From 6aebda9b1e358e6c79416923ada758d99b479d9d Mon Sep 17 00:00:00 2001 From: torredil Date: Tue, 21 Feb 2023 20:37:00 +0000 Subject: [PATCH] Remove AWS legacy cloud provider + EBS in-tree storage plugin Signed-off-by: torredil --- .../vendor/github.com/stretchr/objx/LICENSE | 26 - cluster/addons/storage-class/aws/default.yaml | 11 - cmd/cloud-controller-manager/providers.go | 1 - .../app/plugins_providers.go | 2 - cmd/kubelet/app/plugins_providers.go | 2 - go.mod | 1 - pkg/cloudprovider/providers/providers.go | 1 - .../volume/expand/expand_controller_test.go | 2 - pkg/features/kube_features.go | 10 - .../cadvisor/cadvisor_cloudproviders.go | 1 - pkg/kubelet/kubelet_test.go | 2 - .../plugins/nodevolumelimits/utils.go | 4 +- .../framework/plugins/volumebinding/binder.go | 2 +- pkg/volume/awsebs/OWNERS | 13 - pkg/volume/awsebs/attacher.go | 312 - pkg/volume/awsebs/attacher_linux.go | 29 - pkg/volume/awsebs/attacher_test.go | 293 - pkg/volume/awsebs/attacher_unsupported.go | 26 - pkg/volume/awsebs/attacher_windows.go | 69 - pkg/volume/awsebs/attacher_windows_test.go | 96 - pkg/volume/awsebs/aws_ebs.go | 556 - pkg/volume/awsebs/aws_ebs_block.go | 180 - pkg/volume/awsebs/aws_ebs_block_test.go | 159 - pkg/volume/awsebs/aws_ebs_test.go | 477 - pkg/volume/awsebs/aws_util.go | 342 - pkg/volume/awsebs/doc.go | 19 - pkg/volume/csi/csi_plugin.go | 2 +- pkg/volume/csimigration/plugin_manager.go | 2 +- .../csimigration/plugin_manager_test.go | 43 - .../operation_generator_test.go | 15 +- .../persistentvolume/label/admission.go | 57 +- .../persistentvolume/label/admission_test.go | 247 +- staging/publishing/rules.yaml | 2 - staging/src/k8s.io/cloud-provider/plugins.go | 1 - .../k8s.io/legacy-cloud-providers/aws/OWNERS | 18 - .../k8s.io/legacy-cloud-providers/aws/aws.go | 5099 ---- .../aws/aws_assumerole_provider.go | 62 - .../aws/aws_assumerole_provider_test.go | 133 - .../legacy-cloud-providers/aws/aws_fakes.go | 688 - .../aws/aws_instancegroups.go | 92 - .../aws/aws_loadbalancer.go | 1662 -- .../aws/aws_loadbalancer_test.go | 1081 - .../legacy-cloud-providers/aws/aws_metrics.go | 75 - .../legacy-cloud-providers/aws/aws_routes.go | 222 - .../legacy-cloud-providers/aws/aws_test.go | 3578 --- .../legacy-cloud-providers/aws/aws_utils.go | 48 - .../aws/device_allocator.go | 135 - .../aws/device_allocator_test.go | 84 - .../k8s.io/legacy-cloud-providers/aws/doc.go | 17 - .../legacy-cloud-providers/aws/instances.go | 276 - .../aws/instances_test.go | 204 - .../legacy-cloud-providers/aws/log_handler.go | 51 - .../aws/retry_handler.go | 178 - .../aws/retry_handler_test.go | 138 - .../aws/sets_ippermissions.go | 219 - .../k8s.io/legacy-cloud-providers/aws/tags.go | 315 - .../legacy-cloud-providers/aws/tags_test.go | 235 - .../legacy-cloud-providers/aws/volumes.go | 120 - .../src/k8s.io/legacy-cloud-providers/go.mod | 5 - .../src/k8s.io/legacy-cloud-providers/go.sum | 18 - test/e2e/framework/providers/aws/aws.go | 168 +- test/e2e/storage/drivers/in_tree.go | 65 - .../aws/aws-sdk-go/service/autoscaling/api.go | 20556 ---------------- .../aws/aws-sdk-go/service/autoscaling/doc.go | 33 - .../aws-sdk-go/service/autoscaling/errors.go | 68 - .../aws-sdk-go/service/autoscaling/service.go | 104 - .../aws-sdk-go/service/autoscaling/waiters.go | 163 - .../aws/aws-sdk-go/service/elb/api.go | 7168 ------ .../aws/aws-sdk-go/service/elb/doc.go | 50 - .../aws/aws-sdk-go/service/elb/errors.go | 145 - .../aws/aws-sdk-go/service/elb/service.go | 104 - .../aws/aws-sdk-go/service/elb/waiters.go | 158 - .../aws/aws-sdk-go/service/elbv2/api.go | 10571 -------- .../aws/aws-sdk-go/service/elbv2/doc.go | 54 - .../aws/aws-sdk-go/service/elbv2/errors.go | 235 - .../aws/aws-sdk-go/service/elbv2/service.go | 104 - .../aws/aws-sdk-go/service/elbv2/waiters.go | 270 - .../aws/aws-sdk-go/service/kms/api.go | 19280 --------------- .../aws/aws-sdk-go/service/kms/doc.go | 113 - .../aws/aws-sdk-go/service/kms/errors.go | 376 - .../aws/aws-sdk-go/service/kms/service.go | 109 - .../cadvisor/utils/cloudinfo/aws/aws.go | 78 - .../github.com/stretchr/objx/.codeclimate.yml | 21 - vendor/github.com/stretchr/objx/.gitignore | 11 - vendor/github.com/stretchr/objx/LICENSE | 22 - vendor/github.com/stretchr/objx/README.md | 80 - vendor/github.com/stretchr/objx/Taskfile.yml | 30 - vendor/github.com/stretchr/objx/accessors.go | 197 - .../github.com/stretchr/objx/conversions.go | 280 - vendor/github.com/stretchr/objx/doc.go | 66 - vendor/github.com/stretchr/objx/map.go | 215 - vendor/github.com/stretchr/objx/mutations.go | 77 - vendor/github.com/stretchr/objx/security.go | 12 - vendor/github.com/stretchr/objx/tests.go | 17 - .../github.com/stretchr/objx/type_specific.go | 346 - .../stretchr/objx/type_specific_codegen.go | 2261 -- vendor/github.com/stretchr/objx/value.go | 159 - .../github.com/stretchr/testify/mock/doc.go | 44 - .../github.com/stretchr/testify/mock/mock.go | 1098 - vendor/modules.txt | 10 - 100 files changed, 31 insertions(+), 82645 deletions(-) delete mode 100644 LICENSES/vendor/github.com/stretchr/objx/LICENSE delete mode 100644 cluster/addons/storage-class/aws/default.yaml delete mode 100644 pkg/volume/awsebs/OWNERS delete mode 100644 pkg/volume/awsebs/attacher.go delete mode 100644 pkg/volume/awsebs/attacher_linux.go delete mode 100644 pkg/volume/awsebs/attacher_test.go delete mode 100644 pkg/volume/awsebs/attacher_unsupported.go delete mode 100644 pkg/volume/awsebs/attacher_windows.go delete mode 100644 pkg/volume/awsebs/attacher_windows_test.go delete mode 100644 pkg/volume/awsebs/aws_ebs.go delete mode 100644 pkg/volume/awsebs/aws_ebs_block.go delete mode 100644 pkg/volume/awsebs/aws_ebs_block_test.go delete mode 100644 pkg/volume/awsebs/aws_ebs_test.go delete mode 100644 pkg/volume/awsebs/aws_util.go delete mode 100644 pkg/volume/awsebs/doc.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/OWNERS delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider_test.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_fakes.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_instancegroups.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer_test.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_metrics.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_routes.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/aws_utils.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator_test.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/doc.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/instances.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/instances_test.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/log_handler.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler_test.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/sets_ippermissions.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/tags.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/tags_test.go delete mode 100644 staging/src/k8s.io/legacy-cloud-providers/aws/volumes.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/api.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/service.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/kms/api.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/kms/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/kms/errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/kms/service.go delete mode 100644 vendor/github.com/google/cadvisor/utils/cloudinfo/aws/aws.go delete mode 100644 vendor/github.com/stretchr/objx/.codeclimate.yml delete mode 100644 vendor/github.com/stretchr/objx/.gitignore delete mode 100644 vendor/github.com/stretchr/objx/LICENSE delete mode 100644 vendor/github.com/stretchr/objx/README.md delete mode 100644 vendor/github.com/stretchr/objx/Taskfile.yml delete mode 100644 vendor/github.com/stretchr/objx/accessors.go delete mode 100644 vendor/github.com/stretchr/objx/conversions.go delete mode 100644 vendor/github.com/stretchr/objx/doc.go delete mode 100644 vendor/github.com/stretchr/objx/map.go delete mode 100644 vendor/github.com/stretchr/objx/mutations.go delete mode 100644 vendor/github.com/stretchr/objx/security.go delete mode 100644 vendor/github.com/stretchr/objx/tests.go delete mode 100644 vendor/github.com/stretchr/objx/type_specific.go delete mode 100644 vendor/github.com/stretchr/objx/type_specific_codegen.go delete mode 100644 vendor/github.com/stretchr/objx/value.go delete mode 100644 vendor/github.com/stretchr/testify/mock/doc.go delete mode 100644 vendor/github.com/stretchr/testify/mock/mock.go diff --git a/LICENSES/vendor/github.com/stretchr/objx/LICENSE b/LICENSES/vendor/github.com/stretchr/objx/LICENSE deleted file mode 100644 index 420e4cf6d71..00000000000 --- a/LICENSES/vendor/github.com/stretchr/objx/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -= vendor/github.com/stretchr/objx licensed under: = - -The MIT License - -Copyright (c) 2014 Stretchr, Inc. -Copyright (c) 2017-2018 objx contributors - -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. - -= vendor/github.com/stretchr/objx/LICENSE d023fd31d3ca39ec61eec65a91732735 diff --git a/cluster/addons/storage-class/aws/default.yaml b/cluster/addons/storage-class/aws/default.yaml deleted file mode 100644 index c5a7d0a231f..00000000000 --- a/cluster/addons/storage-class/aws/default.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: gp2 - annotations: - storageclass.kubernetes.io/is-default-class: "true" - labels: - addonmanager.kubernetes.io/mode: EnsureExists -provisioner: kubernetes.io/aws-ebs -parameters: - type: gp2 diff --git a/cmd/cloud-controller-manager/providers.go b/cmd/cloud-controller-manager/providers.go index b75e7b07cbe..6c6bb338305 100644 --- a/cmd/cloud-controller-manager/providers.go +++ b/cmd/cloud-controller-manager/providers.go @@ -25,7 +25,6 @@ package main import ( // NOTE: Importing all in-tree cloud-providers is not required when // implementing an out-of-tree cloud-provider. - _ "k8s.io/legacy-cloud-providers/aws" _ "k8s.io/legacy-cloud-providers/azure" _ "k8s.io/legacy-cloud-providers/gce" _ "k8s.io/legacy-cloud-providers/vsphere" diff --git a/cmd/kube-controller-manager/app/plugins_providers.go b/cmd/kube-controller-manager/app/plugins_providers.go index 8b7d66d2f86..0198eeae15f 100644 --- a/cmd/kube-controller-manager/app/plugins_providers.go +++ b/cmd/kube-controller-manager/app/plugins_providers.go @@ -25,7 +25,6 @@ import ( "k8s.io/klog/v2" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/awsebs" "k8s.io/kubernetes/pkg/volume/azure_file" "k8s.io/kubernetes/pkg/volume/azuredd" "k8s.io/kubernetes/pkg/volume/csimigration" @@ -63,7 +62,6 @@ type pluginInfo struct { func appendAttachableLegacyProviderVolumes(allPlugins []volume.VolumePlugin, featureGate featuregate.FeatureGate) ([]volume.VolumePlugin, error) { pluginMigrationStatus := make(map[string]pluginInfo) - pluginMigrationStatus[plugins.AWSEBSInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationAWS, pluginUnregisterFeature: features.InTreePluginAWSUnregister, pluginProbeFunction: awsebs.ProbeVolumePlugins} pluginMigrationStatus[plugins.GCEPDInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationGCE, pluginUnregisterFeature: features.InTreePluginGCEUnregister, pluginProbeFunction: gcepd.ProbeVolumePlugins} pluginMigrationStatus[plugins.AzureDiskInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationAzureDisk, pluginUnregisterFeature: features.InTreePluginAzureDiskUnregister, pluginProbeFunction: azuredd.ProbeVolumePlugins} pluginMigrationStatus[plugins.VSphereInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationvSphere, pluginUnregisterFeature: features.InTreePluginvSphereUnregister, pluginProbeFunction: vsphere_volume.ProbeVolumePlugins} diff --git a/cmd/kubelet/app/plugins_providers.go b/cmd/kubelet/app/plugins_providers.go index 26e408e3dbe..1948009f03f 100644 --- a/cmd/kubelet/app/plugins_providers.go +++ b/cmd/kubelet/app/plugins_providers.go @@ -30,7 +30,6 @@ import ( "k8s.io/klog/v2" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/awsebs" "k8s.io/kubernetes/pkg/volume/azure_file" "k8s.io/kubernetes/pkg/volume/azuredd" "k8s.io/kubernetes/pkg/volume/csimigration" @@ -69,7 +68,6 @@ type pluginInfo struct { func appendLegacyProviderVolumes(allPlugins []volume.VolumePlugin, featureGate featuregate.FeatureGate) ([]volume.VolumePlugin, error) { pluginMigrationStatus := make(map[string]pluginInfo) - pluginMigrationStatus[plugins.AWSEBSInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationAWS, pluginUnregisterFeature: features.InTreePluginAWSUnregister, pluginProbeFunction: awsebs.ProbeVolumePlugins} pluginMigrationStatus[plugins.GCEPDInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationGCE, pluginUnregisterFeature: features.InTreePluginGCEUnregister, pluginProbeFunction: gcepd.ProbeVolumePlugins} pluginMigrationStatus[plugins.AzureDiskInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationAzureDisk, pluginUnregisterFeature: features.InTreePluginAzureDiskUnregister, pluginProbeFunction: azuredd.ProbeVolumePlugins} pluginMigrationStatus[plugins.AzureFileInTreePluginName] = pluginInfo{pluginMigrationFeature: features.CSIMigrationAzureFile, pluginUnregisterFeature: features.InTreePluginAzureFileUnregister, pluginProbeFunction: azure_file.ProbeVolumePlugins} diff --git a/go.mod b/go.mod index 2bde38773d1..98055e8a64d 100644 --- a/go.mod +++ b/go.mod @@ -213,7 +213,6 @@ require ( github.com/sirupsen/logrus v1.9.0 // indirect github.com/soheilhy/cmux v0.1.5 // indirect github.com/stoewer/go-strcase v1.2.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 // indirect github.com/vishvananda/netns v0.0.2 // indirect diff --git a/pkg/cloudprovider/providers/providers.go b/pkg/cloudprovider/providers/providers.go index dda8b56585f..d0cff351a43 100644 --- a/pkg/cloudprovider/providers/providers.go +++ b/pkg/cloudprovider/providers/providers.go @@ -21,7 +21,6 @@ package cloudprovider import ( // Cloud providers - _ "k8s.io/legacy-cloud-providers/aws" _ "k8s.io/legacy-cloud-providers/azure" _ "k8s.io/legacy-cloud-providers/gce" _ "k8s.io/legacy-cloud-providers/vsphere" diff --git a/pkg/controller/volume/expand/expand_controller_test.go b/pkg/controller/volume/expand/expand_controller_test.go index 38ac353dac2..2b21e5e49ba 100644 --- a/pkg/controller/volume/expand/expand_controller_test.go +++ b/pkg/controller/volume/expand/expand_controller_test.go @@ -38,7 +38,6 @@ import ( "k8s.io/kubernetes/pkg/controller" controllervolumetesting "k8s.io/kubernetes/pkg/controller/volume/attachdetach/testing" "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/awsebs" "k8s.io/kubernetes/pkg/volume/csimigration" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/operationexecutor" @@ -107,7 +106,6 @@ func TestSyncHandler(t *testing.T) { informerFactory.Core().V1().PersistentVolumeClaims().Informer().GetIndexer().Add(pvc) } allPlugins := []volume.VolumePlugin{} - allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...) translator := csitrans.New() expc, err := NewExpandController(fakeKubeClient, pvcInformer, pvInformer, nil, allPlugins, translator, csimigration.NewPluginManager(translator, utilfeature.DefaultFeatureGate), nil) if err != nil { diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index 7f57eb5a326..687703037ee 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -108,14 +108,6 @@ const ( // Allow the usage of options to fine-tune the cpumanager policies. CPUManagerPolicyOptions featuregate.Feature = "CPUManagerPolicyOptions" - // owner: @leakingtapan - // alpha: v1.14 - // beta: v1.17 - // GA: v1.25 - // - // Enables the AWS EBS in-tree driver to AWS EBS CSI Driver migration feature. - CSIMigrationAWS featuregate.Feature = "CSIMigrationAWS" - // owner: @andyzhangx // alpha: v1.15 // beta: v1.19 @@ -885,8 +877,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS CPUManagerPolicyOptions: {Default: true, PreRelease: featuregate.Beta}, - CSIMigrationAWS: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.27 - CSIMigrationAzureDisk: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26 CSIMigrationAzureFile: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.28 diff --git a/pkg/kubelet/cadvisor/cadvisor_cloudproviders.go b/pkg/kubelet/cadvisor/cadvisor_cloudproviders.go index 5ec414694d3..f9685f6fa81 100644 --- a/pkg/kubelet/cadvisor/cadvisor_cloudproviders.go +++ b/pkg/kubelet/cadvisor/cadvisor_cloudproviders.go @@ -22,7 +22,6 @@ package cadvisor import ( // Register cloud info providers. // TODO(#68522): Remove this in 1.20+ once the cAdvisor endpoints are removed. - _ "github.com/google/cadvisor/utils/cloudinfo/aws" _ "github.com/google/cadvisor/utils/cloudinfo/azure" _ "github.com/google/cadvisor/utils/cloudinfo/gce" ) diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index 5b06f84104c..23f6ec74739 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -92,7 +92,6 @@ import ( schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework" "k8s.io/kubernetes/pkg/util/oom" "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/awsebs" "k8s.io/kubernetes/pkg/volume/azuredd" "k8s.io/kubernetes/pkg/volume/gcepd" _ "k8s.io/kubernetes/pkg/volume/hostpath" @@ -368,7 +367,6 @@ func newTestKubeletWithImageList( if initFakeVolumePlugin { allPlugins = append(allPlugins, plug) } else { - allPlugins = append(allPlugins, awsebs.ProbeVolumePlugins()...) allPlugins = append(allPlugins, gcepd.ProbeVolumePlugins()...) allPlugins = append(allPlugins, azuredd.ProbeVolumePlugins()...) } diff --git a/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go b/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go index 79d625e17c2..7047e731c00 100644 --- a/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go +++ b/pkg/scheduler/framework/plugins/nodevolumelimits/utils.go @@ -40,9 +40,7 @@ func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string) bool { // along with the plugin-specific one switch pluginName { case csilibplugins.AWSEBSInTreePluginName: - if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAWS) { - return false - } + return true case csilibplugins.PortworxVolumePluginName: if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx) { return false diff --git a/pkg/scheduler/framework/plugins/volumebinding/binder.go b/pkg/scheduler/framework/plugins/volumebinding/binder.go index 27db6594dbf..3311ecc446c 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/binder.go +++ b/pkg/scheduler/framework/plugins/volumebinding/binder.go @@ -1086,7 +1086,7 @@ func (a byPVCSize) Less(i, j int) bool { func isCSIMigrationOnForPlugin(pluginName string) bool { switch pluginName { case csiplugins.AWSEBSInTreePluginName: - return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAWS) + return true case csiplugins.GCEPDInTreePluginName: return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationGCE) case csiplugins.AzureDiskInTreePluginName: diff --git a/pkg/volume/awsebs/OWNERS b/pkg/volume/awsebs/OWNERS deleted file mode 100644 index 746c74a7a6a..00000000000 --- a/pkg/volume/awsebs/OWNERS +++ /dev/null @@ -1,13 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: - - gnufied - - jingxu97 - - jsafrane - - justinsb -reviewers: - - gnufied - - jingxu97 - - justinsb - - jsafrane - - saad-ali diff --git a/pkg/volume/awsebs/attacher.go b/pkg/volume/awsebs/attacher.go deleted file mode 100644 index aa729933910..00000000000 --- a/pkg/volume/awsebs/attacher.go +++ /dev/null @@ -1,312 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "fmt" - "os" - "path" - "path/filepath" - "runtime" - "strconv" - "time" - - "k8s.io/klog/v2" - "k8s.io/mount-utils" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/volume" - volumeutil "k8s.io/kubernetes/pkg/volume/util" - "k8s.io/legacy-cloud-providers/aws" -) - -type awsElasticBlockStoreAttacher struct { - host volume.VolumeHost - awsVolumes aws.Volumes -} - -var _ volume.Attacher = &awsElasticBlockStoreAttacher{} - -var _ volume.DeviceMounter = &awsElasticBlockStoreAttacher{} - -var _ volume.AttachableVolumePlugin = &awsElasticBlockStorePlugin{} - -var _ volume.DeviceMountableVolumePlugin = &awsElasticBlockStorePlugin{} - -func (plugin *awsElasticBlockStorePlugin) NewAttacher() (volume.Attacher, error) { - awsCloud, err := getCloudProvider(plugin.host.GetCloudProvider()) - if err != nil { - return nil, err - } - - return &awsElasticBlockStoreAttacher{ - host: plugin.host, - awsVolumes: awsCloud, - }, nil -} - -func (plugin *awsElasticBlockStorePlugin) NewDeviceMounter() (volume.DeviceMounter, error) { - return plugin.NewAttacher() -} - -func (plugin *awsElasticBlockStorePlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, error) { - mounter := plugin.host.GetMounter(plugin.GetPluginName()) - return mounter.GetMountRefs(deviceMountPath) -} - -func (attacher *awsElasticBlockStoreAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string, error) { - volumeSource, _, err := getVolumeSource(spec) - if err != nil { - return "", err - } - - volumeID := aws.KubernetesVolumeID(volumeSource.VolumeID) - - // awsCloud.AttachDisk checks if disk is already attached to node and - // succeeds in that case, so no need to do that separately. - devicePath, err := attacher.awsVolumes.AttachDisk(volumeID, nodeName) - if err != nil { - klog.Errorf("Error attaching volume %q to node %q: %+v", volumeID, nodeName, err) - return "", err - } - - return devicePath, nil -} - -func (attacher *awsElasticBlockStoreAttacher) VolumesAreAttached(specs []*volume.Spec, nodeName types.NodeName) (map[*volume.Spec]bool, error) { - - klog.Warningf("Attacher.VolumesAreAttached called for node %q - Please use BulkVerifyVolumes for AWS", nodeName) - volumeNodeMap := map[types.NodeName][]*volume.Spec{ - nodeName: specs, - } - nodeVolumesResult := make(map[*volume.Spec]bool) - nodesVerificationMap, err := attacher.BulkVerifyVolumes(volumeNodeMap) - if err != nil { - klog.Errorf("Attacher.VolumesAreAttached - error checking volumes for node %q with %v", nodeName, err) - return nodeVolumesResult, err - } - - if result, ok := nodesVerificationMap[nodeName]; ok { - return result, nil - } - return nodeVolumesResult, nil -} - -func (attacher *awsElasticBlockStoreAttacher) BulkVerifyVolumes(volumesByNode map[types.NodeName][]*volume.Spec) (map[types.NodeName]map[*volume.Spec]bool, error) { - volumesAttachedCheck := make(map[types.NodeName]map[*volume.Spec]bool) - diskNamesByNode := make(map[types.NodeName][]aws.KubernetesVolumeID) - volumeSpecMap := make(map[aws.KubernetesVolumeID]*volume.Spec) - - for nodeName, volumeSpecs := range volumesByNode { - for _, volumeSpec := range volumeSpecs { - volumeSource, _, err := getVolumeSource(volumeSpec) - - if err != nil { - klog.Errorf("Error getting volume (%q) source : %v", volumeSpec.Name(), err) - continue - } - - name := aws.KubernetesVolumeID(volumeSource.VolumeID) - diskNamesByNode[nodeName] = append(diskNamesByNode[nodeName], name) - - nodeDisk, nodeDiskExists := volumesAttachedCheck[nodeName] - - if !nodeDiskExists { - nodeDisk = make(map[*volume.Spec]bool) - } - nodeDisk[volumeSpec] = true - volumeSpecMap[name] = volumeSpec - volumesAttachedCheck[nodeName] = nodeDisk - } - } - attachedResult, err := attacher.awsVolumes.DisksAreAttached(diskNamesByNode) - - if err != nil { - klog.Errorf("Error checking if volumes are attached to nodes err = %v", err) - return volumesAttachedCheck, err - } - - for nodeName, nodeDisks := range attachedResult { - for diskName, attached := range nodeDisks { - if !attached { - spec := volumeSpecMap[diskName] - setNodeDisk(volumesAttachedCheck, spec, nodeName, false) - } - } - } - - return volumesAttachedCheck, nil -} - -func (attacher *awsElasticBlockStoreAttacher) WaitForAttach(spec *volume.Spec, devicePath string, _ *v1.Pod, timeout time.Duration) (string, error) { - volumeSource, _, err := getVolumeSource(spec) - if err != nil { - return "", err - } - - volumeID := volumeSource.VolumeID - partition := "" - if volumeSource.Partition != 0 { - partition = strconv.Itoa(int(volumeSource.Partition)) - } - - if devicePath == "" { - return "", fmt.Errorf("waitForAttach failed for AWS Volume %q: devicePath is empty", volumeID) - } - - ticker := time.NewTicker(checkSleepDuration) - defer ticker.Stop() - timer := time.NewTimer(timeout) - defer timer.Stop() - - for { - select { - case <-ticker.C: - klog.V(5).Infof("Checking AWS Volume %q is attached at devicePath %q.", volumeID, devicePath) - path, err := attacher.getDevicePath(volumeSource.VolumeID, partition, devicePath) - if err != nil { - // Log error, if any, and continue checking periodically. See issue #11321 - klog.Errorf("Error verifying AWS Volume (%q) is attached at devicePath %q: %v", volumeID, devicePath, err) - } else if path != "" { - // A device path has successfully been created for the PD - klog.Infof("Successfully found attached AWS Volume %q at path %q.", volumeID, path) - return path, nil - } - case <-timer.C: - return "", fmt.Errorf("could not find attached AWS Volume %q. Timeout waiting for mount paths to be created", volumeID) - } - } -} - -func (attacher *awsElasticBlockStoreAttacher) GetDeviceMountPath( - spec *volume.Spec) (string, error) { - volumeSource, _, err := getVolumeSource(spec) - if err != nil { - return "", err - } - - return makeGlobalPDPath(attacher.host, aws.KubernetesVolumeID(volumeSource.VolumeID)), nil -} - -// FIXME: this method can be further pruned. -func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string, _ volume.DeviceMounterArgs) error { - mounter := attacher.host.GetMounter(awsElasticBlockStorePluginName) - notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) - if err != nil { - if !os.IsNotExist(err) { - return err - } - dir := deviceMountPath - if runtime.GOOS == "windows" { - // On Windows, FormatAndMount will mklink (create a symbolic link) at deviceMountPath later, so don't create a - // directory at deviceMountPath now. Otherwise mklink will error: "Cannot create a file when that file already exists". - // Instead, create the parent of deviceMountPath. For example when deviceMountPath is: - // C:\var\lib\kubelet\plugins\kubernetes.io\aws-ebs\mounts\aws\us-west-2b\vol-xxx - // create us-west-2b. FormatAndMount will make vol-xxx a symlink to the drive (e.g. D:\) - dir = filepath.Dir(deviceMountPath) - } - if err := os.MkdirAll(dir, 0750); err != nil { - return fmt.Errorf("making dir %s failed with %s", dir, err) - } - notMnt = true - } - - volumeSource, readOnly, err := getVolumeSource(spec) - if err != nil { - return err - } - - var options []string - if readOnly { - options = append(options, "ro") - } - if notMnt { - diskMounter := volumeutil.NewSafeFormatAndMountFromHost(awsElasticBlockStorePluginName, attacher.host) - mountOptions := volumeutil.MountOptionFromSpec(spec, options...) - err = diskMounter.FormatAndMount(devicePath, deviceMountPath, volumeSource.FSType, mountOptions) - if err != nil { - os.Remove(deviceMountPath) - return err - } - } - return nil -} - -type awsElasticBlockStoreDetacher struct { - mounter mount.Interface - awsVolumes aws.Volumes -} - -var _ volume.Detacher = &awsElasticBlockStoreDetacher{} - -var _ volume.DeviceUnmounter = &awsElasticBlockStoreDetacher{} - -func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error) { - awsCloud, err := getCloudProvider(plugin.host.GetCloudProvider()) - if err != nil { - return nil, err - } - - return &awsElasticBlockStoreDetacher{ - mounter: plugin.host.GetMounter(plugin.GetPluginName()), - awsVolumes: awsCloud, - }, nil -} - -func (plugin *awsElasticBlockStorePlugin) NewDeviceUnmounter() (volume.DeviceUnmounter, error) { - return plugin.NewDetacher() -} - -func (detacher *awsElasticBlockStoreDetacher) Detach(volumeName string, nodeName types.NodeName) error { - volumeID := aws.KubernetesVolumeID(path.Base(volumeName)) - - if _, err := detacher.awsVolumes.DetachDisk(volumeID, nodeName); err != nil { - klog.Errorf("Error detaching volumeID %q: %v", volumeID, err) - return err - } - return nil -} - -func (detacher *awsElasticBlockStoreDetacher) UnmountDevice(deviceMountPath string) error { - return mount.CleanupMountPoint(deviceMountPath, detacher.mounter, false) -} - -func (plugin *awsElasticBlockStorePlugin) CanAttach(spec *volume.Spec) (bool, error) { - return true, nil -} - -func (plugin *awsElasticBlockStorePlugin) CanDeviceMount(spec *volume.Spec) (bool, error) { - return true, nil -} - -func setNodeDisk( - nodeDiskMap map[types.NodeName]map[*volume.Spec]bool, - volumeSpec *volume.Spec, - nodeName types.NodeName, - check bool) { - - volumeMap := nodeDiskMap[nodeName] - if volumeMap == nil { - volumeMap = make(map[*volume.Spec]bool) - nodeDiskMap[nodeName] = volumeMap - } - volumeMap[volumeSpec] = check -} diff --git a/pkg/volume/awsebs/attacher_linux.go b/pkg/volume/awsebs/attacher_linux.go deleted file mode 100644 index 450d2f0a5f4..00000000000 --- a/pkg/volume/awsebs/attacher_linux.go +++ /dev/null @@ -1,29 +0,0 @@ -//go:build !providerless && linux -// +build !providerless,linux - -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "k8s.io/legacy-cloud-providers/aws" -) - -func (attacher *awsElasticBlockStoreAttacher) getDevicePath(volumeID, partition, devicePath string) (string, error) { - devicePaths := getDiskByIDPaths(aws.KubernetesVolumeID(volumeID), partition, devicePath) - return verifyDevicePath(devicePaths) -} diff --git a/pkg/volume/awsebs/attacher_test.go b/pkg/volume/awsebs/attacher_test.go deleted file mode 100644 index 9dd44e09799..00000000000 --- a/pkg/volume/awsebs/attacher_test.go +++ /dev/null @@ -1,293 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "errors" - "os" - "testing" - - "k8s.io/klog/v2" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/volume" - volumetest "k8s.io/kubernetes/pkg/volume/testing" - "k8s.io/legacy-cloud-providers/aws" -) - -func TestGetVolumeName_Volume(t *testing.T) { - plugin := newPlugin(t) - name := aws.KubernetesVolumeID("my-aws-volume") - spec := createVolSpec(name, false) - - volumeName, err := plugin.GetVolumeName(spec) - if err != nil { - t.Errorf("GetVolumeName error: %v", err) - } - if volumeName != string(name) { - t.Errorf("GetVolumeName error: expected %s, got %s", name, volumeName) - } -} - -func TestGetVolumeName_PersistentVolume(t *testing.T) { - plugin := newPlugin(t) - name := aws.KubernetesVolumeID("my-aws-pv") - spec := createPVSpec(name, true) - - volumeName, err := plugin.GetVolumeName(spec) - if err != nil { - t.Errorf("GetVolumeName error: %v", err) - } - if volumeName != string(name) { - t.Errorf("GetVolumeName error: expected %s, got %s", name, volumeName) - } -} - -// One testcase for TestAttachDetach table test below -type testcase struct { - name string - // For fake AWS: - attach attachCall - detach detachCall - t *testing.T - - // Actual test to run - test func(test *testcase) (string, error) - // Expected return of the test - expectedDevice string - expectedError error -} - -func TestAttachDetach(t *testing.T) { - diskName := aws.KubernetesVolumeID("disk") - nodeName := types.NodeName("instance") - spec := createVolSpec(diskName, false) - attachError := errors.New("fake attach error") - detachError := errors.New("fake detach error") - tests := []testcase{ - // Successful Attach call - { - name: "Attach_Positive", - attach: attachCall{diskName, nodeName, "/dev/sda", nil}, - test: func(testcase *testcase) (string, error) { - attacher := newAttacher(testcase) - return attacher.Attach(spec, nodeName) - }, - expectedDevice: "/dev/sda", - }, - - // Attach call fails - { - name: "Attach_Negative", - attach: attachCall{diskName, nodeName, "", attachError}, - test: func(testcase *testcase) (string, error) { - attacher := newAttacher(testcase) - return attacher.Attach(spec, nodeName) - }, - expectedError: attachError, - }, - - // Detach succeeds - { - name: "Detach_Positive", - detach: detachCall{diskName, nodeName, "/dev/sda", nil}, - test: func(testcase *testcase) (string, error) { - detacher := newDetacher(testcase) - mountPath := "/mnt/" + string(diskName) - return "", detacher.Detach(mountPath, nodeName) - }, - }, - // Detach fails - { - name: "Detach_Negative", - detach: detachCall{diskName, nodeName, "", detachError}, - test: func(testcase *testcase) (string, error) { - detacher := newDetacher(testcase) - mountPath := "/mnt/" + string(diskName) - return "", detacher.Detach(mountPath, nodeName) - }, - expectedError: detachError, - }, - } - - for _, testcase := range tests { - t.Run(testcase.name, func(t *testing.T) { - testcase.t = t - device, err := testcase.test(&testcase) - if err != testcase.expectedError { - t.Errorf("failed: expected err=%q, got %q", testcase.expectedError.Error(), err.Error()) - } - if device != testcase.expectedDevice { - t.Errorf("failed: expected device=%q, got %q", testcase.expectedDevice, device) - } - }) - } -} - -// newPlugin creates a new gcePersistentDiskPlugin with fake cloud, NewAttacher -// and NewDetacher won't work. -func newPlugin(t *testing.T) *awsElasticBlockStorePlugin { - host := volumetest.NewFakeVolumeHost(t, os.TempDir(), nil, nil) - plugins := ProbeVolumePlugins() - plugin := plugins[0] - plugin.Init(host) - return plugin.(*awsElasticBlockStorePlugin) -} - -func newAttacher(testcase *testcase) *awsElasticBlockStoreAttacher { - return &awsElasticBlockStoreAttacher{ - host: nil, - awsVolumes: testcase, - } -} - -func newDetacher(testcase *testcase) *awsElasticBlockStoreDetacher { - return &awsElasticBlockStoreDetacher{ - awsVolumes: testcase, - } -} - -func createVolSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec { - return &volume.Spec{ - Volume: &v1.Volume{ - VolumeSource: v1.VolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: string(name), - ReadOnly: readOnly, - }, - }, - }, - } -} - -func createPVSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec { - return &volume.Spec{ - PersistentVolume: &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: string(name), - ReadOnly: readOnly, - }, - }, - }, - }, - } -} - -// Fake AWS implementation - -type attachCall struct { - diskName aws.KubernetesVolumeID - nodeName types.NodeName - retDeviceName string - ret error -} - -type detachCall struct { - diskName aws.KubernetesVolumeID - nodeName types.NodeName - retDeviceName string - ret error -} - -func (testcase *testcase) AttachDisk(diskName aws.KubernetesVolumeID, nodeName types.NodeName) (string, error) { - expected := &testcase.attach - - if expected.diskName == "" && expected.nodeName == "" { - // testcase.attach looks uninitialized, test did not expect to call - // AttachDisk - testcase.t.Errorf("Unexpected AttachDisk call!") - return "", errors.New("unexpected AttachDisk call") - } - - if expected.diskName != diskName { - testcase.t.Errorf("Unexpected AttachDisk call: expected diskName %s, got %s", expected.diskName, diskName) - return "", errors.New("unexpected AttachDisk call: wrong diskName") - } - - if expected.nodeName != nodeName { - testcase.t.Errorf("Unexpected AttachDisk call: expected nodeName %s, got %s", expected.nodeName, nodeName) - return "", errors.New("unexpected AttachDisk call: wrong nodeName") - } - - klog.V(4).Infof("AttachDisk call: %s, %s, returning %q, %v", diskName, nodeName, expected.retDeviceName, expected.ret) - - return expected.retDeviceName, expected.ret -} - -func (testcase *testcase) DetachDisk(diskName aws.KubernetesVolumeID, nodeName types.NodeName) (string, error) { - expected := &testcase.detach - - if expected.diskName == "" && expected.nodeName == "" { - // testcase.detach looks uninitialized, test did not expect to call - // DetachDisk - testcase.t.Errorf("Unexpected DetachDisk call!") - return "", errors.New("unexpected DetachDisk call") - } - - if expected.diskName != diskName { - testcase.t.Errorf("Unexpected DetachDisk call: expected diskName %s, got %s", expected.diskName, diskName) - return "", errors.New("unexpected DetachDisk call: wrong diskName") - } - - if expected.nodeName != nodeName { - testcase.t.Errorf("Unexpected DetachDisk call: expected nodeName %s, got %s", expected.nodeName, nodeName) - return "", errors.New("unexpected DetachDisk call: wrong nodeName") - } - - klog.V(4).Infof("DetachDisk call: %s, %s, returning %q, %v", diskName, nodeName, expected.retDeviceName, expected.ret) - - return expected.retDeviceName, expected.ret -} - -func (testcase *testcase) DiskIsAttached(diskName aws.KubernetesVolumeID, nodeName types.NodeName) (bool, error) { - // DetachDisk no longer relies on DiskIsAttached api call - return false, nil -} - -func (testcase *testcase) DisksAreAttached(nodeDisks map[types.NodeName][]aws.KubernetesVolumeID) (map[types.NodeName]map[aws.KubernetesVolumeID]bool, error) { - return nil, errors.New("not implemented") -} - -func (testcase *testcase) CreateDisk(volumeOptions *aws.VolumeOptions) (volumeName aws.KubernetesVolumeID, err error) { - return "", errors.New("not implemented") -} - -func (testcase *testcase) DeleteDisk(volumeName aws.KubernetesVolumeID) (bool, error) { - return false, errors.New("not implemented") -} - -func (testcase *testcase) GetVolumeLabels(volumeName aws.KubernetesVolumeID) (map[string]string, error) { - return map[string]string{}, errors.New("not implemented") -} - -func (testcase *testcase) GetDiskPath(volumeName aws.KubernetesVolumeID) (string, error) { - return "", errors.New("not implemented") -} - -func (testcase *testcase) ResizeDisk( - volumeName aws.KubernetesVolumeID, - oldSize resource.Quantity, - newSize resource.Quantity) (resource.Quantity, error) { - return oldSize, errors.New("not implemented") -} diff --git a/pkg/volume/awsebs/attacher_unsupported.go b/pkg/volume/awsebs/attacher_unsupported.go deleted file mode 100644 index c0a3de1c812..00000000000 --- a/pkg/volume/awsebs/attacher_unsupported.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build !providerless && !linux && !windows -// +build !providerless,!linux,!windows - -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import "errors" - -func (attacher *awsElasticBlockStoreAttacher) getDevicePath(volumeID, partition, devicePath string) (string, error) { - return "", errors.New("unsupported") -} diff --git a/pkg/volume/awsebs/attacher_windows.go b/pkg/volume/awsebs/attacher_windows.go deleted file mode 100644 index c24b28fdc2a..00000000000 --- a/pkg/volume/awsebs/attacher_windows.go +++ /dev/null @@ -1,69 +0,0 @@ -//go:build !providerless && windows -// +build !providerless,windows - -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "fmt" - "regexp" - "strings" -) - -// ebsnvme-id is present on AWS-provided Windows Server AMIs -// https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/nvme-ebs-volumes.html#identify-nvme-ebs-device -const ebsnvmeID = `C:\ProgramData\Amazon\Tools\ebsnvme-id.exe` - -func (attacher *awsElasticBlockStoreAttacher) getDevicePath(volumeID, partition, devicePath string) (string, error) { - return attacher.getDiskNumber(volumeID) -} - -// getDiskNumber gets the Windows disk number for a given volume ID. The disk number is needed for mounting. -// TODO This only works for Nitro-based instances -// TODO fallback to Get-Disk -func (attacher *awsElasticBlockStoreAttacher) getDiskNumber(volumeID string) (string, error) { - // Split the ID from zone: aws://us-west-2b/vol-06d0909eb358b05f9 - split := strings.Split(volumeID, "/") - volumeID = split[len(split)-1] - - exec := attacher.host.GetExec(awsElasticBlockStorePluginName) - output, err := exec.Command(ebsnvmeID).CombinedOutput() - if err != nil { - return "", fmt.Errorf("error calling ebsnvme-id.exe: %v", err) - } - // ebsnvme-id.exe will output a list of disks in this format: - // ``` - // Disk Number: 1 - // Volume ID: vol-06d0909eb358b05f9 - // Device Name: /dev/xvdch - // ``` - // Don't try to match devicePath against "Device Name" not only because volume ID is sufficient, - // but because devicePath may change between Linux & Windows formats between WaitForAttach calls. - // The first attach and mount, WaitForAttach gets devicePath as the Linux format /dev/xvdch. Then - // WaitForAttach returns the disk number as the "right" devicePath and that is persisted to ASW. - // In subsequent mounts of the same disk, WaitForAttach gets devicePath as the Windows format it - // returned the first time. - diskRe := regexp.MustCompile( - `Disk Number: (\d+)\s*` + - `Volume ID: ` + volumeID + `\s*`) - matches := diskRe.FindStringSubmatch(string(output)) - if len(matches) != 2 { - return "", fmt.Errorf("disk not found in ebsnvme-id.exe output: %q", string(output)) - } - return matches[1], nil -} diff --git a/pkg/volume/awsebs/attacher_windows_test.go b/pkg/volume/awsebs/attacher_windows_test.go deleted file mode 100644 index b27fbaab827..00000000000 --- a/pkg/volume/awsebs/attacher_windows_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build !providerless && windows -// +build !providerless,windows - -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "errors" - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - volumetest "k8s.io/kubernetes/pkg/volume/testing" - "k8s.io/utils/exec" - exectest "k8s.io/utils/exec/testing" -) - -func TestGetDevicePath(t *testing.T) { - testCases := []struct { - commandOutput string - commandError error - expectedOutput string - expectedError bool - expectedErrMsg string - }{ - { - commandOutput: "", - commandError: errors.New("expected error."), - expectedError: true, - expectedErrMsg: "error calling ebsnvme-id.exe: expected error.", - }, - { - commandOutput: "foolish output.", - expectedError: true, - expectedErrMsg: `disk not found in ebsnvme-id.exe output: "foolish output."`, - }, - { - commandOutput: "Disk Number: 42\nVolume ID: vol-fake-id", - expectedOutput: "42", - }, - } - - fakeHost := volumetest.NewFakeVolumeHost(t, os.TempDir(), nil, nil) - fakeExec := fakeHost.GetExec("").(*exectest.FakeExec) - - // This will enable fakeExec to "run" commands. - fakeExec.DisableScripts = false - attacher := &awsElasticBlockStoreAttacher{ - host: fakeHost, - } - - for _, tc := range testCases { - fakeCmd := &exectest.FakeCmd{ - CombinedOutputScript: []exectest.FakeAction{ - func() ([]byte, []byte, error) { - return []byte(tc.commandOutput), []byte(""), tc.commandError - }, - }, - } - fakeExec.CommandScript = []exectest.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { - return fakeCmd - }, - } - fakeExec.CommandCalls = 0 - - fakeVolID := "aws://us-west-2b/vol-fake-id" - devPath, err := attacher.getDevicePath(fakeVolID, "fake-partition", "fake-device-path") - if tc.expectedError { - if err == nil || err.Error() != tc.expectedErrMsg { - t.Errorf("expected error message `%s` but got `%v`", tc.expectedErrMsg, err) - } - continue - } - - require.NoError(t, err) - assert.Equal(t, tc.expectedOutput, devPath) - } -} diff --git a/pkg/volume/awsebs/aws_ebs.go b/pkg/volume/awsebs/aws_ebs.go deleted file mode 100644 index 0801982ffcd..00000000000 --- a/pkg/volume/awsebs/aws_ebs.go +++ /dev/null @@ -1,556 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "context" - "fmt" - "os" - "path/filepath" - "regexp" - "runtime" - "strconv" - "strings" - - "k8s.io/klog/v2" - "k8s.io/mount-utils" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/util" - "k8s.io/legacy-cloud-providers/aws" - utilstrings "k8s.io/utils/strings" -) - -// ProbeVolumePlugins is the primary entrypoint for volume plugins. -func ProbeVolumePlugins() []volume.VolumePlugin { - return []volume.VolumePlugin{&awsElasticBlockStorePlugin{nil}} -} - -type awsElasticBlockStorePlugin struct { - host volume.VolumeHost -} - -var _ volume.VolumePlugin = &awsElasticBlockStorePlugin{} -var _ volume.PersistentVolumePlugin = &awsElasticBlockStorePlugin{} -var _ volume.DeletableVolumePlugin = &awsElasticBlockStorePlugin{} -var _ volume.ProvisionableVolumePlugin = &awsElasticBlockStorePlugin{} - -const ( - awsElasticBlockStorePluginName = "kubernetes.io/aws-ebs" - awsURLNamePrefix = "aws://" -) - -func getPath(uid types.UID, volName string, host volume.VolumeHost) string { - return host.GetPodVolumeDir(uid, utilstrings.EscapeQualifiedName(awsElasticBlockStorePluginName), volName) -} - -func (plugin *awsElasticBlockStorePlugin) Init(host volume.VolumeHost) error { - plugin.host = host - return nil -} - -func (plugin *awsElasticBlockStorePlugin) GetPluginName() string { - return awsElasticBlockStorePluginName -} - -func (plugin *awsElasticBlockStorePlugin) GetVolumeName(spec *volume.Spec) (string, error) { - volumeSource, _, err := getVolumeSource(spec) - if err != nil { - return "", err - } - - return volumeSource.VolumeID, nil -} - -func (plugin *awsElasticBlockStorePlugin) CanSupport(spec *volume.Spec) bool { - return (spec.PersistentVolume != nil && spec.PersistentVolume.Spec.AWSElasticBlockStore != nil) || - (spec.Volume != nil && spec.Volume.AWSElasticBlockStore != nil) -} - -func (plugin *awsElasticBlockStorePlugin) RequiresRemount(spec *volume.Spec) bool { - return false -} - -func (plugin *awsElasticBlockStorePlugin) SupportsMountOption() bool { - return true -} - -func (plugin *awsElasticBlockStorePlugin) SupportsBulkVolumeVerification() bool { - return true -} - -func (plugin *awsElasticBlockStorePlugin) SupportsSELinuxContextMount(spec *volume.Spec) (bool, error) { - return false, nil -} - -func (plugin *awsElasticBlockStorePlugin) GetVolumeLimits() (map[string]int64, error) { - volumeLimits := map[string]int64{ - util.EBSVolumeLimitKey: util.DefaultMaxEBSVolumes, - } - cloud := plugin.host.GetCloudProvider() - - // if we can't fetch cloudprovider we return an error - // hoping external CCM or admin can set it. Returning - // default values from here will mean, no one can - // override them. - if cloud == nil { - return nil, fmt.Errorf("no cloudprovider present") - } - - if cloud.ProviderName() != aws.ProviderName { - return nil, fmt.Errorf("expected aws cloud, found %s", cloud.ProviderName()) - } - - instances, ok := cloud.Instances() - if !ok { - klog.V(3).Infof("Failed to get instances from cloud provider") - return volumeLimits, nil - } - - instanceType, err := instances.InstanceType(context.TODO(), plugin.host.GetNodeName()) - if err != nil { - klog.Errorf("Failed to get instance type from AWS cloud provider") - return volumeLimits, nil - } - - if ok, _ := regexp.MatchString(util.EBSNitroLimitRegex, instanceType); ok { - volumeLimits[util.EBSVolumeLimitKey] = util.DefaultMaxEBSNitroVolumeLimit - } - - return volumeLimits, nil -} - -func (plugin *awsElasticBlockStorePlugin) VolumeLimitKey(spec *volume.Spec) string { - return util.EBSVolumeLimitKey -} - -func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode { - return []v1.PersistentVolumeAccessMode{ - v1.ReadWriteOnce, - } -} - -func (plugin *awsElasticBlockStorePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { - // Inject real implementations here, test through the internal function. - return plugin.newMounterInternal(spec, pod.UID, &AWSDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) -} - -func (plugin *awsElasticBlockStorePlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager ebsManager, mounter mount.Interface) (volume.Mounter, error) { - // EBSs used directly in a pod have a ReadOnly flag set by the pod author. - // EBSs used as a PersistentVolume gets the ReadOnly flag indirectly through the persistent-claim volume used to mount the PV - ebs, readOnly, err := getVolumeSource(spec) - if err != nil { - return nil, err - } - - volumeID := aws.KubernetesVolumeID(ebs.VolumeID) - fsType := ebs.FSType - partition := "" - if ebs.Partition != 0 { - partition = strconv.Itoa(int(ebs.Partition)) - } - - return &awsElasticBlockStoreMounter{ - awsElasticBlockStore: &awsElasticBlockStore{ - podUID: podUID, - volName: spec.Name(), - volumeID: volumeID, - partition: partition, - manager: manager, - mounter: mounter, - plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, spec.Name(), plugin.host)), - }, - fsType: fsType, - readOnly: readOnly, - diskMounter: util.NewSafeFormatAndMountFromHost(plugin.GetPluginName(), plugin.host), - mountOptions: util.MountOptionFromSpec(spec), - }, nil -} - -func (plugin *awsElasticBlockStorePlugin) NewUnmounter(volName string, podUID types.UID) (volume.Unmounter, error) { - // Inject real implementations here, test through the internal function. - return plugin.newUnmounterInternal(volName, podUID, &AWSDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) -} - -func (plugin *awsElasticBlockStorePlugin) newUnmounterInternal(volName string, podUID types.UID, manager ebsManager, mounter mount.Interface) (volume.Unmounter, error) { - return &awsElasticBlockStoreUnmounter{&awsElasticBlockStore{ - podUID: podUID, - volName: volName, - manager: manager, - mounter: mounter, - plugin: plugin, - MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)), - }}, nil -} - -func (plugin *awsElasticBlockStorePlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, error) { - return plugin.newDeleterInternal(spec, &AWSDiskUtil{}) -} - -func (plugin *awsElasticBlockStorePlugin) newDeleterInternal(spec *volume.Spec, manager ebsManager) (volume.Deleter, error) { - if spec.PersistentVolume != nil && spec.PersistentVolume.Spec.AWSElasticBlockStore == nil { - klog.Errorf("spec.PersistentVolumeSource.AWSElasticBlockStore is nil") - return nil, fmt.Errorf("spec.PersistentVolumeSource.AWSElasticBlockStore is nil") - } - return &awsElasticBlockStoreDeleter{ - awsElasticBlockStore: &awsElasticBlockStore{ - volName: spec.Name(), - volumeID: aws.KubernetesVolumeID(spec.PersistentVolume.Spec.AWSElasticBlockStore.VolumeID), - manager: manager, - plugin: plugin, - }}, nil -} - -func (plugin *awsElasticBlockStorePlugin) NewProvisioner(options volume.VolumeOptions) (volume.Provisioner, error) { - return plugin.newProvisionerInternal(options, &AWSDiskUtil{}) -} - -func (plugin *awsElasticBlockStorePlugin) newProvisionerInternal(options volume.VolumeOptions, manager ebsManager) (volume.Provisioner, error) { - return &awsElasticBlockStoreProvisioner{ - awsElasticBlockStore: &awsElasticBlockStore{ - manager: manager, - plugin: plugin, - }, - options: options, - }, nil -} - -func getVolumeSource( - spec *volume.Spec) (*v1.AWSElasticBlockStoreVolumeSource, bool, error) { - if spec.Volume != nil && spec.Volume.AWSElasticBlockStore != nil { - return spec.Volume.AWSElasticBlockStore, spec.Volume.AWSElasticBlockStore.ReadOnly, nil - } else if spec.PersistentVolume != nil && - spec.PersistentVolume.Spec.AWSElasticBlockStore != nil { - return spec.PersistentVolume.Spec.AWSElasticBlockStore, spec.ReadOnly, nil - } - - return nil, false, fmt.Errorf("Spec does not reference an AWS EBS volume type") -} - -func (plugin *awsElasticBlockStorePlugin) ConstructVolumeSpec(volName, mountPath string) (volume.ReconstructedVolume, error) { - mounter := plugin.host.GetMounter(plugin.GetPluginName()) - kvh, ok := plugin.host.(volume.KubeletVolumeHost) - if !ok { - return volume.ReconstructedVolume{}, fmt.Errorf("plugin volume host does not implement KubeletVolumeHost interface") - } - hu := kvh.GetHostUtil() - pluginMntDir := util.GetPluginMountDir(plugin.host, plugin.GetPluginName()) - volumeID, err := hu.GetDeviceNameFromMount(mounter, mountPath, pluginMntDir) - if err != nil { - return volume.ReconstructedVolume{}, err - } - volumeID, err = formatVolumeID(volumeID) - if err != nil { - return volume.ReconstructedVolume{}, fmt.Errorf("failed to get AWS volume id from mount path %q: %v", mountPath, err) - } - - file := v1.PersistentVolumeFilesystem - return volume.ReconstructedVolume{ - Spec: newAWSVolumeSpec(volName, volumeID, file), - }, nil -} - -func (plugin *awsElasticBlockStorePlugin) RequiresFSResize() bool { - return true -} - -func (plugin *awsElasticBlockStorePlugin) ExpandVolumeDevice( - spec *volume.Spec, - newSize resource.Quantity, - oldSize resource.Quantity) (resource.Quantity, error) { - var awsVolume aws.Volumes - - awsVolume, err := getCloudProvider(plugin.host.GetCloudProvider()) - - if err != nil { - return oldSize, err - } - // we don't expect to receive this call for non PVs - rawVolumeName := spec.PersistentVolume.Spec.AWSElasticBlockStore.VolumeID - volumeID := aws.KubernetesVolumeID(rawVolumeName) - - if volumeID == "" { - return oldSize, fmt.Errorf("EBS.ExpandVolumeDevice Invalid volume id for %s", spec.Name()) - } - return awsVolume.ResizeDisk(volumeID, oldSize, newSize) -} - -func (plugin *awsElasticBlockStorePlugin) NodeExpand(resizeOptions volume.NodeResizeOptions) (bool, error) { - fsVolume, err := util.CheckVolumeModeFilesystem(resizeOptions.VolumeSpec) - if err != nil { - return false, fmt.Errorf("error checking VolumeMode: %v", err) - } - // if volume is not a fs file system, there is nothing for us to do here. - if !fsVolume { - return true, nil - } - _, err = util.GenericResizeFS(plugin.host, plugin.GetPluginName(), resizeOptions.DevicePath, resizeOptions.DeviceMountPath) - if err != nil { - return false, err - } - return true, nil -} - -var _ volume.NodeExpandableVolumePlugin = &awsElasticBlockStorePlugin{} -var _ volume.ExpandableVolumePlugin = &awsElasticBlockStorePlugin{} -var _ volume.VolumePluginWithAttachLimits = &awsElasticBlockStorePlugin{} - -// Abstract interface to PD operations. -type ebsManager interface { - CreateVolume(provisioner *awsElasticBlockStoreProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (volumeID aws.KubernetesVolumeID, volumeSizeGB int, labels map[string]string, fstype string, err error) - // Deletes a volume - DeleteVolume(deleter *awsElasticBlockStoreDeleter) error -} - -// awsElasticBlockStore volumes are disk resources provided by Amazon Web Services -// that are attached to the kubelet's host machine and exposed to the pod. -type awsElasticBlockStore struct { - volName string - podUID types.UID - // Unique id of the PD, used to find the disk resource in the provider. - volumeID aws.KubernetesVolumeID - // Specifies the partition to mount - partition string - // Utility interface that provides API calls to the provider to attach/detach disks. - manager ebsManager - // Mounter interface that provides system calls to mount the global path to the pod local path. - mounter mount.Interface - plugin *awsElasticBlockStorePlugin - volume.MetricsProvider -} - -type awsElasticBlockStoreMounter struct { - *awsElasticBlockStore - // Filesystem type, optional. - fsType string - // Specifies whether the disk will be attached as read-only. - readOnly bool - // diskMounter provides the interface that is used to mount the actual block device. - diskMounter *mount.SafeFormatAndMount - mountOptions []string -} - -var _ volume.Mounter = &awsElasticBlockStoreMounter{} - -func (b *awsElasticBlockStoreMounter) GetAttributes() volume.Attributes { - return volume.Attributes{ - ReadOnly: b.readOnly, - Managed: !b.readOnly, - SELinuxRelabel: true, - } -} - -// SetUp attaches the disk and bind mounts to the volume path. -func (b *awsElasticBlockStoreMounter) SetUp(mounterArgs volume.MounterArgs) error { - return b.SetUpAt(b.GetPath(), mounterArgs) -} - -// SetUpAt attaches the disk and bind mounts to the volume path. -func (b *awsElasticBlockStoreMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) error { - // TODO: handle failed mounts here. - notMnt, err := b.mounter.IsLikelyNotMountPoint(dir) - klog.V(4).Infof("PersistentDisk set up: %s %v %v", dir, !notMnt, err) - if err != nil && !os.IsNotExist(err) { - klog.Errorf("cannot validate mount point: %s %v", dir, err) - return err - } - if !notMnt { - return nil - } - - globalPDPath := makeGlobalPDPath(b.plugin.host, b.volumeID) - - if runtime.GOOS != "windows" { - // On Windows, Mount will create the parent of dir and mklink (create a symbolic link) at dir later, so don't create a - // directory at dir now. Otherwise mklink will error: "Cannot create a file when that file already exists". - // Instead, do nothing. For example when dir is: - // C:\var\lib\kubelet\pods\xxx\volumes\kubernetes.io~aws-ebs\pvc-xxx - // do nothing. Mount will make pvc-xxx a symlink to the global mount path (e.g. C:\var\lib\kubelet\plugins\kubernetes.io\aws-ebs\mounts\aws\us-west-2b\vol-xxx) - if err := os.MkdirAll(dir, 0750); err != nil { - return err - } - } - - // Perform a bind mount to the full path to allow duplicate mounts of the same PD. - options := []string{"bind"} - if b.readOnly { - options = append(options, "ro") - } - mountOptions := util.JoinMountOptions(options, b.mountOptions) - err = b.mounter.MountSensitiveWithoutSystemd(globalPDPath, dir, "", mountOptions, nil) - if err != nil { - notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir) - if mntErr != nil { - klog.Errorf("IsLikelyNotMountPoint check failed for %s: %v", dir, mntErr) - return err - } - if !notMnt { - if mntErr = b.mounter.Unmount(dir); mntErr != nil { - klog.Errorf("failed to unmount %s: %v", dir, mntErr) - return err - } - notMnt, mntErr := b.mounter.IsLikelyNotMountPoint(dir) - if mntErr != nil { - klog.Errorf("IsLikelyNotMountPoint check failed for %s: %v", dir, mntErr) - return err - } - if !notMnt { - // This is very odd, we don't expect it. We'll try again next sync loop. - klog.Errorf("%s is still mounted, despite call to unmount(). Will try again next sync loop.", dir) - return err - } - } - os.Remove(dir) - klog.Errorf("Mount of disk %s failed: %v", dir, err) - return err - } - - if !b.readOnly { - volume.SetVolumeOwnership(b, mounterArgs.FsGroup, mounterArgs.FSGroupChangePolicy, util.FSGroupCompleteHook(b.plugin, nil)) - } - - klog.V(4).Infof("Successfully mounted %s", dir) - return nil -} - -func makeGlobalPDPath(host volume.VolumeHost, volumeID aws.KubernetesVolumeID) string { - // Clean up the URI to be more fs-friendly - name := string(volumeID) - name = strings.Replace(name, "://", "/", -1) - return filepath.Join(host.GetPluginDir(awsElasticBlockStorePluginName), util.MountsInGlobalPDPath, name) -} - -func (ebs *awsElasticBlockStore) GetPath() string { - return getPath(ebs.podUID, ebs.volName, ebs.plugin.host) -} - -type awsElasticBlockStoreUnmounter struct { - *awsElasticBlockStore -} - -var _ volume.Unmounter = &awsElasticBlockStoreUnmounter{} - -// Unmounts the bind mount, and detaches the disk only if the PD -// resource was the last reference to that disk on the kubelet. -func (c *awsElasticBlockStoreUnmounter) TearDown() error { - return c.TearDownAt(c.GetPath()) -} - -// Unmounts the bind mount -func (c *awsElasticBlockStoreUnmounter) TearDownAt(dir string) error { - return mount.CleanupMountPoint(dir, c.mounter, false) -} - -type awsElasticBlockStoreDeleter struct { - *awsElasticBlockStore -} - -var _ volume.Deleter = &awsElasticBlockStoreDeleter{} - -func (d *awsElasticBlockStoreDeleter) GetPath() string { - return getPath(d.podUID, d.volName, d.plugin.host) -} - -func (d *awsElasticBlockStoreDeleter) Delete() error { - return d.manager.DeleteVolume(d) -} - -type awsElasticBlockStoreProvisioner struct { - *awsElasticBlockStore - options volume.VolumeOptions -} - -var _ volume.Provisioner = &awsElasticBlockStoreProvisioner{} - -func (c *awsElasticBlockStoreProvisioner) Provision(selectedNode *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (*v1.PersistentVolume, error) { - if !util.ContainsAllAccessModes(c.plugin.GetAccessModes(), c.options.PVC.Spec.AccessModes) { - return nil, fmt.Errorf("invalid AccessModes %v: only AccessModes %v are supported", c.options.PVC.Spec.AccessModes, c.plugin.GetAccessModes()) - } - - volumeID, sizeGB, labels, fstype, err := c.manager.CreateVolume(c, selectedNode, allowedTopologies) - if err != nil { - klog.Errorf("Provision failed: %v", err) - return nil, err - } - - if fstype == "" { - fstype = "ext4" - } - - volumeMode := c.options.PVC.Spec.VolumeMode - if volumeMode != nil && *volumeMode == v1.PersistentVolumeBlock { - // Block volumes should not have any FSType - fstype = "" - } - - pv := &v1.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: c.options.PVName, - Labels: map[string]string{}, - Annotations: map[string]string{ - util.VolumeDynamicallyCreatedByKey: "aws-ebs-dynamic-provisioner", - }, - }, - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy, - AccessModes: c.options.PVC.Spec.AccessModes, - Capacity: v1.ResourceList{ - v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), - }, - VolumeMode: volumeMode, - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: string(volumeID), - FSType: fstype, - Partition: 0, - ReadOnly: false, - }, - }, - MountOptions: c.options.MountOptions, - }, - } - - if len(c.options.PVC.Spec.AccessModes) == 0 { - pv.Spec.AccessModes = c.plugin.GetAccessModes() - } - - requirements := make([]v1.NodeSelectorRequirement, 0, len(labels)) - if len(labels) != 0 { - if pv.Labels == nil { - pv.Labels = make(map[string]string, len(labels)) - } - for k, v := range labels { - pv.Labels[k] = v - requirements = append(requirements, v1.NodeSelectorRequirement{Key: k, Operator: v1.NodeSelectorOpIn, Values: []string{v}}) - } - } - - pv.Spec.NodeAffinity = new(v1.VolumeNodeAffinity) - pv.Spec.NodeAffinity.Required = new(v1.NodeSelector) - pv.Spec.NodeAffinity.Required.NodeSelectorTerms = make([]v1.NodeSelectorTerm, 1) - pv.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions = requirements - - return pv, nil -} diff --git a/pkg/volume/awsebs/aws_ebs_block.go b/pkg/volume/awsebs/aws_ebs_block.go deleted file mode 100644 index 2eaab4e46f2..00000000000 --- a/pkg/volume/awsebs/aws_ebs_block.go +++ /dev/null @@ -1,180 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "fmt" - "path/filepath" - goruntime "runtime" - "strconv" - "strings" - - "k8s.io/klog/v2" - "k8s.io/mount-utils" - utilstrings "k8s.io/utils/strings" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/util/volumepathhandler" - "k8s.io/legacy-cloud-providers/aws" -) - -var _ volume.BlockVolumePlugin = &awsElasticBlockStorePlugin{} - -func (plugin *awsElasticBlockStorePlugin) ConstructBlockVolumeSpec(podUID types.UID, volumeName, mapPath string) (*volume.Spec, error) { - pluginDir := plugin.host.GetVolumeDevicePluginDir(awsElasticBlockStorePluginName) - blkutil := volumepathhandler.NewBlockVolumePathHandler() - globalMapPathUUID, err := blkutil.FindGlobalMapPathUUIDFromPod(pluginDir, mapPath, podUID) - if err != nil { - return nil, err - } - klog.V(5).Infof("globalMapPathUUID: %s", globalMapPathUUID) - - globalMapPath := filepath.Dir(globalMapPathUUID) - if len(globalMapPath) <= 1 { - return nil, fmt.Errorf("failed to get volume plugin information from globalMapPathUUID: %v", globalMapPathUUID) - } - - return plugin.getVolumeSpecFromGlobalMapPath(volumeName, globalMapPath) -} - -func (plugin *awsElasticBlockStorePlugin) getVolumeSpecFromGlobalMapPath(volumeName string, globalMapPath string) (*volume.Spec, error) { - // Get volume spec information from globalMapPath - // globalMapPath example: - // plugins/kubernetes.io/{PluginName}/{DefaultKubeletVolumeDevicesDirName}/{volumeID} - // plugins/kubernetes.io/aws-ebs/volumeDevices/vol-XXXXXX - pluginDir := plugin.host.GetVolumeDevicePluginDir(awsElasticBlockStorePluginName) - if !strings.HasPrefix(globalMapPath, pluginDir) { - return nil, fmt.Errorf("volume symlink %s is not in global plugin directory", globalMapPath) - } - fullVolumeID := strings.TrimPrefix(globalMapPath, pluginDir) // /vol-XXXXXX - fullVolumeID = strings.TrimLeft(fullVolumeID, "/") // vol-XXXXXX - // Windows paths have \\ instead. - if goruntime.GOOS == "windows" { - fullVolumeID = strings.TrimLeft(fullVolumeID, "\\") // vol-XXXXXX - } - vID, err := formatVolumeID(fullVolumeID) - if err != nil { - return nil, fmt.Errorf("failed to get AWS volume id from map path %q: %v", globalMapPath, err) - } - - block := v1.PersistentVolumeBlock - return newAWSVolumeSpec(volumeName, vID, block), nil -} - -// NewBlockVolumeMapper creates a new volume.BlockVolumeMapper from an API specification. -func (plugin *awsElasticBlockStorePlugin) NewBlockVolumeMapper(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.BlockVolumeMapper, error) { - // If this is called via GenerateUnmapDeviceFunc(), pod is nil. - // Pass empty string as dummy uid since uid isn't used in the case. - var uid types.UID - if pod != nil { - uid = pod.UID - } - - return plugin.newBlockVolumeMapperInternal(spec, uid, &AWSDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) -} - -func (plugin *awsElasticBlockStorePlugin) newBlockVolumeMapperInternal(spec *volume.Spec, podUID types.UID, manager ebsManager, mounter mount.Interface) (volume.BlockVolumeMapper, error) { - ebs, readOnly, err := getVolumeSource(spec) - if err != nil { - return nil, err - } - - volumeID := aws.KubernetesVolumeID(ebs.VolumeID) - partition := "" - if ebs.Partition != 0 { - partition = strconv.Itoa(int(ebs.Partition)) - } - - mapper := &awsElasticBlockStoreMapper{ - awsElasticBlockStore: &awsElasticBlockStore{ - podUID: podUID, - volName: spec.Name(), - volumeID: volumeID, - partition: partition, - manager: manager, - mounter: mounter, - plugin: plugin, - }, - readOnly: readOnly, - } - - blockPath, err := mapper.GetGlobalMapPath(spec) - if err != nil { - return nil, fmt.Errorf("failed to get device path: %v", err) - } - mapper.MetricsProvider = volume.NewMetricsBlock(filepath.Join(blockPath, string(podUID))) - - return mapper, nil -} - -func (plugin *awsElasticBlockStorePlugin) NewBlockVolumeUnmapper(volName string, podUID types.UID) (volume.BlockVolumeUnmapper, error) { - return plugin.newUnmapperInternal(volName, podUID, &AWSDiskUtil{}, plugin.host.GetMounter(plugin.GetPluginName())) -} - -func (plugin *awsElasticBlockStorePlugin) newUnmapperInternal(volName string, podUID types.UID, manager ebsManager, mounter mount.Interface) (volume.BlockVolumeUnmapper, error) { - return &awsElasticBlockStoreUnmapper{ - awsElasticBlockStore: &awsElasticBlockStore{ - podUID: podUID, - volName: volName, - manager: manager, - mounter: mounter, - plugin: plugin, - }}, nil -} - -type awsElasticBlockStoreUnmapper struct { - *awsElasticBlockStore -} - -var _ volume.BlockVolumeUnmapper = &awsElasticBlockStoreUnmapper{} - -type awsElasticBlockStoreMapper struct { - *awsElasticBlockStore - readOnly bool -} - -var _ volume.BlockVolumeMapper = &awsElasticBlockStoreMapper{} - -// GetGlobalMapPath returns global map path and error -// path: plugins/kubernetes.io/{PluginName}/volumeDevices/volumeID -// -// plugins/kubernetes.io/aws-ebs/volumeDevices/vol-XXXXXX -func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, error) { - volumeSource, _, err := getVolumeSource(spec) - if err != nil { - return "", err - } - return filepath.Join(ebs.plugin.host.GetVolumeDevicePluginDir(awsElasticBlockStorePluginName), string(volumeSource.VolumeID)), nil -} - -// GetPodDeviceMapPath returns pod device map path and volume name -// path: pods/{podUid}/volumeDevices/kubernetes.io~aws -func (ebs *awsElasticBlockStore) GetPodDeviceMapPath() (string, string) { - name := awsElasticBlockStorePluginName - return ebs.plugin.host.GetPodVolumeDeviceDir(ebs.podUID, utilstrings.EscapeQualifiedName(name)), ebs.volName -} - -// SupportsMetrics returns true for awsElasticBlockStore as it initializes the -// MetricsProvider. -func (ebs *awsElasticBlockStore) SupportsMetrics() bool { - return true -} diff --git a/pkg/volume/awsebs/aws_ebs_block_test.go b/pkg/volume/awsebs/aws_ebs_block_test.go deleted file mode 100644 index 0598766e68b..00000000000 --- a/pkg/volume/awsebs/aws_ebs_block_test.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "os" - "path/filepath" - "testing" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - utiltesting "k8s.io/client-go/util/testing" - "k8s.io/kubernetes/pkg/volume" - volumetest "k8s.io/kubernetes/pkg/volume/testing" -) - -const ( - testVolName = "vol-1234" - testPVName = "pv1" - testGlobalPath = "plugins/kubernetes.io/aws-ebs/volumeDevices/vol-1234" - testPodPath = "pods/poduid/volumeDevices/kubernetes.io~aws-ebs" -) - -func TestGetVolumeSpecFromGlobalMapPath(t *testing.T) { - // make our test path for fake GlobalMapPath - // /tmp symbolized our pluginDir - // /tmp/testGlobalPathXXXXX/plugins/kubernetes.io/gce-pd/volumeDevices/pdVol1 - tmpVDir, err := utiltesting.MkTmpdir("awsBlockTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - //deferred clean up - defer os.RemoveAll(tmpVDir) - - expectedGlobalPath := filepath.Join(tmpVDir, testGlobalPath) - - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeVolumeHost(t, tmpVDir, nil, nil)) - plug, err := plugMgr.FindMapperPluginByName(awsElasticBlockStorePluginName) - if err != nil { - os.RemoveAll(tmpVDir) - t.Fatalf("Can't find the plugin by name: %q", awsElasticBlockStorePluginName) - } - - //Bad Path - badspec, err := plug.(*awsElasticBlockStorePlugin).getVolumeSpecFromGlobalMapPath("", "") - if badspec != nil || err == nil { - t.Fatalf("Expected not to get spec from GlobalMapPath but did") - } - - // Good Path - spec, err := plug.(*awsElasticBlockStorePlugin).getVolumeSpecFromGlobalMapPath("myVolume", expectedGlobalPath) - if spec == nil || err != nil { - t.Fatalf("Failed to get spec from GlobalMapPath: %v", err) - } - if spec.PersistentVolume.Name != "myVolume" { - t.Errorf("Invalid PV name from GlobalMapPath spec: %s", spec.PersistentVolume.Name) - } - if spec.PersistentVolume.Spec.AWSElasticBlockStore.VolumeID != testVolName { - t.Errorf("Invalid volumeID from GlobalMapPath spec: %s", spec.PersistentVolume.Spec.AWSElasticBlockStore.VolumeID) - } - block := v1.PersistentVolumeBlock - specMode := spec.PersistentVolume.Spec.VolumeMode - if specMode == nil { - t.Errorf("Invalid volumeMode from GlobalMapPath spec: %v - %v", specMode, block) - } - if *specMode != block { - t.Errorf("Invalid volumeMode from GlobalMapPath spec: %v - %v", *specMode, block) - } -} - -func getTestVolume(readOnly bool, isBlock bool) *volume.Spec { - pv := &v1.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: testPVName, - }, - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: testVolName, - }, - }, - }, - } - - if isBlock { - blockMode := v1.PersistentVolumeBlock - pv.Spec.VolumeMode = &blockMode - } - return volume.NewSpecFromPersistentVolume(pv, readOnly) -} - -func TestGetPodAndPluginMapPaths(t *testing.T) { - tmpVDir, err := utiltesting.MkTmpdir("awsBlockTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - //deferred clean up - defer os.RemoveAll(tmpVDir) - - expectedGlobalPath := filepath.Join(tmpVDir, testGlobalPath) - expectedPodPath := filepath.Join(tmpVDir, testPodPath) - - spec := getTestVolume(false, true /*isBlock*/) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeVolumeHost(t, tmpVDir, nil, nil)) - plug, err := plugMgr.FindMapperPluginByName(awsElasticBlockStorePluginName) - if err != nil { - os.RemoveAll(tmpVDir) - t.Fatalf("Can't find the plugin by name: %q", awsElasticBlockStorePluginName) - } - if plug.GetPluginName() != awsElasticBlockStorePluginName { - t.Fatalf("Wrong name: %s", plug.GetPluginName()) - } - pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} - mapper, err := plug.NewBlockVolumeMapper(spec, pod, volume.VolumeOptions{}) - if err != nil { - t.Fatalf("Failed to make a new Mounter: %v", err) - } - if mapper == nil { - t.Fatalf("Got a nil Mounter") - } - - //GetGlobalMapPath - gMapPath, err := mapper.GetGlobalMapPath(spec) - if err != nil || len(gMapPath) == 0 { - t.Fatalf("Invalid path from GlobalMapPath spec: %s", spec.PersistentVolume.Spec.GCEPersistentDisk.PDName) - } - if gMapPath != expectedGlobalPath { - t.Fatalf("Failed to get GlobalMapPath: %s %s", gMapPath, expectedGlobalPath) - } - - //GetPodDeviceMapPath - gDevicePath, gVolName := mapper.GetPodDeviceMapPath() - if gDevicePath != expectedPodPath { - t.Errorf("Got unexpected pod path: %s, expected %s", gDevicePath, expectedPodPath) - } - if gVolName != testPVName { - t.Errorf("Got unexpected volNamne: %s, expected %s", gVolName, testPVName) - } -} diff --git a/pkg/volume/awsebs/aws_ebs_test.go b/pkg/volume/awsebs/aws_ebs_test.go deleted file mode 100644 index 9ffb080a61c..00000000000 --- a/pkg/volume/awsebs/aws_ebs_test.go +++ /dev/null @@ -1,477 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "fmt" - "os" - "path/filepath" - "reflect" - goruntime "runtime" - "testing" - - "github.com/stretchr/testify/assert" - "k8s.io/mount-utils" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/client-go/kubernetes/fake" - utiltesting "k8s.io/client-go/util/testing" - "k8s.io/kubernetes/pkg/volume" - volumetest "k8s.io/kubernetes/pkg/volume/testing" - "k8s.io/legacy-cloud-providers/aws" -) - -func TestCanSupport(t *testing.T) { - tmpDir, err := utiltesting.MkTmpdir("awsebsTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - defer os.RemoveAll(tmpDir) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeKubeletVolumeHost(t, tmpDir, nil, nil)) - - plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs") - if err != nil { - t.Fatal("Can't find the plugin by name") - } - if plug.GetPluginName() != "kubernetes.io/aws-ebs" { - t.Errorf("Wrong name: %s", plug.GetPluginName()) - } - if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}}}}) { - t.Errorf("Expected true") - } - if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}}}}}) { - t.Errorf("Expected true") - } -} - -func TestGetAccessModes(t *testing.T) { - tmpDir, err := utiltesting.MkTmpdir("awsebsTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - defer os.RemoveAll(tmpDir) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeKubeletVolumeHost(t, tmpDir, nil, nil)) - - plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/aws-ebs") - if err != nil { - t.Errorf("Can't find the plugin by name") - } - - if !volumetest.ContainsAccessMode(plug.GetAccessModes(), v1.ReadWriteOnce) { - t.Errorf("Expected to support AccessModeTypes: %s", v1.ReadWriteOnce) - } - if volumetest.ContainsAccessMode(plug.GetAccessModes(), v1.ReadOnlyMany) { - t.Errorf("Expected not to support AccessModeTypes: %s", v1.ReadOnlyMany) - } -} - -type fakePDManager struct { -} - -// TODO(jonesdl) To fully test this, we could create a loopback device -// and mount that instead. -func (fake *fakePDManager) CreateVolume(c *awsElasticBlockStoreProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (volumeID aws.KubernetesVolumeID, volumeSizeGB int, labels map[string]string, fstype string, err error) { - labels = make(map[string]string) - labels["fakepdmanager"] = "yes" - return "test-aws-volume-name", 100, labels, "", nil -} - -func (fake *fakePDManager) DeleteVolume(cd *awsElasticBlockStoreDeleter) error { - if cd.volumeID != "test-aws-volume-name" { - return fmt.Errorf("Deleter got unexpected volume name: %s", cd.volumeID) - } - return nil -} - -func TestPlugin(t *testing.T) { - tmpDir, err := utiltesting.MkTmpdir("awsebsTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - defer os.RemoveAll(tmpDir) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeKubeletVolumeHost(t, tmpDir, nil, nil)) - - plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs") - if err != nil { - t.Errorf("Can't find the plugin by name") - } - spec := &v1.Volume{ - Name: "vol1", - VolumeSource: v1.VolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: "pd", - FSType: "ext4", - }, - }, - } - fakeManager := &fakePDManager{} - fakeMounter := mount.NewFakeMounter(nil) - mounter, err := plug.(*awsElasticBlockStorePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), types.UID("poduid"), fakeManager, fakeMounter) - if err != nil { - t.Errorf("Failed to make a new Mounter: %v", err) - } - if mounter == nil { - t.Errorf("Got a nil Mounter") - } - - volPath := filepath.Join(tmpDir, "pods/poduid/volumes/kubernetes.io~aws-ebs/vol1") - path := mounter.GetPath() - if path != volPath { - t.Errorf("Got unexpected path: %s", path) - } - - if err := mounter.SetUp(volume.MounterArgs{}); err != nil { - t.Errorf("Expected success, got: %v", err) - } - - // On Windows, Mount will create the parent of dir and mklink (create a symbolic link) at the volume path later, - // so mounter.SetUp will not create the directory. Otherwise mklink will error: "Cannot create a file when that file already exists". - if goruntime.GOOS != "windows" { - if _, err := os.Stat(path); err != nil { - if os.IsNotExist(err) { - t.Errorf("SetUp() failed, volume path not created: %s", path) - } else { - t.Errorf("SetUp() failed: %v", err) - } - } - } - - fakeManager = &fakePDManager{} - unmounter, err := plug.(*awsElasticBlockStorePlugin).newUnmounterInternal("vol1", types.UID("poduid"), fakeManager, fakeMounter) - if err != nil { - t.Errorf("Failed to make a new Unmounter: %v", err) - } - if unmounter == nil { - t.Errorf("Got a nil Unmounter") - } - - if err := unmounter.TearDown(); err != nil { - t.Errorf("Expected success, got: %v", err) - } - if _, err := os.Stat(path); err == nil { - t.Errorf("TearDown() failed, volume path still exists: %s", path) - } else if !os.IsNotExist(err) { - t.Errorf("TearDown() failed: %v", err) - } - - // Test Provisioner - options := volume.VolumeOptions{ - PVC: volumetest.CreateTestPVC("100Mi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}), - PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete, - } - provisioner, err := plug.(*awsElasticBlockStorePlugin).newProvisionerInternal(options, &fakePDManager{}) - if err != nil { - t.Errorf("Error creating new provisioner:%v", err) - } - - persistentSpec, err := provisioner.Provision(nil, nil) - if err != nil { - t.Errorf("Provision() failed: %v", err) - } - - if persistentSpec.Spec.PersistentVolumeSource.AWSElasticBlockStore.VolumeID != "test-aws-volume-name" { - t.Errorf("Provision() returned unexpected volume ID: %s", persistentSpec.Spec.PersistentVolumeSource.AWSElasticBlockStore.VolumeID) - } - cap := persistentSpec.Spec.Capacity[v1.ResourceStorage] - size := cap.Value() - if size != 100*1024*1024*1024 { - t.Errorf("Provision() returned unexpected volume size: %v", size) - } - - if persistentSpec.Labels["fakepdmanager"] != "yes" { - t.Errorf("Provision() returned unexpected labels: %v", persistentSpec.Labels) - } - - // check nodeaffinity members - if persistentSpec.Spec.NodeAffinity == nil { - t.Errorf("Provision() returned unexpected nil NodeAffinity") - } - - if persistentSpec.Spec.NodeAffinity.Required == nil { - t.Errorf("Provision() returned unexpected nil NodeAffinity.Required") - } - - n := len(persistentSpec.Spec.NodeAffinity.Required.NodeSelectorTerms) - if n != 1 { - t.Errorf("Provision() returned unexpected number of NodeSelectorTerms %d. Expected %d", n, 1) - } - - n = len(persistentSpec.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions) - if n != 1 { - t.Errorf("Provision() returned unexpected number of MatchExpressions %d. Expected %d", n, 1) - } - - req := persistentSpec.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions[0] - if req.Key != "fakepdmanager" { - t.Errorf("Provision() returned unexpected requirement key in NodeAffinity %v", req.Key) - } - - if req.Operator != v1.NodeSelectorOpIn { - t.Errorf("Provision() returned unexpected requirement operator in NodeAffinity %v", req.Operator) - } - - if len(req.Values) != 1 || req.Values[0] != "yes" { - t.Errorf("Provision() returned unexpected requirement value in NodeAffinity %v", req.Values) - } - // Test Deleter - volSpec := &volume.Spec{ - PersistentVolume: persistentSpec, - } - deleter, err := plug.(*awsElasticBlockStorePlugin).newDeleterInternal(volSpec, &fakePDManager{}) - if err != nil { - t.Errorf("Error creating new deleter:%v", err) - } - err = deleter.Delete() - if err != nil { - t.Errorf("Deleter() failed: %v", err) - } -} - -func TestPersistentClaimReadOnlyFlag(t *testing.T) { - pv := &v1.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "pvA", - }, - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}, - }, - ClaimRef: &v1.ObjectReference{ - Name: "claimA", - }, - }, - } - - claim := &v1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "claimA", - Namespace: "nsA", - }, - Spec: v1.PersistentVolumeClaimSpec{ - VolumeName: "pvA", - }, - Status: v1.PersistentVolumeClaimStatus{ - Phase: v1.ClaimBound, - }, - } - - clientset := fake.NewSimpleClientset(pv, claim) - - tmpDir, err := utiltesting.MkTmpdir("awsebsTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - defer os.RemoveAll(tmpDir) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeKubeletVolumeHost(t, tmpDir, clientset, nil)) - plug, _ := plugMgr.FindPluginByName(awsElasticBlockStorePluginName) - - // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes - spec := volume.NewSpecFromPersistentVolume(pv, true) - pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} - mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) - - if !mounter.GetAttributes().ReadOnly { - t.Errorf("Expected true for mounter.IsReadOnly") - } -} - -func TestMounterAndUnmounterTypeAssert(t *testing.T) { - tmpDir, err := utiltesting.MkTmpdir("awsebsTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - defer os.RemoveAll(tmpDir) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeKubeletVolumeHost(t, tmpDir, nil, nil)) - - plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs") - if err != nil { - t.Errorf("Can't find the plugin by name") - } - spec := &v1.Volume{ - Name: "vol1", - VolumeSource: v1.VolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: "pd", - FSType: "ext4", - }, - }, - } - - mounter, err := plug.(*awsElasticBlockStorePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), types.UID("poduid"), &fakePDManager{}, mount.NewFakeMounter(nil)) - if err != nil { - t.Errorf("Error creating new mounter:%v", err) - } - if _, ok := mounter.(volume.Unmounter); ok { - t.Errorf("Volume Mounter can be type-assert to Unmounter") - } - - unmounter, err := plug.(*awsElasticBlockStorePlugin).newUnmounterInternal("vol1", types.UID("poduid"), &fakePDManager{}, mount.NewFakeMounter(nil)) - if err != nil { - t.Errorf("Error creating new unmounter:%v", err) - } - if _, ok := unmounter.(volume.Mounter); ok { - t.Errorf("Volume Unmounter can be type-assert to Mounter") - } -} - -func TestMountOptions(t *testing.T) { - tmpDir, err := utiltesting.MkTmpdir("aws-ebs") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - defer os.RemoveAll(tmpDir) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeKubeletVolumeHost(t, tmpDir, nil, nil)) - - plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs") - if err != nil { - t.Errorf("Can't find the plugin by name") - } - - pv := &v1.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "pvA", - }, - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}, - }, - ClaimRef: &v1.ObjectReference{ - Name: "claimA", - }, - MountOptions: []string{"_netdev"}, - }, - } - - fakeManager := &fakePDManager{} - fakeMounter := mount.NewFakeMounter(nil) - - mounter, err := plug.(*awsElasticBlockStorePlugin).newMounterInternal(volume.NewSpecFromPersistentVolume(pv, false), types.UID("poduid"), fakeManager, fakeMounter) - if err != nil { - t.Errorf("Failed to make a new Mounter: %v", err) - } - if mounter == nil { - t.Errorf("Got a nil Mounter") - } - - if err := mounter.SetUp(volume.MounterArgs{}); err != nil { - t.Errorf("Expected success, got: %v", err) - } - mountOptions := fakeMounter.MountPoints[0].Opts - expectedMountOptions := []string{"_netdev", "bind"} - if !reflect.DeepEqual(mountOptions, expectedMountOptions) { - t.Errorf("Expected mount options to be %v got %v", expectedMountOptions, mountOptions) - } -} - -func TestGetCandidateZone(t *testing.T) { - const testZone = "my-zone-1a" - - // TODO: add test case for immediate bind volume when we have a good way to mock Cloud outside cloudprovider - tests := []struct { - cloud *aws.Cloud - node *v1.Node - expectedZones sets.String - }{ - { - cloud: nil, - node: &v1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - v1.LabelTopologyZone: testZone, - }, - }, - }, - expectedZones: sets.NewString(), - }, - { - cloud: nil, - node: &v1.Node{}, - expectedZones: sets.NewString(), - }, - } - - for _, test := range tests { - zones, err := getCandidateZones(test.cloud, test.node) - assert.NoError(t, err) - assert.Equal(t, test.expectedZones, zones) - } -} - -func TestFormatVolumeID(t *testing.T) { - tests := []struct { - volumeIDFromPath string - expectedVolumeID string - }{ - { - "aws/vol-1234", - "aws:///vol-1234", - }, - { - "aws:/vol-1234", - "aws:///vol-1234", - }, - { - "aws/us-east-1/vol-1234", - "aws://us-east-1/vol-1234", - }, - { - "aws:/us-east-1/vol-1234", - "aws://us-east-1/vol-1234", - }, - { - "vol-1234", - "vol-1234", - }, - } - for _, test := range tests { - volumeID, err := formatVolumeID(test.volumeIDFromPath) - assert.NoError(t, err) - assert.Equal(t, test.expectedVolumeID, volumeID, test.volumeIDFromPath) - } -} - -func TestUnsupportedVolumeHost(t *testing.T) { - tmpDir, err := utiltesting.MkTmpdir("awsebsTest") - if err != nil { - t.Fatalf("can't make a temp dir: %v", err) - } - defer os.RemoveAll(tmpDir) - plugMgr := volume.VolumePluginMgr{} - plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeVolumeHost(t, tmpDir, nil, nil)) - - plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs") - if err != nil { - t.Fatal("Can't find the plugin by name") - } - - _, err = plug.ConstructVolumeSpec("", "") - if err == nil { - t.Errorf("Expected failure constructing volume spec with unsupported VolumeHost") - } -} diff --git a/pkg/volume/awsebs/aws_util.go b/pkg/volume/awsebs/aws_util.go deleted file mode 100644 index 61429e325e3..00000000000 --- a/pkg/volume/awsebs/aws_util.go +++ /dev/null @@ -1,342 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package awsebs - -import ( - "fmt" - "os" - "path/filepath" - "strconv" - "strings" - "time" - - "k8s.io/klog/v2" - "k8s.io/mount-utils" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/sets" - cloudprovider "k8s.io/cloud-provider" - volumehelpers "k8s.io/cloud-provider/volume/helpers" - "k8s.io/kubernetes/pkg/volume" - volumeutil "k8s.io/kubernetes/pkg/volume/util" - "k8s.io/legacy-cloud-providers/aws" -) - -const ( - diskPartitionSuffix = "" - nvmeDiskPartitionSuffix = "p" - checkSleepDuration = time.Second -) - -// AWSDiskUtil provides operations for EBS volume. -type AWSDiskUtil struct{} - -// DeleteVolume deletes an AWS EBS volume. -func (util *AWSDiskUtil) DeleteVolume(d *awsElasticBlockStoreDeleter) error { - cloud, err := getCloudProvider(d.awsElasticBlockStore.plugin.host.GetCloudProvider()) - if err != nil { - return err - } - - deleted, err := cloud.DeleteDisk(d.volumeID) - if err != nil { - // AWS cloud provider returns volume.deletedVolumeInUseError when - // necessary, no handling needed here. - klog.V(2).Infof("Error deleting EBS Disk volume %s: %v", d.volumeID, err) - return err - } - if deleted { - klog.V(2).Infof("Successfully deleted EBS Disk volume %s", d.volumeID) - } else { - klog.V(2).Infof("Successfully deleted EBS Disk volume %s (actually already deleted)", d.volumeID) - } - return nil -} - -// CreateVolume creates an AWS EBS volume. -// Returns: volumeID, volumeSizeGB, labels, fstype, error -func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (aws.KubernetesVolumeID, int, map[string]string, string, error) { - cloud, err := getCloudProvider(c.awsElasticBlockStore.plugin.host.GetCloudProvider()) - if err != nil { - return "", 0, nil, "", err - } - - // AWS volumes don't have Name field, store the name in Name tag - var tags map[string]string - if c.options.CloudTags == nil { - tags = make(map[string]string) - } else { - tags = *c.options.CloudTags - } - tags["Name"] = volumeutil.GenerateVolumeName(c.options.ClusterName, c.options.PVName, 255) // AWS tags can have 255 characters - - capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)] - - zonesWithNodes, err := getCandidateZones(cloud, node) - if err != nil { - return "", 0, nil, "", fmt.Errorf("error finding candidate zone for pvc: %v", err) - } - - volumeOptions, err := populateVolumeOptions(c.plugin.GetPluginName(), c.options.PVC.Name, capacity, tags, c.options.Parameters, node, allowedTopologies, zonesWithNodes) - if err != nil { - klog.V(2).Infof("Error populating EBS options: %v", err) - return "", 0, nil, "", err - } - - // TODO: implement PVC.Selector parsing - if c.options.PVC.Spec.Selector != nil { - return "", 0, nil, "", fmt.Errorf("claim.Spec.Selector is not supported for dynamic provisioning on AWS") - } - - name, err := cloud.CreateDisk(volumeOptions) - if err != nil { - klog.V(2).Infof("Error creating EBS Disk volume: %v", err) - return "", 0, nil, "", err - } - klog.V(2).Infof("Successfully created EBS Disk volume %s", name) - - labels, err := cloud.GetVolumeLabels(name) - if err != nil { - // We don't really want to leak the volume here... - klog.Errorf("Error building labels for new EBS volume %q: %v", name, err) - } - - fstype := "" - for k, v := range c.options.Parameters { - if strings.ToLower(k) == volume.VolumeParameterFSType { - fstype = v - } - } - - return name, volumeOptions.CapacityGB, labels, fstype, nil -} - -// getCandidateZones finds possible zones that a volume can be created in -func getCandidateZones(cloud *aws.Cloud, selectedNode *v1.Node) (sets.String, error) { - if selectedNode != nil { - // For topology aware volume provisioning, node is already selected so we use the zone from - // selected node directly instead of candidate zones. - // We can assume the information is always available as node controller shall maintain it. - return sets.NewString(), nil - } - - // For non-topology-aware volumes (those that binds immediately), we fall back to original logic to query - // cloud provider for possible zones - return cloud.GetCandidateZonesForDynamicVolume() -} - -// returns volumeOptions for EBS based on storageclass parameters and node configuration -func populateVolumeOptions(pluginName, pvcName string, capacityGB resource.Quantity, tags map[string]string, storageParams map[string]string, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm, zonesWithNodes sets.String) (*aws.VolumeOptions, error) { - requestGiB, err := volumehelpers.RoundUpToGiBInt(capacityGB) - if err != nil { - return nil, err - } - - volumeOptions := &aws.VolumeOptions{ - CapacityGB: requestGiB, - Tags: tags, - } - - // Apply Parameters (case-insensitive). We leave validation of - // the values to the cloud provider. - zonePresent := false - zonesPresent := false - var zone string - var zones sets.String - for k, v := range storageParams { - switch strings.ToLower(k) { - case "type": - volumeOptions.VolumeType = v - case "zone": - zonePresent = true - zone = v - case "zones": - zonesPresent = true - zones, err = volumehelpers.ZonesToSet(v) - if err != nil { - return nil, fmt.Errorf("error parsing zones %s, must be strings separated by commas: %v", zones, err) - } - case "iopspergb": - volumeOptions.IOPSPerGB, err = strconv.Atoi(v) - if err != nil { - return nil, fmt.Errorf("invalid iopsPerGB value %q: %v", v, err) - } - case "encrypted": - volumeOptions.Encrypted, err = strconv.ParseBool(v) - if err != nil { - return nil, fmt.Errorf("invalid encrypted boolean value %q, must be true or false: %v", v, err) - } - case "kmskeyid": - volumeOptions.KmsKeyID = v - case volume.VolumeParameterFSType: - // Do nothing but don't make this fail - default: - return nil, fmt.Errorf("invalid option %q for volume plugin %s", k, pluginName) - } - } - - volumeOptions.AvailabilityZone, err = volumehelpers.SelectZoneForVolume(zonePresent, zonesPresent, zone, zones, zonesWithNodes, node, allowedTopologies, pvcName) - if err != nil { - return nil, err - } - return volumeOptions, nil -} - -// Returns the first path that exists, or empty string if none exist. -func verifyDevicePath(devicePaths []string) (string, error) { - for _, path := range devicePaths { - if pathExists, err := mount.PathExists(path); err != nil { - return "", fmt.Errorf("error checking if path exists: %v", err) - } else if pathExists { - return path, nil - } - } - - return "", nil -} - -// Returns list of all paths for given EBS mount -// This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id) -// Here it is mostly about applying the partition path -func getDiskByIDPaths(volumeID aws.KubernetesVolumeID, partition string, devicePath string) []string { - var devicePaths []string - if devicePath != "" { - devicePaths = append(devicePaths, devicePath) - } - - if partition != "" { - for i, path := range devicePaths { - devicePaths[i] = path + diskPartitionSuffix + partition - } - } - - // We need to find NVME volumes, which are mounted on a "random" nvme path ("/dev/nvme0n1"), - // and we have to get the volume id from the nvme interface - awsVolumeID, err := volumeID.MapToAWSVolumeID() - if err != nil { - klog.Warningf("Error mapping volume %q to AWS volume: %v", volumeID, err) - } else { - // This is the magic name on which AWS presents NVME devices under /dev/disk/by-id/ - // For example, vol-0fab1d5e3f72a5e23 creates a symlink at /dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol0fab1d5e3f72a5e23 - nvmeName := "nvme-Amazon_Elastic_Block_Store_" + strings.Replace(string(awsVolumeID), "-", "", -1) - nvmePath, err := findNvmeVolume(nvmeName) - if err != nil { - klog.Warningf("Error looking for nvme volume %q: %v", volumeID, err) - } else if nvmePath != "" { - if partition != "" { - nvmePath = nvmePath + nvmeDiskPartitionSuffix + partition - } - devicePaths = append(devicePaths, nvmePath) - } - } - - return devicePaths -} - -// Returns cloud provider -func getCloudProvider(cloudProvider cloudprovider.Interface) (*aws.Cloud, error) { - awsCloudProvider, ok := cloudProvider.(*aws.Cloud) - if !ok || awsCloudProvider == nil { - return nil, fmt.Errorf("failed to get AWS Cloud Provider. GetCloudProvider returned %v instead", cloudProvider) - } - - return awsCloudProvider, nil -} - -// findNvmeVolume looks for the nvme volume with the specified name -// It follows the symlink (if it exists) and returns the absolute path to the device -func findNvmeVolume(findName string) (device string, err error) { - p := filepath.Join("/dev/disk/by-id/", findName) - stat, err := os.Lstat(p) - if err != nil { - if os.IsNotExist(err) { - klog.V(6).Infof("nvme path not found %q", p) - return "", nil - } - return "", fmt.Errorf("error getting stat of %q: %v", p, err) - } - - if stat.Mode()&os.ModeSymlink != os.ModeSymlink { - klog.Warningf("nvme file %q found, but was not a symlink", p) - return "", nil - } - - // Find the target, resolving to an absolute path - // For example, /dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol0fab1d5e3f72a5e23 -> ../../nvme2n1 - resolved, err := filepath.EvalSymlinks(p) - if err != nil { - return "", fmt.Errorf("error reading target of symlink %q: %v", p, err) - } - - if !strings.HasPrefix(resolved, "/dev") { - return "", fmt.Errorf("resolved symlink for %q was unexpected: %q", p, resolved) - } - - return resolved, nil -} - -func formatVolumeID(volumeID string) (string, error) { - // This is a workaround to fix the issue in converting aws volume id from globalPDPath and globalMapPath - // There are three formats for AWSEBSVolumeSource.VolumeID and they are stored on disk in paths like so: - // VolumeID mountPath mapPath - // aws:///vol-1234 aws/vol-1234 aws:/vol-1234 - // aws://us-east-1/vol-1234 aws/us-east-1/vol-1234 aws:/us-east-1/vol-1234 - // vol-1234 vol-1234 vol-1234 - // This code is for converting volume ids from paths back to AWS style VolumeIDs - sourceName := volumeID - if strings.HasPrefix(volumeID, "aws/") || strings.HasPrefix(volumeID, "aws:/") { - names := strings.Split(volumeID, "/") - length := len(names) - if length < 2 || length > 3 { - return "", fmt.Errorf("invalid volume name format %q", volumeID) - } - volName := names[length-1] - if !strings.HasPrefix(volName, "vol-") { - return "", fmt.Errorf("invalid volume name format for AWS volume (%q)", volName) - } - if length == 2 { - sourceName = awsURLNamePrefix + "" + "/" + volName // empty zone label - } - if length == 3 { - sourceName = awsURLNamePrefix + names[1] + "/" + volName // names[1] is the zone label - } - klog.V(4).Infof("Convert aws volume name from %q to %q ", volumeID, sourceName) - } - return sourceName, nil -} - -func newAWSVolumeSpec(volumeName, volumeID string, mode v1.PersistentVolumeMode) *volume.Spec { - awsVolume := &v1.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: volumeName, - }, - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: volumeID, - }, - }, - VolumeMode: &mode, - }, - } - return volume.NewSpecFromPersistentVolume(awsVolume, false) -} diff --git a/pkg/volume/awsebs/doc.go b/pkg/volume/awsebs/doc.go deleted file mode 100644 index 3b2d21208e3..00000000000 --- a/pkg/volume/awsebs/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package awsebs contains the internal representation of AWS Elastic -// Block Store volumes. -package awsebs // import "k8s.io/kubernetes/pkg/volume/awsebs" diff --git a/pkg/volume/csi/csi_plugin.go b/pkg/volume/csi/csi_plugin.go index e00a4d6d097..e1de2f3ea33 100644 --- a/pkg/volume/csi/csi_plugin.go +++ b/pkg/volume/csi/csi_plugin.go @@ -220,7 +220,7 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error { return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationGCE) }, csitranslationplugins.AWSEBSInTreePluginName: func() bool { - return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAWS) + return true }, csitranslationplugins.CinderInTreePluginName: func() bool { return true diff --git a/pkg/volume/csimigration/plugin_manager.go b/pkg/volume/csimigration/plugin_manager.go index b568e85ac15..aa8a8e7d023 100644 --- a/pkg/volume/csimigration/plugin_manager.go +++ b/pkg/volume/csimigration/plugin_manager.go @@ -89,7 +89,7 @@ func (pm PluginManager) IsMigrationEnabledForPlugin(pluginName string) bool { switch pluginName { case csilibplugins.AWSEBSInTreePluginName: - return pm.featureGate.Enabled(features.CSIMigrationAWS) + return true case csilibplugins.GCEPDInTreePluginName: return pm.featureGate.Enabled(features.CSIMigrationGCE) case csilibplugins.AzureFileInTreePluginName: diff --git a/pkg/volume/csimigration/plugin_manager_test.go b/pkg/volume/csimigration/plugin_manager_test.go index c1517075f47..b4d2d8b20c1 100644 --- a/pkg/volume/csimigration/plugin_manager_test.go +++ b/pkg/volume/csimigration/plugin_manager_test.go @@ -74,27 +74,6 @@ func TestIsMigratable(t *testing.T) { }, }, }, - { - name: "AWS EBS PV with CSIMigrationAWS enabled", - pluginFeature: features.CSIMigrationAWS, - pluginFeatureEnabled: true, - isMigratable: true, - csiMigrationEnabled: true, - spec: &volume.Spec{ - PersistentVolume: &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: "vol01", - FSType: "ext3", - Partition: 1, - ReadOnly: true, - }, - }, - }, - }, - }, - }, } csiTranslator := csitrans.New() for _, test := range testCases { @@ -146,28 +125,6 @@ func TestMigrationFeatureFlagStatus(t *testing.T) { csiMigrationResult: true, csiMigrationCompleteResult: true, }, - { - name: "aws-ebs migration flag enabled and migration-complete flag disabled with CSI migration flag enabled", - pluginName: "kubernetes.io/aws-ebs", - pluginFeature: features.CSIMigrationAWS, - pluginFeatureEnabled: true, - csiMigrationEnabled: true, - inTreePluginUnregister: features.InTreePluginAWSUnregister, - inTreePluginUnregisterEnabled: false, - csiMigrationResult: true, - csiMigrationCompleteResult: false, - }, - { - name: "aws-ebs migration flag enabled and migration-complete flag enabled with CSI migration flag enabled", - pluginName: "kubernetes.io/aws-ebs", - pluginFeature: features.CSIMigrationAWS, - pluginFeatureEnabled: true, - csiMigrationEnabled: true, - inTreePluginUnregister: features.InTreePluginAWSUnregister, - inTreePluginUnregisterEnabled: true, - csiMigrationResult: true, - csiMigrationCompleteResult: true, - }, { name: "vsphere-volume migration flag enabled and migration-complete flag disabled with CSI migration flag enabled", pluginName: "kubernetes.io/vsphere-volume", diff --git a/pkg/volume/util/operationexecutor/operation_generator_test.go b/pkg/volume/util/operationexecutor/operation_generator_test.go index 23387554f90..737fe00d8a5 100644 --- a/pkg/volume/util/operationexecutor/operation_generator_test.go +++ b/pkg/volume/util/operationexecutor/operation_generator_test.go @@ -18,6 +18,9 @@ package operationexecutor import ( "fmt" + "os" + "testing" + "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/runtime" utilfeature "k8s.io/apiserver/pkg/util/feature" @@ -25,8 +28,6 @@ import ( "k8s.io/client-go/tools/record" featuregatetesting "k8s.io/component-base/featuregate/testing" "k8s.io/kubernetes/pkg/features" - "os" - "testing" "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" @@ -37,7 +38,6 @@ import ( "k8s.io/component-base/metrics/testutil" "k8s.io/csi-translation-lib/plugins" "k8s.io/kubernetes/pkg/volume" - "k8s.io/kubernetes/pkg/volume/awsebs" csitesting "k8s.io/kubernetes/pkg/volume/csi/testing" "k8s.io/kubernetes/pkg/volume/gcepd" volumetesting "k8s.io/kubernetes/pkg/volume/testing" @@ -65,15 +65,6 @@ func TestOperationGenerator_GenerateUnmapVolumeFunc_PluginName(t *testing.T) { }}, probVolumePlugins: gcepd.ProbeVolumePlugins(), }, - { - name: "aws ebs plugin: csi migration disabled", - pluginName: plugins.AWSEBSInTreePluginName, - pvSpec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}, - }}, - probVolumePlugins: awsebs.ProbeVolumePlugins(), - }, } for _, tc := range testcases { diff --git a/plugin/pkg/admission/storage/persistentvolume/label/admission.go b/plugin/pkg/admission/storage/persistentvolume/label/admission.go index 3f5c7782600..54dd507ace3 100644 --- a/plugin/pkg/admission/storage/persistentvolume/label/admission.go +++ b/plugin/pkg/admission/storage/persistentvolume/label/admission.go @@ -57,7 +57,6 @@ type persistentVolumeLabel struct { mutex sync.Mutex cloudConfig []byte - awsPVLabeler cloudprovider.PVLabeler gcePVLabeler cloudprovider.PVLabeler azurePVLabeler cloudprovider.PVLabeler vspherePVLabeler cloudprovider.PVLabeler @@ -72,7 +71,7 @@ var _ kubeapiserveradmission.WantsCloudConfig = &persistentVolumeLabel{} // As a side effect, the cloud provider may block invalid or non-existent volumes. func newPersistentVolumeLabel() *persistentVolumeLabel { // DEPRECATED: in a future release, we will use mutating admission webhooks to apply PV labels. - // Once the mutating admission webhook is used for AWS, Azure, and GCE, + // Once the mutating admission webhook is used for Azure, and GCE, // this admission controller will be removed. klog.Warning("PersistentVolumeLabel admission controller is deprecated. " + "Please remove this controller from your configuration files and scripts.") @@ -200,12 +199,6 @@ func (l *persistentVolumeLabel) findVolumeLabels(volume *api.PersistentVolume) ( // Either missing labels or we don't trust the user provided correct values. switch { - case volume.Spec.AWSElasticBlockStore != nil: - labels, err := l.findAWSEBSLabels(volume) - if err != nil { - return nil, fmt.Errorf("error querying AWS EBS volume %s: %v", volume.Spec.AWSElasticBlockStore.VolumeID, err) - } - return labels, nil case volume.Spec.GCEPersistentDisk != nil: labels, err := l.findGCEPDLabels(volume) if err != nil { @@ -229,54 +222,6 @@ func (l *persistentVolumeLabel) findVolumeLabels(volume *api.PersistentVolume) ( return nil, nil } -func (l *persistentVolumeLabel) findAWSEBSLabels(volume *api.PersistentVolume) (map[string]string, error) { - // Ignore any volumes that are being provisioned - if volume.Spec.AWSElasticBlockStore.VolumeID == cloudvolume.ProvisionedVolumeName { - return nil, nil - } - pvlabler, err := l.getAWSPVLabeler() - if err != nil { - return nil, err - } - if pvlabler == nil { - return nil, fmt.Errorf("unable to build AWS cloud provider for EBS") - } - - pv := &v1.PersistentVolume{} - err = k8s_api_v1.Convert_core_PersistentVolume_To_v1_PersistentVolume(volume, pv, nil) - if err != nil { - return nil, fmt.Errorf("failed to convert PersistentVolume to core/v1: %q", err) - } - - return pvlabler.GetLabelsForVolume(context.TODO(), pv) -} - -// getAWSPVLabeler returns the AWS implementation of PVLabeler -func (l *persistentVolumeLabel) getAWSPVLabeler() (cloudprovider.PVLabeler, error) { - l.mutex.Lock() - defer l.mutex.Unlock() - - if l.awsPVLabeler == nil { - var cloudConfigReader io.Reader - if len(l.cloudConfig) > 0 { - cloudConfigReader = bytes.NewReader(l.cloudConfig) - } - - cloudProvider, err := cloudprovider.GetCloudProvider("aws", cloudConfigReader) - if err != nil || cloudProvider == nil { - return nil, err - } - - awsPVLabeler, ok := cloudProvider.(cloudprovider.PVLabeler) - if !ok { - return nil, errors.New("AWS cloud provider does not implement PV labeling") - } - - l.awsPVLabeler = awsPVLabeler - } - return l.awsPVLabeler, nil -} - func (l *persistentVolumeLabel) findGCEPDLabels(volume *api.PersistentVolume) (map[string]string, error) { // Ignore any volumes that are being provisioned if volume.Spec.GCEPersistentDisk.PDName == cloudvolume.ProvisionedVolumeName { diff --git a/plugin/pkg/admission/storage/persistentvolume/label/admission_test.go b/plugin/pkg/admission/storage/persistentvolume/label/admission_test.go index 36c46d5cbb8..b91172d0df4 100644 --- a/plugin/pkg/admission/storage/persistentvolume/label/admission_test.go +++ b/plugin/pkg/admission/storage/persistentvolume/label/admission_test.go @@ -97,26 +97,26 @@ func Test_PVLAdmission(t *testing.T) { handler: newPersistentVolumeLabel(), pvlabeler: mockVolumeFailure(errors.New("invalid volume")), preAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{Name: "awsebs", Namespace: "myns"}, + ObjectMeta: metav1.ObjectMeta{Name: "vSpherePV", Namespace: "myns"}, Spec: api.PersistentVolumeSpec{ PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", + VsphereVolume: &api.VsphereVirtualDiskVolumeSource{ + VolumePath: "123", }, }, }, }, postAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{Name: "awsebs", Namespace: "myns"}, + ObjectMeta: metav1.ObjectMeta{Name: "vSpherePV", Namespace: "myns"}, Spec: api.PersistentVolumeSpec{ PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", + VsphereVolume: &api.VsphereVirtualDiskVolumeSource{ + VolumePath: "123", }, }, }, }, - err: apierrors.NewForbidden(schema.ParseGroupResource("persistentvolumes"), "awsebs", errors.New("error querying AWS EBS volume 123: invalid volume")), + err: apierrors.NewForbidden(schema.ParseGroupResource("persistentvolumes"), "vSpherePV", errors.New("error querying vSphere Volume 123: invalid volume")), }, { name: "cloud provider returns no labels", @@ -170,69 +170,6 @@ func Test_PVLAdmission(t *testing.T) { }, err: nil, }, - { - name: "AWS EBS PV labeled correctly", - handler: newPersistentVolumeLabel(), - pvlabeler: mockVolumeLabels(map[string]string{ - "a": "1", - "b": "2", - v1.LabelTopologyZone: "1__2__3", - }), - preAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{Name: "awsebs", Namespace: "myns"}, - Spec: api.PersistentVolumeSpec{ - PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", - }, - }, - }, - }, - postAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", - Namespace: "myns", - Labels: map[string]string{ - "a": "1", - "b": "2", - v1.LabelTopologyZone: "1__2__3", - }, - }, - Spec: api.PersistentVolumeSpec{ - PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", - }, - }, - NodeAffinity: &api.VolumeNodeAffinity{ - Required: &api.NodeSelector{ - NodeSelectorTerms: []api.NodeSelectorTerm{ - { - MatchExpressions: []api.NodeSelectorRequirement{ - { - Key: "a", - Operator: api.NodeSelectorOpIn, - Values: []string{"1"}, - }, - { - Key: "b", - Operator: api.NodeSelectorOpIn, - Values: []string{"2"}, - }, - { - Key: v1.LabelTopologyZone, - Operator: api.NodeSelectorOpIn, - Values: []string{"1", "2", "3"}, - }, - }, - }, - }, - }, - }, - }, - }, - err: nil, - }, { name: "existing Beta labels from dynamic provisioning are not changed", handler: newPersistentVolumeLabel(), @@ -378,7 +315,7 @@ func Test_PVLAdmission(t *testing.T) { }), preAdmissionPV: &api.PersistentVolume{ ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", Namespace: "myns", + Name: "vSpherePV", Namespace: "myns", Labels: map[string]string{ v1.LabelTopologyZone: "existingDomain", v1.LabelTopologyRegion: "existingRegion", @@ -386,15 +323,15 @@ func Test_PVLAdmission(t *testing.T) { }, Spec: api.PersistentVolumeSpec{ PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", + VsphereVolume: &api.VsphereVirtualDiskVolumeSource{ + VolumePath: "123", }, }, }, }, postAdmissionPV: &api.PersistentVolume{ ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", + Name: "vSpherePV", Namespace: "myns", Labels: map[string]string{ v1.LabelTopologyZone: "domain1", @@ -403,8 +340,8 @@ func Test_PVLAdmission(t *testing.T) { }, Spec: api.PersistentVolumeSpec{ PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", + VsphereVolume: &api.VsphereVirtualDiskVolumeSource{ + VolumePath: "123", }, }, NodeAffinity: &api.VolumeNodeAffinity{ @@ -561,150 +498,7 @@ func Test_PVLAdmission(t *testing.T) { err: nil, }, { - name: "AWS EBS PV overrides user applied labels", - handler: newPersistentVolumeLabel(), - pvlabeler: mockVolumeLabels(map[string]string{ - "a": "1", - "b": "2", - v1.LabelTopologyZone: "1__2__3", - }), - preAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", - Namespace: "myns", - Labels: map[string]string{ - "a": "not1", - }, - }, - Spec: api.PersistentVolumeSpec{ - PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", - }, - }, - }, - }, - postAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", - Namespace: "myns", - Labels: map[string]string{ - "a": "1", - "b": "2", - v1.LabelTopologyZone: "1__2__3", - }, - }, - Spec: api.PersistentVolumeSpec{ - PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", - }, - }, - NodeAffinity: &api.VolumeNodeAffinity{ - Required: &api.NodeSelector{ - NodeSelectorTerms: []api.NodeSelectorTerm{ - { - MatchExpressions: []api.NodeSelectorRequirement{ - { - Key: "a", - Operator: api.NodeSelectorOpIn, - Values: []string{"1"}, - }, - { - Key: "b", - Operator: api.NodeSelectorOpIn, - Values: []string{"2"}, - }, - { - Key: v1.LabelTopologyZone, - Operator: api.NodeSelectorOpIn, - Values: []string{"1", "2", "3"}, - }, - }, - }, - }, - }, - }, - }, - }, - err: nil, - }, - { - name: "AWS EBS PV conflicting affinity rules left in-tact", - handler: newPersistentVolumeLabel(), - pvlabeler: mockVolumeLabels(map[string]string{ - "a": "1", - "b": "2", - "c": "3", - }), - preAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", - Namespace: "myns", - Labels: map[string]string{ - "c": "3", - }, - }, - Spec: api.PersistentVolumeSpec{ - PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", - }, - }, - NodeAffinity: &api.VolumeNodeAffinity{ - Required: &api.NodeSelector{ - NodeSelectorTerms: []api.NodeSelectorTerm{ - { - MatchExpressions: []api.NodeSelectorRequirement{ - { - Key: "c", - Operator: api.NodeSelectorOpIn, - Values: []string{"3"}, - }, - }, - }, - }, - }, - }, - }, - }, - postAdmissionPV: &api.PersistentVolume{ - ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", - Namespace: "myns", - Labels: map[string]string{ - "a": "1", - "b": "2", - "c": "3", - }, - }, - Spec: api.PersistentVolumeSpec{ - PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", - }, - }, - NodeAffinity: &api.VolumeNodeAffinity{ - Required: &api.NodeSelector{ - NodeSelectorTerms: []api.NodeSelectorTerm{ - { - MatchExpressions: []api.NodeSelectorRequirement{ - { - Key: "c", - Operator: api.NodeSelectorOpIn, - Values: []string{"3"}, - }, - }, - }, - }, - }, - }, - }, - }, - err: nil, - }, - { - name: "AWS EBS PV non-conflicting affinity rules added", + name: "vSphere PV non-conflicting affinity rules added", handler: newPersistentVolumeLabel(), pvlabeler: mockVolumeLabels(map[string]string{ "d": "1", @@ -713,7 +507,7 @@ func Test_PVLAdmission(t *testing.T) { }), preAdmissionPV: &api.PersistentVolume{ ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", + Name: "vSpherePV", Namespace: "myns", Labels: map[string]string{ "a": "1", @@ -723,8 +517,8 @@ func Test_PVLAdmission(t *testing.T) { }, Spec: api.PersistentVolumeSpec{ PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", + VsphereVolume: &api.VsphereVirtualDiskVolumeSource{ + VolumePath: "123", }, }, NodeAffinity: &api.VolumeNodeAffinity{ @@ -756,7 +550,7 @@ func Test_PVLAdmission(t *testing.T) { }, postAdmissionPV: &api.PersistentVolume{ ObjectMeta: metav1.ObjectMeta{ - Name: "awsebs", + Name: "vSpherePV", Namespace: "myns", Labels: map[string]string{ "a": "1", @@ -769,8 +563,8 @@ func Test_PVLAdmission(t *testing.T) { }, Spec: api.PersistentVolumeSpec{ PersistentVolumeSource: api.PersistentVolumeSource{ - AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ - VolumeID: "123", + VsphereVolume: &api.VsphereVirtualDiskVolumeSource{ + VolumePath: "123", }, }, NodeAffinity: &api.VolumeNodeAffinity{ @@ -914,7 +708,6 @@ func Test_PVLAdmission(t *testing.T) { // provider does not reduce test coverage but it does simplify/clean up the tests here because // the provider is then decided based on the type of PV (EBS, GCEPD, Azure Disk, etc) func setPVLabeler(handler *persistentVolumeLabel, pvlabeler cloudprovider.PVLabeler) { - handler.awsPVLabeler = pvlabeler handler.gcePVLabeler = pvlabeler handler.azurePVLabeler = pvlabeler handler.vspherePVLabeler = pvlabeler diff --git a/staging/publishing/rules.yaml b/staging/publishing/rules.yaml index 9fb5c038a72..fed84e92e49 100644 --- a/staging/publishing/rules.yaml +++ b/staging/publishing/rules.yaml @@ -1673,8 +1673,6 @@ rules: branch: master - repository: cloud-provider branch: master - - repository: csi-translation-lib - branch: master - repository: apiserver branch: master - repository: component-base diff --git a/staging/src/k8s.io/cloud-provider/plugins.go b/staging/src/k8s.io/cloud-provider/plugins.go index 5300abdb4c0..7aa061157de 100644 --- a/staging/src/k8s.io/cloud-provider/plugins.go +++ b/staging/src/k8s.io/cloud-provider/plugins.go @@ -40,7 +40,6 @@ var ( external bool detail string }{ - {"aws", false, "The AWS provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes/cloud-provider-aws"}, {"azure", false, "The Azure provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes-sigs/cloud-provider-azure"}, {"gce", false, "The GCE provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes/cloud-provider-gcp"}, {"vsphere", false, "The vSphere provider is deprecated and will be removed in a future release. Please use https://github.com/kubernetes/cloud-provider-vsphere"}, diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/OWNERS b/staging/src/k8s.io/legacy-cloud-providers/aws/OWNERS deleted file mode 100644 index 346f06c8e32..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/OWNERS +++ /dev/null @@ -1,18 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners -# We are no longer accepting features into k8s.io/legacy-cloud-providers. -# Any kind/feature PRs must be approved by SIG Cloud Provider going forward. - -emeritus_approvers: - - justinsb - - gnufied - - jsafrane - - micahhausler - - m00nf1sh - - zmerlynn - - mcrute -reviewers: - - gnufied - - jsafrane - - justinsb - - nckturner - - m00nf1sh diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go deleted file mode 100644 index 2c18d56b4ac..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go +++ /dev/null @@ -1,5099 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "context" - "errors" - "fmt" - "io" - "path" - "regexp" - "sort" - "strconv" - "strings" - "sync" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/stscreds" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/autoscaling" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/elb" - "github.com/aws/aws-sdk-go/service/elbv2" - "github.com/aws/aws-sdk-go/service/kms" - "github.com/aws/aws-sdk-go/service/sts" - "gopkg.in/gcfg.v1" - v1 "k8s.io/api/core/v1" - "k8s.io/klog/v2" - netutils "k8s.io/utils/net" - - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/informers" - informercorev1 "k8s.io/client-go/informers/core/v1" - clientset "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/scheme" - v1core "k8s.io/client-go/kubernetes/typed/core/v1" - "k8s.io/client-go/pkg/version" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - cloudprovider "k8s.io/cloud-provider" - nodehelpers "k8s.io/cloud-provider/node/helpers" - servicehelpers "k8s.io/cloud-provider/service/helpers" - cloudvolume "k8s.io/cloud-provider/volume" - volerr "k8s.io/cloud-provider/volume/errors" - volumehelpers "k8s.io/cloud-provider/volume/helpers" -) - -// NLBHealthCheckRuleDescription is the comment used on a security group rule to -// indicate that it is used for health checks -const NLBHealthCheckRuleDescription = "kubernetes.io/rule/nlb/health" - -// NLBClientRuleDescription is the comment used on a security group rule to -// indicate that it is used for client traffic -const NLBClientRuleDescription = "kubernetes.io/rule/nlb/client" - -// NLBMtuDiscoveryRuleDescription is the comment used on a security group rule -// to indicate that it is used for mtu discovery -const NLBMtuDiscoveryRuleDescription = "kubernetes.io/rule/nlb/mtu" - -// ProviderName is the name of this cloud provider. -const ProviderName = "aws" - -// TagNameKubernetesService is the tag name we use to differentiate multiple -// services. Used currently for ELBs only. -const TagNameKubernetesService = "kubernetes.io/service-name" - -// TagNameSubnetInternalELB is the tag name used on a subnet to designate that -// it should be used for internal ELBs -const TagNameSubnetInternalELB = "kubernetes.io/role/internal-elb" - -// TagNameSubnetPublicELB is the tag name used on a subnet to designate that -// it should be used for internet ELBs -const TagNameSubnetPublicELB = "kubernetes.io/role/elb" - -// ServiceAnnotationLoadBalancerType is the annotation used on the service -// to indicate what type of Load Balancer we want. Right now, the only accepted -// value is "nlb" -const ServiceAnnotationLoadBalancerType = "service.beta.kubernetes.io/aws-load-balancer-type" - -// ServiceAnnotationLoadBalancerInternal is the annotation used on the service -// to indicate that we want an internal ELB. -const ServiceAnnotationLoadBalancerInternal = "service.beta.kubernetes.io/aws-load-balancer-internal" - -// ServiceAnnotationLoadBalancerProxyProtocol is the annotation used on the -// service to enable the proxy protocol on an ELB. Right now we only accept the -// value "*" which means enable the proxy protocol on all ELB backends. In the -// future we could adjust this to allow setting the proxy protocol only on -// certain backends. -const ServiceAnnotationLoadBalancerProxyProtocol = "service.beta.kubernetes.io/aws-load-balancer-proxy-protocol" - -// ServiceAnnotationLoadBalancerAccessLogEmitInterval is the annotation used to -// specify access log emit interval. -const ServiceAnnotationLoadBalancerAccessLogEmitInterval = "service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval" - -// ServiceAnnotationLoadBalancerAccessLogEnabled is the annotation used on the -// service to enable or disable access logs. -const ServiceAnnotationLoadBalancerAccessLogEnabled = "service.beta.kubernetes.io/aws-load-balancer-access-log-enabled" - -// ServiceAnnotationLoadBalancerAccessLogS3BucketName is the annotation used to -// specify access log s3 bucket name. -const ServiceAnnotationLoadBalancerAccessLogS3BucketName = "service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name" - -// ServiceAnnotationLoadBalancerAccessLogS3BucketPrefix is the annotation used -// to specify access log s3 bucket prefix. -const ServiceAnnotationLoadBalancerAccessLogS3BucketPrefix = "service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix" - -// ServiceAnnotationLoadBalancerConnectionDrainingEnabled is the annnotation -// used on the service to enable or disable connection draining. -const ServiceAnnotationLoadBalancerConnectionDrainingEnabled = "service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled" - -// ServiceAnnotationLoadBalancerConnectionDrainingTimeout is the annotation -// used on the service to specify a connection draining timeout. -const ServiceAnnotationLoadBalancerConnectionDrainingTimeout = "service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout" - -// ServiceAnnotationLoadBalancerConnectionIdleTimeout is the annotation used -// on the service to specify the idle connection timeout. -const ServiceAnnotationLoadBalancerConnectionIdleTimeout = "service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout" - -// ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled is the annotation -// used on the service to enable or disable cross-zone load balancing. -const ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled = "service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled" - -// ServiceAnnotationLoadBalancerExtraSecurityGroups is the annotation used -// on the service to specify additional security groups to be added to ELB created -const ServiceAnnotationLoadBalancerExtraSecurityGroups = "service.beta.kubernetes.io/aws-load-balancer-extra-security-groups" - -// ServiceAnnotationLoadBalancerSecurityGroups is the annotation used -// on the service to specify the security groups to be added to ELB created. Differently from the annotation -// "service.beta.kubernetes.io/aws-load-balancer-extra-security-groups", this replaces all other security groups previously assigned to the ELB. -const ServiceAnnotationLoadBalancerSecurityGroups = "service.beta.kubernetes.io/aws-load-balancer-security-groups" - -// ServiceAnnotationLoadBalancerCertificate is the annotation used on the -// service to request a secure listener. Value is a valid certificate ARN. -// For more, see http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-listener-config.html -// CertARN is an IAM or CM certificate ARN, e.g. arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012 -const ServiceAnnotationLoadBalancerCertificate = "service.beta.kubernetes.io/aws-load-balancer-ssl-cert" - -// ServiceAnnotationLoadBalancerSSLPorts is the annotation used on the service -// to specify a comma-separated list of ports that will use SSL/HTTPS -// listeners. Defaults to '*' (all). -const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-load-balancer-ssl-ports" - -// ServiceAnnotationLoadBalancerSSLNegotiationPolicy is the annotation used on -// the service to specify a SSL negotiation settings for the HTTPS/SSL listeners -// of your load balancer. Defaults to AWS's default -const ServiceAnnotationLoadBalancerSSLNegotiationPolicy = "service.beta.kubernetes.io/aws-load-balancer-ssl-negotiation-policy" - -// ServiceAnnotationLoadBalancerBEProtocol is the annotation used on the service -// to specify the protocol spoken by the backend (pod) behind a listener. -// If `http` (default) or `https`, an HTTPS listener that terminates the -// connection and parses headers is created. -// -// If set to `ssl` or `tcp`, a "raw" SSL listener is used. -// If set to `http` and `aws-load-balancer-ssl-cert` is not used then -// a HTTP listener is used. -const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol" - -// ServiceAnnotationLoadBalancerAdditionalTags is the annotation used on the service -// to specify a comma-separated list of key-value pairs which will be recorded as -// additional tags in the ELB. -// For example: "Key1=Val1,Key2=Val2,KeyNoVal1=,KeyNoVal2" -const ServiceAnnotationLoadBalancerAdditionalTags = "service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags" - -// ServiceAnnotationLoadBalancerHealthCheckProtocol is the annotation used on the service to -// specify the protocol used for the ELB health check. Supported values are TCP, HTTP, HTTPS -// Default is TCP if externalTrafficPolicy is Cluster, HTTP if externalTrafficPolicy is Local -const ServiceAnnotationLoadBalancerHealthCheckProtocol = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-protocol" - -// ServiceAnnotationLoadBalancerHealthCheckPort is the annotation used on the service to -// specify the port used for ELB health check. -// Default is traffic-port if externalTrafficPolicy is Cluster, healthCheckNodePort if externalTrafficPolicy is Local -const ServiceAnnotationLoadBalancerHealthCheckPort = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-port" - -// ServiceAnnotationLoadBalancerHealthCheckPath is the annotation used on the service to -// specify the path for the ELB health check when the health check protocol is HTTP/HTTPS -// Defaults to /healthz if externalTrafficPolicy is Local, / otherwise -const ServiceAnnotationLoadBalancerHealthCheckPath = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-path" - -// ServiceAnnotationLoadBalancerHCHealthyThreshold is the annotation used on -// the service to specify the number of successive successful health checks -// required for a backend to be considered healthy for traffic. For NLB, healthy-threshold -// and unhealthy-threshold must be equal. -const ServiceAnnotationLoadBalancerHCHealthyThreshold = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-healthy-threshold" - -// ServiceAnnotationLoadBalancerHCUnhealthyThreshold is the annotation used -// on the service to specify the number of unsuccessful health checks -// required for a backend to be considered unhealthy for traffic -const ServiceAnnotationLoadBalancerHCUnhealthyThreshold = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-unhealthy-threshold" - -// ServiceAnnotationLoadBalancerHCTimeout is the annotation used on the -// service to specify, in seconds, how long to wait before marking a health -// check as failed. -const ServiceAnnotationLoadBalancerHCTimeout = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-timeout" - -// ServiceAnnotationLoadBalancerHCInterval is the annotation used on the -// service to specify, in seconds, the interval between health checks. -const ServiceAnnotationLoadBalancerHCInterval = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-interval" - -// ServiceAnnotationLoadBalancerEIPAllocations is the annotation used on the -// service to specify a comma separated list of EIP allocations to use as -// static IP addresses for the NLB. Only supported on elbv2 (NLB) -const ServiceAnnotationLoadBalancerEIPAllocations = "service.beta.kubernetes.io/aws-load-balancer-eip-allocations" - -// ServiceAnnotationLoadBalancerTargetNodeLabels is the annotation used on the service -// to specify a comma-separated list of key-value pairs which will be used to select -// the target nodes for the load balancer -// For example: "Key1=Val1,Key2=Val2,KeyNoVal1=,KeyNoVal2" -const ServiceAnnotationLoadBalancerTargetNodeLabels = "service.beta.kubernetes.io/aws-load-balancer-target-node-labels" - -// ServiceAnnotationLoadBalancerSubnets is the annotation used on the service to specify the -// Availability Zone configuration for the load balancer. The values are comma separated list of -// subnetID or subnetName from different AZs -// By default, the controller will auto-discover the subnets. If there are multiple subnets per AZ, auto-discovery -// will break the tie in the following order - -// 1. prefer the subnet with the correct role tag. kubernetes.io/role/elb for public and kubernetes.io/role/internal-elb for private access -// 2. prefer the subnet with the cluster tag kubernetes.io/cluster/ -// 3. prefer the subnet that is first in lexicographic order -const ServiceAnnotationLoadBalancerSubnets = "service.beta.kubernetes.io/aws-load-balancer-subnets" - -// Event key when a volume is stuck on attaching state when being attached to a volume -const volumeAttachmentStuck = "VolumeAttachmentStuck" - -// Indicates that a node has volumes stuck in attaching state and hence it is not fit for scheduling more pods -const nodeWithImpairedVolumes = "NodeWithImpairedVolumes" - -const ( - // volumeAttachmentConsecutiveErrorLimit is the number of consecutive errors we will ignore when waiting for a volume to attach/detach - volumeAttachmentStatusConsecutiveErrorLimit = 10 - - // Attach typically takes 2-5 seconds (average is 2). Asking before 2 seconds is just waste of API quota. - volumeAttachmentStatusInitialDelay = 2 * time.Second - // Detach typically takes 5-10 seconds (average is 6). Asking before 5 seconds is just waste of API quota. - volumeDetachmentStatusInitialDelay = 5 * time.Second - // After the initial delay, poll attach/detach with exponential backoff (2046 seconds total) - volumeAttachmentStatusPollDelay = 2 * time.Second - volumeAttachmentStatusFactor = 2 - volumeAttachmentStatusSteps = 11 - - // createTag* is configuration of exponential backoff for CreateTag call. We - // retry mainly because if we create an object, we cannot tag it until it is - // "fully created" (eventual consistency). Starting with 1 second, doubling - // it every step and taking 9 steps results in 255 second total waiting - // time. - createTagInitialDelay = 1 * time.Second - createTagFactor = 2.0 - createTagSteps = 9 - - // volumeCreate* is configuration of exponential backoff for created volume. - // On a random AWS account (shared among several developers) it took 4s on - // average, 8s max. - volumeCreateInitialDelay = 5 * time.Second - volumeCreateBackoffFactor = 1.2 - volumeCreateBackoffSteps = 10 - - // Number of node names that can be added to a filter. The AWS limit is 200 - // but we are using a lower limit on purpose - filterNodeLimit = 150 -) - -const ( - // represents expected attachment status of a volume after attach - volumeAttachedStatus = "attached" - - // represents expected attachment status of a volume after detach - volumeDetachedStatus = "detached" -) - -// awsTagNameMasterRoles is a set of well-known AWS tag names that indicate the instance is a master -// The major consequence is that it is then not considered for AWS zone discovery for dynamic volume creation. -var awsTagNameMasterRoles = sets.NewString("kubernetes.io/role/master", "k8s.io/role/master") - -// Maps from backend protocol to ELB protocol -var backendProtocolMapping = map[string]string{ - "https": "https", - "http": "https", - "ssl": "ssl", - "tcp": "ssl", -} - -// MaxReadThenCreateRetries sets the maximum number of attempts we will make when -// we read to see if something exists and then try to create it if we didn't find it. -// This can fail once in a consistent system if done in parallel -// In an eventually consistent system, it could fail unboundedly -const MaxReadThenCreateRetries = 30 - -// DefaultVolumeType specifies which storage to use for newly created Volumes -// TODO: Remove when user/admin can configure volume types and thus we don't -// need hardcoded defaults. -const DefaultVolumeType = "gp2" - -// Services is an abstraction over AWS, to allow mocking/other implementations -type Services interface { - Compute(region string) (EC2, error) - LoadBalancing(region string) (ELB, error) - LoadBalancingV2(region string) (ELBV2, error) - Autoscaling(region string) (ASG, error) - Metadata() (EC2Metadata, error) - KeyManagement(region string) (KMS, error) -} - -// EC2 is an abstraction over AWS', to allow mocking/other implementations -// Note that the DescribeX functions return a list, so callers don't need to deal with paging -// TODO: Should we rename this to AWS (EBS & ELB are not technically part of EC2) -type EC2 interface { - // Query EC2 for instances matching the filter - DescribeInstances(request *ec2.DescribeInstancesInput) ([]*ec2.Instance, error) - - // Attach a volume to an instance - AttachVolume(*ec2.AttachVolumeInput) (*ec2.VolumeAttachment, error) - // Detach a volume from an instance it is attached to - DetachVolume(request *ec2.DetachVolumeInput) (resp *ec2.VolumeAttachment, err error) - // Lists volumes - DescribeVolumes(request *ec2.DescribeVolumesInput) ([]*ec2.Volume, error) - // Create an EBS volume - CreateVolume(request *ec2.CreateVolumeInput) (resp *ec2.Volume, err error) - // Delete an EBS volume - DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error) - - ModifyVolume(*ec2.ModifyVolumeInput) (*ec2.ModifyVolumeOutput, error) - - DescribeVolumeModifications(*ec2.DescribeVolumesModificationsInput) ([]*ec2.VolumeModification, error) - - DescribeSecurityGroups(request *ec2.DescribeSecurityGroupsInput) ([]*ec2.SecurityGroup, error) - - CreateSecurityGroup(*ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error) - DeleteSecurityGroup(request *ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error) - - AuthorizeSecurityGroupIngress(*ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error) - RevokeSecurityGroupIngress(*ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error) - - DescribeSubnets(*ec2.DescribeSubnetsInput) ([]*ec2.Subnet, error) - - CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) - - DescribeRouteTables(request *ec2.DescribeRouteTablesInput) ([]*ec2.RouteTable, error) - CreateRoute(request *ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error) - DeleteRoute(request *ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error) - - ModifyInstanceAttribute(request *ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error) - - DescribeVpcs(input *ec2.DescribeVpcsInput) (*ec2.DescribeVpcsOutput, error) -} - -// ELB is a simple pass-through of AWS' ELB client interface, which allows for testing -type ELB interface { - CreateLoadBalancer(*elb.CreateLoadBalancerInput) (*elb.CreateLoadBalancerOutput, error) - DeleteLoadBalancer(*elb.DeleteLoadBalancerInput) (*elb.DeleteLoadBalancerOutput, error) - DescribeLoadBalancers(*elb.DescribeLoadBalancersInput) (*elb.DescribeLoadBalancersOutput, error) - AddTags(*elb.AddTagsInput) (*elb.AddTagsOutput, error) - RegisterInstancesWithLoadBalancer(*elb.RegisterInstancesWithLoadBalancerInput) (*elb.RegisterInstancesWithLoadBalancerOutput, error) - DeregisterInstancesFromLoadBalancer(*elb.DeregisterInstancesFromLoadBalancerInput) (*elb.DeregisterInstancesFromLoadBalancerOutput, error) - CreateLoadBalancerPolicy(*elb.CreateLoadBalancerPolicyInput) (*elb.CreateLoadBalancerPolicyOutput, error) - SetLoadBalancerPoliciesForBackendServer(*elb.SetLoadBalancerPoliciesForBackendServerInput) (*elb.SetLoadBalancerPoliciesForBackendServerOutput, error) - SetLoadBalancerPoliciesOfListener(input *elb.SetLoadBalancerPoliciesOfListenerInput) (*elb.SetLoadBalancerPoliciesOfListenerOutput, error) - DescribeLoadBalancerPolicies(input *elb.DescribeLoadBalancerPoliciesInput) (*elb.DescribeLoadBalancerPoliciesOutput, error) - - DetachLoadBalancerFromSubnets(*elb.DetachLoadBalancerFromSubnetsInput) (*elb.DetachLoadBalancerFromSubnetsOutput, error) - AttachLoadBalancerToSubnets(*elb.AttachLoadBalancerToSubnetsInput) (*elb.AttachLoadBalancerToSubnetsOutput, error) - - CreateLoadBalancerListeners(*elb.CreateLoadBalancerListenersInput) (*elb.CreateLoadBalancerListenersOutput, error) - DeleteLoadBalancerListeners(*elb.DeleteLoadBalancerListenersInput) (*elb.DeleteLoadBalancerListenersOutput, error) - - ApplySecurityGroupsToLoadBalancer(*elb.ApplySecurityGroupsToLoadBalancerInput) (*elb.ApplySecurityGroupsToLoadBalancerOutput, error) - - ConfigureHealthCheck(*elb.ConfigureHealthCheckInput) (*elb.ConfigureHealthCheckOutput, error) - - DescribeLoadBalancerAttributes(*elb.DescribeLoadBalancerAttributesInput) (*elb.DescribeLoadBalancerAttributesOutput, error) - ModifyLoadBalancerAttributes(*elb.ModifyLoadBalancerAttributesInput) (*elb.ModifyLoadBalancerAttributesOutput, error) -} - -// ELBV2 is a simple pass-through of AWS' ELBV2 client interface, which allows for testing -type ELBV2 interface { - AddTags(input *elbv2.AddTagsInput) (*elbv2.AddTagsOutput, error) - - CreateLoadBalancer(*elbv2.CreateLoadBalancerInput) (*elbv2.CreateLoadBalancerOutput, error) - DescribeLoadBalancers(*elbv2.DescribeLoadBalancersInput) (*elbv2.DescribeLoadBalancersOutput, error) - DeleteLoadBalancer(*elbv2.DeleteLoadBalancerInput) (*elbv2.DeleteLoadBalancerOutput, error) - - ModifyLoadBalancerAttributes(*elbv2.ModifyLoadBalancerAttributesInput) (*elbv2.ModifyLoadBalancerAttributesOutput, error) - DescribeLoadBalancerAttributes(*elbv2.DescribeLoadBalancerAttributesInput) (*elbv2.DescribeLoadBalancerAttributesOutput, error) - - CreateTargetGroup(*elbv2.CreateTargetGroupInput) (*elbv2.CreateTargetGroupOutput, error) - DescribeTargetGroups(*elbv2.DescribeTargetGroupsInput) (*elbv2.DescribeTargetGroupsOutput, error) - ModifyTargetGroup(*elbv2.ModifyTargetGroupInput) (*elbv2.ModifyTargetGroupOutput, error) - DeleteTargetGroup(*elbv2.DeleteTargetGroupInput) (*elbv2.DeleteTargetGroupOutput, error) - - DescribeTargetHealth(input *elbv2.DescribeTargetHealthInput) (*elbv2.DescribeTargetHealthOutput, error) - - DescribeTargetGroupAttributes(*elbv2.DescribeTargetGroupAttributesInput) (*elbv2.DescribeTargetGroupAttributesOutput, error) - ModifyTargetGroupAttributes(*elbv2.ModifyTargetGroupAttributesInput) (*elbv2.ModifyTargetGroupAttributesOutput, error) - - RegisterTargets(*elbv2.RegisterTargetsInput) (*elbv2.RegisterTargetsOutput, error) - DeregisterTargets(*elbv2.DeregisterTargetsInput) (*elbv2.DeregisterTargetsOutput, error) - - CreateListener(*elbv2.CreateListenerInput) (*elbv2.CreateListenerOutput, error) - DescribeListeners(*elbv2.DescribeListenersInput) (*elbv2.DescribeListenersOutput, error) - DeleteListener(*elbv2.DeleteListenerInput) (*elbv2.DeleteListenerOutput, error) - ModifyListener(*elbv2.ModifyListenerInput) (*elbv2.ModifyListenerOutput, error) - - WaitUntilLoadBalancersDeleted(*elbv2.DescribeLoadBalancersInput) error -} - -// ASG is a simple pass-through of the Autoscaling client interface, which -// allows for testing. -type ASG interface { - UpdateAutoScalingGroup(*autoscaling.UpdateAutoScalingGroupInput) (*autoscaling.UpdateAutoScalingGroupOutput, error) - DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error) -} - -// KMS is a simple pass-through of the Key Management Service client interface, -// which allows for testing. -type KMS interface { - DescribeKey(*kms.DescribeKeyInput) (*kms.DescribeKeyOutput, error) -} - -// EC2Metadata is an abstraction over the AWS metadata service. -type EC2Metadata interface { - // Query the EC2 metadata service (used to discover instance-id etc) - GetMetadata(path string) (string, error) -} - -// AWS volume types -const ( - // Provisioned IOPS SSD - VolumeTypeIO1 = "io1" - // General Purpose SSD - VolumeTypeGP2 = "gp2" - // Cold HDD (sc1) - VolumeTypeSC1 = "sc1" - // Throughput Optimized HDD - VolumeTypeST1 = "st1" -) - -// AWS provisioning limits. -// Source: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html -const ( - MinTotalIOPS = 100 - MaxTotalIOPS = 64000 -) - -// VolumeOptions specifies capacity and tags for a volume. -type VolumeOptions struct { - CapacityGB int - Tags map[string]string - VolumeType string - AvailabilityZone string - // IOPSPerGB x CapacityGB will give total IOPS of the volume to create. - // Calculated total IOPS will be capped at MaxTotalIOPS. - IOPSPerGB int - Encrypted bool - // fully qualified resource name to the key to use for encryption. - // example: arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef - KmsKeyID string -} - -// Volumes is an interface for managing cloud-provisioned volumes -// TODO: Allow other clouds to implement this -type Volumes interface { - // Attach the disk to the node with the specified NodeName - // nodeName can be empty to mean "the instance on which we are running" - // Returns the device (e.g. /dev/xvdf) where we attached the volume - AttachDisk(diskName KubernetesVolumeID, nodeName types.NodeName) (string, error) - // Detach the disk from the node with the specified NodeName - // nodeName can be empty to mean "the instance on which we are running" - // Returns the device where the volume was attached - DetachDisk(diskName KubernetesVolumeID, nodeName types.NodeName) (string, error) - - // Create a volume with the specified options - CreateDisk(volumeOptions *VolumeOptions) (volumeName KubernetesVolumeID, err error) - // Delete the specified volume - // Returns true iff the volume was deleted - // If the was not found, returns (false, nil) - DeleteDisk(volumeName KubernetesVolumeID) (bool, error) - - // Get labels to apply to volume on creation - GetVolumeLabels(volumeName KubernetesVolumeID) (map[string]string, error) - - // Get volume's disk path from volume name - // return the device path where the volume is attached - GetDiskPath(volumeName KubernetesVolumeID) (string, error) - - // Check if the volume is already attached to the node with the specified NodeName - DiskIsAttached(diskName KubernetesVolumeID, nodeName types.NodeName) (bool, error) - - // Check if disks specified in argument map are still attached to their respective nodes. - DisksAreAttached(map[types.NodeName][]KubernetesVolumeID) (map[types.NodeName]map[KubernetesVolumeID]bool, error) - - // Expand the disk to new size - ResizeDisk(diskName KubernetesVolumeID, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error) -} - -// InstanceGroups is an interface for managing cloud-managed instance groups / autoscaling instance groups -// TODO: Allow other clouds to implement this -type InstanceGroups interface { - // Set the size to the fixed size - ResizeInstanceGroup(instanceGroupName string, size int) error - // Queries the cloud provider for information about the specified instance group - DescribeInstanceGroup(instanceGroupName string) (InstanceGroupInfo, error) -} - -// InstanceGroupInfo is returned by InstanceGroups.Describe, and exposes information about the group. -type InstanceGroupInfo interface { - // The number of instances currently running under control of this group - CurrentSize() (int, error) -} - -var _ cloudprovider.Interface = (*Cloud)(nil) -var _ cloudprovider.Instances = (*Cloud)(nil) -var _ cloudprovider.LoadBalancer = (*Cloud)(nil) -var _ cloudprovider.Routes = (*Cloud)(nil) -var _ cloudprovider.Zones = (*Cloud)(nil) -var _ cloudprovider.PVLabeler = (*Cloud)(nil) - -// Cloud is an implementation of Interface, LoadBalancer and Instances for Amazon Web Services. -type Cloud struct { - ec2 EC2 - elb ELB - elbv2 ELBV2 - asg ASG - kms KMS - metadata EC2Metadata - cfg *CloudConfig - region string - vpcID string - - tagging awsTagging - - // The AWS instance that we are running on - // Note that we cache some state in awsInstance (mountpoints), so we must preserve the instance - selfAWSInstance *awsInstance - - instanceCache instanceCache - - clientBuilder cloudprovider.ControllerClientBuilder - kubeClient clientset.Interface - - nodeInformer informercorev1.NodeInformer - // Extract the function out to make it easier to test - nodeInformerHasSynced cache.InformerSynced - - eventBroadcaster record.EventBroadcaster - eventRecorder record.EventRecorder - - // We keep an active list of devices we have assigned but not yet - // attached, to avoid a race condition where we assign a device mapping - // and then get a second request before we attach the volume - attachingMutex sync.Mutex - attaching map[types.NodeName]map[mountDevice]EBSVolumeID - - // state of our device allocator for each node - deviceAllocators map[types.NodeName]DeviceAllocator -} - -var _ Volumes = &Cloud{} - -// CloudConfig wraps the settings for the AWS cloud provider. -// NOTE: Cloud config files should follow the same Kubernetes deprecation policy as -// flags or CLIs. Config fields should not change behavior in incompatible ways and -// should be deprecated for at least 2 release prior to removing. -// See https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-flag-or-cli -// for more details. -type CloudConfig struct { - Global struct { - // TODO: Is there any use for this? We can get it from the instance metadata service - // Maybe if we're not running on AWS, e.g. bootstrap; for now it is not very useful - Zone string - - // The AWS VPC flag enables the possibility to run the master components - // on a different aws account, on a different cloud provider or on-premises. - // If the flag is set also the KubernetesClusterTag must be provided - VPC string - // SubnetID enables using a specific subnet to use for ELB's - SubnetID string - // RouteTableID enables using a specific RouteTable - RouteTableID string - - // RoleARN is the IAM role to assume when interaction with AWS APIs. - RoleARN string - - // KubernetesClusterTag is the legacy cluster id we'll use to identify our cluster resources - KubernetesClusterTag string - // KubernetesClusterID is the cluster id we'll use to identify our cluster resources - KubernetesClusterID string - - //The aws provider creates an inbound rule per load balancer on the node security - //group. However, this can run into the AWS security group rule limit of 50 if - //many LoadBalancers are created. - // - //This flag disables the automatic ingress creation. It requires that the user - //has setup a rule that allows inbound traffic on kubelet ports from the - //local VPC subnet (so load balancers can access it). E.g. 10.82.0.0/16 30000-32000. - DisableSecurityGroupIngress bool - - //AWS has a hard limit of 500 security groups. For large clusters creating a security group for each ELB - //can cause the max number of security groups to be reached. If this is set instead of creating a new - //Security group for each ELB this security group will be used instead. - ElbSecurityGroup string - - //During the instantiation of an new AWS cloud provider, the detected region - //is validated against a known set of regions. - // - //In a non-standard, AWS like environment (e.g. Eucalyptus), this check may - //be undesirable. Setting this to true will disable the check and provide - //a warning that the check was skipped. Please note that this is an - //experimental feature and work-in-progress for the moment. If you find - //yourself in an non-AWS cloud and open an issue, please indicate that in the - //issue body. - DisableStrictZoneCheck bool - } - // [ServiceOverride "1"] - // Service = s3 - // Region = region1 - // URL = https://s3.foo.bar - // SigningRegion = signing_region - // SigningMethod = signing_method - // - // [ServiceOverride "2"] - // Service = ec2 - // Region = region2 - // URL = https://ec2.foo.bar - // SigningRegion = signing_region - // SigningMethod = signing_method - ServiceOverride map[string]*struct { - Service string - Region string - URL string - SigningRegion string - SigningMethod string - SigningName string - } -} - -func (cfg *CloudConfig) validateOverrides() error { - if len(cfg.ServiceOverride) == 0 { - return nil - } - set := make(map[string]bool) - for onum, ovrd := range cfg.ServiceOverride { - // Note: gcfg does not space trim, so we have to when comparing to empty string "" - name := strings.TrimSpace(ovrd.Service) - if name == "" { - return fmt.Errorf("service name is missing [Service is \"\"] in override %s", onum) - } - // insure the map service name is space trimmed - ovrd.Service = name - - region := strings.TrimSpace(ovrd.Region) - if region == "" { - return fmt.Errorf("service region is missing [Region is \"\"] in override %s", onum) - } - // insure the map region is space trimmed - ovrd.Region = region - - url := strings.TrimSpace(ovrd.URL) - if url == "" { - return fmt.Errorf("url is missing [URL is \"\"] in override %s", onum) - } - signingRegion := strings.TrimSpace(ovrd.SigningRegion) - if signingRegion == "" { - return fmt.Errorf("signingRegion is missing [SigningRegion is \"\"] in override %s", onum) - } - signature := name + "_" + region - if set[signature] { - return fmt.Errorf("duplicate entry found for service override [%s] (%s in %s)", onum, name, region) - } - set[signature] = true - } - return nil -} - -func (cfg *CloudConfig) getResolver() endpoints.ResolverFunc { - defaultResolver := endpoints.DefaultResolver() - defaultResolverFn := func(service, region string, - optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { - return defaultResolver.EndpointFor(service, region, optFns...) - } - if len(cfg.ServiceOverride) == 0 { - return defaultResolverFn - } - - return func(service, region string, - optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { - for _, override := range cfg.ServiceOverride { - if override.Service == service && override.Region == region { - return endpoints.ResolvedEndpoint{ - URL: override.URL, - SigningRegion: override.SigningRegion, - SigningMethod: override.SigningMethod, - SigningName: override.SigningName, - }, nil - } - } - return defaultResolver.EndpointFor(service, region, optFns...) - } -} - -// awsSdkEC2 is an implementation of the EC2 interface, backed by aws-sdk-go -type awsSdkEC2 struct { - ec2 *ec2.EC2 -} - -// Interface to make the CloudConfig immutable for awsSDKProvider -type awsCloudConfigProvider interface { - getResolver() endpoints.ResolverFunc -} - -type awsSDKProvider struct { - creds *credentials.Credentials - cfg awsCloudConfigProvider - - mutex sync.Mutex - regionDelayers map[string]*CrossRequestRetryDelay -} - -func newAWSSDKProvider(creds *credentials.Credentials, cfg *CloudConfig) *awsSDKProvider { - return &awsSDKProvider{ - creds: creds, - cfg: cfg, - regionDelayers: make(map[string]*CrossRequestRetryDelay), - } -} - -func (p *awsSDKProvider) addHandlers(regionName string, h *request.Handlers) { - h.Build.PushFrontNamed(request.NamedHandler{ - Name: "k8s/user-agent", - Fn: request.MakeAddToUserAgentHandler("kubernetes", version.Get().String()), - }) - - h.Sign.PushFrontNamed(request.NamedHandler{ - Name: "k8s/logger", - Fn: awsHandlerLogger, - }) - - delayer := p.getCrossRequestRetryDelay(regionName) - if delayer != nil { - h.Sign.PushFrontNamed(request.NamedHandler{ - Name: "k8s/delay-presign", - Fn: delayer.BeforeSign, - }) - - h.AfterRetry.PushFrontNamed(request.NamedHandler{ - Name: "k8s/delay-afterretry", - Fn: delayer.AfterRetry, - }) - } - - p.addAPILoggingHandlers(h) -} - -func (p *awsSDKProvider) addAPILoggingHandlers(h *request.Handlers) { - h.Send.PushBackNamed(request.NamedHandler{ - Name: "k8s/api-request", - Fn: awsSendHandlerLogger, - }) - - h.ValidateResponse.PushFrontNamed(request.NamedHandler{ - Name: "k8s/api-validate-response", - Fn: awsValidateResponseHandlerLogger, - }) -} - -// Get a CrossRequestRetryDelay, scoped to the region, not to the request. -// This means that when we hit a limit on a call, we will delay _all_ calls to the API. -// We do this to protect the AWS account from becoming overloaded and effectively locked. -// We also log when we hit request limits. -// Note that this delays the current goroutine; this is bad behaviour and will -// likely cause k8s to become slow or unresponsive for cloud operations. -// However, this throttle is intended only as a last resort. When we observe -// this throttling, we need to address the root cause (e.g. add a delay to a -// controller retry loop) -func (p *awsSDKProvider) getCrossRequestRetryDelay(regionName string) *CrossRequestRetryDelay { - p.mutex.Lock() - defer p.mutex.Unlock() - - delayer, found := p.regionDelayers[regionName] - if !found { - delayer = NewCrossRequestRetryDelay() - p.regionDelayers[regionName] = delayer - } - return delayer -} - -// SetInformers implements InformerUser interface by setting up informer-fed caches for aws lib to -// leverage Kubernetes API for caching -func (c *Cloud) SetInformers(informerFactory informers.SharedInformerFactory) { - klog.Infof("Setting up informers for Cloud") - c.nodeInformer = informerFactory.Core().V1().Nodes() - c.nodeInformerHasSynced = c.nodeInformer.Informer().HasSynced -} - -func (p *awsSDKProvider) Compute(regionName string) (EC2, error) { - awsConfig := &aws.Config{ - Region: ®ionName, - Credentials: p.creds, - } - awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true). - WithEndpointResolver(p.cfg.getResolver()) - sess, err := session.NewSessionWithOptions(session.Options{ - Config: *awsConfig, - SharedConfigState: session.SharedConfigEnable, - }) - - if err != nil { - return nil, fmt.Errorf("unable to initialize AWS session: %v", err) - } - service := ec2.New(sess) - - p.addHandlers(regionName, &service.Handlers) - - ec2 := &awsSdkEC2{ - ec2: service, - } - return ec2, nil -} - -func (p *awsSDKProvider) LoadBalancing(regionName string) (ELB, error) { - awsConfig := &aws.Config{ - Region: ®ionName, - Credentials: p.creds, - } - awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true). - WithEndpointResolver(p.cfg.getResolver()) - sess, err := session.NewSessionWithOptions(session.Options{ - Config: *awsConfig, - SharedConfigState: session.SharedConfigEnable, - }) - if err != nil { - return nil, fmt.Errorf("unable to initialize AWS session: %v", err) - } - elbClient := elb.New(sess) - p.addHandlers(regionName, &elbClient.Handlers) - - return elbClient, nil -} - -func (p *awsSDKProvider) LoadBalancingV2(regionName string) (ELBV2, error) { - awsConfig := &aws.Config{ - Region: ®ionName, - Credentials: p.creds, - } - awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true). - WithEndpointResolver(p.cfg.getResolver()) - sess, err := session.NewSessionWithOptions(session.Options{ - Config: *awsConfig, - SharedConfigState: session.SharedConfigEnable, - }) - if err != nil { - return nil, fmt.Errorf("unable to initialize AWS session: %v", err) - } - elbClient := elbv2.New(sess) - - p.addHandlers(regionName, &elbClient.Handlers) - - return elbClient, nil -} - -func (p *awsSDKProvider) Autoscaling(regionName string) (ASG, error) { - awsConfig := &aws.Config{ - Region: ®ionName, - Credentials: p.creds, - } - awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true). - WithEndpointResolver(p.cfg.getResolver()) - sess, err := session.NewSessionWithOptions(session.Options{ - Config: *awsConfig, - SharedConfigState: session.SharedConfigEnable, - }) - if err != nil { - return nil, fmt.Errorf("unable to initialize AWS session: %v", err) - } - client := autoscaling.New(sess) - - p.addHandlers(regionName, &client.Handlers) - - return client, nil -} - -func (p *awsSDKProvider) Metadata() (EC2Metadata, error) { - sess, err := session.NewSession(&aws.Config{ - EndpointResolver: p.cfg.getResolver(), - }) - if err != nil { - return nil, fmt.Errorf("unable to initialize AWS session: %v", err) - } - client := ec2metadata.New(sess) - p.addAPILoggingHandlers(&client.Handlers) - return client, nil -} - -func (p *awsSDKProvider) KeyManagement(regionName string) (KMS, error) { - awsConfig := &aws.Config{ - Region: ®ionName, - Credentials: p.creds, - } - awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true). - WithEndpointResolver(p.cfg.getResolver()) - sess, err := session.NewSessionWithOptions(session.Options{ - Config: *awsConfig, - SharedConfigState: session.SharedConfigEnable, - }) - if err != nil { - return nil, fmt.Errorf("unable to initialize AWS session: %v", err) - } - kmsClient := kms.New(sess) - - p.addHandlers(regionName, &kmsClient.Handlers) - - return kmsClient, nil -} - -func newEc2Filter(name string, values ...string) *ec2.Filter { - filter := &ec2.Filter{ - Name: aws.String(name), - } - for _, value := range values { - filter.Values = append(filter.Values, aws.String(value)) - } - return filter -} - -// AddSSHKeyToAllInstances is currently not implemented. -func (c *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error { - return cloudprovider.NotImplemented -} - -// CurrentNodeName returns the name of the current node -func (c *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) { - return c.selfAWSInstance.nodeName, nil -} - -// Implementation of EC2.Instances -func (s *awsSdkEC2) DescribeInstances(request *ec2.DescribeInstancesInput) ([]*ec2.Instance, error) { - // Instances are paged - results := []*ec2.Instance{} - var nextToken *string - requestTime := time.Now() - - if request.MaxResults == nil && request.InstanceIds == nil { - // MaxResults must be set in order for pagination to work - // MaxResults cannot be set with InstanceIds - request.MaxResults = aws.Int64(1000) - } - - for { - response, err := s.ec2.DescribeInstances(request) - if err != nil { - recordAWSMetric("describe_instance", 0, err) - return nil, fmt.Errorf("error listing AWS instances: %q", err) - } - - for _, reservation := range response.Reservations { - results = append(results, reservation.Instances...) - } - - nextToken = response.NextToken - if aws.StringValue(nextToken) == "" { - break - } - request.NextToken = nextToken - } - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("describe_instance", timeTaken, nil) - return results, nil -} - -// Implements EC2.DescribeSecurityGroups -func (s *awsSdkEC2) DescribeSecurityGroups(request *ec2.DescribeSecurityGroupsInput) ([]*ec2.SecurityGroup, error) { - // Security groups are paged - results := []*ec2.SecurityGroup{} - var nextToken *string - requestTime := time.Now() - for { - response, err := s.ec2.DescribeSecurityGroups(request) - if err != nil { - recordAWSMetric("describe_security_groups", 0, err) - return nil, fmt.Errorf("error listing AWS security groups: %q", err) - } - - results = append(results, response.SecurityGroups...) - - nextToken = response.NextToken - if aws.StringValue(nextToken) == "" { - break - } - request.NextToken = nextToken - } - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("describe_security_groups", timeTaken, nil) - return results, nil -} - -func (s *awsSdkEC2) AttachVolume(request *ec2.AttachVolumeInput) (*ec2.VolumeAttachment, error) { - requestTime := time.Now() - resp, err := s.ec2.AttachVolume(request) - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("attach_volume", timeTaken, err) - return resp, err -} - -func (s *awsSdkEC2) DetachVolume(request *ec2.DetachVolumeInput) (*ec2.VolumeAttachment, error) { - requestTime := time.Now() - resp, err := s.ec2.DetachVolume(request) - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("detach_volume", timeTaken, err) - return resp, err -} - -func (s *awsSdkEC2) DescribeVolumes(request *ec2.DescribeVolumesInput) ([]*ec2.Volume, error) { - // Volumes are paged - results := []*ec2.Volume{} - var nextToken *string - requestTime := time.Now() - for { - response, err := s.ec2.DescribeVolumes(request) - - if err != nil { - recordAWSMetric("describe_volume", 0, err) - return nil, err - } - - results = append(results, response.Volumes...) - - nextToken = response.NextToken - if aws.StringValue(nextToken) == "" { - break - } - request.NextToken = nextToken - } - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("describe_volume", timeTaken, nil) - return results, nil -} - -func (s *awsSdkEC2) CreateVolume(request *ec2.CreateVolumeInput) (*ec2.Volume, error) { - requestTime := time.Now() - resp, err := s.ec2.CreateVolume(request) - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("create_volume", timeTaken, err) - return resp, err -} - -func (s *awsSdkEC2) DeleteVolume(request *ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error) { - requestTime := time.Now() - resp, err := s.ec2.DeleteVolume(request) - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("delete_volume", timeTaken, err) - return resp, err -} - -func (s *awsSdkEC2) ModifyVolume(request *ec2.ModifyVolumeInput) (*ec2.ModifyVolumeOutput, error) { - requestTime := time.Now() - resp, err := s.ec2.ModifyVolume(request) - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("modify_volume", timeTaken, err) - return resp, err -} - -func (s *awsSdkEC2) DescribeVolumeModifications(request *ec2.DescribeVolumesModificationsInput) ([]*ec2.VolumeModification, error) { - requestTime := time.Now() - results := []*ec2.VolumeModification{} - var nextToken *string - for { - resp, err := s.ec2.DescribeVolumesModifications(request) - if err != nil { - recordAWSMetric("describe_volume_modification", 0, err) - return nil, fmt.Errorf("error listing volume modifictions : %v", err) - } - results = append(results, resp.VolumesModifications...) - nextToken = resp.NextToken - if aws.StringValue(nextToken) == "" { - break - } - request.NextToken = nextToken - } - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("describe_volume_modification", timeTaken, nil) - return results, nil -} - -func (s *awsSdkEC2) DescribeSubnets(request *ec2.DescribeSubnetsInput) ([]*ec2.Subnet, error) { - // Subnets are not paged - response, err := s.ec2.DescribeSubnets(request) - if err != nil { - return nil, fmt.Errorf("error listing AWS subnets: %q", err) - } - return response.Subnets, nil -} - -func (s *awsSdkEC2) CreateSecurityGroup(request *ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error) { - return s.ec2.CreateSecurityGroup(request) -} - -func (s *awsSdkEC2) DeleteSecurityGroup(request *ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error) { - return s.ec2.DeleteSecurityGroup(request) -} - -func (s *awsSdkEC2) AuthorizeSecurityGroupIngress(request *ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error) { - return s.ec2.AuthorizeSecurityGroupIngress(request) -} - -func (s *awsSdkEC2) RevokeSecurityGroupIngress(request *ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error) { - return s.ec2.RevokeSecurityGroupIngress(request) -} - -func (s *awsSdkEC2) CreateTags(request *ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) { - requestTime := time.Now() - resp, err := s.ec2.CreateTags(request) - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("create_tags", timeTaken, err) - return resp, err -} - -func (s *awsSdkEC2) DescribeRouteTables(request *ec2.DescribeRouteTablesInput) ([]*ec2.RouteTable, error) { - results := []*ec2.RouteTable{} - var nextToken *string - requestTime := time.Now() - for { - response, err := s.ec2.DescribeRouteTables(request) - if err != nil { - recordAWSMetric("describe_route_tables", 0, err) - return nil, fmt.Errorf("error listing AWS route tables: %q", err) - } - - results = append(results, response.RouteTables...) - - nextToken = response.NextToken - if aws.StringValue(nextToken) == "" { - break - } - request.NextToken = nextToken - } - timeTaken := time.Since(requestTime).Seconds() - recordAWSMetric("describe_route_tables", timeTaken, nil) - return results, nil -} - -func (s *awsSdkEC2) CreateRoute(request *ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error) { - return s.ec2.CreateRoute(request) -} - -func (s *awsSdkEC2) DeleteRoute(request *ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error) { - return s.ec2.DeleteRoute(request) -} - -func (s *awsSdkEC2) ModifyInstanceAttribute(request *ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error) { - return s.ec2.ModifyInstanceAttribute(request) -} - -func (s *awsSdkEC2) DescribeVpcs(request *ec2.DescribeVpcsInput) (*ec2.DescribeVpcsOutput, error) { - return s.ec2.DescribeVpcs(request) -} - -func init() { - registerMetrics() - cloudprovider.RegisterCloudProvider(ProviderName, func(config io.Reader) (cloudprovider.Interface, error) { - cfg, err := readAWSCloudConfig(config) - if err != nil { - return nil, fmt.Errorf("unable to read AWS cloud provider config file: %v", err) - } - - if err = cfg.validateOverrides(); err != nil { - return nil, fmt.Errorf("unable to validate custom endpoint overrides: %v", err) - } - - regionName, err := getRegionFromMetadata(cfg) - if err != nil { - return nil, err - } - sess, err := session.NewSessionWithOptions(session.Options{ - Config: *aws.NewConfig().WithRegion(regionName).WithSTSRegionalEndpoint(endpoints.RegionalSTSEndpoint), - SharedConfigState: session.SharedConfigEnable, - }) - if err != nil { - return nil, fmt.Errorf("unable to initialize AWS session: %v", err) - } - - var creds *credentials.Credentials - if cfg.Global.RoleARN != "" { - klog.Infof("Using AWS assumed role %v", cfg.Global.RoleARN) - provider := &stscreds.AssumeRoleProvider{ - Client: sts.New(sess), - RoleARN: cfg.Global.RoleARN, - } - - creds = credentials.NewChainCredentials( - []credentials.Provider{ - &credentials.EnvProvider{}, - assumeRoleProvider(provider), - }) - } - - aws := newAWSSDKProvider(creds, cfg) - return newAWSCloud(*cfg, aws) - }) -} - -func getRegionFromMetadata(cfg *CloudConfig) (string, error) { - klog.Infof("Get AWS region from metadata client") - - metadata, err := newAWSSDKProvider(nil, cfg).Metadata() - if err != nil { - return "", fmt.Errorf("error creating AWS metadata client: %q", err) - } - - err = updateConfigZone(cfg, metadata) - if err != nil { - return "", fmt.Errorf("unable to determine AWS zone from cloud provider config or EC2 instance metadata: %v", err) - } - - zone := cfg.Global.Zone - if len(zone) <= 1 { - return "", fmt.Errorf("invalid AWS zone in config file: %s", zone) - } - - regionName, err := azToRegion(zone) - if err != nil { - return "", err - } - - return regionName, nil -} - -// readAWSCloudConfig reads an instance of AWSCloudConfig from config reader. -func readAWSCloudConfig(config io.Reader) (*CloudConfig, error) { - var cfg CloudConfig - var err error - - if config != nil { - err = gcfg.ReadInto(&cfg, config) - if err != nil { - return nil, err - } - } - - return &cfg, nil -} - -func updateConfigZone(cfg *CloudConfig, metadata EC2Metadata) error { - if cfg.Global.Zone == "" { - if metadata != nil { - klog.Info("Zone not specified in configuration file; querying AWS metadata service") - var err error - cfg.Global.Zone, err = getAvailabilityZone(metadata) - if err != nil { - return err - } - } - if cfg.Global.Zone == "" { - return fmt.Errorf("no zone specified in configuration file") - } - } - - return nil -} - -func getAvailabilityZone(metadata EC2Metadata) (string, error) { - return metadata.GetMetadata("placement/availability-zone") -} - -// Derives the region from a valid az name. -// Returns an error if the az is known invalid (empty) -func azToRegion(az string) (string, error) { - if len(az) < 1 { - return "", fmt.Errorf("invalid (empty) AZ") - } - - r := regexp.MustCompile(`^([a-zA-Z]+-)+\d+`) - region := r.FindString(az) - if region == "" { - return "", fmt.Errorf("invalid AZ: %s", az) - } - - return region, nil -} - -// newAWSCloud creates a new instance of AWSCloud. -// AWSProvider and instanceId are primarily for tests -func newAWSCloud(cfg CloudConfig, awsServices Services) (*Cloud, error) { - // We have some state in the Cloud object - in particular the attaching map - // Log so that if we are building multiple Cloud objects, it is obvious! - klog.Infof("Building AWS cloudprovider") - - metadata, err := awsServices.Metadata() - if err != nil { - return nil, fmt.Errorf("error creating AWS metadata client: %q", err) - } - - err = updateConfigZone(&cfg, metadata) - if err != nil { - return nil, fmt.Errorf("unable to determine AWS zone from cloud provider config or EC2 instance metadata: %v", err) - } - - zone := cfg.Global.Zone - if len(zone) <= 1 { - return nil, fmt.Errorf("invalid AWS zone in config file: %s", zone) - } - regionName, err := azToRegion(zone) - if err != nil { - return nil, err - } - - if !cfg.Global.DisableStrictZoneCheck { - if !isRegionValid(regionName, metadata) { - return nil, fmt.Errorf("not a valid AWS zone (unknown region): %s", zone) - } - } else { - klog.Warningf("Strict AWS zone checking is disabled. Proceeding with zone: %s", zone) - } - - ec2, err := awsServices.Compute(regionName) - if err != nil { - return nil, fmt.Errorf("error creating AWS EC2 client: %v", err) - } - - elb, err := awsServices.LoadBalancing(regionName) - if err != nil { - return nil, fmt.Errorf("error creating AWS ELB client: %v", err) - } - - elbv2, err := awsServices.LoadBalancingV2(regionName) - if err != nil { - return nil, fmt.Errorf("error creating AWS ELBV2 client: %v", err) - } - - asg, err := awsServices.Autoscaling(regionName) - if err != nil { - return nil, fmt.Errorf("error creating AWS autoscaling client: %v", err) - } - - kms, err := awsServices.KeyManagement(regionName) - if err != nil { - return nil, fmt.Errorf("error creating AWS key management client: %v", err) - } - - awsCloud := &Cloud{ - ec2: ec2, - elb: elb, - elbv2: elbv2, - asg: asg, - metadata: metadata, - kms: kms, - cfg: &cfg, - region: regionName, - - attaching: make(map[types.NodeName]map[mountDevice]EBSVolumeID), - deviceAllocators: make(map[types.NodeName]DeviceAllocator), - } - awsCloud.instanceCache.cloud = awsCloud - - tagged := cfg.Global.KubernetesClusterTag != "" || cfg.Global.KubernetesClusterID != "" - if cfg.Global.VPC != "" && (cfg.Global.SubnetID != "" || cfg.Global.RoleARN != "") && tagged { - // When the master is running on a different AWS account, cloud provider or on-premise - // build up a dummy instance and use the VPC from the nodes account - klog.Info("Master is configured to run on a different AWS account, different cloud provider or on-premises") - awsCloud.selfAWSInstance = &awsInstance{ - nodeName: "master-dummy", - vpcID: cfg.Global.VPC, - subnetID: cfg.Global.SubnetID, - } - awsCloud.vpcID = cfg.Global.VPC - } else { - selfAWSInstance, err := awsCloud.buildSelfAWSInstance() - if err != nil { - return nil, err - } - awsCloud.selfAWSInstance = selfAWSInstance - awsCloud.vpcID = selfAWSInstance.vpcID - } - - if cfg.Global.KubernetesClusterTag != "" || cfg.Global.KubernetesClusterID != "" { - if err := awsCloud.tagging.init(cfg.Global.KubernetesClusterTag, cfg.Global.KubernetesClusterID); err != nil { - return nil, err - } - } else { - // TODO: Clean up double-API query - info, err := awsCloud.selfAWSInstance.describeInstance() - if err != nil { - return nil, err - } - if err := awsCloud.tagging.initFromTags(info.Tags); err != nil { - return nil, err - } - } - return awsCloud, nil -} - -// isRegionValid accepts an AWS region name and returns if the region is a -// valid region known to the AWS SDK. Considers the region returned from the -// EC2 metadata service to be a valid region as it's only available on a host -// running in a valid AWS region. -func isRegionValid(region string, metadata EC2Metadata) bool { - // Does the AWS SDK know about the region? - for _, p := range endpoints.DefaultPartitions() { - for r := range p.Regions() { - if r == region { - return true - } - } - } - - // ap-northeast-3 is purposely excluded from the SDK because it - // requires an access request (for more details see): - // https://github.com/aws/aws-sdk-go/issues/1863 - if region == "ap-northeast-3" { - return true - } - - // Fallback to checking if the region matches the instance metadata region - // (ignoring any user overrides). This just accounts for running an old - // build of Kubernetes in a new region that wasn't compiled into the SDK - // when Kubernetes was built. - if az, err := getAvailabilityZone(metadata); err == nil { - if r, err := azToRegion(az); err == nil && region == r { - return true - } - } - - return false -} - -// Initialize passes a Kubernetes clientBuilder interface to the cloud provider -func (c *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{}) { - c.clientBuilder = clientBuilder - c.kubeClient = clientBuilder.ClientOrDie("aws-cloud-provider") - c.eventBroadcaster = record.NewBroadcaster() - c.eventBroadcaster.StartStructuredLogging(0) - c.eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: c.kubeClient.CoreV1().Events("")}) - c.eventRecorder = c.eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "aws-cloud-provider"}) -} - -// Clusters returns the list of clusters. -func (c *Cloud) Clusters() (cloudprovider.Clusters, bool) { - return nil, false -} - -// ProviderName returns the cloud provider ID. -func (c *Cloud) ProviderName() string { - return ProviderName -} - -// LoadBalancer returns an implementation of LoadBalancer for Amazon Web Services. -func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool) { - return c, true -} - -// Instances returns an implementation of Instances for Amazon Web Services. -func (c *Cloud) Instances() (cloudprovider.Instances, bool) { - return c, true -} - -// InstancesV2 returns an implementation of InstancesV2 for Amazon Web Services. -// TODO: implement ONLY for external cloud provider -func (c *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) { - return nil, false -} - -// Zones returns an implementation of Zones for Amazon Web Services. -func (c *Cloud) Zones() (cloudprovider.Zones, bool) { - return c, true -} - -// Routes returns an implementation of Routes for Amazon Web Services. -func (c *Cloud) Routes() (cloudprovider.Routes, bool) { - return c, true -} - -// HasClusterID returns true if the cluster has a clusterID -func (c *Cloud) HasClusterID() bool { - return len(c.tagging.clusterID()) > 0 -} - -// NodeAddresses is an implementation of Instances.NodeAddresses. -func (c *Cloud) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error) { - if c.selfAWSInstance.nodeName == name || len(name) == 0 { - addresses := []v1.NodeAddress{} - - macs, err := c.metadata.GetMetadata("network/interfaces/macs/") - if err != nil { - return nil, fmt.Errorf("error querying AWS metadata for %q: %q", "network/interfaces/macs", err) - } - - // We want the IPs to end up in order by interface (in particular, we want eth0's - // IPs first), but macs isn't necessarily sorted in that order so we have to - // explicitly order by device-number (device-number == the "0" in "eth0"). - - var macIDs []string - macDevNum := make(map[string]int) - for _, macID := range strings.Split(macs, "\n") { - if macID == "" { - continue - } - numPath := path.Join("network/interfaces/macs/", macID, "device-number") - numStr, err := c.metadata.GetMetadata(numPath) - if err != nil { - return nil, fmt.Errorf("error querying AWS metadata for %q: %q", numPath, err) - } - num, err := strconv.Atoi(strings.TrimSpace(numStr)) - if err != nil { - klog.Warningf("Bad device-number %q for interface %s\n", numStr, macID) - continue - } - macIDs = append(macIDs, macID) - macDevNum[macID] = num - } - - // Sort macIDs by interface device-number - sort.Slice(macIDs, func(i, j int) bool { - return macDevNum[macIDs[i]] < macDevNum[macIDs[j]] - }) - - for _, macID := range macIDs { - ipPath := path.Join("network/interfaces/macs/", macID, "local-ipv4s") - internalIPs, err := c.metadata.GetMetadata(ipPath) - if err != nil { - return nil, fmt.Errorf("error querying AWS metadata for %q: %q", ipPath, err) - } - - for _, internalIP := range strings.Split(internalIPs, "\n") { - if internalIP == "" { - continue - } - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalIP, Address: internalIP}) - } - } - - externalIP, err := c.metadata.GetMetadata("public-ipv4") - if err != nil { - //TODO: It would be nice to be able to determine the reason for the failure, - // but the AWS client masks all failures with the same error description. - klog.V(4).Info("Could not determine public IP from AWS metadata.") - } else { - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeExternalIP, Address: externalIP}) - } - - localHostname, err := c.metadata.GetMetadata("local-hostname") - if err != nil || len(localHostname) == 0 { - //TODO: It would be nice to be able to determine the reason for the failure, - // but the AWS client masks all failures with the same error description. - klog.V(4).Info("Could not determine private DNS from AWS metadata.") - } else { - hostname, internalDNS := parseMetadataLocalHostname(localHostname) - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeHostName, Address: hostname}) - for _, d := range internalDNS { - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalDNS, Address: d}) - } - } - - externalDNS, err := c.metadata.GetMetadata("public-hostname") - if err != nil || len(externalDNS) == 0 { - //TODO: It would be nice to be able to determine the reason for the failure, - // but the AWS client masks all failures with the same error description. - klog.V(4).Info("Could not determine public DNS from AWS metadata.") - } else { - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeExternalDNS, Address: externalDNS}) - } - - return addresses, nil - } - - instance, err := c.getInstanceByNodeName(name) - if err != nil { - return nil, fmt.Errorf("getInstanceByNodeName failed for %q with %q", name, err) - } - return extractNodeAddresses(instance) -} - -// parseMetadataLocalHostname parses the output of "local-hostname" metadata. -// If a DHCP option set is configured for a VPC and it has multiple domain names, GetMetadata -// returns a string containing first the hostname followed by additional domain names, -// space-separated. For example, if the DHCP option set has: -// domain-name = us-west-2.compute.internal a.a b.b c.c d.d; -// $ curl http://169.254.169.254/latest/meta-data/local-hostname -// ip-192-168-111-51.us-west-2.compute.internal a.a b.b c.c d.d -func parseMetadataLocalHostname(metadata string) (string, []string) { - localHostnames := strings.Fields(metadata) - hostname := localHostnames[0] - internalDNS := []string{hostname} - - privateAddress := strings.Split(hostname, ".")[0] - for _, h := range localHostnames[1:] { - internalDNSAddress := privateAddress + "." + h - internalDNS = append(internalDNS, internalDNSAddress) - } - return hostname, internalDNS -} - -// extractNodeAddresses maps the instance information from EC2 to an array of NodeAddresses -func extractNodeAddresses(instance *ec2.Instance) ([]v1.NodeAddress, error) { - // Not clear if the order matters here, but we might as well indicate a sensible preference order - - if instance == nil { - return nil, fmt.Errorf("nil instance passed to extractNodeAddresses") - } - - addresses := []v1.NodeAddress{} - - // handle internal network interfaces - for _, networkInterface := range instance.NetworkInterfaces { - // skip network interfaces that are not currently in use - if aws.StringValue(networkInterface.Status) != ec2.NetworkInterfaceStatusInUse { - continue - } - - for _, internalIP := range networkInterface.PrivateIpAddresses { - if ipAddress := aws.StringValue(internalIP.PrivateIpAddress); ipAddress != "" { - ip := netutils.ParseIPSloppy(ipAddress) - if ip == nil { - return nil, fmt.Errorf("EC2 instance had invalid private address: %s (%q)", aws.StringValue(instance.InstanceId), ipAddress) - } - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalIP, Address: ip.String()}) - } - } - } - - // TODO: Other IP addresses (multiple ips)? - publicIPAddress := aws.StringValue(instance.PublicIpAddress) - if publicIPAddress != "" { - ip := netutils.ParseIPSloppy(publicIPAddress) - if ip == nil { - return nil, fmt.Errorf("EC2 instance had invalid public address: %s (%s)", aws.StringValue(instance.InstanceId), publicIPAddress) - } - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeExternalIP, Address: ip.String()}) - } - - privateDNSName := aws.StringValue(instance.PrivateDnsName) - if privateDNSName != "" { - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalDNS, Address: privateDNSName}) - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeHostName, Address: privateDNSName}) - } - - publicDNSName := aws.StringValue(instance.PublicDnsName) - if publicDNSName != "" { - addresses = append(addresses, v1.NodeAddress{Type: v1.NodeExternalDNS, Address: publicDNSName}) - } - - return addresses, nil -} - -// NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID -// This method will not be called from the node that is requesting this ID. i.e. metadata service -// and other local methods cannot be used here -func (c *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) { - instanceID, err := KubernetesInstanceID(providerID).MapToAWSInstanceID() - if err != nil { - return nil, err - } - - instance, err := describeInstance(c.ec2, instanceID) - if err != nil { - return nil, err - } - - return extractNodeAddresses(instance) -} - -// InstanceExistsByProviderID returns true if the instance with the given provider id still exists. -// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. -func (c *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) { - instanceID, err := KubernetesInstanceID(providerID).MapToAWSInstanceID() - if err != nil { - return false, err - } - - request := &ec2.DescribeInstancesInput{ - InstanceIds: []*string{instanceID.awsString()}, - } - - instances, err := c.ec2.DescribeInstances(request) - if err != nil { - // if err is InstanceNotFound, return false with no error - if isAWSErrorInstanceNotFound(err) { - return false, nil - } - return false, err - } - if len(instances) == 0 { - return false, nil - } - if len(instances) > 1 { - return false, fmt.Errorf("multiple instances found for instance: %s", instanceID) - } - - state := instances[0].State.Name - if *state == ec2.InstanceStateNameTerminated { - klog.Warningf("the instance %s is terminated", instanceID) - return false, nil - } - - return true, nil -} - -// InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes -func (c *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) { - instanceID, err := KubernetesInstanceID(providerID).MapToAWSInstanceID() - if err != nil { - return false, err - } - - request := &ec2.DescribeInstancesInput{ - InstanceIds: []*string{instanceID.awsString()}, - } - - instances, err := c.ec2.DescribeInstances(request) - if err != nil { - return false, err - } - if len(instances) == 0 { - klog.Warningf("the instance %s does not exist anymore", providerID) - // returns false, because otherwise node is not deleted from cluster - // false means that it will continue to check InstanceExistsByProviderID - return false, nil - } - if len(instances) > 1 { - return false, fmt.Errorf("multiple instances found for instance: %s", instanceID) - } - - instance := instances[0] - if instance.State != nil { - state := aws.StringValue(instance.State.Name) - // valid state for detaching volumes - if state == ec2.InstanceStateNameStopped { - return true, nil - } - } - return false, nil -} - -// InstanceID returns the cloud provider ID of the node with the specified nodeName. -func (c *Cloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error) { - // In the future it is possible to also return an endpoint as: - // // - if c.selfAWSInstance.nodeName == nodeName { - return "/" + c.selfAWSInstance.availabilityZone + "/" + c.selfAWSInstance.awsID, nil - } - inst, err := c.getInstanceByNodeName(nodeName) - if err != nil { - if err == cloudprovider.InstanceNotFound { - // The Instances interface requires that we return InstanceNotFound (without wrapping) - return "", err - } - return "", fmt.Errorf("getInstanceByNodeName failed for %q with %q", nodeName, err) - } - return "/" + aws.StringValue(inst.Placement.AvailabilityZone) + "/" + aws.StringValue(inst.InstanceId), nil -} - -// InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID -// This method will not be called from the node that is requesting this ID. i.e. metadata service -// and other local methods cannot be used here -func (c *Cloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error) { - instanceID, err := KubernetesInstanceID(providerID).MapToAWSInstanceID() - if err != nil { - return "", err - } - - instance, err := describeInstance(c.ec2, instanceID) - if err != nil { - return "", err - } - - return aws.StringValue(instance.InstanceType), nil -} - -// InstanceType returns the type of the node with the specified nodeName. -func (c *Cloud) InstanceType(ctx context.Context, nodeName types.NodeName) (string, error) { - if c.selfAWSInstance.nodeName == nodeName { - return c.selfAWSInstance.instanceType, nil - } - inst, err := c.getInstanceByNodeName(nodeName) - if err != nil { - return "", fmt.Errorf("getInstanceByNodeName failed for %q with %q", nodeName, err) - } - return aws.StringValue(inst.InstanceType), nil -} - -// GetCandidateZonesForDynamicVolume retrieves a list of all the zones in which nodes are running -// It currently involves querying all instances -func (c *Cloud) GetCandidateZonesForDynamicVolume() (sets.String, error) { - // We don't currently cache this; it is currently used only in volume - // creation which is expected to be a comparatively rare occurrence. - - // TODO: Caching / expose v1.Nodes to the cloud provider? - // TODO: We could also query for subnets, I think - - // Note: It is more efficient to call the EC2 API twice with different tag - // filters than to call it once with a tag filter that results in a logical - // OR. For really large clusters the logical OR will result in EC2 API rate - // limiting. - instances := []*ec2.Instance{} - - baseFilters := []*ec2.Filter{newEc2Filter("instance-state-name", "running")} - - filters := c.tagging.addFilters(baseFilters) - di, err := c.describeInstances(filters) - if err != nil { - return nil, err - } - - instances = append(instances, di...) - - if c.tagging.usesLegacyTags { - filters = c.tagging.addLegacyFilters(baseFilters) - di, err = c.describeInstances(filters) - if err != nil { - return nil, err - } - - instances = append(instances, di...) - } - - if len(instances) == 0 { - return nil, fmt.Errorf("no instances returned") - } - - zones := sets.NewString() - - for _, instance := range instances { - // We skip over master nodes, if the installation tool labels them with one of the well-known master labels - // This avoids creating a volume in a zone where only the master is running - e.g. #34583 - // This is a short-term workaround until the scheduler takes care of zone selection - master := false - for _, tag := range instance.Tags { - tagKey := aws.StringValue(tag.Key) - if awsTagNameMasterRoles.Has(tagKey) { - master = true - } - } - - if master { - klog.V(4).Infof("Ignoring master instance %q in zone discovery", aws.StringValue(instance.InstanceId)) - continue - } - - if instance.Placement != nil { - zone := aws.StringValue(instance.Placement.AvailabilityZone) - zones.Insert(zone) - } - } - - klog.V(2).Infof("Found instances in zones %s", zones) - return zones, nil -} - -// GetZone implements Zones.GetZone -func (c *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error) { - return cloudprovider.Zone{ - FailureDomain: c.selfAWSInstance.availabilityZone, - Region: c.region, - }, nil -} - -// GetZoneByProviderID implements Zones.GetZoneByProviderID -// This is particularly useful in external cloud providers where the kubelet -// does not initialize node data. -func (c *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error) { - instanceID, err := KubernetesInstanceID(providerID).MapToAWSInstanceID() - if err != nil { - return cloudprovider.Zone{}, err - } - instance, err := c.getInstanceByID(string(instanceID)) - if err != nil { - return cloudprovider.Zone{}, err - } - - zone := cloudprovider.Zone{ - FailureDomain: *(instance.Placement.AvailabilityZone), - Region: c.region, - } - - return zone, nil -} - -// GetZoneByNodeName implements Zones.GetZoneByNodeName -// This is particularly useful in external cloud providers where the kubelet -// does not initialize node data. -func (c *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error) { - instance, err := c.getInstanceByNodeName(nodeName) - if err != nil { - return cloudprovider.Zone{}, err - } - zone := cloudprovider.Zone{ - FailureDomain: *(instance.Placement.AvailabilityZone), - Region: c.region, - } - - return zone, nil - -} - -func isAWSErrorInstanceNotFound(err error) bool { - if err == nil { - return false - } - - if awsError, ok := err.(awserr.Error); ok { - if awsError.Code() == ec2.UnsuccessfulInstanceCreditSpecificationErrorCodeInvalidInstanceIdNotFound { - return true - } - } - - return false -} - -// Used to represent a mount device for attaching an EBS volume -// This should be stored as a single letter (i.e. c, not sdc or /dev/sdc) -type mountDevice string - -type awsInstance struct { - ec2 EC2 - - // id in AWS - awsID string - - // node name in k8s - nodeName types.NodeName - - // availability zone the instance resides in - availabilityZone string - - // ID of VPC the instance resides in - vpcID string - - // ID of subnet the instance resides in - subnetID string - - // instance type - instanceType string -} - -// newAWSInstance creates a new awsInstance object -func newAWSInstance(ec2Service EC2, instance *ec2.Instance) *awsInstance { - az := "" - if instance.Placement != nil { - az = aws.StringValue(instance.Placement.AvailabilityZone) - } - self := &awsInstance{ - ec2: ec2Service, - awsID: aws.StringValue(instance.InstanceId), - nodeName: mapInstanceToNodeName(instance), - availabilityZone: az, - instanceType: aws.StringValue(instance.InstanceType), - vpcID: aws.StringValue(instance.VpcId), - subnetID: aws.StringValue(instance.SubnetId), - } - - return self -} - -// Gets the full information about this instance from the EC2 API -func (i *awsInstance) describeInstance() (*ec2.Instance, error) { - return describeInstance(i.ec2, InstanceID(i.awsID)) -} - -// Gets the mountDevice already assigned to the volume, or assigns an unused mountDevice. -// If the volume is already assigned, this will return the existing mountDevice with alreadyAttached=true. -// Otherwise the mountDevice is assigned by finding the first available mountDevice, and it is returned with alreadyAttached=false. -func (c *Cloud) getMountDevice( - i *awsInstance, - info *ec2.Instance, - volumeID EBSVolumeID, - assign bool) (assigned mountDevice, alreadyAttached bool, err error) { - - deviceMappings := map[mountDevice]EBSVolumeID{} - volumeStatus := map[EBSVolumeID]string{} // for better logging of volume status - for _, blockDevice := range info.BlockDeviceMappings { - name := aws.StringValue(blockDevice.DeviceName) - name = strings.TrimPrefix(name, "/dev/sd") - name = strings.TrimPrefix(name, "/dev/xvd") - if len(name) < 1 || len(name) > 2 { - klog.Warningf("Unexpected EBS DeviceName: %q", aws.StringValue(blockDevice.DeviceName)) - } - if blockDevice.Ebs != nil && blockDevice.Ebs.VolumeId != nil { - volumeStatus[EBSVolumeID(*blockDevice.Ebs.VolumeId)] = aws.StringValue(blockDevice.Ebs.Status) - } - - deviceMappings[mountDevice(name)] = EBSVolumeID(aws.StringValue(blockDevice.Ebs.VolumeId)) - } - - // We lock to prevent concurrent mounts from conflicting - // We may still conflict if someone calls the API concurrently, - // but the AWS API will then fail one of the two attach operations - c.attachingMutex.Lock() - defer c.attachingMutex.Unlock() - - for mountDevice, volume := range c.attaching[i.nodeName] { - deviceMappings[mountDevice] = volume - } - - // Check to see if this volume is already assigned a device on this machine - for mountDevice, mappingVolumeID := range deviceMappings { - if volumeID == mappingVolumeID { - if assign { - // DescribeInstances shows the volume as attached / detaching, while Kubernetes - // cloud provider thinks it's detached. - // This can happened when the volume has just been detached from the same node - // and AWS API returns stale data in this DescribeInstances ("eventual consistency"). - // Fail the attachment and let A/D controller retry in a while, hoping that - // AWS API returns consistent result next time (i.e. the volume is detached). - status := volumeStatus[mappingVolumeID] - klog.Warningf("Got assignment call for already-assigned volume: %s@%s, volume status: %s", mountDevice, mappingVolumeID, status) - } - return mountDevice, true, nil - } - } - - if !assign { - return mountDevice(""), false, nil - } - - // Find the next unused device name - deviceAllocator := c.deviceAllocators[i.nodeName] - if deviceAllocator == nil { - // we want device names with two significant characters, starting with /dev/xvdbb - // the allowed range is /dev/xvd[b-c][a-z] - // http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html - deviceAllocator = NewDeviceAllocator() - c.deviceAllocators[i.nodeName] = deviceAllocator - } - // We need to lock deviceAllocator to prevent possible race with Deprioritize function - deviceAllocator.Lock() - defer deviceAllocator.Unlock() - - chosen, err := deviceAllocator.GetNext(deviceMappings) - if err != nil { - klog.Warningf("Could not assign a mount device. mappings=%v, error: %v", deviceMappings, err) - return "", false, fmt.Errorf("too many EBS volumes attached to node %s", i.nodeName) - } - - attaching := c.attaching[i.nodeName] - if attaching == nil { - attaching = make(map[mountDevice]EBSVolumeID) - c.attaching[i.nodeName] = attaching - } - attaching[chosen] = volumeID - klog.V(2).Infof("Assigned mount device %s -> volume %s", chosen, volumeID) - - return chosen, false, nil -} - -// endAttaching removes the entry from the "attachments in progress" map -// It returns true if it was found (and removed), false otherwise -func (c *Cloud) endAttaching(i *awsInstance, volumeID EBSVolumeID, mountDevice mountDevice) bool { - c.attachingMutex.Lock() - defer c.attachingMutex.Unlock() - - existingVolumeID, found := c.attaching[i.nodeName][mountDevice] - if !found { - return false - } - if volumeID != existingVolumeID { - // This actually can happen, because getMountDevice combines the attaching map with the volumes - // attached to the instance (as reported by the EC2 API). So if endAttaching comes after - // a 10 second poll delay, we might well have had a concurrent request to allocate a mountpoint, - // which because we allocate sequentially is _very_ likely to get the immediately freed volume - klog.Infof("endAttaching on device %q assigned to different volume: %q vs %q", mountDevice, volumeID, existingVolumeID) - return false - } - klog.V(2).Infof("Releasing in-process attachment entry: %s -> volume %s", mountDevice, volumeID) - delete(c.attaching[i.nodeName], mountDevice) - return true -} - -type awsDisk struct { - ec2 EC2 - - // Name in k8s - name KubernetesVolumeID - // id in AWS - awsID EBSVolumeID -} - -func newAWSDisk(aws *Cloud, name KubernetesVolumeID) (*awsDisk, error) { - awsID, err := name.MapToAWSVolumeID() - if err != nil { - return nil, err - } - disk := &awsDisk{ec2: aws.ec2, name: name, awsID: awsID} - return disk, nil -} - -// Helper function for describeVolume callers. Tries to retype given error to AWS error -// and returns true in case the AWS error is "InvalidVolume.NotFound", false otherwise -func isAWSErrorVolumeNotFound(err error) bool { - if err != nil { - if awsError, ok := err.(awserr.Error); ok { - // https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html - if awsError.Code() == "InvalidVolume.NotFound" { - return true - } - } - } - return false -} - -// Gets the full information about this volume from the EC2 API -func (d *awsDisk) describeVolume() (*ec2.Volume, error) { - volumeID := d.awsID - - request := &ec2.DescribeVolumesInput{ - VolumeIds: []*string{volumeID.awsString()}, - } - - volumes, err := d.ec2.DescribeVolumes(request) - if err != nil { - return nil, err - } - if len(volumes) == 0 { - return nil, fmt.Errorf("no volumes found") - } - if len(volumes) > 1 { - return nil, fmt.Errorf("multiple volumes found") - } - return volumes[0], nil -} - -func (d *awsDisk) describeVolumeModification() (*ec2.VolumeModification, error) { - volumeID := d.awsID - request := &ec2.DescribeVolumesModificationsInput{ - VolumeIds: []*string{volumeID.awsString()}, - } - volumeMods, err := d.ec2.DescribeVolumeModifications(request) - - if err != nil { - return nil, fmt.Errorf("error describing volume modification %s with %v", volumeID, err) - } - - if len(volumeMods) == 0 { - return nil, fmt.Errorf("no volume modifications found for %s", volumeID) - } - lastIndex := len(volumeMods) - 1 - return volumeMods[lastIndex], nil -} - -func (d *awsDisk) modifyVolume(requestGiB int64) (int64, error) { - volumeID := d.awsID - - request := &ec2.ModifyVolumeInput{ - VolumeId: volumeID.awsString(), - Size: aws.Int64(requestGiB), - } - output, err := d.ec2.ModifyVolume(request) - if err != nil { - modifyError := fmt.Errorf("AWS modifyVolume failed for %s with %v", volumeID, err) - return requestGiB, modifyError - } - - volumeModification := output.VolumeModification - - if aws.StringValue(volumeModification.ModificationState) == ec2.VolumeModificationStateCompleted { - return aws.Int64Value(volumeModification.TargetSize), nil - } - - backoff := wait.Backoff{ - Duration: 1 * time.Second, - Factor: 2, - Steps: 10, - } - - checkForResize := func() (bool, error) { - volumeModification, err := d.describeVolumeModification() - - if err != nil { - return false, err - } - - // According to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring_mods.html - // Size changes usually take a few seconds to complete and take effect after a volume is in the Optimizing state. - if aws.StringValue(volumeModification.ModificationState) == ec2.VolumeModificationStateOptimizing { - return true, nil - } - return false, nil - } - waitWithErr := wait.ExponentialBackoff(backoff, checkForResize) - return requestGiB, waitWithErr -} - -// applyUnSchedulableTaint applies a unschedulable taint to a node after verifying -// if node has become unusable because of volumes getting stuck in attaching state. -func (c *Cloud) applyUnSchedulableTaint(nodeName types.NodeName, reason string) { - node, fetchErr := c.kubeClient.CoreV1().Nodes().Get(context.TODO(), string(nodeName), metav1.GetOptions{}) - if fetchErr != nil { - klog.Errorf("Error fetching node %s with %v", nodeName, fetchErr) - return - } - - taint := &v1.Taint{ - Key: nodeWithImpairedVolumes, - Value: "true", - Effect: v1.TaintEffectNoSchedule, - } - err := nodehelpers.AddOrUpdateTaintOnNode(c.kubeClient, string(nodeName), taint) - if err != nil { - klog.Errorf("Error applying taint to node %s with error %v", nodeName, err) - return - } - c.eventRecorder.Eventf(node, v1.EventTypeWarning, volumeAttachmentStuck, reason) -} - -// waitForAttachmentStatus polls until the attachment status is the expected value -// On success, it returns the last attachment state. -func (d *awsDisk) waitForAttachmentStatus(status string, expectedInstance, expectedDevice string, alreadyAttached bool) (*ec2.VolumeAttachment, error) { - backoff := wait.Backoff{ - Duration: volumeAttachmentStatusPollDelay, - Factor: volumeAttachmentStatusFactor, - Steps: volumeAttachmentStatusSteps, - } - - // Because of rate limiting, we often see errors from describeVolume. - // Or AWS eventual consistency returns unexpected data. - // So we tolerate a limited number of failures. - // But once we see more than 10 errors in a row, we return the error. - errorCount := 0 - - // Attach/detach usually takes time. It does not make sense to start - // polling DescribeVolumes before some initial delay to let AWS - // process the request. - time.Sleep(getInitialAttachDetachDelay(status)) - - var attachment *ec2.VolumeAttachment - - err := wait.ExponentialBackoff(backoff, func() (bool, error) { - info, err := d.describeVolume() - if err != nil { - // The VolumeNotFound error is special -- we don't need to wait for it to repeat - if isAWSErrorVolumeNotFound(err) { - if status == volumeDetachedStatus { - // The disk doesn't exist, assume it's detached, log warning and stop waiting - klog.Warningf("Waiting for volume %q to be detached but the volume does not exist", d.awsID) - stateStr := "detached" - attachment = &ec2.VolumeAttachment{ - State: &stateStr, - } - return true, nil - } - if status == volumeAttachedStatus { - // The disk doesn't exist, complain, give up waiting and report error - klog.Warningf("Waiting for volume %q to be attached but the volume does not exist", d.awsID) - return false, err - } - } - errorCount++ - if errorCount > volumeAttachmentStatusConsecutiveErrorLimit { - // report the error - return false, err - } - - klog.Warningf("Ignoring error from describe volume for volume %q; will retry: %q", d.awsID, err) - return false, nil - } - - if len(info.Attachments) > 1 { - // Shouldn't happen; log so we know if it is - klog.Warningf("Found multiple attachments for volume %q: %v", d.awsID, info) - } - attachmentStatus := "" - for _, a := range info.Attachments { - if attachmentStatus != "" { - // Shouldn't happen; log so we know if it is - klog.Warningf("Found multiple attachments for volume %q: %v", d.awsID, info) - } - if a.State != nil { - attachment = a - attachmentStatus = *a.State - } else { - // Shouldn't happen; log so we know if it is - klog.Warningf("Ignoring nil attachment state for volume %q: %v", d.awsID, a) - } - } - if attachmentStatus == "" { - attachmentStatus = volumeDetachedStatus - } - if attachment != nil { - // AWS eventual consistency can go back in time. - // For example, we're waiting for a volume to be attached as /dev/xvdba, but AWS can tell us it's - // attached as /dev/xvdbb, where it was attached before and it was already detached. - // Retry couple of times, hoping AWS starts reporting the right status. - device := aws.StringValue(attachment.Device) - if expectedDevice != "" && device != "" && device != expectedDevice { - klog.Warningf("Expected device %s %s for volume %s, but found device %s %s", expectedDevice, status, d.name, device, attachmentStatus) - errorCount++ - if errorCount > volumeAttachmentStatusConsecutiveErrorLimit { - // report the error - return false, fmt.Errorf("attachment of disk %q failed: requested device %q but found %q", d.name, expectedDevice, device) - } - return false, nil - } - instanceID := aws.StringValue(attachment.InstanceId) - if expectedInstance != "" && instanceID != "" && instanceID != expectedInstance { - klog.Warningf("Expected instance %s/%s for volume %s, but found instance %s/%s", expectedInstance, status, d.name, instanceID, attachmentStatus) - errorCount++ - if errorCount > volumeAttachmentStatusConsecutiveErrorLimit { - // report the error - return false, fmt.Errorf("attachment of disk %q failed: requested device %q but found %q", d.name, expectedDevice, device) - } - return false, nil - } - } - - // if we expected volume to be attached and it was reported as already attached via DescribeInstance call - // but DescribeVolume told us volume is detached, we will short-circuit this long wait loop and return error - // so as AttachDisk can be retried without waiting for 20 minutes. - if (status == volumeAttachedStatus) && alreadyAttached && (attachmentStatus != status) { - return false, fmt.Errorf("attachment of disk %q failed, expected device to be attached but was %s", d.name, attachmentStatus) - } - - if attachmentStatus == status { - // Attachment is in requested state, finish waiting - return true, nil - } - // continue waiting - errorCount = 0 - klog.V(2).Infof("Waiting for volume %q state: actual=%s, desired=%s", d.awsID, attachmentStatus, status) - return false, nil - }) - return attachment, err -} - -// Deletes the EBS disk -func (d *awsDisk) deleteVolume() (bool, error) { - request := &ec2.DeleteVolumeInput{VolumeId: d.awsID.awsString()} - _, err := d.ec2.DeleteVolume(request) - if err != nil { - if isAWSErrorVolumeNotFound(err) { - return false, nil - } - if awsError, ok := err.(awserr.Error); ok { - if awsError.Code() == "VolumeInUse" { - return false, volerr.NewDeletedVolumeInUseError(err.Error()) - } - } - return false, fmt.Errorf("error deleting EBS volume %q: %q", d.awsID, err) - } - return true, nil -} - -// Builds the awsInstance for the EC2 instance on which we are running. -// This is called when the AWSCloud is initialized, and should not be called otherwise (because the awsInstance for the local instance is a singleton with drive mapping state) -func (c *Cloud) buildSelfAWSInstance() (*awsInstance, error) { - if c.selfAWSInstance != nil { - panic("do not call buildSelfAWSInstance directly") - } - instanceID, err := c.metadata.GetMetadata("instance-id") - if err != nil { - return nil, fmt.Errorf("error fetching instance-id from ec2 metadata service: %q", err) - } - - // We want to fetch the hostname via the EC2 metadata service - // (`GetMetadata("local-hostname")`): But see #11543 - we need to use - // the EC2 API to get the privateDnsName in case of a private DNS zone - // e.g. mydomain.io, because the metadata service returns the wrong - // hostname. Once we're doing that, we might as well get all our - // information from the instance returned by the EC2 API - it is a - // single API call to get all the information, and it means we don't - // have two code paths. - instance, err := c.getInstanceByID(instanceID) - if err != nil { - return nil, fmt.Errorf("error finding instance %s: %q", instanceID, err) - } - return newAWSInstance(c.ec2, instance), nil -} - -// wrapAttachError wraps the error returned by an AttachVolume request with -// additional information, if needed and possible. -func wrapAttachError(err error, disk *awsDisk, instance string) error { - if awsError, ok := err.(awserr.Error); ok { - if awsError.Code() == "VolumeInUse" { - info, err := disk.describeVolume() - if err != nil { - klog.Errorf("Error describing volume %q: %q", disk.awsID, err) - } else { - for _, a := range info.Attachments { - if disk.awsID != EBSVolumeID(aws.StringValue(a.VolumeId)) { - klog.Warningf("Expected to get attachment info of volume %q but instead got info of %q", disk.awsID, aws.StringValue(a.VolumeId)) - } else if aws.StringValue(a.State) == "attached" { - return fmt.Errorf("error attaching EBS volume %q to instance %q: %q. The volume is currently attached to instance %q", disk.awsID, instance, awsError, aws.StringValue(a.InstanceId)) - } - } - } - } - } - return fmt.Errorf("error attaching EBS volume %q to instance %q: %q", disk.awsID, instance, err) -} - -// AttachDisk implements Volumes.AttachDisk -func (c *Cloud) AttachDisk(diskName KubernetesVolumeID, nodeName types.NodeName) (string, error) { - disk, err := newAWSDisk(c, diskName) - if err != nil { - return "", err - } - - awsInstance, info, err := c.getFullInstance(nodeName) - if err != nil { - return "", fmt.Errorf("error finding instance %s: %q", nodeName, err) - } - - // mountDevice will hold the device where we should try to attach the disk - var mountDevice mountDevice - // alreadyAttached is true if we have already called AttachVolume on this disk - var alreadyAttached bool - - // attachEnded is set to true if the attach operation completed - // (successfully or not), and is thus no longer in progress - attachEnded := false - defer func() { - if attachEnded { - if !c.endAttaching(awsInstance, disk.awsID, mountDevice) { - klog.Errorf("endAttaching called for disk %q when attach not in progress", disk.awsID) - } - } - }() - - mountDevice, alreadyAttached, err = c.getMountDevice(awsInstance, info, disk.awsID, true) - if err != nil { - return "", err - } - - // Inside the instance, the mountpoint always looks like /dev/xvdX (?) - hostDevice := "/dev/xvd" + string(mountDevice) - // We are using xvd names (so we are HVM only) - // See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html - ec2Device := "/dev/xvd" + string(mountDevice) - - if !alreadyAttached { - available, err := c.checkIfAvailable(disk, "attaching", awsInstance.awsID) - if err != nil { - klog.Error(err) - } - - if !available { - attachEnded = true - return "", err - } - request := &ec2.AttachVolumeInput{ - Device: aws.String(ec2Device), - InstanceId: aws.String(awsInstance.awsID), - VolumeId: disk.awsID.awsString(), - } - - attachResponse, err := c.ec2.AttachVolume(request) - if err != nil { - attachEnded = true - // TODO: Check if the volume was concurrently attached? - return "", wrapAttachError(err, disk, awsInstance.awsID) - } - if da, ok := c.deviceAllocators[awsInstance.nodeName]; ok { - da.Deprioritize(mountDevice) - } - klog.V(2).Infof("AttachVolume volume=%q instance=%q request returned %v", disk.awsID, awsInstance.awsID, attachResponse) - } - - attachment, err := disk.waitForAttachmentStatus("attached", awsInstance.awsID, ec2Device, alreadyAttached) - - if err != nil { - if err == wait.ErrWaitTimeout { - c.applyUnSchedulableTaint(nodeName, "Volume stuck in attaching state - node needs reboot to fix impaired state.") - } - return "", err - } - - // The attach operation has finished - attachEnded = true - - // Double check the attachment to be 100% sure we attached the correct volume at the correct mountpoint - // It could happen otherwise that we see the volume attached from a previous/separate AttachVolume call, - // which could theoretically be against a different device (or even instance). - if attachment == nil { - // Impossible? - return "", fmt.Errorf("unexpected state: attachment nil after attached %q to %q", diskName, nodeName) - } - if ec2Device != aws.StringValue(attachment.Device) { - // Already checked in waitForAttachmentStatus(), but just to be sure... - return "", fmt.Errorf("disk attachment of %q to %q failed: requested device %q but found %q", diskName, nodeName, ec2Device, aws.StringValue(attachment.Device)) - } - if awsInstance.awsID != aws.StringValue(attachment.InstanceId) { - return "", fmt.Errorf("disk attachment of %q to %q failed: requested instance %q but found %q", diskName, nodeName, awsInstance.awsID, aws.StringValue(attachment.InstanceId)) - } - - return hostDevice, nil -} - -// DetachDisk implements Volumes.DetachDisk -func (c *Cloud) DetachDisk(diskName KubernetesVolumeID, nodeName types.NodeName) (string, error) { - diskInfo, attached, err := c.checkIfAttachedToNode(diskName, nodeName) - if err != nil { - if isAWSErrorVolumeNotFound(err) { - // Someone deleted the volume being detached; complain, but do nothing else and return success - klog.Warningf("DetachDisk %s called for node %s but volume does not exist; assuming the volume is detached", diskName, nodeName) - return "", nil - } - - return "", err - } - - if !attached && diskInfo.ec2Instance != nil { - klog.Warningf("DetachDisk %s called for node %s but volume is attached to node %s", diskName, nodeName, diskInfo.nodeName) - return "", nil - } - - if !attached { - return "", nil - } - - awsInstance := newAWSInstance(c.ec2, diskInfo.ec2Instance) - - mountDevice, alreadyAttached, err := c.getMountDevice(awsInstance, diskInfo.ec2Instance, diskInfo.disk.awsID, false) - if err != nil { - return "", err - } - - if !alreadyAttached { - klog.Warningf("DetachDisk called on non-attached disk: %s", diskName) - // TODO: Continue? Tolerate non-attached error from the AWS DetachVolume call? - } - - request := ec2.DetachVolumeInput{ - InstanceId: &awsInstance.awsID, - VolumeId: diskInfo.disk.awsID.awsString(), - } - - response, err := c.ec2.DetachVolume(&request) - if err != nil { - return "", fmt.Errorf("error detaching EBS volume %q from %q: %q", diskInfo.disk.awsID, awsInstance.awsID, err) - } - - if response == nil { - return "", errors.New("no response from DetachVolume") - } - - attachment, err := diskInfo.disk.waitForAttachmentStatus("detached", awsInstance.awsID, "", false) - if err != nil { - return "", err - } - if da, ok := c.deviceAllocators[awsInstance.nodeName]; ok { - da.Deprioritize(mountDevice) - } - if attachment != nil { - // We expect it to be nil, it is (maybe) interesting if it is not - klog.V(2).Infof("waitForAttachmentStatus returned non-nil attachment with state=detached: %v", attachment) - } - - if mountDevice != "" { - c.endAttaching(awsInstance, diskInfo.disk.awsID, mountDevice) - // We don't check the return value - we don't really expect the attachment to have been - // in progress, though it might have been - } - - hostDevicePath := "/dev/xvd" + string(mountDevice) - return hostDevicePath, err -} - -// CreateDisk implements Volumes.CreateDisk -func (c *Cloud) CreateDisk(volumeOptions *VolumeOptions) (KubernetesVolumeID, error) { - var createType string - var iops int64 - switch volumeOptions.VolumeType { - case VolumeTypeGP2, VolumeTypeSC1, VolumeTypeST1: - createType = volumeOptions.VolumeType - - case VolumeTypeIO1: - // See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html - // for IOPS constraints. AWS will throw an error if IOPS per GB gets out - // of supported bounds, no need to check it here. - createType = volumeOptions.VolumeType - iops = int64(volumeOptions.CapacityGB * volumeOptions.IOPSPerGB) - - // Cap at min/max total IOPS, AWS would throw an error if it gets too - // low/high. - if iops < MinTotalIOPS { - iops = MinTotalIOPS - } - if iops > MaxTotalIOPS { - iops = MaxTotalIOPS - } - - case "": - createType = DefaultVolumeType - - default: - return KubernetesVolumeID(""), fmt.Errorf("invalid AWS VolumeType %q", volumeOptions.VolumeType) - } - - request := &ec2.CreateVolumeInput{} - request.AvailabilityZone = aws.String(volumeOptions.AvailabilityZone) - request.Size = aws.Int64(int64(volumeOptions.CapacityGB)) - request.VolumeType = aws.String(createType) - request.Encrypted = aws.Bool(volumeOptions.Encrypted) - if len(volumeOptions.KmsKeyID) > 0 { - request.KmsKeyId = aws.String(volumeOptions.KmsKeyID) - request.Encrypted = aws.Bool(true) - } - if iops > 0 { - request.Iops = aws.Int64(iops) - } - - tags := volumeOptions.Tags - tags = c.tagging.buildTags(ResourceLifecycleOwned, tags) - - var tagList []*ec2.Tag - for k, v := range tags { - tagList = append(tagList, &ec2.Tag{ - Key: aws.String(k), Value: aws.String(v), - }) - } - request.TagSpecifications = append(request.TagSpecifications, &ec2.TagSpecification{ - Tags: tagList, - ResourceType: aws.String(ec2.ResourceTypeVolume), - }) - - response, err := c.ec2.CreateVolume(request) - if err != nil { - return KubernetesVolumeID(""), err - } - - awsID := EBSVolumeID(aws.StringValue(response.VolumeId)) - if awsID == "" { - return KubernetesVolumeID(""), fmt.Errorf("VolumeID was not returned by CreateVolume") - } - volumeName := KubernetesVolumeID("aws://" + aws.StringValue(response.AvailabilityZone) + "/" + string(awsID)) - - err = c.waitUntilVolumeAvailable(volumeName) - if err != nil { - // AWS has a bad habbit of reporting success when creating a volume with - // encryption keys that either don't exists or have wrong permissions. - // Such volume lives for couple of seconds and then it's silently deleted - // by AWS. There is no other check to ensure that given KMS key is correct, - // because Kubernetes may have limited permissions to the key. - if isAWSErrorVolumeNotFound(err) { - err = fmt.Errorf("failed to create encrypted volume: the volume disappeared after creation, most likely due to inaccessible KMS encryption key") - } else { - // When DescribeVolumes api failed, plugin will lose track on the volumes' state - // driver should be able to clean up these kind of volumes to make sure they are not leaked on customers' account - klog.V(5).Infof("Failed to create the volume %v due to %v. Will try to delete it.", volumeName, err) - awsDisk, newDiskError := newAWSDisk(c, volumeName) - if newDiskError != nil { - klog.Errorf("Failed to delete the volume %v due to error: %v", volumeName, newDiskError) - } else { - if _, deleteVolumeError := awsDisk.deleteVolume(); deleteVolumeError != nil { - klog.Errorf("Failed to delete the volume %v due to error: %v", volumeName, deleteVolumeError) - } else { - klog.V(5).Infof("%v is deleted because it is not in desired state after waiting", volumeName) - } - } - } - return KubernetesVolumeID(""), err - } - - return volumeName, nil -} - -func (c *Cloud) waitUntilVolumeAvailable(volumeName KubernetesVolumeID) error { - disk, err := newAWSDisk(c, volumeName) - if err != nil { - // Unreachable code - return err - } - time.Sleep(5 * time.Second) - backoff := wait.Backoff{ - Duration: volumeCreateInitialDelay, - Factor: volumeCreateBackoffFactor, - Steps: volumeCreateBackoffSteps, - } - err = wait.ExponentialBackoff(backoff, func() (done bool, err error) { - vol, err := disk.describeVolume() - if err != nil { - return true, err - } - if vol.State != nil { - switch *vol.State { - case "available": - // The volume is Available, it won't be deleted now. - return true, nil - case "creating": - return false, nil - default: - return true, fmt.Errorf("unexpected State of newly created AWS EBS volume %s: %q", volumeName, *vol.State) - } - } - return false, nil - }) - return err -} - -// DeleteDisk implements Volumes.DeleteDisk -func (c *Cloud) DeleteDisk(volumeName KubernetesVolumeID) (bool, error) { - awsDisk, err := newAWSDisk(c, volumeName) - if err != nil { - return false, err - } - available, err := c.checkIfAvailable(awsDisk, "deleting", "") - if err != nil { - if isAWSErrorVolumeNotFound(err) { - klog.V(2).Infof("Volume %s not found when deleting it, assuming it's deleted", awsDisk.awsID) - return false, nil - } - if volerr.IsDanglingError(err) { - // The volume is still attached somewhere - return false, volerr.NewDeletedVolumeInUseError(err.Error()) - } - klog.Error(err) - } - - if !available { - return false, err - } - - return awsDisk.deleteVolume() -} - -func (c *Cloud) checkIfAvailable(disk *awsDisk, opName string, instance string) (bool, error) { - info, err := disk.describeVolume() - - if err != nil { - klog.Errorf("Error describing volume %q: %q", disk.awsID, err) - // if for some reason we can not describe volume we will return error - return false, err - } - - volumeState := aws.StringValue(info.State) - opError := fmt.Sprintf("error %s EBS volume %q", opName, disk.awsID) - if len(instance) != 0 { - opError = fmt.Sprintf("%q to instance %q", opError, instance) - } - - // Only available volumes can be attached or deleted - if volumeState != "available" { - // Volume is attached somewhere else and we can not attach it here - if len(info.Attachments) > 0 { - attachment := info.Attachments[0] - instanceID := aws.StringValue(attachment.InstanceId) - attachedInstance, ierr := c.getInstanceByID(instanceID) - attachErr := fmt.Sprintf("%s since volume is currently attached to %q", opError, instanceID) - if ierr != nil { - klog.Error(attachErr) - return false, errors.New(attachErr) - } - devicePath := aws.StringValue(attachment.Device) - nodeName := mapInstanceToNodeName(attachedInstance) - - danglingErr := volerr.NewDanglingError(attachErr, nodeName, devicePath) - return false, danglingErr - } - - attachErr := fmt.Errorf("%s since volume is in %q state", opError, volumeState) - return false, attachErr - } - - return true, nil -} - -// GetLabelsForVolume gets the volume labels for a volume -func (c *Cloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error) { - // Ignore if not AWSElasticBlockStore. - if pv.Spec.AWSElasticBlockStore == nil { - return nil, nil - } - - // Ignore any volumes that are being provisioned - if pv.Spec.AWSElasticBlockStore.VolumeID == cloudvolume.ProvisionedVolumeName { - return nil, nil - } - - spec := KubernetesVolumeID(pv.Spec.AWSElasticBlockStore.VolumeID) - labels, err := c.GetVolumeLabels(spec) - if err != nil { - return nil, err - } - - return labels, nil -} - -// GetVolumeLabels implements Volumes.GetVolumeLabels -func (c *Cloud) GetVolumeLabels(volumeName KubernetesVolumeID) (map[string]string, error) { - awsDisk, err := newAWSDisk(c, volumeName) - if err != nil { - return nil, err - } - info, err := awsDisk.describeVolume() - if err != nil { - return nil, err - } - labels := make(map[string]string) - az := aws.StringValue(info.AvailabilityZone) - if az == "" { - return nil, fmt.Errorf("volume did not have AZ information: %q", aws.StringValue(info.VolumeId)) - } - - labels[v1.LabelTopologyZone] = az - region, err := azToRegion(az) - if err != nil { - return nil, err - } - labels[v1.LabelTopologyRegion] = region - - return labels, nil -} - -// GetDiskPath implements Volumes.GetDiskPath -func (c *Cloud) GetDiskPath(volumeName KubernetesVolumeID) (string, error) { - awsDisk, err := newAWSDisk(c, volumeName) - if err != nil { - return "", err - } - info, err := awsDisk.describeVolume() - if err != nil { - return "", err - } - if len(info.Attachments) == 0 { - return "", fmt.Errorf("No attachment to volume %s", volumeName) - } - return aws.StringValue(info.Attachments[0].Device), nil -} - -// DiskIsAttached implements Volumes.DiskIsAttached -func (c *Cloud) DiskIsAttached(diskName KubernetesVolumeID, nodeName types.NodeName) (bool, error) { - _, attached, err := c.checkIfAttachedToNode(diskName, nodeName) - if err != nil { - if isAWSErrorVolumeNotFound(err) { - // The disk doesn't exist, can't be attached - klog.Warningf("DiskIsAttached called for volume %s on node %s but the volume does not exist", diskName, nodeName) - return false, nil - } - - return true, err - } - - return attached, nil -} - -// DisksAreAttached returns a map of nodes and Kubernetes volume IDs indicating -// if the volumes are attached to the node -func (c *Cloud) DisksAreAttached(nodeDisks map[types.NodeName][]KubernetesVolumeID) (map[types.NodeName]map[KubernetesVolumeID]bool, error) { - attached := make(map[types.NodeName]map[KubernetesVolumeID]bool) - - if len(nodeDisks) == 0 { - return attached, nil - } - - nodeNames := []string{} - for nodeName, diskNames := range nodeDisks { - for _, diskName := range diskNames { - setNodeDisk(attached, diskName, nodeName, false) - } - nodeNames = append(nodeNames, mapNodeNameToPrivateDNSName(nodeName)) - } - - // Note that we get instances regardless of state. - // This means there might be multiple nodes with the same node names. - awsInstances, err := c.getInstancesByNodeNames(nodeNames) - if err != nil { - // When there is an error fetching instance information - // it is safer to return nil and let volume information not be touched. - return nil, err - } - - if len(awsInstances) == 0 { - klog.V(2).Infof("DisksAreAttached found no instances matching node names; will assume disks not attached") - return attached, nil - } - - // Note that we check that the volume is attached to the correct node, not that it is attached to _a_ node - for _, awsInstance := range awsInstances { - nodeName := mapInstanceToNodeName(awsInstance) - - diskNames := nodeDisks[nodeName] - if len(diskNames) == 0 { - continue - } - - awsInstanceState := "" - if awsInstance != nil && awsInstance.State != nil { - awsInstanceState = aws.StringValue(awsInstance.State.Name) - } - if awsInstanceState == "terminated" { - // Instance is terminated, safe to assume volumes not attached - // Note that we keep volumes attached to instances in other states (most notably, stopped) - continue - } - - idToDiskName := make(map[EBSVolumeID]KubernetesVolumeID) - for _, diskName := range diskNames { - volumeID, err := diskName.MapToAWSVolumeID() - if err != nil { - return nil, fmt.Errorf("error mapping volume spec %q to aws id: %v", diskName, err) - } - idToDiskName[volumeID] = diskName - } - - for _, blockDevice := range awsInstance.BlockDeviceMappings { - volumeID := EBSVolumeID(aws.StringValue(blockDevice.Ebs.VolumeId)) - diskName, found := idToDiskName[volumeID] - if found { - // Disk is still attached to node - setNodeDisk(attached, diskName, nodeName, true) - } - } - } - - return attached, nil -} - -// ResizeDisk resizes an EBS volume in GiB increments, it will round up to the -// next GiB if arguments are not provided in even GiB increments -func (c *Cloud) ResizeDisk( - diskName KubernetesVolumeID, - oldSize resource.Quantity, - newSize resource.Quantity) (resource.Quantity, error) { - awsDisk, err := newAWSDisk(c, diskName) - if err != nil { - return oldSize, err - } - - volumeInfo, err := awsDisk.describeVolume() - if err != nil { - descErr := fmt.Errorf("AWS.ResizeDisk Error describing volume %s with %v", diskName, err) - return oldSize, descErr - } - // AWS resizes in chunks of GiB (not GB) - requestGiB, err := volumehelpers.RoundUpToGiB(newSize) - if err != nil { - return oldSize, err - } - newSizeQuant := resource.MustParse(fmt.Sprintf("%dGi", requestGiB)) - - // If disk already if of greater or equal size than requested we return - if aws.Int64Value(volumeInfo.Size) >= requestGiB { - return newSizeQuant, nil - } - _, err = awsDisk.modifyVolume(requestGiB) - - if err != nil { - return oldSize, err - } - return newSizeQuant, nil -} - -// Gets the current load balancer state -func (c *Cloud) describeLoadBalancer(name string) (*elb.LoadBalancerDescription, error) { - request := &elb.DescribeLoadBalancersInput{} - request.LoadBalancerNames = []*string{&name} - - response, err := c.elb.DescribeLoadBalancers(request) - if err != nil { - if awsError, ok := err.(awserr.Error); ok { - if awsError.Code() == "LoadBalancerNotFound" { - return nil, nil - } - } - return nil, err - } - - var ret *elb.LoadBalancerDescription - for _, loadBalancer := range response.LoadBalancerDescriptions { - if ret != nil { - klog.Errorf("Found multiple load balancers with name: %s", name) - } - ret = loadBalancer - } - return ret, nil -} - -func (c *Cloud) addLoadBalancerTags(loadBalancerName string, requested map[string]string) error { - var tags []*elb.Tag - for k, v := range requested { - tag := &elb.Tag{ - Key: aws.String(k), - Value: aws.String(v), - } - tags = append(tags, tag) - } - - request := &elb.AddTagsInput{} - request.LoadBalancerNames = []*string{&loadBalancerName} - request.Tags = tags - - _, err := c.elb.AddTags(request) - if err != nil { - return fmt.Errorf("error adding tags to load balancer: %v", err) - } - return nil -} - -// Gets the current load balancer state -func (c *Cloud) describeLoadBalancerv2(name string) (*elbv2.LoadBalancer, error) { - request := &elbv2.DescribeLoadBalancersInput{ - Names: []*string{aws.String(name)}, - } - - response, err := c.elbv2.DescribeLoadBalancers(request) - if err != nil { - if awsError, ok := err.(awserr.Error); ok { - if awsError.Code() == elbv2.ErrCodeLoadBalancerNotFoundException { - return nil, nil - } - } - return nil, fmt.Errorf("error describing load balancer: %q", err) - } - - // AWS will not return 2 load balancers with the same name _and_ type. - for i := range response.LoadBalancers { - if aws.StringValue(response.LoadBalancers[i].Type) == elbv2.LoadBalancerTypeEnumNetwork { - return response.LoadBalancers[i], nil - } - } - - return nil, fmt.Errorf("NLB '%s' could not be found", name) -} - -// Retrieves instance's vpc id from metadata -func (c *Cloud) findVPCID() (string, error) { - macs, err := c.metadata.GetMetadata("network/interfaces/macs/") - if err != nil { - return "", fmt.Errorf("could not list interfaces of the instance: %q", err) - } - - // loop over interfaces, first vpc id returned wins - for _, macPath := range strings.Split(macs, "\n") { - if len(macPath) == 0 { - continue - } - url := fmt.Sprintf("network/interfaces/macs/%svpc-id", macPath) - vpcID, err := c.metadata.GetMetadata(url) - if err != nil { - continue - } - return vpcID, nil - } - return "", fmt.Errorf("could not find VPC ID in instance metadata") -} - -// Retrieves the specified security group from the AWS API, or returns nil if not found -func (c *Cloud) findSecurityGroup(securityGroupID string) (*ec2.SecurityGroup, error) { - describeSecurityGroupsRequest := &ec2.DescribeSecurityGroupsInput{ - GroupIds: []*string{&securityGroupID}, - } - // We don't apply our tag filters because we are retrieving by ID - - groups, err := c.ec2.DescribeSecurityGroups(describeSecurityGroupsRequest) - if err != nil { - klog.Warningf("Error retrieving security group: %q", err) - return nil, err - } - - if len(groups) == 0 { - return nil, nil - } - if len(groups) != 1 { - // This should not be possible - ids should be unique - return nil, fmt.Errorf("multiple security groups found with same id %q", securityGroupID) - } - group := groups[0] - return group, nil -} - -func isEqualIntPointer(l, r *int64) bool { - if l == nil { - return r == nil - } - if r == nil { - return l == nil - } - return *l == *r -} - -func isEqualStringPointer(l, r *string) bool { - if l == nil { - return r == nil - } - if r == nil { - return l == nil - } - return *l == *r -} - -func ipPermissionExists(newPermission, existing *ec2.IpPermission, compareGroupUserIDs bool) bool { - if !isEqualIntPointer(newPermission.FromPort, existing.FromPort) { - return false - } - if !isEqualIntPointer(newPermission.ToPort, existing.ToPort) { - return false - } - if !isEqualStringPointer(newPermission.IpProtocol, existing.IpProtocol) { - return false - } - // Check only if newPermission is a subset of existing. Usually it has zero or one elements. - // Not doing actual CIDR math yet; not clear it's needed, either. - klog.V(4).Infof("Comparing %v to %v", newPermission, existing) - if len(newPermission.IpRanges) > len(existing.IpRanges) { - return false - } - - for j := range newPermission.IpRanges { - found := false - for k := range existing.IpRanges { - if isEqualStringPointer(newPermission.IpRanges[j].CidrIp, existing.IpRanges[k].CidrIp) { - found = true - break - } - } - if !found { - return false - } - } - - for _, leftPair := range newPermission.UserIdGroupPairs { - found := false - for _, rightPair := range existing.UserIdGroupPairs { - if isEqualUserGroupPair(leftPair, rightPair, compareGroupUserIDs) { - found = true - break - } - } - if !found { - return false - } - } - - return true -} - -func isEqualUserGroupPair(l, r *ec2.UserIdGroupPair, compareGroupUserIDs bool) bool { - klog.V(2).Infof("Comparing %v to %v", *l.GroupId, *r.GroupId) - if isEqualStringPointer(l.GroupId, r.GroupId) { - if compareGroupUserIDs { - if isEqualStringPointer(l.UserId, r.UserId) { - return true - } - } else { - return true - } - } - - return false -} - -// Makes sure the security group ingress is exactly the specified permissions -// Returns true if and only if changes were made -// The security group must already exist -func (c *Cloud) setSecurityGroupIngress(securityGroupID string, permissions IPPermissionSet) (bool, error) { - group, err := c.findSecurityGroup(securityGroupID) - if err != nil { - klog.Warningf("Error retrieving security group %q", err) - return false, err - } - - if group == nil { - return false, fmt.Errorf("security group not found: %s", securityGroupID) - } - - klog.V(2).Infof("Existing security group ingress: %s %v", securityGroupID, group.IpPermissions) - - actual := NewIPPermissionSet(group.IpPermissions...) - - // EC2 groups rules together, for example combining: - // - // { Port=80, Range=[A] } and { Port=80, Range=[B] } - // - // into { Port=80, Range=[A,B] } - // - // We have to ungroup them, because otherwise the logic becomes really - // complicated, and also because if we have Range=[A,B] and we try to - // add Range=[A] then EC2 complains about a duplicate rule. - permissions = permissions.Ungroup() - actual = actual.Ungroup() - - remove := actual.Difference(permissions) - add := permissions.Difference(actual) - - if add.Len() == 0 && remove.Len() == 0 { - return false, nil - } - - // TODO: There is a limit in VPC of 100 rules per security group, so we - // probably should try grouping or combining to fit under this limit. - // But this is only used on the ELB security group currently, so it - // would require (ports * CIDRS) > 100. Also, it isn't obvious exactly - // how removing single permissions from compound rules works, and we - // don't want to accidentally open more than intended while we're - // applying changes. - if add.Len() != 0 { - klog.V(2).Infof("Adding security group ingress: %s %v", securityGroupID, add.List()) - - request := &ec2.AuthorizeSecurityGroupIngressInput{} - request.GroupId = &securityGroupID - request.IpPermissions = add.List() - _, err = c.ec2.AuthorizeSecurityGroupIngress(request) - if err != nil { - return false, fmt.Errorf("error authorizing security group ingress: %q", err) - } - } - if remove.Len() != 0 { - klog.V(2).Infof("Remove security group ingress: %s %v", securityGroupID, remove.List()) - - request := &ec2.RevokeSecurityGroupIngressInput{} - request.GroupId = &securityGroupID - request.IpPermissions = remove.List() - _, err = c.ec2.RevokeSecurityGroupIngress(request) - if err != nil { - return false, fmt.Errorf("error revoking security group ingress: %q", err) - } - } - - return true, nil -} - -// Makes sure the security group includes the specified permissions -// Returns true if and only if changes were made -// The security group must already exist -func (c *Cloud) addSecurityGroupIngress(securityGroupID string, addPermissions []*ec2.IpPermission) (bool, error) { - // We do not want to make changes to the Global defined SG - if securityGroupID == c.cfg.Global.ElbSecurityGroup { - return false, nil - } - - group, err := c.findSecurityGroup(securityGroupID) - if err != nil { - klog.Warningf("Error retrieving security group: %q", err) - return false, err - } - - if group == nil { - return false, fmt.Errorf("security group not found: %s", securityGroupID) - } - - klog.V(2).Infof("Existing security group ingress: %s %v", securityGroupID, group.IpPermissions) - - changes := []*ec2.IpPermission{} - for _, addPermission := range addPermissions { - hasUserID := false - for i := range addPermission.UserIdGroupPairs { - if addPermission.UserIdGroupPairs[i].UserId != nil { - hasUserID = true - } - } - - found := false - for _, groupPermission := range group.IpPermissions { - if ipPermissionExists(addPermission, groupPermission, hasUserID) { - found = true - break - } - } - - if !found { - changes = append(changes, addPermission) - } - } - - if len(changes) == 0 { - return false, nil - } - - klog.V(2).Infof("Adding security group ingress: %s %v", securityGroupID, changes) - - request := &ec2.AuthorizeSecurityGroupIngressInput{} - request.GroupId = &securityGroupID - request.IpPermissions = changes - _, err = c.ec2.AuthorizeSecurityGroupIngress(request) - if err != nil { - klog.Warningf("Error authorizing security group ingress %q", err) - return false, fmt.Errorf("error authorizing security group ingress: %q", err) - } - - return true, nil -} - -// Makes sure the security group no longer includes the specified permissions -// Returns true if and only if changes were made -// If the security group no longer exists, will return (false, nil) -func (c *Cloud) removeSecurityGroupIngress(securityGroupID string, removePermissions []*ec2.IpPermission) (bool, error) { - // We do not want to make changes to the Global defined SG - if securityGroupID == c.cfg.Global.ElbSecurityGroup { - return false, nil - } - - group, err := c.findSecurityGroup(securityGroupID) - if err != nil { - klog.Warningf("Error retrieving security group: %q", err) - return false, err - } - - if group == nil { - klog.Warning("Security group not found: ", securityGroupID) - return false, nil - } - - changes := []*ec2.IpPermission{} - for _, removePermission := range removePermissions { - hasUserID := false - for i := range removePermission.UserIdGroupPairs { - if removePermission.UserIdGroupPairs[i].UserId != nil { - hasUserID = true - } - } - - var found *ec2.IpPermission - for _, groupPermission := range group.IpPermissions { - if ipPermissionExists(removePermission, groupPermission, hasUserID) { - found = removePermission - break - } - } - - if found != nil { - changes = append(changes, found) - } - } - - if len(changes) == 0 { - return false, nil - } - - klog.V(2).Infof("Removing security group ingress: %s %v", securityGroupID, changes) - - request := &ec2.RevokeSecurityGroupIngressInput{} - request.GroupId = &securityGroupID - request.IpPermissions = changes - _, err = c.ec2.RevokeSecurityGroupIngress(request) - if err != nil { - klog.Warningf("Error revoking security group ingress: %q", err) - return false, err - } - - return true, nil -} - -// Makes sure the security group exists. -// For multi-cluster isolation, name must be globally unique, for example derived from the service UUID. -// Additional tags can be specified -// Returns the security group id or error -func (c *Cloud) ensureSecurityGroup(name string, description string, additionalTags map[string]string) (string, error) { - groupID := "" - attempt := 0 - for { - attempt++ - - // Note that we do _not_ add our tag filters; group-name + vpc-id is the EC2 primary key. - // However, we do check that it matches our tags. - // If it doesn't have any tags, we tag it; this is how we recover if we failed to tag before. - // If it has a different cluster's tags, that is an error. - // This shouldn't happen because name is expected to be globally unique (UUID derived) - request := &ec2.DescribeSecurityGroupsInput{} - request.Filters = []*ec2.Filter{ - newEc2Filter("group-name", name), - newEc2Filter("vpc-id", c.vpcID), - } - - securityGroups, err := c.ec2.DescribeSecurityGroups(request) - if err != nil { - return "", err - } - - if len(securityGroups) >= 1 { - if len(securityGroups) > 1 { - klog.Warningf("Found multiple security groups with name: %q", name) - } - err := c.tagging.readRepairClusterTags( - c.ec2, aws.StringValue(securityGroups[0].GroupId), - ResourceLifecycleOwned, nil, securityGroups[0].Tags) - if err != nil { - return "", err - } - - return aws.StringValue(securityGroups[0].GroupId), nil - } - - createRequest := &ec2.CreateSecurityGroupInput{} - createRequest.VpcId = &c.vpcID - createRequest.GroupName = &name - createRequest.Description = &description - - createResponse, err := c.ec2.CreateSecurityGroup(createRequest) - if err != nil { - ignore := false - switch err := err.(type) { - case awserr.Error: - if err.Code() == "InvalidGroup.Duplicate" && attempt < MaxReadThenCreateRetries { - klog.V(2).Infof("Got InvalidGroup.Duplicate while creating security group (race?); will retry") - ignore = true - } - } - if !ignore { - klog.Errorf("Error creating security group: %q", err) - return "", err - } - time.Sleep(1 * time.Second) - } else { - groupID = aws.StringValue(createResponse.GroupId) - break - } - } - if groupID == "" { - return "", fmt.Errorf("created security group, but id was not returned: %s", name) - } - - err := c.tagging.createTags(c.ec2, groupID, ResourceLifecycleOwned, additionalTags) - if err != nil { - // If we retry, ensureClusterTags will recover from this - it - // will add the missing tags. We could delete the security - // group here, but that doesn't feel like the right thing, as - // the caller is likely to retry the create - return "", fmt.Errorf("error tagging security group: %q", err) - } - return groupID, nil -} - -// Finds the value for a given tag. -func findTag(tags []*ec2.Tag, key string) (string, bool) { - for _, tag := range tags { - if aws.StringValue(tag.Key) == key { - return aws.StringValue(tag.Value), true - } - } - return "", false -} - -// Finds the subnets associated with the cluster, by matching cluster tags if present. -// For maximal backwards compatibility, if no subnets are tagged, it will fall-back to the current subnet. -// However, in future this will likely be treated as an error. -func (c *Cloud) findSubnets() ([]*ec2.Subnet, error) { - request := &ec2.DescribeSubnetsInput{} - request.Filters = []*ec2.Filter{newEc2Filter("vpc-id", c.vpcID)} - - subnets, err := c.ec2.DescribeSubnets(request) - if err != nil { - return nil, fmt.Errorf("error describing subnets: %q", err) - } - - var matches []*ec2.Subnet - for _, subnet := range subnets { - if c.tagging.hasClusterTag(subnet.Tags) { - matches = append(matches, subnet) - } else if c.tagging.hasNoClusterPrefixTag(subnet.Tags) { - matches = append(matches, subnet) - } - } - - if len(matches) != 0 { - return matches, nil - } - - // Fall back to the current instance subnets, if nothing is tagged - klog.Warningf("No tagged subnets found; will fall-back to the current subnet only. This is likely to be an error in a future version of k8s.") - - request = &ec2.DescribeSubnetsInput{} - request.Filters = []*ec2.Filter{newEc2Filter("subnet-id", c.selfAWSInstance.subnetID)} - - subnets, err = c.ec2.DescribeSubnets(request) - if err != nil { - return nil, fmt.Errorf("error describing subnets: %q", err) - } - - return subnets, nil -} - -// Finds the subnets to use for an ELB we are creating. -// Normal (Internet-facing) ELBs must use public subnets, so we skip private subnets. -// Internal ELBs can use public or private subnets, but if we have a private subnet we should prefer that. -func (c *Cloud) findELBSubnets(internalELB bool) ([]string, error) { - vpcIDFilter := newEc2Filter("vpc-id", c.vpcID) - - subnets, err := c.findSubnets() - if err != nil { - return nil, err - } - - rRequest := &ec2.DescribeRouteTablesInput{} - rRequest.Filters = []*ec2.Filter{vpcIDFilter} - rt, err := c.ec2.DescribeRouteTables(rRequest) - if err != nil { - return nil, fmt.Errorf("error describe route table: %q", err) - } - - subnetsByAZ := make(map[string]*ec2.Subnet) - for _, subnet := range subnets { - az := aws.StringValue(subnet.AvailabilityZone) - id := aws.StringValue(subnet.SubnetId) - if az == "" || id == "" { - klog.Warningf("Ignoring subnet with empty az/id: %v", subnet) - continue - } - - isPublic, err := isSubnetPublic(rt, id) - if err != nil { - return nil, err - } - if !internalELB && !isPublic { - klog.V(2).Infof("Ignoring private subnet for public ELB %q", id) - continue - } - - existing := subnetsByAZ[az] - if existing == nil { - subnetsByAZ[az] = subnet - continue - } - - // Try to break the tie using the role tag - var tagName string - if internalELB { - tagName = TagNameSubnetInternalELB - } else { - tagName = TagNameSubnetPublicELB - } - - _, existingHasTag := findTag(existing.Tags, tagName) - _, subnetHasTag := findTag(subnet.Tags, tagName) - - if existingHasTag != subnetHasTag { - if subnetHasTag { - subnetsByAZ[az] = subnet - } - continue - } - - // Prefer the one with the cluster Tag - existingHasClusterTag := c.tagging.hasClusterTag(existing.Tags) - subnetHasClusterTag := c.tagging.hasClusterTag(subnet.Tags) - if existingHasClusterTag != subnetHasClusterTag { - if subnetHasClusterTag { - subnetsByAZ[az] = subnet - } - continue - } - - // If we have two subnets for the same AZ we arbitrarily choose the one that is first lexicographically. - if strings.Compare(*existing.SubnetId, *subnet.SubnetId) > 0 { - klog.Warningf("Found multiple subnets in AZ %q; choosing %q between subnets %q and %q", az, *subnet.SubnetId, *existing.SubnetId, *subnet.SubnetId) - subnetsByAZ[az] = subnet - continue - } - - klog.Warningf("Found multiple subnets in AZ %q; choosing %q between subnets %q and %q", az, *existing.SubnetId, *existing.SubnetId, *subnet.SubnetId) - continue - } - - var azNames []string - for key := range subnetsByAZ { - azNames = append(azNames, key) - } - - sort.Strings(azNames) - - var subnetIDs []string - for _, key := range azNames { - subnetIDs = append(subnetIDs, aws.StringValue(subnetsByAZ[key].SubnetId)) - } - - return subnetIDs, nil -} - -func splitCommaSeparatedString(commaSeparatedString string) []string { - var result []string - parts := strings.Split(commaSeparatedString, ",") - for _, part := range parts { - part = strings.TrimSpace(part) - if len(part) == 0 { - continue - } - result = append(result, part) - } - return result -} - -// parses comma separated values from annotation into string slice, returns true if annotation exists -func parseStringSliceAnnotation(annotations map[string]string, annotation string, value *[]string) bool { - rawValue := "" - if exists := parseStringAnnotation(annotations, annotation, &rawValue); !exists { - return false - } - *value = splitCommaSeparatedString(rawValue) - return true -} - -func (c *Cloud) getLoadBalancerSubnets(service *v1.Service, internalELB bool) ([]string, error) { - var rawSubnetNameOrIDs []string - if exists := parseStringSliceAnnotation(service.Annotations, ServiceAnnotationLoadBalancerSubnets, &rawSubnetNameOrIDs); exists { - return c.resolveSubnetNameOrIDs(rawSubnetNameOrIDs) - } - return c.findELBSubnets(internalELB) -} - -func (c *Cloud) resolveSubnetNameOrIDs(subnetNameOrIDs []string) ([]string, error) { - var subnetIDs []string - var subnetNames []string - if len(subnetNameOrIDs) == 0 { - return []string{}, fmt.Errorf("unable to resolve empty subnet slice") - } - for _, nameOrID := range subnetNameOrIDs { - if strings.HasPrefix(nameOrID, "subnet-") { - subnetIDs = append(subnetIDs, nameOrID) - } else { - subnetNames = append(subnetNames, nameOrID) - } - } - var resolvedSubnets []*ec2.Subnet - if len(subnetIDs) > 0 { - req := &ec2.DescribeSubnetsInput{ - SubnetIds: aws.StringSlice(subnetIDs), - } - subnets, err := c.ec2.DescribeSubnets(req) - if err != nil { - return []string{}, err - } - resolvedSubnets = append(resolvedSubnets, subnets...) - } - if len(subnetNames) > 0 { - req := &ec2.DescribeSubnetsInput{ - Filters: []*ec2.Filter{ - { - Name: aws.String("tag:Name"), - Values: aws.StringSlice(subnetNames), - }, - { - Name: aws.String("vpc-id"), - Values: aws.StringSlice([]string{c.vpcID}), - }, - }, - } - subnets, err := c.ec2.DescribeSubnets(req) - if err != nil { - return []string{}, err - } - resolvedSubnets = append(resolvedSubnets, subnets...) - } - if len(resolvedSubnets) != len(subnetNameOrIDs) { - return []string{}, fmt.Errorf("expected to find %v, but found %v subnets", len(subnetNameOrIDs), len(resolvedSubnets)) - } - var subnets []string - for _, subnet := range resolvedSubnets { - subnets = append(subnets, aws.StringValue(subnet.SubnetId)) - } - return subnets, nil -} - -func isSubnetPublic(rt []*ec2.RouteTable, subnetID string) (bool, error) { - var subnetTable *ec2.RouteTable - for _, table := range rt { - for _, assoc := range table.Associations { - if aws.StringValue(assoc.SubnetId) == subnetID { - subnetTable = table - break - } - } - } - - if subnetTable == nil { - // If there is no explicit association, the subnet will be implicitly - // associated with the VPC's main routing table. - for _, table := range rt { - for _, assoc := range table.Associations { - if aws.BoolValue(assoc.Main) == true { - klog.V(4).Infof("Assuming implicit use of main routing table %s for %s", - aws.StringValue(table.RouteTableId), subnetID) - subnetTable = table - break - } - } - } - } - - if subnetTable == nil { - return false, fmt.Errorf("could not locate routing table for subnet %s", subnetID) - } - - for _, route := range subnetTable.Routes { - // There is no direct way in the AWS API to determine if a subnet is public or private. - // A public subnet is one which has an internet gateway route - // we look for the gatewayId and make sure it has the prefix of igw to differentiate - // from the default in-subnet route which is called "local" - // or other virtual gateway (starting with vgv) - // or vpc peering connections (starting with pcx). - if strings.HasPrefix(aws.StringValue(route.GatewayId), "igw") { - return true, nil - } - } - - return false, nil -} - -type portSets struct { - names sets.String - numbers sets.Int64 -} - -// getPortSets returns a portSets structure representing port names and numbers -// that the comma-separated string describes. If the input is empty or equal to -// "*", a nil pointer is returned. -func getPortSets(annotation string) (ports *portSets) { - if annotation != "" && annotation != "*" { - ports = &portSets{ - sets.NewString(), - sets.NewInt64(), - } - portStringSlice := strings.Split(annotation, ",") - for _, item := range portStringSlice { - port, err := strconv.Atoi(item) - if err != nil { - ports.names.Insert(item) - } else { - ports.numbers.Insert(int64(port)) - } - } - } - return -} - -// This function is useful in extracting the security group list from annotation -func getSGListFromAnnotation(annotatedSG string) []string { - sgList := []string{} - for _, extraSG := range strings.Split(annotatedSG, ",") { - extraSG = strings.TrimSpace(extraSG) - if len(extraSG) > 0 { - sgList = append(sgList, extraSG) - } - } - return sgList -} - -// buildELBSecurityGroupList returns list of SecurityGroups which should be -// attached to ELB created by a service. List always consist of at least -// 1 member which is an SG created for this service or a SG from the Global config. -// Extra groups can be specified via annotation, as can extra tags for any -// new groups. The annotation "ServiceAnnotationLoadBalancerSecurityGroups" allows for -// setting the security groups specified. -func (c *Cloud) buildELBSecurityGroupList(serviceName types.NamespacedName, loadBalancerName string, annotations map[string]string) ([]string, bool, error) { - var err error - var securityGroupID string - // We do not want to make changes to a Global defined SG - var setupSg = false - - sgList := getSGListFromAnnotation(annotations[ServiceAnnotationLoadBalancerSecurityGroups]) - - // If no Security Groups have been specified with the ServiceAnnotationLoadBalancerSecurityGroups annotation, we add the default one. - if len(sgList) == 0 { - if c.cfg.Global.ElbSecurityGroup != "" { - sgList = append(sgList, c.cfg.Global.ElbSecurityGroup) - } else { - // Create a security group for the load balancer - sgName := "k8s-elb-" + loadBalancerName - sgDescription := fmt.Sprintf("Security group for Kubernetes ELB %s (%v)", loadBalancerName, serviceName) - securityGroupID, err = c.ensureSecurityGroup(sgName, sgDescription, getKeyValuePropertiesFromAnnotation(annotations, ServiceAnnotationLoadBalancerAdditionalTags)) - if err != nil { - klog.Errorf("Error creating load balancer security group: %q", err) - return nil, setupSg, err - } - sgList = append(sgList, securityGroupID) - setupSg = true - } - } - - extraSGList := getSGListFromAnnotation(annotations[ServiceAnnotationLoadBalancerExtraSecurityGroups]) - sgList = append(sgList, extraSGList...) - - return sgList, setupSg, nil -} - -// sortELBSecurityGroupList returns a list of sorted securityGroupIDs based on the original order -// from buildELBSecurityGroupList. The logic is: -// - securityGroups specified by ServiceAnnotationLoadBalancerSecurityGroups appears first in order -// - securityGroups specified by ServiceAnnotationLoadBalancerExtraSecurityGroups appears last in order -func (c *Cloud) sortELBSecurityGroupList(securityGroupIDs []string, annotations map[string]string) { - annotatedSGList := getSGListFromAnnotation(annotations[ServiceAnnotationLoadBalancerSecurityGroups]) - annotatedExtraSGList := getSGListFromAnnotation(annotations[ServiceAnnotationLoadBalancerExtraSecurityGroups]) - annotatedSGIndex := make(map[string]int, len(annotatedSGList)) - annotatedExtraSGIndex := make(map[string]int, len(annotatedExtraSGList)) - - for i, sgID := range annotatedSGList { - annotatedSGIndex[sgID] = i - } - for i, sgID := range annotatedExtraSGList { - annotatedExtraSGIndex[sgID] = i - } - sgOrderMapping := make(map[string]int, len(securityGroupIDs)) - for _, sgID := range securityGroupIDs { - if i, ok := annotatedSGIndex[sgID]; ok { - sgOrderMapping[sgID] = i - } else if j, ok := annotatedExtraSGIndex[sgID]; ok { - sgOrderMapping[sgID] = len(annotatedSGIndex) + 1 + j - } else { - sgOrderMapping[sgID] = len(annotatedSGIndex) - } - } - sort.Slice(securityGroupIDs, func(i, j int) bool { - return sgOrderMapping[securityGroupIDs[i]] < sgOrderMapping[securityGroupIDs[j]] - }) -} - -// buildListener creates a new listener from the given port, adding an SSL certificate -// if indicated by the appropriate annotations. -func buildListener(port v1.ServicePort, annotations map[string]string, sslPorts *portSets) (*elb.Listener, error) { - loadBalancerPort := int64(port.Port) - portName := strings.ToLower(port.Name) - instancePort := int64(port.NodePort) - protocol := strings.ToLower(string(port.Protocol)) - instanceProtocol := protocol - - listener := &elb.Listener{} - listener.InstancePort = &instancePort - listener.LoadBalancerPort = &loadBalancerPort - certID := annotations[ServiceAnnotationLoadBalancerCertificate] - if certID != "" && (sslPorts == nil || sslPorts.numbers.Has(loadBalancerPort) || sslPorts.names.Has(portName)) { - instanceProtocol = annotations[ServiceAnnotationLoadBalancerBEProtocol] - if instanceProtocol == "" { - protocol = "ssl" - instanceProtocol = "tcp" - } else { - protocol = backendProtocolMapping[instanceProtocol] - if protocol == "" { - return nil, fmt.Errorf("Invalid backend protocol %s for %s in %s", instanceProtocol, certID, ServiceAnnotationLoadBalancerBEProtocol) - } - } - listener.SSLCertificateId = &certID - } else if annotationProtocol := annotations[ServiceAnnotationLoadBalancerBEProtocol]; annotationProtocol == "http" { - instanceProtocol = annotationProtocol - protocol = "http" - } - - listener.Protocol = &protocol - listener.InstanceProtocol = &instanceProtocol - - return listener, nil -} - -func (c *Cloud) getSubnetCidrs(subnetIDs []string) ([]string, error) { - request := &ec2.DescribeSubnetsInput{} - for _, subnetID := range subnetIDs { - request.SubnetIds = append(request.SubnetIds, aws.String(subnetID)) - } - - subnets, err := c.ec2.DescribeSubnets(request) - if err != nil { - return nil, fmt.Errorf("error querying Subnet for ELB: %q", err) - } - if len(subnets) != len(subnetIDs) { - return nil, fmt.Errorf("error querying Subnet for ELB, got %d subnets for %v", len(subnets), subnetIDs) - } - - cidrs := make([]string, 0, len(subnets)) - for _, subnet := range subnets { - cidrs = append(cidrs, aws.StringValue(subnet.CidrBlock)) - } - return cidrs, nil -} - -func parseStringAnnotation(annotations map[string]string, annotation string, value *string) bool { - if v, ok := annotations[annotation]; ok { - *value = v - return true - } - return false -} - -func parseInt64Annotation(annotations map[string]string, annotation string, value *int64) (bool, error) { - if v, ok := annotations[annotation]; ok { - parsed, err := strconv.ParseInt(v, 10, 0) - if err != nil { - return true, fmt.Errorf("failed to parse annotation %v=%v", annotation, v) - } - *value = parsed - return true, nil - } - return false, nil -} - -func (c *Cloud) buildNLBHealthCheckConfiguration(svc *v1.Service) (healthCheckConfig, error) { - hc := healthCheckConfig{ - Port: defaultHealthCheckPort, - Path: defaultHealthCheckPath, - Protocol: elbv2.ProtocolEnumTcp, - Interval: defaultNlbHealthCheckInterval, - Timeout: defaultNlbHealthCheckTimeout, - HealthyThreshold: defaultNlbHealthCheckThreshold, - UnhealthyThreshold: defaultNlbHealthCheckThreshold, - } - if svc.Spec.ExternalTrafficPolicy == v1.ServiceExternalTrafficPolicyLocal { - path, port := servicehelpers.GetServiceHealthCheckPathPort(svc) - hc = healthCheckConfig{ - Port: strconv.Itoa(int(port)), - Path: path, - Protocol: elbv2.ProtocolEnumHttp, - Interval: 10, - Timeout: 10, - HealthyThreshold: 2, - UnhealthyThreshold: 2, - } - } - if parseStringAnnotation(svc.Annotations, ServiceAnnotationLoadBalancerHealthCheckProtocol, &hc.Protocol) { - hc.Protocol = strings.ToUpper(hc.Protocol) - } - switch hc.Protocol { - case elbv2.ProtocolEnumHttp, elbv2.ProtocolEnumHttps: - parseStringAnnotation(svc.Annotations, ServiceAnnotationLoadBalancerHealthCheckPath, &hc.Path) - case elbv2.ProtocolEnumTcp: - hc.Path = "" - default: - return healthCheckConfig{}, fmt.Errorf("Unsupported health check protocol %v", hc.Protocol) - } - - parseStringAnnotation(svc.Annotations, ServiceAnnotationLoadBalancerHealthCheckPort, &hc.Port) - - if _, err := parseInt64Annotation(svc.Annotations, ServiceAnnotationLoadBalancerHCInterval, &hc.Interval); err != nil { - return healthCheckConfig{}, err - } - if _, err := parseInt64Annotation(svc.Annotations, ServiceAnnotationLoadBalancerHCTimeout, &hc.Timeout); err != nil { - return healthCheckConfig{}, err - } - if _, err := parseInt64Annotation(svc.Annotations, ServiceAnnotationLoadBalancerHCHealthyThreshold, &hc.HealthyThreshold); err != nil { - return healthCheckConfig{}, err - } - if _, err := parseInt64Annotation(svc.Annotations, ServiceAnnotationLoadBalancerHCUnhealthyThreshold, &hc.UnhealthyThreshold); err != nil { - return healthCheckConfig{}, err - } - - if hc.Port != defaultHealthCheckPort { - if _, err := strconv.ParseInt(hc.Port, 10, 0); err != nil { - return healthCheckConfig{}, fmt.Errorf("Invalid health check port '%v'", hc.Port) - } - } - return hc, nil -} - -// EnsureLoadBalancer implements LoadBalancer.EnsureLoadBalancer -func (c *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, apiService *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) { - annotations := apiService.Annotations - if isLBExternal(annotations) { - return nil, cloudprovider.ImplementedElsewhere - } - klog.V(2).Infof("EnsureLoadBalancer(%v, %v, %v, %v, %v, %v, %v)", - clusterName, apiService.Namespace, apiService.Name, c.region, apiService.Spec.LoadBalancerIP, apiService.Spec.Ports, annotations) - - if apiService.Spec.SessionAffinity != v1.ServiceAffinityNone { - // ELB supports sticky sessions, but only when configured for HTTP/HTTPS - return nil, fmt.Errorf("unsupported load balancer affinity: %v", apiService.Spec.SessionAffinity) - } - - if len(apiService.Spec.Ports) == 0 { - return nil, fmt.Errorf("requested load balancer with no ports") - } - if err := checkMixedProtocol(apiService.Spec.Ports); err != nil { - return nil, err - } - // Figure out what mappings we want on the load balancer - listeners := []*elb.Listener{} - v2Mappings := []nlbPortMapping{} - - sslPorts := getPortSets(annotations[ServiceAnnotationLoadBalancerSSLPorts]) - for _, port := range apiService.Spec.Ports { - if err := checkProtocol(port, annotations); err != nil { - return nil, err - } - - if port.NodePort == 0 { - klog.Errorf("Ignoring port without NodePort defined: %v", port) - continue - } - - if isNLB(annotations) { - portMapping := nlbPortMapping{ - FrontendPort: int64(port.Port), - FrontendProtocol: string(port.Protocol), - TrafficPort: int64(port.NodePort), - TrafficProtocol: string(port.Protocol), - } - var err error - if portMapping.HealthCheckConfig, err = c.buildNLBHealthCheckConfiguration(apiService); err != nil { - return nil, err - } - - certificateARN := annotations[ServiceAnnotationLoadBalancerCertificate] - if port.Protocol != v1.ProtocolUDP && certificateARN != "" && (sslPorts == nil || sslPorts.numbers.Has(int64(port.Port)) || sslPorts.names.Has(port.Name)) { - portMapping.FrontendProtocol = elbv2.ProtocolEnumTls - portMapping.SSLCertificateARN = certificateARN - portMapping.SSLPolicy = annotations[ServiceAnnotationLoadBalancerSSLNegotiationPolicy] - - if backendProtocol := annotations[ServiceAnnotationLoadBalancerBEProtocol]; backendProtocol == "ssl" { - portMapping.TrafficProtocol = elbv2.ProtocolEnumTls - } - } - - v2Mappings = append(v2Mappings, portMapping) - } else { - listener, err := buildListener(port, annotations, sslPorts) - if err != nil { - return nil, err - } - listeners = append(listeners, listener) - } - } - - if apiService.Spec.LoadBalancerIP != "" { - return nil, fmt.Errorf("LoadBalancerIP cannot be specified for AWS ELB") - } - - instances, err := c.findInstancesForELB(nodes, annotations) - if err != nil { - return nil, err - } - - sourceRanges, err := servicehelpers.GetLoadBalancerSourceRanges(apiService) - if err != nil { - return nil, err - } - - // Determine if this is tagged as an Internal ELB - internalELB := false - internalAnnotation := apiService.Annotations[ServiceAnnotationLoadBalancerInternal] - if internalAnnotation == "false" { - internalELB = false - } else if internalAnnotation != "" { - internalELB = true - } - - if isNLB(annotations) { - // Find the subnets that the ELB will live in - subnetIDs, err := c.getLoadBalancerSubnets(apiService, internalELB) - if err != nil { - klog.Errorf("Error listing subnets in VPC: %q", err) - return nil, err - } - // Bail out early if there are no subnets - if len(subnetIDs) == 0 { - return nil, fmt.Errorf("could not find any suitable subnets for creating the ELB") - } - - loadBalancerName := c.GetLoadBalancerName(ctx, clusterName, apiService) - serviceName := types.NamespacedName{Namespace: apiService.Namespace, Name: apiService.Name} - - instanceIDs := []string{} - for id := range instances { - instanceIDs = append(instanceIDs, string(id)) - } - - v2LoadBalancer, err := c.ensureLoadBalancerv2( - serviceName, - loadBalancerName, - v2Mappings, - instanceIDs, - subnetIDs, - internalELB, - annotations, - ) - if err != nil { - return nil, err - } - - subnetCidrs, err := c.getSubnetCidrs(subnetIDs) - if err != nil { - klog.Errorf("Error getting subnet cidrs: %q", err) - return nil, err - } - - sourceRangeCidrs := []string{} - for cidr := range sourceRanges { - sourceRangeCidrs = append(sourceRangeCidrs, cidr) - } - if len(sourceRangeCidrs) == 0 { - sourceRangeCidrs = append(sourceRangeCidrs, "0.0.0.0/0") - } - - err = c.updateInstanceSecurityGroupsForNLB(loadBalancerName, instances, subnetCidrs, sourceRangeCidrs, v2Mappings) - if err != nil { - klog.Warningf("Error opening ingress rules for the load balancer to the instances: %q", err) - return nil, err - } - - // We don't have an `ensureLoadBalancerInstances()` function for elbv2 - // because `ensureLoadBalancerv2()` requires instance Ids - - // TODO: Wait for creation? - return v2toStatus(v2LoadBalancer), nil - } - - // Determine if we need to set the Proxy protocol policy - proxyProtocol := false - proxyProtocolAnnotation := apiService.Annotations[ServiceAnnotationLoadBalancerProxyProtocol] - if proxyProtocolAnnotation != "" { - if proxyProtocolAnnotation != "*" { - return nil, fmt.Errorf("annotation %q=%q detected, but the only value supported currently is '*'", ServiceAnnotationLoadBalancerProxyProtocol, proxyProtocolAnnotation) - } - proxyProtocol = true - } - - // Some load balancer attributes are required, so defaults are set. These can be overridden by annotations. - loadBalancerAttributes := &elb.LoadBalancerAttributes{ - AccessLog: &elb.AccessLog{Enabled: aws.Bool(false)}, - ConnectionDraining: &elb.ConnectionDraining{Enabled: aws.Bool(false)}, - ConnectionSettings: &elb.ConnectionSettings{IdleTimeout: aws.Int64(60)}, - CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{Enabled: aws.Bool(false)}, - } - - // Determine if an access log emit interval has been specified - accessLogEmitIntervalAnnotation := annotations[ServiceAnnotationLoadBalancerAccessLogEmitInterval] - if accessLogEmitIntervalAnnotation != "" { - accessLogEmitInterval, err := strconv.ParseInt(accessLogEmitIntervalAnnotation, 10, 64) - if err != nil { - return nil, fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerAccessLogEmitInterval, - accessLogEmitIntervalAnnotation, - ) - } - loadBalancerAttributes.AccessLog.EmitInterval = &accessLogEmitInterval - } - - // Determine if access log enabled/disabled has been specified - accessLogEnabledAnnotation := annotations[ServiceAnnotationLoadBalancerAccessLogEnabled] - if accessLogEnabledAnnotation != "" { - accessLogEnabled, err := strconv.ParseBool(accessLogEnabledAnnotation) - if err != nil { - return nil, fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerAccessLogEnabled, - accessLogEnabledAnnotation, - ) - } - loadBalancerAttributes.AccessLog.Enabled = &accessLogEnabled - } - - // Determine if access log s3 bucket name has been specified - accessLogS3BucketNameAnnotation := annotations[ServiceAnnotationLoadBalancerAccessLogS3BucketName] - if accessLogS3BucketNameAnnotation != "" { - loadBalancerAttributes.AccessLog.S3BucketName = &accessLogS3BucketNameAnnotation - } - - // Determine if access log s3 bucket prefix has been specified - accessLogS3BucketPrefixAnnotation := annotations[ServiceAnnotationLoadBalancerAccessLogS3BucketPrefix] - if accessLogS3BucketPrefixAnnotation != "" { - loadBalancerAttributes.AccessLog.S3BucketPrefix = &accessLogS3BucketPrefixAnnotation - } - - // Determine if connection draining enabled/disabled has been specified - connectionDrainingEnabledAnnotation := annotations[ServiceAnnotationLoadBalancerConnectionDrainingEnabled] - if connectionDrainingEnabledAnnotation != "" { - connectionDrainingEnabled, err := strconv.ParseBool(connectionDrainingEnabledAnnotation) - if err != nil { - return nil, fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerConnectionDrainingEnabled, - connectionDrainingEnabledAnnotation, - ) - } - loadBalancerAttributes.ConnectionDraining.Enabled = &connectionDrainingEnabled - } - - // Determine if connection draining timeout has been specified - connectionDrainingTimeoutAnnotation := annotations[ServiceAnnotationLoadBalancerConnectionDrainingTimeout] - if connectionDrainingTimeoutAnnotation != "" { - connectionDrainingTimeout, err := strconv.ParseInt(connectionDrainingTimeoutAnnotation, 10, 64) - if err != nil { - return nil, fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerConnectionDrainingTimeout, - connectionDrainingTimeoutAnnotation, - ) - } - loadBalancerAttributes.ConnectionDraining.Timeout = &connectionDrainingTimeout - } - - // Determine if connection idle timeout has been specified - connectionIdleTimeoutAnnotation := annotations[ServiceAnnotationLoadBalancerConnectionIdleTimeout] - if connectionIdleTimeoutAnnotation != "" { - connectionIdleTimeout, err := strconv.ParseInt(connectionIdleTimeoutAnnotation, 10, 64) - if err != nil { - return nil, fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerConnectionIdleTimeout, - connectionIdleTimeoutAnnotation, - ) - } - loadBalancerAttributes.ConnectionSettings.IdleTimeout = &connectionIdleTimeout - } - - // Determine if cross zone load balancing enabled/disabled has been specified - crossZoneLoadBalancingEnabledAnnotation := annotations[ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled] - if crossZoneLoadBalancingEnabledAnnotation != "" { - crossZoneLoadBalancingEnabled, err := strconv.ParseBool(crossZoneLoadBalancingEnabledAnnotation) - if err != nil { - return nil, fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled, - crossZoneLoadBalancingEnabledAnnotation, - ) - } - loadBalancerAttributes.CrossZoneLoadBalancing.Enabled = &crossZoneLoadBalancingEnabled - } - - // Find the subnets that the ELB will live in - subnetIDs, err := c.getLoadBalancerSubnets(apiService, internalELB) - if err != nil { - klog.Errorf("Error listing subnets in VPC: %q", err) - return nil, err - } - - // Bail out early if there are no subnets - if len(subnetIDs) == 0 { - return nil, fmt.Errorf("could not find any suitable subnets for creating the ELB") - } - - loadBalancerName := c.GetLoadBalancerName(ctx, clusterName, apiService) - serviceName := types.NamespacedName{Namespace: apiService.Namespace, Name: apiService.Name} - securityGroupIDs, setupSg, err := c.buildELBSecurityGroupList(serviceName, loadBalancerName, annotations) - if err != nil { - return nil, err - } - if len(securityGroupIDs) == 0 { - return nil, fmt.Errorf("[BUG] ELB can't have empty list of Security Groups to be assigned, this is a Kubernetes bug, please report") - } - - if setupSg { - ec2SourceRanges := []*ec2.IpRange{} - for _, sourceRange := range sourceRanges.StringSlice() { - ec2SourceRanges = append(ec2SourceRanges, &ec2.IpRange{CidrIp: aws.String(sourceRange)}) - } - - permissions := NewIPPermissionSet() - for _, port := range apiService.Spec.Ports { - portInt64 := int64(port.Port) - protocol := strings.ToLower(string(port.Protocol)) - - permission := &ec2.IpPermission{} - permission.FromPort = &portInt64 - permission.ToPort = &portInt64 - permission.IpRanges = ec2SourceRanges - permission.IpProtocol = &protocol - - permissions.Insert(permission) - } - - // Allow ICMP fragmentation packets, important for MTU discovery - { - permission := &ec2.IpPermission{ - IpProtocol: aws.String("icmp"), - FromPort: aws.Int64(3), - ToPort: aws.Int64(4), - IpRanges: ec2SourceRanges, - } - - permissions.Insert(permission) - } - _, err = c.setSecurityGroupIngress(securityGroupIDs[0], permissions) - if err != nil { - return nil, err - } - } - - // Build the load balancer itself - loadBalancer, err := c.ensureLoadBalancer( - serviceName, - loadBalancerName, - listeners, - subnetIDs, - securityGroupIDs, - internalELB, - proxyProtocol, - loadBalancerAttributes, - annotations, - ) - if err != nil { - return nil, err - } - - if sslPolicyName, ok := annotations[ServiceAnnotationLoadBalancerSSLNegotiationPolicy]; ok { - err := c.ensureSSLNegotiationPolicy(loadBalancer, sslPolicyName) - if err != nil { - return nil, err - } - - for _, port := range c.getLoadBalancerTLSPorts(loadBalancer) { - err := c.setSSLNegotiationPolicy(loadBalancerName, sslPolicyName, port) - if err != nil { - return nil, err - } - } - } - - // We only configure a TCP health-check on the first port - var tcpHealthCheckPort int32 - for _, listener := range listeners { - if listener.InstancePort == nil { - continue - } - tcpHealthCheckPort = int32(*listener.InstancePort) - break - } - if path, healthCheckNodePort := servicehelpers.GetServiceHealthCheckPathPort(apiService); path != "" { - klog.V(4).Infof("service %v (%v) needs health checks on :%d%s)", apiService.Name, loadBalancerName, healthCheckNodePort, path) - if annotations[ServiceAnnotationLoadBalancerHealthCheckPort] == defaultHealthCheckPort { - healthCheckNodePort = tcpHealthCheckPort - } - err = c.ensureLoadBalancerHealthCheck(loadBalancer, "HTTP", healthCheckNodePort, path, annotations) - if err != nil { - return nil, fmt.Errorf("Failed to ensure health check for localized service %v on node port %v: %q", loadBalancerName, healthCheckNodePort, err) - } - } else { - klog.V(4).Infof("service %v does not need custom health checks", apiService.Name) - annotationProtocol := strings.ToLower(annotations[ServiceAnnotationLoadBalancerBEProtocol]) - var hcProtocol string - if annotationProtocol == "https" || annotationProtocol == "ssl" { - hcProtocol = "SSL" - } else { - hcProtocol = "TCP" - } - // there must be no path on TCP health check - err = c.ensureLoadBalancerHealthCheck(loadBalancer, hcProtocol, tcpHealthCheckPort, "", annotations) - if err != nil { - return nil, err - } - } - - err = c.updateInstanceSecurityGroupsForLoadBalancer(loadBalancer, instances, annotations) - if err != nil { - klog.Warningf("Error opening ingress rules for the load balancer to the instances: %q", err) - return nil, err - } - - err = c.ensureLoadBalancerInstances(aws.StringValue(loadBalancer.LoadBalancerName), loadBalancer.Instances, instances) - if err != nil { - klog.Warningf("Error registering instances with the load balancer: %q", err) - return nil, err - } - - klog.V(1).Infof("Loadbalancer %s (%v) has DNS name %s", loadBalancerName, serviceName, aws.StringValue(loadBalancer.DNSName)) - - // TODO: Wait for creation? - - status := toStatus(loadBalancer) - return status, nil -} - -// GetLoadBalancer is an implementation of LoadBalancer.GetLoadBalancer -func (c *Cloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error) { - if isLBExternal(service.Annotations) { - return nil, false, nil - } - loadBalancerName := c.GetLoadBalancerName(ctx, clusterName, service) - - if isNLB(service.Annotations) { - lb, err := c.describeLoadBalancerv2(loadBalancerName) - if err != nil { - return nil, false, err - } - if lb == nil { - return nil, false, nil - } - return v2toStatus(lb), true, nil - } - - lb, err := c.describeLoadBalancer(loadBalancerName) - if err != nil { - return nil, false, err - } - - if lb == nil { - return nil, false, nil - } - - status := toStatus(lb) - return status, true, nil -} - -// GetLoadBalancerName is an implementation of LoadBalancer.GetLoadBalancerName -func (c *Cloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string { - // TODO: replace DefaultLoadBalancerName to generate more meaningful loadbalancer names. - return cloudprovider.DefaultLoadBalancerName(service) -} - -func toStatus(lb *elb.LoadBalancerDescription) *v1.LoadBalancerStatus { - status := &v1.LoadBalancerStatus{} - - if aws.StringValue(lb.DNSName) != "" { - var ingress v1.LoadBalancerIngress - ingress.Hostname = aws.StringValue(lb.DNSName) - status.Ingress = []v1.LoadBalancerIngress{ingress} - } - - return status -} - -func v2toStatus(lb *elbv2.LoadBalancer) *v1.LoadBalancerStatus { - status := &v1.LoadBalancerStatus{} - if lb == nil { - klog.Error("[BUG] v2toStatus got nil input, this is a Kubernetes bug, please report") - return status - } - - // We check for Active or Provisioning, the only successful statuses - if aws.StringValue(lb.DNSName) != "" && (aws.StringValue(lb.State.Code) == elbv2.LoadBalancerStateEnumActive || - aws.StringValue(lb.State.Code) == elbv2.LoadBalancerStateEnumProvisioning) { - var ingress v1.LoadBalancerIngress - ingress.Hostname = aws.StringValue(lb.DNSName) - status.Ingress = []v1.LoadBalancerIngress{ingress} - } - - return status -} - -// Returns the first security group for an instance, or nil -// We only create instances with one security group, so we don't expect multiple security groups. -// However, if there are multiple security groups, we will choose the one tagged with our cluster filter. -// Otherwise we will return an error. -func findSecurityGroupForInstance(instance *ec2.Instance, taggedSecurityGroups map[string]*ec2.SecurityGroup) (*ec2.GroupIdentifier, error) { - instanceID := aws.StringValue(instance.InstanceId) - - var tagged []*ec2.GroupIdentifier - var untagged []*ec2.GroupIdentifier - for _, group := range instance.SecurityGroups { - groupID := aws.StringValue(group.GroupId) - if groupID == "" { - klog.Warningf("Ignoring security group without id for instance %q: %v", instanceID, group) - continue - } - _, isTagged := taggedSecurityGroups[groupID] - if isTagged { - tagged = append(tagged, group) - } else { - untagged = append(untagged, group) - } - } - - if len(tagged) > 0 { - // We create instances with one SG - // If users create multiple SGs, they must tag one of them as being k8s owned - if len(tagged) != 1 { - taggedGroups := "" - for _, v := range tagged { - taggedGroups += fmt.Sprintf("%s(%s) ", *v.GroupId, *v.GroupName) - } - return nil, fmt.Errorf("Multiple tagged security groups found for instance %s; ensure only the k8s security group is tagged; the tagged groups were %v", instanceID, taggedGroups) - } - return tagged[0], nil - } - - if len(untagged) > 0 { - // For back-compat, we will allow a single untagged SG - if len(untagged) != 1 { - return nil, fmt.Errorf("Multiple untagged security groups found for instance %s; ensure the k8s security group is tagged", instanceID) - } - return untagged[0], nil - } - - klog.Warningf("No security group found for instance %q", instanceID) - return nil, nil -} - -// Return all the security groups that are tagged as being part of our cluster -func (c *Cloud) getTaggedSecurityGroups() (map[string]*ec2.SecurityGroup, error) { - request := &ec2.DescribeSecurityGroupsInput{} - groups, err := c.ec2.DescribeSecurityGroups(request) - if err != nil { - return nil, fmt.Errorf("error querying security groups: %q", err) - } - - m := make(map[string]*ec2.SecurityGroup) - for _, group := range groups { - if !c.tagging.hasClusterTag(group.Tags) { - continue - } - - id := aws.StringValue(group.GroupId) - if id == "" { - klog.Warningf("Ignoring group without id: %v", group) - continue - } - m[id] = group - } - return m, nil -} - -// Open security group ingress rules on the instances so that the load balancer can talk to them -// Will also remove any security groups ingress rules for the load balancer that are _not_ needed for allInstances -func (c *Cloud) updateInstanceSecurityGroupsForLoadBalancer(lb *elb.LoadBalancerDescription, instances map[InstanceID]*ec2.Instance, annotations map[string]string) error { - if c.cfg.Global.DisableSecurityGroupIngress { - return nil - } - - // Determine the load balancer security group id - lbSecurityGroupIDs := aws.StringValueSlice(lb.SecurityGroups) - if len(lbSecurityGroupIDs) == 0 { - return fmt.Errorf("could not determine security group for load balancer: %s", aws.StringValue(lb.LoadBalancerName)) - } - c.sortELBSecurityGroupList(lbSecurityGroupIDs, annotations) - loadBalancerSecurityGroupID := lbSecurityGroupIDs[0] - - // Get the actual list of groups that allow ingress from the load-balancer - var actualGroups []*ec2.SecurityGroup - { - describeRequest := &ec2.DescribeSecurityGroupsInput{} - describeRequest.Filters = []*ec2.Filter{ - newEc2Filter("ip-permission.group-id", loadBalancerSecurityGroupID), - } - response, err := c.ec2.DescribeSecurityGroups(describeRequest) - if err != nil { - return fmt.Errorf("error querying security groups for ELB: %q", err) - } - for _, sg := range response { - if !c.tagging.hasClusterTag(sg.Tags) { - continue - } - actualGroups = append(actualGroups, sg) - } - } - - taggedSecurityGroups, err := c.getTaggedSecurityGroups() - if err != nil { - return fmt.Errorf("error querying for tagged security groups: %q", err) - } - - // Open the firewall from the load balancer to the instance - // We don't actually have a trivial way to know in advance which security group the instance is in - // (it is probably the node security group, but we don't easily have that). - // However, we _do_ have the list of security groups on the instance records. - - // Map containing the changes we want to make; true to add, false to remove - instanceSecurityGroupIds := map[string]bool{} - - // Scan instances for groups we want open - for _, instance := range instances { - securityGroup, err := findSecurityGroupForInstance(instance, taggedSecurityGroups) - if err != nil { - return err - } - - if securityGroup == nil { - klog.Warning("Ignoring instance without security group: ", aws.StringValue(instance.InstanceId)) - continue - } - id := aws.StringValue(securityGroup.GroupId) - if id == "" { - klog.Warningf("found security group without id: %v", securityGroup) - continue - } - - instanceSecurityGroupIds[id] = true - } - - // Compare to actual groups - for _, actualGroup := range actualGroups { - actualGroupID := aws.StringValue(actualGroup.GroupId) - if actualGroupID == "" { - klog.Warning("Ignoring group without ID: ", actualGroup) - continue - } - - adding, found := instanceSecurityGroupIds[actualGroupID] - if found && adding { - // We don't need to make a change; the permission is already in place - delete(instanceSecurityGroupIds, actualGroupID) - } else { - // This group is not needed by allInstances; delete it - instanceSecurityGroupIds[actualGroupID] = false - } - } - - for instanceSecurityGroupID, add := range instanceSecurityGroupIds { - if add { - klog.V(2).Infof("Adding rule for traffic from the load balancer (%s) to instances (%s)", loadBalancerSecurityGroupID, instanceSecurityGroupID) - } else { - klog.V(2).Infof("Removing rule for traffic from the load balancer (%s) to instance (%s)", loadBalancerSecurityGroupID, instanceSecurityGroupID) - } - sourceGroupID := &ec2.UserIdGroupPair{} - sourceGroupID.GroupId = &loadBalancerSecurityGroupID - - allProtocols := "-1" - - permission := &ec2.IpPermission{} - permission.IpProtocol = &allProtocols - permission.UserIdGroupPairs = []*ec2.UserIdGroupPair{sourceGroupID} - - permissions := []*ec2.IpPermission{permission} - - if add { - changed, err := c.addSecurityGroupIngress(instanceSecurityGroupID, permissions) - if err != nil { - return err - } - if !changed { - klog.Warning("Allowing ingress was not needed; concurrent change? groupId=", instanceSecurityGroupID) - } - } else { - changed, err := c.removeSecurityGroupIngress(instanceSecurityGroupID, permissions) - if err != nil { - return err - } - if !changed { - klog.Warning("Revoking ingress was not needed; concurrent change? groupId=", instanceSecurityGroupID) - } - } - } - - return nil -} - -// EnsureLoadBalancerDeleted implements LoadBalancer.EnsureLoadBalancerDeleted. -func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error { - if isLBExternal(service.Annotations) { - return nil - } - loadBalancerName := c.GetLoadBalancerName(ctx, clusterName, service) - - if isNLB(service.Annotations) { - lb, err := c.describeLoadBalancerv2(loadBalancerName) - if err != nil { - return err - } - if lb == nil { - klog.Info("Load balancer already deleted: ", loadBalancerName) - return nil - } - - // Delete the LoadBalancer and target groups - // - // Deleting a target group while associated with a load balancer will - // fail. We delete the loadbalancer first. This does leave the - // possibility of zombie target groups if DeleteLoadBalancer() fails - // - // * Get target groups for NLB - // * Delete Load Balancer - // * Delete target groups - // * Clean up SecurityGroupRules - { - - targetGroups, err := c.elbv2.DescribeTargetGroups( - &elbv2.DescribeTargetGroupsInput{LoadBalancerArn: lb.LoadBalancerArn}, - ) - if err != nil { - return fmt.Errorf("error listing target groups before deleting load balancer: %q", err) - } - - _, err = c.elbv2.DeleteLoadBalancer( - &elbv2.DeleteLoadBalancerInput{LoadBalancerArn: lb.LoadBalancerArn}, - ) - if err != nil { - return fmt.Errorf("error deleting load balancer %q: %v", loadBalancerName, err) - } - - for _, group := range targetGroups.TargetGroups { - _, err := c.elbv2.DeleteTargetGroup( - &elbv2.DeleteTargetGroupInput{TargetGroupArn: group.TargetGroupArn}, - ) - if err != nil { - return fmt.Errorf("error deleting target groups after deleting load balancer: %q", err) - } - } - } - - return c.updateInstanceSecurityGroupsForNLB(loadBalancerName, nil, nil, nil, nil) - } - - lb, err := c.describeLoadBalancer(loadBalancerName) - if err != nil { - return err - } - - if lb == nil { - klog.Info("Load balancer already deleted: ", loadBalancerName) - return nil - } - - { - // De-authorize the load balancer security group from the instances security group - err = c.updateInstanceSecurityGroupsForLoadBalancer(lb, nil, service.Annotations) - if err != nil { - klog.Errorf("Error deregistering load balancer from instance security groups: %q", err) - return err - } - } - - { - // Delete the load balancer itself - request := &elb.DeleteLoadBalancerInput{} - request.LoadBalancerName = lb.LoadBalancerName - - _, err = c.elb.DeleteLoadBalancer(request) - if err != nil { - // TODO: Check if error was because load balancer was concurrently deleted - klog.Errorf("Error deleting load balancer: %q", err) - return err - } - } - - { - // Delete the security group(s) for the load balancer - // Note that this is annoying: the load balancer disappears from the API immediately, but it is still - // deleting in the background. We get a DependencyViolation until the load balancer has deleted itself - - var loadBalancerSGs = aws.StringValueSlice(lb.SecurityGroups) - - describeRequest := &ec2.DescribeSecurityGroupsInput{} - describeRequest.Filters = []*ec2.Filter{ - newEc2Filter("group-id", loadBalancerSGs...), - } - response, err := c.ec2.DescribeSecurityGroups(describeRequest) - if err != nil { - return fmt.Errorf("error querying security groups for ELB: %q", err) - } - - // Collect the security groups to delete - securityGroupIDs := map[string]struct{}{} - annotatedSgSet := map[string]bool{} - annotatedSgsList := getSGListFromAnnotation(service.Annotations[ServiceAnnotationLoadBalancerSecurityGroups]) - annotatedExtraSgsList := getSGListFromAnnotation(service.Annotations[ServiceAnnotationLoadBalancerExtraSecurityGroups]) - annotatedSgsList = append(annotatedSgsList, annotatedExtraSgsList...) - - for _, sg := range annotatedSgsList { - annotatedSgSet[sg] = true - } - - for _, sg := range response { - sgID := aws.StringValue(sg.GroupId) - - if sgID == c.cfg.Global.ElbSecurityGroup { - //We don't want to delete a security group that was defined in the Cloud Configuration. - continue - } - if sgID == "" { - klog.Warningf("Ignoring empty security group in %s", service.Name) - continue - } - - if !c.tagging.hasClusterTag(sg.Tags) { - klog.Warningf("Ignoring security group with no cluster tag in %s", service.Name) - continue - } - - // This is an extra protection of deletion of non provisioned Security Group which is annotated with `service.beta.kubernetes.io/aws-load-balancer-security-groups`. - if _, ok := annotatedSgSet[sgID]; ok { - klog.Warningf("Ignoring security group with annotation `service.beta.kubernetes.io/aws-load-balancer-security-groups` or service.beta.kubernetes.io/aws-load-balancer-extra-security-groups in %s", service.Name) - continue - } - - securityGroupIDs[sgID] = struct{}{} - } - - // Loop through and try to delete them - timeoutAt := time.Now().Add(time.Second * 600) - for { - for securityGroupID := range securityGroupIDs { - request := &ec2.DeleteSecurityGroupInput{} - request.GroupId = &securityGroupID - _, err := c.ec2.DeleteSecurityGroup(request) - if err == nil { - delete(securityGroupIDs, securityGroupID) - } else { - ignore := false - if awsError, ok := err.(awserr.Error); ok { - if awsError.Code() == "DependencyViolation" { - klog.V(2).Infof("Ignoring DependencyViolation while deleting load-balancer security group (%s), assuming because LB is in process of deleting", securityGroupID) - ignore = true - } - } - if !ignore { - return fmt.Errorf("error while deleting load balancer security group (%s): %q", securityGroupID, err) - } - } - } - - if len(securityGroupIDs) == 0 { - klog.V(2).Info("Deleted all security groups for load balancer: ", service.Name) - break - } - - if time.Now().After(timeoutAt) { - ids := []string{} - for id := range securityGroupIDs { - ids = append(ids, id) - } - - return fmt.Errorf("timed out deleting ELB: %s. Could not delete security groups %v", service.Name, strings.Join(ids, ",")) - } - - klog.V(2).Info("Waiting for load-balancer to delete so we can delete security groups: ", service.Name) - - time.Sleep(10 * time.Second) - } - } - - return nil -} - -// UpdateLoadBalancer implements LoadBalancer.UpdateLoadBalancer -func (c *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error { - if isLBExternal(service.Annotations) { - return cloudprovider.ImplementedElsewhere - } - instances, err := c.findInstancesForELB(nodes, service.Annotations) - if err != nil { - return err - } - loadBalancerName := c.GetLoadBalancerName(ctx, clusterName, service) - if isNLB(service.Annotations) { - lb, err := c.describeLoadBalancerv2(loadBalancerName) - if err != nil { - return err - } - if lb == nil { - return fmt.Errorf("Load balancer not found") - } - _, err = c.EnsureLoadBalancer(ctx, clusterName, service, nodes) - return err - } - lb, err := c.describeLoadBalancer(loadBalancerName) - if err != nil { - return err - } - - if lb == nil { - return fmt.Errorf("Load balancer not found") - } - - if sslPolicyName, ok := service.Annotations[ServiceAnnotationLoadBalancerSSLNegotiationPolicy]; ok { - err := c.ensureSSLNegotiationPolicy(lb, sslPolicyName) - if err != nil { - return err - } - for _, port := range c.getLoadBalancerTLSPorts(lb) { - err := c.setSSLNegotiationPolicy(loadBalancerName, sslPolicyName, port) - if err != nil { - return err - } - } - } - - err = c.ensureLoadBalancerInstances(aws.StringValue(lb.LoadBalancerName), lb.Instances, instances) - if err != nil { - return nil - } - - err = c.updateInstanceSecurityGroupsForLoadBalancer(lb, instances, service.Annotations) - if err != nil { - return err - } - - return nil -} - -// Returns the instance with the specified ID -func (c *Cloud) getInstanceByID(instanceID string) (*ec2.Instance, error) { - instances, err := c.getInstancesByIDs([]*string{&instanceID}) - if err != nil { - return nil, err - } - - if len(instances) == 0 { - return nil, cloudprovider.InstanceNotFound - } - if len(instances) > 1 { - return nil, fmt.Errorf("multiple instances found for instance: %s", instanceID) - } - - return instances[instanceID], nil -} - -func (c *Cloud) getInstancesByIDs(instanceIDs []*string) (map[string]*ec2.Instance, error) { - instancesByID := make(map[string]*ec2.Instance) - if len(instanceIDs) == 0 { - return instancesByID, nil - } - - request := &ec2.DescribeInstancesInput{ - InstanceIds: instanceIDs, - } - - instances, err := c.ec2.DescribeInstances(request) - if err != nil { - return nil, err - } - - for _, instance := range instances { - instanceID := aws.StringValue(instance.InstanceId) - if instanceID == "" { - continue - } - - instancesByID[instanceID] = instance - } - - return instancesByID, nil -} - -func (c *Cloud) getInstancesByNodeNames(nodeNames []string, states ...string) ([]*ec2.Instance, error) { - names := aws.StringSlice(nodeNames) - ec2Instances := []*ec2.Instance{} - - for i := 0; i < len(names); i += filterNodeLimit { - end := i + filterNodeLimit - if end > len(names) { - end = len(names) - } - - nameSlice := names[i:end] - - nodeNameFilter := &ec2.Filter{ - Name: aws.String("private-dns-name"), - Values: nameSlice, - } - - filters := []*ec2.Filter{nodeNameFilter} - if len(states) > 0 { - filters = append(filters, newEc2Filter("instance-state-name", states...)) - } - - instances, err := c.describeInstances(filters) - if err != nil { - klog.V(2).Infof("Failed to describe instances %v", nodeNames) - return nil, err - } - ec2Instances = append(ec2Instances, instances...) - } - - if len(ec2Instances) == 0 { - klog.V(3).Infof("Failed to find any instances %v", nodeNames) - return nil, nil - } - return ec2Instances, nil -} - -// TODO: Move to instanceCache -func (c *Cloud) describeInstances(filters []*ec2.Filter) ([]*ec2.Instance, error) { - request := &ec2.DescribeInstancesInput{ - Filters: filters, - } - - response, err := c.ec2.DescribeInstances(request) - if err != nil { - return nil, err - } - - var matches []*ec2.Instance - for _, instance := range response { - if c.tagging.hasClusterTag(instance.Tags) { - matches = append(matches, instance) - } - } - return matches, nil -} - -// mapNodeNameToPrivateDNSName maps a k8s NodeName to an AWS Instance PrivateDNSName -// This is a simple string cast -func mapNodeNameToPrivateDNSName(nodeName types.NodeName) string { - return string(nodeName) -} - -// mapInstanceToNodeName maps a EC2 instance to a k8s NodeName, by extracting the PrivateDNSName -func mapInstanceToNodeName(i *ec2.Instance) types.NodeName { - return types.NodeName(aws.StringValue(i.PrivateDnsName)) -} - -var aliveFilter = []string{ - ec2.InstanceStateNamePending, - ec2.InstanceStateNameRunning, - ec2.InstanceStateNameShuttingDown, - ec2.InstanceStateNameStopping, - ec2.InstanceStateNameStopped, -} - -// Returns the instance with the specified node name -// Returns nil if it does not exist -func (c *Cloud) findInstanceByNodeName(nodeName types.NodeName) (*ec2.Instance, error) { - privateDNSName := mapNodeNameToPrivateDNSName(nodeName) - filters := []*ec2.Filter{ - newEc2Filter("private-dns-name", privateDNSName), - // exclude instances in "terminated" state - newEc2Filter("instance-state-name", aliveFilter...), - } - - instances, err := c.describeInstances(filters) - if err != nil { - return nil, err - } - - if len(instances) == 0 { - return nil, nil - } - if len(instances) > 1 { - return nil, fmt.Errorf("multiple instances found for name: %s", nodeName) - } - return instances[0], nil -} - -// Returns the instance with the specified node name -// Like findInstanceByNodeName, but returns error if node not found -func (c *Cloud) getInstanceByNodeName(nodeName types.NodeName) (*ec2.Instance, error) { - var instance *ec2.Instance - - // we leverage node cache to try to retrieve node's provider id first, as - // get instance by provider id is way more efficient than by filters in - // aws context - awsID, err := c.nodeNameToProviderID(nodeName) - if err != nil { - klog.V(3).Infof("Unable to convert node name %q to aws instanceID, fall back to findInstanceByNodeName: %v", nodeName, err) - instance, err = c.findInstanceByNodeName(nodeName) - } else { - instance, err = c.getInstanceByID(string(awsID)) - } - if err == nil && instance == nil { - return nil, cloudprovider.InstanceNotFound - } - return instance, err -} - -func (c *Cloud) getFullInstance(nodeName types.NodeName) (*awsInstance, *ec2.Instance, error) { - if nodeName == "" { - instance, err := c.getInstanceByID(c.selfAWSInstance.awsID) - return c.selfAWSInstance, instance, err - } - instance, err := c.getInstanceByNodeName(nodeName) - if err != nil { - return nil, nil, err - } - awsInstance := newAWSInstance(c.ec2, instance) - return awsInstance, instance, err -} - -func (c *Cloud) nodeNameToProviderID(nodeName types.NodeName) (InstanceID, error) { - if len(nodeName) == 0 { - return "", fmt.Errorf("no nodeName provided") - } - - if c.nodeInformerHasSynced == nil || !c.nodeInformerHasSynced() { - return "", fmt.Errorf("node informer has not synced yet") - } - - node, err := c.nodeInformer.Lister().Get(string(nodeName)) - if err != nil { - return "", err - } - if len(node.Spec.ProviderID) == 0 { - return "", fmt.Errorf("node has no providerID") - } - - return KubernetesInstanceID(node.Spec.ProviderID).MapToAWSInstanceID() -} - -func checkMixedProtocol(ports []v1.ServicePort) error { - if len(ports) == 0 { - return nil - } - firstProtocol := ports[0].Protocol - for _, port := range ports[1:] { - if port.Protocol != firstProtocol { - return fmt.Errorf("mixed protocol is not supported for LoadBalancer") - } - } - return nil -} - -func checkProtocol(port v1.ServicePort, annotations map[string]string) error { - // nlb supports tcp, udp - if isNLB(annotations) && (port.Protocol == v1.ProtocolTCP || port.Protocol == v1.ProtocolUDP) { - return nil - } - // elb only supports tcp - if !isNLB(annotations) && port.Protocol == v1.ProtocolTCP { - return nil - } - return fmt.Errorf("Protocol %s not supported by LoadBalancer", port.Protocol) -} - -func setNodeDisk( - nodeDiskMap map[types.NodeName]map[KubernetesVolumeID]bool, - volumeID KubernetesVolumeID, - nodeName types.NodeName, - check bool) { - - volumeMap := nodeDiskMap[nodeName] - - if volumeMap == nil { - volumeMap = make(map[KubernetesVolumeID]bool) - nodeDiskMap[nodeName] = volumeMap - } - volumeMap[volumeID] = check -} - -func getInitialAttachDetachDelay(status string) time.Duration { - if status == volumeDetachedStatus { - return volumeDetachmentStatusInitialDelay - } - return volumeAttachmentStatusInitialDelay -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider.go deleted file mode 100644 index 1f96538eadf..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "sync" - "time" - - "github.com/aws/aws-sdk-go/aws/credentials" -) - -const ( - invalidateCredsCacheAfter = 1 * time.Second -) - -// assumeRoleProviderWithRateLimiting makes sure we call the underlying provider only -// once after `invalidateCredsCacheAfter` period -type assumeRoleProviderWithRateLimiting struct { - provider credentials.Provider - invalidateCredsCacheAfter time.Duration - sync.RWMutex - lastError error - lastValue credentials.Value - lastRetrieveTime time.Time -} - -func assumeRoleProvider(provider credentials.Provider) credentials.Provider { - return &assumeRoleProviderWithRateLimiting{provider: provider, - invalidateCredsCacheAfter: invalidateCredsCacheAfter} -} - -func (l *assumeRoleProviderWithRateLimiting) Retrieve() (credentials.Value, error) { - l.Lock() - defer l.Unlock() - if time.Since(l.lastRetrieveTime) < l.invalidateCredsCacheAfter { - if l.lastError != nil { - return credentials.Value{}, l.lastError - } - return l.lastValue, nil - } - l.lastValue, l.lastError = l.provider.Retrieve() - l.lastRetrieveTime = time.Now() - return l.lastValue, l.lastError -} - -func (l *assumeRoleProviderWithRateLimiting) IsExpired() bool { - return l.provider.IsExpired() -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider_test.go deleted file mode 100644 index af91682cee7..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_assumerole_provider_test.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - "reflect" - "sync" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws/credentials" -) - -func Test_assumeRoleProviderWithRateLimiting_Retrieve(t *testing.T) { - type fields struct { - provider credentials.Provider - invalidateCredsCacheAfter time.Duration - RWMutex sync.RWMutex - lastError error - lastValue credentials.Value - lastRetrieveTime time.Time - } - tests := []struct { - name string - fields fields - want credentials.Value - wantProviderCalled bool - sleepBeforeCallingProvider time.Duration - wantErr bool - wantErrString string - }{{ - name: "Call assume role provider and verify access ID returned", - fields: fields{provider: &fakeAssumeRoleProvider{accesskeyID: "fakeID"}}, - want: credentials.Value{AccessKeyID: "fakeID"}, - wantProviderCalled: true, - }, { - name: "Immediate call to assume role API, shouldn't call the underlying provider and return the last value", - fields: fields{ - provider: &fakeAssumeRoleProvider{accesskeyID: "fakeID"}, - invalidateCredsCacheAfter: 100 * time.Millisecond, - lastValue: credentials.Value{AccessKeyID: "fakeID1"}, - lastRetrieveTime: time.Now(), - }, - want: credentials.Value{AccessKeyID: "fakeID1"}, - wantProviderCalled: false, - sleepBeforeCallingProvider: 10 * time.Millisecond, - }, { - name: "Assume role provider returns an error when trying to assume a role", - fields: fields{ - provider: &fakeAssumeRoleProvider{err: fmt.Errorf("can't assume fake role")}, - invalidateCredsCacheAfter: 10 * time.Millisecond, - lastRetrieveTime: time.Now(), - }, - wantProviderCalled: true, - wantErr: true, - wantErrString: "can't assume fake role", - sleepBeforeCallingProvider: 15 * time.Millisecond, - }, { - name: "Immediate call to assume role API, shouldn't call the underlying provider and return the last error value", - fields: fields{ - provider: &fakeAssumeRoleProvider{}, - invalidateCredsCacheAfter: 100 * time.Millisecond, - lastRetrieveTime: time.Now(), - }, - want: credentials.Value{}, - wantProviderCalled: false, - wantErr: true, - wantErrString: "can't assume fake role", - }, { - name: "Delayed call to assume role API, should call the underlying provider", - fields: fields{ - provider: &fakeAssumeRoleProvider{accesskeyID: "fakeID2"}, - invalidateCredsCacheAfter: 20 * time.Millisecond, - lastRetrieveTime: time.Now(), - }, - want: credentials.Value{AccessKeyID: "fakeID2"}, - wantProviderCalled: true, - sleepBeforeCallingProvider: 25 * time.Millisecond, - }} - //nolint:govet // ignore copying of sync.RWMutex, it is empty - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - l := &assumeRoleProviderWithRateLimiting{ - provider: tt.fields.provider, - invalidateCredsCacheAfter: tt.fields.invalidateCredsCacheAfter, - lastError: tt.fields.lastError, - lastValue: tt.fields.lastValue, - lastRetrieveTime: tt.fields.lastRetrieveTime, - } - time.Sleep(tt.sleepBeforeCallingProvider) - got, err := l.Retrieve() - if (err != nil) != tt.wantErr && (tt.wantErr && reflect.DeepEqual(err, tt.wantErrString)) { - t.Errorf("assumeRoleProviderWithRateLimiting.Retrieve() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("assumeRoleProviderWithRateLimiting.Retrieve() got = %v, want %v", got, tt.want) - return - } - if tt.wantProviderCalled != tt.fields.provider.(*fakeAssumeRoleProvider).providerCalled { - t.Errorf("provider called %v, want %v", tt.fields.provider.(*fakeAssumeRoleProvider).providerCalled, tt.wantProviderCalled) - } - }) - } -} - -type fakeAssumeRoleProvider struct { - accesskeyID string - err error - providerCalled bool -} - -func (f *fakeAssumeRoleProvider) Retrieve() (credentials.Value, error) { - f.providerCalled = true - return credentials.Value{AccessKeyID: f.accesskeyID}, f.err -} - -func (f *fakeAssumeRoleProvider) IsExpired() bool { return true } diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_fakes.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_fakes.go deleted file mode 100644 index c970a6aaa02..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_fakes.go +++ /dev/null @@ -1,688 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - "sort" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/autoscaling" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/elb" - "github.com/aws/aws-sdk-go/service/elbv2" - "github.com/aws/aws-sdk-go/service/kms" - _ "github.com/stretchr/testify/mock" - "k8s.io/klog/v2" -) - -// FakeAWSServices is an fake AWS session used for testing -type FakeAWSServices struct { - region string - instances []*ec2.Instance - selfInstance *ec2.Instance - networkInterfacesMacs []string - networkInterfacesPrivateIPs [][]string - networkInterfacesVpcIDs []string - - ec2 FakeEC2 - elb ELB - elbv2 ELBV2 - asg *FakeASG - metadata *FakeMetadata - kms *FakeKMS -} - -// NewFakeAWSServices creates a new FakeAWSServices -func NewFakeAWSServices(clusterID string) *FakeAWSServices { - s := &FakeAWSServices{} - s.region = "us-east-1" - s.ec2 = &FakeEC2Impl{aws: s} - s.elb = &FakeELB{aws: s} - s.elbv2 = &FakeELBV2{aws: s} - s.asg = &FakeASG{aws: s} - s.metadata = &FakeMetadata{aws: s} - s.kms = &FakeKMS{aws: s} - - s.networkInterfacesMacs = []string{"aa:bb:cc:dd:ee:00", "aa:bb:cc:dd:ee:01"} - s.networkInterfacesVpcIDs = []string{"vpc-mac0", "vpc-mac1"} - - selfInstance := &ec2.Instance{} - selfInstance.InstanceId = aws.String("i-self") - selfInstance.Placement = &ec2.Placement{ - AvailabilityZone: aws.String("us-east-1a"), - } - selfInstance.PrivateDnsName = aws.String("ip-172-20-0-100.ec2.internal") - selfInstance.PrivateIpAddress = aws.String("192.168.0.1") - selfInstance.PublicIpAddress = aws.String("1.2.3.4") - s.selfInstance = selfInstance - s.instances = []*ec2.Instance{selfInstance} - - var tag ec2.Tag - tag.Key = aws.String(TagNameKubernetesClusterLegacy) - tag.Value = aws.String(clusterID) - selfInstance.Tags = []*ec2.Tag{&tag} - - return s -} - -// WithAz sets the ec2 placement availability zone -func (s *FakeAWSServices) WithAz(az string) *FakeAWSServices { - if s.selfInstance.Placement == nil { - s.selfInstance.Placement = &ec2.Placement{} - } - s.selfInstance.Placement.AvailabilityZone = aws.String(az) - return s -} - -// Compute returns a fake EC2 client -func (s *FakeAWSServices) Compute(region string) (EC2, error) { - return s.ec2, nil -} - -// LoadBalancing returns a fake ELB client -func (s *FakeAWSServices) LoadBalancing(region string) (ELB, error) { - return s.elb, nil -} - -// LoadBalancingV2 returns a fake ELBV2 client -func (s *FakeAWSServices) LoadBalancingV2(region string) (ELBV2, error) { - return s.elbv2, nil -} - -// Autoscaling returns a fake ASG client -func (s *FakeAWSServices) Autoscaling(region string) (ASG, error) { - return s.asg, nil -} - -// Metadata returns a fake EC2Metadata client -func (s *FakeAWSServices) Metadata() (EC2Metadata, error) { - return s.metadata, nil -} - -// KeyManagement returns a fake KMS client -func (s *FakeAWSServices) KeyManagement(region string) (KMS, error) { - return s.kms, nil -} - -// FakeEC2 is a fake EC2 client used for testing -type FakeEC2 interface { - EC2 - CreateSubnet(*ec2.Subnet) (*ec2.CreateSubnetOutput, error) - RemoveSubnets() - CreateRouteTable(*ec2.RouteTable) (*ec2.CreateRouteTableOutput, error) - RemoveRouteTables() -} - -// FakeEC2Impl is an implementation of the FakeEC2 interface used for testing -type FakeEC2Impl struct { - aws *FakeAWSServices - Subnets []*ec2.Subnet - DescribeSubnetsInput *ec2.DescribeSubnetsInput - RouteTables []*ec2.RouteTable - DescribeRouteTablesInput *ec2.DescribeRouteTablesInput -} - -// DescribeInstances returns fake instance descriptions -func (ec2i *FakeEC2Impl) DescribeInstances(request *ec2.DescribeInstancesInput) ([]*ec2.Instance, error) { - matches := []*ec2.Instance{} - for _, instance := range ec2i.aws.instances { - if request.InstanceIds != nil { - if instance.InstanceId == nil { - klog.Warning("Instance with no instance id: ", instance) - continue - } - - found := false - for _, instanceID := range request.InstanceIds { - if *instanceID == *instance.InstanceId { - found = true - break - } - } - if !found { - continue - } - } - if request.Filters != nil { - allMatch := true - for _, filter := range request.Filters { - if !instanceMatchesFilter(instance, filter) { - allMatch = false - break - } - } - if !allMatch { - continue - } - } - matches = append(matches, instance) - } - - return matches, nil -} - -// AttachVolume is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) AttachVolume(request *ec2.AttachVolumeInput) (resp *ec2.VolumeAttachment, err error) { - panic("Not implemented") -} - -// DetachVolume is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) DetachVolume(request *ec2.DetachVolumeInput) (resp *ec2.VolumeAttachment, err error) { - panic("Not implemented") -} - -// DescribeVolumes is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) DescribeVolumes(request *ec2.DescribeVolumesInput) ([]*ec2.Volume, error) { - panic("Not implemented") -} - -// CreateVolume is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) CreateVolume(request *ec2.CreateVolumeInput) (resp *ec2.Volume, err error) { - panic("Not implemented") -} - -// DeleteVolume is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) DeleteVolume(request *ec2.DeleteVolumeInput) (resp *ec2.DeleteVolumeOutput, err error) { - panic("Not implemented") -} - -// DescribeSecurityGroups is not implemented but is required for interface -// conformance -func (ec2i *FakeEC2Impl) DescribeSecurityGroups(request *ec2.DescribeSecurityGroupsInput) ([]*ec2.SecurityGroup, error) { - panic("Not implemented") -} - -// CreateSecurityGroup is not implemented but is required for interface -// conformance -func (ec2i *FakeEC2Impl) CreateSecurityGroup(*ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error) { - panic("Not implemented") -} - -// DeleteSecurityGroup is not implemented but is required for interface -// conformance -func (ec2i *FakeEC2Impl) DeleteSecurityGroup(*ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error) { - panic("Not implemented") -} - -// AuthorizeSecurityGroupIngress is not implemented but is required for -// interface conformance -func (ec2i *FakeEC2Impl) AuthorizeSecurityGroupIngress(*ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error) { - panic("Not implemented") -} - -// RevokeSecurityGroupIngress is not implemented but is required for interface -// conformance -func (ec2i *FakeEC2Impl) RevokeSecurityGroupIngress(*ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error) { - panic("Not implemented") -} - -// DescribeVolumeModifications is not implemented but is required for interface -// conformance -func (ec2i *FakeEC2Impl) DescribeVolumeModifications(*ec2.DescribeVolumesModificationsInput) ([]*ec2.VolumeModification, error) { - panic("Not implemented") -} - -// ModifyVolume is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) ModifyVolume(*ec2.ModifyVolumeInput) (*ec2.ModifyVolumeOutput, error) { - panic("Not implemented") -} - -// CreateSubnet creates fake subnets -func (ec2i *FakeEC2Impl) CreateSubnet(request *ec2.Subnet) (*ec2.CreateSubnetOutput, error) { - ec2i.Subnets = append(ec2i.Subnets, request) - response := &ec2.CreateSubnetOutput{ - Subnet: request, - } - return response, nil -} - -// DescribeSubnets returns fake subnet descriptions -func (ec2i *FakeEC2Impl) DescribeSubnets(request *ec2.DescribeSubnetsInput) ([]*ec2.Subnet, error) { - ec2i.DescribeSubnetsInput = request - return ec2i.Subnets, nil -} - -// RemoveSubnets clears subnets on client -func (ec2i *FakeEC2Impl) RemoveSubnets() { - ec2i.Subnets = ec2i.Subnets[:0] -} - -// CreateTags is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) { - panic("Not implemented") -} - -// DescribeRouteTables returns fake route table descriptions -func (ec2i *FakeEC2Impl) DescribeRouteTables(request *ec2.DescribeRouteTablesInput) ([]*ec2.RouteTable, error) { - ec2i.DescribeRouteTablesInput = request - return ec2i.RouteTables, nil -} - -// CreateRouteTable creates fake route tables -func (ec2i *FakeEC2Impl) CreateRouteTable(request *ec2.RouteTable) (*ec2.CreateRouteTableOutput, error) { - ec2i.RouteTables = append(ec2i.RouteTables, request) - response := &ec2.CreateRouteTableOutput{ - RouteTable: request, - } - return response, nil -} - -// RemoveRouteTables clears route tables on client -func (ec2i *FakeEC2Impl) RemoveRouteTables() { - ec2i.RouteTables = ec2i.RouteTables[:0] -} - -// CreateRoute is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) CreateRoute(request *ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error) { - panic("Not implemented") -} - -// DeleteRoute is not implemented but is required for interface conformance -func (ec2i *FakeEC2Impl) DeleteRoute(request *ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error) { - panic("Not implemented") -} - -// ModifyInstanceAttribute is not implemented but is required for interface -// conformance -func (ec2i *FakeEC2Impl) ModifyInstanceAttribute(request *ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error) { - panic("Not implemented") -} - -// DescribeVpcs returns fake VPC descriptions -func (ec2i *FakeEC2Impl) DescribeVpcs(request *ec2.DescribeVpcsInput) (*ec2.DescribeVpcsOutput, error) { - return &ec2.DescribeVpcsOutput{Vpcs: []*ec2.Vpc{{CidrBlock: aws.String("172.20.0.0/16")}}}, nil -} - -// FakeMetadata is a fake EC2 metadata service client used for testing -type FakeMetadata struct { - aws *FakeAWSServices -} - -// GetMetadata returns fake EC2 metadata for testing -func (m *FakeMetadata) GetMetadata(key string) (string, error) { - networkInterfacesPrefix := "network/interfaces/macs/" - i := m.aws.selfInstance - if key == "placement/availability-zone" { - az := "" - if i.Placement != nil { - az = aws.StringValue(i.Placement.AvailabilityZone) - } - return az, nil - } else if key == "instance-id" { - return aws.StringValue(i.InstanceId), nil - } else if key == "local-hostname" { - return aws.StringValue(i.PrivateDnsName), nil - } else if key == "public-hostname" { - return aws.StringValue(i.PublicDnsName), nil - } else if key == "local-ipv4" { - return aws.StringValue(i.PrivateIpAddress), nil - } else if key == "public-ipv4" { - return aws.StringValue(i.PublicIpAddress), nil - } else if strings.HasPrefix(key, networkInterfacesPrefix) { - if key == networkInterfacesPrefix { - // Return the MACs sorted lexically rather than in device-number - // order; this matches AWS's observed behavior and lets us test - // that we fix up the ordering correctly in NodeAddresses(). - macs := make([]string, len(m.aws.networkInterfacesMacs)) - copy(macs, m.aws.networkInterfacesMacs) - sort.Strings(macs) - return strings.Join(macs, "/\n") + "/\n", nil - } - - keySplit := strings.Split(key, "/") - macParam := keySplit[3] - if len(keySplit) == 5 && keySplit[4] == "vpc-id" { - for i, macElem := range m.aws.networkInterfacesMacs { - if macParam == macElem { - return m.aws.networkInterfacesVpcIDs[i], nil - } - } - } - if len(keySplit) == 5 && keySplit[4] == "device-number" { - for i, macElem := range m.aws.networkInterfacesMacs { - if macParam == macElem { - n := i - if n > 0 { - // Introduce an artificial gap, just to test eg: [eth0, eth2] - n++ - } - return fmt.Sprintf("%d\n", n), nil - } - } - } - if len(keySplit) == 5 && keySplit[4] == "local-ipv4s" { - for i, macElem := range m.aws.networkInterfacesMacs { - if macParam == macElem { - return strings.Join(m.aws.networkInterfacesPrivateIPs[i], "/\n"), nil - } - } - } - - return "", nil - } - - return "", nil -} - -// FakeELB is a fake ELB client used for testing -type FakeELB struct { - aws *FakeAWSServices -} - -// CreateLoadBalancer is not implemented but is required for interface -// conformance -func (elb *FakeELB) CreateLoadBalancer(*elb.CreateLoadBalancerInput) (*elb.CreateLoadBalancerOutput, error) { - panic("Not implemented") -} - -// DeleteLoadBalancer is not implemented but is required for interface -// conformance -func (elb *FakeELB) DeleteLoadBalancer(input *elb.DeleteLoadBalancerInput) (*elb.DeleteLoadBalancerOutput, error) { - panic("Not implemented") -} - -// DescribeLoadBalancers is not implemented but is required for interface -// conformance -func (elb *FakeELB) DescribeLoadBalancers(input *elb.DescribeLoadBalancersInput) (*elb.DescribeLoadBalancersOutput, error) { - panic("Not implemented") -} - -// AddTags is not implemented but is required for interface conformance -func (elb *FakeELB) AddTags(input *elb.AddTagsInput) (*elb.AddTagsOutput, error) { - panic("Not implemented") -} - -// RegisterInstancesWithLoadBalancer is not implemented but is required for -// interface conformance -func (elb *FakeELB) RegisterInstancesWithLoadBalancer(*elb.RegisterInstancesWithLoadBalancerInput) (*elb.RegisterInstancesWithLoadBalancerOutput, error) { - panic("Not implemented") -} - -// DeregisterInstancesFromLoadBalancer is not implemented but is required for -// interface conformance -func (elb *FakeELB) DeregisterInstancesFromLoadBalancer(*elb.DeregisterInstancesFromLoadBalancerInput) (*elb.DeregisterInstancesFromLoadBalancerOutput, error) { - panic("Not implemented") -} - -// DetachLoadBalancerFromSubnets is not implemented but is required for -// interface conformance -func (elb *FakeELB) DetachLoadBalancerFromSubnets(*elb.DetachLoadBalancerFromSubnetsInput) (*elb.DetachLoadBalancerFromSubnetsOutput, error) { - panic("Not implemented") -} - -// AttachLoadBalancerToSubnets is not implemented but is required for interface -// conformance -func (elb *FakeELB) AttachLoadBalancerToSubnets(*elb.AttachLoadBalancerToSubnetsInput) (*elb.AttachLoadBalancerToSubnetsOutput, error) { - panic("Not implemented") -} - -// CreateLoadBalancerListeners is not implemented but is required for interface -// conformance -func (elb *FakeELB) CreateLoadBalancerListeners(*elb.CreateLoadBalancerListenersInput) (*elb.CreateLoadBalancerListenersOutput, error) { - panic("Not implemented") -} - -// DeleteLoadBalancerListeners is not implemented but is required for interface -// conformance -func (elb *FakeELB) DeleteLoadBalancerListeners(*elb.DeleteLoadBalancerListenersInput) (*elb.DeleteLoadBalancerListenersOutput, error) { - panic("Not implemented") -} - -// ApplySecurityGroupsToLoadBalancer is not implemented but is required for -// interface conformance -func (elb *FakeELB) ApplySecurityGroupsToLoadBalancer(*elb.ApplySecurityGroupsToLoadBalancerInput) (*elb.ApplySecurityGroupsToLoadBalancerOutput, error) { - panic("Not implemented") -} - -// ConfigureHealthCheck is not implemented but is required for interface -// conformance -func (elb *FakeELB) ConfigureHealthCheck(*elb.ConfigureHealthCheckInput) (*elb.ConfigureHealthCheckOutput, error) { - panic("Not implemented") -} - -// CreateLoadBalancerPolicy is not implemented but is required for interface -// conformance -func (elb *FakeELB) CreateLoadBalancerPolicy(*elb.CreateLoadBalancerPolicyInput) (*elb.CreateLoadBalancerPolicyOutput, error) { - panic("Not implemented") -} - -// SetLoadBalancerPoliciesForBackendServer is not implemented but is required -// for interface conformance -func (elb *FakeELB) SetLoadBalancerPoliciesForBackendServer(*elb.SetLoadBalancerPoliciesForBackendServerInput) (*elb.SetLoadBalancerPoliciesForBackendServerOutput, error) { - panic("Not implemented") -} - -// SetLoadBalancerPoliciesOfListener is not implemented but is required for -// interface conformance -func (elb *FakeELB) SetLoadBalancerPoliciesOfListener(input *elb.SetLoadBalancerPoliciesOfListenerInput) (*elb.SetLoadBalancerPoliciesOfListenerOutput, error) { - panic("Not implemented") -} - -// DescribeLoadBalancerPolicies is not implemented but is required for -// interface conformance -func (elb *FakeELB) DescribeLoadBalancerPolicies(input *elb.DescribeLoadBalancerPoliciesInput) (*elb.DescribeLoadBalancerPoliciesOutput, error) { - panic("Not implemented") -} - -// DescribeLoadBalancerAttributes is not implemented but is required for -// interface conformance -func (elb *FakeELB) DescribeLoadBalancerAttributes(*elb.DescribeLoadBalancerAttributesInput) (*elb.DescribeLoadBalancerAttributesOutput, error) { - panic("Not implemented") -} - -// ModifyLoadBalancerAttributes is not implemented but is required for -// interface conformance -func (elb *FakeELB) ModifyLoadBalancerAttributes(*elb.ModifyLoadBalancerAttributesInput) (*elb.ModifyLoadBalancerAttributesOutput, error) { - panic("Not implemented") -} - -// FakeELBV2 is a fake ELBV2 client used for testing -type FakeELBV2 struct { - aws *FakeAWSServices -} - -// AddTags is not implemented but is required for interface conformance -func (elb *FakeELBV2) AddTags(input *elbv2.AddTagsInput) (*elbv2.AddTagsOutput, error) { - panic("Not implemented") -} - -// CreateLoadBalancer is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) CreateLoadBalancer(*elbv2.CreateLoadBalancerInput) (*elbv2.CreateLoadBalancerOutput, error) { - panic("Not implemented") -} - -// DescribeLoadBalancers is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) DescribeLoadBalancers(*elbv2.DescribeLoadBalancersInput) (*elbv2.DescribeLoadBalancersOutput, error) { - panic("Not implemented") -} - -// DeleteLoadBalancer is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) DeleteLoadBalancer(*elbv2.DeleteLoadBalancerInput) (*elbv2.DeleteLoadBalancerOutput, error) { - panic("Not implemented") -} - -// ModifyLoadBalancerAttributes is not implemented but is required for -// interface conformance -func (elb *FakeELBV2) ModifyLoadBalancerAttributes(*elbv2.ModifyLoadBalancerAttributesInput) (*elbv2.ModifyLoadBalancerAttributesOutput, error) { - panic("Not implemented") -} - -// DescribeLoadBalancerAttributes is not implemented but is required for -// interface conformance -func (elb *FakeELBV2) DescribeLoadBalancerAttributes(*elbv2.DescribeLoadBalancerAttributesInput) (*elbv2.DescribeLoadBalancerAttributesOutput, error) { - panic("Not implemented") -} - -// CreateTargetGroup is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) CreateTargetGroup(*elbv2.CreateTargetGroupInput) (*elbv2.CreateTargetGroupOutput, error) { - panic("Not implemented") -} - -// DescribeTargetGroups is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) DescribeTargetGroups(*elbv2.DescribeTargetGroupsInput) (*elbv2.DescribeTargetGroupsOutput, error) { - panic("Not implemented") -} - -// ModifyTargetGroup is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) ModifyTargetGroup(*elbv2.ModifyTargetGroupInput) (*elbv2.ModifyTargetGroupOutput, error) { - panic("Not implemented") -} - -// DeleteTargetGroup is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) DeleteTargetGroup(*elbv2.DeleteTargetGroupInput) (*elbv2.DeleteTargetGroupOutput, error) { - panic("Not implemented") -} - -// DescribeTargetHealth is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) DescribeTargetHealth(input *elbv2.DescribeTargetHealthInput) (*elbv2.DescribeTargetHealthOutput, error) { - panic("Not implemented") -} - -// DescribeTargetGroupAttributes is not implemented but is required for -// interface conformance -func (elb *FakeELBV2) DescribeTargetGroupAttributes(*elbv2.DescribeTargetGroupAttributesInput) (*elbv2.DescribeTargetGroupAttributesOutput, error) { - panic("Not implemented") -} - -// ModifyTargetGroupAttributes is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) ModifyTargetGroupAttributes(*elbv2.ModifyTargetGroupAttributesInput) (*elbv2.ModifyTargetGroupAttributesOutput, error) { - panic("Not implemented") -} - -// RegisterTargets is not implemented but is required for interface conformance -func (elb *FakeELBV2) RegisterTargets(*elbv2.RegisterTargetsInput) (*elbv2.RegisterTargetsOutput, error) { - panic("Not implemented") -} - -// DeregisterTargets is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) DeregisterTargets(*elbv2.DeregisterTargetsInput) (*elbv2.DeregisterTargetsOutput, error) { - panic("Not implemented") -} - -// CreateListener is not implemented but is required for interface conformance -func (elb *FakeELBV2) CreateListener(*elbv2.CreateListenerInput) (*elbv2.CreateListenerOutput, error) { - panic("Not implemented") -} - -// DescribeListeners is not implemented but is required for interface -// conformance -func (elb *FakeELBV2) DescribeListeners(*elbv2.DescribeListenersInput) (*elbv2.DescribeListenersOutput, error) { - panic("Not implemented") -} - -// DeleteListener is not implemented but is required for interface conformance -func (elb *FakeELBV2) DeleteListener(*elbv2.DeleteListenerInput) (*elbv2.DeleteListenerOutput, error) { - panic("Not implemented") -} - -// ModifyListener is not implemented but is required for interface conformance -func (elb *FakeELBV2) ModifyListener(*elbv2.ModifyListenerInput) (*elbv2.ModifyListenerOutput, error) { - panic("Not implemented") -} - -// WaitUntilLoadBalancersDeleted is not implemented but is required for -// interface conformance -func (elb *FakeELBV2) WaitUntilLoadBalancersDeleted(*elbv2.DescribeLoadBalancersInput) error { - panic("Not implemented") -} - -// FakeASG is a fake Autoscaling client used for testing -type FakeASG struct { - aws *FakeAWSServices -} - -// UpdateAutoScalingGroup is not implemented but is required for interface -// conformance -func (a *FakeASG) UpdateAutoScalingGroup(*autoscaling.UpdateAutoScalingGroupInput) (*autoscaling.UpdateAutoScalingGroupOutput, error) { - panic("Not implemented") -} - -// DescribeAutoScalingGroups is not implemented but is required for interface -// conformance -func (a *FakeASG) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error) { - panic("Not implemented") -} - -// FakeKMS is a fake KMS client used for testing -type FakeKMS struct { - aws *FakeAWSServices -} - -// DescribeKey is not implemented but is required for interface conformance -func (kms *FakeKMS) DescribeKey(*kms.DescribeKeyInput) (*kms.DescribeKeyOutput, error) { - panic("Not implemented") -} - -func instanceMatchesFilter(instance *ec2.Instance, filter *ec2.Filter) bool { - name := *filter.Name - if name == "private-dns-name" { - if instance.PrivateDnsName == nil { - return false - } - return contains(filter.Values, *instance.PrivateDnsName) - } - - if name == "instance-state-name" { - return contains(filter.Values, *instance.State.Name) - } - - if name == "tag-key" { - for _, instanceTag := range instance.Tags { - if contains(filter.Values, aws.StringValue(instanceTag.Key)) { - return true - } - } - return false - } - - if strings.HasPrefix(name, "tag:") { - tagName := name[4:] - for _, instanceTag := range instance.Tags { - if aws.StringValue(instanceTag.Key) == tagName && contains(filter.Values, aws.StringValue(instanceTag.Value)) { - return true - } - } - return false - } - - panic("Unknown filter name: " + name) -} - -func contains(haystack []*string, needle string) bool { - for _, s := range haystack { - // (deliberately panic if s == nil) - if needle == *s { - return true - } - } - return false -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_instancegroups.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_instancegroups.go deleted file mode 100644 index 5360e8a96bd..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_instancegroups.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/autoscaling" - "k8s.io/klog/v2" -) - -// AWSCloud implements InstanceGroups -var _ InstanceGroups = &Cloud{} - -// ResizeInstanceGroup sets the size of the specificed instancegroup Exported -// so it can be used by the e2e tests, which don't want to instantiate a full -// cloudprovider. -func ResizeInstanceGroup(asg ASG, instanceGroupName string, size int) error { - request := &autoscaling.UpdateAutoScalingGroupInput{ - AutoScalingGroupName: aws.String(instanceGroupName), - DesiredCapacity: aws.Int64(int64(size)), - } - if _, err := asg.UpdateAutoScalingGroup(request); err != nil { - return fmt.Errorf("error resizing AWS autoscaling group: %q", err) - } - return nil -} - -// ResizeInstanceGroup implements InstanceGroups.ResizeInstanceGroup -// Set the size to the fixed size -func (c *Cloud) ResizeInstanceGroup(instanceGroupName string, size int) error { - return ResizeInstanceGroup(c.asg, instanceGroupName, size) -} - -// DescribeInstanceGroup gets info about the specified instancegroup -// Exported so it can be used by the e2e tests, -// which don't want to instantiate a full cloudprovider. -func DescribeInstanceGroup(asg ASG, instanceGroupName string) (InstanceGroupInfo, error) { - request := &autoscaling.DescribeAutoScalingGroupsInput{ - AutoScalingGroupNames: []*string{aws.String(instanceGroupName)}, - } - response, err := asg.DescribeAutoScalingGroups(request) - if err != nil { - return nil, fmt.Errorf("error listing AWS autoscaling group (%s): %q", instanceGroupName, err) - } - - if len(response.AutoScalingGroups) == 0 { - return nil, nil - } - if len(response.AutoScalingGroups) > 1 { - klog.Warning("AWS returned multiple autoscaling groups with name ", instanceGroupName) - } - group := response.AutoScalingGroups[0] - return &awsInstanceGroup{group: group}, nil -} - -// DescribeInstanceGroup implements InstanceGroups.DescribeInstanceGroup -// Queries the cloud provider for information about the specified instance group -func (c *Cloud) DescribeInstanceGroup(instanceGroupName string) (InstanceGroupInfo, error) { - return DescribeInstanceGroup(c.asg, instanceGroupName) -} - -// awsInstanceGroup implements InstanceGroupInfo -var _ InstanceGroupInfo = &awsInstanceGroup{} - -type awsInstanceGroup struct { - group *autoscaling.Group -} - -// Implement InstanceGroupInfo.CurrentSize -// The number of instances currently running under control of this group -func (g *awsInstanceGroup) CurrentSize() (int, error) { - return len(g.group.Instances), nil -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go deleted file mode 100644 index 3f05aed7f40..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go +++ /dev/null @@ -1,1662 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "crypto/sha1" - "encoding/hex" - "fmt" - "reflect" - "regexp" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/elb" - "github.com/aws/aws-sdk-go/service/elbv2" - v1 "k8s.io/api/core/v1" - "k8s.io/klog/v2" - - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/sets" -) - -const ( - // ProxyProtocolPolicyName is the tag named used for the proxy protocol - // policy - ProxyProtocolPolicyName = "k8s-proxyprotocol-enabled" - - // SSLNegotiationPolicyNameFormat is a format string used for the SSL - // negotiation policy tag name - SSLNegotiationPolicyNameFormat = "k8s-SSLNegotiationPolicy-%s" - - lbAttrLoadBalancingCrossZoneEnabled = "load_balancing.cross_zone.enabled" - lbAttrAccessLogsS3Enabled = "access_logs.s3.enabled" - lbAttrAccessLogsS3Bucket = "access_logs.s3.bucket" - lbAttrAccessLogsS3Prefix = "access_logs.s3.prefix" - - // defaultEC2InstanceCacheMaxAge is the max age for the EC2 instance cache - defaultEC2InstanceCacheMaxAge = 10 * time.Minute -) - -var ( - // Defaults for ELB Healthcheck - defaultElbHCHealthyThreshold = int64(2) - defaultElbHCUnhealthyThreshold = int64(6) - defaultElbHCTimeout = int64(5) - defaultElbHCInterval = int64(10) - defaultNlbHealthCheckInterval = int64(30) - defaultNlbHealthCheckTimeout = int64(10) - defaultNlbHealthCheckThreshold = int64(3) - defaultHealthCheckPort = "traffic-port" - defaultHealthCheckPath = "/" - - // Defaults for ELB Target operations - defaultRegisterTargetsChunkSize = 100 - defaultDeregisterTargetsChunkSize = 100 -) - -func isNLB(annotations map[string]string) bool { - if annotations[ServiceAnnotationLoadBalancerType] == "nlb" { - return true - } - return false -} - -func isLBExternal(annotations map[string]string) bool { - if val := annotations[ServiceAnnotationLoadBalancerType]; val == "nlb-ip" || val == "external" { - return true - } - return false -} - -type healthCheckConfig struct { - Port string - Path string - Protocol string - Interval int64 - Timeout int64 - HealthyThreshold int64 - UnhealthyThreshold int64 -} - -type nlbPortMapping struct { - FrontendPort int64 - FrontendProtocol string - - TrafficPort int64 - TrafficProtocol string - - SSLCertificateARN string - SSLPolicy string - HealthCheckConfig healthCheckConfig -} - -// getKeyValuePropertiesFromAnnotation converts the comma separated list of key-value -// pairs from the specified annotation and returns it as a map. -func getKeyValuePropertiesFromAnnotation(annotations map[string]string, annotation string) map[string]string { - additionalTags := make(map[string]string) - if additionalTagsList, ok := annotations[annotation]; ok { - additionalTagsList = strings.TrimSpace(additionalTagsList) - - // Break up list of "Key1=Val,Key2=Val2" - tagList := strings.Split(additionalTagsList, ",") - - // Break up "Key=Val" - for _, tagSet := range tagList { - tag := strings.Split(strings.TrimSpace(tagSet), "=") - - // Accept "Key=val" or "Key=" or just "Key" - if len(tag) >= 2 && len(tag[0]) != 0 { - // There is a key and a value, so save it - additionalTags[tag[0]] = tag[1] - } else if len(tag) == 1 && len(tag[0]) != 0 { - // Just "Key" - additionalTags[tag[0]] = "" - } - } - } - - return additionalTags -} - -// ensureLoadBalancerv2 ensures a v2 load balancer is created -func (c *Cloud) ensureLoadBalancerv2(namespacedName types.NamespacedName, loadBalancerName string, mappings []nlbPortMapping, instanceIDs, subnetIDs []string, internalELB bool, annotations map[string]string) (*elbv2.LoadBalancer, error) { - loadBalancer, err := c.describeLoadBalancerv2(loadBalancerName) - if err != nil { - return nil, err - } - - dirty := false - - // Get additional tags set by the user - tags := getKeyValuePropertiesFromAnnotation(annotations, ServiceAnnotationLoadBalancerAdditionalTags) - // Add default tags - tags[TagNameKubernetesService] = namespacedName.String() - tags = c.tagging.buildTags(ResourceLifecycleOwned, tags) - - if loadBalancer == nil { - // Create the LB - createRequest := &elbv2.CreateLoadBalancerInput{ - Type: aws.String(elbv2.LoadBalancerTypeEnumNetwork), - Name: aws.String(loadBalancerName), - } - if internalELB { - createRequest.Scheme = aws.String("internal") - } - - var allocationIDs []string - if eipList, present := annotations[ServiceAnnotationLoadBalancerEIPAllocations]; present { - allocationIDs = strings.Split(eipList, ",") - if len(allocationIDs) != len(subnetIDs) { - return nil, fmt.Errorf("error creating load balancer: Must have same number of EIP AllocationIDs (%d) and SubnetIDs (%d)", len(allocationIDs), len(subnetIDs)) - } - } - - // We are supposed to specify one subnet per AZ. - // TODO: What happens if we have more than one subnet per AZ? - createRequest.SubnetMappings = createSubnetMappings(subnetIDs, allocationIDs) - - for k, v := range tags { - createRequest.Tags = append(createRequest.Tags, &elbv2.Tag{ - Key: aws.String(k), Value: aws.String(v), - }) - } - - klog.Infof("Creating load balancer for %v with name: %s", namespacedName, loadBalancerName) - createResponse, err := c.elbv2.CreateLoadBalancer(createRequest) - if err != nil { - return nil, fmt.Errorf("error creating load balancer: %q", err) - } - - loadBalancer = createResponse.LoadBalancers[0] - for i := range mappings { - // It is easier to keep track of updates by having possibly - // duplicate target groups where the backend port is the same - _, err := c.createListenerV2(createResponse.LoadBalancers[0].LoadBalancerArn, mappings[i], namespacedName, instanceIDs, *createResponse.LoadBalancers[0].VpcId, tags) - if err != nil { - return nil, fmt.Errorf("error creating listener: %q", err) - } - } - if err := c.reconcileLBAttributes(aws.StringValue(loadBalancer.LoadBalancerArn), annotations); err != nil { - return nil, err - } - } else { - // TODO: Sync internal vs non-internal - - // sync mappings - { - listenerDescriptions, err := c.elbv2.DescribeListeners( - &elbv2.DescribeListenersInput{ - LoadBalancerArn: loadBalancer.LoadBalancerArn, - }, - ) - if err != nil { - return nil, fmt.Errorf("error describing listeners: %q", err) - } - - // actual maps FrontendPort to an elbv2.Listener - actual := map[int64]map[string]*elbv2.Listener{} - for _, listener := range listenerDescriptions.Listeners { - if actual[*listener.Port] == nil { - actual[*listener.Port] = map[string]*elbv2.Listener{} - } - actual[*listener.Port][*listener.Protocol] = listener - } - - actualTargetGroups, err := c.elbv2.DescribeTargetGroups( - &elbv2.DescribeTargetGroupsInput{ - LoadBalancerArn: loadBalancer.LoadBalancerArn, - }, - ) - if err != nil { - return nil, fmt.Errorf("error listing target groups: %q", err) - } - - nodePortTargetGroup := map[int64]*elbv2.TargetGroup{} - for _, targetGroup := range actualTargetGroups.TargetGroups { - nodePortTargetGroup[*targetGroup.Port] = targetGroup - } - - // Handle additions/modifications - for _, mapping := range mappings { - frontendPort := mapping.FrontendPort - frontendProtocol := mapping.FrontendProtocol - nodePort := mapping.TrafficPort - // modifications - if listener, ok := actual[frontendPort][frontendProtocol]; ok { - listenerNeedsModification := false - - if aws.StringValue(listener.Protocol) != mapping.FrontendProtocol { - listenerNeedsModification = true - } - switch mapping.FrontendProtocol { - case elbv2.ProtocolEnumTls: - { - if aws.StringValue(listener.SslPolicy) != mapping.SSLPolicy { - listenerNeedsModification = true - } - if len(listener.Certificates) == 0 || aws.StringValue(listener.Certificates[0].CertificateArn) != mapping.SSLCertificateARN { - listenerNeedsModification = true - } - } - case elbv2.ProtocolEnumTcp: - { - if aws.StringValue(listener.SslPolicy) != "" { - listenerNeedsModification = true - } - if len(listener.Certificates) != 0 { - listenerNeedsModification = true - } - } - } - - // recreate targetGroup if trafficPort, protocol or HealthCheckProtocol changed - healthCheckModified := false - targetGroupRecreated := false - targetGroup, ok := nodePortTargetGroup[nodePort] - - if targetGroup != nil && (!strings.EqualFold(mapping.HealthCheckConfig.Protocol, aws.StringValue(targetGroup.HealthCheckProtocol)) || - mapping.HealthCheckConfig.Interval != aws.Int64Value(targetGroup.HealthCheckIntervalSeconds)) { - healthCheckModified = true - } - - if !ok || aws.StringValue(targetGroup.Protocol) != mapping.TrafficProtocol || healthCheckModified { - // create new target group - targetGroup, err = c.ensureTargetGroup( - nil, - namespacedName, - mapping, - instanceIDs, - *loadBalancer.VpcId, - tags, - ) - if err != nil { - return nil, err - } - targetGroupRecreated = true - listenerNeedsModification = true - } - - if listenerNeedsModification { - modifyListenerInput := &elbv2.ModifyListenerInput{ - ListenerArn: listener.ListenerArn, - Port: aws.Int64(frontendPort), - Protocol: aws.String(mapping.FrontendProtocol), - DefaultActions: []*elbv2.Action{{ - TargetGroupArn: targetGroup.TargetGroupArn, - Type: aws.String("forward"), - }}, - } - if mapping.FrontendProtocol == elbv2.ProtocolEnumTls { - if mapping.SSLPolicy != "" { - modifyListenerInput.SslPolicy = aws.String(mapping.SSLPolicy) - } - modifyListenerInput.Certificates = []*elbv2.Certificate{ - { - CertificateArn: aws.String(mapping.SSLCertificateARN), - }, - } - } - if _, err := c.elbv2.ModifyListener(modifyListenerInput); err != nil { - return nil, fmt.Errorf("error updating load balancer listener: %q", err) - } - } - - // Delete old targetGroup if needed - if targetGroupRecreated { - if _, err := c.elbv2.DeleteTargetGroup(&elbv2.DeleteTargetGroupInput{ - TargetGroupArn: listener.DefaultActions[0].TargetGroupArn, - }); err != nil { - return nil, fmt.Errorf("error deleting old target group: %q", err) - } - } else { - // Run ensureTargetGroup to make sure instances in service are up-to-date - _, err = c.ensureTargetGroup( - targetGroup, - namespacedName, - mapping, - instanceIDs, - *loadBalancer.VpcId, - tags, - ) - if err != nil { - return nil, err - } - } - dirty = true - continue - } - - // Additions - _, err := c.createListenerV2(loadBalancer.LoadBalancerArn, mapping, namespacedName, instanceIDs, *loadBalancer.VpcId, tags) - if err != nil { - return nil, err - } - dirty = true - } - - frontEndPorts := map[int64]map[string]bool{} - for i := range mappings { - if frontEndPorts[mappings[i].FrontendPort] == nil { - frontEndPorts[mappings[i].FrontendPort] = map[string]bool{} - } - frontEndPorts[mappings[i].FrontendPort][mappings[i].FrontendProtocol] = true - } - - // handle deletions - for port := range actual { - for protocol := range actual[port] { - if _, ok := frontEndPorts[port][protocol]; !ok { - err := c.deleteListenerV2(actual[port][protocol]) - if err != nil { - return nil, err - } - dirty = true - } - } - } - } - if err := c.reconcileLBAttributes(aws.StringValue(loadBalancer.LoadBalancerArn), annotations); err != nil { - return nil, err - } - - // Subnets cannot be modified on NLBs - if dirty { - loadBalancers, err := c.elbv2.DescribeLoadBalancers( - &elbv2.DescribeLoadBalancersInput{ - LoadBalancerArns: []*string{ - loadBalancer.LoadBalancerArn, - }, - }, - ) - if err != nil { - return nil, fmt.Errorf("error retrieving load balancer after update: %q", err) - } - loadBalancer = loadBalancers.LoadBalancers[0] - } - } - return loadBalancer, nil -} - -func (c *Cloud) reconcileLBAttributes(loadBalancerArn string, annotations map[string]string) error { - desiredLoadBalancerAttributes := map[string]string{} - - desiredLoadBalancerAttributes[lbAttrLoadBalancingCrossZoneEnabled] = "false" - crossZoneLoadBalancingEnabledAnnotation := annotations[ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled] - if crossZoneLoadBalancingEnabledAnnotation != "" { - crossZoneEnabled, err := strconv.ParseBool(crossZoneLoadBalancingEnabledAnnotation) - if err != nil { - return fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled, - crossZoneLoadBalancingEnabledAnnotation, - ) - } - - if crossZoneEnabled { - desiredLoadBalancerAttributes[lbAttrLoadBalancingCrossZoneEnabled] = "true" - } - } - - desiredLoadBalancerAttributes[lbAttrAccessLogsS3Enabled] = "false" - accessLogsS3EnabledAnnotation := annotations[ServiceAnnotationLoadBalancerAccessLogEnabled] - if accessLogsS3EnabledAnnotation != "" { - accessLogsS3Enabled, err := strconv.ParseBool(accessLogsS3EnabledAnnotation) - if err != nil { - return fmt.Errorf("error parsing service annotation: %s=%s", - ServiceAnnotationLoadBalancerAccessLogEnabled, - accessLogsS3EnabledAnnotation, - ) - } - - if accessLogsS3Enabled { - desiredLoadBalancerAttributes[lbAttrAccessLogsS3Enabled] = "true" - } - } - - desiredLoadBalancerAttributes[lbAttrAccessLogsS3Bucket] = annotations[ServiceAnnotationLoadBalancerAccessLogS3BucketName] - desiredLoadBalancerAttributes[lbAttrAccessLogsS3Prefix] = annotations[ServiceAnnotationLoadBalancerAccessLogS3BucketPrefix] - - currentLoadBalancerAttributes := map[string]string{} - describeAttributesOutput, err := c.elbv2.DescribeLoadBalancerAttributes(&elbv2.DescribeLoadBalancerAttributesInput{ - LoadBalancerArn: aws.String(loadBalancerArn), - }) - if err != nil { - return fmt.Errorf("unable to retrieve load balancer attributes during attribute sync: %q", err) - } - for _, attr := range describeAttributesOutput.Attributes { - currentLoadBalancerAttributes[aws.StringValue(attr.Key)] = aws.StringValue(attr.Value) - } - - var changedAttributes []*elbv2.LoadBalancerAttribute - if desiredLoadBalancerAttributes[lbAttrLoadBalancingCrossZoneEnabled] != currentLoadBalancerAttributes[lbAttrLoadBalancingCrossZoneEnabled] { - changedAttributes = append(changedAttributes, &elbv2.LoadBalancerAttribute{ - Key: aws.String(lbAttrLoadBalancingCrossZoneEnabled), - Value: aws.String(desiredLoadBalancerAttributes[lbAttrLoadBalancingCrossZoneEnabled]), - }) - } - if desiredLoadBalancerAttributes[lbAttrAccessLogsS3Enabled] != currentLoadBalancerAttributes[lbAttrAccessLogsS3Enabled] { - changedAttributes = append(changedAttributes, &elbv2.LoadBalancerAttribute{ - Key: aws.String(lbAttrAccessLogsS3Enabled), - Value: aws.String(desiredLoadBalancerAttributes[lbAttrAccessLogsS3Enabled]), - }) - } - - // ELBV2 API forbids us to set bucket to an empty bucket, so we keep it unchanged if AccessLogsS3Enabled==false. - if desiredLoadBalancerAttributes[lbAttrAccessLogsS3Enabled] == "true" { - if desiredLoadBalancerAttributes[lbAttrAccessLogsS3Bucket] != currentLoadBalancerAttributes[lbAttrAccessLogsS3Bucket] { - changedAttributes = append(changedAttributes, &elbv2.LoadBalancerAttribute{ - Key: aws.String(lbAttrAccessLogsS3Bucket), - Value: aws.String(desiredLoadBalancerAttributes[lbAttrAccessLogsS3Bucket]), - }) - } - if desiredLoadBalancerAttributes[lbAttrAccessLogsS3Prefix] != currentLoadBalancerAttributes[lbAttrAccessLogsS3Prefix] { - changedAttributes = append(changedAttributes, &elbv2.LoadBalancerAttribute{ - Key: aws.String(lbAttrAccessLogsS3Prefix), - Value: aws.String(desiredLoadBalancerAttributes[lbAttrAccessLogsS3Prefix]), - }) - } - } - - if len(changedAttributes) > 0 { - klog.V(2).Infof("updating load-balancer attributes for %q", loadBalancerArn) - - _, err = c.elbv2.ModifyLoadBalancerAttributes(&elbv2.ModifyLoadBalancerAttributesInput{ - LoadBalancerArn: aws.String(loadBalancerArn), - Attributes: changedAttributes, - }) - if err != nil { - return fmt.Errorf("unable to update load balancer attributes during attribute sync: %q", err) - } - } - return nil -} - -var invalidELBV2NameRegex = regexp.MustCompile("[^[:alnum:]]") - -// buildTargetGroupName will build unique name for targetGroup of service & port. -// the name is in format k8s-{namespace:8}-{name:8}-{uuid:10} (chosen to benefit most common use cases). -// Note: nodePort & targetProtocol & targetType are included since they cannot be modified on existing targetGroup. -func (c *Cloud) buildTargetGroupName(serviceName types.NamespacedName, servicePort int64, nodePort int64, targetProtocol string, targetType string, mapping nlbPortMapping) string { - hasher := sha1.New() - _, _ = hasher.Write([]byte(c.tagging.clusterID())) - _, _ = hasher.Write([]byte(serviceName.Namespace)) - _, _ = hasher.Write([]byte(serviceName.Name)) - _, _ = hasher.Write([]byte(strconv.FormatInt(servicePort, 10))) - _, _ = hasher.Write([]byte(strconv.FormatInt(nodePort, 10))) - _, _ = hasher.Write([]byte(targetProtocol)) - _, _ = hasher.Write([]byte(targetType)) - _, _ = hasher.Write([]byte(mapping.HealthCheckConfig.Protocol)) - _, _ = hasher.Write([]byte(strconv.FormatInt(mapping.HealthCheckConfig.Interval, 10))) - tgUUID := hex.EncodeToString(hasher.Sum(nil)) - - sanitizedNamespace := invalidELBV2NameRegex.ReplaceAllString(serviceName.Namespace, "") - sanitizedServiceName := invalidELBV2NameRegex.ReplaceAllString(serviceName.Name, "") - return fmt.Sprintf("k8s-%.8s-%.8s-%.10s", sanitizedNamespace, sanitizedServiceName, tgUUID) -} - -func (c *Cloud) createListenerV2(loadBalancerArn *string, mapping nlbPortMapping, namespacedName types.NamespacedName, instanceIDs []string, vpcID string, tags map[string]string) (listener *elbv2.Listener, err error) { - target, err := c.ensureTargetGroup( - nil, - namespacedName, - mapping, - instanceIDs, - vpcID, - tags, - ) - if err != nil { - return nil, err - } - - createListernerInput := &elbv2.CreateListenerInput{ - LoadBalancerArn: loadBalancerArn, - Port: aws.Int64(mapping.FrontendPort), - Protocol: aws.String(mapping.FrontendProtocol), - DefaultActions: []*elbv2.Action{{ - TargetGroupArn: target.TargetGroupArn, - Type: aws.String(elbv2.ActionTypeEnumForward), - }}, - } - if mapping.FrontendProtocol == "TLS" { - if mapping.SSLPolicy != "" { - createListernerInput.SslPolicy = aws.String(mapping.SSLPolicy) - } - createListernerInput.Certificates = []*elbv2.Certificate{ - { - CertificateArn: aws.String(mapping.SSLCertificateARN), - }, - } - } - - klog.Infof("Creating load balancer listener for %v", namespacedName) - createListenerOutput, err := c.elbv2.CreateListener(createListernerInput) - if err != nil { - return nil, fmt.Errorf("error creating load balancer listener: %q", err) - } - return createListenerOutput.Listeners[0], nil -} - -// cleans up listener and corresponding target group -func (c *Cloud) deleteListenerV2(listener *elbv2.Listener) error { - _, err := c.elbv2.DeleteListener(&elbv2.DeleteListenerInput{ListenerArn: listener.ListenerArn}) - if err != nil { - return fmt.Errorf("error deleting load balancer listener: %q", err) - } - _, err = c.elbv2.DeleteTargetGroup(&elbv2.DeleteTargetGroupInput{TargetGroupArn: listener.DefaultActions[0].TargetGroupArn}) - if err != nil { - return fmt.Errorf("error deleting load balancer target group: %q", err) - } - return nil -} - -// ensureTargetGroup creates a target group with a set of instances. -func (c *Cloud) ensureTargetGroup(targetGroup *elbv2.TargetGroup, serviceName types.NamespacedName, mapping nlbPortMapping, instances []string, vpcID string, tags map[string]string) (*elbv2.TargetGroup, error) { - dirty := false - expectedTargets := c.computeTargetGroupExpectedTargets(instances, mapping.TrafficPort) - if targetGroup == nil { - targetType := "instance" - name := c.buildTargetGroupName(serviceName, mapping.FrontendPort, mapping.TrafficPort, mapping.TrafficProtocol, targetType, mapping) - klog.Infof("Creating load balancer target group for %v with name: %s", serviceName, name) - input := &elbv2.CreateTargetGroupInput{ - VpcId: aws.String(vpcID), - Name: aws.String(name), - Port: aws.Int64(mapping.TrafficPort), - Protocol: aws.String(mapping.TrafficProtocol), - TargetType: aws.String(targetType), - HealthCheckIntervalSeconds: aws.Int64(mapping.HealthCheckConfig.Interval), - HealthCheckPort: aws.String(mapping.HealthCheckConfig.Port), - HealthCheckProtocol: aws.String(mapping.HealthCheckConfig.Protocol), - HealthyThresholdCount: aws.Int64(mapping.HealthCheckConfig.HealthyThreshold), - UnhealthyThresholdCount: aws.Int64(mapping.HealthCheckConfig.UnhealthyThreshold), - // HealthCheckTimeoutSeconds: Currently not configurable, 6 seconds for HTTP, 10 for TCP/HTTPS - } - - if mapping.HealthCheckConfig.Protocol != elbv2.ProtocolEnumTcp { - input.HealthCheckPath = aws.String(mapping.HealthCheckConfig.Path) - } - - result, err := c.elbv2.CreateTargetGroup(input) - if err != nil { - return nil, fmt.Errorf("error creating load balancer target group: %q", err) - } - if len(result.TargetGroups) != 1 { - return nil, fmt.Errorf("expected only one target group on CreateTargetGroup, got %d groups", len(result.TargetGroups)) - } - - if len(tags) != 0 { - targetGroupTags := make([]*elbv2.Tag, 0, len(tags)) - for k, v := range tags { - targetGroupTags = append(targetGroupTags, &elbv2.Tag{ - Key: aws.String(k), Value: aws.String(v), - }) - } - tgArn := aws.StringValue(result.TargetGroups[0].TargetGroupArn) - if _, err := c.elbv2.AddTags(&elbv2.AddTagsInput{ - ResourceArns: []*string{aws.String(tgArn)}, - Tags: targetGroupTags, - }); err != nil { - return nil, fmt.Errorf("error adding tags for targetGroup %s due to %q", tgArn, err) - } - } - - tg := result.TargetGroups[0] - tgARN := aws.StringValue(tg.TargetGroupArn) - if err := c.ensureTargetGroupTargets(tgARN, expectedTargets, nil); err != nil { - return nil, err - } - return tg, nil - } - - // handle instances in service - { - tgARN := aws.StringValue(targetGroup.TargetGroupArn) - actualTargets, err := c.obtainTargetGroupActualTargets(tgARN) - if err != nil { - return nil, err - } - if err := c.ensureTargetGroupTargets(tgARN, expectedTargets, actualTargets); err != nil { - return nil, err - } - } - - // ensure the health check is correct - { - dirtyHealthCheck := false - - input := &elbv2.ModifyTargetGroupInput{ - TargetGroupArn: targetGroup.TargetGroupArn, - } - if mapping.HealthCheckConfig.Port != aws.StringValue(targetGroup.HealthCheckPort) { - input.HealthCheckPort = aws.String(mapping.HealthCheckConfig.Port) - dirtyHealthCheck = true - } - if mapping.HealthCheckConfig.HealthyThreshold != aws.Int64Value(targetGroup.HealthyThresholdCount) { - dirtyHealthCheck = true - input.HealthyThresholdCount = aws.Int64(mapping.HealthCheckConfig.HealthyThreshold) - input.UnhealthyThresholdCount = aws.Int64(mapping.HealthCheckConfig.UnhealthyThreshold) - } - if !strings.EqualFold(mapping.HealthCheckConfig.Protocol, elbv2.ProtocolEnumTcp) { - if mapping.HealthCheckConfig.Path != aws.StringValue(input.HealthCheckPath) { - input.HealthCheckPath = aws.String(mapping.HealthCheckConfig.Path) - dirtyHealthCheck = true - } - } - - if dirtyHealthCheck { - _, err := c.elbv2.ModifyTargetGroup(input) - if err != nil { - return nil, fmt.Errorf("error modifying target group health check: %q", err) - } - - dirty = true - } - } - - if dirty { - result, err := c.elbv2.DescribeTargetGroups(&elbv2.DescribeTargetGroupsInput{ - TargetGroupArns: []*string{targetGroup.TargetGroupArn}, - }) - if err != nil { - return nil, fmt.Errorf("error retrieving target group after creation/update: %q", err) - } - targetGroup = result.TargetGroups[0] - } - - return targetGroup, nil -} - -func (c *Cloud) ensureTargetGroupTargets(tgARN string, expectedTargets []*elbv2.TargetDescription, actualTargets []*elbv2.TargetDescription) error { - targetsToRegister, targetsToDeregister := c.diffTargetGroupTargets(expectedTargets, actualTargets) - if len(targetsToRegister) > 0 { - targetsToRegisterChunks := c.chunkTargetDescriptions(targetsToRegister, defaultRegisterTargetsChunkSize) - for _, targetsChunk := range targetsToRegisterChunks { - req := &elbv2.RegisterTargetsInput{ - TargetGroupArn: aws.String(tgARN), - Targets: targetsChunk, - } - if _, err := c.elbv2.RegisterTargets(req); err != nil { - return fmt.Errorf("error trying to register targets in target group: %q", err) - } - } - } - if len(targetsToDeregister) > 0 { - targetsToDeregisterChunks := c.chunkTargetDescriptions(targetsToDeregister, defaultDeregisterTargetsChunkSize) - for _, targetsChunk := range targetsToDeregisterChunks { - req := &elbv2.DeregisterTargetsInput{ - TargetGroupArn: aws.String(tgARN), - Targets: targetsChunk, - } - if _, err := c.elbv2.DeregisterTargets(req); err != nil { - return fmt.Errorf("error trying to deregister targets in target group: %q", err) - } - } - } - return nil -} - -func (c *Cloud) computeTargetGroupExpectedTargets(instanceIDs []string, port int64) []*elbv2.TargetDescription { - expectedTargets := make([]*elbv2.TargetDescription, 0, len(instanceIDs)) - for _, instanceID := range instanceIDs { - expectedTargets = append(expectedTargets, &elbv2.TargetDescription{ - Id: aws.String(instanceID), - Port: aws.Int64(port), - }) - } - return expectedTargets -} - -func (c *Cloud) obtainTargetGroupActualTargets(tgARN string) ([]*elbv2.TargetDescription, error) { - req := &elbv2.DescribeTargetHealthInput{ - TargetGroupArn: aws.String(tgARN), - } - resp, err := c.elbv2.DescribeTargetHealth(req) - if err != nil { - return nil, fmt.Errorf("error describing target group health: %q", err) - } - actualTargets := make([]*elbv2.TargetDescription, 0, len(resp.TargetHealthDescriptions)) - for _, targetDesc := range resp.TargetHealthDescriptions { - if targetDesc.TargetHealth.Reason != nil && aws.StringValue(targetDesc.TargetHealth.Reason) == elbv2.TargetHealthReasonEnumTargetDeregistrationInProgress { - continue - } - actualTargets = append(actualTargets, targetDesc.Target) - } - return actualTargets, nil -} - -// diffTargetGroupTargets computes the targets to register and targets to deregister based on existingTargets and desired instances. -func (c *Cloud) diffTargetGroupTargets(expectedTargets []*elbv2.TargetDescription, actualTargets []*elbv2.TargetDescription) (targetsToRegister []*elbv2.TargetDescription, targetsToDeregister []*elbv2.TargetDescription) { - expectedTargetsByUID := make(map[string]*elbv2.TargetDescription, len(expectedTargets)) - for _, target := range expectedTargets { - targetUID := fmt.Sprintf("%v:%v", aws.StringValue(target.Id), aws.Int64Value(target.Port)) - expectedTargetsByUID[targetUID] = target - } - actualTargetsByUID := make(map[string]*elbv2.TargetDescription, len(actualTargets)) - for _, target := range actualTargets { - targetUID := fmt.Sprintf("%v:%v", aws.StringValue(target.Id), aws.Int64Value(target.Port)) - actualTargetsByUID[targetUID] = target - } - - expectedTargetsUIDs := sets.StringKeySet(expectedTargetsByUID) - actualTargetsUIDs := sets.StringKeySet(actualTargetsByUID) - for _, targetUID := range expectedTargetsUIDs.Difference(actualTargetsUIDs).List() { - targetsToRegister = append(targetsToRegister, expectedTargetsByUID[targetUID]) - } - for _, targetUID := range actualTargetsUIDs.Difference(expectedTargetsUIDs).List() { - targetsToDeregister = append(targetsToDeregister, actualTargetsByUID[targetUID]) - } - return targetsToRegister, targetsToDeregister -} - -// chunkTargetDescriptions will split slice of TargetDescription into chunks -func (c *Cloud) chunkTargetDescriptions(targets []*elbv2.TargetDescription, chunkSize int) [][]*elbv2.TargetDescription { - var chunks [][]*elbv2.TargetDescription - for i := 0; i < len(targets); i += chunkSize { - end := i + chunkSize - if end > len(targets) { - end = len(targets) - } - chunks = append(chunks, targets[i:end]) - } - return chunks -} - -// updateInstanceSecurityGroupsForNLB will adjust securityGroup's settings to allow inbound traffic into instances from clientCIDRs and portMappings. -// TIP: if either instances or clientCIDRs or portMappings are nil, then the securityGroup rules for lbName are cleared. -func (c *Cloud) updateInstanceSecurityGroupsForNLB(lbName string, instances map[InstanceID]*ec2.Instance, subnetCIDRs []string, clientCIDRs []string, portMappings []nlbPortMapping) error { - if c.cfg.Global.DisableSecurityGroupIngress { - return nil - } - - clusterSGs, err := c.getTaggedSecurityGroups() - if err != nil { - return fmt.Errorf("error querying for tagged security groups: %q", err) - } - // scan instances for groups we want to open - desiredSGIDs := sets.String{} - for _, instance := range instances { - sg, err := findSecurityGroupForInstance(instance, clusterSGs) - if err != nil { - return err - } - if sg == nil { - klog.Warningf("Ignoring instance without security group: %s", aws.StringValue(instance.InstanceId)) - continue - } - desiredSGIDs.Insert(aws.StringValue(sg.GroupId)) - } - - // TODO(@M00nF1sh): do we really needs to support SG without cluster tag at current version? - // findSecurityGroupForInstance might return SG that are not tagged. - { - for sgID := range desiredSGIDs.Difference(sets.StringKeySet(clusterSGs)) { - sg, err := c.findSecurityGroup(sgID) - if err != nil { - return fmt.Errorf("error finding instance group: %q", err) - } - clusterSGs[sgID] = sg - } - } - - { - clientPorts := sets.Int64{} - clientProtocol := "tcp" - healthCheckPorts := sets.Int64{} - for _, port := range portMappings { - clientPorts.Insert(port.TrafficPort) - hcPort := port.TrafficPort - if port.HealthCheckConfig.Port != defaultHealthCheckPort { - var err error - if hcPort, err = strconv.ParseInt(port.HealthCheckConfig.Port, 10, 0); err != nil { - return fmt.Errorf("Invalid health check port %v", port.HealthCheckConfig.Port) - } - } - healthCheckPorts.Insert(hcPort) - if port.TrafficProtocol == string(v1.ProtocolUDP) { - clientProtocol = "udp" - } - } - clientRuleAnnotation := fmt.Sprintf("%s=%s", NLBClientRuleDescription, lbName) - healthRuleAnnotation := fmt.Sprintf("%s=%s", NLBHealthCheckRuleDescription, lbName) - for sgID, sg := range clusterSGs { - sgPerms := NewIPPermissionSet(sg.IpPermissions...).Ungroup() - if desiredSGIDs.Has(sgID) { - // If the client rule is 1) all addresses 2) tcp and 3) has same ports as the healthcheck, - // then the health rules are a subset of the client rule and are not needed. - if len(clientCIDRs) != 1 || clientCIDRs[0] != "0.0.0.0/0" || clientProtocol != "tcp" || !healthCheckPorts.Equal(clientPorts) { - if err := c.updateInstanceSecurityGroupForNLBTraffic(sgID, sgPerms, healthRuleAnnotation, "tcp", healthCheckPorts, subnetCIDRs); err != nil { - return err - } - } - if err := c.updateInstanceSecurityGroupForNLBTraffic(sgID, sgPerms, clientRuleAnnotation, clientProtocol, clientPorts, clientCIDRs); err != nil { - return err - } - } else { - if err := c.updateInstanceSecurityGroupForNLBTraffic(sgID, sgPerms, healthRuleAnnotation, "tcp", nil, nil); err != nil { - return err - } - if err := c.updateInstanceSecurityGroupForNLBTraffic(sgID, sgPerms, clientRuleAnnotation, clientProtocol, nil, nil); err != nil { - return err - } - } - if !sgPerms.Equal(NewIPPermissionSet(sg.IpPermissions...).Ungroup()) { - if err := c.updateInstanceSecurityGroupForNLBMTU(sgID, sgPerms); err != nil { - return err - } - } - } - } - return nil -} - -// updateInstanceSecurityGroupForNLBTraffic will manage permissions set(identified by ruleDesc) on securityGroup to match desired set(allow protocol traffic from ports/cidr). -// Note: sgPerms will be updated to reflect the current permission set on SG after update. -func (c *Cloud) updateInstanceSecurityGroupForNLBTraffic(sgID string, sgPerms IPPermissionSet, ruleDesc string, protocol string, ports sets.Int64, cidrs []string) error { - desiredPerms := NewIPPermissionSet() - for port := range ports { - for _, cidr := range cidrs { - desiredPerms.Insert(&ec2.IpPermission{ - IpProtocol: aws.String(protocol), - FromPort: aws.Int64(port), - ToPort: aws.Int64(port), - IpRanges: []*ec2.IpRange{ - { - CidrIp: aws.String(cidr), - Description: aws.String(ruleDesc), - }, - }, - }) - } - } - - permsToGrant := desiredPerms.Difference(sgPerms) - permsToRevoke := sgPerms.Difference(desiredPerms) - permsToRevoke.DeleteIf(IPPermissionNotMatch{IPPermissionMatchDesc{ruleDesc}}) - if len(permsToRevoke) > 0 { - permsToRevokeList := permsToRevoke.List() - changed, err := c.removeSecurityGroupIngress(sgID, permsToRevokeList) - if err != nil { - klog.Warningf("Error remove traffic permission from security group: %q", err) - return err - } - if !changed { - klog.Warning("Revoking ingress was not needed; concurrent change? groupId=", sgID) - } - sgPerms.Delete(permsToRevokeList...) - } - if len(permsToGrant) > 0 { - permsToGrantList := permsToGrant.List() - changed, err := c.addSecurityGroupIngress(sgID, permsToGrantList) - if err != nil { - klog.Warningf("Error add traffic permission to security group: %q", err) - return err - } - if !changed { - klog.Warning("Allowing ingress was not needed; concurrent change? groupId=", sgID) - } - sgPerms.Insert(permsToGrantList...) - } - return nil -} - -// Note: sgPerms will be updated to reflect the current permission set on SG after update. -func (c *Cloud) updateInstanceSecurityGroupForNLBMTU(sgID string, sgPerms IPPermissionSet) error { - desiredPerms := NewIPPermissionSet() - for _, perm := range sgPerms { - for _, ipRange := range perm.IpRanges { - if strings.Contains(aws.StringValue(ipRange.Description), NLBClientRuleDescription) { - desiredPerms.Insert(&ec2.IpPermission{ - IpProtocol: aws.String("icmp"), - FromPort: aws.Int64(3), - ToPort: aws.Int64(4), - IpRanges: []*ec2.IpRange{ - { - CidrIp: ipRange.CidrIp, - Description: aws.String(NLBMtuDiscoveryRuleDescription), - }, - }, - }) - } - } - } - - permsToGrant := desiredPerms.Difference(sgPerms) - permsToRevoke := sgPerms.Difference(desiredPerms) - permsToRevoke.DeleteIf(IPPermissionNotMatch{IPPermissionMatchDesc{NLBMtuDiscoveryRuleDescription}}) - if len(permsToRevoke) > 0 { - permsToRevokeList := permsToRevoke.List() - changed, err := c.removeSecurityGroupIngress(sgID, permsToRevokeList) - if err != nil { - klog.Warningf("Error remove MTU permission from security group: %q", err) - return err - } - if !changed { - klog.Warning("Revoking ingress was not needed; concurrent change? groupId=", sgID) - } - - sgPerms.Delete(permsToRevokeList...) - } - if len(permsToGrant) > 0 { - permsToGrantList := permsToGrant.List() - changed, err := c.addSecurityGroupIngress(sgID, permsToGrantList) - if err != nil { - klog.Warningf("Error add MTU permission to security group: %q", err) - return err - } - if !changed { - klog.Warning("Allowing ingress was not needed; concurrent change? groupId=", sgID) - } - sgPerms.Insert(permsToGrantList...) - } - return nil -} - -func (c *Cloud) ensureLoadBalancer(namespacedName types.NamespacedName, loadBalancerName string, listeners []*elb.Listener, subnetIDs []string, securityGroupIDs []string, internalELB, proxyProtocol bool, loadBalancerAttributes *elb.LoadBalancerAttributes, annotations map[string]string) (*elb.LoadBalancerDescription, error) { - loadBalancer, err := c.describeLoadBalancer(loadBalancerName) - if err != nil { - return nil, err - } - - dirty := false - - if loadBalancer == nil { - createRequest := &elb.CreateLoadBalancerInput{} - createRequest.LoadBalancerName = aws.String(loadBalancerName) - - createRequest.Listeners = listeners - - if internalELB { - createRequest.Scheme = aws.String("internal") - } - - // We are supposed to specify one subnet per AZ. - // TODO: What happens if we have more than one subnet per AZ? - if subnetIDs == nil { - createRequest.Subnets = nil - } else { - createRequest.Subnets = aws.StringSlice(subnetIDs) - } - - if securityGroupIDs == nil { - createRequest.SecurityGroups = nil - } else { - createRequest.SecurityGroups = aws.StringSlice(securityGroupIDs) - } - - // Get additional tags set by the user - tags := getKeyValuePropertiesFromAnnotation(annotations, ServiceAnnotationLoadBalancerAdditionalTags) - - // Add default tags - tags[TagNameKubernetesService] = namespacedName.String() - tags = c.tagging.buildTags(ResourceLifecycleOwned, tags) - - for k, v := range tags { - createRequest.Tags = append(createRequest.Tags, &elb.Tag{ - Key: aws.String(k), Value: aws.String(v), - }) - } - - klog.Infof("Creating load balancer for %v with name: %s", namespacedName, loadBalancerName) - _, err := c.elb.CreateLoadBalancer(createRequest) - if err != nil { - return nil, err - } - - if proxyProtocol { - err = c.createProxyProtocolPolicy(loadBalancerName) - if err != nil { - return nil, err - } - - for _, listener := range listeners { - klog.V(2).Infof("Adjusting AWS loadbalancer proxy protocol on node port %d. Setting to true", *listener.InstancePort) - err := c.setBackendPolicies(loadBalancerName, *listener.InstancePort, []*string{aws.String(ProxyProtocolPolicyName)}) - if err != nil { - return nil, err - } - } - } - - dirty = true - } else { - // TODO: Sync internal vs non-internal - - { - // Sync subnets - expected := sets.NewString(subnetIDs...) - actual := stringSetFromPointers(loadBalancer.Subnets) - - additions := expected.Difference(actual) - removals := actual.Difference(expected) - - if removals.Len() != 0 { - request := &elb.DetachLoadBalancerFromSubnetsInput{} - request.LoadBalancerName = aws.String(loadBalancerName) - request.Subnets = stringSetToPointers(removals) - klog.V(2).Info("Detaching load balancer from removed subnets") - _, err := c.elb.DetachLoadBalancerFromSubnets(request) - if err != nil { - return nil, fmt.Errorf("error detaching AWS loadbalancer from subnets: %q", err) - } - dirty = true - } - - if additions.Len() != 0 { - request := &elb.AttachLoadBalancerToSubnetsInput{} - request.LoadBalancerName = aws.String(loadBalancerName) - request.Subnets = stringSetToPointers(additions) - klog.V(2).Info("Attaching load balancer to added subnets") - _, err := c.elb.AttachLoadBalancerToSubnets(request) - if err != nil { - return nil, fmt.Errorf("error attaching AWS loadbalancer to subnets: %q", err) - } - dirty = true - } - } - - { - // Sync security groups - expected := sets.NewString(securityGroupIDs...) - actual := stringSetFromPointers(loadBalancer.SecurityGroups) - - if !expected.Equal(actual) { - // This call just replaces the security groups, unlike e.g. subnets (!) - request := &elb.ApplySecurityGroupsToLoadBalancerInput{} - request.LoadBalancerName = aws.String(loadBalancerName) - if securityGroupIDs == nil { - request.SecurityGroups = nil - } else { - request.SecurityGroups = aws.StringSlice(securityGroupIDs) - } - klog.V(2).Info("Applying updated security groups to load balancer") - _, err := c.elb.ApplySecurityGroupsToLoadBalancer(request) - if err != nil { - return nil, fmt.Errorf("error applying AWS loadbalancer security groups: %q", err) - } - dirty = true - } - } - - { - additions, removals := syncElbListeners(loadBalancerName, listeners, loadBalancer.ListenerDescriptions) - - if len(removals) != 0 { - request := &elb.DeleteLoadBalancerListenersInput{} - request.LoadBalancerName = aws.String(loadBalancerName) - request.LoadBalancerPorts = removals - klog.V(2).Info("Deleting removed load balancer listeners") - if _, err := c.elb.DeleteLoadBalancerListeners(request); err != nil { - return nil, fmt.Errorf("error deleting AWS loadbalancer listeners: %q", err) - } - dirty = true - } - - if len(additions) != 0 { - request := &elb.CreateLoadBalancerListenersInput{} - request.LoadBalancerName = aws.String(loadBalancerName) - request.Listeners = additions - klog.V(2).Info("Creating added load balancer listeners") - if _, err := c.elb.CreateLoadBalancerListeners(request); err != nil { - return nil, fmt.Errorf("error creating AWS loadbalancer listeners: %q", err) - } - dirty = true - } - } - - { - // Sync proxy protocol state for new and existing listeners - - proxyPolicies := make([]*string, 0) - if proxyProtocol { - // Ensure the backend policy exists - - // NOTE The documentation for the AWS API indicates we could get an HTTP 400 - // back if a policy of the same name already exists. However, the aws-sdk does not - // seem to return an error to us in these cases. Therefore, this will issue an API - // request every time. - err := c.createProxyProtocolPolicy(loadBalancerName) - if err != nil { - return nil, err - } - - proxyPolicies = append(proxyPolicies, aws.String(ProxyProtocolPolicyName)) - } - - foundBackends := make(map[int64]bool) - proxyProtocolBackends := make(map[int64]bool) - for _, backendListener := range loadBalancer.BackendServerDescriptions { - foundBackends[*backendListener.InstancePort] = false - proxyProtocolBackends[*backendListener.InstancePort] = proxyProtocolEnabled(backendListener) - } - - for _, listener := range listeners { - setPolicy := false - instancePort := *listener.InstancePort - - if currentState, ok := proxyProtocolBackends[instancePort]; !ok { - // This is a new ELB backend so we only need to worry about - // potentially adding a policy and not removing an - // existing one - setPolicy = proxyProtocol - } else { - foundBackends[instancePort] = true - // This is an existing ELB backend so we need to determine - // if the state changed - setPolicy = (currentState != proxyProtocol) - } - - if setPolicy { - klog.V(2).Infof("Adjusting AWS loadbalancer proxy protocol on node port %d. Setting to %t", instancePort, proxyProtocol) - err := c.setBackendPolicies(loadBalancerName, instancePort, proxyPolicies) - if err != nil { - return nil, err - } - dirty = true - } - } - - // We now need to figure out if any backend policies need removed - // because these old policies will stick around even if there is no - // corresponding listener anymore - for instancePort, found := range foundBackends { - if !found { - klog.V(2).Infof("Adjusting AWS loadbalancer proxy protocol on node port %d. Setting to false", instancePort) - err := c.setBackendPolicies(loadBalancerName, instancePort, []*string{}) - if err != nil { - return nil, err - } - dirty = true - } - } - } - - { - // Add additional tags - klog.V(2).Infof("Creating additional load balancer tags for %s", loadBalancerName) - tags := getKeyValuePropertiesFromAnnotation(annotations, ServiceAnnotationLoadBalancerAdditionalTags) - if len(tags) > 0 { - err := c.addLoadBalancerTags(loadBalancerName, tags) - if err != nil { - return nil, fmt.Errorf("unable to create additional load balancer tags: %v", err) - } - } - } - } - - // Whether the ELB was new or existing, sync attributes regardless. This accounts for things - // that cannot be specified at the time of creation and can only be modified after the fact, - // e.g. idle connection timeout. - { - describeAttributesRequest := &elb.DescribeLoadBalancerAttributesInput{} - describeAttributesRequest.LoadBalancerName = aws.String(loadBalancerName) - describeAttributesOutput, err := c.elb.DescribeLoadBalancerAttributes(describeAttributesRequest) - if err != nil { - klog.Warning("Unable to retrieve load balancer attributes during attribute sync") - return nil, err - } - - foundAttributes := &describeAttributesOutput.LoadBalancerAttributes - - // Update attributes if they're dirty - if !reflect.DeepEqual(loadBalancerAttributes, foundAttributes) { - klog.V(2).Infof("Updating load-balancer attributes for %q", loadBalancerName) - - modifyAttributesRequest := &elb.ModifyLoadBalancerAttributesInput{} - modifyAttributesRequest.LoadBalancerName = aws.String(loadBalancerName) - modifyAttributesRequest.LoadBalancerAttributes = loadBalancerAttributes - _, err = c.elb.ModifyLoadBalancerAttributes(modifyAttributesRequest) - if err != nil { - return nil, fmt.Errorf("Unable to update load balancer attributes during attribute sync: %q", err) - } - dirty = true - } - } - - if dirty { - loadBalancer, err = c.describeLoadBalancer(loadBalancerName) - if err != nil { - klog.Warning("Unable to retrieve load balancer after creation/update") - return nil, err - } - } - - return loadBalancer, nil -} - -// syncElbListeners computes a plan to reconcile the desired vs actual state of the listeners on an ELB -// NOTE: there exists an O(nlgn) implementation for this function. However, as the default limit of -// listeners per elb is 100, this implementation is reduced from O(m*n) => O(n). -func syncElbListeners(loadBalancerName string, listeners []*elb.Listener, listenerDescriptions []*elb.ListenerDescription) ([]*elb.Listener, []*int64) { - foundSet := make(map[int]bool) - removals := []*int64{} - additions := []*elb.Listener{} - - for _, listenerDescription := range listenerDescriptions { - actual := listenerDescription.Listener - if actual == nil { - klog.Warning("Ignoring empty listener in AWS loadbalancer: ", loadBalancerName) - continue - } - - found := false - for i, expected := range listeners { - if expected == nil { - klog.Warning("Ignoring empty desired listener for loadbalancer: ", loadBalancerName) - continue - } - if elbListenersAreEqual(actual, expected) { - // The current listener on the actual - // elb is in the set of desired listeners. - foundSet[i] = true - found = true - break - } - } - if !found { - removals = append(removals, actual.LoadBalancerPort) - } - } - - for i := range listeners { - if !foundSet[i] { - additions = append(additions, listeners[i]) - } - } - - return additions, removals -} - -func elbListenersAreEqual(actual, expected *elb.Listener) bool { - if !elbProtocolsAreEqual(actual.Protocol, expected.Protocol) { - return false - } - if !elbProtocolsAreEqual(actual.InstanceProtocol, expected.InstanceProtocol) { - return false - } - if aws.Int64Value(actual.InstancePort) != aws.Int64Value(expected.InstancePort) { - return false - } - if aws.Int64Value(actual.LoadBalancerPort) != aws.Int64Value(expected.LoadBalancerPort) { - return false - } - if !awsArnEquals(actual.SSLCertificateId, expected.SSLCertificateId) { - return false - } - return true -} - -func createSubnetMappings(subnetIDs []string, allocationIDs []string) []*elbv2.SubnetMapping { - response := []*elbv2.SubnetMapping{} - - for index, id := range subnetIDs { - sm := &elbv2.SubnetMapping{SubnetId: aws.String(id)} - if len(allocationIDs) > 0 { - sm.AllocationId = aws.String(allocationIDs[index]) - } - response = append(response, sm) - } - - return response -} - -// elbProtocolsAreEqual checks if two ELB protocol strings are considered the same -// Comparison is case insensitive -func elbProtocolsAreEqual(l, r *string) bool { - if l == nil || r == nil { - return l == r - } - return strings.EqualFold(aws.StringValue(l), aws.StringValue(r)) -} - -// awsArnEquals checks if two ARN strings are considered the same -// Comparison is case insensitive -func awsArnEquals(l, r *string) bool { - if l == nil || r == nil { - return l == r - } - return strings.EqualFold(aws.StringValue(l), aws.StringValue(r)) -} - -// getExpectedHealthCheck returns an elb.Healthcheck for the provided target -// and using either sensible defaults or overrides via Service annotations -func (c *Cloud) getExpectedHealthCheck(target string, annotations map[string]string) (*elb.HealthCheck, error) { - healthcheck := &elb.HealthCheck{Target: &target} - getOrDefault := func(annotation string, defaultValue int64) (*int64, error) { - i64 := defaultValue - var err error - if s, ok := annotations[annotation]; ok { - i64, err = strconv.ParseInt(s, 10, 0) - if err != nil { - return nil, fmt.Errorf("failed parsing health check annotation value: %v", err) - } - } - return &i64, nil - } - var err error - healthcheck.HealthyThreshold, err = getOrDefault(ServiceAnnotationLoadBalancerHCHealthyThreshold, defaultElbHCHealthyThreshold) - if err != nil { - return nil, err - } - healthcheck.UnhealthyThreshold, err = getOrDefault(ServiceAnnotationLoadBalancerHCUnhealthyThreshold, defaultElbHCUnhealthyThreshold) - if err != nil { - return nil, err - } - healthcheck.Timeout, err = getOrDefault(ServiceAnnotationLoadBalancerHCTimeout, defaultElbHCTimeout) - if err != nil { - return nil, err - } - healthcheck.Interval, err = getOrDefault(ServiceAnnotationLoadBalancerHCInterval, defaultElbHCInterval) - if err != nil { - return nil, err - } - if err = healthcheck.Validate(); err != nil { - return nil, fmt.Errorf("some of the load balancer health check parameters are invalid: %v", err) - } - return healthcheck, nil -} - -// Makes sure that the health check for an ELB matches the configured health check node port -func (c *Cloud) ensureLoadBalancerHealthCheck(loadBalancer *elb.LoadBalancerDescription, protocol string, port int32, path string, annotations map[string]string) error { - name := aws.StringValue(loadBalancer.LoadBalancerName) - - actual := loadBalancer.HealthCheck - // Override healthcheck protocol, port and path based on annotations - if s, ok := annotations[ServiceAnnotationLoadBalancerHealthCheckProtocol]; ok { - protocol = s - } - if s, ok := annotations[ServiceAnnotationLoadBalancerHealthCheckPort]; ok && s != defaultHealthCheckPort { - p, err := strconv.ParseInt(s, 10, 0) - if err != nil { - return err - } - port = int32(p) - } - switch strings.ToUpper(protocol) { - case "HTTP", "HTTPS": - if path == "" { - path = defaultHealthCheckPath - } - if s := annotations[ServiceAnnotationLoadBalancerHealthCheckPath]; s != "" { - path = s - } - default: - path = "" - } - expectedTarget := protocol + ":" + strconv.FormatInt(int64(port), 10) + path - expected, err := c.getExpectedHealthCheck(expectedTarget, annotations) - if err != nil { - return fmt.Errorf("cannot update health check for load balancer %q: %q", name, err) - } - - // comparing attributes 1 by 1 to avoid breakage in case a new field is - // added to the HC which breaks the equality - if aws.StringValue(expected.Target) == aws.StringValue(actual.Target) && - aws.Int64Value(expected.HealthyThreshold) == aws.Int64Value(actual.HealthyThreshold) && - aws.Int64Value(expected.UnhealthyThreshold) == aws.Int64Value(actual.UnhealthyThreshold) && - aws.Int64Value(expected.Interval) == aws.Int64Value(actual.Interval) && - aws.Int64Value(expected.Timeout) == aws.Int64Value(actual.Timeout) { - return nil - } - - request := &elb.ConfigureHealthCheckInput{} - request.HealthCheck = expected - request.LoadBalancerName = loadBalancer.LoadBalancerName - - _, err = c.elb.ConfigureHealthCheck(request) - if err != nil { - return fmt.Errorf("error configuring load balancer health check for %q: %q", name, err) - } - - return nil -} - -// Makes sure that exactly the specified hosts are registered as instances with the load balancer -func (c *Cloud) ensureLoadBalancerInstances(loadBalancerName string, lbInstances []*elb.Instance, instanceIDs map[InstanceID]*ec2.Instance) error { - expected := sets.NewString() - for id := range instanceIDs { - expected.Insert(string(id)) - } - - actual := sets.NewString() - for _, lbInstance := range lbInstances { - actual.Insert(aws.StringValue(lbInstance.InstanceId)) - } - - additions := expected.Difference(actual) - removals := actual.Difference(expected) - - addInstances := []*elb.Instance{} - for _, instanceID := range additions.List() { - addInstance := &elb.Instance{} - addInstance.InstanceId = aws.String(instanceID) - addInstances = append(addInstances, addInstance) - } - - removeInstances := []*elb.Instance{} - for _, instanceID := range removals.List() { - removeInstance := &elb.Instance{} - removeInstance.InstanceId = aws.String(instanceID) - removeInstances = append(removeInstances, removeInstance) - } - - if len(addInstances) > 0 { - registerRequest := &elb.RegisterInstancesWithLoadBalancerInput{} - registerRequest.Instances = addInstances - registerRequest.LoadBalancerName = aws.String(loadBalancerName) - _, err := c.elb.RegisterInstancesWithLoadBalancer(registerRequest) - if err != nil { - return err - } - klog.V(1).Infof("Instances added to load-balancer %s", loadBalancerName) - } - - if len(removeInstances) > 0 { - deregisterRequest := &elb.DeregisterInstancesFromLoadBalancerInput{} - deregisterRequest.Instances = removeInstances - deregisterRequest.LoadBalancerName = aws.String(loadBalancerName) - _, err := c.elb.DeregisterInstancesFromLoadBalancer(deregisterRequest) - if err != nil { - return err - } - klog.V(1).Infof("Instances removed from load-balancer %s", loadBalancerName) - } - - return nil -} - -func (c *Cloud) getLoadBalancerTLSPorts(loadBalancer *elb.LoadBalancerDescription) []int64 { - ports := []int64{} - - for _, listenerDescription := range loadBalancer.ListenerDescriptions { - protocol := aws.StringValue(listenerDescription.Listener.Protocol) - if protocol == "SSL" || protocol == "HTTPS" { - ports = append(ports, aws.Int64Value(listenerDescription.Listener.LoadBalancerPort)) - } - } - return ports -} - -func (c *Cloud) ensureSSLNegotiationPolicy(loadBalancer *elb.LoadBalancerDescription, policyName string) error { - klog.V(2).Info("Describing load balancer policies on load balancer") - result, err := c.elb.DescribeLoadBalancerPolicies(&elb.DescribeLoadBalancerPoliciesInput{ - LoadBalancerName: loadBalancer.LoadBalancerName, - PolicyNames: []*string{ - aws.String(fmt.Sprintf(SSLNegotiationPolicyNameFormat, policyName)), - }, - }) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case elb.ErrCodePolicyNotFoundException: - default: - return fmt.Errorf("error describing security policies on load balancer: %q", err) - } - } - } - - if len(result.PolicyDescriptions) > 0 { - return nil - } - - klog.V(2).Infof("Creating SSL negotiation policy '%s' on load balancer", fmt.Sprintf(SSLNegotiationPolicyNameFormat, policyName)) - // there is an upper limit of 98 policies on an ELB, we're pretty safe from - // running into it - _, err = c.elb.CreateLoadBalancerPolicy(&elb.CreateLoadBalancerPolicyInput{ - LoadBalancerName: loadBalancer.LoadBalancerName, - PolicyName: aws.String(fmt.Sprintf(SSLNegotiationPolicyNameFormat, policyName)), - PolicyTypeName: aws.String("SSLNegotiationPolicyType"), - PolicyAttributes: []*elb.PolicyAttribute{ - { - AttributeName: aws.String("Reference-Security-Policy"), - AttributeValue: aws.String(policyName), - }, - }, - }) - if err != nil { - return fmt.Errorf("error creating security policy on load balancer: %q", err) - } - return nil -} - -func (c *Cloud) setSSLNegotiationPolicy(loadBalancerName, sslPolicyName string, port int64) error { - policyName := fmt.Sprintf(SSLNegotiationPolicyNameFormat, sslPolicyName) - request := &elb.SetLoadBalancerPoliciesOfListenerInput{ - LoadBalancerName: aws.String(loadBalancerName), - LoadBalancerPort: aws.Int64(port), - PolicyNames: []*string{ - aws.String(policyName), - }, - } - klog.V(2).Infof("Setting SSL negotiation policy '%s' on load balancer", policyName) - _, err := c.elb.SetLoadBalancerPoliciesOfListener(request) - if err != nil { - return fmt.Errorf("error setting SSL negotiation policy '%s' on load balancer: %q", policyName, err) - } - return nil -} - -func (c *Cloud) createProxyProtocolPolicy(loadBalancerName string) error { - request := &elb.CreateLoadBalancerPolicyInput{ - LoadBalancerName: aws.String(loadBalancerName), - PolicyName: aws.String(ProxyProtocolPolicyName), - PolicyTypeName: aws.String("ProxyProtocolPolicyType"), - PolicyAttributes: []*elb.PolicyAttribute{ - { - AttributeName: aws.String("ProxyProtocol"), - AttributeValue: aws.String("true"), - }, - }, - } - klog.V(2).Info("Creating proxy protocol policy on load balancer") - _, err := c.elb.CreateLoadBalancerPolicy(request) - if err != nil { - return fmt.Errorf("error creating proxy protocol policy on load balancer: %q", err) - } - - return nil -} - -func (c *Cloud) setBackendPolicies(loadBalancerName string, instancePort int64, policies []*string) error { - request := &elb.SetLoadBalancerPoliciesForBackendServerInput{ - InstancePort: aws.Int64(instancePort), - LoadBalancerName: aws.String(loadBalancerName), - PolicyNames: policies, - } - if len(policies) > 0 { - klog.V(2).Infof("Adding AWS loadbalancer backend policies on node port %d", instancePort) - } else { - klog.V(2).Infof("Removing AWS loadbalancer backend policies on node port %d", instancePort) - } - _, err := c.elb.SetLoadBalancerPoliciesForBackendServer(request) - if err != nil { - return fmt.Errorf("error adjusting AWS loadbalancer backend policies: %q", err) - } - - return nil -} - -func proxyProtocolEnabled(backend *elb.BackendServerDescription) bool { - for _, policy := range backend.PolicyNames { - if aws.StringValue(policy) == ProxyProtocolPolicyName { - return true - } - } - - return false -} - -// findInstancesForELB gets the EC2 instances corresponding to the Nodes, for setting up an ELB -// We ignore Nodes (with a log message) where the instanceid cannot be determined from the provider, -// and we ignore instances which are not found -func (c *Cloud) findInstancesForELB(nodes []*v1.Node, annotations map[string]string) (map[InstanceID]*ec2.Instance, error) { - - targetNodes := filterTargetNodes(nodes, annotations) - - // Map to instance ids ignoring Nodes where we cannot find the id (but logging) - instanceIDs := mapToAWSInstanceIDsTolerant(targetNodes) - - cacheCriteria := cacheCriteria{ - MaxAge: defaultEC2InstanceCacheMaxAge, - HasInstances: instanceIDs, // Refresh if any of the instance ids are missing - } - snapshot, err := c.instanceCache.describeAllInstancesCached(cacheCriteria) - if err != nil { - return nil, err - } - - instances := snapshot.FindInstances(instanceIDs) - // We ignore instances that cannot be found - - return instances, nil -} - -// filterTargetNodes uses node labels to filter the nodes that should be targeted by the ELB, -// checking if all the labels provided in an annotation are present in the nodes -func filterTargetNodes(nodes []*v1.Node, annotations map[string]string) []*v1.Node { - - targetNodeLabels := getKeyValuePropertiesFromAnnotation(annotations, ServiceAnnotationLoadBalancerTargetNodeLabels) - - if len(targetNodeLabels) == 0 { - return nodes - } - - targetNodes := make([]*v1.Node, 0, len(nodes)) - - for _, node := range nodes { - if node.Labels != nil && len(node.Labels) > 0 { - allFiltersMatch := true - - for targetLabelKey, targetLabelValue := range targetNodeLabels { - if nodeLabelValue, ok := node.Labels[targetLabelKey]; !ok || (nodeLabelValue != targetLabelValue && targetLabelValue != "") { - allFiltersMatch = false - break - } - } - - if allFiltersMatch { - targetNodes = append(targetNodes, node) - } - } - } - - return targetNodes -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer_test.go deleted file mode 100644 index 8894d12ce06..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer_test.go +++ /dev/null @@ -1,1081 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - "reflect" - "testing" - "time" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/elb" - "github.com/aws/aws-sdk-go/service/elbv2" - "github.com/stretchr/testify/assert" -) - -func TestElbProtocolsAreEqual(t *testing.T) { - grid := []struct { - L *string - R *string - Expected bool - }{ - { - L: aws.String("http"), - R: aws.String("http"), - Expected: true, - }, - { - L: aws.String("HTTP"), - R: aws.String("http"), - Expected: true, - }, - { - L: aws.String("HTTP"), - R: aws.String("TCP"), - Expected: false, - }, - { - L: aws.String(""), - R: aws.String("TCP"), - Expected: false, - }, - { - L: aws.String(""), - R: aws.String(""), - Expected: true, - }, - { - L: nil, - R: aws.String(""), - Expected: false, - }, - { - L: aws.String(""), - R: nil, - Expected: false, - }, - { - L: nil, - R: nil, - Expected: true, - }, - } - for _, g := range grid { - actual := elbProtocolsAreEqual(g.L, g.R) - if actual != g.Expected { - t.Errorf("unexpected result from protocolsEquals(%v, %v)", g.L, g.R) - } - } -} - -func TestAWSARNEquals(t *testing.T) { - grid := []struct { - L *string - R *string - Expected bool - }{ - { - L: aws.String("arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012"), - R: aws.String("arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012"), - Expected: true, - }, - { - L: aws.String("ARN:AWS:ACM:US-EAST-1:123456789012:CERTIFICATE/12345678-1234-1234-1234-123456789012"), - R: aws.String("arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012"), - Expected: true, - }, - { - L: aws.String("arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012"), - R: aws.String(""), - Expected: false, - }, - { - L: aws.String(""), - R: aws.String(""), - Expected: true, - }, - { - L: nil, - R: aws.String(""), - Expected: false, - }, - { - L: aws.String(""), - R: nil, - Expected: false, - }, - { - L: nil, - R: nil, - Expected: true, - }, - } - for _, g := range grid { - actual := awsArnEquals(g.L, g.R) - if actual != g.Expected { - t.Errorf("unexpected result from awsArnEquals(%v, %v)", g.L, g.R) - } - } -} - -func TestIsNLB(t *testing.T) { - tests := []struct { - name string - - annotations map[string]string - want bool - }{ - { - "NLB annotation provided", - map[string]string{"service.beta.kubernetes.io/aws-load-balancer-type": "nlb"}, - true, - }, - { - "NLB annotation has invalid value", - map[string]string{"service.beta.kubernetes.io/aws-load-balancer-type": "elb"}, - false, - }, - { - "NLB annotation absent", - map[string]string{}, - false, - }, - } - - for _, test := range tests { - t.Logf("Running test case %s", test.name) - got := isNLB(test.annotations) - - if got != test.want { - t.Errorf("Incorrect value for isNLB() case %s. Got %t, expected %t.", test.name, got, test.want) - } - } -} - -func TestIsLBExternal(t *testing.T) { - tests := []struct { - name string - annotations map[string]string - want bool - }{ - { - name: "No annotation", - annotations: map[string]string{}, - want: false, - }, - { - name: "Type NLB", - annotations: map[string]string{"service.beta.kubernetes.io/aws-load-balancer-type": "nlb"}, - want: false, - }, - { - name: "Type NLB-IP", - annotations: map[string]string{"service.beta.kubernetes.io/aws-load-balancer-type": "nlb-ip"}, - want: true, - }, - { - name: "Type External", - annotations: map[string]string{"service.beta.kubernetes.io/aws-load-balancer-type": "external"}, - want: true, - }, - } - for _, test := range tests { - t.Logf("Running test case %s", test.name) - got := isLBExternal(test.annotations) - - if got != test.want { - t.Errorf("Incorrect value for isLBExternal() case %s. Got %t, expected %t.", test.name, got, test.want) - } - } -} - -func TestSyncElbListeners(t *testing.T) { - tests := []struct { - name string - loadBalancerName string - listeners []*elb.Listener - listenerDescriptions []*elb.ListenerDescription - toCreate []*elb.Listener - toDelete []*int64 - }{ - { - name: "no edge cases", - loadBalancerName: "lb_one", - listeners: []*elb.Listener{ - {InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP"), SSLCertificateId: aws.String("abc-123")}, - {InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP"), SSLCertificateId: aws.String("def-456")}, - {InstancePort: aws.Int64(8443), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(8443), Protocol: aws.String("TCP"), SSLCertificateId: aws.String("def-456")}, - }, - listenerDescriptions: []*elb.ListenerDescription{ - {Listener: &elb.Listener{InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}}, - {Listener: &elb.Listener{InstancePort: aws.Int64(8443), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(8443), Protocol: aws.String("TCP"), SSLCertificateId: aws.String("def-456")}}, - }, - toDelete: []*int64{ - aws.Int64(80), - }, - toCreate: []*elb.Listener{ - {InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP"), SSLCertificateId: aws.String("abc-123")}, - {InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP"), SSLCertificateId: aws.String("def-456")}, - }, - }, - { - name: "no listeners to delete", - loadBalancerName: "lb_two", - listeners: []*elb.Listener{ - {InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP"), SSLCertificateId: aws.String("abc-123")}, - {InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP"), SSLCertificateId: aws.String("def-456")}, - }, - listenerDescriptions: []*elb.ListenerDescription{ - {Listener: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP"), SSLCertificateId: aws.String("abc-123")}}, - }, - toCreate: []*elb.Listener{ - {InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP"), SSLCertificateId: aws.String("def-456")}, - }, - toDelete: []*int64{}, - }, - { - name: "no listeners to create", - loadBalancerName: "lb_three", - listeners: []*elb.Listener{ - {InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP"), SSLCertificateId: aws.String("abc-123")}, - }, - listenerDescriptions: []*elb.ListenerDescription{ - {Listener: &elb.Listener{InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}}, - {Listener: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP"), SSLCertificateId: aws.String("abc-123")}}, - }, - toDelete: []*int64{ - aws.Int64(80), - }, - toCreate: []*elb.Listener{}, - }, - { - name: "nil actual listener", - loadBalancerName: "lb_four", - listeners: []*elb.Listener{ - {InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP")}, - }, - listenerDescriptions: []*elb.ListenerDescription{ - {Listener: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP"), SSLCertificateId: aws.String("abc-123")}}, - {Listener: nil}, - }, - toDelete: []*int64{ - aws.Int64(443), - }, - toCreate: []*elb.Listener{ - {InstancePort: aws.Int64(443), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("HTTP")}, - }, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - additions, removals := syncElbListeners(test.loadBalancerName, test.listeners, test.listenerDescriptions) - assert.Equal(t, additions, test.toCreate) - assert.Equal(t, removals, test.toDelete) - }) - } -} - -func TestElbListenersAreEqual(t *testing.T) { - tests := []struct { - name string - expected, actual *elb.Listener - equal bool - }{ - { - name: "should be equal", - expected: &elb.Listener{InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - actual: &elb.Listener{InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - equal: true, - }, - { - name: "instance port should be different", - expected: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - actual: &elb.Listener{InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - equal: false, - }, - { - name: "instance protocol should be different", - expected: &elb.Listener{InstancePort: aws.Int64(80), InstanceProtocol: aws.String("HTTP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - actual: &elb.Listener{InstancePort: aws.Int64(80), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - equal: false, - }, - { - name: "load balancer port should be different", - expected: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(443), Protocol: aws.String("TCP")}, - actual: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - equal: false, - }, - { - name: "protocol should be different", - expected: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("TCP")}, - actual: &elb.Listener{InstancePort: aws.Int64(443), InstanceProtocol: aws.String("TCP"), LoadBalancerPort: aws.Int64(80), Protocol: aws.String("HTTP")}, - equal: false, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - assert.Equal(t, test.equal, elbListenersAreEqual(test.expected, test.actual)) - }) - } -} - -func TestBuildTargetGroupName(t *testing.T) { - type args struct { - serviceName types.NamespacedName - servicePort int64 - nodePort int64 - targetProtocol string - targetType string - nlbConfig nlbPortMapping - } - tests := []struct { - name string - clusterID string - args args - want string - }{ - { - name: "base case", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-a"}, - servicePort: 80, - nodePort: 8080, - targetProtocol: "TCP", - targetType: "instance", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-default-servicea-7fa2e07508", - }, - { - name: "base case & clusterID changed", - clusterID: "cluster-b", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-a"}, - servicePort: 80, - nodePort: 8080, - targetProtocol: "TCP", - targetType: "instance", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-default-servicea-719ee635da", - }, - { - name: "base case & serviceNamespace changed", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "another", Name: "service-a"}, - servicePort: 80, - nodePort: 8080, - targetProtocol: "TCP", - targetType: "instance", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-another-servicea-f66e09847d", - }, - { - name: "base case & serviceName changed", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-b"}, - servicePort: 80, - nodePort: 8080, - targetProtocol: "TCP", - targetType: "instance", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-default-serviceb-196c19c881", - }, - { - name: "base case & servicePort changed", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-a"}, - servicePort: 9090, - nodePort: 8080, - targetProtocol: "TCP", - targetType: "instance", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-default-servicea-06876706cb", - }, - { - name: "base case & nodePort changed", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-a"}, - servicePort: 80, - nodePort: 9090, - targetProtocol: "TCP", - targetType: "instance", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-default-servicea-119f844ec0", - }, - { - name: "base case & targetProtocol changed", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-a"}, - servicePort: 80, - nodePort: 8080, - targetProtocol: "UDP", - targetType: "instance", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-default-servicea-3868761686", - }, - { - name: "base case & targetType changed", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-a"}, - servicePort: 80, - nodePort: 8080, - targetProtocol: "TCP", - targetType: "ip", - nlbConfig: nlbPortMapping{}, - }, - want: "k8s-default-servicea-0fa31f4b0f", - }, - { - name: "custom healthcheck config", - clusterID: "cluster-a", - args: args{ - serviceName: types.NamespacedName{Namespace: "default", Name: "service-a"}, - servicePort: 80, - nodePort: 8080, - targetProtocol: "TCP", - targetType: "ip", - nlbConfig: nlbPortMapping{ - HealthCheckConfig: healthCheckConfig{ - Protocol: "HTTP", - Interval: 10, - }, - }, - }, - want: "k8s-default-servicea-4028e49618", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Cloud{ - tagging: awsTagging{ClusterID: tt.clusterID}, - } - if got := c.buildTargetGroupName(tt.args.serviceName, tt.args.servicePort, tt.args.nodePort, tt.args.targetProtocol, tt.args.targetType, tt.args.nlbConfig); got != tt.want { - assert.Equal(t, tt.want, got) - } - }) - } -} - -func TestFilterTargetNodes(t *testing.T) { - tests := []struct { - name string - nodeLabels, annotations map[string]string - nodeTargeted bool - }{ - { - name: "when no filter is provided, node should be targeted", - nodeLabels: map[string]string{"k1": "v1"}, - nodeTargeted: true, - }, - { - name: "when all key-value filters match, node should be targeted", - nodeLabels: map[string]string{"k1": "v1", "k2": "v2"}, - annotations: map[string]string{ServiceAnnotationLoadBalancerTargetNodeLabels: "k1=v1,k2=v2"}, - nodeTargeted: true, - }, - { - name: "when all just-key filter match, node should be targeted", - nodeLabels: map[string]string{"k1": "v1", "k2": "v2"}, - annotations: map[string]string{ServiceAnnotationLoadBalancerTargetNodeLabels: "k1,k2"}, - nodeTargeted: true, - }, - { - name: "when some filters do not match, node should not be targeted", - nodeLabels: map[string]string{"k1": "v1"}, - annotations: map[string]string{ServiceAnnotationLoadBalancerTargetNodeLabels: "k1=v1,k2"}, - nodeTargeted: false, - }, - { - name: "when no filter matches, node should not be targeted", - nodeLabels: map[string]string{"k1": "v1", "k2": "v2"}, - annotations: map[string]string{ServiceAnnotationLoadBalancerTargetNodeLabels: "k3=v3"}, - nodeTargeted: false, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - node := &v1.Node{} - node.Labels = test.nodeLabels - - nodes := []*v1.Node{node} - targetNodes := filterTargetNodes(nodes, test.annotations) - - if test.nodeTargeted { - assert.Equal(t, nodes, targetNodes) - } else { - assert.Empty(t, targetNodes) - } - }) - } -} - -func makeNodeInstancePair(offset int) (*v1.Node, *ec2.Instance) { - instanceID := fmt.Sprintf("i-%x", int64(0x03bcc3496da09f78e)+int64(offset)) - instance := &ec2.Instance{ - InstanceId: aws.String(instanceID), - Placement: &ec2.Placement{ - AvailabilityZone: aws.String("us-east-1b"), - }, - PrivateDnsName: aws.String(fmt.Sprintf("ip-192-168-32-%d.ec2.internal", 101+offset)), - PrivateIpAddress: aws.String(fmt.Sprintf("192.168.32.%d", 101+offset)), - PublicIpAddress: aws.String(fmt.Sprintf("1.2.3.%d", 1+offset)), - } - - var tag ec2.Tag - tag.Key = aws.String(fmt.Sprintf("%s%s", TagNameKubernetesClusterPrefix, TestClusterID)) - tag.Value = aws.String("owned") - instance.Tags = []*ec2.Tag{&tag} - - node := &v1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("ip-192-168-0-%d.ec2.internal", 101+offset), - }, - Spec: v1.NodeSpec{ - ProviderID: fmt.Sprintf("aws:///us-east-1b/%s", instanceID), - }, - } - return node, instance -} - -func TestCloud_findInstancesForELB(t *testing.T) { - defaultNode := &v1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: "ip-172-20-0-100.ec2.internal", - }, - Spec: v1.NodeSpec{ - ProviderID: "aws:///us-east-1a/i-self", - }, - } - newNode, newInstance := makeNodeInstancePair(1) - awsServices := NewFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - - want := map[InstanceID]*ec2.Instance{ - "i-self": awsServices.selfInstance, - } - got, err := c.findInstancesForELB([]*v1.Node{defaultNode}, nil) - assert.NoError(t, err) - assert.True(t, reflect.DeepEqual(want, got)) - - // Add a new EC2 instance - awsServices.instances = append(awsServices.instances, newInstance) - want = map[InstanceID]*ec2.Instance{ - "i-self": awsServices.selfInstance, - InstanceID(aws.StringValue(newInstance.InstanceId)): newInstance, - } - got, err = c.findInstancesForELB([]*v1.Node{defaultNode, newNode}, nil) - assert.NoError(t, err) - assert.True(t, reflect.DeepEqual(want, got)) - - // Verify existing instance cache gets used - cacheExpiryOld := c.instanceCache.snapshot.timestamp - got, err = c.findInstancesForELB([]*v1.Node{defaultNode, newNode}, nil) - assert.NoError(t, err) - assert.True(t, reflect.DeepEqual(want, got)) - cacheExpiryNew := c.instanceCache.snapshot.timestamp - assert.Equal(t, cacheExpiryOld, cacheExpiryNew) - - // Force cache expiry and verify cache gets updated with new timestamp - cacheExpiryOld = c.instanceCache.snapshot.timestamp - c.instanceCache.snapshot.timestamp = c.instanceCache.snapshot.timestamp.Add(-(defaultEC2InstanceCacheMaxAge + 1*time.Second)) - got, err = c.findInstancesForELB([]*v1.Node{defaultNode, newNode}, nil) - assert.NoError(t, err) - assert.True(t, reflect.DeepEqual(want, got)) - cacheExpiryNew = c.instanceCache.snapshot.timestamp - assert.True(t, cacheExpiryNew.After(cacheExpiryOld)) -} - -func TestCloud_chunkTargetDescriptions(t *testing.T) { - type args struct { - targets []*elbv2.TargetDescription - chunkSize int - } - tests := []struct { - name string - args args - want [][]*elbv2.TargetDescription - }{ - { - name: "can be evenly chunked", - args: args{ - targets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - chunkSize: 2, - }, - want: [][]*elbv2.TargetDescription{ - { - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - }, - { - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - }, - }, - { - name: "cannot be evenly chunked", - args: args{ - targets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - chunkSize: 3, - }, - want: [][]*elbv2.TargetDescription{ - { - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - }, - { - - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - }, - }, - { - name: "chunkSize equal to total count", - args: args{ - targets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - chunkSize: 4, - }, - want: [][]*elbv2.TargetDescription{ - { - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - }, - }, - { - name: "chunkSize greater than total count", - args: args{ - targets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - chunkSize: 10, - }, - want: [][]*elbv2.TargetDescription{ - { - { - Id: aws.String("i-abcdefg1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg3"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdefg4"), - Port: aws.Int64(8080), - }, - }, - }, - }, - { - name: "chunk nil slice", - args: args{ - targets: nil, - chunkSize: 2, - }, - want: nil, - }, - { - name: "chunk empty slice", - args: args{ - targets: []*elbv2.TargetDescription{}, - chunkSize: 2, - }, - want: nil, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Cloud{} - got := c.chunkTargetDescriptions(tt.args.targets, tt.args.chunkSize) - assert.Equal(t, tt.want, got) - }) - } -} - -func TestCloud_diffTargetGroupTargets(t *testing.T) { - type args struct { - expectedTargets []*elbv2.TargetDescription - actualTargets []*elbv2.TargetDescription - } - tests := []struct { - name string - args args - wantTargetsToRegister []*elbv2.TargetDescription - wantTargetsToDeregister []*elbv2.TargetDescription - }{ - { - name: "all targets to register", - args: args{ - expectedTargets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - }, - actualTargets: nil, - }, - wantTargetsToRegister: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - }, - wantTargetsToDeregister: nil, - }, - { - name: "all targets to deregister", - args: args{ - expectedTargets: nil, - actualTargets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - }, - }, - wantTargetsToRegister: nil, - wantTargetsToDeregister: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - }, - }, - { - name: "some targets to register and deregister", - args: args{ - expectedTargets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef4"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef5"), - Port: aws.Int64(8080), - }, - }, - actualTargets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef3"), - Port: aws.Int64(8080), - }, - }, - }, - wantTargetsToRegister: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef4"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef5"), - Port: aws.Int64(8080), - }, - }, - wantTargetsToDeregister: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef3"), - Port: aws.Int64(8080), - }, - }, - }, - { - name: "both expected and actual targets are empty", - args: args{ - expectedTargets: nil, - actualTargets: nil, - }, - wantTargetsToRegister: nil, - wantTargetsToDeregister: nil, - }, - { - name: "expected and actual targets equals", - args: args{ - expectedTargets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef3"), - Port: aws.Int64(8080), - }, - }, - actualTargets: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef3"), - Port: aws.Int64(8080), - }, - }, - }, - wantTargetsToRegister: nil, - wantTargetsToDeregister: nil, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Cloud{} - gotTargetsToRegister, gotTargetsToDeregister := c.diffTargetGroupTargets(tt.args.expectedTargets, tt.args.actualTargets) - assert.Equal(t, tt.wantTargetsToRegister, gotTargetsToRegister) - assert.Equal(t, tt.wantTargetsToDeregister, gotTargetsToDeregister) - }) - } -} - -func TestCloud_computeTargetGroupExpectedTargets(t *testing.T) { - type args struct { - instanceIDs []string - port int64 - } - tests := []struct { - name string - args args - want []*elbv2.TargetDescription - }{ - { - name: "no instance", - args: args{ - instanceIDs: nil, - port: 8080, - }, - want: []*elbv2.TargetDescription{}, - }, - { - name: "one instance", - args: args{ - instanceIDs: []string{"i-abcdef1"}, - port: 8080, - }, - want: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - }, - }, - { - name: "multiple instances", - args: args{ - instanceIDs: []string{"i-abcdef1", "i-abcdef2", "i-abcdef3"}, - port: 8080, - }, - want: []*elbv2.TargetDescription{ - { - Id: aws.String("i-abcdef1"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef2"), - Port: aws.Int64(8080), - }, - { - Id: aws.String("i-abcdef3"), - Port: aws.Int64(8080), - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Cloud{} - got := c.computeTargetGroupExpectedTargets(tt.args.instanceIDs, tt.args.port) - assert.Equal(t, tt.want, got) - }) - } -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_metrics.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_metrics.go deleted file mode 100644 index 0f01c7e3d09..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_metrics.go +++ /dev/null @@ -1,75 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "sync" - - "k8s.io/component-base/metrics" - "k8s.io/component-base/metrics/legacyregistry" -) - -var ( - awsAPIMetric = metrics.NewHistogramVec( - &metrics.HistogramOpts{ - Name: "cloudprovider_aws_api_request_duration_seconds", - Help: "Latency of AWS API calls", - StabilityLevel: metrics.ALPHA, - }, - []string{"request"}) - - awsAPIErrorMetric = metrics.NewCounterVec( - &metrics.CounterOpts{ - Name: "cloudprovider_aws_api_request_errors", - Help: "AWS API errors", - StabilityLevel: metrics.ALPHA, - }, - []string{"request"}) - - awsAPIThrottlesMetric = metrics.NewCounterVec( - &metrics.CounterOpts{ - Name: "cloudprovider_aws_api_throttled_requests_total", - Help: "AWS API throttled requests", - StabilityLevel: metrics.ALPHA, - }, - []string{"operation_name"}) -) - -func recordAWSMetric(actionName string, timeTaken float64, err error) { - if err != nil { - awsAPIErrorMetric.With(metrics.Labels{"request": actionName}).Inc() - } else { - awsAPIMetric.With(metrics.Labels{"request": actionName}).Observe(timeTaken) - } -} - -func recordAWSThrottlesMetric(operation string) { - awsAPIThrottlesMetric.With(metrics.Labels{"operation_name": operation}).Inc() -} - -var registerOnce sync.Once - -func registerMetrics() { - registerOnce.Do(func() { - legacyregistry.MustRegister(awsAPIMetric) - legacyregistry.MustRegister(awsAPIErrorMetric) - legacyregistry.MustRegister(awsAPIThrottlesMetric) - }) -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_routes.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_routes.go deleted file mode 100644 index 6aed26db31c..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_routes.go +++ /dev/null @@ -1,222 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "context" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" - "k8s.io/klog/v2" - - cloudprovider "k8s.io/cloud-provider" -) - -func (c *Cloud) findRouteTable(clusterName string) (*ec2.RouteTable, error) { - // This should be unnecessary (we already filter on TagNameKubernetesCluster, - // and something is broken if cluster name doesn't match, but anyway... - // TODO: All clouds should be cluster-aware by default - var tables []*ec2.RouteTable - - if c.cfg.Global.RouteTableID != "" { - request := &ec2.DescribeRouteTablesInput{Filters: []*ec2.Filter{newEc2Filter("route-table-id", c.cfg.Global.RouteTableID)}} - response, err := c.ec2.DescribeRouteTables(request) - if err != nil { - return nil, err - } - - tables = response - } else { - request := &ec2.DescribeRouteTablesInput{} - response, err := c.ec2.DescribeRouteTables(request) - if err != nil { - return nil, err - } - - for _, table := range response { - if c.tagging.hasClusterTag(table.Tags) { - tables = append(tables, table) - } - } - } - - if len(tables) == 0 { - return nil, fmt.Errorf("unable to find route table for AWS cluster: %s", clusterName) - } - - if len(tables) != 1 { - return nil, fmt.Errorf("found multiple matching AWS route tables for AWS cluster: %s", clusterName) - } - return tables[0], nil -} - -// ListRoutes implements Routes.ListRoutes -// List all routes that match the filter -func (c *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error) { - table, err := c.findRouteTable(clusterName) - if err != nil { - return nil, err - } - - var routes []*cloudprovider.Route - var instanceIDs []*string - - for _, r := range table.Routes { - instanceID := aws.StringValue(r.InstanceId) - - if instanceID == "" { - continue - } - - instanceIDs = append(instanceIDs, &instanceID) - } - - instances, err := c.getInstancesByIDs(instanceIDs) - if err != nil { - return nil, err - } - - for _, r := range table.Routes { - destinationCIDR := aws.StringValue(r.DestinationCidrBlock) - if destinationCIDR == "" { - continue - } - - route := &cloudprovider.Route{ - Name: clusterName + "-" + destinationCIDR, - DestinationCIDR: destinationCIDR, - } - - // Capture blackhole routes - if aws.StringValue(r.State) == ec2.RouteStateBlackhole { - route.Blackhole = true - routes = append(routes, route) - continue - } - - // Capture instance routes - instanceID := aws.StringValue(r.InstanceId) - if instanceID != "" { - instance, found := instances[instanceID] - if found { - route.TargetNode = mapInstanceToNodeName(instance) - routes = append(routes, route) - } else { - klog.Warningf("unable to find instance ID %s in the list of instances being routed to", instanceID) - } - } - } - - return routes, nil -} - -// Sets the instance attribute "source-dest-check" to the specified value -func (c *Cloud) configureInstanceSourceDestCheck(instanceID string, sourceDestCheck bool) error { - request := &ec2.ModifyInstanceAttributeInput{} - request.InstanceId = aws.String(instanceID) - request.SourceDestCheck = &ec2.AttributeBooleanValue{Value: aws.Bool(sourceDestCheck)} - - _, err := c.ec2.ModifyInstanceAttribute(request) - if err != nil { - return fmt.Errorf("error configuring source-dest-check on instance %s: %q", instanceID, err) - } - return nil -} - -// CreateRoute implements Routes.CreateRoute -// Create the described route -func (c *Cloud) CreateRoute(ctx context.Context, clusterName string, nameHint string, route *cloudprovider.Route) error { - instance, err := c.getInstanceByNodeName(route.TargetNode) - if err != nil { - return err - } - - // In addition to configuring the route itself, we also need to configure the instance to accept that traffic - // On AWS, this requires turning source-dest checks off - err = c.configureInstanceSourceDestCheck(aws.StringValue(instance.InstanceId), false) - if err != nil { - return err - } - - table, err := c.findRouteTable(clusterName) - if err != nil { - return err - } - - var deleteRoute *ec2.Route - for _, r := range table.Routes { - destinationCIDR := aws.StringValue(r.DestinationCidrBlock) - - if destinationCIDR != route.DestinationCIDR { - continue - } - - if aws.StringValue(r.State) == ec2.RouteStateBlackhole { - deleteRoute = r - } - } - - if deleteRoute != nil { - klog.Infof("deleting blackholed route: %s", aws.StringValue(deleteRoute.DestinationCidrBlock)) - - request := &ec2.DeleteRouteInput{} - request.DestinationCidrBlock = deleteRoute.DestinationCidrBlock - request.RouteTableId = table.RouteTableId - - _, err = c.ec2.DeleteRoute(request) - if err != nil { - return fmt.Errorf("error deleting blackholed AWS route (%s): %q", aws.StringValue(deleteRoute.DestinationCidrBlock), err) - } - } - - request := &ec2.CreateRouteInput{} - // TODO: use ClientToken for idempotency? - request.DestinationCidrBlock = aws.String(route.DestinationCIDR) - request.InstanceId = instance.InstanceId - request.RouteTableId = table.RouteTableId - - _, err = c.ec2.CreateRoute(request) - if err != nil { - return fmt.Errorf("error creating AWS route (%s): %q", route.DestinationCIDR, err) - } - - return nil -} - -// DeleteRoute implements Routes.DeleteRoute -// Delete the specified route -func (c *Cloud) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error { - table, err := c.findRouteTable(clusterName) - if err != nil { - return err - } - - request := &ec2.DeleteRouteInput{} - request.DestinationCidrBlock = aws.String(route.DestinationCIDR) - request.RouteTableId = table.RouteTableId - - _, err = c.ec2.DeleteRoute(request) - if err != nil { - return fmt.Errorf("error deleting AWS route (%s): %q", route.DestinationCIDR, err) - } - - return nil -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go deleted file mode 100644 index 9b7a172c499..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go +++ /dev/null @@ -1,3578 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "context" - "errors" - "fmt" - "io" - "math/rand" - "reflect" - "sort" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/elb" - "github.com/aws/aws-sdk-go/service/elbv2" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/intstr" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/client-go/informers" - "k8s.io/client-go/kubernetes/fake" - cloudvolume "k8s.io/cloud-provider/volume" -) - -const TestClusterID = "clusterid.test" -const TestClusterName = "testCluster" - -type MockedFakeEC2 struct { - *FakeEC2Impl - mock.Mock -} - -func (m *MockedFakeEC2) expectDescribeSecurityGroups(clusterID, groupName string) { - tags := []*ec2.Tag{ - {Key: aws.String(TagNameKubernetesClusterLegacy), Value: aws.String(clusterID)}, - {Key: aws.String(fmt.Sprintf("%s%s", TagNameKubernetesClusterPrefix, clusterID)), Value: aws.String(ResourceLifecycleOwned)}, - } - - m.On("DescribeSecurityGroups", &ec2.DescribeSecurityGroupsInput{Filters: []*ec2.Filter{ - newEc2Filter("group-name", groupName), - newEc2Filter("vpc-id", ""), - }}).Return([]*ec2.SecurityGroup{{Tags: tags}}) -} - -func (m *MockedFakeEC2) DescribeVolumes(request *ec2.DescribeVolumesInput) ([]*ec2.Volume, error) { - args := m.Called(request) - return args.Get(0).([]*ec2.Volume), nil -} - -func (m *MockedFakeEC2) DeleteVolume(request *ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error) { - args := m.Called(request) - return args.Get(0).(*ec2.DeleteVolumeOutput), nil -} - -func (m *MockedFakeEC2) DescribeSecurityGroups(request *ec2.DescribeSecurityGroupsInput) ([]*ec2.SecurityGroup, error) { - args := m.Called(request) - return args.Get(0).([]*ec2.SecurityGroup), nil -} - -func (m *MockedFakeEC2) CreateVolume(request *ec2.CreateVolumeInput) (*ec2.Volume, error) { - // mock requires stable input, and in CreateDisk we invoke buildTags which uses - // a map to create tags, which then get converted into an array. This leads to - // unstable sorting order which confuses mock. Sorted tags are not needed in - // regular code, but are a must in tests here: - for i := 0; i < len(request.TagSpecifications); i++ { - if request.TagSpecifications[i] == nil { - continue - } - tags := request.TagSpecifications[i].Tags - sort.Slice(tags, func(i, j int) bool { - if tags[i] == nil && tags[j] != nil { - return false - } - if tags[i] != nil && tags[j] == nil { - return true - } - return *tags[i].Key < *tags[j].Key - }) - } - args := m.Called(request) - return args.Get(0).(*ec2.Volume), nil -} - -type MockedFakeELB struct { - *FakeELB - mock.Mock -} - -func (m *MockedFakeELB) DescribeLoadBalancers(input *elb.DescribeLoadBalancersInput) (*elb.DescribeLoadBalancersOutput, error) { - args := m.Called(input) - return args.Get(0).(*elb.DescribeLoadBalancersOutput), nil -} - -func (m *MockedFakeELB) expectDescribeLoadBalancers(loadBalancerName string) { - m.On("DescribeLoadBalancers", &elb.DescribeLoadBalancersInput{LoadBalancerNames: []*string{aws.String(loadBalancerName)}}).Return(&elb.DescribeLoadBalancersOutput{ - LoadBalancerDescriptions: []*elb.LoadBalancerDescription{{}}, - }) -} - -func (m *MockedFakeELB) AddTags(input *elb.AddTagsInput) (*elb.AddTagsOutput, error) { - args := m.Called(input) - return args.Get(0).(*elb.AddTagsOutput), nil -} - -func (m *MockedFakeELB) ConfigureHealthCheck(input *elb.ConfigureHealthCheckInput) (*elb.ConfigureHealthCheckOutput, error) { - args := m.Called(input) - if args.Get(0) == nil { - return nil, args.Error(1) - } - return args.Get(0).(*elb.ConfigureHealthCheckOutput), args.Error(1) -} - -func (m *MockedFakeELB) expectConfigureHealthCheck(loadBalancerName *string, expectedHC *elb.HealthCheck, returnErr error) { - expected := &elb.ConfigureHealthCheckInput{HealthCheck: expectedHC, LoadBalancerName: loadBalancerName} - call := m.On("ConfigureHealthCheck", expected) - if returnErr != nil { - call.Return(nil, returnErr) - } else { - call.Return(&elb.ConfigureHealthCheckOutput{}, nil) - } -} - -func TestReadAWSCloudConfig(t *testing.T) { - tests := []struct { - name string - - reader io.Reader - aws Services - - expectError bool - zone string - }{ - { - "No config reader", - nil, nil, - true, "", - }, - { - "Empty config, no metadata", - strings.NewReader(""), nil, - true, "", - }, - { - "No zone in config, no metadata", - strings.NewReader("[global]\n"), nil, - true, "", - }, - { - "Zone in config, no metadata", - strings.NewReader("[global]\nzone = eu-west-1a"), nil, - false, "eu-west-1a", - }, - { - "No zone in config, metadata does not have zone", - strings.NewReader("[global]\n"), newMockedFakeAWSServices(TestClusterID).WithAz(""), - true, "", - }, - { - "No zone in config, metadata has zone", - strings.NewReader("[global]\n"), newMockedFakeAWSServices(TestClusterID), - false, "us-east-1a", - }, - { - "Zone in config should take precedence over metadata", - strings.NewReader("[global]\nzone = eu-west-1a"), newMockedFakeAWSServices(TestClusterID), - false, "eu-west-1a", - }, - } - - for _, test := range tests { - t.Logf("Running test case %s", test.name) - var metadata EC2Metadata - if test.aws != nil { - metadata, _ = test.aws.Metadata() - } - cfg, err := readAWSCloudConfig(test.reader) - if err == nil { - err = updateConfigZone(cfg, metadata) - } - if test.expectError { - if err == nil { - t.Errorf("Should error for case %s (cfg=%v)", test.name, cfg) - } - } else { - if err != nil { - t.Errorf("Should succeed for case: %s", test.name) - } - if cfg.Global.Zone != test.zone { - t.Errorf("Incorrect zone value (%s vs %s) for case: %s", - cfg.Global.Zone, test.zone, test.name) - } - } - } -} - -type ServiceDescriptor struct { - name string - region string - signingRegion, signingMethod string - signingName string -} - -func TestOverridesActiveConfig(t *testing.T) { - tests := []struct { - name string - - reader io.Reader - aws Services - - expectError bool - active bool - servicesOverridden []ServiceDescriptor - }{ - { - "No overrides", - strings.NewReader(` - [global] - `), - nil, - false, false, - []ServiceDescriptor{}, - }, - { - "Missing Service Name", - strings.NewReader(` - [global] - - [ServiceOverride "1"] - Region=sregion - URL=https://s3.foo.bar - SigningRegion=sregion - SigningMethod = sign - `), - nil, - true, false, - []ServiceDescriptor{}, - }, - { - "Missing Service Region", - strings.NewReader(` - [global] - - [ServiceOverride "1"] - Service=s3 - URL=https://s3.foo.bar - SigningRegion=sregion - SigningMethod = sign - `), - nil, - true, false, - []ServiceDescriptor{}, - }, - { - "Missing URL", - strings.NewReader(` - [global] - - [ServiceOverride "1"] - Service="s3" - Region=sregion - SigningRegion=sregion - SigningMethod = sign - `), - nil, - true, false, - []ServiceDescriptor{}, - }, - { - "Missing Signing Region", - strings.NewReader(` - [global] - - [ServiceOverride "1"] - Service=s3 - Region=sregion - URL=https://s3.foo.bar - SigningMethod = sign - `), - nil, - true, false, - []ServiceDescriptor{}, - }, - { - "Active Overrides", - strings.NewReader(` - [Global] - - [ServiceOverride "1"] - Service = "s3 " - Region = sregion - URL = https://s3.foo.bar - SigningRegion = sregion - SigningMethod = v4 - `), - nil, - false, true, - []ServiceDescriptor{{name: "s3", region: "sregion", signingRegion: "sregion", signingMethod: "v4"}}, - }, - { - "Multiple Overridden Services", - strings.NewReader(` - [Global] - vpc = vpc-abc1234567 - - [ServiceOverride "1"] - Service=s3 - Region=sregion1 - URL=https://s3.foo.bar - SigningRegion=sregion1 - SigningMethod = v4 - - [ServiceOverride "2"] - Service=ec2 - Region=sregion2 - URL=https://ec2.foo.bar - SigningRegion=sregion2 - SigningMethod = v4`), - nil, - false, true, - []ServiceDescriptor{{name: "s3", region: "sregion1", signingRegion: "sregion1", signingMethod: "v4"}, - {name: "ec2", region: "sregion2", signingRegion: "sregion2", signingMethod: "v4"}}, - }, - { - "Duplicate Services", - strings.NewReader(` - [Global] - vpc = vpc-abc1234567 - - [ServiceOverride "1"] - Service=s3 - Region=sregion1 - URL=https://s3.foo.bar - SigningRegion=sregion - SigningMethod = sign - - [ServiceOverride "2"] - Service=s3 - Region=sregion1 - URL=https://s3.foo.bar - SigningRegion=sregion - SigningMethod = sign`), - nil, - true, false, - []ServiceDescriptor{}, - }, - { - "Multiple Overridden Services in Multiple regions", - strings.NewReader(` - [global] - - [ServiceOverride "1"] - Service=s3 - Region=region1 - URL=https://s3.foo.bar - SigningRegion=sregion1 - - [ServiceOverride "2"] - Service=ec2 - Region=region2 - URL=https://ec2.foo.bar - SigningRegion=sregion - SigningMethod = v4 - `), - nil, - false, true, - []ServiceDescriptor{{name: "s3", region: "region1", signingRegion: "sregion1", signingMethod: ""}, - {name: "ec2", region: "region2", signingRegion: "sregion", signingMethod: "v4"}}, - }, - { - "Multiple regions, Same Service", - strings.NewReader(` - [global] - - [ServiceOverride "1"] - Service=s3 - Region=region1 - URL=https://s3.foo.bar - SigningRegion=sregion1 - SigningMethod = v3 - - [ServiceOverride "2"] - Service=s3 - Region=region2 - URL=https://s3.foo.bar - SigningRegion=sregion1 - SigningMethod = v4 - SigningName = "name" - `), - nil, - false, true, - []ServiceDescriptor{{name: "s3", region: "region1", signingRegion: "sregion1", signingMethod: "v3"}, - {name: "s3", region: "region2", signingRegion: "sregion1", signingMethod: "v4", signingName: "name"}}, - }, - } - - for _, test := range tests { - t.Logf("Running test case %s", test.name) - cfg, err := readAWSCloudConfig(test.reader) - if err == nil { - err = cfg.validateOverrides() - } - if test.expectError { - if err == nil { - t.Errorf("Should error for case %s (cfg=%v)", test.name, cfg) - } - } else { - if err != nil { - t.Errorf("Should succeed for case: %s, got %v", test.name, err) - } - - if len(cfg.ServiceOverride) != len(test.servicesOverridden) { - t.Errorf("Expected %d overridden services, received %d for case %s", - len(test.servicesOverridden), len(cfg.ServiceOverride), test.name) - } else { - for _, sd := range test.servicesOverridden { - var found *struct { - Service string - Region string - URL string - SigningRegion string - SigningMethod string - SigningName string - } - for _, v := range cfg.ServiceOverride { - if v.Service == sd.name && v.Region == sd.region { - found = v - break - } - } - if found == nil { - t.Errorf("Missing override for service %s in case %s", - sd.name, test.name) - } else { - if found.SigningRegion != sd.signingRegion { - t.Errorf("Expected signing region '%s', received '%s' for case %s", - sd.signingRegion, found.SigningRegion, test.name) - } - if found.SigningMethod != sd.signingMethod { - t.Errorf("Expected signing method '%s', received '%s' for case %s", - sd.signingMethod, found.SigningRegion, test.name) - } - targetName := fmt.Sprintf("https://%s.foo.bar", sd.name) - if found.URL != targetName { - t.Errorf("Expected Endpoint '%s', received '%s' for case %s", - targetName, found.URL, test.name) - } - if found.SigningName != sd.signingName { - t.Errorf("Expected signing name '%s', received '%s' for case %s", - sd.signingName, found.SigningName, test.name) - } - - fn := cfg.getResolver() - ep1, e := fn(sd.name, sd.region, nil) - if e != nil { - t.Errorf("Expected a valid endpoint for %s in case %s", - sd.name, test.name) - } else { - targetName := fmt.Sprintf("https://%s.foo.bar", sd.name) - if ep1.URL != targetName { - t.Errorf("Expected endpoint url: %s, received %s in case %s", - targetName, ep1.URL, test.name) - } - if ep1.SigningRegion != sd.signingRegion { - t.Errorf("Expected signing region '%s', received '%s' in case %s", - sd.signingRegion, ep1.SigningRegion, test.name) - } - if ep1.SigningMethod != sd.signingMethod { - t.Errorf("Expected signing method '%s', received '%s' in case %s", - sd.signingMethod, ep1.SigningRegion, test.name) - } - } - } - } - } - } - } -} - -func TestNewAWSCloud(t *testing.T) { - tests := []struct { - name string - - reader io.Reader - awsServices Services - - expectError bool - region string - }{ - { - "No config reader", - nil, newMockedFakeAWSServices(TestClusterID).WithAz(""), - true, "", - }, - { - "Config specifies valid zone", - strings.NewReader("[global]\nzone = eu-west-1a"), newMockedFakeAWSServices(TestClusterID), - false, "eu-west-1", - }, - { - "Gets zone from metadata when not in config", - strings.NewReader("[global]\n"), - newMockedFakeAWSServices(TestClusterID), - false, "us-east-1", - }, - { - "No zone in config or metadata", - strings.NewReader("[global]\n"), - newMockedFakeAWSServices(TestClusterID).WithAz(""), - true, "", - }, - } - - for _, test := range tests { - t.Logf("Running test case %s", test.name) - cfg, err := readAWSCloudConfig(test.reader) - var c *Cloud - if err == nil { - c, err = newAWSCloud(*cfg, test.awsServices) - } - if test.expectError { - if err == nil { - t.Errorf("Should error for case %s", test.name) - } - } else { - if err != nil { - t.Errorf("Should succeed for case: %s, got %v", test.name, err) - } else if c.region != test.region { - t.Errorf("Incorrect region value (%s vs %s) for case: %s", - c.region, test.region, test.name) - } - } - } -} - -func mockInstancesResp(selfInstance *ec2.Instance, instances []*ec2.Instance) (*Cloud, *FakeAWSServices) { - awsServices := newMockedFakeAWSServices(TestClusterID) - awsServices.instances = instances - awsServices.selfInstance = selfInstance - awsCloud, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - panic(err) - } - awsCloud.kubeClient = fake.NewSimpleClientset() - return awsCloud, awsServices -} - -func mockAvailabilityZone(availabilityZone string) *Cloud { - awsServices := newMockedFakeAWSServices(TestClusterID).WithAz(availabilityZone) - awsCloud, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - panic(err) - } - awsCloud.kubeClient = fake.NewSimpleClientset() - return awsCloud -} - -func testHasNodeAddress(t *testing.T, addrs []v1.NodeAddress, addressType v1.NodeAddressType, address string) { - for _, addr := range addrs { - if addr.Type == addressType && addr.Address == address { - return - } - } - t.Errorf("Did not find expected address: %s:%s in %v", addressType, address, addrs) -} - -func makeInstance(num int, privateIP, publicIP, privateDNSName, publicDNSName string, setNetInterface bool) ec2.Instance { - var tag ec2.Tag - tag.Key = aws.String(TagNameKubernetesClusterLegacy) - tag.Value = aws.String(TestClusterID) - tags := []*ec2.Tag{&tag} - - instance := ec2.Instance{ - InstanceId: aws.String(fmt.Sprintf("i-%d", num)), - PrivateDnsName: aws.String(privateDNSName), - PrivateIpAddress: aws.String(privateIP), - PublicDnsName: aws.String(publicDNSName), - PublicIpAddress: aws.String(publicIP), - InstanceType: aws.String("c3.large"), - Tags: tags, - Placement: &ec2.Placement{AvailabilityZone: aws.String("us-east-1a")}, - State: &ec2.InstanceState{ - Name: aws.String("running"), - }, - } - if setNetInterface == true { - instance.NetworkInterfaces = []*ec2.InstanceNetworkInterface{ - { - Status: aws.String(ec2.NetworkInterfaceStatusInUse), - PrivateIpAddresses: []*ec2.InstancePrivateIpAddress{ - { - PrivateIpAddress: aws.String(privateIP), - }, - }, - }, - } - } - return instance -} - -func TestNodeAddresses(t *testing.T) { - // Note instance0 and instance1 have the same name - // (we test that this produces an error) - instance0 := makeInstance(0, "192.168.0.1", "1.2.3.4", "instance-same.ec2.internal", "instance-same.ec2.external", true) - instance1 := makeInstance(1, "192.168.0.2", "", "instance-same.ec2.internal", "", false) - instance2 := makeInstance(2, "192.168.0.1", "1.2.3.4", "instance-other.ec2.internal", "", false) - instances := []*ec2.Instance{&instance0, &instance1, &instance2} - - aws1, _ := mockInstancesResp(&instance0, []*ec2.Instance{&instance0}) - _, err1 := aws1.NodeAddresses(context.TODO(), "instance-mismatch.ec2.internal") - if err1 == nil { - t.Errorf("Should error when no instance found") - } - - aws2, _ := mockInstancesResp(&instance2, instances) - _, err2 := aws2.NodeAddresses(context.TODO(), "instance-same.ec2.internal") - if err2 == nil { - t.Errorf("Should error when multiple instances found") - } - - aws3, _ := mockInstancesResp(&instance0, instances[0:1]) - // change node name so it uses the instance instead of metadata - aws3.selfAWSInstance.nodeName = "foo" - addrs3, err3 := aws3.NodeAddresses(context.TODO(), "instance-same.ec2.internal") - if err3 != nil { - t.Errorf("Should not error when instance found") - } - if len(addrs3) != 5 { - t.Errorf("Should return exactly 5 NodeAddresses") - } - testHasNodeAddress(t, addrs3, v1.NodeInternalIP, "192.168.0.1") - testHasNodeAddress(t, addrs3, v1.NodeExternalIP, "1.2.3.4") - testHasNodeAddress(t, addrs3, v1.NodeExternalDNS, "instance-same.ec2.external") - testHasNodeAddress(t, addrs3, v1.NodeInternalDNS, "instance-same.ec2.internal") - testHasNodeAddress(t, addrs3, v1.NodeHostName, "instance-same.ec2.internal") -} - -func TestNodeAddressesWithMetadata(t *testing.T) { - instance := makeInstance(0, "", "2.3.4.5", "instance.ec2.internal", "", false) - instances := []*ec2.Instance{&instance} - awsCloud, awsServices := mockInstancesResp(&instance, instances) - - awsServices.networkInterfacesMacs = []string{"0a:77:89:f3:9c:f6", "0a:26:64:c4:6a:48"} - awsServices.networkInterfacesPrivateIPs = [][]string{{"192.168.0.1"}, {"192.168.0.2"}} - addrs, err := awsCloud.NodeAddresses(context.TODO(), "") - if err != nil { - t.Errorf("unexpected error: %v", err) - } - testHasNodeAddress(t, addrs, v1.NodeInternalIP, "192.168.0.1") - testHasNodeAddress(t, addrs, v1.NodeInternalIP, "192.168.0.2") - testHasNodeAddress(t, addrs, v1.NodeExternalIP, "2.3.4.5") - var index1, index2 int - for i, addr := range addrs { - if addr.Type == v1.NodeInternalIP && addr.Address == "192.168.0.1" { - index1 = i - } else if addr.Type == v1.NodeInternalIP && addr.Address == "192.168.0.2" { - index2 = i - } - } - if index1 > index2 { - t.Errorf("Addresses in incorrect order: %v", addrs) - } -} - -func TestParseMetadataLocalHostname(t *testing.T) { - tests := []struct { - name string - metadata string - hostname string - internalDNS []string - }{ - { - "single hostname", - "ip-172-31-16-168.us-west-2.compute.internal", - "ip-172-31-16-168.us-west-2.compute.internal", - []string{"ip-172-31-16-168.us-west-2.compute.internal"}, - }, - { - "dhcp options set with three additional domain names", - "ip-172-31-16-168.us-west-2.compute.internal example.com example.ca example.org", - "ip-172-31-16-168.us-west-2.compute.internal", - []string{"ip-172-31-16-168.us-west-2.compute.internal", "ip-172-31-16-168.example.com", "ip-172-31-16-168.example.ca", "ip-172-31-16-168.example.org"}, - }, - } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - hostname, internalDNS := parseMetadataLocalHostname(test.metadata) - if hostname != test.hostname { - t.Errorf("got hostname %v, expected %v", hostname, test.hostname) - } - for i, v := range internalDNS { - if v != test.internalDNS[i] { - t.Errorf("got an internalDNS %v, expected %v", v, test.internalDNS[i]) - } - } - }) - } -} - -func TestGetRegion(t *testing.T) { - aws := mockAvailabilityZone("us-west-2e") - zones, ok := aws.Zones() - if !ok { - t.Fatalf("Unexpected missing zones impl") - } - zone, err := zones.GetZone(context.TODO()) - if err != nil { - t.Fatalf("unexpected error %v", err) - } - if zone.Region != "us-west-2" { - t.Errorf("Unexpected region: %s", zone.Region) - } - if zone.FailureDomain != "us-west-2e" { - t.Errorf("Unexpected FailureDomain: %s", zone.FailureDomain) - } -} - -func TestFindVPCID(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - vpcID, err := c.findVPCID() - if err != nil { - t.Errorf("Unexpected error: %v", err) - } - if vpcID != "vpc-mac0" { - t.Errorf("Unexpected vpcID: %s", vpcID) - } -} - -func constructSubnets(subnetsIn map[int]map[string]string) (subnetsOut []*ec2.Subnet) { - for i := range subnetsIn { - subnetsOut = append( - subnetsOut, - constructSubnet( - subnetsIn[i]["id"], - subnetsIn[i]["az"], - ), - ) - } - return -} - -func constructSubnet(id string, az string) *ec2.Subnet { - return &ec2.Subnet{ - SubnetId: &id, - AvailabilityZone: &az, - } -} - -func constructRouteTables(routeTablesIn map[string]bool) (routeTablesOut []*ec2.RouteTable) { - routeTablesOut = append(routeTablesOut, - &ec2.RouteTable{ - Associations: []*ec2.RouteTableAssociation{{Main: aws.Bool(true)}}, - Routes: []*ec2.Route{{ - DestinationCidrBlock: aws.String("0.0.0.0/0"), - GatewayId: aws.String("igw-main"), - }}, - }) - - for subnetID := range routeTablesIn { - routeTablesOut = append( - routeTablesOut, - constructRouteTable( - subnetID, - routeTablesIn[subnetID], - ), - ) - } - return -} - -func constructRouteTable(subnetID string, public bool) *ec2.RouteTable { - var gatewayID string - if public { - gatewayID = "igw-" + subnetID[len(subnetID)-8:8] - } else { - gatewayID = "vgw-" + subnetID[len(subnetID)-8:8] - } - return &ec2.RouteTable{ - Associations: []*ec2.RouteTableAssociation{{SubnetId: aws.String(subnetID)}}, - Routes: []*ec2.Route{{ - DestinationCidrBlock: aws.String("0.0.0.0/0"), - GatewayId: aws.String(gatewayID), - }}, - } -} - -func Test_findELBSubnets(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - subnetA0000001 := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2a"), - SubnetId: aws.String("subnet-a0000001"), - Tags: []*ec2.Tag{ - { - Key: aws.String(TagNameSubnetPublicELB), - Value: aws.String("1"), - }, - }, - } - subnetA0000002 := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2a"), - SubnetId: aws.String("subnet-a0000002"), - Tags: []*ec2.Tag{ - { - Key: aws.String(TagNameSubnetPublicELB), - Value: aws.String("1"), - }, - }, - } - subnetA0000003 := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2a"), - SubnetId: aws.String("subnet-a0000003"), - Tags: []*ec2.Tag{ - { - Key: aws.String(c.tagging.clusterTagKey()), - Value: aws.String("owned"), - }, - { - Key: aws.String(TagNameSubnetInternalELB), - Value: aws.String("1"), - }, - }, - } - subnetB0000001 := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2b"), - SubnetId: aws.String("subnet-b0000001"), - Tags: []*ec2.Tag{ - { - Key: aws.String(c.tagging.clusterTagKey()), - Value: aws.String("owned"), - }, - { - Key: aws.String(TagNameSubnetPublicELB), - Value: aws.String("1"), - }, - }, - } - subnetB0000002 := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2b"), - SubnetId: aws.String("subnet-b0000002"), - Tags: []*ec2.Tag{ - { - Key: aws.String(c.tagging.clusterTagKey()), - Value: aws.String("owned"), - }, - { - Key: aws.String(TagNameSubnetInternalELB), - Value: aws.String("1"), - }, - }, - } - subnetC0000001 := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2c"), - SubnetId: aws.String("subnet-c0000001"), - Tags: []*ec2.Tag{ - { - Key: aws.String(c.tagging.clusterTagKey()), - Value: aws.String("owned"), - }, - { - Key: aws.String(TagNameSubnetInternalELB), - Value: aws.String("1"), - }, - }, - } - subnetOther := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2c"), - SubnetId: aws.String("subnet-other"), - Tags: []*ec2.Tag{ - { - Key: aws.String(TagNameKubernetesClusterPrefix + "clusterid.other"), - Value: aws.String("owned"), - }, - { - Key: aws.String(TagNameSubnetInternalELB), - Value: aws.String("1"), - }, - }, - } - subnetNoTag := &ec2.Subnet{ - AvailabilityZone: aws.String("us-west-2c"), - SubnetId: aws.String("subnet-notag"), - } - - tests := []struct { - name string - subnets []*ec2.Subnet - routeTables map[string]bool - internal bool - want []string - }{ - { - name: "no subnets", - }, - { - name: "single tagged subnet", - subnets: []*ec2.Subnet{ - subnetA0000001, - }, - routeTables: map[string]bool{ - "subnet-a0000001": true, - }, - internal: false, - want: []string{"subnet-a0000001"}, - }, - { - name: "no matching public subnet", - subnets: []*ec2.Subnet{ - subnetA0000002, - }, - routeTables: map[string]bool{ - "subnet-a0000002": false, - }, - want: nil, - }, - { - name: "prefer role over cluster tag", - subnets: []*ec2.Subnet{ - subnetA0000001, - subnetA0000003, - }, - routeTables: map[string]bool{ - "subnet-a0000001": true, - "subnet-a0000003": true, - }, - want: []string{"subnet-a0000001"}, - }, - { - name: "prefer cluster tag", - subnets: []*ec2.Subnet{ - subnetC0000001, - subnetNoTag, - }, - want: []string{"subnet-c0000001"}, - }, - { - name: "include untagged", - subnets: []*ec2.Subnet{ - subnetA0000001, - subnetNoTag, - }, - routeTables: map[string]bool{ - "subnet-a0000001": true, - "subnet-notag": true, - }, - want: []string{"subnet-a0000001", "subnet-notag"}, - }, - { - name: "ignore some other cluster owned subnet", - subnets: []*ec2.Subnet{ - subnetB0000001, - subnetOther, - }, - routeTables: map[string]bool{ - "subnet-b0000001": true, - "subnet-other": true, - }, - want: []string{"subnet-b0000001"}, - }, - { - name: "prefer matching role", - subnets: []*ec2.Subnet{ - subnetB0000001, - subnetB0000002, - }, - routeTables: map[string]bool{ - "subnet-b0000001": false, - "subnet-b0000002": false, - }, - want: []string{"subnet-b0000002"}, - internal: true, - }, - { - name: "choose lexicographic order", - subnets: []*ec2.Subnet{ - subnetA0000001, - subnetA0000002, - }, - routeTables: map[string]bool{ - "subnet-a0000001": true, - "subnet-a0000002": true, - }, - want: []string{"subnet-a0000001"}, - }, - { - name: "everything", - subnets: []*ec2.Subnet{ - subnetA0000001, - subnetA0000002, - subnetB0000001, - subnetB0000002, - subnetC0000001, - subnetNoTag, - subnetOther, - }, - routeTables: map[string]bool{ - "subnet-a0000001": true, - "subnet-a0000002": true, - "subnet-b0000001": true, - "subnet-b0000002": true, - "subnet-c0000001": true, - "subnet-notag": true, - "subnet-other": true, - }, - want: []string{"subnet-a0000001", "subnet-b0000001", "subnet-c0000001"}, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - awsServices.ec2.RemoveSubnets() - awsServices.ec2.RemoveRouteTables() - for _, subnet := range tt.subnets { - awsServices.ec2.CreateSubnet(subnet) - } - routeTables := constructRouteTables(tt.routeTables) - for _, rt := range routeTables { - awsServices.ec2.CreateRouteTable(rt) - } - got, _ := c.findELBSubnets(tt.internal) - sort.Strings(tt.want) - sort.Strings(got) - assert.Equal(t, tt.want, got) - }) - } -} - -func Test_getLoadBalancerSubnets(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - tests := []struct { - name string - service *v1.Service - subnets []*ec2.Subnet - internalELB bool - want []string - wantErr error - }{ - { - name: "no annotation", - service: &v1.Service{}, - }, - { - name: "annotation with no subnets", - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-subnets": "\t", - }, - }, - }, - wantErr: errors.New("unable to resolve empty subnet slice"), - }, - { - name: "subnet ids", - subnets: []*ec2.Subnet{ - { - AvailabilityZone: aws.String("us-west-2c"), - SubnetId: aws.String("subnet-a000001"), - }, - { - AvailabilityZone: aws.String("us-west-2b"), - SubnetId: aws.String("subnet-a000002"), - }, - }, - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-subnets": "subnet-a000001, subnet-a000002", - }, - }, - }, - want: []string{"subnet-a000001", "subnet-a000002"}, - }, - { - name: "subnet names", - subnets: []*ec2.Subnet{ - { - AvailabilityZone: aws.String("us-west-2c"), - SubnetId: aws.String("subnet-a000001"), - }, - { - AvailabilityZone: aws.String("us-west-2b"), - SubnetId: aws.String("subnet-a000002"), - }, - }, - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-subnets": "My Subnet 1, My Subnet 2 ", - }, - }, - }, - want: []string{"subnet-a000001", "subnet-a000002"}, - }, - { - name: "unable to find all subnets", - subnets: []*ec2.Subnet{ - { - AvailabilityZone: aws.String("us-west-2c"), - SubnetId: aws.String("subnet-a000001"), - }, - }, - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-subnets": "My Subnet 1, My Subnet 2, Test Subnet ", - }, - }, - }, - wantErr: errors.New("expected to find 3, but found 1 subnets"), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - awsServices.ec2.RemoveSubnets() - for _, subnet := range tt.subnets { - awsServices.ec2.CreateSubnet(subnet) - } - got, err := c.getLoadBalancerSubnets(tt.service, tt.internalELB) - if tt.wantErr != nil { - assert.EqualError(t, err, tt.wantErr.Error()) - } else { - assert.Equal(t, tt.want, got) - } - }) - } -} - -func TestSubnetIDsinVPC(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - - // test with 3 subnets from 3 different AZs - subnets := make(map[int]map[string]string) - subnets[0] = make(map[string]string) - subnets[0]["id"] = "subnet-a0000001" - subnets[0]["az"] = "af-south-1a" - subnets[1] = make(map[string]string) - subnets[1]["id"] = "subnet-b0000001" - subnets[1]["az"] = "af-south-1b" - subnets[2] = make(map[string]string) - subnets[2]["id"] = "subnet-c0000001" - subnets[2]["az"] = "af-south-1c" - constructedSubnets := constructSubnets(subnets) - awsServices.ec2.RemoveSubnets() - for _, subnet := range constructedSubnets { - awsServices.ec2.CreateSubnet(subnet) - } - - routeTables := map[string]bool{ - "subnet-a0000001": true, - "subnet-b0000001": true, - "subnet-c0000001": true, - } - constructedRouteTables := constructRouteTables(routeTables) - awsServices.ec2.RemoveRouteTables() - for _, rt := range constructedRouteTables { - awsServices.ec2.CreateRouteTable(rt) - } - - result, err := c.findELBSubnets(false) - if err != nil { - t.Errorf("Error listing subnets: %v", err) - return - } - - if len(result) != 3 { - t.Errorf("Expected 3 subnets but got %d", len(result)) - return - } - - resultSet := make(map[string]bool) - for _, v := range result { - resultSet[v] = true - } - - for i := range subnets { - if !resultSet[subnets[i]["id"]] { - t.Errorf("Expected subnet%d '%s' in result: %v", i, subnets[i]["id"], result) - return - } - } - - // test implicit routing table - when subnets are not explicitly linked to a table they should use main - constructedRouteTables = constructRouteTables(map[string]bool{}) - awsServices.ec2.RemoveRouteTables() - for _, rt := range constructedRouteTables { - awsServices.ec2.CreateRouteTable(rt) - } - - result, err = c.findELBSubnets(false) - if err != nil { - t.Errorf("Error listing subnets: %v", err) - return - } - - if len(result) != 3 { - t.Errorf("Expected 3 subnets but got %d", len(result)) - return - } - - resultSet = make(map[string]bool) - for _, v := range result { - resultSet[v] = true - } - - for i := range subnets { - if !resultSet[subnets[i]["id"]] { - t.Errorf("Expected subnet%d '%s' in result: %v", i, subnets[i]["id"], result) - return - } - } - - // Test with 5 subnets from 3 different AZs. - // Add 2 duplicate AZ subnets lexicographically chosen one is the middle element in array to - // check that we both choose the correct entry when it comes after and before another element - // in the same AZ. - subnets[3] = make(map[string]string) - subnets[3]["id"] = "subnet-c0000000" - subnets[3]["az"] = "af-south-1c" - subnets[4] = make(map[string]string) - subnets[4]["id"] = "subnet-c0000002" - subnets[4]["az"] = "af-south-1c" - constructedSubnets = constructSubnets(subnets) - awsServices.ec2.RemoveSubnets() - for _, subnet := range constructedSubnets { - awsServices.ec2.CreateSubnet(subnet) - } - routeTables["subnet-c0000000"] = true - routeTables["subnet-c0000002"] = true - constructedRouteTables = constructRouteTables(routeTables) - awsServices.ec2.RemoveRouteTables() - for _, rt := range constructedRouteTables { - awsServices.ec2.CreateRouteTable(rt) - } - - result, err = c.findELBSubnets(false) - if err != nil { - t.Errorf("Error listing subnets: %v", err) - return - } - - if len(result) != 3 { - t.Errorf("Expected 3 subnets but got %d", len(result)) - return - } - - expected := []*string{aws.String("subnet-a0000001"), aws.String("subnet-b0000001"), aws.String("subnet-c0000000")} - for _, s := range result { - if !contains(expected, s) { - t.Errorf("Unexpected subnet '%s' found", s) - return - } - } - - delete(routeTables, "subnet-c0000002") - - // test with 6 subnets from 3 different AZs - // with 3 private subnets - subnets[4] = make(map[string]string) - subnets[4]["id"] = "subnet-d0000001" - subnets[4]["az"] = "af-south-1a" - subnets[5] = make(map[string]string) - subnets[5]["id"] = "subnet-d0000002" - subnets[5]["az"] = "af-south-1b" - - constructedSubnets = constructSubnets(subnets) - awsServices.ec2.RemoveSubnets() - for _, subnet := range constructedSubnets { - awsServices.ec2.CreateSubnet(subnet) - } - - routeTables["subnet-a0000001"] = false - routeTables["subnet-b0000001"] = false - routeTables["subnet-c0000001"] = false - routeTables["subnet-c0000000"] = true - routeTables["subnet-d0000001"] = true - routeTables["subnet-d0000002"] = true - constructedRouteTables = constructRouteTables(routeTables) - awsServices.ec2.RemoveRouteTables() - for _, rt := range constructedRouteTables { - awsServices.ec2.CreateRouteTable(rt) - } - result, err = c.findELBSubnets(false) - if err != nil { - t.Errorf("Error listing subnets: %v", err) - return - } - - if len(result) != 3 { - t.Errorf("Expected 3 subnets but got %d", len(result)) - return - } - - expected = []*string{aws.String("subnet-c0000000"), aws.String("subnet-d0000001"), aws.String("subnet-d0000002")} - for _, s := range result { - if !contains(expected, s) { - t.Errorf("Unexpected subnet '%s' found", s) - return - } - } -} - -func TestIpPermissionExistsHandlesMultipleGroupIds(t *testing.T) { - oldIPPermission := ec2.IpPermission{ - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - {GroupId: aws.String("firstGroupId")}, - {GroupId: aws.String("secondGroupId")}, - {GroupId: aws.String("thirdGroupId")}, - }, - } - - existingIPPermission := ec2.IpPermission{ - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - {GroupId: aws.String("secondGroupId")}, - }, - } - - newIPPermission := ec2.IpPermission{ - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - {GroupId: aws.String("fourthGroupId")}, - }, - } - - equals := ipPermissionExists(&existingIPPermission, &oldIPPermission, false) - if !equals { - t.Errorf("Should have been considered equal since first is in the second array of groups") - } - - equals = ipPermissionExists(&newIPPermission, &oldIPPermission, false) - if equals { - t.Errorf("Should have not been considered equal since first is not in the second array of groups") - } - - // The first pair matches, but the second does not - newIPPermission2 := ec2.IpPermission{ - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - {GroupId: aws.String("firstGroupId")}, - {GroupId: aws.String("fourthGroupId")}, - }, - } - equals = ipPermissionExists(&newIPPermission2, &oldIPPermission, false) - if equals { - t.Errorf("Should have not been considered equal since first is not in the second array of groups") - } -} - -func TestIpPermissionExistsHandlesRangeSubsets(t *testing.T) { - // Two existing scenarios we'll test against - emptyIPPermission := ec2.IpPermission{} - - oldIPPermission := ec2.IpPermission{ - IpRanges: []*ec2.IpRange{ - {CidrIp: aws.String("10.0.0.0/8")}, - {CidrIp: aws.String("192.168.1.0/24")}, - }, - } - - // Two already existing ranges and a new one - existingIPPermission := ec2.IpPermission{ - IpRanges: []*ec2.IpRange{ - {CidrIp: aws.String("10.0.0.0/8")}, - }, - } - existingIPPermission2 := ec2.IpPermission{ - IpRanges: []*ec2.IpRange{ - {CidrIp: aws.String("192.168.1.0/24")}, - }, - } - - newIPPermission := ec2.IpPermission{ - IpRanges: []*ec2.IpRange{ - {CidrIp: aws.String("172.16.0.0/16")}, - }, - } - - exists := ipPermissionExists(&emptyIPPermission, &emptyIPPermission, false) - if !exists { - t.Errorf("Should have been considered existing since we're comparing a range array against itself") - } - exists = ipPermissionExists(&oldIPPermission, &oldIPPermission, false) - if !exists { - t.Errorf("Should have been considered existing since we're comparing a range array against itself") - } - - exists = ipPermissionExists(&existingIPPermission, &oldIPPermission, false) - if !exists { - t.Errorf("Should have been considered existing since 10.* is in oldIPPermission's array of ranges") - } - exists = ipPermissionExists(&existingIPPermission2, &oldIPPermission, false) - if !exists { - t.Errorf("Should have been considered existing since 192.* is in oldIpPermission2's array of ranges") - } - - exists = ipPermissionExists(&newIPPermission, &emptyIPPermission, false) - if exists { - t.Errorf("Should have not been considered existing since we compared against a missing array of ranges") - } - exists = ipPermissionExists(&newIPPermission, &oldIPPermission, false) - if exists { - t.Errorf("Should have not been considered existing since 172.* is not in oldIPPermission's array of ranges") - } -} - -func TestIpPermissionExistsHandlesMultipleGroupIdsWithUserIds(t *testing.T) { - oldIPPermission := ec2.IpPermission{ - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - {GroupId: aws.String("firstGroupId"), UserId: aws.String("firstUserId")}, - {GroupId: aws.String("secondGroupId"), UserId: aws.String("secondUserId")}, - {GroupId: aws.String("thirdGroupId"), UserId: aws.String("thirdUserId")}, - }, - } - - existingIPPermission := ec2.IpPermission{ - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - {GroupId: aws.String("secondGroupId"), UserId: aws.String("secondUserId")}, - }, - } - - newIPPermission := ec2.IpPermission{ - UserIdGroupPairs: []*ec2.UserIdGroupPair{ - {GroupId: aws.String("secondGroupId"), UserId: aws.String("anotherUserId")}, - }, - } - - equals := ipPermissionExists(&existingIPPermission, &oldIPPermission, true) - if !equals { - t.Errorf("Should have been considered equal since first is in the second array of groups") - } - - equals = ipPermissionExists(&newIPPermission, &oldIPPermission, true) - if equals { - t.Errorf("Should have not been considered equal since first is not in the second array of groups") - } -} - -func TestFindInstanceByNodeNameExcludesTerminatedInstances(t *testing.T) { - awsStates := []struct { - id int64 - state string - expected bool - }{ - {0, ec2.InstanceStateNamePending, true}, - {16, ec2.InstanceStateNameRunning, true}, - {32, ec2.InstanceStateNameShuttingDown, true}, - {48, ec2.InstanceStateNameTerminated, false}, - {64, ec2.InstanceStateNameStopping, true}, - {80, ec2.InstanceStateNameStopped, true}, - } - awsServices := newMockedFakeAWSServices(TestClusterID) - - nodeName := types.NodeName("my-dns.internal") - - var tag ec2.Tag - tag.Key = aws.String(TagNameKubernetesClusterLegacy) - tag.Value = aws.String(TestClusterID) - tags := []*ec2.Tag{&tag} - - var testInstance ec2.Instance - testInstance.PrivateDnsName = aws.String(string(nodeName)) - testInstance.Tags = tags - - awsDefaultInstances := awsServices.instances - for _, awsState := range awsStates { - id := "i-" + awsState.state - testInstance.InstanceId = aws.String(id) - testInstance.State = &ec2.InstanceState{Code: aws.Int64(awsState.id), Name: aws.String(awsState.state)} - - awsServices.instances = append(awsDefaultInstances, &testInstance) - - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - - resultInstance, err := c.findInstanceByNodeName(nodeName) - - if awsState.expected { - if err != nil || resultInstance == nil { - t.Errorf("Expected to find instance %v", *testInstance.InstanceId) - return - } - if *resultInstance.InstanceId != *testInstance.InstanceId { - t.Errorf("Wrong instance returned by findInstanceByNodeName() expected: %v, actual: %v", *testInstance.InstanceId, *resultInstance.InstanceId) - return - } - } else { - if err == nil && resultInstance != nil { - t.Errorf("Did not expect to find instance %v", *resultInstance.InstanceId) - return - } - } - } -} - -func TestGetInstanceByNodeNameBatching(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - var tag ec2.Tag - tag.Key = aws.String(TagNameKubernetesClusterPrefix + TestClusterID) - tag.Value = aws.String("") - tags := []*ec2.Tag{&tag} - nodeNames := []string{} - for i := 0; i < 200; i++ { - nodeName := fmt.Sprintf("ip-171-20-42-%d.ec2.internal", i) - nodeNames = append(nodeNames, nodeName) - ec2Instance := &ec2.Instance{} - instanceID := fmt.Sprintf("i-abcedf%d", i) - ec2Instance.InstanceId = aws.String(instanceID) - ec2Instance.PrivateDnsName = aws.String(nodeName) - ec2Instance.State = &ec2.InstanceState{Code: aws.Int64(48), Name: aws.String("running")} - ec2Instance.Tags = tags - awsServices.instances = append(awsServices.instances, ec2Instance) - - } - - instances, err := c.getInstancesByNodeNames(nodeNames) - assert.Nil(t, err, "Error getting instances by nodeNames %v: %v", nodeNames, err) - assert.NotEmpty(t, instances) - assert.Equal(t, 200, len(instances), "Expected 200 but got less") -} - -func TestGetVolumeLabels(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - volumeID := EBSVolumeID("vol-VolumeId") - expectedVolumeRequest := &ec2.DescribeVolumesInput{VolumeIds: []*string{volumeID.awsString()}} - awsServices.ec2.(*MockedFakeEC2).On("DescribeVolumes", expectedVolumeRequest).Return([]*ec2.Volume{ - { - VolumeId: volumeID.awsString(), - AvailabilityZone: aws.String("us-east-1a"), - }, - }) - - labels, err := c.GetVolumeLabels(KubernetesVolumeID("aws:///" + string(volumeID))) - - assert.Nil(t, err, "Error creating Volume %v", err) - assert.Equal(t, map[string]string{ - v1.LabelTopologyZone: "us-east-1a", - v1.LabelTopologyRegion: "us-east-1"}, labels) - awsServices.ec2.(*MockedFakeEC2).AssertExpectations(t) -} - -func TestGetLabelsForVolume(t *testing.T) { - defaultVolume := EBSVolumeID("vol-VolumeId").awsString() - tests := []struct { - name string - pv *v1.PersistentVolume - expectedVolumeID *string - expectedEC2Volumes []*ec2.Volume - expectedLabels map[string]string - expectedError error - }{ - { - "not an EBS volume", - &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{}, - }, - nil, - nil, - nil, - nil, - }, - { - "volume which is being provisioned", - &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: cloudvolume.ProvisionedVolumeName, - }, - }, - }, - }, - nil, - nil, - nil, - nil, - }, - { - "no volumes found", - &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: "vol-VolumeId", - }, - }, - }, - }, - defaultVolume, - nil, - nil, - fmt.Errorf("no volumes found"), - }, - { - "correct labels for volume", - &v1.PersistentVolume{ - Spec: v1.PersistentVolumeSpec{ - PersistentVolumeSource: v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: "vol-VolumeId", - }, - }, - }, - }, - defaultVolume, - []*ec2.Volume{{ - VolumeId: defaultVolume, - AvailabilityZone: aws.String("us-east-1a"), - }}, - map[string]string{ - v1.LabelTopologyZone: "us-east-1a", - v1.LabelTopologyRegion: "us-east-1", - }, - nil, - }, - } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - expectedVolumeRequest := &ec2.DescribeVolumesInput{VolumeIds: []*string{test.expectedVolumeID}} - awsServices.ec2.(*MockedFakeEC2).On("DescribeVolumes", expectedVolumeRequest).Return(test.expectedEC2Volumes) - - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - - l, err := c.GetLabelsForVolume(context.TODO(), test.pv) - assert.Equal(t, test.expectedLabels, l) - assert.Equal(t, test.expectedError, err) - }) - - } -} - -func TestDescribeLoadBalancerOnDelete(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - awsServices.elb.(*MockedFakeELB).expectDescribeLoadBalancers("aid") - - c.EnsureLoadBalancerDeleted(context.TODO(), TestClusterName, &v1.Service{ObjectMeta: metav1.ObjectMeta{Name: "myservice", UID: "id"}}) -} - -func TestDescribeLoadBalancerOnUpdate(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - awsServices.elb.(*MockedFakeELB).expectDescribeLoadBalancers("aid") - - c.UpdateLoadBalancer(context.TODO(), TestClusterName, &v1.Service{ObjectMeta: metav1.ObjectMeta{Name: "myservice", UID: "id"}}, []*v1.Node{}) -} - -func TestDescribeLoadBalancerOnGet(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - awsServices.elb.(*MockedFakeELB).expectDescribeLoadBalancers("aid") - - c.GetLoadBalancer(context.TODO(), TestClusterName, &v1.Service{ObjectMeta: metav1.ObjectMeta{Name: "myservice", UID: "id"}}) -} - -func TestDescribeLoadBalancerOnEnsure(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - awsServices.elb.(*MockedFakeELB).expectDescribeLoadBalancers("aid") - - c.EnsureLoadBalancer(context.TODO(), TestClusterName, &v1.Service{ObjectMeta: metav1.ObjectMeta{Name: "myservice", UID: "id"}}, []*v1.Node{}) -} - -func TestCheckMixedProtocol(t *testing.T) { - tests := []struct { - name string - annotations map[string]string - ports []v1.ServicePort - wantErr error - }{ - { - name: "TCP", - annotations: make(map[string]string), - ports: []v1.ServicePort{ - { - Protocol: v1.ProtocolTCP, - Port: int32(8080), - }, - }, - wantErr: nil, - }, - { - name: "UDP", - annotations: map[string]string{ServiceAnnotationLoadBalancerType: "nlb"}, - ports: []v1.ServicePort{ - { - Protocol: v1.ProtocolUDP, - Port: int32(8080), - }, - }, - wantErr: nil, - }, - { - name: "TCP and UDP", - annotations: map[string]string{ServiceAnnotationLoadBalancerType: "nlb"}, - ports: []v1.ServicePort{ - { - Protocol: v1.ProtocolUDP, - Port: int32(53), - }, - { - Protocol: v1.ProtocolTCP, - Port: int32(53), - }, - }, - wantErr: errors.New("mixed protocol is not supported for LoadBalancer"), - }, - } - for _, test := range tests { - tt := test - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - err := checkMixedProtocol(tt.ports) - if tt.wantErr != nil { - assert.EqualError(t, err, tt.wantErr.Error()) - } else { - assert.Equal(t, err, nil) - } - }) - } -} - -func TestCheckProtocol(t *testing.T) { - tests := []struct { - name string - annotations map[string]string - port v1.ServicePort - wantErr error - }{ - { - name: "TCP with ELB", - annotations: make(map[string]string), - port: v1.ServicePort{Protocol: v1.ProtocolTCP, Port: int32(8080)}, - wantErr: nil, - }, - { - name: "TCP with NLB", - annotations: map[string]string{ServiceAnnotationLoadBalancerType: "nlb"}, - port: v1.ServicePort{Protocol: v1.ProtocolTCP, Port: int32(8080)}, - wantErr: nil, - }, - { - name: "UDP with ELB", - annotations: make(map[string]string), - port: v1.ServicePort{Protocol: v1.ProtocolUDP, Port: int32(8080)}, - wantErr: fmt.Errorf("Protocol UDP not supported by load balancer"), - }, - { - name: "UDP with NLB", - annotations: map[string]string{ServiceAnnotationLoadBalancerType: "nlb"}, - port: v1.ServicePort{Protocol: v1.ProtocolUDP, Port: int32(8080)}, - wantErr: nil, - }, - } - for _, test := range tests { - tt := test - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - err := checkProtocol(tt.port, tt.annotations) - if tt.wantErr != nil && err == nil { - t.Errorf("Expected error: want=%s got =%s", tt.wantErr, err) - } - if tt.wantErr == nil && err != nil { - t.Errorf("Unexpected error: want=%s got =%s", tt.wantErr, err) - } - }) - } -} - -func TestBuildListener(t *testing.T) { - tests := []struct { - name string - - lbPort int64 - portName string - instancePort int64 - backendProtocolAnnotation string - certAnnotation string - sslPortAnnotation string - - expectError bool - lbProtocol string - instanceProtocol string - certID string - }{ - { - "No cert or BE protocol annotation, passthrough", - 80, "", 7999, "", "", "", - false, "tcp", "tcp", "", - }, - { - "Cert annotation without BE protocol specified, SSL->TCP", - 80, "", 8000, "", "cert", "", - false, "ssl", "tcp", "cert", - }, - { - "BE protocol without cert annotation, passthrough", - 443, "", 8001, "https", "", "", - false, "tcp", "tcp", "", - }, - { - "Invalid cert annotation, bogus backend protocol", - 443, "", 8002, "bacon", "foo", "", - true, "tcp", "tcp", "", - }, - { - "Invalid cert annotation, protocol followed by equal sign", - 443, "", 8003, "http=", "=", "", - true, "tcp", "tcp", "", - }, - { - "HTTPS->HTTPS", - 443, "", 8004, "https", "cert", "", - false, "https", "https", "cert", - }, - { - "HTTPS->HTTP", - 443, "", 8005, "http", "cert", "", - false, "https", "http", "cert", - }, - { - "SSL->SSL", - 443, "", 8006, "ssl", "cert", "", - false, "ssl", "ssl", "cert", - }, - { - "SSL->TCP", - 443, "", 8007, "tcp", "cert", "", - false, "ssl", "tcp", "cert", - }, - { - "Port in whitelist", - 1234, "", 8008, "tcp", "cert", "1234,5678", - false, "ssl", "tcp", "cert", - }, - { - "Port not in whitelist, passthrough", - 443, "", 8009, "tcp", "cert", "1234,5678", - false, "tcp", "tcp", "", - }, - { - "Named port in whitelist", - 1234, "bar", 8010, "tcp", "cert", "foo,bar", - false, "ssl", "tcp", "cert", - }, - { - "Named port not in whitelist, passthrough", - 443, "", 8011, "tcp", "cert", "foo,bar", - false, "tcp", "tcp", "", - }, - { - "HTTP->HTTP", - 80, "", 8012, "http", "", "", - false, "http", "http", "", - }, - } - - for _, test := range tests { - t.Logf("Running test case %s", test.name) - annotations := make(map[string]string) - if test.backendProtocolAnnotation != "" { - annotations[ServiceAnnotationLoadBalancerBEProtocol] = test.backendProtocolAnnotation - } - if test.certAnnotation != "" { - annotations[ServiceAnnotationLoadBalancerCertificate] = test.certAnnotation - } - ports := getPortSets(test.sslPortAnnotation) - l, err := buildListener(v1.ServicePort{ - NodePort: int32(test.instancePort), - Port: int32(test.lbPort), - Name: test.portName, - Protocol: v1.Protocol("tcp"), - }, annotations, ports) - if test.expectError { - if err == nil { - t.Errorf("Should error for case %s", test.name) - } - } else { - if err != nil { - t.Errorf("Should succeed for case: %s, got %v", test.name, err) - } else { - var cert *string - if test.certID != "" { - cert = &test.certID - } - expected := &elb.Listener{ - InstancePort: &test.instancePort, - InstanceProtocol: &test.instanceProtocol, - LoadBalancerPort: &test.lbPort, - Protocol: &test.lbProtocol, - SSLCertificateId: cert, - } - if !reflect.DeepEqual(l, expected) { - t.Errorf("Incorrect listener (%v vs expected %v) for case: %s", - l, expected, test.name) - } - } - } - } -} - -func TestProxyProtocolEnabled(t *testing.T) { - policies := sets.NewString(ProxyProtocolPolicyName, "FooBarFoo") - fakeBackend := &elb.BackendServerDescription{ - InstancePort: aws.Int64(80), - PolicyNames: stringSetToPointers(policies), - } - result := proxyProtocolEnabled(fakeBackend) - assert.True(t, result, "expected to find %s in %s", ProxyProtocolPolicyName, policies) - - policies = sets.NewString("FooBarFoo") - fakeBackend = &elb.BackendServerDescription{ - InstancePort: aws.Int64(80), - PolicyNames: []*string{ - aws.String("FooBarFoo"), - }, - } - result = proxyProtocolEnabled(fakeBackend) - assert.False(t, result, "did not expect to find %s in %s", ProxyProtocolPolicyName, policies) - - policies = sets.NewString() - fakeBackend = &elb.BackendServerDescription{ - InstancePort: aws.Int64(80), - } - result = proxyProtocolEnabled(fakeBackend) - assert.False(t, result, "did not expect to find %s in %s", ProxyProtocolPolicyName, policies) -} - -func TestGetKeyValuePropertiesFromAnnotation(t *testing.T) { - tagTests := []struct { - Annotations map[string]string - Tags map[string]string - }{ - { - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerAdditionalTags: "Key=Val", - }, - Tags: map[string]string{ - "Key": "Val", - }, - }, - { - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerAdditionalTags: "Key1=Val1, Key2=Val2", - }, - Tags: map[string]string{ - "Key1": "Val1", - "Key2": "Val2", - }, - }, - { - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerAdditionalTags: "Key1=, Key2=Val2", - "anotherKey": "anotherValue", - }, - Tags: map[string]string{ - "Key1": "", - "Key2": "Val2", - }, - }, - { - Annotations: map[string]string{ - "Nothing": "Key1=, Key2=Val2, Key3", - }, - Tags: map[string]string{}, - }, - { - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerAdditionalTags: "K=V K1=V2,Key1========, =====, ======Val, =Val, , 234,", - }, - Tags: map[string]string{ - "K": "V K1", - "Key1": "", - "234": "", - }, - }, - } - - for _, tagTest := range tagTests { - result := getKeyValuePropertiesFromAnnotation(tagTest.Annotations, ServiceAnnotationLoadBalancerAdditionalTags) - for k, v := range result { - if len(result) != len(tagTest.Tags) { - t.Errorf("incorrect expected length: %v != %v", result, tagTest.Tags) - continue - } - if tagTest.Tags[k] != v { - t.Errorf("%s != %s", tagTest.Tags[k], v) - continue - } - } - } -} - -func TestLBExtraSecurityGroupsAnnotation(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - - sg1 := map[string]string{ServiceAnnotationLoadBalancerExtraSecurityGroups: "sg-000001"} - sg2 := map[string]string{ServiceAnnotationLoadBalancerExtraSecurityGroups: "sg-000002"} - sg3 := map[string]string{ServiceAnnotationLoadBalancerExtraSecurityGroups: "sg-000001, sg-000002"} - - tests := []struct { - name string - - annotations map[string]string - expectedSGs []string - }{ - {"No extra SG annotation", map[string]string{}, []string{}}, - {"Empty extra SGs specified", map[string]string{ServiceAnnotationLoadBalancerExtraSecurityGroups: ", ,,"}, []string{}}, - {"SG specified", sg1, []string{sg1[ServiceAnnotationLoadBalancerExtraSecurityGroups]}}, - {"Multiple SGs specified", sg3, []string{sg1[ServiceAnnotationLoadBalancerExtraSecurityGroups], sg2[ServiceAnnotationLoadBalancerExtraSecurityGroups]}}, - } - - awsServices.ec2.(*MockedFakeEC2).expectDescribeSecurityGroups(TestClusterID, "k8s-elb-aid") - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - serviceName := types.NamespacedName{Namespace: "default", Name: "myservice"} - - sgList, setupSg, err := c.buildELBSecurityGroupList(serviceName, "aid", test.annotations) - assert.NoError(t, err, "buildELBSecurityGroupList failed") - extraSGs := sgList[1:] - assert.True(t, sets.NewString(test.expectedSGs...).Equal(sets.NewString(extraSGs...)), - "Security Groups expected=%q , returned=%q", test.expectedSGs, extraSGs) - assert.True(t, setupSg, "Security Groups Setup Permissions Flag expected=%t , returned=%t", true, setupSg) - }) - } -} - -func TestLBSecurityGroupsAnnotation(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - - sg1 := map[string]string{ServiceAnnotationLoadBalancerSecurityGroups: "sg-000001"} - sg2 := map[string]string{ServiceAnnotationLoadBalancerSecurityGroups: "sg-000002"} - sg3 := map[string]string{ServiceAnnotationLoadBalancerSecurityGroups: "sg-000001, sg-000002"} - - tests := []struct { - name string - - annotations map[string]string - expectedSGs []string - }{ - {"SG specified", sg1, []string{sg1[ServiceAnnotationLoadBalancerSecurityGroups]}}, - {"Multiple SGs specified", sg3, []string{sg1[ServiceAnnotationLoadBalancerSecurityGroups], sg2[ServiceAnnotationLoadBalancerSecurityGroups]}}, - } - - awsServices.ec2.(*MockedFakeEC2).expectDescribeSecurityGroups(TestClusterID, "k8s-elb-aid") - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - serviceName := types.NamespacedName{Namespace: "default", Name: "myservice"} - - sgList, setupSg, err := c.buildELBSecurityGroupList(serviceName, "aid", test.annotations) - assert.NoError(t, err, "buildELBSecurityGroupList failed") - assert.True(t, sets.NewString(test.expectedSGs...).Equal(sets.NewString(sgList...)), - "Security Groups expected=%q , returned=%q", test.expectedSGs, sgList) - assert.False(t, setupSg, "Security Groups Setup Permissions Flag expected=%t , returned=%t", false, setupSg) - }) - } -} - -// Test that we can add a load balancer tag -func TestAddLoadBalancerTags(t *testing.T) { - loadBalancerName := "test-elb" - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - - want := make(map[string]string) - want["tag1"] = "val1" - - expectedAddTagsRequest := &elb.AddTagsInput{ - LoadBalancerNames: []*string{&loadBalancerName}, - Tags: []*elb.Tag{ - { - Key: aws.String("tag1"), - Value: aws.String("val1"), - }, - }, - } - awsServices.elb.(*MockedFakeELB).On("AddTags", expectedAddTagsRequest).Return(&elb.AddTagsOutput{}) - - err := c.addLoadBalancerTags(loadBalancerName, want) - assert.Nil(t, err, "Error adding load balancer tags: %v", err) - awsServices.elb.(*MockedFakeELB).AssertExpectations(t) -} - -func TestEnsureLoadBalancerHealthCheck(t *testing.T) { - tests := []struct { - name string - annotations map[string]string - want elb.HealthCheck - }{ - { - name: "falls back to HC defaults", - annotations: map[string]string{}, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("TCP:8080"), - }, - }, - { - name: "healthy threshold override", - annotations: map[string]string{ServiceAnnotationLoadBalancerHCHealthyThreshold: "7"}, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(7), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("TCP:8080"), - }, - }, - { - name: "unhealthy threshold override", - annotations: map[string]string{ServiceAnnotationLoadBalancerHCUnhealthyThreshold: "7"}, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(7), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("TCP:8080"), - }, - }, - { - name: "timeout override", - annotations: map[string]string{ServiceAnnotationLoadBalancerHCTimeout: "7"}, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(7), - Interval: aws.Int64(10), - Target: aws.String("TCP:8080"), - }, - }, - { - name: "interval override", - annotations: map[string]string{ServiceAnnotationLoadBalancerHCInterval: "7"}, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(7), - Target: aws.String("TCP:8080"), - }, - }, - { - name: "healthcheck port override", - annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckPort: "2122", - }, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("TCP:2122"), - }, - }, - { - name: "healthcheck protocol override", - annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckProtocol: "HTTP", - }, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("HTTP:8080/"), - }, - }, - { - name: "healthcheck protocol, port, path override", - annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckProtocol: "HTTPS", - ServiceAnnotationLoadBalancerHealthCheckPath: "/healthz", - ServiceAnnotationLoadBalancerHealthCheckPort: "31224", - }, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("HTTPS:31224/healthz"), - }, - }, - { - name: "healthcheck protocol SSL", - annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckProtocol: "SSL", - ServiceAnnotationLoadBalancerHealthCheckPath: "/healthz", - ServiceAnnotationLoadBalancerHealthCheckPort: "3124", - }, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("SSL:3124"), - }, - }, - { - name: "healthcheck port annotation traffic-port", - annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckProtocol: "TCP", - ServiceAnnotationLoadBalancerHealthCheckPort: "traffic-port", - }, - want: elb.HealthCheck{ - HealthyThreshold: aws.Int64(2), - UnhealthyThreshold: aws.Int64(6), - Timeout: aws.Int64(5), - Interval: aws.Int64(10), - Target: aws.String("TCP:8080"), - }, - }, - } - lbName := "myLB" - // this HC will always differ from the expected HC and thus it is expected an - // API call will be made to update it - currentHC := &elb.HealthCheck{} - elbDesc := &elb.LoadBalancerDescription{LoadBalancerName: &lbName, HealthCheck: currentHC} - defaultHealthyThreshold := int64(2) - defaultUnhealthyThreshold := int64(6) - defaultTimeout := int64(5) - defaultInterval := int64(10) - protocol, path, port := "TCP", "", int32(8080) - target := "TCP:8080" - defaultHC := &elb.HealthCheck{ - HealthyThreshold: &defaultHealthyThreshold, - UnhealthyThreshold: &defaultUnhealthyThreshold, - Timeout: &defaultTimeout, - Interval: &defaultInterval, - Target: &target, - } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - expectedHC := test.want - awsServices.elb.(*MockedFakeELB).expectConfigureHealthCheck(&lbName, &expectedHC, nil) - - err = c.ensureLoadBalancerHealthCheck(elbDesc, protocol, port, path, test.annotations) - - require.NoError(t, err) - awsServices.elb.(*MockedFakeELB).AssertExpectations(t) - }) - } - - t.Run("does not make an API call if the current health check is the same", func(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - expectedHC := *defaultHC - timeout := int64(3) - expectedHC.Timeout = &timeout - annotations := map[string]string{ServiceAnnotationLoadBalancerHCTimeout: "3"} - var currentHC elb.HealthCheck - currentHC = expectedHC - - // NOTE no call expectations are set on the ELB mock - // test default HC - elbDesc := &elb.LoadBalancerDescription{LoadBalancerName: &lbName, HealthCheck: defaultHC} - err = c.ensureLoadBalancerHealthCheck(elbDesc, protocol, port, path, map[string]string{}) - assert.NoError(t, err) - // test HC with override - elbDesc = &elb.LoadBalancerDescription{LoadBalancerName: &lbName, HealthCheck: ¤tHC} - err = c.ensureLoadBalancerHealthCheck(elbDesc, protocol, port, path, annotations) - assert.NoError(t, err) - }) - - t.Run("validates resulting expected health check before making an API call", func(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - expectedHC := *defaultHC - invalidThreshold := int64(1) - expectedHC.HealthyThreshold = &invalidThreshold - require.Error(t, expectedHC.Validate()) // confirm test precondition - annotations := map[string]string{ServiceAnnotationLoadBalancerHCTimeout: "1"} - - // NOTE no call expectations are set on the ELB mock - err = c.ensureLoadBalancerHealthCheck(elbDesc, protocol, port, path, annotations) - - require.Error(t, err) - }) - - t.Run("handles invalid override values", func(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - annotations := map[string]string{ServiceAnnotationLoadBalancerHCTimeout: "3.3"} - - // NOTE no call expectations are set on the ELB mock - err = c.ensureLoadBalancerHealthCheck(elbDesc, protocol, port, path, annotations) - - require.Error(t, err) - }) - - t.Run("returns error when updating the health check fails", func(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - assert.Nil(t, err, "Error building aws cloud: %v", err) - returnErr := fmt.Errorf("throttling error") - awsServices.elb.(*MockedFakeELB).expectConfigureHealthCheck(&lbName, defaultHC, returnErr) - - err = c.ensureLoadBalancerHealthCheck(elbDesc, protocol, port, path, map[string]string{}) - - require.Error(t, err) - awsServices.elb.(*MockedFakeELB).AssertExpectations(t) - }) -} - -func TestFindSecurityGroupForInstance(t *testing.T) { - groups := map[string]*ec2.SecurityGroup{"sg123": {GroupId: aws.String("sg123")}} - id, err := findSecurityGroupForInstance(&ec2.Instance{SecurityGroups: []*ec2.GroupIdentifier{{GroupId: aws.String("sg123"), GroupName: aws.String("my_group")}}}, groups) - if err != nil { - t.Error() - } - assert.Equal(t, *id.GroupId, "sg123") - assert.Equal(t, *id.GroupName, "my_group") -} - -func TestFindSecurityGroupForInstanceMultipleTagged(t *testing.T) { - groups := map[string]*ec2.SecurityGroup{"sg123": {GroupId: aws.String("sg123")}} - _, err := findSecurityGroupForInstance(&ec2.Instance{ - SecurityGroups: []*ec2.GroupIdentifier{ - {GroupId: aws.String("sg123"), GroupName: aws.String("my_group")}, - {GroupId: aws.String("sg123"), GroupName: aws.String("another_group")}, - }, - }, groups) - require.Error(t, err) - assert.Contains(t, err.Error(), "sg123(my_group)") - assert.Contains(t, err.Error(), "sg123(another_group)") -} - -func TestCreateDisk(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - - volumeOptions := &VolumeOptions{ - AvailabilityZone: "us-east-1a", - CapacityGB: 10, - } - request := &ec2.CreateVolumeInput{ - AvailabilityZone: aws.String("us-east-1a"), - Encrypted: aws.Bool(false), - VolumeType: aws.String(DefaultVolumeType), - Size: aws.Int64(10), - TagSpecifications: []*ec2.TagSpecification{ - {ResourceType: aws.String(ec2.ResourceTypeVolume), Tags: []*ec2.Tag{ - // CreateVolume from MockedFakeEC2 expects sorted tags, so we need to - // always have these tags sorted: - {Key: aws.String(TagNameKubernetesClusterLegacy), Value: aws.String(TestClusterID)}, - {Key: aws.String(fmt.Sprintf("%s%s", TagNameKubernetesClusterPrefix, TestClusterID)), Value: aws.String(ResourceLifecycleOwned)}, - }}, - }, - } - - volume := &ec2.Volume{ - AvailabilityZone: aws.String("us-east-1a"), - VolumeId: aws.String("vol-volumeId0"), - State: aws.String("available"), - } - awsServices.ec2.(*MockedFakeEC2).On("CreateVolume", request).Return(volume, nil) - - describeVolumesRequest := &ec2.DescribeVolumesInput{ - VolumeIds: []*string{aws.String("vol-volumeId0")}, - } - awsServices.ec2.(*MockedFakeEC2).On("DescribeVolumes", describeVolumesRequest).Return([]*ec2.Volume{volume}, nil) - - volumeID, err := c.CreateDisk(volumeOptions) - assert.Nil(t, err, "Error creating disk: %v", err) - assert.Equal(t, volumeID, KubernetesVolumeID("aws://us-east-1a/vol-volumeId0")) - awsServices.ec2.(*MockedFakeEC2).AssertExpectations(t) -} - -func TestCreateDiskFailDescribeVolume(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - c, _ := newAWSCloud(CloudConfig{}, awsServices) - - volumeOptions := &VolumeOptions{ - AvailabilityZone: "us-east-1a", - CapacityGB: 10, - } - request := &ec2.CreateVolumeInput{ - AvailabilityZone: aws.String("us-east-1a"), - Encrypted: aws.Bool(false), - VolumeType: aws.String(DefaultVolumeType), - Size: aws.Int64(10), - TagSpecifications: []*ec2.TagSpecification{ - {ResourceType: aws.String(ec2.ResourceTypeVolume), Tags: []*ec2.Tag{ - // CreateVolume from MockedFakeEC2 expects sorted tags, so we need to - // always have these tags sorted: - {Key: aws.String(TagNameKubernetesClusterLegacy), Value: aws.String(TestClusterID)}, - {Key: aws.String(fmt.Sprintf("%s%s", TagNameKubernetesClusterPrefix, TestClusterID)), Value: aws.String(ResourceLifecycleOwned)}, - }}, - }, - } - - volume := &ec2.Volume{ - AvailabilityZone: aws.String("us-east-1a"), - VolumeId: aws.String("vol-volumeId0"), - State: aws.String("creating"), - } - awsServices.ec2.(*MockedFakeEC2).On("CreateVolume", request).Return(volume, nil) - - describeVolumesRequest := &ec2.DescribeVolumesInput{ - VolumeIds: []*string{aws.String("vol-volumeId0")}, - } - deleteVolumeRequest := &ec2.DeleteVolumeInput{ - VolumeId: aws.String("vol-volumeId0"), - } - awsServices.ec2.(*MockedFakeEC2).On("DescribeVolumes", describeVolumesRequest).Return([]*ec2.Volume{volume}, nil) - awsServices.ec2.(*MockedFakeEC2).On("DeleteVolume", deleteVolumeRequest).Return(&ec2.DeleteVolumeOutput{}, nil) - - volumeID, err := c.CreateDisk(volumeOptions) - assert.Error(t, err) - assert.Equal(t, volumeID, KubernetesVolumeID("")) - awsServices.ec2.(*MockedFakeEC2).AssertExpectations(t) -} - -func TestRegionIsValid(t *testing.T) { - fake := newMockedFakeAWSServices("fakeCluster") - fake.selfInstance.Placement = &ec2.Placement{ - AvailabilityZone: aws.String("pl-fake-999a"), - } - - // This is the legacy list that was removed, using this to ensure we avoid - // region regressions if something goes wrong in the SDK - regions := []string{ - "ap-northeast-1", - "ap-northeast-2", - "ap-northeast-3", - "ap-south-1", - "ap-southeast-1", - "ap-southeast-2", - "ca-central-1", - "eu-central-1", - "eu-west-1", - "eu-west-2", - "eu-west-3", - "sa-east-1", - "us-east-1", - "us-east-2", - "us-west-1", - "us-west-2", - "cn-north-1", - "cn-northwest-1", - "us-gov-west-1", - "ap-northeast-3", - - // Ensures that we always trust what the metadata service returns - "pl-fake-999", - } - - for _, region := range regions { - assert.True(t, isRegionValid(region, fake.metadata), "expected region '%s' to be valid but it was not", region) - } - - assert.False(t, isRegionValid("pl-fake-991a", fake.metadata), "expected region 'pl-fake-991' to be invalid but it was not") -} - -func TestNodeNameToProviderID(t *testing.T) { - testNodeName := types.NodeName("ip-10-0-0-1.ec2.internal") - testProviderID := "aws:///us-east-1c/i-02bce90670bb0c7cd" - fakeAWS := newMockedFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, fakeAWS) - assert.NoError(t, err) - - fakeClient := &fake.Clientset{} - fakeInformerFactory := informers.NewSharedInformerFactory(fakeClient, 0) - c.SetInformers(fakeInformerFactory) - - // no node name - _, err = c.nodeNameToProviderID("") - assert.Error(t, err) - - // informer has not synced - c.nodeInformerHasSynced = informerNotSynced - _, err = c.nodeNameToProviderID(testNodeName) - assert.Error(t, err) - - // informer has synced but node not found - c.nodeInformerHasSynced = informerSynced - _, err = c.nodeNameToProviderID(testNodeName) - assert.Error(t, err) - - // we are able to find the node in cache - err = c.nodeInformer.Informer().GetStore().Add(&v1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: string(testNodeName), - }, - Spec: v1.NodeSpec{ - ProviderID: testProviderID, - }, - }) - assert.NoError(t, err) - _, err = c.nodeNameToProviderID(testNodeName) - assert.NoError(t, err) -} - -func informerSynced() bool { - return true -} - -func informerNotSynced() bool { - return false -} - -type MockedFakeELBV2 struct { - LoadBalancers []*elbv2.LoadBalancer - TargetGroups []*elbv2.TargetGroup - Listeners []*elbv2.Listener - - // keys on all of these maps are ARNs - LoadBalancerAttributes map[string]map[string]string - Tags map[string][]elbv2.Tag - RegisteredInstances map[string][]string // value is list of instance IDs -} - -func (m *MockedFakeELBV2) AddTags(request *elbv2.AddTagsInput) (*elbv2.AddTagsOutput, error) { - for _, arn := range request.ResourceArns { - for _, tag := range request.Tags { - m.Tags[aws.StringValue(arn)] = append(m.Tags[aws.StringValue(arn)], *tag) - } - } - - return &elbv2.AddTagsOutput{}, nil -} - -func (m *MockedFakeELBV2) CreateLoadBalancer(request *elbv2.CreateLoadBalancerInput) (*elbv2.CreateLoadBalancerOutput, error) { - accountID := 123456789 - arn := fmt.Sprintf("arn:aws:elasticloadbalancing:us-east-1:%d:loadbalancer/net/%x/%x", - accountID, - rand.Uint64(), - rand.Uint32()) - - newLB := &elbv2.LoadBalancer{ - LoadBalancerArn: aws.String(arn), - LoadBalancerName: request.Name, - Type: aws.String(elbv2.LoadBalancerTypeEnumNetwork), - VpcId: aws.String("vpc-abc123def456abc78"), - } - m.LoadBalancers = append(m.LoadBalancers, newLB) - - return &elbv2.CreateLoadBalancerOutput{ - LoadBalancers: []*elbv2.LoadBalancer{newLB}, - }, nil -} - -func (m *MockedFakeELBV2) DescribeLoadBalancers(request *elbv2.DescribeLoadBalancersInput) (*elbv2.DescribeLoadBalancersOutput, error) { - findMeNames := make(map[string]bool) - for _, name := range request.Names { - findMeNames[aws.StringValue(name)] = true - } - - findMeARNs := make(map[string]bool) - for _, arn := range request.LoadBalancerArns { - findMeARNs[aws.StringValue(arn)] = true - } - - result := []*elbv2.LoadBalancer{} - - for _, lb := range m.LoadBalancers { - if _, present := findMeNames[aws.StringValue(lb.LoadBalancerName)]; present { - result = append(result, lb) - delete(findMeNames, aws.StringValue(lb.LoadBalancerName)) - } else if _, present := findMeARNs[aws.StringValue(lb.LoadBalancerArn)]; present { - result = append(result, lb) - delete(findMeARNs, aws.StringValue(lb.LoadBalancerArn)) - } - } - - if len(findMeNames) > 0 || len(findMeARNs) > 0 { - return nil, awserr.New(elbv2.ErrCodeLoadBalancerNotFoundException, "not found", nil) - } - - return &elbv2.DescribeLoadBalancersOutput{ - LoadBalancers: result, - }, nil -} - -func (m *MockedFakeELBV2) DeleteLoadBalancer(*elbv2.DeleteLoadBalancerInput) (*elbv2.DeleteLoadBalancerOutput, error) { - panic("Not implemented") -} - -func (m *MockedFakeELBV2) ModifyLoadBalancerAttributes(request *elbv2.ModifyLoadBalancerAttributesInput) (*elbv2.ModifyLoadBalancerAttributesOutput, error) { - attrMap, present := m.LoadBalancerAttributes[aws.StringValue(request.LoadBalancerArn)] - - if !present { - attrMap = make(map[string]string) - m.LoadBalancerAttributes[aws.StringValue(request.LoadBalancerArn)] = attrMap - } - - for _, attr := range request.Attributes { - attrMap[aws.StringValue(attr.Key)] = aws.StringValue(attr.Value) - } - - return &elbv2.ModifyLoadBalancerAttributesOutput{ - Attributes: request.Attributes, - }, nil -} - -func (m *MockedFakeELBV2) DescribeLoadBalancerAttributes(request *elbv2.DescribeLoadBalancerAttributesInput) (*elbv2.DescribeLoadBalancerAttributesOutput, error) { - attrs := []*elbv2.LoadBalancerAttribute{} - - if lbAttrs, present := m.LoadBalancerAttributes[aws.StringValue(request.LoadBalancerArn)]; present { - for key, value := range lbAttrs { - attrs = append(attrs, &elbv2.LoadBalancerAttribute{ - Key: aws.String(key), - Value: aws.String(value), - }) - } - } - - return &elbv2.DescribeLoadBalancerAttributesOutput{ - Attributes: attrs, - }, nil -} - -func (m *MockedFakeELBV2) CreateTargetGroup(request *elbv2.CreateTargetGroupInput) (*elbv2.CreateTargetGroupOutput, error) { - accountID := 123456789 - arn := fmt.Sprintf("arn:aws:elasticloadbalancing:us-east-1:%d:targetgroup/%x/%x", - accountID, - rand.Uint64(), - rand.Uint32()) - - newTG := &elbv2.TargetGroup{ - TargetGroupArn: aws.String(arn), - TargetGroupName: request.Name, - Port: request.Port, - Protocol: request.Protocol, - HealthCheckProtocol: request.HealthCheckProtocol, - HealthCheckPath: request.HealthCheckPath, - HealthCheckPort: request.HealthCheckPort, - HealthCheckTimeoutSeconds: request.HealthCheckTimeoutSeconds, - HealthCheckIntervalSeconds: request.HealthCheckIntervalSeconds, - HealthyThresholdCount: request.HealthyThresholdCount, - UnhealthyThresholdCount: request.UnhealthyThresholdCount, - } - - m.TargetGroups = append(m.TargetGroups, newTG) - - return &elbv2.CreateTargetGroupOutput{ - TargetGroups: []*elbv2.TargetGroup{newTG}, - }, nil -} - -func (m *MockedFakeELBV2) DescribeTargetGroups(request *elbv2.DescribeTargetGroupsInput) (*elbv2.DescribeTargetGroupsOutput, error) { - var targetGroups []*elbv2.TargetGroup - - if request.LoadBalancerArn != nil { - targetGroups = []*elbv2.TargetGroup{} - - for _, tg := range m.TargetGroups { - for _, lbArn := range tg.LoadBalancerArns { - if aws.StringValue(lbArn) == aws.StringValue(request.LoadBalancerArn) { - targetGroups = append(targetGroups, tg) - break - } - } - } - } else if len(request.Names) != 0 { - targetGroups = []*elbv2.TargetGroup{} - - for _, tg := range m.TargetGroups { - for _, name := range request.Names { - if aws.StringValue(tg.TargetGroupName) == aws.StringValue(name) { - targetGroups = append(targetGroups, tg) - break - } - } - } - } else if len(request.TargetGroupArns) != 0 { - targetGroups = []*elbv2.TargetGroup{} - - for _, tg := range m.TargetGroups { - for _, arn := range request.TargetGroupArns { - if aws.StringValue(tg.TargetGroupArn) == aws.StringValue(arn) { - targetGroups = append(targetGroups, tg) - break - } - } - } - } else { - targetGroups = m.TargetGroups - } - - return &elbv2.DescribeTargetGroupsOutput{ - TargetGroups: targetGroups, - }, nil -} - -func (m *MockedFakeELBV2) ModifyTargetGroup(request *elbv2.ModifyTargetGroupInput) (*elbv2.ModifyTargetGroupOutput, error) { - var matchingTargetGroup *elbv2.TargetGroup - dirtyGroups := []*elbv2.TargetGroup{} - - for _, tg := range m.TargetGroups { - if aws.StringValue(tg.TargetGroupArn) == aws.StringValue(request.TargetGroupArn) { - matchingTargetGroup = tg - break - } - } - - if matchingTargetGroup != nil { - dirtyGroups = append(dirtyGroups, matchingTargetGroup) - - if request.HealthCheckEnabled != nil { - matchingTargetGroup.HealthCheckEnabled = request.HealthCheckEnabled - } - if request.HealthCheckIntervalSeconds != nil { - matchingTargetGroup.HealthCheckIntervalSeconds = request.HealthCheckIntervalSeconds - } - if request.HealthCheckPath != nil { - matchingTargetGroup.HealthCheckPath = request.HealthCheckPath - } - if request.HealthCheckPort != nil { - matchingTargetGroup.HealthCheckPort = request.HealthCheckPort - } - if request.HealthCheckProtocol != nil { - matchingTargetGroup.HealthCheckProtocol = request.HealthCheckProtocol - } - if request.HealthCheckTimeoutSeconds != nil { - matchingTargetGroup.HealthCheckTimeoutSeconds = request.HealthCheckTimeoutSeconds - } - if request.HealthyThresholdCount != nil { - matchingTargetGroup.HealthyThresholdCount = request.HealthyThresholdCount - } - if request.Matcher != nil { - matchingTargetGroup.Matcher = request.Matcher - } - if request.UnhealthyThresholdCount != nil { - matchingTargetGroup.UnhealthyThresholdCount = request.UnhealthyThresholdCount - } - } - - return &elbv2.ModifyTargetGroupOutput{ - TargetGroups: dirtyGroups, - }, nil -} - -func (m *MockedFakeELBV2) DeleteTargetGroup(request *elbv2.DeleteTargetGroupInput) (*elbv2.DeleteTargetGroupOutput, error) { - newTargetGroups := []*elbv2.TargetGroup{} - - for _, tg := range m.TargetGroups { - if aws.StringValue(tg.TargetGroupArn) != aws.StringValue(request.TargetGroupArn) { - newTargetGroups = append(newTargetGroups, tg) - } - } - - m.TargetGroups = newTargetGroups - - delete(m.RegisteredInstances, aws.StringValue(request.TargetGroupArn)) - - return &elbv2.DeleteTargetGroupOutput{}, nil -} - -func (m *MockedFakeELBV2) DescribeTargetHealth(request *elbv2.DescribeTargetHealthInput) (*elbv2.DescribeTargetHealthOutput, error) { - healthDescriptions := []*elbv2.TargetHealthDescription{} - - var matchingTargetGroup *elbv2.TargetGroup - - for _, tg := range m.TargetGroups { - if aws.StringValue(tg.TargetGroupArn) == aws.StringValue(request.TargetGroupArn) { - matchingTargetGroup = tg - break - } - } - - if registeredTargets, present := m.RegisteredInstances[aws.StringValue(request.TargetGroupArn)]; present { - for _, target := range registeredTargets { - healthDescriptions = append(healthDescriptions, &elbv2.TargetHealthDescription{ - HealthCheckPort: matchingTargetGroup.HealthCheckPort, - Target: &elbv2.TargetDescription{ - Id: aws.String(target), - Port: matchingTargetGroup.Port, - }, - TargetHealth: &elbv2.TargetHealth{ - State: aws.String("healthy"), - }, - }) - } - } - - return &elbv2.DescribeTargetHealthOutput{ - TargetHealthDescriptions: healthDescriptions, - }, nil -} - -func (m *MockedFakeELBV2) DescribeTargetGroupAttributes(*elbv2.DescribeTargetGroupAttributesInput) (*elbv2.DescribeTargetGroupAttributesOutput, error) { - panic("Not implemented") -} - -func (m *MockedFakeELBV2) ModifyTargetGroupAttributes(*elbv2.ModifyTargetGroupAttributesInput) (*elbv2.ModifyTargetGroupAttributesOutput, error) { - panic("Not implemented") -} - -func (m *MockedFakeELBV2) RegisterTargets(request *elbv2.RegisterTargetsInput) (*elbv2.RegisterTargetsOutput, error) { - arn := aws.StringValue(request.TargetGroupArn) - alreadyExists := make(map[string]bool) - for _, targetID := range m.RegisteredInstances[arn] { - alreadyExists[targetID] = true - } - for _, target := range request.Targets { - if !alreadyExists[aws.StringValue(target.Id)] { - m.RegisteredInstances[arn] = append(m.RegisteredInstances[arn], aws.StringValue(target.Id)) - } - } - return &elbv2.RegisterTargetsOutput{}, nil -} - -func (m *MockedFakeELBV2) DeregisterTargets(request *elbv2.DeregisterTargetsInput) (*elbv2.DeregisterTargetsOutput, error) { - removeMe := make(map[string]bool) - - for _, target := range request.Targets { - removeMe[aws.StringValue(target.Id)] = true - } - newRegisteredInstancesForArn := []string{} - for _, targetID := range m.RegisteredInstances[aws.StringValue(request.TargetGroupArn)] { - if !removeMe[targetID] { - newRegisteredInstancesForArn = append(newRegisteredInstancesForArn, targetID) - } - } - m.RegisteredInstances[aws.StringValue(request.TargetGroupArn)] = newRegisteredInstancesForArn - - return &elbv2.DeregisterTargetsOutput{}, nil -} - -func (m *MockedFakeELBV2) CreateListener(request *elbv2.CreateListenerInput) (*elbv2.CreateListenerOutput, error) { - accountID := 123456789 - arn := fmt.Sprintf("arn:aws:elasticloadbalancing:us-east-1:%d:listener/net/%x/%x/%x", - accountID, - rand.Uint64(), - rand.Uint32(), - rand.Uint32()) - - newListener := &elbv2.Listener{ - ListenerArn: aws.String(arn), - Port: request.Port, - Protocol: request.Protocol, - DefaultActions: request.DefaultActions, - LoadBalancerArn: request.LoadBalancerArn, - } - - m.Listeners = append(m.Listeners, newListener) - - for _, tg := range m.TargetGroups { - for _, action := range request.DefaultActions { - if aws.StringValue(action.TargetGroupArn) == aws.StringValue(tg.TargetGroupArn) { - tg.LoadBalancerArns = append(tg.LoadBalancerArns, request.LoadBalancerArn) - break - } - } - } - - return &elbv2.CreateListenerOutput{ - Listeners: []*elbv2.Listener{newListener}, - }, nil -} - -func (m *MockedFakeELBV2) DescribeListeners(request *elbv2.DescribeListenersInput) (*elbv2.DescribeListenersOutput, error) { - if len(request.ListenerArns) == 0 && request.LoadBalancerArn == nil { - return &elbv2.DescribeListenersOutput{ - Listeners: m.Listeners, - }, nil - } else if len(request.ListenerArns) == 0 { - listeners := []*elbv2.Listener{} - - for _, lb := range m.Listeners { - if aws.StringValue(lb.LoadBalancerArn) == aws.StringValue(request.LoadBalancerArn) { - listeners = append(listeners, lb) - } - } - - return &elbv2.DescribeListenersOutput{ - Listeners: listeners, - }, nil - } - panic("Not implemented") -} - -func (m *MockedFakeELBV2) DeleteListener(*elbv2.DeleteListenerInput) (*elbv2.DeleteListenerOutput, error) { - panic("Not implemented") -} - -func (m *MockedFakeELBV2) ModifyListener(request *elbv2.ModifyListenerInput) (*elbv2.ModifyListenerOutput, error) { - modifiedListeners := []*elbv2.Listener{} - - for _, listener := range m.Listeners { - if aws.StringValue(listener.ListenerArn) == aws.StringValue(request.ListenerArn) { - if request.DefaultActions != nil { - // for each old action, find the corresponding target group, and remove the listener's LB ARN from its list - for _, action := range listener.DefaultActions { - var targetGroupForAction *elbv2.TargetGroup - - for _, tg := range m.TargetGroups { - if aws.StringValue(action.TargetGroupArn) == aws.StringValue(tg.TargetGroupArn) { - targetGroupForAction = tg - break - } - } - - if targetGroupForAction != nil { - newLoadBalancerARNs := []*string{} - for _, lbArn := range targetGroupForAction.LoadBalancerArns { - if aws.StringValue(lbArn) != aws.StringValue(listener.LoadBalancerArn) { - newLoadBalancerARNs = append(newLoadBalancerARNs, lbArn) - } - } - - targetGroupForAction.LoadBalancerArns = newLoadBalancerARNs - } - } - - listener.DefaultActions = request.DefaultActions - - // for each new action, add the listener's LB ARN to that action's target groups' lists - for _, action := range request.DefaultActions { - var targetGroupForAction *elbv2.TargetGroup - - for _, tg := range m.TargetGroups { - if aws.StringValue(action.TargetGroupArn) == aws.StringValue(tg.TargetGroupArn) { - targetGroupForAction = tg - break - } - } - - if targetGroupForAction != nil { - targetGroupForAction.LoadBalancerArns = append(targetGroupForAction.LoadBalancerArns, listener.LoadBalancerArn) - } - } - } - if request.Port != nil { - listener.Port = request.Port - } - if request.Protocol != nil { - listener.Protocol = request.Protocol - } - - modifiedListeners = append(modifiedListeners, listener) - } - } - - return &elbv2.ModifyListenerOutput{ - Listeners: modifiedListeners, - }, nil -} - -func (m *MockedFakeELBV2) WaitUntilLoadBalancersDeleted(*elbv2.DescribeLoadBalancersInput) error { - panic("Not implemented") -} - -func (m *MockedFakeEC2) maybeExpectDescribeSecurityGroups(clusterID, groupName string) { - tags := []*ec2.Tag{ - {Key: aws.String(TagNameKubernetesClusterLegacy), Value: aws.String(clusterID)}, - {Key: aws.String(fmt.Sprintf("%s%s", TagNameKubernetesClusterPrefix, clusterID)), Value: aws.String(ResourceLifecycleOwned)}, - } - - m.On("DescribeSecurityGroups", &ec2.DescribeSecurityGroupsInput{Filters: []*ec2.Filter{ - newEc2Filter("group-name", groupName), - newEc2Filter("vpc-id", ""), - }}).Maybe().Return([]*ec2.SecurityGroup{{Tags: tags}}) - - m.On("DescribeSecurityGroups", &ec2.DescribeSecurityGroupsInput{}).Maybe().Return([]*ec2.SecurityGroup{{Tags: tags}}) -} - -func TestNLBNodeRegistration(t *testing.T) { - awsServices := newMockedFakeAWSServices(TestClusterID) - awsServices.elbv2 = &MockedFakeELBV2{Tags: make(map[string][]elbv2.Tag), RegisteredInstances: make(map[string][]string), LoadBalancerAttributes: make(map[string]map[string]string)} - c, _ := newAWSCloud(CloudConfig{}, awsServices) - - awsServices.ec2.(*MockedFakeEC2).Subnets = []*ec2.Subnet{ - { - AvailabilityZone: aws.String("us-west-2a"), - SubnetId: aws.String("subnet-abc123de"), - Tags: []*ec2.Tag{ - { - Key: aws.String(c.tagging.clusterTagKey()), - Value: aws.String("owned"), - }, - }, - }, - } - - awsServices.ec2.(*MockedFakeEC2).RouteTables = []*ec2.RouteTable{ - { - Associations: []*ec2.RouteTableAssociation{ - { - Main: aws.Bool(true), - RouteTableAssociationId: aws.String("rtbassoc-abc123def456abc78"), - RouteTableId: aws.String("rtb-abc123def456abc78"), - SubnetId: aws.String("subnet-abc123de"), - }, - }, - RouteTableId: aws.String("rtb-abc123def456abc78"), - Routes: []*ec2.Route{ - { - DestinationCidrBlock: aws.String("0.0.0.0/0"), - GatewayId: aws.String("igw-abc123def456abc78"), - State: aws.String("active"), - }, - }, - }, - } - awsServices.ec2.(*MockedFakeEC2).maybeExpectDescribeSecurityGroups(TestClusterID, "k8s-elb-aid") - - nodes := []*v1.Node{makeNamedNode(awsServices, 0, "a"), makeNamedNode(awsServices, 1, "b"), makeNamedNode(awsServices, 2, "c")} - - fauxService := &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "myservice", - UID: "id", - Annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-type": "nlb", - }, - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Name: "http", - Port: 8080, - NodePort: 31173, - TargetPort: intstr.FromInt(31173), - Protocol: v1.ProtocolTCP, - }, - }, - SessionAffinity: v1.ServiceAffinityNone, - }, - } - - _, err := c.EnsureLoadBalancer(context.TODO(), TestClusterName, fauxService, nodes) - if err != nil { - t.Errorf("EnsureLoadBalancer returned an error: %v", err) - } - for _, instances := range awsServices.elbv2.(*MockedFakeELBV2).RegisteredInstances { - if len(instances) != 3 { - t.Errorf("Expected 3 nodes registered with target group, saw %d", len(instances)) - } - } - - _, err = c.EnsureLoadBalancer(context.TODO(), TestClusterName, fauxService, nodes[:2]) - if err != nil { - t.Errorf("EnsureLoadBalancer returned an error: %v", err) - } - for _, instances := range awsServices.elbv2.(*MockedFakeELBV2).RegisteredInstances { - if len(instances) != 2 { - t.Errorf("Expected 2 nodes registered with target group, saw %d", len(instances)) - } - } - - _, err = c.EnsureLoadBalancer(context.TODO(), TestClusterName, fauxService, nodes) - if err != nil { - t.Errorf("EnsureLoadBalancer returned an error: %v", err) - } - for _, instances := range awsServices.elbv2.(*MockedFakeELBV2).RegisteredInstances { - if len(instances) != 3 { - t.Errorf("Expected 3 nodes registered with target group, saw %d", len(instances)) - } - } - - fauxService.Annotations[ServiceAnnotationLoadBalancerHealthCheckProtocol] = "http" - tgARN := aws.StringValue(awsServices.elbv2.(*MockedFakeELBV2).Listeners[0].DefaultActions[0].TargetGroupArn) - _, err = c.EnsureLoadBalancer(context.TODO(), TestClusterName, fauxService, nodes) - if err != nil { - t.Errorf("EnsureLoadBalancer returned an error: %v", err) - } - assert.Equal(t, 1, len(awsServices.elbv2.(*MockedFakeELBV2).Listeners)) - assert.NotEqual(t, tgARN, aws.StringValue(awsServices.elbv2.(*MockedFakeELBV2).Listeners[0].DefaultActions[0].TargetGroupArn)) -} - -func makeNamedNode(s *FakeAWSServices, offset int, name string) *v1.Node { - instanceID := fmt.Sprintf("i-%x", int64(0x02bce90670bb0c7cd)+int64(offset)) - instance := &ec2.Instance{} - instance.InstanceId = aws.String(instanceID) - instance.Placement = &ec2.Placement{ - AvailabilityZone: aws.String("us-east-1c"), - } - instance.PrivateDnsName = aws.String(fmt.Sprintf("ip-172-20-0-%d.ec2.internal", 101+offset)) - instance.PrivateIpAddress = aws.String(fmt.Sprintf("192.168.0.%d", 1+offset)) - - var tag ec2.Tag - tag.Key = aws.String(TagNameKubernetesClusterLegacy) - tag.Value = aws.String(TestClusterID) - instance.Tags = []*ec2.Tag{&tag} - - s.instances = append(s.instances, instance) - - testProviderID := "aws:///us-east-1c/" + instanceID - return &v1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - Spec: v1.NodeSpec{ - ProviderID: testProviderID, - }, - } -} - -func newMockedFakeAWSServices(id string) *FakeAWSServices { - s := NewFakeAWSServices(id) - s.ec2 = &MockedFakeEC2{FakeEC2Impl: s.ec2.(*FakeEC2Impl)} - s.elb = &MockedFakeELB{FakeELB: s.elb.(*FakeELB)} - return s -} - -func TestAzToRegion(t *testing.T) { - testCases := []struct { - az string - region string - }{ - {"us-west-2a", "us-west-2"}, - {"us-west-2-lax-1a", "us-west-2"}, - {"ap-northeast-2a", "ap-northeast-2"}, - {"us-gov-east-1a", "us-gov-east-1"}, - {"us-iso-east-1a", "us-iso-east-1"}, - {"us-isob-east-1a", "us-isob-east-1"}, - } - - for _, testCase := range testCases { - result, err := azToRegion(testCase.az) - assert.NoError(t, err) - assert.Equal(t, testCase.region, result) - } -} - -func TestCloud_sortELBSecurityGroupList(t *testing.T) { - type args struct { - securityGroupIDs []string - annotations map[string]string - } - tests := []struct { - name string - args args - wantSecurityGroupIDs []string - }{ - { - name: "with no annotation", - args: args{ - securityGroupIDs: []string{"sg-1"}, - annotations: map[string]string{}, - }, - wantSecurityGroupIDs: []string{"sg-1"}, - }, - { - name: "with service.beta.kubernetes.io/aws-load-balancer-security-groups", - args: args{ - securityGroupIDs: []string{"sg-2", "sg-1", "sg-3"}, - annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-security-groups": "sg-3,sg-2,sg-1", - }, - }, - wantSecurityGroupIDs: []string{"sg-3", "sg-2", "sg-1"}, - }, - { - name: "with service.beta.kubernetes.io/aws-load-balancer-extra-security-groups", - args: args{ - securityGroupIDs: []string{"sg-2", "sg-1", "sg-3", "sg-4"}, - annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-extra-security-groups": "sg-3,sg-2,sg-1", - }, - }, - wantSecurityGroupIDs: []string{"sg-4", "sg-3", "sg-2", "sg-1"}, - }, - { - name: "with both annotation", - args: args{ - securityGroupIDs: []string{"sg-2", "sg-1", "sg-3", "sg-4", "sg-5", "sg-6"}, - annotations: map[string]string{ - "service.beta.kubernetes.io/aws-load-balancer-security-groups": "sg-3,sg-2,sg-1", - "service.beta.kubernetes.io/aws-load-balancer-extra-security-groups": "sg-6,sg-5", - }, - }, - wantSecurityGroupIDs: []string{"sg-3", "sg-2", "sg-1", "sg-4", "sg-6", "sg-5"}, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Cloud{} - c.sortELBSecurityGroupList(tt.args.securityGroupIDs, tt.args.annotations) - assert.Equal(t, tt.wantSecurityGroupIDs, tt.args.securityGroupIDs) - }) - } -} - -func TestCloud_buildNLBHealthCheckConfiguration(t *testing.T) { - tests := []struct { - name string - annotations map[string]string - service *v1.Service - want healthCheckConfig - wantError bool - }{ - { - name: "default cluster", - annotations: map[string]string{}, - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - }, - }, - want: healthCheckConfig{ - Port: "traffic-port", - Protocol: elbv2.ProtocolEnumTcp, - Interval: 30, - Timeout: 10, - HealthyThreshold: 3, - UnhealthyThreshold: 3, - }, - wantError: false, - }, - { - name: "default local", - annotations: map[string]string{}, - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - }, - Spec: v1.ServiceSpec{ - Type: v1.ServiceTypeLoadBalancer, - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyLocal, - HealthCheckNodePort: 32213, - }, - }, - want: healthCheckConfig{ - Port: "32213", - Path: "/healthz", - Protocol: elbv2.ProtocolEnumHttp, - Interval: 10, - Timeout: 10, - HealthyThreshold: 2, - UnhealthyThreshold: 2, - }, - wantError: false, - }, - { - name: "with TCP healthcheck", - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckProtocol: "TCP", - ServiceAnnotationLoadBalancerHealthCheckPort: "8001", - ServiceAnnotationLoadBalancerHealthCheckPath: "/healthz", - ServiceAnnotationLoadBalancerHCHealthyThreshold: "4", - ServiceAnnotationLoadBalancerHCUnhealthyThreshold: "4", - ServiceAnnotationLoadBalancerHCInterval: "10", - ServiceAnnotationLoadBalancerHCTimeout: "5", - }, - }, - Spec: v1.ServiceSpec{ - Type: v1.ServiceTypeLoadBalancer, - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyLocal, - HealthCheckNodePort: 32213, - }, - }, - want: healthCheckConfig{ - Interval: 10, - Timeout: 5, - Protocol: "TCP", - Port: "8001", - HealthyThreshold: 4, - UnhealthyThreshold: 4, - }, - wantError: false, - }, - { - name: "with HTTP healthcheck", - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckProtocol: "HTTP", - ServiceAnnotationLoadBalancerHealthCheckPort: "41233", - ServiceAnnotationLoadBalancerHealthCheckPath: "/healthz", - ServiceAnnotationLoadBalancerHCHealthyThreshold: "5", - ServiceAnnotationLoadBalancerHCUnhealthyThreshold: "5", - ServiceAnnotationLoadBalancerHCInterval: "30", - ServiceAnnotationLoadBalancerHCTimeout: "6", - }, - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - }, - }, - want: healthCheckConfig{ - Interval: 30, - Timeout: 6, - Protocol: "HTTP", - Port: "41233", - Path: "/healthz", - HealthyThreshold: 5, - UnhealthyThreshold: 5, - }, - wantError: false, - }, - { - name: "HTTP healthcheck default path", - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerHealthCheckProtocol: "Http", - }, - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - }, - }, - want: healthCheckConfig{ - Interval: 30, - Timeout: 10, - Protocol: "HTTP", - Path: "/", - Port: "traffic-port", - HealthyThreshold: 3, - UnhealthyThreshold: 3, - }, - wantError: false, - }, - { - name: "interval not 10 or 30", - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerHCInterval: "23", - }, - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - }, - }, - want: healthCheckConfig{ - Port: "traffic-port", - Protocol: elbv2.ProtocolEnumTcp, - Interval: 23, - Timeout: 10, - HealthyThreshold: 3, - UnhealthyThreshold: 3, - }, - wantError: false, - }, - { - name: "invalid timeout", - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerHCTimeout: "non-numeric", - }, - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - }, - }, - want: healthCheckConfig{}, - wantError: true, - }, - { - name: "mismatch healthy and unhealthy targets", - service: &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-svc", - UID: "UID", - Annotations: map[string]string{ - ServiceAnnotationLoadBalancerHCHealthyThreshold: "7", - ServiceAnnotationLoadBalancerHCUnhealthyThreshold: "5", - }, - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Name: "http", - Protocol: v1.ProtocolTCP, - Port: 8080, - TargetPort: intstr.FromInt(8880), - NodePort: 32205, - }, - }, - }, - }, - want: healthCheckConfig{ - Port: "traffic-port", - Protocol: elbv2.ProtocolEnumTcp, - Interval: 30, - Timeout: 10, - HealthyThreshold: 7, - UnhealthyThreshold: 5, - }, - wantError: false, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Cloud{} - hc, err := c.buildNLBHealthCheckConfiguration(tt.service) - if !tt.wantError { - assert.Equal(t, tt.want, hc) - } else { - assert.NotNil(t, err) - } - }) - } -} - -func Test_parseStringSliceAnnotation(t *testing.T) { - tests := []struct { - name string - annotation string - annotations map[string]string - want []string - wantExist bool - }{ - { - name: "empty annotation", - annotation: "test.annotation", - wantExist: false, - }, - { - name: "empty value", - annotation: "a1", - annotations: map[string]string{ - "a1": "\t, ,,", - }, - want: nil, - wantExist: true, - }, - { - name: "single value", - annotation: "a1", - annotations: map[string]string{ - "a1": " value 1 ", - }, - want: []string{"value 1"}, - wantExist: true, - }, - { - name: "multiple values", - annotation: "a1", - annotations: map[string]string{ - "a1": "subnet-1, subnet-2, My Subnet ", - }, - want: []string{"subnet-1", "subnet-2", "My Subnet"}, - wantExist: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - var gotValue []string - gotExist := parseStringSliceAnnotation(tt.annotations, tt.annotation, &gotValue) - assert.Equal(t, tt.wantExist, gotExist) - assert.Equal(t, tt.want, gotValue) - }) - } -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_utils.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_utils.go deleted file mode 100644 index f9e6cdab617..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_utils.go +++ /dev/null @@ -1,48 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "github.com/aws/aws-sdk-go/aws" - - "k8s.io/apimachinery/pkg/util/sets" -) - -func stringSetToPointers(in sets.String) []*string { - if in == nil { - return nil - } - out := make([]*string, 0, len(in)) - for k := range in { - out = append(out, aws.String(k)) - } - return out -} - -func stringSetFromPointers(in []*string) sets.String { - if in == nil { - return nil - } - out := sets.NewString() - for i := range in { - out.Insert(aws.StringValue(in[i])) - } - return out -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator.go b/staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator.go deleted file mode 100644 index 14f1c685e6f..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator.go +++ /dev/null @@ -1,135 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - "sort" - "sync" -) - -// ExistingDevices is a map of assigned devices. Presence of a key with a device -// name in the map means that the device is allocated. Value is irrelevant and -// can be used for anything that DeviceAllocator user wants. -// Only the relevant part of device name should be in the map, e.g. "ba" for -// "/dev/xvdba". -type ExistingDevices map[mountDevice]EBSVolumeID - -// DeviceAllocator finds available device name, taking into account already -// assigned device names from ExistingDevices map. It tries to find the next -// device name to the previously assigned one (from previous DeviceAllocator -// call), so all available device names are used eventually and it minimizes -// device name reuse. -// -// All these allocations are in-memory, nothing is written to / read from -// /dev directory. -// -// On AWS, we should assign new (not yet used) device names to attached volumes. -// If we reuse a previously used name, we may get the volume "attaching" forever, -// see https://aws.amazon.com/premiumsupport/knowledge-center/ebs-stuck-attaching/. -type DeviceAllocator interface { - // GetNext returns a free device name or error when there is no free device - // name. Only the device suffix is returned, e.g. "ba" for "/dev/xvdba". - // It's up to the called to add appropriate "/dev/sd" or "/dev/xvd" prefix. - GetNext(existingDevices ExistingDevices) (mountDevice, error) - - // Deprioritize the device so as it can't be used immediately again - Deprioritize(mountDevice) - - // Lock the deviceAllocator - Lock() - - // Unlock the deviceAllocator - Unlock() -} - -type deviceAllocator struct { - possibleDevices map[mountDevice]int - counter int - deviceLock sync.Mutex -} - -var _ DeviceAllocator = &deviceAllocator{} - -type devicePair struct { - deviceName mountDevice - deviceIndex int -} - -type devicePairList []devicePair - -func (p devicePairList) Len() int { return len(p) } -func (p devicePairList) Less(i, j int) bool { return p[i].deviceIndex < p[j].deviceIndex } -func (p devicePairList) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -// NewDeviceAllocator allocates device names according to scheme ba..bz, ca..cz -// it moves along the ring and always picks next device until device list is -// exhausted. -func NewDeviceAllocator() DeviceAllocator { - possibleDevices := make(map[mountDevice]int) - for _, firstChar := range []rune{'b', 'c'} { - for i := 'a'; i <= 'z'; i++ { - dev := mountDevice([]rune{firstChar, i}) - possibleDevices[dev] = 0 - } - } - return &deviceAllocator{ - possibleDevices: possibleDevices, - counter: 0, - } -} - -// GetNext gets next available device from the pool, this function assumes that caller -// holds the necessary lock on deviceAllocator -func (d *deviceAllocator) GetNext(existingDevices ExistingDevices) (mountDevice, error) { - for _, devicePair := range d.sortByCount() { - if _, found := existingDevices[devicePair.deviceName]; !found { - return devicePair.deviceName, nil - } - } - return "", fmt.Errorf("no devices are available") -} - -func (d *deviceAllocator) sortByCount() devicePairList { - dpl := make(devicePairList, 0) - for deviceName, deviceIndex := range d.possibleDevices { - dpl = append(dpl, devicePair{deviceName, deviceIndex}) - } - sort.Sort(dpl) - return dpl -} - -func (d *deviceAllocator) Lock() { - d.deviceLock.Lock() -} - -func (d *deviceAllocator) Unlock() { - d.deviceLock.Unlock() -} - -// Deprioritize the device so as it can't be used immediately again -func (d *deviceAllocator) Deprioritize(chosen mountDevice) { - d.deviceLock.Lock() - defer d.deviceLock.Unlock() - if _, ok := d.possibleDevices[chosen]; ok { - d.counter++ - d.possibleDevices[chosen] = d.counter - } -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator_test.go deleted file mode 100644 index 6dea8500fd7..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/device_allocator_test.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import "testing" - -func TestDeviceAllocator(t *testing.T) { - tests := []struct { - name string - existingDevices ExistingDevices - deviceMap map[mountDevice]int - expectedOutput mountDevice - }{ - { - "empty device list with wrap", - ExistingDevices{}, - generateUnsortedDeviceList(), - "bd", // next to 'zz' is the first one, 'ba' - }, - } - - for _, test := range tests { - allocator := NewDeviceAllocator().(*deviceAllocator) - for k, v := range test.deviceMap { - allocator.possibleDevices[k] = v - } - - got, err := allocator.GetNext(test.existingDevices) - if err != nil { - t.Errorf("text %q: unexpected error: %v", test.name, err) - } - if got != test.expectedOutput { - t.Errorf("text %q: expected %q, got %q", test.name, test.expectedOutput, got) - } - } -} - -func generateUnsortedDeviceList() map[mountDevice]int { - possibleDevices := make(map[mountDevice]int) - for _, firstChar := range []rune{'b', 'c'} { - for i := 'a'; i <= 'z'; i++ { - dev := mountDevice([]rune{firstChar, i}) - possibleDevices[dev] = 3 - } - } - possibleDevices["bd"] = 0 - return possibleDevices -} - -func TestDeviceAllocatorError(t *testing.T) { - allocator := NewDeviceAllocator().(*deviceAllocator) - existingDevices := ExistingDevices{} - - // make all devices used - var first, second byte - for first = 'b'; first <= 'c'; first++ { - for second = 'a'; second <= 'z'; second++ { - device := [2]byte{first, second} - existingDevices[mountDevice(device[:])] = "used" - } - } - - device, err := allocator.GetNext(existingDevices) - if err == nil { - t.Errorf("expected error, got device %q", device) - } -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/doc.go b/staging/src/k8s.io/legacy-cloud-providers/aws/doc.go deleted file mode 100644 index 94cbbd1fc88..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/instances.go b/staging/src/k8s.io/legacy-cloud-providers/aws/instances.go deleted file mode 100644 index c2970382759..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/instances.go +++ /dev/null @@ -1,276 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - "net/url" - "regexp" - "strings" - "sync" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" - "k8s.io/klog/v2" - - "k8s.io/api/core/v1" -) - -// awsInstanceRegMatch represents Regex Match for AWS instance. -var awsInstanceRegMatch = regexp.MustCompile("^i-[^/]*$") - -// InstanceID represents the ID of the instance in the AWS API, e.g. i-12345678 -// The "traditional" format is "i-12345678" -// A new longer format is also being introduced: "i-12345678abcdef01" -// We should not assume anything about the length or format, though it seems -// reasonable to assume that instances will continue to start with "i-". -type InstanceID string - -func (i InstanceID) awsString() *string { - return aws.String(string(i)) -} - -// KubernetesInstanceID represents the id for an instance in the kubernetes API; -// the following form -// - aws://// -// - aws://// -// - -type KubernetesInstanceID string - -// MapToAWSInstanceID extracts the InstanceID from the KubernetesInstanceID -func (name KubernetesInstanceID) MapToAWSInstanceID() (InstanceID, error) { - s := string(name) - - if !strings.HasPrefix(s, "aws://") { - // Assume a bare aws volume id (vol-1234...) - // Build a URL with an empty host (AZ) - s = "aws://" + "/" + "/" + s - } - url, err := url.Parse(s) - if err != nil { - return "", fmt.Errorf("Invalid instance name (%s): %v", name, err) - } - if url.Scheme != "aws" { - return "", fmt.Errorf("Invalid scheme for AWS instance (%s)", name) - } - - awsID := "" - tokens := strings.Split(strings.Trim(url.Path, "/"), "/") - if len(tokens) == 1 { - // instanceId - awsID = tokens[0] - } else if len(tokens) == 2 { - // az/instanceId - awsID = tokens[1] - } - - // We sanity check the resulting volume; the two known formats are - // i-12345678 and i-12345678abcdef01 - if awsID == "" || !awsInstanceRegMatch.MatchString(awsID) { - return "", fmt.Errorf("Invalid format for AWS instance (%s)", name) - } - - return InstanceID(awsID), nil -} - -// mapToAWSInstanceID extracts the InstanceIDs from the Nodes, returning an error if a Node cannot be mapped -func mapToAWSInstanceIDs(nodes []*v1.Node) ([]InstanceID, error) { - var instanceIDs []InstanceID - for _, node := range nodes { - if node.Spec.ProviderID == "" { - return nil, fmt.Errorf("node %q did not have ProviderID set", node.Name) - } - instanceID, err := KubernetesInstanceID(node.Spec.ProviderID).MapToAWSInstanceID() - if err != nil { - return nil, fmt.Errorf("unable to parse ProviderID %q for node %q", node.Spec.ProviderID, node.Name) - } - instanceIDs = append(instanceIDs, instanceID) - } - - return instanceIDs, nil -} - -// mapToAWSInstanceIDsTolerant extracts the InstanceIDs from the Nodes, skipping Nodes that cannot be mapped -func mapToAWSInstanceIDsTolerant(nodes []*v1.Node) []InstanceID { - var instanceIDs []InstanceID - for _, node := range nodes { - if node.Spec.ProviderID == "" { - klog.Warningf("node %q did not have ProviderID set", node.Name) - continue - } - instanceID, err := KubernetesInstanceID(node.Spec.ProviderID).MapToAWSInstanceID() - if err != nil { - klog.Warningf("unable to parse ProviderID %q for node %q", node.Spec.ProviderID, node.Name) - continue - } - instanceIDs = append(instanceIDs, instanceID) - } - - return instanceIDs -} - -// Gets the full information about this instance from the EC2 API -func describeInstance(ec2Client EC2, instanceID InstanceID) (*ec2.Instance, error) { - request := &ec2.DescribeInstancesInput{ - InstanceIds: []*string{instanceID.awsString()}, - } - - instances, err := ec2Client.DescribeInstances(request) - if err != nil { - return nil, err - } - if len(instances) == 0 { - return nil, fmt.Errorf("no instances found for instance: %s", instanceID) - } - if len(instances) > 1 { - return nil, fmt.Errorf("multiple instances found for instance: %s", instanceID) - } - return instances[0], nil -} - -// instanceCache manages the cache of DescribeInstances -type instanceCache struct { - // TODO: Get rid of this field, send all calls through the instanceCache - cloud *Cloud - - mutex sync.Mutex - snapshot *allInstancesSnapshot -} - -// Gets the full information about these instance from the EC2 API -func (c *instanceCache) describeAllInstancesUncached() (*allInstancesSnapshot, error) { - now := time.Now() - - klog.V(4).Infof("EC2 DescribeInstances - fetching all instances") - - var filters []*ec2.Filter - instances, err := c.cloud.describeInstances(filters) - if err != nil { - return nil, err - } - - m := make(map[InstanceID]*ec2.Instance) - for _, i := range instances { - id := InstanceID(aws.StringValue(i.InstanceId)) - m[id] = i - } - - snapshot := &allInstancesSnapshot{now, m} - - c.mutex.Lock() - defer c.mutex.Unlock() - - if c.snapshot != nil && snapshot.olderThan(c.snapshot) { - // If this happens a lot, we could run this function in a mutex and only return one result - klog.Infof("Not caching concurrent AWS DescribeInstances results") - } else { - c.snapshot = snapshot - } - - return snapshot, nil -} - -// cacheCriteria holds criteria that must hold to use a cached snapshot -type cacheCriteria struct { - // MaxAge indicates the maximum age of a cached snapshot we can accept. - // If set to 0 (i.e. unset), cached values will not time out because of age. - MaxAge time.Duration - - // HasInstances is a list of InstanceIDs that must be in a cached snapshot for it to be considered valid. - // If an instance is not found in the cached snapshot, the snapshot be ignored and we will re-fetch. - HasInstances []InstanceID -} - -// describeAllInstancesCached returns all instances, using cached results if applicable -func (c *instanceCache) describeAllInstancesCached(criteria cacheCriteria) (*allInstancesSnapshot, error) { - var err error - snapshot := c.getSnapshot() - if snapshot != nil && !snapshot.MeetsCriteria(criteria) { - snapshot = nil - } - - if snapshot == nil { - snapshot, err = c.describeAllInstancesUncached() - if err != nil { - return nil, err - } - } else { - klog.V(6).Infof("EC2 DescribeInstances - using cached results") - } - - return snapshot, nil -} - -// getSnapshot returns a snapshot if one exists -func (c *instanceCache) getSnapshot() *allInstancesSnapshot { - c.mutex.Lock() - defer c.mutex.Unlock() - - return c.snapshot -} - -// olderThan is a simple helper to encapsulate timestamp comparison -func (s *allInstancesSnapshot) olderThan(other *allInstancesSnapshot) bool { - // After() is technically broken by time changes until we have monotonic time - return other.timestamp.After(s.timestamp) -} - -// MeetsCriteria returns true if the snapshot meets the criteria in cacheCriteria -func (s *allInstancesSnapshot) MeetsCriteria(criteria cacheCriteria) bool { - if criteria.MaxAge > 0 { - // Sub() is technically broken by time changes until we have monotonic time - now := time.Now() - if now.Sub(s.timestamp) > criteria.MaxAge { - klog.V(6).Infof("instanceCache snapshot cannot be used as is older than MaxAge=%s", criteria.MaxAge) - return false - } - } - - if len(criteria.HasInstances) != 0 { - for _, id := range criteria.HasInstances { - if nil == s.instances[id] { - klog.V(6).Infof("instanceCache snapshot cannot be used as does not contain instance %s", id) - return false - } - } - } - - return true -} - -// allInstancesSnapshot holds the results from querying for all instances, -// along with the timestamp for cache-invalidation purposes -type allInstancesSnapshot struct { - timestamp time.Time - instances map[InstanceID]*ec2.Instance -} - -// FindInstances returns the instances corresponding to the specified ids. If an id is not found, it is ignored. -func (s *allInstancesSnapshot) FindInstances(ids []InstanceID) map[InstanceID]*ec2.Instance { - m := make(map[InstanceID]*ec2.Instance) - for _, id := range ids { - instance := s.instances[id] - if instance != nil { - m[id] = instance - } - } - return m -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/instances_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/instances_test.go deleted file mode 100644 index fddac2bbe5f..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/instances_test.go +++ /dev/null @@ -1,204 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/stretchr/testify/assert" - - "k8s.io/api/core/v1" -) - -func TestMapToAWSInstanceIDs(t *testing.T) { - tests := []struct { - Kubernetes KubernetesInstanceID - Aws InstanceID - ExpectError bool - }{ - { - Kubernetes: "aws:///us-east-1a/i-12345678", - Aws: "i-12345678", - }, - { - Kubernetes: "aws:////i-12345678", - Aws: "i-12345678", - }, - { - Kubernetes: "i-12345678", - Aws: "i-12345678", - }, - { - Kubernetes: "aws:///us-east-1a/i-12345678abcdef01", - Aws: "i-12345678abcdef01", - }, - { - Kubernetes: "aws:////i-12345678abcdef01", - Aws: "i-12345678abcdef01", - }, - { - Kubernetes: "i-12345678abcdef01", - Aws: "i-12345678abcdef01", - }, - { - Kubernetes: "vol-123456789", - ExpectError: true, - }, - { - Kubernetes: "aws:///us-east-1a/vol-12345678abcdef01", - ExpectError: true, - }, - { - Kubernetes: "aws://accountid/us-east-1a/vol-12345678abcdef01", - ExpectError: true, - }, - { - Kubernetes: "aws:///us-east-1a/vol-12345678abcdef01/suffix", - ExpectError: true, - }, - { - Kubernetes: "", - ExpectError: true, - }, - } - - for _, test := range tests { - awsID, err := test.Kubernetes.MapToAWSInstanceID() - if err != nil { - if !test.ExpectError { - t.Errorf("unexpected error parsing %s: %v", test.Kubernetes, err) - } - } else { - if test.ExpectError { - t.Errorf("expected error parsing %s", test.Kubernetes) - } else if test.Aws != awsID { - t.Errorf("unexpected value parsing %s, got %s", test.Kubernetes, awsID) - } - } - } - - for _, test := range tests { - node := &v1.Node{} - node.Spec.ProviderID = string(test.Kubernetes) - - awsInstanceIds, err := mapToAWSInstanceIDs([]*v1.Node{node}) - if err != nil { - if !test.ExpectError { - t.Errorf("unexpected error parsing %s: %v", test.Kubernetes, err) - } - } else { - if test.ExpectError { - t.Errorf("expected error parsing %s", test.Kubernetes) - } else if len(awsInstanceIds) != 1 { - t.Errorf("unexpected value parsing %s, got %s", test.Kubernetes, awsInstanceIds) - } else if awsInstanceIds[0] != test.Aws { - t.Errorf("unexpected value parsing %s, got %s", test.Kubernetes, awsInstanceIds) - } - } - - awsInstanceIds = mapToAWSInstanceIDsTolerant([]*v1.Node{node}) - if test.ExpectError { - if len(awsInstanceIds) != 0 { - t.Errorf("unexpected results parsing %s: %s", test.Kubernetes, awsInstanceIds) - } - } else { - if len(awsInstanceIds) != 1 { - t.Errorf("unexpected value parsing %s, got %s", test.Kubernetes, awsInstanceIds) - } else if awsInstanceIds[0] != test.Aws { - t.Errorf("unexpected value parsing %s, got %s", test.Kubernetes, awsInstanceIds) - } - } - } -} - -func TestSnapshotMeetsCriteria(t *testing.T) { - snapshot := &allInstancesSnapshot{timestamp: time.Now().Add(-3601 * time.Second)} - - if !snapshot.MeetsCriteria(cacheCriteria{}) { - t.Errorf("Snapshot should always meet empty criteria") - } - - if snapshot.MeetsCriteria(cacheCriteria{MaxAge: time.Hour}) { - t.Errorf("Snapshot did not honor MaxAge") - } - - if snapshot.MeetsCriteria(cacheCriteria{HasInstances: []InstanceID{InstanceID("i-12345678")}}) { - t.Errorf("Snapshot did not honor HasInstances with missing instances") - } - - snapshot.instances = make(map[InstanceID]*ec2.Instance) - snapshot.instances[InstanceID("i-12345678")] = &ec2.Instance{} - - if !snapshot.MeetsCriteria(cacheCriteria{HasInstances: []InstanceID{InstanceID("i-12345678")}}) { - t.Errorf("Snapshot did not honor HasInstances with matching instances") - } - - if snapshot.MeetsCriteria(cacheCriteria{HasInstances: []InstanceID{InstanceID("i-12345678"), InstanceID("i-00000000")}}) { - t.Errorf("Snapshot did not honor HasInstances with partially matching instances") - } -} - -func TestOlderThan(t *testing.T) { - t1 := time.Now() - t2 := t1.Add(time.Second) - - s1 := &allInstancesSnapshot{timestamp: t1} - s2 := &allInstancesSnapshot{timestamp: t2} - - assert.True(t, s1.olderThan(s2), "s1 should be olderThan s2") - assert.False(t, s2.olderThan(s1), "s2 not should be olderThan s1") - assert.False(t, s1.olderThan(s1), "s1 not should be olderThan itself") -} - -func TestSnapshotFindInstances(t *testing.T) { - snapshot := &allInstancesSnapshot{} - - snapshot.instances = make(map[InstanceID]*ec2.Instance) - { - id := InstanceID("i-12345678") - snapshot.instances[id] = &ec2.Instance{InstanceId: id.awsString()} - } - { - id := InstanceID("i-23456789") - snapshot.instances[id] = &ec2.Instance{InstanceId: id.awsString()} - } - - instances := snapshot.FindInstances([]InstanceID{InstanceID("i-12345678"), InstanceID("i-23456789"), InstanceID("i-00000000")}) - if len(instances) != 2 { - t.Errorf("findInstances returned %d results, expected 2", len(instances)) - } - - for _, id := range []InstanceID{InstanceID("i-12345678"), InstanceID("i-23456789")} { - i := instances[id] - if i == nil { - t.Errorf("findInstances did not return %s", id) - continue - } - if aws.StringValue(i.InstanceId) != string(id) { - t.Errorf("findInstances did not return expected instanceId for %s", id) - } - if i != snapshot.instances[id] { - t.Errorf("findInstances did not return expected instance (reference equality) for %s", id) - } - } -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/log_handler.go b/staging/src/k8s.io/legacy-cloud-providers/aws/log_handler.go deleted file mode 100644 index b758d11392b..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/log_handler.go +++ /dev/null @@ -1,51 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "github.com/aws/aws-sdk-go/aws/request" - "k8s.io/klog/v2" -) - -// Handler for aws-sdk-go that logs all requests -func awsHandlerLogger(req *request.Request) { - service, name := awsServiceAndName(req) - klog.V(4).Infof("AWS request: %s %s", service, name) -} - -func awsSendHandlerLogger(req *request.Request) { - service, name := awsServiceAndName(req) - klog.V(4).Infof("AWS API Send: %s %s %v %v", service, name, req.Operation, req.Params) -} - -func awsValidateResponseHandlerLogger(req *request.Request) { - service, name := awsServiceAndName(req) - klog.V(4).Infof("AWS API ValidateResponse: %s %s %v %v %s", service, name, req.Operation, req.Params, req.HTTPResponse.Status) -} - -func awsServiceAndName(req *request.Request) (string, string) { - service := req.ClientInfo.ServiceName - - name := "?" - if req.Operation != nil { - name = req.Operation.Name - } - return service, name -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler.go b/staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler.go deleted file mode 100644 index 91daa272773..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "math" - "sync" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "k8s.io/klog/v2" -) - -const ( - decayIntervalSeconds = 20 - decayFraction = 0.8 - maxDelay = 60 * time.Second -) - -// CrossRequestRetryDelay inserts delays before AWS calls, when we are observing RequestLimitExceeded errors -// Note that we share a CrossRequestRetryDelay across multiple AWS requests; this is a process-wide back-off, -// whereas the aws-sdk-go implements a per-request exponential backoff/retry -type CrossRequestRetryDelay struct { - backoff Backoff -} - -// NewCrossRequestRetryDelay creates a new CrossRequestRetryDelay -func NewCrossRequestRetryDelay() *CrossRequestRetryDelay { - c := &CrossRequestRetryDelay{} - c.backoff.init(decayIntervalSeconds, decayFraction, maxDelay) - return c -} - -// BeforeSign is added to the Sign chain; called before each request -func (c *CrossRequestRetryDelay) BeforeSign(r *request.Request) { - now := time.Now() - delay := c.backoff.ComputeDelayForRequest(now) - if delay > 0 { - klog.Warningf("Inserting delay before AWS request (%s) to avoid RequestLimitExceeded: %s", - describeRequest(r), delay.String()) - - if sleepFn := r.Config.SleepDelay; sleepFn != nil { - // Support SleepDelay for backwards compatibility - sleepFn(delay) - } else if err := aws.SleepWithContext(r.Context(), delay); err != nil { - r.Error = awserr.New(request.CanceledErrorCode, "request context canceled", err) - r.Retryable = aws.Bool(false) - return - } - - // Avoid clock skew problems - r.Time = now - } -} - -// Return the operation name, for use in log messages and metrics -func operationName(r *request.Request) string { - name := "?" - if r.Operation != nil { - name = r.Operation.Name - } - return name -} - -// Return a user-friendly string describing the request, for use in log messages -func describeRequest(r *request.Request) string { - service := r.ClientInfo.ServiceName - return service + "::" + operationName(r) -} - -// AfterRetry is added to the AfterRetry chain; called after any error -func (c *CrossRequestRetryDelay) AfterRetry(r *request.Request) { - if r.Error == nil { - return - } - awsError, ok := r.Error.(awserr.Error) - if !ok { - return - } - if awsError.Code() == "RequestLimitExceeded" { - c.backoff.ReportError() - recordAWSThrottlesMetric(operationName(r)) - klog.Warningf("Got RequestLimitExceeded error on AWS request (%s)", - describeRequest(r)) - } -} - -// Backoff manages a backoff that varies based on the recently observed failures -type Backoff struct { - decayIntervalSeconds int64 - decayFraction float64 - maxDelay time.Duration - - mutex sync.Mutex - - // We count all requests & the number of requests which hit a - // RequestLimit. We only really care about 'recent' requests, so we - // decay the counts exponentially to bias towards recent values. - countErrorsRequestLimit float32 - countRequests float32 - lastDecay int64 -} - -func (b *Backoff) init(decayIntervalSeconds int, decayFraction float64, maxDelay time.Duration) { - b.lastDecay = time.Now().Unix() - // Bias so that if the first request hits the limit we don't immediately apply the full delay - b.countRequests = 4 - b.decayIntervalSeconds = int64(decayIntervalSeconds) - b.decayFraction = decayFraction - b.maxDelay = maxDelay -} - -// ComputeDelayForRequest computes the delay required for a request, also -// updates internal state to count this request -func (b *Backoff) ComputeDelayForRequest(now time.Time) time.Duration { - b.mutex.Lock() - defer b.mutex.Unlock() - - // Apply exponential decay to the counters - timeDeltaSeconds := now.Unix() - b.lastDecay - if timeDeltaSeconds > b.decayIntervalSeconds { - intervals := float64(timeDeltaSeconds) / float64(b.decayIntervalSeconds) - decay := float32(math.Pow(b.decayFraction, intervals)) - b.countErrorsRequestLimit *= decay - b.countRequests *= decay - b.lastDecay = now.Unix() - } - - // Count this request - b.countRequests += 1.0 - - // Compute the failure rate - errorFraction := float32(0.0) - if b.countRequests > 0.5 { - // Avoid tiny residuals & rounding errors - errorFraction = b.countErrorsRequestLimit / b.countRequests - } - - // Ignore a low fraction of errors - // This also allows them to time-out - if errorFraction < 0.1 { - return time.Duration(0) - } - - // Delay by the max delay multiplied by the recent error rate - // (i.e. we apply a linear delay function) - // TODO: This is pretty arbitrary - delay := time.Nanosecond * time.Duration(float32(b.maxDelay.Nanoseconds())*errorFraction) - // Round down to the nearest second for sanity - return time.Second * time.Duration(int(delay.Seconds())) -} - -// ReportError is called when we observe a throttling error -func (b *Backoff) ReportError() { - b.mutex.Lock() - defer b.mutex.Unlock() - - b.countErrorsRequestLimit += 1.0 -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler_test.go deleted file mode 100644 index bd0b2330542..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/retry_handler_test.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "testing" - "time" -) - -// There follows a group of tests for the backoff logic. There's nothing -// particularly special about the values chosen: if we tweak the values in the -// backoff logic then we might well have to update the tests. However the key -// behavioural elements should remain (e.g. no errors => no backoff), and these -// are each tested by one of the tests below. - -// Test that we don't apply any delays when there are no errors -func TestBackoffNoErrors(t *testing.T) { - b := &Backoff{} - b.init(decayIntervalSeconds, decayFraction, maxDelay) - - now := time.Now() - for i := 0; i < 100; i++ { - d := b.ComputeDelayForRequest(now) - if d.Nanoseconds() != 0 { - t.Fatalf("unexpected delay during no-error case") - } - now = now.Add(time.Second) - } -} - -// Test that we always apply a delay when there are errors, and also that we -// don't "flap" - that our own delay doesn't cause us to oscillate between -// delay and no-delay. -func TestBackoffAllErrors(t *testing.T) { - b := &Backoff{} - b.init(decayIntervalSeconds, decayFraction, maxDelay) - - now := time.Now() - // Warm up - for i := 0; i < 10; i++ { - _ = b.ComputeDelayForRequest(now) - b.ReportError() - now = now.Add(time.Second) - } - - for i := 0; i < 100; i++ { - d := b.ComputeDelayForRequest(now) - b.ReportError() - if d.Seconds() < 5 { - t.Fatalf("unexpected short-delay during all-error case: %v", d) - } - t.Logf("delay @%d %v", i, d) - now = now.Add(d) - } -} - -// Test that we do come close to our max delay, when we see all errors at 1 -// second intervals (this simulates multiple concurrent requests, because we -// don't wait for delay in between requests) -func TestBackoffHitsMax(t *testing.T) { - b := &Backoff{} - b.init(decayIntervalSeconds, decayFraction, maxDelay) - - now := time.Now() - for i := 0; i < 100; i++ { - _ = b.ComputeDelayForRequest(now) - b.ReportError() - now = now.Add(time.Second) - } - - for i := 0; i < 10; i++ { - d := b.ComputeDelayForRequest(now) - b.ReportError() - if float32(d.Nanoseconds()) < (float32(maxDelay.Nanoseconds()) * 0.95) { - t.Fatalf("expected delay to be >= 95 percent of max delay, was %v", d) - } - t.Logf("delay @%d %v", i, d) - now = now.Add(time.Second) - } -} - -// Test that after a phase of errors, we eventually stop applying a delay once there are -// no more errors. -func TestBackoffRecovers(t *testing.T) { - b := &Backoff{} - b.init(decayIntervalSeconds, decayFraction, maxDelay) - - now := time.Now() - - // Phase of all-errors - for i := 0; i < 100; i++ { - _ = b.ComputeDelayForRequest(now) - b.ReportError() - now = now.Add(time.Second) - } - - for i := 0; i < 10; i++ { - d := b.ComputeDelayForRequest(now) - b.ReportError() - if d.Seconds() < 5 { - t.Fatalf("unexpected short-delay during all-error phase: %v", d) - } - t.Logf("error phase delay @%d %v", i, d) - now = now.Add(time.Second) - } - - // Phase of no errors - for i := 0; i < 100; i++ { - _ = b.ComputeDelayForRequest(now) - now = now.Add(3 * time.Second) - } - - for i := 0; i < 10; i++ { - d := b.ComputeDelayForRequest(now) - if d.Seconds() != 0 { - t.Fatalf("unexpected delay during error recovery phase: %v", d) - } - t.Logf("no-error phase delay @%d %v", i, d) - now = now.Add(time.Second) - } -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/sets_ippermissions.go b/staging/src/k8s.io/legacy-cloud-providers/aws/sets_ippermissions.go deleted file mode 100644 index d8ca2df0b22..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/sets_ippermissions.go +++ /dev/null @@ -1,219 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "encoding/json" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" -) - -// IPPermissionSet maps IP strings of strings to EC2 IpPermissions -type IPPermissionSet map[string]*ec2.IpPermission - -// IPPermissionPredicate is an predicate to test whether IPPermission matches some condition. -type IPPermissionPredicate interface { - // Test checks whether specified IPPermission matches condition. - Test(perm *ec2.IpPermission) bool -} - -// NewIPPermissionSet creates a new IPPermissionSet -func NewIPPermissionSet(items ...*ec2.IpPermission) IPPermissionSet { - s := make(IPPermissionSet) - s.Insert(items...) - return s -} - -// Ungroup splits permissions out into individual permissions -// EC2 will combine permissions with the same port but different SourceRanges together, for example -// We ungroup them so we can process them -func (s IPPermissionSet) Ungroup() IPPermissionSet { - l := []*ec2.IpPermission{} - for _, p := range s.List() { - if len(p.IpRanges) <= 1 { - l = append(l, p) - continue - } - for _, ipRange := range p.IpRanges { - c := &ec2.IpPermission{} - *c = *p - c.IpRanges = []*ec2.IpRange{ipRange} - l = append(l, c) - } - } - - l2 := []*ec2.IpPermission{} - for _, p := range l { - if len(p.UserIdGroupPairs) <= 1 { - l2 = append(l2, p) - continue - } - for _, u := range p.UserIdGroupPairs { - c := &ec2.IpPermission{} - *c = *p - c.UserIdGroupPairs = []*ec2.UserIdGroupPair{u} - l2 = append(l, c) - } - } - - l3 := []*ec2.IpPermission{} - for _, p := range l2 { - if len(p.PrefixListIds) <= 1 { - l3 = append(l3, p) - continue - } - for _, v := range p.PrefixListIds { - c := &ec2.IpPermission{} - *c = *p - c.PrefixListIds = []*ec2.PrefixListId{v} - l3 = append(l3, c) - } - } - - return NewIPPermissionSet(l3...) -} - -// Insert adds items to the set. -func (s IPPermissionSet) Insert(items ...*ec2.IpPermission) { - for _, p := range items { - k := keyForIPPermission(p) - s[k] = p - } -} - -// Delete delete permission from the set. -func (s IPPermissionSet) Delete(items ...*ec2.IpPermission) { - for _, p := range items { - k := keyForIPPermission(p) - delete(s, k) - } -} - -// DeleteIf delete permission from the set if permission matches predicate. -func (s IPPermissionSet) DeleteIf(predicate IPPermissionPredicate) { - for k, p := range s { - if predicate.Test(p) { - delete(s, k) - } - } -} - -// List returns the contents as a slice. Order is not defined. -func (s IPPermissionSet) List() []*ec2.IpPermission { - res := make([]*ec2.IpPermission, 0, len(s)) - for _, v := range s { - res = append(res, v) - } - return res -} - -// IsSuperset returns true if and only if s is a superset of s2. -func (s IPPermissionSet) IsSuperset(s2 IPPermissionSet) bool { - for k := range s2 { - _, found := s[k] - if !found { - return false - } - } - return true -} - -// Equal returns true if and only if s is equal (as a set) to s2. -// Two sets are equal if their membership is identical. -// (In practice, this means same elements, order doesn't matter) -func (s IPPermissionSet) Equal(s2 IPPermissionSet) bool { - return len(s) == len(s2) && s.IsSuperset(s2) -} - -// Difference returns a set of objects that are not in s2 -// For example: -// s1 = {a1, a2, a3} -// s2 = {a1, a2, a4, a5} -// s1.Difference(s2) = {a3} -// s2.Difference(s1) = {a4, a5} -func (s IPPermissionSet) Difference(s2 IPPermissionSet) IPPermissionSet { - result := NewIPPermissionSet() - for k, v := range s { - _, found := s2[k] - if !found { - result[k] = v - } - } - return result -} - -// Len returns the size of the set. -func (s IPPermissionSet) Len() int { - return len(s) -} - -func keyForIPPermission(p *ec2.IpPermission) string { - v, err := json.Marshal(p) - if err != nil { - panic(fmt.Sprintf("error building JSON representation of ec2.IpPermission: %v", err)) - } - return string(v) -} - -var _ IPPermissionPredicate = IPPermissionMatchDesc{} - -// IPPermissionMatchDesc checks whether specific IPPermission contains description. -type IPPermissionMatchDesc struct { - Description string -} - -// Test whether specific IPPermission contains description. -func (p IPPermissionMatchDesc) Test(perm *ec2.IpPermission) bool { - for _, v4Range := range perm.IpRanges { - if aws.StringValue(v4Range.Description) == p.Description { - return true - } - } - for _, v6Range := range perm.Ipv6Ranges { - if aws.StringValue(v6Range.Description) == p.Description { - return true - } - } - for _, prefixListID := range perm.PrefixListIds { - if aws.StringValue(prefixListID.Description) == p.Description { - return true - } - } - for _, group := range perm.UserIdGroupPairs { - if aws.StringValue(group.Description) == p.Description { - return true - } - } - return false -} - -var _ IPPermissionPredicate = IPPermissionNotMatch{} - -// IPPermissionNotMatch is the *not* operator for Predicate -type IPPermissionNotMatch struct { - Predicate IPPermissionPredicate -} - -// Test whether specific IPPermission not match the embed predicate. -func (p IPPermissionNotMatch) Test(perm *ec2.IpPermission) bool { - return !p.Predicate.Test(perm) -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/tags.go b/staging/src/k8s.io/legacy-cloud-providers/aws/tags.go deleted file mode 100644 index ee44cf20a56..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/tags.go +++ /dev/null @@ -1,315 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" - "k8s.io/klog/v2" - - "k8s.io/apimachinery/pkg/util/wait" -) - -// TagNameKubernetesClusterPrefix is the tag name we use to differentiate multiple -// logically independent clusters running in the same AZ. -// The tag key = TagNameKubernetesClusterPrefix + clusterID -// The tag value is an ownership value -const TagNameKubernetesClusterPrefix = "kubernetes.io/cluster/" - -// TagNameKubernetesClusterLegacy is the legacy tag name we use to differentiate multiple -// logically independent clusters running in the same AZ. The problem with it was that it -// did not allow shared resources. -const TagNameKubernetesClusterLegacy = "KubernetesCluster" - -// ResourceLifecycle is the cluster lifecycle state used in tagging -type ResourceLifecycle string - -const ( - // ResourceLifecycleOwned is the value we use when tagging resources to indicate - // that the resource is considered owned and managed by the cluster, - // and in particular that the lifecycle is tied to the lifecycle of the cluster. - ResourceLifecycleOwned = "owned" - // ResourceLifecycleShared is the value we use when tagging resources to indicate - // that the resource is shared between multiple clusters, and should not be destroyed - // if the cluster is destroyed. - ResourceLifecycleShared = "shared" -) - -type awsTagging struct { - // ClusterID is our cluster identifier: we tag AWS resources with this value, - // and thus we can run two independent clusters in the same VPC or subnets. - // This gives us similar functionality to GCE projects. - ClusterID string - - // usesLegacyTags is true if we are using the legacy TagNameKubernetesClusterLegacy tags - usesLegacyTags bool -} - -func (t *awsTagging) init(legacyClusterID string, clusterID string) error { - if legacyClusterID != "" { - if clusterID != "" && legacyClusterID != clusterID { - return fmt.Errorf("clusterID tags did not match: %q vs %q", clusterID, legacyClusterID) - } - t.usesLegacyTags = true - clusterID = legacyClusterID - } - - t.ClusterID = clusterID - - if clusterID != "" { - klog.Infof("AWS cloud filtering on ClusterID: %v", clusterID) - } else { - return fmt.Errorf("AWS cloud failed to find ClusterID") - } - - return nil -} - -// Extracts a clusterID from the given tags, if one is present -// If no clusterID is found, returns "", nil -// If multiple (different) clusterIDs are found, returns an error -func (t *awsTagging) initFromTags(tags []*ec2.Tag) error { - legacyClusterID, newClusterID, err := findClusterIDs(tags) - if err != nil { - return err - } - - if legacyClusterID == "" && newClusterID == "" { - klog.Errorf("Tag %q nor %q not found; Kubernetes may behave unexpectedly.", TagNameKubernetesClusterLegacy, TagNameKubernetesClusterPrefix+"...") - } - - return t.init(legacyClusterID, newClusterID) -} - -// Extracts the legacy & new cluster ids from the given tags, if they are present -// If duplicate tags are found, returns an error -func findClusterIDs(tags []*ec2.Tag) (string, string, error) { - legacyClusterID := "" - newClusterID := "" - - for _, tag := range tags { - tagKey := aws.StringValue(tag.Key) - if strings.HasPrefix(tagKey, TagNameKubernetesClusterPrefix) { - id := strings.TrimPrefix(tagKey, TagNameKubernetesClusterPrefix) - if newClusterID != "" { - return "", "", fmt.Errorf("Found multiple cluster tags with prefix %s (%q and %q)", TagNameKubernetesClusterPrefix, newClusterID, id) - } - newClusterID = id - } - - if tagKey == TagNameKubernetesClusterLegacy { - id := aws.StringValue(tag.Value) - if legacyClusterID != "" { - return "", "", fmt.Errorf("Found multiple %s tags (%q and %q)", TagNameKubernetesClusterLegacy, legacyClusterID, id) - } - legacyClusterID = id - } - } - - return legacyClusterID, newClusterID, nil -} - -func (t *awsTagging) clusterTagKey() string { - return TagNameKubernetesClusterPrefix + t.ClusterID -} - -func (t *awsTagging) hasClusterTag(tags []*ec2.Tag) bool { - // if the clusterID is not configured -- we consider all instances. - if len(t.ClusterID) == 0 { - return true - } - clusterTagKey := t.clusterTagKey() - for _, tag := range tags { - tagKey := aws.StringValue(tag.Key) - // For 1.6, we continue to recognize the legacy tags, for the 1.5 -> 1.6 upgrade - // Note that we want to continue traversing tag list if we see a legacy tag with value != ClusterID - if (tagKey == TagNameKubernetesClusterLegacy) && (aws.StringValue(tag.Value) == t.ClusterID) { - return true - } - if tagKey == clusterTagKey { - return true - } - } - return false -} - -func (t *awsTagging) hasNoClusterPrefixTag(tags []*ec2.Tag) bool { - for _, tag := range tags { - if strings.HasPrefix(aws.StringValue(tag.Key), TagNameKubernetesClusterPrefix) { - return false - } - } - return true -} - -// Ensure that a resource has the correct tags -// If it has no tags, we assume that this was a problem caused by an error in between creation and tagging, -// and we add the tags. If it has a different cluster's tags, that is an error. -func (t *awsTagging) readRepairClusterTags(client EC2, resourceID string, lifecycle ResourceLifecycle, additionalTags map[string]string, observedTags []*ec2.Tag) error { - actualTagMap := make(map[string]string) - for _, tag := range observedTags { - actualTagMap[aws.StringValue(tag.Key)] = aws.StringValue(tag.Value) - } - - expectedTags := t.buildTags(lifecycle, additionalTags) - - addTags := make(map[string]string) - for k, expected := range expectedTags { - actual := actualTagMap[k] - if actual == expected { - continue - } - if actual == "" { - klog.Warningf("Resource %q was missing expected cluster tag %q. Will add (with value %q)", resourceID, k, expected) - addTags[k] = expected - } else { - return fmt.Errorf("resource %q has tag belonging to another cluster: %q=%q (expected %q)", resourceID, k, actual, expected) - } - } - - if len(addTags) == 0 { - return nil - } - - if err := t.createTags(client, resourceID, lifecycle, addTags); err != nil { - return fmt.Errorf("error adding missing tags to resource %q: %q", resourceID, err) - } - - return nil -} - -// createTags calls EC2 CreateTags, but adds retry-on-failure logic -// We retry mainly because if we create an object, we cannot tag it until it is "fully created" (eventual consistency) -// The error code varies though (depending on what we are tagging), so we simply retry on all errors -func (t *awsTagging) createTags(client EC2, resourceID string, lifecycle ResourceLifecycle, additionalTags map[string]string) error { - tags := t.buildTags(lifecycle, additionalTags) - - if tags == nil || len(tags) == 0 { - return nil - } - - var awsTags []*ec2.Tag - for k, v := range tags { - tag := &ec2.Tag{ - Key: aws.String(k), - Value: aws.String(v), - } - awsTags = append(awsTags, tag) - } - - backoff := wait.Backoff{ - Duration: createTagInitialDelay, - Factor: createTagFactor, - Steps: createTagSteps, - } - request := &ec2.CreateTagsInput{} - request.Resources = []*string{&resourceID} - request.Tags = awsTags - - var lastErr error - err := wait.ExponentialBackoff(backoff, func() (bool, error) { - _, err := client.CreateTags(request) - if err == nil { - return true, nil - } - - // We could check that the error is retryable, but the error code changes based on what we are tagging - // SecurityGroup: InvalidGroup.NotFound - klog.V(2).Infof("Failed to create tags; will retry. Error was %q", err) - lastErr = err - return false, nil - }) - if err == wait.ErrWaitTimeout { - // return real CreateTags error instead of timeout - err = lastErr - } - return err -} - -// Add additional filters, to match on our tags -// This lets us run multiple k8s clusters in a single EC2 AZ -func (t *awsTagging) addFilters(filters []*ec2.Filter) []*ec2.Filter { - // if there are no clusterID configured - no filtering by special tag names - // should be applied to revert to legacy behaviour. - if len(t.ClusterID) == 0 { - if len(filters) == 0 { - // We can't pass a zero-length Filters to AWS (it's an error) - // So if we end up with no filters; just return nil - return nil - } - return filters - } - - f := newEc2Filter("tag-key", t.clusterTagKey()) - filters = append(filters, f) - return filters -} - -// Add additional filters, to match on our tags. This uses the tag for legacy -// 1.5 -> 1.6 clusters and exists for backwards compatibility -// -// This lets us run multiple k8s clusters in a single EC2 AZ -func (t *awsTagging) addLegacyFilters(filters []*ec2.Filter) []*ec2.Filter { - // if there are no clusterID configured - no filtering by special tag names - // should be applied to revert to legacy behaviour. - if len(t.ClusterID) == 0 { - if len(filters) == 0 { - // We can't pass a zero-length Filters to AWS (it's an error) - // So if we end up with no filters; just return nil - return nil - } - return filters - } - - f := newEc2Filter(fmt.Sprintf("tag:%s", TagNameKubernetesClusterLegacy), t.ClusterID) - - // We can't pass a zero-length Filters to AWS (it's an error) - // So if we end up with no filters; we need to return nil - filters = append(filters, f) - return filters -} - -func (t *awsTagging) buildTags(lifecycle ResourceLifecycle, additionalTags map[string]string) map[string]string { - tags := make(map[string]string) - for k, v := range additionalTags { - tags[k] = v - } - - // no clusterID is a sign of misconfigured cluster, but we can't be tagging the resources with empty - // strings - if len(t.ClusterID) == 0 { - return tags - } - - // We only create legacy tags if we are using legacy tags, i.e. if we have seen a legacy tag on our instance - if t.usesLegacyTags { - tags[TagNameKubernetesClusterLegacy] = t.ClusterID - } - tags[t.clusterTagKey()] = string(lifecycle) - - return tags -} - -func (t *awsTagging) clusterID() string { - return t.ClusterID -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/tags_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/tags_test.go deleted file mode 100644 index 8a6025c0b41..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/tags_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build !nolegacyroviders -// +build !nolegacyroviders - -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/stretchr/testify/assert" -) - -func TestFilterTags(t *testing.T) { - awsServices := NewFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - - if c.tagging.ClusterID != TestClusterID { - t.Errorf("unexpected ClusterID: %v", c.tagging.ClusterID) - } -} - -func TestFindClusterID(t *testing.T) { - grid := []struct { - Tags map[string]string - ExpectedNew string - ExpectedLegacy string - ExpectError bool - }{ - { - Tags: map[string]string{}, - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterLegacy: "a", - }, - ExpectedLegacy: "a", - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterPrefix + "a": "owned", - }, - ExpectedNew: "a", - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterPrefix + "a": "shared", - }, - ExpectedNew: "a", - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterPrefix + "a": "", - }, - ExpectedNew: "a", - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterLegacy: "a", - TagNameKubernetesClusterPrefix + "a": "", - }, - ExpectedLegacy: "a", - ExpectedNew: "a", - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterPrefix + "a": "", - TagNameKubernetesClusterPrefix + "b": "", - }, - ExpectError: true, - }, - } - for _, g := range grid { - var ec2Tags []*ec2.Tag - for k, v := range g.Tags { - ec2Tags = append(ec2Tags, &ec2.Tag{Key: aws.String(k), Value: aws.String(v)}) - } - actualLegacy, actualNew, err := findClusterIDs(ec2Tags) - if g.ExpectError { - if err == nil { - t.Errorf("expected error for tags %v", g.Tags) - continue - } - } else { - if err != nil { - t.Errorf("unexpected error for tags %v: %v", g.Tags, err) - continue - } - - if g.ExpectedNew != actualNew { - t.Errorf("unexpected new clusterid for tags %v: %s vs %s", g.Tags, g.ExpectedNew, actualNew) - continue - } - - if g.ExpectedLegacy != actualLegacy { - t.Errorf("unexpected new clusterid for tags %v: %s vs %s", g.Tags, g.ExpectedLegacy, actualLegacy) - continue - } - } - } -} - -func TestHasClusterTag(t *testing.T) { - awsServices := NewFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - grid := []struct { - Tags map[string]string - Expected bool - }{ - { - Tags: map[string]string{}, - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterLegacy: TestClusterID, - }, - Expected: true, - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterLegacy: "a", - }, - Expected: false, - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterPrefix + TestClusterID: "owned", - }, - Expected: true, - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterPrefix + TestClusterID: "", - }, - Expected: true, - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterLegacy: "a", - TagNameKubernetesClusterPrefix + TestClusterID: "shared", - }, - Expected: true, - }, - { - Tags: map[string]string{ - TagNameKubernetesClusterPrefix + TestClusterID: "shared", - TagNameKubernetesClusterPrefix + "b": "shared", - }, - Expected: true, - }, - } - for _, g := range grid { - var ec2Tags []*ec2.Tag - for k, v := range g.Tags { - ec2Tags = append(ec2Tags, &ec2.Tag{Key: aws.String(k), Value: aws.String(v)}) - } - result := c.tagging.hasClusterTag(ec2Tags) - if result != g.Expected { - t.Errorf("Unexpected result for tags %v: %t", g.Tags, result) - } - } -} - -func TestHasNoClusterPrefixTag(t *testing.T) { - awsServices := NewFakeAWSServices(TestClusterID) - c, err := newAWSCloud(CloudConfig{}, awsServices) - if err != nil { - t.Errorf("Error building aws cloud: %v", err) - return - } - tests := []struct { - name string - tags []*ec2.Tag - want bool - }{ - { - name: "no tags", - want: true, - }, - { - name: "no cluster tags", - tags: []*ec2.Tag{ - { - Key: aws.String("not a cluster tag"), - Value: aws.String("true"), - }, - }, - want: true, - }, - { - name: "contains cluster tags", - tags: []*ec2.Tag{ - { - Key: aws.String("tag1"), - Value: aws.String("value1"), - }, - { - Key: aws.String("kubernetes.io/cluster/test.cluster"), - Value: aws.String("owned"), - }, - }, - want: false, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, tt.want, c.tagging.hasNoClusterPrefixTag(tt.tags)) - }) - } -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/volumes.go b/staging/src/k8s.io/legacy-cloud-providers/aws/volumes.go deleted file mode 100644 index 48fde1187fa..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/volumes.go +++ /dev/null @@ -1,120 +0,0 @@ -//go:build !providerless -// +build !providerless - -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package aws - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/ec2" - csimigration "k8s.io/csi-translation-lib/plugins" - "k8s.io/klog/v2" - - "k8s.io/apimachinery/pkg/types" -) - -// EBSVolumeID represents the ID of the volume in the AWS API, e.g. -// vol-12345678 The "traditional" format is "vol-12345678" A new longer format -// is also being introduced: "vol-12345678abcdef01" We should not assume -// anything about the length or format, though it seems reasonable to assume -// that volumes will continue to start with "vol-". -type EBSVolumeID string - -func (i EBSVolumeID) awsString() *string { - return aws.String(string(i)) -} - -// KubernetesVolumeID represents the id for a volume in the kubernetes API; -// a few forms are recognized: -// - aws:/// -// - aws:/// -// - -type KubernetesVolumeID string - -// DiskInfo returns aws disk information in easy to use manner -type diskInfo struct { - ec2Instance *ec2.Instance - nodeName types.NodeName - volumeState string - attachmentState string - hasAttachment bool - disk *awsDisk -} - -// MapToAWSVolumeID extracts the EBSVolumeID from the KubernetesVolumeID -func (name KubernetesVolumeID) MapToAWSVolumeID() (EBSVolumeID, error) { - awsID, err := csimigration.KubernetesVolumeIDToEBSVolumeID(string(name)) - if err != nil { - return "", err - } - return EBSVolumeID(awsID), nil -} - -// GetAWSVolumeID converts a Kubernetes volume ID to an AWS volume ID -func GetAWSVolumeID(kubeVolumeID string) (string, error) { - kid := KubernetesVolumeID(kubeVolumeID) - awsID, err := kid.MapToAWSVolumeID() - return string(awsID), err -} - -func (c *Cloud) checkIfAttachedToNode(diskName KubernetesVolumeID, nodeName types.NodeName) (*diskInfo, bool, error) { - disk, err := newAWSDisk(c, diskName) - - if err != nil { - return nil, true, err - } - - awsDiskInfo := &diskInfo{ - disk: disk, - } - - info, err := disk.describeVolume() - - if err != nil { - klog.Warningf("Error describing volume %s with %v", diskName, err) - awsDiskInfo.volumeState = "unknown" - return awsDiskInfo, false, err - } - - awsDiskInfo.volumeState = aws.StringValue(info.State) - - if len(info.Attachments) > 0 { - attachment := info.Attachments[0] - awsDiskInfo.attachmentState = aws.StringValue(attachment.State) - instanceID := aws.StringValue(attachment.InstanceId) - instanceInfo, err := c.getInstanceByID(instanceID) - - // This should never happen but if it does it could mean there was a race and instance - // has been deleted - if err != nil { - fetchErr := fmt.Errorf("error fetching instance %s for volume %s", instanceID, diskName) - klog.Warning(fetchErr) - return awsDiskInfo, false, fetchErr - } - - awsDiskInfo.ec2Instance = instanceInfo - awsDiskInfo.nodeName = mapInstanceToNodeName(instanceInfo) - awsDiskInfo.hasAttachment = true - if awsDiskInfo.nodeName == nodeName { - return awsDiskInfo, true, nil - } - } - return awsDiskInfo, false, nil -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/go.mod b/staging/src/k8s.io/legacy-cloud-providers/go.mod index 2f238840de7..39a2c2c1ffc 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/go.mod +++ b/staging/src/k8s.io/legacy-cloud-providers/go.mod @@ -11,7 +11,6 @@ require ( github.com/Azure/go-autorest/autorest/adal v0.9.20 github.com/Azure/go-autorest/autorest/mocks v0.4.2 github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.1-0.20220218231025-f11817397a1b - github.com/aws/aws-sdk-go v1.44.147 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.5.9 github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021 @@ -26,7 +25,6 @@ require ( k8s.io/client-go v0.0.0 k8s.io/cloud-provider v0.0.0 k8s.io/component-base v0.0.0 - k8s.io/csi-translation-lib v0.0.0 k8s.io/klog/v2 v2.90.1 k8s.io/utils v0.0.0-20230209194617-a36077c30491 sigs.k8s.io/yaml v1.3.0 @@ -59,7 +57,6 @@ require ( github.com/google/gofuzz v1.1.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/gax-go/v2 v2.1.1 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -74,7 +71,6 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/objx v0.5.0 // indirect go.opencensus.io v0.23.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect @@ -103,7 +99,6 @@ replace ( k8s.io/component-base => ../component-base k8s.io/component-helpers => ../component-helpers k8s.io/controller-manager => ../controller-manager - k8s.io/csi-translation-lib => ../csi-translation-lib k8s.io/kms => ../kms k8s.io/legacy-cloud-providers => ../legacy-cloud-providers ) diff --git a/staging/src/k8s.io/legacy-cloud-providers/go.sum b/staging/src/k8s.io/legacy-cloud-providers/go.sum index 13191b3ab41..741b54f3c89 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/go.sum +++ b/staging/src/k8s.io/legacy-cloud-providers/go.sum @@ -77,8 +77,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aws/aws-sdk-go v1.44.147 h1:C/YQv0QAvRHio4cESBTFGh8aI/JM9VdRislDIOz/Dx4= -github.com/aws/aws-sdk-go v1.44.147/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -242,10 +240,6 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -337,7 +331,6 @@ github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -356,7 +349,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -411,7 +403,6 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -453,8 +444,6 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -486,7 +475,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -544,14 +532,10 @@ golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -563,7 +547,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -624,7 +607,6 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/test/e2e/framework/providers/aws/aws.go b/test/e2e/framework/providers/aws/aws.go index 6a4ef58eaa1..7f641133fa6 100644 --- a/test/e2e/framework/providers/aws/aws.go +++ b/test/e2e/framework/providers/aws/aws.go @@ -17,20 +17,7 @@ limitations under the License. package aws import ( - "context" - "fmt" - "strings" - - "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/autoscaling" - "github.com/aws/aws-sdk-go/service/ec2" - - v1 "k8s.io/api/core/v1" "k8s.io/kubernetes/test/e2e/framework" - e2epv "k8s.io/kubernetes/test/e2e/framework/pv" - awscloud "k8s.io/legacy-cloud-providers/aws" ) func init() { @@ -38,162 +25,13 @@ func init() { } func newProvider() (framework.ProviderInterface, error) { - if framework.TestContext.CloudConfig.Zone == "" { - framework.Logf("Warning: gce-zone not specified! Some tests that use the AWS SDK may select the wrong region and fail.") - } return &Provider{}, nil } // Provider is a structure to handle AWS clouds for e2e testing +// It does not do anything useful, it's there only to provide valid +// --provider=aws cmdline option to allow testing of CSI migration +// tests of kubernetes.io/aws-ebs volume plugin. type Provider struct { framework.NullProvider } - -// ResizeGroup resizes an instance group -func (p *Provider) ResizeGroup(group string, size int32) error { - awsSession, err := session.NewSession() - if err != nil { - return err - } - client := autoscaling.New(awsSession) - return awscloud.ResizeInstanceGroup(client, group, int(size)) -} - -// GroupSize returns the size of an instance group -func (p *Provider) GroupSize(group string) (int, error) { - awsSession, err := session.NewSession() - if err != nil { - return -1, err - } - client := autoscaling.New(awsSession) - instanceGroup, err := awscloud.DescribeInstanceGroup(client, group) - if err != nil { - return -1, fmt.Errorf("error describing instance group: %w", err) - } - if instanceGroup == nil { - return -1, fmt.Errorf("instance group not found: %s", group) - } - return instanceGroup.CurrentSize() -} - -// DeleteNode deletes a node which is specified as the argument -func (p *Provider) DeleteNode(node *v1.Node) error { - client := newAWSClient("") - - instanceID, err := awscloud.KubernetesInstanceID(node.Spec.ProviderID).MapToAWSInstanceID() - if err != nil { - return err - } - - req := &ec2.TerminateInstancesInput{ - InstanceIds: []*string{ - aws.String(string(instanceID)), - }, - } - _, err = client.TerminateInstances(req) - return err -} - -func (p *Provider) CreateShare() (string, string, string, error) { - return "", "", "", nil -} - -func (p *Provider) DeleteShare(accountName, shareName string) error { - return nil -} - -// CreatePD creates a persistent volume on the specified availability zone -func (p *Provider) CreatePD(zone string) (string, error) { - client := newAWSClient(zone) - request := &ec2.CreateVolumeInput{} - request.AvailabilityZone = aws.String(zone) - request.Size = aws.Int64(10) - request.VolumeType = aws.String(awscloud.DefaultVolumeType) - - // We need to tag the volume so that locked-down IAM configurations can still mount it - if framework.TestContext.CloudConfig.ClusterTag != "" { - clusterID := framework.TestContext.CloudConfig.ClusterTag - - legacyTag := &ec2.Tag{ - Key: aws.String(awscloud.TagNameKubernetesClusterLegacy), - Value: aws.String(clusterID), - } - - newTag := &ec2.Tag{ - Key: aws.String(awscloud.TagNameKubernetesClusterPrefix + clusterID), - Value: aws.String(awscloud.ResourceLifecycleOwned), - } - - tagSpecification := &ec2.TagSpecification{ - ResourceType: aws.String(ec2.ResourceTypeVolume), - Tags: []*ec2.Tag{legacyTag, newTag}, - } - - request.TagSpecifications = append(request.TagSpecifications, tagSpecification) - } - - response, err := client.CreateVolume(request) - if err != nil { - return "", err - } - - az := aws.StringValue(response.AvailabilityZone) - awsID := aws.StringValue(response.VolumeId) - - volumeName := "aws://" + az + "/" + awsID - return volumeName, nil -} - -// DeletePD deletes a persistent volume -func (p *Provider) DeletePD(pdName string) error { - client := newAWSClient("") - - tokens := strings.Split(pdName, "/") - awsVolumeID := tokens[len(tokens)-1] - - request := &ec2.DeleteVolumeInput{VolumeId: aws.String(awsVolumeID)} - _, err := client.DeleteVolume(request) - if err != nil { - if awsError, ok := err.(awserr.Error); ok && awsError.Code() == "InvalidVolume.NotFound" { - framework.Logf("volume deletion implicitly succeeded because volume %q does not exist.", pdName) - } else { - return fmt.Errorf("error deleting EBS volumes: %w", err) - } - } - return nil -} - -// CreatePVSource creates a persistent volume source -func (p *Provider) CreatePVSource(ctx context.Context, zone, diskName string) (*v1.PersistentVolumeSource, error) { - return &v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: diskName, - FSType: "ext3", - }, - }, nil -} - -// DeletePVSource deletes a persistent volume source -func (p *Provider) DeletePVSource(ctx context.Context, pvSource *v1.PersistentVolumeSource) error { - return e2epv.DeletePDWithRetry(ctx, pvSource.AWSElasticBlockStore.VolumeID) -} - -func newAWSClient(zone string) *ec2.EC2 { - var cfg *aws.Config - - if zone == "" { - zone = framework.TestContext.CloudConfig.Zone - } - if zone == "" { - framework.Logf("Warning: No AWS zone configured!") - cfg = nil - } else { - region := zone[:len(zone)-1] - cfg = &aws.Config{Region: aws.String(region)} - } - session, err := session.NewSession() - if err != nil { - framework.Logf("Warning: failed to create aws session") - } - return ec2.New(session, cfg) -} diff --git a/test/e2e/storage/drivers/in_tree.go b/test/e2e/storage/drivers/in_tree.go index 6056f43fcd6..573bd4b7a95 100644 --- a/test/e2e/storage/drivers/in_tree.go +++ b/test/e2e/storage/drivers/in_tree.go @@ -1463,15 +1463,7 @@ type awsDriver struct { driverInfo storageframework.DriverInfo } -type awsVolume struct { - volumeName string -} - var _ storageframework.TestDriver = &awsDriver{} - -var _ storageframework.PreprovisionedVolumeTestDriver = &awsDriver{} -var _ storageframework.InlineVolumeTestDriver = &awsDriver{} -var _ storageframework.PreprovisionedPVTestDriver = &awsDriver{} var _ storageframework.DynamicPVTestDriver = &awsDriver{} // InitAwsDriver returns awsDriver that implements TestDriver interface @@ -1520,40 +1512,6 @@ func (a *awsDriver) SkipUnsupportedTest(pattern storageframework.TestPattern) { e2eskipper.SkipUnlessProviderIs("aws") } -func (a *awsDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource { - av, ok := e2evolume.(*awsVolume) - if !ok { - framework.Failf("Failed to cast test volume of type %T to the AWS test volume", e2evolume) - } - volSource := v1.VolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: av.volumeName, - ReadOnly: readOnly, - }, - } - if fsType != "" { - volSource.AWSElasticBlockStore.FSType = fsType - } - return &volSource -} - -func (a *awsDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) { - av, ok := e2evolume.(*awsVolume) - if !ok { - framework.Failf("Failed to cast test volume of type %T to the AWS test volume", e2evolume) - } - pvSource := v1.PersistentVolumeSource{ - AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{ - VolumeID: av.volumeName, - ReadOnly: readOnly, - }, - } - if fsType != "" { - pvSource.AWSElasticBlockStore.FSType = fsType - } - return &pvSource, nil -} - func (a *awsDriver) GetDynamicProvisionStorageClass(ctx context.Context, config *storageframework.PerTestConfig, fsType string) *storagev1.StorageClass { provisioner := "kubernetes.io/aws-ebs" parameters := map[string]string{} @@ -1583,29 +1541,6 @@ func (a *awsDriver) PrepareTest(ctx context.Context, f *framework.Framework) *st return config } -func (a *awsDriver) CreateVolume(ctx context.Context, config *storageframework.PerTestConfig, volType storageframework.TestVolType) storageframework.TestVolume { - zone := getInlineVolumeZone(ctx, config.Framework) - if volType == storageframework.InlineVolume || volType == storageframework.PreprovisionedPV { - // PD will be created in framework.TestContext.CloudConfig.Zone zone, - // so pods should be also scheduled there. - config.ClientNodeSelection = e2epod.NodeSelection{ - Selector: map[string]string{ - v1.LabelTopologyZone: zone, - }, - } - } - ginkgo.By("creating a test aws volume") - vname, err := e2epv.CreatePDWithRetryAndZone(ctx, zone) - framework.ExpectNoError(err) - return &awsVolume{ - volumeName: vname, - } -} - -func (v *awsVolume) DeleteVolume(ctx context.Context) { - _ = e2epv.DeletePDWithRetry(ctx, v.volumeName) -} - // local type localDriver struct { driverInfo storageframework.DriverInfo diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go deleted file mode 100644 index 33c06a6589e..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go +++ /dev/null @@ -1,20556 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package autoscaling - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/query" -) - -const opAttachInstances = "AttachInstances" - -// AttachInstancesRequest generates a "aws/request.Request" representing the -// client's request for the AttachInstances operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AttachInstances for more information on using the AttachInstances -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the AttachInstancesRequest method. -// req, resp := client.AttachInstancesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachInstances -func (c *AutoScaling) AttachInstancesRequest(input *AttachInstancesInput) (req *request.Request, output *AttachInstancesOutput) { - op := &request.Operation{ - Name: opAttachInstances, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AttachInstancesInput{} - } - - output = &AttachInstancesOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// AttachInstances API operation for Auto Scaling. -// -// Attaches one or more EC2 instances to the specified Auto Scaling group. -// -// When you attach instances, Amazon EC2 Auto Scaling increases the desired -// capacity of the group by the number of instances being attached. If the number -// of instances being attached plus the desired capacity of the group exceeds -// the maximum size of the group, the operation fails. -// -// If there is a Classic Load Balancer attached to your Auto Scaling group, -// the instances are also registered with the load balancer. If there are target -// groups attached to your Auto Scaling group, the instances are also registered -// with the target groups. -// -// For more information, see Attach EC2 instances to your Auto Scaling group -// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/attach-instance-asg.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation AttachInstances for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachInstances -func (c *AutoScaling) AttachInstances(input *AttachInstancesInput) (*AttachInstancesOutput, error) { - req, out := c.AttachInstancesRequest(input) - return out, req.Send() -} - -// AttachInstancesWithContext is the same as AttachInstances with the addition of -// the ability to pass a context and additional request options. -// -// See AttachInstances for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) AttachInstancesWithContext(ctx aws.Context, input *AttachInstancesInput, opts ...request.Option) (*AttachInstancesOutput, error) { - req, out := c.AttachInstancesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAttachLoadBalancerTargetGroups = "AttachLoadBalancerTargetGroups" - -// AttachLoadBalancerTargetGroupsRequest generates a "aws/request.Request" representing the -// client's request for the AttachLoadBalancerTargetGroups operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AttachLoadBalancerTargetGroups for more information on using the AttachLoadBalancerTargetGroups -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the AttachLoadBalancerTargetGroupsRequest method. -// req, resp := client.AttachLoadBalancerTargetGroupsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancerTargetGroups -func (c *AutoScaling) AttachLoadBalancerTargetGroupsRequest(input *AttachLoadBalancerTargetGroupsInput) (req *request.Request, output *AttachLoadBalancerTargetGroupsOutput) { - op := &request.Operation{ - Name: opAttachLoadBalancerTargetGroups, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AttachLoadBalancerTargetGroupsInput{} - } - - output = &AttachLoadBalancerTargetGroupsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// AttachLoadBalancerTargetGroups API operation for Auto Scaling. -// -// Attaches one or more target groups to the specified Auto Scaling group. -// -// This operation is used with the following load balancer types: -// -// - Application Load Balancer - Operates at the application layer (layer -// 7) and supports HTTP and HTTPS. -// -// - Network Load Balancer - Operates at the transport layer (layer 4) and -// supports TCP, TLS, and UDP. -// -// - Gateway Load Balancer - Operates at the network layer (layer 3). -// -// To describe the target groups for an Auto Scaling group, call the DescribeLoadBalancerTargetGroups -// API. To detach the target group from the Auto Scaling group, call the DetachLoadBalancerTargetGroups -// API. -// -// This operation is additive and does not detach existing target groups or -// Classic Load Balancers from the Auto Scaling group. -// -// For more information, see Use Elastic Load Balancing to distribute traffic -// across the instances in your Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation AttachLoadBalancerTargetGroups for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancerTargetGroups -func (c *AutoScaling) AttachLoadBalancerTargetGroups(input *AttachLoadBalancerTargetGroupsInput) (*AttachLoadBalancerTargetGroupsOutput, error) { - req, out := c.AttachLoadBalancerTargetGroupsRequest(input) - return out, req.Send() -} - -// AttachLoadBalancerTargetGroupsWithContext is the same as AttachLoadBalancerTargetGroups with the addition of -// the ability to pass a context and additional request options. -// -// See AttachLoadBalancerTargetGroups for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) AttachLoadBalancerTargetGroupsWithContext(ctx aws.Context, input *AttachLoadBalancerTargetGroupsInput, opts ...request.Option) (*AttachLoadBalancerTargetGroupsOutput, error) { - req, out := c.AttachLoadBalancerTargetGroupsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAttachLoadBalancers = "AttachLoadBalancers" - -// AttachLoadBalancersRequest generates a "aws/request.Request" representing the -// client's request for the AttachLoadBalancers operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AttachLoadBalancers for more information on using the AttachLoadBalancers -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the AttachLoadBalancersRequest method. -// req, resp := client.AttachLoadBalancersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancers -func (c *AutoScaling) AttachLoadBalancersRequest(input *AttachLoadBalancersInput) (req *request.Request, output *AttachLoadBalancersOutput) { - op := &request.Operation{ - Name: opAttachLoadBalancers, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AttachLoadBalancersInput{} - } - - output = &AttachLoadBalancersOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// AttachLoadBalancers API operation for Auto Scaling. -// -// To attach an Application Load Balancer, Network Load Balancer, or Gateway -// Load Balancer, use the AttachLoadBalancerTargetGroups API operation instead. -// -// Attaches one or more Classic Load Balancers to the specified Auto Scaling -// group. Amazon EC2 Auto Scaling registers the running instances with these -// Classic Load Balancers. -// -// To describe the load balancers for an Auto Scaling group, call the DescribeLoadBalancers -// API. To detach a load balancer from the Auto Scaling group, call the DetachLoadBalancers -// API. -// -// This operation is additive and does not detach existing Classic Load Balancers -// or target groups from the Auto Scaling group. -// -// For more information, see Use Elastic Load Balancing to distribute traffic -// across the instances in your Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation AttachLoadBalancers for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancers -func (c *AutoScaling) AttachLoadBalancers(input *AttachLoadBalancersInput) (*AttachLoadBalancersOutput, error) { - req, out := c.AttachLoadBalancersRequest(input) - return out, req.Send() -} - -// AttachLoadBalancersWithContext is the same as AttachLoadBalancers with the addition of -// the ability to pass a context and additional request options. -// -// See AttachLoadBalancers for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) AttachLoadBalancersWithContext(ctx aws.Context, input *AttachLoadBalancersInput, opts ...request.Option) (*AttachLoadBalancersOutput, error) { - req, out := c.AttachLoadBalancersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opBatchDeleteScheduledAction = "BatchDeleteScheduledAction" - -// BatchDeleteScheduledActionRequest generates a "aws/request.Request" representing the -// client's request for the BatchDeleteScheduledAction operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See BatchDeleteScheduledAction for more information on using the BatchDeleteScheduledAction -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the BatchDeleteScheduledActionRequest method. -// req, resp := client.BatchDeleteScheduledActionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchDeleteScheduledAction -func (c *AutoScaling) BatchDeleteScheduledActionRequest(input *BatchDeleteScheduledActionInput) (req *request.Request, output *BatchDeleteScheduledActionOutput) { - op := &request.Operation{ - Name: opBatchDeleteScheduledAction, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &BatchDeleteScheduledActionInput{} - } - - output = &BatchDeleteScheduledActionOutput{} - req = c.newRequest(op, input, output) - return -} - -// BatchDeleteScheduledAction API operation for Auto Scaling. -// -// Deletes one or more scheduled actions for the specified Auto Scaling group. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation BatchDeleteScheduledAction for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchDeleteScheduledAction -func (c *AutoScaling) BatchDeleteScheduledAction(input *BatchDeleteScheduledActionInput) (*BatchDeleteScheduledActionOutput, error) { - req, out := c.BatchDeleteScheduledActionRequest(input) - return out, req.Send() -} - -// BatchDeleteScheduledActionWithContext is the same as BatchDeleteScheduledAction with the addition of -// the ability to pass a context and additional request options. -// -// See BatchDeleteScheduledAction for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) BatchDeleteScheduledActionWithContext(ctx aws.Context, input *BatchDeleteScheduledActionInput, opts ...request.Option) (*BatchDeleteScheduledActionOutput, error) { - req, out := c.BatchDeleteScheduledActionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opBatchPutScheduledUpdateGroupAction = "BatchPutScheduledUpdateGroupAction" - -// BatchPutScheduledUpdateGroupActionRequest generates a "aws/request.Request" representing the -// client's request for the BatchPutScheduledUpdateGroupAction operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See BatchPutScheduledUpdateGroupAction for more information on using the BatchPutScheduledUpdateGroupAction -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the BatchPutScheduledUpdateGroupActionRequest method. -// req, resp := client.BatchPutScheduledUpdateGroupActionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchPutScheduledUpdateGroupAction -func (c *AutoScaling) BatchPutScheduledUpdateGroupActionRequest(input *BatchPutScheduledUpdateGroupActionInput) (req *request.Request, output *BatchPutScheduledUpdateGroupActionOutput) { - op := &request.Operation{ - Name: opBatchPutScheduledUpdateGroupAction, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &BatchPutScheduledUpdateGroupActionInput{} - } - - output = &BatchPutScheduledUpdateGroupActionOutput{} - req = c.newRequest(op, input, output) - return -} - -// BatchPutScheduledUpdateGroupAction API operation for Auto Scaling. -// -// Creates or updates one or more scheduled scaling actions for an Auto Scaling -// group. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation BatchPutScheduledUpdateGroupAction for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAlreadyExistsFault "AlreadyExists" -// You already have an Auto Scaling group or launch configuration with this -// name. -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchPutScheduledUpdateGroupAction -func (c *AutoScaling) BatchPutScheduledUpdateGroupAction(input *BatchPutScheduledUpdateGroupActionInput) (*BatchPutScheduledUpdateGroupActionOutput, error) { - req, out := c.BatchPutScheduledUpdateGroupActionRequest(input) - return out, req.Send() -} - -// BatchPutScheduledUpdateGroupActionWithContext is the same as BatchPutScheduledUpdateGroupAction with the addition of -// the ability to pass a context and additional request options. -// -// See BatchPutScheduledUpdateGroupAction for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) BatchPutScheduledUpdateGroupActionWithContext(ctx aws.Context, input *BatchPutScheduledUpdateGroupActionInput, opts ...request.Option) (*BatchPutScheduledUpdateGroupActionOutput, error) { - req, out := c.BatchPutScheduledUpdateGroupActionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCancelInstanceRefresh = "CancelInstanceRefresh" - -// CancelInstanceRefreshRequest generates a "aws/request.Request" representing the -// client's request for the CancelInstanceRefresh operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CancelInstanceRefresh for more information on using the CancelInstanceRefresh -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CancelInstanceRefreshRequest method. -// req, resp := client.CancelInstanceRefreshRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CancelInstanceRefresh -func (c *AutoScaling) CancelInstanceRefreshRequest(input *CancelInstanceRefreshInput) (req *request.Request, output *CancelInstanceRefreshOutput) { - op := &request.Operation{ - Name: opCancelInstanceRefresh, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CancelInstanceRefreshInput{} - } - - output = &CancelInstanceRefreshOutput{} - req = c.newRequest(op, input, output) - return -} - -// CancelInstanceRefresh API operation for Auto Scaling. -// -// Cancels an instance refresh operation in progress. Cancellation does not -// roll back any replacements that have already been completed, but it prevents -// new replacements from being started. -// -// This operation is part of the instance refresh feature (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html) -// in Amazon EC2 Auto Scaling, which helps you update instances in your Auto -// Scaling group after you make configuration changes. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation CancelInstanceRefresh for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeActiveInstanceRefreshNotFoundFault "ActiveInstanceRefreshNotFound" -// The request failed because an active instance refresh for the specified Auto -// Scaling group was not found. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CancelInstanceRefresh -func (c *AutoScaling) CancelInstanceRefresh(input *CancelInstanceRefreshInput) (*CancelInstanceRefreshOutput, error) { - req, out := c.CancelInstanceRefreshRequest(input) - return out, req.Send() -} - -// CancelInstanceRefreshWithContext is the same as CancelInstanceRefresh with the addition of -// the ability to pass a context and additional request options. -// -// See CancelInstanceRefresh for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) CancelInstanceRefreshWithContext(ctx aws.Context, input *CancelInstanceRefreshInput, opts ...request.Option) (*CancelInstanceRefreshOutput, error) { - req, out := c.CancelInstanceRefreshRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCompleteLifecycleAction = "CompleteLifecycleAction" - -// CompleteLifecycleActionRequest generates a "aws/request.Request" representing the -// client's request for the CompleteLifecycleAction operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CompleteLifecycleAction for more information on using the CompleteLifecycleAction -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CompleteLifecycleActionRequest method. -// req, resp := client.CompleteLifecycleActionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleAction -func (c *AutoScaling) CompleteLifecycleActionRequest(input *CompleteLifecycleActionInput) (req *request.Request, output *CompleteLifecycleActionOutput) { - op := &request.Operation{ - Name: opCompleteLifecycleAction, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CompleteLifecycleActionInput{} - } - - output = &CompleteLifecycleActionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CompleteLifecycleAction API operation for Auto Scaling. -// -// Completes the lifecycle action for the specified token or instance with the -// specified result. -// -// This step is a part of the procedure for adding a lifecycle hook to an Auto -// Scaling group: -// -// (Optional) Create a launch template or launch configuration with a user data -// script that runs while an instance is in a wait state due to a lifecycle -// hook. -// -// (Optional) Create a Lambda function and a rule that allows Amazon EventBridge -// to invoke your Lambda function when an instance is put into a wait state -// due to a lifecycle hook. -// -// (Optional) Create a notification target and an IAM role. The target can be -// either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon -// EC2 Auto Scaling to publish lifecycle notifications to the target. -// -// Create the lifecycle hook. Specify whether the hook is used when the instances -// launch or terminate. -// -// If you need more time, record the lifecycle action heartbeat to keep the -// instance in a wait state. -// -// If you finish before the timeout period ends, send a callback by using the -// CompleteLifecycleAction API call. -// -// For more information, see Amazon EC2 Auto Scaling lifecycle hooks (https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation CompleteLifecycleAction for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleAction -func (c *AutoScaling) CompleteLifecycleAction(input *CompleteLifecycleActionInput) (*CompleteLifecycleActionOutput, error) { - req, out := c.CompleteLifecycleActionRequest(input) - return out, req.Send() -} - -// CompleteLifecycleActionWithContext is the same as CompleteLifecycleAction with the addition of -// the ability to pass a context and additional request options. -// -// See CompleteLifecycleAction for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) CompleteLifecycleActionWithContext(ctx aws.Context, input *CompleteLifecycleActionInput, opts ...request.Option) (*CompleteLifecycleActionOutput, error) { - req, out := c.CompleteLifecycleActionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateAutoScalingGroup = "CreateAutoScalingGroup" - -// CreateAutoScalingGroupRequest generates a "aws/request.Request" representing the -// client's request for the CreateAutoScalingGroup operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateAutoScalingGroup for more information on using the CreateAutoScalingGroup -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateAutoScalingGroupRequest method. -// req, resp := client.CreateAutoScalingGroupRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateAutoScalingGroup -func (c *AutoScaling) CreateAutoScalingGroupRequest(input *CreateAutoScalingGroupInput) (req *request.Request, output *CreateAutoScalingGroupOutput) { - op := &request.Operation{ - Name: opCreateAutoScalingGroup, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateAutoScalingGroupInput{} - } - - output = &CreateAutoScalingGroupOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateAutoScalingGroup API operation for Auto Scaling. -// -// We strongly recommend using a launch template when calling this operation -// to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2. -// -// Creates an Auto Scaling group with the specified name and attributes. -// -// If you exceed your maximum limit of Auto Scaling groups, the call fails. -// To query this limit, call the DescribeAccountLimits API. For information -// about updating this limit, see Quotas for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-quotas.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// For introductory exercises for creating an Auto Scaling group, see Getting -// started with Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/GettingStartedTutorial.html) -// and Tutorial: Set up a scaled and load-balanced application (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-register-lbs-with-asg.html) -// in the Amazon EC2 Auto Scaling User Guide. For more information, see Auto -// Scaling groups (https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Every Auto Scaling group has three size properties (DesiredCapacity, MaxSize, -// and MinSize). Usually, you set these sizes based on a specific number of -// instances. However, if you configure a mixed instances policy that defines -// weights for the instance types, you must specify these sizes with the same -// units that you use for weighting instances. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation CreateAutoScalingGroup for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAlreadyExistsFault "AlreadyExists" -// You already have an Auto Scaling group or launch configuration with this -// name. -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateAutoScalingGroup -func (c *AutoScaling) CreateAutoScalingGroup(input *CreateAutoScalingGroupInput) (*CreateAutoScalingGroupOutput, error) { - req, out := c.CreateAutoScalingGroupRequest(input) - return out, req.Send() -} - -// CreateAutoScalingGroupWithContext is the same as CreateAutoScalingGroup with the addition of -// the ability to pass a context and additional request options. -// -// See CreateAutoScalingGroup for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) CreateAutoScalingGroupWithContext(ctx aws.Context, input *CreateAutoScalingGroupInput, opts ...request.Option) (*CreateAutoScalingGroupOutput, error) { - req, out := c.CreateAutoScalingGroupRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateLaunchConfiguration = "CreateLaunchConfiguration" - -// CreateLaunchConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the CreateLaunchConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateLaunchConfiguration for more information on using the CreateLaunchConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateLaunchConfigurationRequest method. -// req, resp := client.CreateLaunchConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateLaunchConfiguration -func (c *AutoScaling) CreateLaunchConfigurationRequest(input *CreateLaunchConfigurationInput) (req *request.Request, output *CreateLaunchConfigurationOutput) { - op := &request.Operation{ - Name: opCreateLaunchConfiguration, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateLaunchConfigurationInput{} - } - - output = &CreateLaunchConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateLaunchConfiguration API operation for Auto Scaling. -// -// Creates a launch configuration. -// -// If you exceed your maximum limit of launch configurations, the call fails. -// To query this limit, call the DescribeAccountLimits API. For information -// about updating this limit, see Quotas for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-quotas.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// For more information, see Launch configurations (https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchConfiguration.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Amazon EC2 Auto Scaling configures instances launched as part of an Auto -// Scaling group using either a launch template or a launch configuration. We -// strongly recommend that you do not use launch configurations. They do not -// provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For -// information about using launch templates, see Launch templates (https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-templates.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation CreateLaunchConfiguration for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAlreadyExistsFault "AlreadyExists" -// You already have an Auto Scaling group or launch configuration with this -// name. -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateLaunchConfiguration -func (c *AutoScaling) CreateLaunchConfiguration(input *CreateLaunchConfigurationInput) (*CreateLaunchConfigurationOutput, error) { - req, out := c.CreateLaunchConfigurationRequest(input) - return out, req.Send() -} - -// CreateLaunchConfigurationWithContext is the same as CreateLaunchConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See CreateLaunchConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) CreateLaunchConfigurationWithContext(ctx aws.Context, input *CreateLaunchConfigurationInput, opts ...request.Option) (*CreateLaunchConfigurationOutput, error) { - req, out := c.CreateLaunchConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateOrUpdateTags = "CreateOrUpdateTags" - -// CreateOrUpdateTagsRequest generates a "aws/request.Request" representing the -// client's request for the CreateOrUpdateTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateOrUpdateTags for more information on using the CreateOrUpdateTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateOrUpdateTagsRequest method. -// req, resp := client.CreateOrUpdateTagsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateOrUpdateTags -func (c *AutoScaling) CreateOrUpdateTagsRequest(input *CreateOrUpdateTagsInput) (req *request.Request, output *CreateOrUpdateTagsOutput) { - op := &request.Operation{ - Name: opCreateOrUpdateTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateOrUpdateTagsInput{} - } - - output = &CreateOrUpdateTagsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateOrUpdateTags API operation for Auto Scaling. -// -// Creates or updates tags for the specified Auto Scaling group. -// -// When you specify a tag with a key that already exists, the operation overwrites -// the previous tag definition, and you do not get an error message. -// -// For more information, see Tag Auto Scaling groups and instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation CreateOrUpdateTags for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeAlreadyExistsFault "AlreadyExists" -// You already have an Auto Scaling group or launch configuration with this -// name. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeResourceInUseFault "ResourceInUse" -// The operation can't be performed because the resource is in use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateOrUpdateTags -func (c *AutoScaling) CreateOrUpdateTags(input *CreateOrUpdateTagsInput) (*CreateOrUpdateTagsOutput, error) { - req, out := c.CreateOrUpdateTagsRequest(input) - return out, req.Send() -} - -// CreateOrUpdateTagsWithContext is the same as CreateOrUpdateTags with the addition of -// the ability to pass a context and additional request options. -// -// See CreateOrUpdateTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) CreateOrUpdateTagsWithContext(ctx aws.Context, input *CreateOrUpdateTagsInput, opts ...request.Option) (*CreateOrUpdateTagsOutput, error) { - req, out := c.CreateOrUpdateTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteAutoScalingGroup = "DeleteAutoScalingGroup" - -// DeleteAutoScalingGroupRequest generates a "aws/request.Request" representing the -// client's request for the DeleteAutoScalingGroup operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteAutoScalingGroup for more information on using the DeleteAutoScalingGroup -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteAutoScalingGroupRequest method. -// req, resp := client.DeleteAutoScalingGroupRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteAutoScalingGroup -func (c *AutoScaling) DeleteAutoScalingGroupRequest(input *DeleteAutoScalingGroupInput) (req *request.Request, output *DeleteAutoScalingGroupOutput) { - op := &request.Operation{ - Name: opDeleteAutoScalingGroup, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteAutoScalingGroupInput{} - } - - output = &DeleteAutoScalingGroupOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteAutoScalingGroup API operation for Auto Scaling. -// -// Deletes the specified Auto Scaling group. -// -// If the group has instances or scaling activities in progress, you must specify -// the option to force the deletion in order for it to succeed. The force delete -// operation will also terminate the EC2 instances. If the group has a warm -// pool, the force delete option also deletes the warm pool. -// -// To remove instances from the Auto Scaling group before deleting it, call -// the DetachInstances API with the list of instances and the option to decrement -// the desired capacity. This ensures that Amazon EC2 Auto Scaling does not -// launch replacement instances. -// -// To terminate all instances before deleting the Auto Scaling group, call the -// UpdateAutoScalingGroup API and set the minimum size and desired capacity -// of the Auto Scaling group to zero. -// -// If the group has scaling policies, deleting the group deletes the policies, -// the underlying alarm actions, and any alarm that no longer has an associated -// action. -// -// For more information, see Delete your Auto Scaling infrastructure (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-process-shutdown.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeleteAutoScalingGroup for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeScalingActivityInProgressFault "ScalingActivityInProgress" -// The operation can't be performed because there are scaling activities in -// progress. -// -// - ErrCodeResourceInUseFault "ResourceInUse" -// The operation can't be performed because the resource is in use. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteAutoScalingGroup -func (c *AutoScaling) DeleteAutoScalingGroup(input *DeleteAutoScalingGroupInput) (*DeleteAutoScalingGroupOutput, error) { - req, out := c.DeleteAutoScalingGroupRequest(input) - return out, req.Send() -} - -// DeleteAutoScalingGroupWithContext is the same as DeleteAutoScalingGroup with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteAutoScalingGroup for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeleteAutoScalingGroupWithContext(ctx aws.Context, input *DeleteAutoScalingGroupInput, opts ...request.Option) (*DeleteAutoScalingGroupOutput, error) { - req, out := c.DeleteAutoScalingGroupRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteLaunchConfiguration = "DeleteLaunchConfiguration" - -// DeleteLaunchConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteLaunchConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteLaunchConfiguration for more information on using the DeleteLaunchConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteLaunchConfigurationRequest method. -// req, resp := client.DeleteLaunchConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLaunchConfiguration -func (c *AutoScaling) DeleteLaunchConfigurationRequest(input *DeleteLaunchConfigurationInput) (req *request.Request, output *DeleteLaunchConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteLaunchConfiguration, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteLaunchConfigurationInput{} - } - - output = &DeleteLaunchConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteLaunchConfiguration API operation for Auto Scaling. -// -// Deletes the specified launch configuration. -// -// The launch configuration must not be attached to an Auto Scaling group. When -// this call completes, the launch configuration is no longer available for -// use. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeleteLaunchConfiguration for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceInUseFault "ResourceInUse" -// The operation can't be performed because the resource is in use. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLaunchConfiguration -func (c *AutoScaling) DeleteLaunchConfiguration(input *DeleteLaunchConfigurationInput) (*DeleteLaunchConfigurationOutput, error) { - req, out := c.DeleteLaunchConfigurationRequest(input) - return out, req.Send() -} - -// DeleteLaunchConfigurationWithContext is the same as DeleteLaunchConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteLaunchConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeleteLaunchConfigurationWithContext(ctx aws.Context, input *DeleteLaunchConfigurationInput, opts ...request.Option) (*DeleteLaunchConfigurationOutput, error) { - req, out := c.DeleteLaunchConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteLifecycleHook = "DeleteLifecycleHook" - -// DeleteLifecycleHookRequest generates a "aws/request.Request" representing the -// client's request for the DeleteLifecycleHook operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteLifecycleHook for more information on using the DeleteLifecycleHook -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteLifecycleHookRequest method. -// req, resp := client.DeleteLifecycleHookRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLifecycleHook -func (c *AutoScaling) DeleteLifecycleHookRequest(input *DeleteLifecycleHookInput) (req *request.Request, output *DeleteLifecycleHookOutput) { - op := &request.Operation{ - Name: opDeleteLifecycleHook, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteLifecycleHookInput{} - } - - output = &DeleteLifecycleHookOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteLifecycleHook API operation for Auto Scaling. -// -// Deletes the specified lifecycle hook. -// -// If there are any outstanding lifecycle actions, they are completed first -// (ABANDON for launching instances, CONTINUE for terminating instances). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeleteLifecycleHook for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLifecycleHook -func (c *AutoScaling) DeleteLifecycleHook(input *DeleteLifecycleHookInput) (*DeleteLifecycleHookOutput, error) { - req, out := c.DeleteLifecycleHookRequest(input) - return out, req.Send() -} - -// DeleteLifecycleHookWithContext is the same as DeleteLifecycleHook with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteLifecycleHook for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeleteLifecycleHookWithContext(ctx aws.Context, input *DeleteLifecycleHookInput, opts ...request.Option) (*DeleteLifecycleHookOutput, error) { - req, out := c.DeleteLifecycleHookRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteNotificationConfiguration = "DeleteNotificationConfiguration" - -// DeleteNotificationConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteNotificationConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteNotificationConfiguration for more information on using the DeleteNotificationConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteNotificationConfigurationRequest method. -// req, resp := client.DeleteNotificationConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteNotificationConfiguration -func (c *AutoScaling) DeleteNotificationConfigurationRequest(input *DeleteNotificationConfigurationInput) (req *request.Request, output *DeleteNotificationConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteNotificationConfiguration, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteNotificationConfigurationInput{} - } - - output = &DeleteNotificationConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteNotificationConfiguration API operation for Auto Scaling. -// -// Deletes the specified notification. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeleteNotificationConfiguration for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteNotificationConfiguration -func (c *AutoScaling) DeleteNotificationConfiguration(input *DeleteNotificationConfigurationInput) (*DeleteNotificationConfigurationOutput, error) { - req, out := c.DeleteNotificationConfigurationRequest(input) - return out, req.Send() -} - -// DeleteNotificationConfigurationWithContext is the same as DeleteNotificationConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteNotificationConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeleteNotificationConfigurationWithContext(ctx aws.Context, input *DeleteNotificationConfigurationInput, opts ...request.Option) (*DeleteNotificationConfigurationOutput, error) { - req, out := c.DeleteNotificationConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeletePolicy = "DeletePolicy" - -// DeletePolicyRequest generates a "aws/request.Request" representing the -// client's request for the DeletePolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeletePolicy for more information on using the DeletePolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeletePolicyRequest method. -// req, resp := client.DeletePolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeletePolicy -func (c *AutoScaling) DeletePolicyRequest(input *DeletePolicyInput) (req *request.Request, output *DeletePolicyOutput) { - op := &request.Operation{ - Name: opDeletePolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeletePolicyInput{} - } - - output = &DeletePolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeletePolicy API operation for Auto Scaling. -// -// Deletes the specified scaling policy. -// -// Deleting either a step scaling policy or a simple scaling policy deletes -// the underlying alarm action, but does not delete the alarm, even if it no -// longer has an associated action. -// -// For more information, see Deleting a scaling policy (https://docs.aws.amazon.com/autoscaling/ec2/userguide/deleting-scaling-policy.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeletePolicy for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeletePolicy -func (c *AutoScaling) DeletePolicy(input *DeletePolicyInput) (*DeletePolicyOutput, error) { - req, out := c.DeletePolicyRequest(input) - return out, req.Send() -} - -// DeletePolicyWithContext is the same as DeletePolicy with the addition of -// the ability to pass a context and additional request options. -// -// See DeletePolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeletePolicyWithContext(ctx aws.Context, input *DeletePolicyInput, opts ...request.Option) (*DeletePolicyOutput, error) { - req, out := c.DeletePolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteScheduledAction = "DeleteScheduledAction" - -// DeleteScheduledActionRequest generates a "aws/request.Request" representing the -// client's request for the DeleteScheduledAction operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteScheduledAction for more information on using the DeleteScheduledAction -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteScheduledActionRequest method. -// req, resp := client.DeleteScheduledActionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteScheduledAction -func (c *AutoScaling) DeleteScheduledActionRequest(input *DeleteScheduledActionInput) (req *request.Request, output *DeleteScheduledActionOutput) { - op := &request.Operation{ - Name: opDeleteScheduledAction, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteScheduledActionInput{} - } - - output = &DeleteScheduledActionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteScheduledAction API operation for Auto Scaling. -// -// Deletes the specified scheduled action. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeleteScheduledAction for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteScheduledAction -func (c *AutoScaling) DeleteScheduledAction(input *DeleteScheduledActionInput) (*DeleteScheduledActionOutput, error) { - req, out := c.DeleteScheduledActionRequest(input) - return out, req.Send() -} - -// DeleteScheduledActionWithContext is the same as DeleteScheduledAction with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteScheduledAction for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeleteScheduledActionWithContext(ctx aws.Context, input *DeleteScheduledActionInput, opts ...request.Option) (*DeleteScheduledActionOutput, error) { - req, out := c.DeleteScheduledActionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteTags = "DeleteTags" - -// DeleteTagsRequest generates a "aws/request.Request" representing the -// client's request for the DeleteTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteTags for more information on using the DeleteTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // 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) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteTags -func (c *AutoScaling) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Request, output *DeleteTagsOutput) { - op := &request.Operation{ - Name: opDeleteTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteTagsInput{} - } - - output = &DeleteTagsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteTags API operation for Auto Scaling. -// -// Deletes the specified tags. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeleteTags for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeResourceInUseFault "ResourceInUse" -// The operation can't be performed because the resource is in use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteTags -func (c *AutoScaling) DeleteTags(input *DeleteTagsInput) (*DeleteTagsOutput, error) { - req, out := c.DeleteTagsRequest(input) - return out, req.Send() -} - -// DeleteTagsWithContext is the same as DeleteTags with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeleteTagsWithContext(ctx aws.Context, input *DeleteTagsInput, opts ...request.Option) (*DeleteTagsOutput, error) { - req, out := c.DeleteTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteWarmPool = "DeleteWarmPool" - -// DeleteWarmPoolRequest generates a "aws/request.Request" representing the -// client's request for the DeleteWarmPool operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteWarmPool for more information on using the DeleteWarmPool -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteWarmPoolRequest method. -// req, resp := client.DeleteWarmPoolRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteWarmPool -func (c *AutoScaling) DeleteWarmPoolRequest(input *DeleteWarmPoolInput) (req *request.Request, output *DeleteWarmPoolOutput) { - op := &request.Operation{ - Name: opDeleteWarmPool, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteWarmPoolInput{} - } - - output = &DeleteWarmPoolOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteWarmPool API operation for Auto Scaling. -// -// Deletes the warm pool for the specified Auto Scaling group. -// -// For more information, see Warm pools for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DeleteWarmPool for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeScalingActivityInProgressFault "ScalingActivityInProgress" -// The operation can't be performed because there are scaling activities in -// progress. -// -// - ErrCodeResourceInUseFault "ResourceInUse" -// The operation can't be performed because the resource is in use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteWarmPool -func (c *AutoScaling) DeleteWarmPool(input *DeleteWarmPoolInput) (*DeleteWarmPoolOutput, error) { - req, out := c.DeleteWarmPoolRequest(input) - return out, req.Send() -} - -// DeleteWarmPoolWithContext is the same as DeleteWarmPool with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteWarmPool for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DeleteWarmPoolWithContext(ctx aws.Context, input *DeleteWarmPoolInput, opts ...request.Option) (*DeleteWarmPoolOutput, error) { - req, out := c.DeleteWarmPoolRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeAccountLimits = "DescribeAccountLimits" - -// DescribeAccountLimitsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeAccountLimits operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeAccountLimits for more information on using the DescribeAccountLimits -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeAccountLimitsRequest method. -// req, resp := client.DescribeAccountLimitsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAccountLimits -func (c *AutoScaling) DescribeAccountLimitsRequest(input *DescribeAccountLimitsInput) (req *request.Request, output *DescribeAccountLimitsOutput) { - op := &request.Operation{ - Name: opDescribeAccountLimits, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeAccountLimitsInput{} - } - - output = &DescribeAccountLimitsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeAccountLimits API operation for Auto Scaling. -// -// Describes the current Amazon EC2 Auto Scaling resource quotas for your account. -// -// When you establish an Amazon Web Services account, the account has initial -// quotas on the maximum number of Auto Scaling groups and launch configurations -// that you can create in a given Region. For more information, see Quotas for -// Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-quotas.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeAccountLimits for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAccountLimits -func (c *AutoScaling) DescribeAccountLimits(input *DescribeAccountLimitsInput) (*DescribeAccountLimitsOutput, error) { - req, out := c.DescribeAccountLimitsRequest(input) - return out, req.Send() -} - -// DescribeAccountLimitsWithContext is the same as DescribeAccountLimits with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeAccountLimits for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeAccountLimitsWithContext(ctx aws.Context, input *DescribeAccountLimitsInput, opts ...request.Option) (*DescribeAccountLimitsOutput, error) { - req, out := c.DescribeAccountLimitsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeAdjustmentTypes = "DescribeAdjustmentTypes" - -// DescribeAdjustmentTypesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeAdjustmentTypes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeAdjustmentTypes for more information on using the DescribeAdjustmentTypes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeAdjustmentTypesRequest method. -// req, resp := client.DescribeAdjustmentTypesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAdjustmentTypes -func (c *AutoScaling) DescribeAdjustmentTypesRequest(input *DescribeAdjustmentTypesInput) (req *request.Request, output *DescribeAdjustmentTypesOutput) { - op := &request.Operation{ - Name: opDescribeAdjustmentTypes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeAdjustmentTypesInput{} - } - - output = &DescribeAdjustmentTypesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeAdjustmentTypes API operation for Auto Scaling. -// -// Describes the available adjustment types for step scaling and simple scaling -// policies. -// -// The following adjustment types are supported: -// -// - ChangeInCapacity -// -// - ExactCapacity -// -// - PercentChangeInCapacity -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeAdjustmentTypes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAdjustmentTypes -func (c *AutoScaling) DescribeAdjustmentTypes(input *DescribeAdjustmentTypesInput) (*DescribeAdjustmentTypesOutput, error) { - req, out := c.DescribeAdjustmentTypesRequest(input) - return out, req.Send() -} - -// DescribeAdjustmentTypesWithContext is the same as DescribeAdjustmentTypes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeAdjustmentTypes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeAdjustmentTypesWithContext(ctx aws.Context, input *DescribeAdjustmentTypesInput, opts ...request.Option) (*DescribeAdjustmentTypesOutput, error) { - req, out := c.DescribeAdjustmentTypesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeAutoScalingGroups = "DescribeAutoScalingGroups" - -// DescribeAutoScalingGroupsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeAutoScalingGroups operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeAutoScalingGroups for more information on using the DescribeAutoScalingGroups -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeAutoScalingGroupsRequest method. -// req, resp := client.DescribeAutoScalingGroupsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingGroups -func (c *AutoScaling) DescribeAutoScalingGroupsRequest(input *DescribeAutoScalingGroupsInput) (req *request.Request, output *DescribeAutoScalingGroupsOutput) { - op := &request.Operation{ - Name: opDescribeAutoScalingGroups, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeAutoScalingGroupsInput{} - } - - output = &DescribeAutoScalingGroupsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeAutoScalingGroups API operation for Auto Scaling. -// -// Gets information about the Auto Scaling groups in the account and Region. -// -// If you specify Auto Scaling group names, the output includes information -// for only the specified Auto Scaling groups. If you specify filters, the output -// includes information for only those Auto Scaling groups that meet the filter -// criteria. If you do not specify group names or filters, the output includes -// information for all Auto Scaling groups. -// -// This operation also returns information about instances in Auto Scaling groups. -// To retrieve information about the instances in a warm pool, you must call -// the DescribeWarmPool API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeAutoScalingGroups for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingGroups -func (c *AutoScaling) DescribeAutoScalingGroups(input *DescribeAutoScalingGroupsInput) (*DescribeAutoScalingGroupsOutput, error) { - req, out := c.DescribeAutoScalingGroupsRequest(input) - return out, req.Send() -} - -// DescribeAutoScalingGroupsWithContext is the same as DescribeAutoScalingGroups with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeAutoScalingGroups for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeAutoScalingGroupsWithContext(ctx aws.Context, input *DescribeAutoScalingGroupsInput, opts ...request.Option) (*DescribeAutoScalingGroupsOutput, error) { - req, out := c.DescribeAutoScalingGroupsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeAutoScalingGroupsPages iterates over the pages of a DescribeAutoScalingGroups operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeAutoScalingGroups 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 DescribeAutoScalingGroups operation. -// pageNum := 0 -// err := client.DescribeAutoScalingGroupsPages(params, -// func(page *autoscaling.DescribeAutoScalingGroupsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribeAutoScalingGroupsPages(input *DescribeAutoScalingGroupsInput, fn func(*DescribeAutoScalingGroupsOutput, bool) bool) error { - return c.DescribeAutoScalingGroupsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeAutoScalingGroupsPagesWithContext same as DescribeAutoScalingGroupsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeAutoScalingGroupsPagesWithContext(ctx aws.Context, input *DescribeAutoScalingGroupsInput, fn func(*DescribeAutoScalingGroupsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeAutoScalingGroupsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeAutoScalingGroupsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeAutoScalingGroupsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeAutoScalingInstances = "DescribeAutoScalingInstances" - -// DescribeAutoScalingInstancesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeAutoScalingInstances operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeAutoScalingInstances for more information on using the DescribeAutoScalingInstances -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeAutoScalingInstancesRequest method. -// req, resp := client.DescribeAutoScalingInstancesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingInstances -func (c *AutoScaling) DescribeAutoScalingInstancesRequest(input *DescribeAutoScalingInstancesInput) (req *request.Request, output *DescribeAutoScalingInstancesOutput) { - op := &request.Operation{ - Name: opDescribeAutoScalingInstances, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeAutoScalingInstancesInput{} - } - - output = &DescribeAutoScalingInstancesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeAutoScalingInstances API operation for Auto Scaling. -// -// Gets information about the Auto Scaling instances in the account and Region. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeAutoScalingInstances for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingInstances -func (c *AutoScaling) DescribeAutoScalingInstances(input *DescribeAutoScalingInstancesInput) (*DescribeAutoScalingInstancesOutput, error) { - req, out := c.DescribeAutoScalingInstancesRequest(input) - return out, req.Send() -} - -// DescribeAutoScalingInstancesWithContext is the same as DescribeAutoScalingInstances with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeAutoScalingInstances for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeAutoScalingInstancesWithContext(ctx aws.Context, input *DescribeAutoScalingInstancesInput, opts ...request.Option) (*DescribeAutoScalingInstancesOutput, error) { - req, out := c.DescribeAutoScalingInstancesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeAutoScalingInstancesPages iterates over the pages of a DescribeAutoScalingInstances operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeAutoScalingInstances 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 DescribeAutoScalingInstances operation. -// pageNum := 0 -// err := client.DescribeAutoScalingInstancesPages(params, -// func(page *autoscaling.DescribeAutoScalingInstancesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribeAutoScalingInstancesPages(input *DescribeAutoScalingInstancesInput, fn func(*DescribeAutoScalingInstancesOutput, bool) bool) error { - return c.DescribeAutoScalingInstancesPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeAutoScalingInstancesPagesWithContext same as DescribeAutoScalingInstancesPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeAutoScalingInstancesPagesWithContext(ctx aws.Context, input *DescribeAutoScalingInstancesInput, fn func(*DescribeAutoScalingInstancesOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeAutoScalingInstancesInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeAutoScalingInstancesRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeAutoScalingInstancesOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeAutoScalingNotificationTypes = "DescribeAutoScalingNotificationTypes" - -// DescribeAutoScalingNotificationTypesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeAutoScalingNotificationTypes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeAutoScalingNotificationTypes for more information on using the DescribeAutoScalingNotificationTypes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeAutoScalingNotificationTypesRequest method. -// req, resp := client.DescribeAutoScalingNotificationTypesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingNotificationTypes -func (c *AutoScaling) DescribeAutoScalingNotificationTypesRequest(input *DescribeAutoScalingNotificationTypesInput) (req *request.Request, output *DescribeAutoScalingNotificationTypesOutput) { - op := &request.Operation{ - Name: opDescribeAutoScalingNotificationTypes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeAutoScalingNotificationTypesInput{} - } - - output = &DescribeAutoScalingNotificationTypesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeAutoScalingNotificationTypes API operation for Auto Scaling. -// -// Describes the notification types that are supported by Amazon EC2 Auto Scaling. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeAutoScalingNotificationTypes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingNotificationTypes -func (c *AutoScaling) DescribeAutoScalingNotificationTypes(input *DescribeAutoScalingNotificationTypesInput) (*DescribeAutoScalingNotificationTypesOutput, error) { - req, out := c.DescribeAutoScalingNotificationTypesRequest(input) - return out, req.Send() -} - -// DescribeAutoScalingNotificationTypesWithContext is the same as DescribeAutoScalingNotificationTypes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeAutoScalingNotificationTypes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeAutoScalingNotificationTypesWithContext(ctx aws.Context, input *DescribeAutoScalingNotificationTypesInput, opts ...request.Option) (*DescribeAutoScalingNotificationTypesOutput, error) { - req, out := c.DescribeAutoScalingNotificationTypesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeInstanceRefreshes = "DescribeInstanceRefreshes" - -// DescribeInstanceRefreshesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeInstanceRefreshes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeInstanceRefreshes for more information on using the DescribeInstanceRefreshes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeInstanceRefreshesRequest method. -// req, resp := client.DescribeInstanceRefreshesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeInstanceRefreshes -func (c *AutoScaling) DescribeInstanceRefreshesRequest(input *DescribeInstanceRefreshesInput) (req *request.Request, output *DescribeInstanceRefreshesOutput) { - op := &request.Operation{ - Name: opDescribeInstanceRefreshes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeInstanceRefreshesInput{} - } - - output = &DescribeInstanceRefreshesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeInstanceRefreshes API operation for Auto Scaling. -// -// Gets information about the instance refreshes for the specified Auto Scaling -// group. -// -// This operation is part of the instance refresh feature (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html) -// in Amazon EC2 Auto Scaling, which helps you update instances in your Auto -// Scaling group after you make configuration changes. -// -// To help you determine the status of an instance refresh, this operation returns -// information about the instance refreshes you previously initiated, including -// their status, end time, the percentage of the instance refresh that is complete, -// and the number of instances remaining to update before the instance refresh -// is complete. -// -// The following are the possible statuses: -// -// - Pending - The request was created, but the operation has not started. -// -// - InProgress - The operation is in progress. -// -// - Successful - The operation completed successfully. -// -// - Failed - The operation failed to complete. You can troubleshoot using -// the status reason and the scaling activities. -// -// - Cancelling - An ongoing operation is being cancelled. Cancellation does -// not roll back any replacements that have already been completed, but it -// prevents new replacements from being started. -// -// - Cancelled - The operation is cancelled. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeInstanceRefreshes for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeInstanceRefreshes -func (c *AutoScaling) DescribeInstanceRefreshes(input *DescribeInstanceRefreshesInput) (*DescribeInstanceRefreshesOutput, error) { - req, out := c.DescribeInstanceRefreshesRequest(input) - return out, req.Send() -} - -// DescribeInstanceRefreshesWithContext is the same as DescribeInstanceRefreshes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeInstanceRefreshes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeInstanceRefreshesWithContext(ctx aws.Context, input *DescribeInstanceRefreshesInput, opts ...request.Option) (*DescribeInstanceRefreshesOutput, error) { - req, out := c.DescribeInstanceRefreshesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLaunchConfigurations = "DescribeLaunchConfigurations" - -// DescribeLaunchConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLaunchConfigurations operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLaunchConfigurations for more information on using the DescribeLaunchConfigurations -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLaunchConfigurationsRequest method. -// req, resp := client.DescribeLaunchConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLaunchConfigurations -func (c *AutoScaling) DescribeLaunchConfigurationsRequest(input *DescribeLaunchConfigurationsInput) (req *request.Request, output *DescribeLaunchConfigurationsOutput) { - op := &request.Operation{ - Name: opDescribeLaunchConfigurations, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeLaunchConfigurationsInput{} - } - - output = &DescribeLaunchConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLaunchConfigurations API operation for Auto Scaling. -// -// Gets information about the launch configurations in the account and Region. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeLaunchConfigurations for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLaunchConfigurations -func (c *AutoScaling) DescribeLaunchConfigurations(input *DescribeLaunchConfigurationsInput) (*DescribeLaunchConfigurationsOutput, error) { - req, out := c.DescribeLaunchConfigurationsRequest(input) - return out, req.Send() -} - -// DescribeLaunchConfigurationsWithContext is the same as DescribeLaunchConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLaunchConfigurations for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeLaunchConfigurationsWithContext(ctx aws.Context, input *DescribeLaunchConfigurationsInput, opts ...request.Option) (*DescribeLaunchConfigurationsOutput, error) { - req, out := c.DescribeLaunchConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeLaunchConfigurationsPages iterates over the pages of a DescribeLaunchConfigurations operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeLaunchConfigurations 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 DescribeLaunchConfigurations operation. -// pageNum := 0 -// err := client.DescribeLaunchConfigurationsPages(params, -// func(page *autoscaling.DescribeLaunchConfigurationsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribeLaunchConfigurationsPages(input *DescribeLaunchConfigurationsInput, fn func(*DescribeLaunchConfigurationsOutput, bool) bool) error { - return c.DescribeLaunchConfigurationsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeLaunchConfigurationsPagesWithContext same as DescribeLaunchConfigurationsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeLaunchConfigurationsPagesWithContext(ctx aws.Context, input *DescribeLaunchConfigurationsInput, fn func(*DescribeLaunchConfigurationsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeLaunchConfigurationsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeLaunchConfigurationsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeLaunchConfigurationsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeLifecycleHookTypes = "DescribeLifecycleHookTypes" - -// DescribeLifecycleHookTypesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLifecycleHookTypes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLifecycleHookTypes for more information on using the DescribeLifecycleHookTypes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLifecycleHookTypesRequest method. -// req, resp := client.DescribeLifecycleHookTypesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHookTypes -func (c *AutoScaling) DescribeLifecycleHookTypesRequest(input *DescribeLifecycleHookTypesInput) (req *request.Request, output *DescribeLifecycleHookTypesOutput) { - op := &request.Operation{ - Name: opDescribeLifecycleHookTypes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLifecycleHookTypesInput{} - } - - output = &DescribeLifecycleHookTypesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLifecycleHookTypes API operation for Auto Scaling. -// -// Describes the available types of lifecycle hooks. -// -// The following hook types are supported: -// -// - autoscaling:EC2_INSTANCE_LAUNCHING -// -// - autoscaling:EC2_INSTANCE_TERMINATING -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeLifecycleHookTypes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHookTypes -func (c *AutoScaling) DescribeLifecycleHookTypes(input *DescribeLifecycleHookTypesInput) (*DescribeLifecycleHookTypesOutput, error) { - req, out := c.DescribeLifecycleHookTypesRequest(input) - return out, req.Send() -} - -// DescribeLifecycleHookTypesWithContext is the same as DescribeLifecycleHookTypes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLifecycleHookTypes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeLifecycleHookTypesWithContext(ctx aws.Context, input *DescribeLifecycleHookTypesInput, opts ...request.Option) (*DescribeLifecycleHookTypesOutput, error) { - req, out := c.DescribeLifecycleHookTypesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLifecycleHooks = "DescribeLifecycleHooks" - -// DescribeLifecycleHooksRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLifecycleHooks operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLifecycleHooks for more information on using the DescribeLifecycleHooks -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLifecycleHooksRequest method. -// req, resp := client.DescribeLifecycleHooksRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHooks -func (c *AutoScaling) DescribeLifecycleHooksRequest(input *DescribeLifecycleHooksInput) (req *request.Request, output *DescribeLifecycleHooksOutput) { - op := &request.Operation{ - Name: opDescribeLifecycleHooks, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLifecycleHooksInput{} - } - - output = &DescribeLifecycleHooksOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLifecycleHooks API operation for Auto Scaling. -// -// Gets information about the lifecycle hooks for the specified Auto Scaling -// group. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeLifecycleHooks for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHooks -func (c *AutoScaling) DescribeLifecycleHooks(input *DescribeLifecycleHooksInput) (*DescribeLifecycleHooksOutput, error) { - req, out := c.DescribeLifecycleHooksRequest(input) - return out, req.Send() -} - -// DescribeLifecycleHooksWithContext is the same as DescribeLifecycleHooks with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLifecycleHooks for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeLifecycleHooksWithContext(ctx aws.Context, input *DescribeLifecycleHooksInput, opts ...request.Option) (*DescribeLifecycleHooksOutput, error) { - req, out := c.DescribeLifecycleHooksRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLoadBalancerTargetGroups = "DescribeLoadBalancerTargetGroups" - -// DescribeLoadBalancerTargetGroupsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancerTargetGroups operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancerTargetGroups for more information on using the DescribeLoadBalancerTargetGroups -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancerTargetGroupsRequest method. -// req, resp := client.DescribeLoadBalancerTargetGroupsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancerTargetGroups -func (c *AutoScaling) DescribeLoadBalancerTargetGroupsRequest(input *DescribeLoadBalancerTargetGroupsInput) (req *request.Request, output *DescribeLoadBalancerTargetGroupsOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancerTargetGroups, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLoadBalancerTargetGroupsInput{} - } - - output = &DescribeLoadBalancerTargetGroupsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancerTargetGroups API operation for Auto Scaling. -// -// Gets information about the Elastic Load Balancing target groups for the specified -// Auto Scaling group. -// -// To determine the attachment status of the target group, use the State element -// in the response. When you attach a target group to an Auto Scaling group, -// the initial State value is Adding. The state transitions to Added after all -// Auto Scaling instances are registered with the target group. If Elastic Load -// Balancing health checks are enabled for the Auto Scaling group, the state -// transitions to InService after at least one Auto Scaling instance passes -// the health check. When the target group is in the InService state, Amazon -// EC2 Auto Scaling can terminate and replace any instances that are reported -// as unhealthy. If no registered instances pass the health checks, the target -// group doesn't enter the InService state. -// -// Target groups also have an InService state if you attach them in the CreateAutoScalingGroup -// API call. If your target group state is InService, but it is not working -// properly, check the scaling activities by calling DescribeScalingActivities -// and take any corrective actions necessary. -// -// For help with failed health checks, see Troubleshooting Amazon EC2 Auto Scaling: -// Health checks (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ts-as-healthchecks.html) -// in the Amazon EC2 Auto Scaling User Guide. For more information, see Use -// Elastic Load Balancing to distribute traffic across the instances in your -// Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeLoadBalancerTargetGroups for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancerTargetGroups -func (c *AutoScaling) DescribeLoadBalancerTargetGroups(input *DescribeLoadBalancerTargetGroupsInput) (*DescribeLoadBalancerTargetGroupsOutput, error) { - req, out := c.DescribeLoadBalancerTargetGroupsRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancerTargetGroupsWithContext is the same as DescribeLoadBalancerTargetGroups with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancerTargetGroups for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeLoadBalancerTargetGroupsWithContext(ctx aws.Context, input *DescribeLoadBalancerTargetGroupsInput, opts ...request.Option) (*DescribeLoadBalancerTargetGroupsOutput, error) { - req, out := c.DescribeLoadBalancerTargetGroupsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLoadBalancers = "DescribeLoadBalancers" - -// DescribeLoadBalancersRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancers operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancers for more information on using the DescribeLoadBalancers -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancersRequest method. -// req, resp := client.DescribeLoadBalancersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancers -func (c *AutoScaling) DescribeLoadBalancersRequest(input *DescribeLoadBalancersInput) (req *request.Request, output *DescribeLoadBalancersOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancers, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLoadBalancersInput{} - } - - output = &DescribeLoadBalancersOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancers API operation for Auto Scaling. -// -// Gets information about the load balancers for the specified Auto Scaling -// group. -// -// This operation describes only Classic Load Balancers. If you have Application -// Load Balancers, Network Load Balancers, or Gateway Load Balancer, use the -// DescribeLoadBalancerTargetGroups API instead. -// -// To determine the attachment status of the load balancer, use the State element -// in the response. When you attach a load balancer to an Auto Scaling group, -// the initial State value is Adding. The state transitions to Added after all -// Auto Scaling instances are registered with the load balancer. If Elastic -// Load Balancing health checks are enabled for the Auto Scaling group, the -// state transitions to InService after at least one Auto Scaling instance passes -// the health check. When the load balancer is in the InService state, Amazon -// EC2 Auto Scaling can terminate and replace any instances that are reported -// as unhealthy. If no registered instances pass the health checks, the load -// balancer doesn't enter the InService state. -// -// Load balancers also have an InService state if you attach them in the CreateAutoScalingGroup -// API call. If your load balancer state is InService, but it is not working -// properly, check the scaling activities by calling DescribeScalingActivities -// and take any corrective actions necessary. -// -// For help with failed health checks, see Troubleshooting Amazon EC2 Auto Scaling: -// Health checks (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ts-as-healthchecks.html) -// in the Amazon EC2 Auto Scaling User Guide. For more information, see Use -// Elastic Load Balancing to distribute traffic across the instances in your -// Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeLoadBalancers for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancers -func (c *AutoScaling) DescribeLoadBalancers(input *DescribeLoadBalancersInput) (*DescribeLoadBalancersOutput, error) { - req, out := c.DescribeLoadBalancersRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancersWithContext is the same as DescribeLoadBalancers with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancers for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeLoadBalancersWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.Option) (*DescribeLoadBalancersOutput, error) { - req, out := c.DescribeLoadBalancersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeMetricCollectionTypes = "DescribeMetricCollectionTypes" - -// DescribeMetricCollectionTypesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeMetricCollectionTypes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeMetricCollectionTypes for more information on using the DescribeMetricCollectionTypes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeMetricCollectionTypesRequest method. -// req, resp := client.DescribeMetricCollectionTypesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeMetricCollectionTypes -func (c *AutoScaling) DescribeMetricCollectionTypesRequest(input *DescribeMetricCollectionTypesInput) (req *request.Request, output *DescribeMetricCollectionTypesOutput) { - op := &request.Operation{ - Name: opDescribeMetricCollectionTypes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeMetricCollectionTypesInput{} - } - - output = &DescribeMetricCollectionTypesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeMetricCollectionTypes API operation for Auto Scaling. -// -// Describes the available CloudWatch metrics for Amazon EC2 Auto Scaling. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeMetricCollectionTypes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeMetricCollectionTypes -func (c *AutoScaling) DescribeMetricCollectionTypes(input *DescribeMetricCollectionTypesInput) (*DescribeMetricCollectionTypesOutput, error) { - req, out := c.DescribeMetricCollectionTypesRequest(input) - return out, req.Send() -} - -// DescribeMetricCollectionTypesWithContext is the same as DescribeMetricCollectionTypes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeMetricCollectionTypes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeMetricCollectionTypesWithContext(ctx aws.Context, input *DescribeMetricCollectionTypesInput, opts ...request.Option) (*DescribeMetricCollectionTypesOutput, error) { - req, out := c.DescribeMetricCollectionTypesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeNotificationConfigurations = "DescribeNotificationConfigurations" - -// DescribeNotificationConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeNotificationConfigurations operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeNotificationConfigurations for more information on using the DescribeNotificationConfigurations -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeNotificationConfigurationsRequest method. -// req, resp := client.DescribeNotificationConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeNotificationConfigurations -func (c *AutoScaling) DescribeNotificationConfigurationsRequest(input *DescribeNotificationConfigurationsInput) (req *request.Request, output *DescribeNotificationConfigurationsOutput) { - op := &request.Operation{ - Name: opDescribeNotificationConfigurations, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeNotificationConfigurationsInput{} - } - - output = &DescribeNotificationConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeNotificationConfigurations API operation for Auto Scaling. -// -// Gets information about the Amazon SNS notifications that are configured for -// one or more Auto Scaling groups. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeNotificationConfigurations for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeNotificationConfigurations -func (c *AutoScaling) DescribeNotificationConfigurations(input *DescribeNotificationConfigurationsInput) (*DescribeNotificationConfigurationsOutput, error) { - req, out := c.DescribeNotificationConfigurationsRequest(input) - return out, req.Send() -} - -// DescribeNotificationConfigurationsWithContext is the same as DescribeNotificationConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeNotificationConfigurations for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeNotificationConfigurationsWithContext(ctx aws.Context, input *DescribeNotificationConfigurationsInput, opts ...request.Option) (*DescribeNotificationConfigurationsOutput, error) { - req, out := c.DescribeNotificationConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeNotificationConfigurationsPages iterates over the pages of a DescribeNotificationConfigurations operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeNotificationConfigurations 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 DescribeNotificationConfigurations operation. -// pageNum := 0 -// err := client.DescribeNotificationConfigurationsPages(params, -// func(page *autoscaling.DescribeNotificationConfigurationsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribeNotificationConfigurationsPages(input *DescribeNotificationConfigurationsInput, fn func(*DescribeNotificationConfigurationsOutput, bool) bool) error { - return c.DescribeNotificationConfigurationsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeNotificationConfigurationsPagesWithContext same as DescribeNotificationConfigurationsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeNotificationConfigurationsPagesWithContext(ctx aws.Context, input *DescribeNotificationConfigurationsInput, fn func(*DescribeNotificationConfigurationsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeNotificationConfigurationsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeNotificationConfigurationsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeNotificationConfigurationsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribePolicies = "DescribePolicies" - -// DescribePoliciesRequest generates a "aws/request.Request" representing the -// client's request for the DescribePolicies operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribePolicies for more information on using the DescribePolicies -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribePoliciesRequest method. -// req, resp := client.DescribePoliciesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribePolicies -func (c *AutoScaling) DescribePoliciesRequest(input *DescribePoliciesInput) (req *request.Request, output *DescribePoliciesOutput) { - op := &request.Operation{ - Name: opDescribePolicies, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribePoliciesInput{} - } - - output = &DescribePoliciesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribePolicies API operation for Auto Scaling. -// -// Gets information about the scaling policies in the account and Region. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribePolicies for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribePolicies -func (c *AutoScaling) DescribePolicies(input *DescribePoliciesInput) (*DescribePoliciesOutput, error) { - req, out := c.DescribePoliciesRequest(input) - return out, req.Send() -} - -// DescribePoliciesWithContext is the same as DescribePolicies with the addition of -// the ability to pass a context and additional request options. -// -// See DescribePolicies for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribePoliciesWithContext(ctx aws.Context, input *DescribePoliciesInput, opts ...request.Option) (*DescribePoliciesOutput, error) { - req, out := c.DescribePoliciesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribePoliciesPages iterates over the pages of a DescribePolicies operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribePolicies 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 DescribePolicies operation. -// pageNum := 0 -// err := client.DescribePoliciesPages(params, -// func(page *autoscaling.DescribePoliciesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribePoliciesPages(input *DescribePoliciesInput, fn func(*DescribePoliciesOutput, bool) bool) error { - return c.DescribePoliciesPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribePoliciesPagesWithContext same as DescribePoliciesPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribePoliciesPagesWithContext(ctx aws.Context, input *DescribePoliciesInput, fn func(*DescribePoliciesOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribePoliciesInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribePoliciesRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribePoliciesOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeScalingActivities = "DescribeScalingActivities" - -// DescribeScalingActivitiesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeScalingActivities operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeScalingActivities for more information on using the DescribeScalingActivities -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeScalingActivitiesRequest method. -// req, resp := client.DescribeScalingActivitiesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScalingActivities -func (c *AutoScaling) DescribeScalingActivitiesRequest(input *DescribeScalingActivitiesInput) (req *request.Request, output *DescribeScalingActivitiesOutput) { - op := &request.Operation{ - Name: opDescribeScalingActivities, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeScalingActivitiesInput{} - } - - output = &DescribeScalingActivitiesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeScalingActivities API operation for Auto Scaling. -// -// Gets information about the scaling activities in the account and Region. -// -// When scaling events occur, you see a record of the scaling activity in the -// scaling activities. For more information, see Verifying a scaling activity -// for an Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-verify-scaling-activity.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// If the scaling event succeeds, the value of the StatusCode element in the -// response is Successful. If an attempt to launch instances failed, the StatusCode -// value is Failed or Cancelled and the StatusMessage element in the response -// indicates the cause of the failure. For help interpreting the StatusMessage, -// see Troubleshooting Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/CHAP_Troubleshooting.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeScalingActivities for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScalingActivities -func (c *AutoScaling) DescribeScalingActivities(input *DescribeScalingActivitiesInput) (*DescribeScalingActivitiesOutput, error) { - req, out := c.DescribeScalingActivitiesRequest(input) - return out, req.Send() -} - -// DescribeScalingActivitiesWithContext is the same as DescribeScalingActivities with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeScalingActivities for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeScalingActivitiesWithContext(ctx aws.Context, input *DescribeScalingActivitiesInput, opts ...request.Option) (*DescribeScalingActivitiesOutput, error) { - req, out := c.DescribeScalingActivitiesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeScalingActivitiesPages iterates over the pages of a DescribeScalingActivities operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeScalingActivities 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 DescribeScalingActivities operation. -// pageNum := 0 -// err := client.DescribeScalingActivitiesPages(params, -// func(page *autoscaling.DescribeScalingActivitiesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribeScalingActivitiesPages(input *DescribeScalingActivitiesInput, fn func(*DescribeScalingActivitiesOutput, bool) bool) error { - return c.DescribeScalingActivitiesPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeScalingActivitiesPagesWithContext same as DescribeScalingActivitiesPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeScalingActivitiesPagesWithContext(ctx aws.Context, input *DescribeScalingActivitiesInput, fn func(*DescribeScalingActivitiesOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeScalingActivitiesInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeScalingActivitiesRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeScalingActivitiesOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeScalingProcessTypes = "DescribeScalingProcessTypes" - -// DescribeScalingProcessTypesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeScalingProcessTypes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeScalingProcessTypes for more information on using the DescribeScalingProcessTypes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeScalingProcessTypesRequest method. -// req, resp := client.DescribeScalingProcessTypesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScalingProcessTypes -func (c *AutoScaling) DescribeScalingProcessTypesRequest(input *DescribeScalingProcessTypesInput) (req *request.Request, output *DescribeScalingProcessTypesOutput) { - op := &request.Operation{ - Name: opDescribeScalingProcessTypes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeScalingProcessTypesInput{} - } - - output = &DescribeScalingProcessTypesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeScalingProcessTypes API operation for Auto Scaling. -// -// Describes the scaling process types for use with the ResumeProcesses and -// SuspendProcesses APIs. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeScalingProcessTypes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScalingProcessTypes -func (c *AutoScaling) DescribeScalingProcessTypes(input *DescribeScalingProcessTypesInput) (*DescribeScalingProcessTypesOutput, error) { - req, out := c.DescribeScalingProcessTypesRequest(input) - return out, req.Send() -} - -// DescribeScalingProcessTypesWithContext is the same as DescribeScalingProcessTypes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeScalingProcessTypes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeScalingProcessTypesWithContext(ctx aws.Context, input *DescribeScalingProcessTypesInput, opts ...request.Option) (*DescribeScalingProcessTypesOutput, error) { - req, out := c.DescribeScalingProcessTypesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeScheduledActions = "DescribeScheduledActions" - -// DescribeScheduledActionsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeScheduledActions operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeScheduledActions for more information on using the DescribeScheduledActions -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeScheduledActionsRequest method. -// req, resp := client.DescribeScheduledActionsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScheduledActions -func (c *AutoScaling) DescribeScheduledActionsRequest(input *DescribeScheduledActionsInput) (req *request.Request, output *DescribeScheduledActionsOutput) { - op := &request.Operation{ - Name: opDescribeScheduledActions, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeScheduledActionsInput{} - } - - output = &DescribeScheduledActionsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeScheduledActions API operation for Auto Scaling. -// -// Gets information about the scheduled actions that haven't run or that have -// not reached their end time. -// -// To describe the scaling activities for scheduled actions that have already -// run, call the DescribeScalingActivities API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeScheduledActions for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScheduledActions -func (c *AutoScaling) DescribeScheduledActions(input *DescribeScheduledActionsInput) (*DescribeScheduledActionsOutput, error) { - req, out := c.DescribeScheduledActionsRequest(input) - return out, req.Send() -} - -// DescribeScheduledActionsWithContext is the same as DescribeScheduledActions with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeScheduledActions for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeScheduledActionsWithContext(ctx aws.Context, input *DescribeScheduledActionsInput, opts ...request.Option) (*DescribeScheduledActionsOutput, error) { - req, out := c.DescribeScheduledActionsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeScheduledActionsPages iterates over the pages of a DescribeScheduledActions operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeScheduledActions 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 DescribeScheduledActions operation. -// pageNum := 0 -// err := client.DescribeScheduledActionsPages(params, -// func(page *autoscaling.DescribeScheduledActionsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribeScheduledActionsPages(input *DescribeScheduledActionsInput, fn func(*DescribeScheduledActionsOutput, bool) bool) error { - return c.DescribeScheduledActionsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeScheduledActionsPagesWithContext same as DescribeScheduledActionsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeScheduledActionsPagesWithContext(ctx aws.Context, input *DescribeScheduledActionsInput, fn func(*DescribeScheduledActionsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeScheduledActionsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeScheduledActionsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeScheduledActionsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeTags = "DescribeTags" - -// DescribeTagsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeTags for more information on using the DescribeTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // 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) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTags -func (c *AutoScaling) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Request, output *DescribeTagsOutput) { - op := &request.Operation{ - Name: opDescribeTags, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - LimitToken: "MaxRecords", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeTagsInput{} - } - - output = &DescribeTagsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeTags API operation for Auto Scaling. -// -// Describes the specified tags. -// -// You can use filters to limit the results. For example, you can query for -// the tags for a specific Auto Scaling group. You can specify multiple values -// for a filter. A tag must match at least one of the specified values for it -// to be included in the results. -// -// You can also specify multiple filters. The result includes information for -// a particular tag only if it matches all the filters. If there's no match, -// no special message is returned. -// -// For more information, see Tag Auto Scaling groups and instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeTags for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTags -func (c *AutoScaling) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error) { - req, out := c.DescribeTagsRequest(input) - return out, req.Send() -} - -// DescribeTagsWithContext is the same as DescribeTags with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeTagsWithContext(ctx aws.Context, input *DescribeTagsInput, opts ...request.Option) (*DescribeTagsOutput, error) { - req, out := c.DescribeTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// 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 *autoscaling.DescribeTagsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *AutoScaling) DescribeTagsPages(input *DescribeTagsInput, fn func(*DescribeTagsOutput, bool) bool) error { - return c.DescribeTagsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeTagsPagesWithContext same as DescribeTagsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeTagsPagesWithContext(ctx aws.Context, input *DescribeTagsInput, fn func(*DescribeTagsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeTagsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeTagsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeTagsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeTerminationPolicyTypes = "DescribeTerminationPolicyTypes" - -// DescribeTerminationPolicyTypesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeTerminationPolicyTypes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeTerminationPolicyTypes for more information on using the DescribeTerminationPolicyTypes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeTerminationPolicyTypesRequest method. -// req, resp := client.DescribeTerminationPolicyTypesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTerminationPolicyTypes -func (c *AutoScaling) DescribeTerminationPolicyTypesRequest(input *DescribeTerminationPolicyTypesInput) (req *request.Request, output *DescribeTerminationPolicyTypesOutput) { - op := &request.Operation{ - Name: opDescribeTerminationPolicyTypes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeTerminationPolicyTypesInput{} - } - - output = &DescribeTerminationPolicyTypesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeTerminationPolicyTypes API operation for Auto Scaling. -// -// Describes the termination policies supported by Amazon EC2 Auto Scaling. -// -// For more information, see Work with Amazon EC2 Auto Scaling termination policies -// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-termination-policies.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeTerminationPolicyTypes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTerminationPolicyTypes -func (c *AutoScaling) DescribeTerminationPolicyTypes(input *DescribeTerminationPolicyTypesInput) (*DescribeTerminationPolicyTypesOutput, error) { - req, out := c.DescribeTerminationPolicyTypesRequest(input) - return out, req.Send() -} - -// DescribeTerminationPolicyTypesWithContext is the same as DescribeTerminationPolicyTypes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeTerminationPolicyTypes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeTerminationPolicyTypesWithContext(ctx aws.Context, input *DescribeTerminationPolicyTypesInput, opts ...request.Option) (*DescribeTerminationPolicyTypesOutput, error) { - req, out := c.DescribeTerminationPolicyTypesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeWarmPool = "DescribeWarmPool" - -// DescribeWarmPoolRequest generates a "aws/request.Request" representing the -// client's request for the DescribeWarmPool operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeWarmPool for more information on using the DescribeWarmPool -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeWarmPoolRequest method. -// req, resp := client.DescribeWarmPoolRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeWarmPool -func (c *AutoScaling) DescribeWarmPoolRequest(input *DescribeWarmPoolInput) (req *request.Request, output *DescribeWarmPoolOutput) { - op := &request.Operation{ - Name: opDescribeWarmPool, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeWarmPoolInput{} - } - - output = &DescribeWarmPoolOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeWarmPool API operation for Auto Scaling. -// -// Gets information about a warm pool and its instances. -// -// For more information, see Warm pools for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DescribeWarmPool for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidNextToken "InvalidNextToken" -// The NextToken value is not valid. -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeWarmPool -func (c *AutoScaling) DescribeWarmPool(input *DescribeWarmPoolInput) (*DescribeWarmPoolOutput, error) { - req, out := c.DescribeWarmPoolRequest(input) - return out, req.Send() -} - -// DescribeWarmPoolWithContext is the same as DescribeWarmPool with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeWarmPool for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DescribeWarmPoolWithContext(ctx aws.Context, input *DescribeWarmPoolInput, opts ...request.Option) (*DescribeWarmPoolOutput, error) { - req, out := c.DescribeWarmPoolRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDetachInstances = "DetachInstances" - -// DetachInstancesRequest generates a "aws/request.Request" representing the -// client's request for the DetachInstances operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DetachInstances for more information on using the DetachInstances -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DetachInstancesRequest method. -// req, resp := client.DetachInstancesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachInstances -func (c *AutoScaling) DetachInstancesRequest(input *DetachInstancesInput) (req *request.Request, output *DetachInstancesOutput) { - op := &request.Operation{ - Name: opDetachInstances, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DetachInstancesInput{} - } - - output = &DetachInstancesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DetachInstances API operation for Auto Scaling. -// -// Removes one or more instances from the specified Auto Scaling group. -// -// After the instances are detached, you can manage them independent of the -// Auto Scaling group. -// -// If you do not specify the option to decrement the desired capacity, Amazon -// EC2 Auto Scaling launches instances to replace the ones that are detached. -// -// If there is a Classic Load Balancer attached to the Auto Scaling group, the -// instances are deregistered from the load balancer. If there are target groups -// attached to the Auto Scaling group, the instances are deregistered from the -// target groups. -// -// For more information, see Detach EC2 instances from your Auto Scaling group -// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/detach-instance-asg.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DetachInstances for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachInstances -func (c *AutoScaling) DetachInstances(input *DetachInstancesInput) (*DetachInstancesOutput, error) { - req, out := c.DetachInstancesRequest(input) - return out, req.Send() -} - -// DetachInstancesWithContext is the same as DetachInstances with the addition of -// the ability to pass a context and additional request options. -// -// See DetachInstances for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DetachInstancesWithContext(ctx aws.Context, input *DetachInstancesInput, opts ...request.Option) (*DetachInstancesOutput, error) { - req, out := c.DetachInstancesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDetachLoadBalancerTargetGroups = "DetachLoadBalancerTargetGroups" - -// DetachLoadBalancerTargetGroupsRequest generates a "aws/request.Request" representing the -// client's request for the DetachLoadBalancerTargetGroups operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DetachLoadBalancerTargetGroups for more information on using the DetachLoadBalancerTargetGroups -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DetachLoadBalancerTargetGroupsRequest method. -// req, resp := client.DetachLoadBalancerTargetGroupsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancerTargetGroups -func (c *AutoScaling) DetachLoadBalancerTargetGroupsRequest(input *DetachLoadBalancerTargetGroupsInput) (req *request.Request, output *DetachLoadBalancerTargetGroupsOutput) { - op := &request.Operation{ - Name: opDetachLoadBalancerTargetGroups, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DetachLoadBalancerTargetGroupsInput{} - } - - output = &DetachLoadBalancerTargetGroupsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DetachLoadBalancerTargetGroups API operation for Auto Scaling. -// -// Detaches one or more target groups from the specified Auto Scaling group. -// -// When you detach a target group, it enters the Removing state while deregistering -// the instances in the group. When all instances are deregistered, then you -// can no longer describe the target group using the DescribeLoadBalancerTargetGroups -// API call. The instances remain running. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DetachLoadBalancerTargetGroups for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancerTargetGroups -func (c *AutoScaling) DetachLoadBalancerTargetGroups(input *DetachLoadBalancerTargetGroupsInput) (*DetachLoadBalancerTargetGroupsOutput, error) { - req, out := c.DetachLoadBalancerTargetGroupsRequest(input) - return out, req.Send() -} - -// DetachLoadBalancerTargetGroupsWithContext is the same as DetachLoadBalancerTargetGroups with the addition of -// the ability to pass a context and additional request options. -// -// See DetachLoadBalancerTargetGroups for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DetachLoadBalancerTargetGroupsWithContext(ctx aws.Context, input *DetachLoadBalancerTargetGroupsInput, opts ...request.Option) (*DetachLoadBalancerTargetGroupsOutput, error) { - req, out := c.DetachLoadBalancerTargetGroupsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDetachLoadBalancers = "DetachLoadBalancers" - -// DetachLoadBalancersRequest generates a "aws/request.Request" representing the -// client's request for the DetachLoadBalancers operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DetachLoadBalancers for more information on using the DetachLoadBalancers -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DetachLoadBalancersRequest method. -// req, resp := client.DetachLoadBalancersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancers -func (c *AutoScaling) DetachLoadBalancersRequest(input *DetachLoadBalancersInput) (req *request.Request, output *DetachLoadBalancersOutput) { - op := &request.Operation{ - Name: opDetachLoadBalancers, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DetachLoadBalancersInput{} - } - - output = &DetachLoadBalancersOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DetachLoadBalancers API operation for Auto Scaling. -// -// Detaches one or more Classic Load Balancers from the specified Auto Scaling -// group. -// -// This operation detaches only Classic Load Balancers. If you have Application -// Load Balancers, Network Load Balancers, or Gateway Load Balancer, use the -// DetachLoadBalancerTargetGroups API instead. -// -// When you detach a load balancer, it enters the Removing state while deregistering -// the instances in the group. When all instances are deregistered, then you -// can no longer describe the load balancer using the DescribeLoadBalancers -// API call. The instances remain running. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DetachLoadBalancers for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancers -func (c *AutoScaling) DetachLoadBalancers(input *DetachLoadBalancersInput) (*DetachLoadBalancersOutput, error) { - req, out := c.DetachLoadBalancersRequest(input) - return out, req.Send() -} - -// DetachLoadBalancersWithContext is the same as DetachLoadBalancers with the addition of -// the ability to pass a context and additional request options. -// -// See DetachLoadBalancers for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DetachLoadBalancersWithContext(ctx aws.Context, input *DetachLoadBalancersInput, opts ...request.Option) (*DetachLoadBalancersOutput, error) { - req, out := c.DetachLoadBalancersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDisableMetricsCollection = "DisableMetricsCollection" - -// DisableMetricsCollectionRequest generates a "aws/request.Request" representing the -// client's request for the DisableMetricsCollection operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DisableMetricsCollection for more information on using the DisableMetricsCollection -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DisableMetricsCollectionRequest method. -// req, resp := client.DisableMetricsCollectionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DisableMetricsCollection -func (c *AutoScaling) DisableMetricsCollectionRequest(input *DisableMetricsCollectionInput) (req *request.Request, output *DisableMetricsCollectionOutput) { - op := &request.Operation{ - Name: opDisableMetricsCollection, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DisableMetricsCollectionInput{} - } - - output = &DisableMetricsCollectionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DisableMetricsCollection API operation for Auto Scaling. -// -// Disables group metrics collection for the specified Auto Scaling group. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation DisableMetricsCollection for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DisableMetricsCollection -func (c *AutoScaling) DisableMetricsCollection(input *DisableMetricsCollectionInput) (*DisableMetricsCollectionOutput, error) { - req, out := c.DisableMetricsCollectionRequest(input) - return out, req.Send() -} - -// DisableMetricsCollectionWithContext is the same as DisableMetricsCollection with the addition of -// the ability to pass a context and additional request options. -// -// See DisableMetricsCollection for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) DisableMetricsCollectionWithContext(ctx aws.Context, input *DisableMetricsCollectionInput, opts ...request.Option) (*DisableMetricsCollectionOutput, error) { - req, out := c.DisableMetricsCollectionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opEnableMetricsCollection = "EnableMetricsCollection" - -// EnableMetricsCollectionRequest generates a "aws/request.Request" representing the -// client's request for the EnableMetricsCollection operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See EnableMetricsCollection for more information on using the EnableMetricsCollection -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the EnableMetricsCollectionRequest method. -// req, resp := client.EnableMetricsCollectionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnableMetricsCollection -func (c *AutoScaling) EnableMetricsCollectionRequest(input *EnableMetricsCollectionInput) (req *request.Request, output *EnableMetricsCollectionOutput) { - op := &request.Operation{ - Name: opEnableMetricsCollection, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &EnableMetricsCollectionInput{} - } - - output = &EnableMetricsCollectionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// EnableMetricsCollection API operation for Auto Scaling. -// -// Enables group metrics collection for the specified Auto Scaling group. -// -// You can use these metrics to track changes in an Auto Scaling group and to -// set alarms on threshold values. You can view group metrics using the Amazon -// EC2 Auto Scaling console or the CloudWatch console. For more information, -// see Monitor CloudWatch metrics for your Auto Scaling groups and instances -// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-cloudwatch-monitoring.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation EnableMetricsCollection for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnableMetricsCollection -func (c *AutoScaling) EnableMetricsCollection(input *EnableMetricsCollectionInput) (*EnableMetricsCollectionOutput, error) { - req, out := c.EnableMetricsCollectionRequest(input) - return out, req.Send() -} - -// EnableMetricsCollectionWithContext is the same as EnableMetricsCollection with the addition of -// the ability to pass a context and additional request options. -// -// See EnableMetricsCollection for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) EnableMetricsCollectionWithContext(ctx aws.Context, input *EnableMetricsCollectionInput, opts ...request.Option) (*EnableMetricsCollectionOutput, error) { - req, out := c.EnableMetricsCollectionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opEnterStandby = "EnterStandby" - -// EnterStandbyRequest generates a "aws/request.Request" representing the -// client's request for the EnterStandby operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See EnterStandby for more information on using the EnterStandby -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the EnterStandbyRequest method. -// req, resp := client.EnterStandbyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnterStandby -func (c *AutoScaling) EnterStandbyRequest(input *EnterStandbyInput) (req *request.Request, output *EnterStandbyOutput) { - op := &request.Operation{ - Name: opEnterStandby, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &EnterStandbyInput{} - } - - output = &EnterStandbyOutput{} - req = c.newRequest(op, input, output) - return -} - -// EnterStandby API operation for Auto Scaling. -// -// Moves the specified instances into the standby state. -// -// If you choose to decrement the desired capacity of the Auto Scaling group, -// the instances can enter standby as long as the desired capacity of the Auto -// Scaling group after the instances are placed into standby is equal to or -// greater than the minimum capacity of the group. -// -// If you choose not to decrement the desired capacity of the Auto Scaling group, -// the Auto Scaling group launches new instances to replace the instances on -// standby. -// -// For more information, see Temporarily removing instances from your Auto Scaling -// group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation EnterStandby for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnterStandby -func (c *AutoScaling) EnterStandby(input *EnterStandbyInput) (*EnterStandbyOutput, error) { - req, out := c.EnterStandbyRequest(input) - return out, req.Send() -} - -// EnterStandbyWithContext is the same as EnterStandby with the addition of -// the ability to pass a context and additional request options. -// -// See EnterStandby for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) EnterStandbyWithContext(ctx aws.Context, input *EnterStandbyInput, opts ...request.Option) (*EnterStandbyOutput, error) { - req, out := c.EnterStandbyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opExecutePolicy = "ExecutePolicy" - -// ExecutePolicyRequest generates a "aws/request.Request" representing the -// client's request for the ExecutePolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ExecutePolicy for more information on using the ExecutePolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ExecutePolicyRequest method. -// req, resp := client.ExecutePolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExecutePolicy -func (c *AutoScaling) ExecutePolicyRequest(input *ExecutePolicyInput) (req *request.Request, output *ExecutePolicyOutput) { - op := &request.Operation{ - Name: opExecutePolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ExecutePolicyInput{} - } - - output = &ExecutePolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// ExecutePolicy API operation for Auto Scaling. -// -// Executes the specified policy. This can be useful for testing the design -// of your scaling policy. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation ExecutePolicy for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeScalingActivityInProgressFault "ScalingActivityInProgress" -// The operation can't be performed because there are scaling activities in -// progress. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExecutePolicy -func (c *AutoScaling) ExecutePolicy(input *ExecutePolicyInput) (*ExecutePolicyOutput, error) { - req, out := c.ExecutePolicyRequest(input) - return out, req.Send() -} - -// ExecutePolicyWithContext is the same as ExecutePolicy with the addition of -// the ability to pass a context and additional request options. -// -// See ExecutePolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) ExecutePolicyWithContext(ctx aws.Context, input *ExecutePolicyInput, opts ...request.Option) (*ExecutePolicyOutput, error) { - req, out := c.ExecutePolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opExitStandby = "ExitStandby" - -// ExitStandbyRequest generates a "aws/request.Request" representing the -// client's request for the ExitStandby operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ExitStandby for more information on using the ExitStandby -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ExitStandbyRequest method. -// req, resp := client.ExitStandbyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExitStandby -func (c *AutoScaling) ExitStandbyRequest(input *ExitStandbyInput) (req *request.Request, output *ExitStandbyOutput) { - op := &request.Operation{ - Name: opExitStandby, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ExitStandbyInput{} - } - - output = &ExitStandbyOutput{} - req = c.newRequest(op, input, output) - return -} - -// ExitStandby API operation for Auto Scaling. -// -// Moves the specified instances out of the standby state. -// -// After you put the instances back in service, the desired capacity is incremented. -// -// For more information, see Temporarily removing instances from your Auto Scaling -// group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation ExitStandby for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExitStandby -func (c *AutoScaling) ExitStandby(input *ExitStandbyInput) (*ExitStandbyOutput, error) { - req, out := c.ExitStandbyRequest(input) - return out, req.Send() -} - -// ExitStandbyWithContext is the same as ExitStandby with the addition of -// the ability to pass a context and additional request options. -// -// See ExitStandby for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) ExitStandbyWithContext(ctx aws.Context, input *ExitStandbyInput, opts ...request.Option) (*ExitStandbyOutput, error) { - req, out := c.ExitStandbyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetPredictiveScalingForecast = "GetPredictiveScalingForecast" - -// GetPredictiveScalingForecastRequest generates a "aws/request.Request" representing the -// client's request for the GetPredictiveScalingForecast operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetPredictiveScalingForecast for more information on using the GetPredictiveScalingForecast -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GetPredictiveScalingForecastRequest method. -// req, resp := client.GetPredictiveScalingForecastRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/GetPredictiveScalingForecast -func (c *AutoScaling) GetPredictiveScalingForecastRequest(input *GetPredictiveScalingForecastInput) (req *request.Request, output *GetPredictiveScalingForecastOutput) { - op := &request.Operation{ - Name: opGetPredictiveScalingForecast, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetPredictiveScalingForecastInput{} - } - - output = &GetPredictiveScalingForecastOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetPredictiveScalingForecast API operation for Auto Scaling. -// -// Retrieves the forecast data for a predictive scaling policy. -// -// Load forecasts are predictions of the hourly load values using historical -// load data from CloudWatch and an analysis of historical trends. Capacity -// forecasts are represented as predicted values for the minimum capacity that -// is needed on an hourly basis, based on the hourly load forecast. -// -// A minimum of 24 hours of data is required to create the initial forecasts. -// However, having a full 14 days of historical data results in more accurate -// forecasts. -// -// For more information, see Predictive scaling for Amazon EC2 Auto Scaling -// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-predictive-scaling.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation GetPredictiveScalingForecast for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/GetPredictiveScalingForecast -func (c *AutoScaling) GetPredictiveScalingForecast(input *GetPredictiveScalingForecastInput) (*GetPredictiveScalingForecastOutput, error) { - req, out := c.GetPredictiveScalingForecastRequest(input) - return out, req.Send() -} - -// GetPredictiveScalingForecastWithContext is the same as GetPredictiveScalingForecast with the addition of -// the ability to pass a context and additional request options. -// -// See GetPredictiveScalingForecast for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) GetPredictiveScalingForecastWithContext(ctx aws.Context, input *GetPredictiveScalingForecastInput, opts ...request.Option) (*GetPredictiveScalingForecastOutput, error) { - req, out := c.GetPredictiveScalingForecastRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutLifecycleHook = "PutLifecycleHook" - -// PutLifecycleHookRequest generates a "aws/request.Request" representing the -// client's request for the PutLifecycleHook operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutLifecycleHook for more information on using the PutLifecycleHook -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the PutLifecycleHookRequest method. -// req, resp := client.PutLifecycleHookRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutLifecycleHook -func (c *AutoScaling) PutLifecycleHookRequest(input *PutLifecycleHookInput) (req *request.Request, output *PutLifecycleHookOutput) { - op := &request.Operation{ - Name: opPutLifecycleHook, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &PutLifecycleHookInput{} - } - - output = &PutLifecycleHookOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutLifecycleHook API operation for Auto Scaling. -// -// Creates or updates a lifecycle hook for the specified Auto Scaling group. -// -// Lifecycle hooks let you create solutions that are aware of events in the -// Auto Scaling instance lifecycle, and then perform a custom action on instances -// when the corresponding lifecycle event occurs. -// -// This step is a part of the procedure for adding a lifecycle hook to an Auto -// Scaling group: -// -// (Optional) Create a launch template or launch configuration with a user data -// script that runs while an instance is in a wait state due to a lifecycle -// hook. -// -// (Optional) Create a Lambda function and a rule that allows Amazon EventBridge -// to invoke your Lambda function when an instance is put into a wait state -// due to a lifecycle hook. -// -// (Optional) Create a notification target and an IAM role. The target can be -// either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon -// EC2 Auto Scaling to publish lifecycle notifications to the target. -// -// Create the lifecycle hook. Specify whether the hook is used when the instances -// launch or terminate. -// -// If you need more time, record the lifecycle action heartbeat to keep the -// instance in a wait state using the RecordLifecycleActionHeartbeat API call. -// -// If you finish before the timeout period ends, send a callback by using the -// CompleteLifecycleAction API call. -// -// For more information, see Amazon EC2 Auto Scaling lifecycle hooks (https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// If you exceed your maximum limit of lifecycle hooks, which by default is -// 50 per Auto Scaling group, the call fails. -// -// You can view the lifecycle hooks for an Auto Scaling group using the DescribeLifecycleHooks -// API call. If you are no longer using a lifecycle hook, you can delete it -// by calling the DeleteLifecycleHook API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation PutLifecycleHook for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutLifecycleHook -func (c *AutoScaling) PutLifecycleHook(input *PutLifecycleHookInput) (*PutLifecycleHookOutput, error) { - req, out := c.PutLifecycleHookRequest(input) - return out, req.Send() -} - -// PutLifecycleHookWithContext is the same as PutLifecycleHook with the addition of -// the ability to pass a context and additional request options. -// -// See PutLifecycleHook for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) PutLifecycleHookWithContext(ctx aws.Context, input *PutLifecycleHookInput, opts ...request.Option) (*PutLifecycleHookOutput, error) { - req, out := c.PutLifecycleHookRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutNotificationConfiguration = "PutNotificationConfiguration" - -// PutNotificationConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutNotificationConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutNotificationConfiguration for more information on using the PutNotificationConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the PutNotificationConfigurationRequest method. -// req, resp := client.PutNotificationConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutNotificationConfiguration -func (c *AutoScaling) PutNotificationConfigurationRequest(input *PutNotificationConfigurationInput) (req *request.Request, output *PutNotificationConfigurationOutput) { - op := &request.Operation{ - Name: opPutNotificationConfiguration, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &PutNotificationConfigurationInput{} - } - - output = &PutNotificationConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutNotificationConfiguration API operation for Auto Scaling. -// -// Configures an Auto Scaling group to send notifications when specified events -// take place. Subscribers to the specified topic can have messages delivered -// to an endpoint such as a web server or an email address. -// -// This configuration overwrites any existing configuration. -// -// For more information, see Getting Amazon SNS notifications when your Auto -// Scaling group scales (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// If you exceed your maximum limit of SNS topics, which is 10 per Auto Scaling -// group, the call fails. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation PutNotificationConfiguration for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutNotificationConfiguration -func (c *AutoScaling) PutNotificationConfiguration(input *PutNotificationConfigurationInput) (*PutNotificationConfigurationOutput, error) { - req, out := c.PutNotificationConfigurationRequest(input) - return out, req.Send() -} - -// PutNotificationConfigurationWithContext is the same as PutNotificationConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutNotificationConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) PutNotificationConfigurationWithContext(ctx aws.Context, input *PutNotificationConfigurationInput, opts ...request.Option) (*PutNotificationConfigurationOutput, error) { - req, out := c.PutNotificationConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutScalingPolicy = "PutScalingPolicy" - -// PutScalingPolicyRequest generates a "aws/request.Request" representing the -// client's request for the PutScalingPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutScalingPolicy for more information on using the PutScalingPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the PutScalingPolicyRequest method. -// req, resp := client.PutScalingPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScalingPolicy -func (c *AutoScaling) PutScalingPolicyRequest(input *PutScalingPolicyInput) (req *request.Request, output *PutScalingPolicyOutput) { - op := &request.Operation{ - Name: opPutScalingPolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &PutScalingPolicyInput{} - } - - output = &PutScalingPolicyOutput{} - req = c.newRequest(op, input, output) - return -} - -// PutScalingPolicy API operation for Auto Scaling. -// -// Creates or updates a scaling policy for an Auto Scaling group. Scaling policies -// are used to scale an Auto Scaling group based on configurable metrics. If -// no policies are defined, the dynamic scaling and predictive scaling features -// are not used. -// -// For more information about using dynamic scaling, see Target tracking scaling -// policies (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html) -// and Step and simple scaling policies (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// For more information about using predictive scaling, see Predictive scaling -// for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-predictive-scaling.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// You can view the scaling policies for an Auto Scaling group using the DescribePolicies -// API call. If you are no longer using a scaling policy, you can delete it -// by calling the DeletePolicy API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation PutScalingPolicy for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScalingPolicy -func (c *AutoScaling) PutScalingPolicy(input *PutScalingPolicyInput) (*PutScalingPolicyOutput, error) { - req, out := c.PutScalingPolicyRequest(input) - return out, req.Send() -} - -// PutScalingPolicyWithContext is the same as PutScalingPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See PutScalingPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) PutScalingPolicyWithContext(ctx aws.Context, input *PutScalingPolicyInput, opts ...request.Option) (*PutScalingPolicyOutput, error) { - req, out := c.PutScalingPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutScheduledUpdateGroupAction = "PutScheduledUpdateGroupAction" - -// PutScheduledUpdateGroupActionRequest generates a "aws/request.Request" representing the -// client's request for the PutScheduledUpdateGroupAction operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutScheduledUpdateGroupAction for more information on using the PutScheduledUpdateGroupAction -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the PutScheduledUpdateGroupActionRequest method. -// req, resp := client.PutScheduledUpdateGroupActionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScheduledUpdateGroupAction -func (c *AutoScaling) PutScheduledUpdateGroupActionRequest(input *PutScheduledUpdateGroupActionInput) (req *request.Request, output *PutScheduledUpdateGroupActionOutput) { - op := &request.Operation{ - Name: opPutScheduledUpdateGroupAction, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &PutScheduledUpdateGroupActionInput{} - } - - output = &PutScheduledUpdateGroupActionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutScheduledUpdateGroupAction API operation for Auto Scaling. -// -// Creates or updates a scheduled scaling action for an Auto Scaling group. -// -// For more information, see Scheduled scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/schedule_time.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// You can view the scheduled actions for an Auto Scaling group using the DescribeScheduledActions -// API call. If you are no longer using a scheduled action, you can delete it -// by calling the DeleteScheduledAction API. -// -// If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns -// an error message. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation PutScheduledUpdateGroupAction for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAlreadyExistsFault "AlreadyExists" -// You already have an Auto Scaling group or launch configuration with this -// name. -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScheduledUpdateGroupAction -func (c *AutoScaling) PutScheduledUpdateGroupAction(input *PutScheduledUpdateGroupActionInput) (*PutScheduledUpdateGroupActionOutput, error) { - req, out := c.PutScheduledUpdateGroupActionRequest(input) - return out, req.Send() -} - -// PutScheduledUpdateGroupActionWithContext is the same as PutScheduledUpdateGroupAction with the addition of -// the ability to pass a context and additional request options. -// -// See PutScheduledUpdateGroupAction for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) PutScheduledUpdateGroupActionWithContext(ctx aws.Context, input *PutScheduledUpdateGroupActionInput, opts ...request.Option) (*PutScheduledUpdateGroupActionOutput, error) { - req, out := c.PutScheduledUpdateGroupActionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutWarmPool = "PutWarmPool" - -// PutWarmPoolRequest generates a "aws/request.Request" representing the -// client's request for the PutWarmPool operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutWarmPool for more information on using the PutWarmPool -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the PutWarmPoolRequest method. -// req, resp := client.PutWarmPoolRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutWarmPool -func (c *AutoScaling) PutWarmPoolRequest(input *PutWarmPoolInput) (req *request.Request, output *PutWarmPoolOutput) { - op := &request.Operation{ - Name: opPutWarmPool, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &PutWarmPoolInput{} - } - - output = &PutWarmPoolOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutWarmPool API operation for Auto Scaling. -// -// Creates or updates a warm pool for the specified Auto Scaling group. A warm -// pool is a pool of pre-initialized EC2 instances that sits alongside the Auto -// Scaling group. Whenever your application needs to scale out, the Auto Scaling -// group can draw on the warm pool to meet its new desired capacity. For more -// information and example configurations, see Warm pools for Amazon EC2 Auto -// Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// This operation must be called from the Region in which the Auto Scaling group -// was created. This operation cannot be called on an Auto Scaling group that -// has a mixed instances policy or a launch template or launch configuration -// that requests Spot Instances. -// -// You can view the instances in the warm pool using the DescribeWarmPool API -// call. If you are no longer using a warm pool, you can delete it by calling -// the DeleteWarmPool API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation PutWarmPool for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutWarmPool -func (c *AutoScaling) PutWarmPool(input *PutWarmPoolInput) (*PutWarmPoolOutput, error) { - req, out := c.PutWarmPoolRequest(input) - return out, req.Send() -} - -// PutWarmPoolWithContext is the same as PutWarmPool with the addition of -// the ability to pass a context and additional request options. -// -// See PutWarmPool for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) PutWarmPoolWithContext(ctx aws.Context, input *PutWarmPoolInput, opts ...request.Option) (*PutWarmPoolOutput, error) { - req, out := c.PutWarmPoolRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRecordLifecycleActionHeartbeat = "RecordLifecycleActionHeartbeat" - -// RecordLifecycleActionHeartbeatRequest generates a "aws/request.Request" representing the -// client's request for the RecordLifecycleActionHeartbeat operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RecordLifecycleActionHeartbeat for more information on using the RecordLifecycleActionHeartbeat -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RecordLifecycleActionHeartbeatRequest method. -// req, resp := client.RecordLifecycleActionHeartbeatRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/RecordLifecycleActionHeartbeat -func (c *AutoScaling) RecordLifecycleActionHeartbeatRequest(input *RecordLifecycleActionHeartbeatInput) (req *request.Request, output *RecordLifecycleActionHeartbeatOutput) { - op := &request.Operation{ - Name: opRecordLifecycleActionHeartbeat, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RecordLifecycleActionHeartbeatInput{} - } - - output = &RecordLifecycleActionHeartbeatOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// RecordLifecycleActionHeartbeat API operation for Auto Scaling. -// -// Records a heartbeat for the lifecycle action associated with the specified -// token or instance. This extends the timeout by the length of time defined -// using the PutLifecycleHook API call. -// -// This step is a part of the procedure for adding a lifecycle hook to an Auto -// Scaling group: -// -// (Optional) Create a launch template or launch configuration with a user data -// script that runs while an instance is in a wait state due to a lifecycle -// hook. -// -// (Optional) Create a Lambda function and a rule that allows Amazon EventBridge -// to invoke your Lambda function when an instance is put into a wait state -// due to a lifecycle hook. -// -// (Optional) Create a notification target and an IAM role. The target can be -// either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon -// EC2 Auto Scaling to publish lifecycle notifications to the target. -// -// Create the lifecycle hook. Specify whether the hook is used when the instances -// launch or terminate. -// -// If you need more time, record the lifecycle action heartbeat to keep the -// instance in a wait state. -// -// If you finish before the timeout period ends, send a callback by using the -// CompleteLifecycleAction API call. -// -// For more information, see Amazon EC2 Auto Scaling lifecycle hooks (https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation RecordLifecycleActionHeartbeat for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/RecordLifecycleActionHeartbeat -func (c *AutoScaling) RecordLifecycleActionHeartbeat(input *RecordLifecycleActionHeartbeatInput) (*RecordLifecycleActionHeartbeatOutput, error) { - req, out := c.RecordLifecycleActionHeartbeatRequest(input) - return out, req.Send() -} - -// RecordLifecycleActionHeartbeatWithContext is the same as RecordLifecycleActionHeartbeat with the addition of -// the ability to pass a context and additional request options. -// -// See RecordLifecycleActionHeartbeat for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) RecordLifecycleActionHeartbeatWithContext(ctx aws.Context, input *RecordLifecycleActionHeartbeatInput, opts ...request.Option) (*RecordLifecycleActionHeartbeatOutput, error) { - req, out := c.RecordLifecycleActionHeartbeatRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opResumeProcesses = "ResumeProcesses" - -// ResumeProcessesRequest generates a "aws/request.Request" representing the -// client's request for the ResumeProcesses operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ResumeProcesses for more information on using the ResumeProcesses -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ResumeProcessesRequest method. -// req, resp := client.ResumeProcessesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ResumeProcesses -func (c *AutoScaling) ResumeProcessesRequest(input *ScalingProcessQuery) (req *request.Request, output *ResumeProcessesOutput) { - op := &request.Operation{ - Name: opResumeProcesses, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ScalingProcessQuery{} - } - - output = &ResumeProcessesOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// ResumeProcesses API operation for Auto Scaling. -// -// Resumes the specified suspended auto scaling processes, or all suspended -// process, for the specified Auto Scaling group. -// -// For more information, see Suspending and resuming scaling processes (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation ResumeProcesses for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceInUseFault "ResourceInUse" -// The operation can't be performed because the resource is in use. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ResumeProcesses -func (c *AutoScaling) ResumeProcesses(input *ScalingProcessQuery) (*ResumeProcessesOutput, error) { - req, out := c.ResumeProcessesRequest(input) - return out, req.Send() -} - -// ResumeProcessesWithContext is the same as ResumeProcesses with the addition of -// the ability to pass a context and additional request options. -// -// See ResumeProcesses for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) ResumeProcessesWithContext(ctx aws.Context, input *ScalingProcessQuery, opts ...request.Option) (*ResumeProcessesOutput, error) { - req, out := c.ResumeProcessesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetDesiredCapacity = "SetDesiredCapacity" - -// SetDesiredCapacityRequest generates a "aws/request.Request" representing the -// client's request for the SetDesiredCapacity operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetDesiredCapacity for more information on using the SetDesiredCapacity -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetDesiredCapacityRequest method. -// req, resp := client.SetDesiredCapacityRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetDesiredCapacity -func (c *AutoScaling) SetDesiredCapacityRequest(input *SetDesiredCapacityInput) (req *request.Request, output *SetDesiredCapacityOutput) { - op := &request.Operation{ - Name: opSetDesiredCapacity, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetDesiredCapacityInput{} - } - - output = &SetDesiredCapacityOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// SetDesiredCapacity API operation for Auto Scaling. -// -// Sets the size of the specified Auto Scaling group. -// -// If a scale-in activity occurs as a result of a new DesiredCapacity value -// that is lower than the current size of the group, the Auto Scaling group -// uses its termination policy to determine which instances to terminate. -// -// For more information, see Manual scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-manual-scaling.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation SetDesiredCapacity for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeScalingActivityInProgressFault "ScalingActivityInProgress" -// The operation can't be performed because there are scaling activities in -// progress. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetDesiredCapacity -func (c *AutoScaling) SetDesiredCapacity(input *SetDesiredCapacityInput) (*SetDesiredCapacityOutput, error) { - req, out := c.SetDesiredCapacityRequest(input) - return out, req.Send() -} - -// SetDesiredCapacityWithContext is the same as SetDesiredCapacity with the addition of -// the ability to pass a context and additional request options. -// -// See SetDesiredCapacity for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) SetDesiredCapacityWithContext(ctx aws.Context, input *SetDesiredCapacityInput, opts ...request.Option) (*SetDesiredCapacityOutput, error) { - req, out := c.SetDesiredCapacityRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetInstanceHealth = "SetInstanceHealth" - -// SetInstanceHealthRequest generates a "aws/request.Request" representing the -// client's request for the SetInstanceHealth operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetInstanceHealth for more information on using the SetInstanceHealth -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetInstanceHealthRequest method. -// req, resp := client.SetInstanceHealthRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceHealth -func (c *AutoScaling) SetInstanceHealthRequest(input *SetInstanceHealthInput) (req *request.Request, output *SetInstanceHealthOutput) { - op := &request.Operation{ - Name: opSetInstanceHealth, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetInstanceHealthInput{} - } - - output = &SetInstanceHealthOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// SetInstanceHealth API operation for Auto Scaling. -// -// Sets the health status of the specified instance. -// -// For more information, see Health checks for Auto Scaling instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation SetInstanceHealth for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceHealth -func (c *AutoScaling) SetInstanceHealth(input *SetInstanceHealthInput) (*SetInstanceHealthOutput, error) { - req, out := c.SetInstanceHealthRequest(input) - return out, req.Send() -} - -// SetInstanceHealthWithContext is the same as SetInstanceHealth with the addition of -// the ability to pass a context and additional request options. -// -// See SetInstanceHealth for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) SetInstanceHealthWithContext(ctx aws.Context, input *SetInstanceHealthInput, opts ...request.Option) (*SetInstanceHealthOutput, error) { - req, out := c.SetInstanceHealthRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetInstanceProtection = "SetInstanceProtection" - -// SetInstanceProtectionRequest generates a "aws/request.Request" representing the -// client's request for the SetInstanceProtection operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetInstanceProtection for more information on using the SetInstanceProtection -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetInstanceProtectionRequest method. -// req, resp := client.SetInstanceProtectionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceProtection -func (c *AutoScaling) SetInstanceProtectionRequest(input *SetInstanceProtectionInput) (req *request.Request, output *SetInstanceProtectionOutput) { - op := &request.Operation{ - Name: opSetInstanceProtection, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetInstanceProtectionInput{} - } - - output = &SetInstanceProtectionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// SetInstanceProtection API operation for Auto Scaling. -// -// Updates the instance protection settings of the specified instances. This -// operation cannot be called on instances in a warm pool. -// -// For more information about preventing instances that are part of an Auto -// Scaling group from terminating on scale in, see Using instance scale-in protection -// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-protection.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// If you exceed your maximum limit of instance IDs, which is 50 per Auto Scaling -// group, the call fails. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation SetInstanceProtection for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceProtection -func (c *AutoScaling) SetInstanceProtection(input *SetInstanceProtectionInput) (*SetInstanceProtectionOutput, error) { - req, out := c.SetInstanceProtectionRequest(input) - return out, req.Send() -} - -// SetInstanceProtectionWithContext is the same as SetInstanceProtection with the addition of -// the ability to pass a context and additional request options. -// -// See SetInstanceProtection for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) SetInstanceProtectionWithContext(ctx aws.Context, input *SetInstanceProtectionInput, opts ...request.Option) (*SetInstanceProtectionOutput, error) { - req, out := c.SetInstanceProtectionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opStartInstanceRefresh = "StartInstanceRefresh" - -// StartInstanceRefreshRequest generates a "aws/request.Request" representing the -// client's request for the StartInstanceRefresh operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See StartInstanceRefresh for more information on using the StartInstanceRefresh -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the StartInstanceRefreshRequest method. -// req, resp := client.StartInstanceRefreshRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/StartInstanceRefresh -func (c *AutoScaling) StartInstanceRefreshRequest(input *StartInstanceRefreshInput) (req *request.Request, output *StartInstanceRefreshOutput) { - op := &request.Operation{ - Name: opStartInstanceRefresh, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &StartInstanceRefreshInput{} - } - - output = &StartInstanceRefreshOutput{} - req = c.newRequest(op, input, output) - return -} - -// StartInstanceRefresh API operation for Auto Scaling. -// -// Starts a new instance refresh operation. An instance refresh performs a rolling -// replacement of all or some instances in an Auto Scaling group. Each instance -// is terminated first and then replaced, which temporarily reduces the capacity -// available within your Auto Scaling group. -// -// This operation is part of the instance refresh feature (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html) -// in Amazon EC2 Auto Scaling, which helps you update instances in your Auto -// Scaling group. This feature is helpful, for example, when you have a new -// AMI or a new user data script. You just need to create a new launch template -// that specifies the new AMI or user data script. Then start an instance refresh -// to immediately begin the process of updating instances in the group. -// -// If the call succeeds, it creates a new instance refresh request with a unique -// ID that you can use to track its progress. To query its status, call the -// DescribeInstanceRefreshes API. To describe the instance refreshes that have -// already run, call the DescribeInstanceRefreshes API. To cancel an instance -// refresh operation in progress, use the CancelInstanceRefresh API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation StartInstanceRefresh for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLimitExceededFault "LimitExceeded" -// You have already reached a limit for your Amazon EC2 Auto Scaling resources -// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). -// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) -// in the Amazon EC2 Auto Scaling API Reference. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeInstanceRefreshInProgressFault "InstanceRefreshInProgress" -// The request failed because an active instance refresh operation already exists -// for the specified Auto Scaling group. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/StartInstanceRefresh -func (c *AutoScaling) StartInstanceRefresh(input *StartInstanceRefreshInput) (*StartInstanceRefreshOutput, error) { - req, out := c.StartInstanceRefreshRequest(input) - return out, req.Send() -} - -// StartInstanceRefreshWithContext is the same as StartInstanceRefresh with the addition of -// the ability to pass a context and additional request options. -// -// See StartInstanceRefresh for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) StartInstanceRefreshWithContext(ctx aws.Context, input *StartInstanceRefreshInput, opts ...request.Option) (*StartInstanceRefreshOutput, error) { - req, out := c.StartInstanceRefreshRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSuspendProcesses = "SuspendProcesses" - -// SuspendProcessesRequest generates a "aws/request.Request" representing the -// client's request for the SuspendProcesses operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SuspendProcesses for more information on using the SuspendProcesses -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SuspendProcessesRequest method. -// req, resp := client.SuspendProcessesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SuspendProcesses -func (c *AutoScaling) SuspendProcessesRequest(input *ScalingProcessQuery) (req *request.Request, output *SuspendProcessesOutput) { - op := &request.Operation{ - Name: opSuspendProcesses, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ScalingProcessQuery{} - } - - output = &SuspendProcessesOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// SuspendProcesses API operation for Auto Scaling. -// -// Suspends the specified auto scaling processes, or all processes, for the -// specified Auto Scaling group. -// -// If you suspend either the Launch or Terminate process types, it can prevent -// other process types from functioning properly. For more information, see -// Suspending and resuming scaling processes (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html) -// in the Amazon EC2 Auto Scaling User Guide. -// -// To resume processes that have been suspended, call the ResumeProcesses API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation SuspendProcesses for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeResourceInUseFault "ResourceInUse" -// The operation can't be performed because the resource is in use. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SuspendProcesses -func (c *AutoScaling) SuspendProcesses(input *ScalingProcessQuery) (*SuspendProcessesOutput, error) { - req, out := c.SuspendProcessesRequest(input) - return out, req.Send() -} - -// SuspendProcessesWithContext is the same as SuspendProcesses with the addition of -// the ability to pass a context and additional request options. -// -// See SuspendProcesses for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) SuspendProcessesWithContext(ctx aws.Context, input *ScalingProcessQuery, opts ...request.Option) (*SuspendProcessesOutput, error) { - req, out := c.SuspendProcessesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opTerminateInstanceInAutoScalingGroup = "TerminateInstanceInAutoScalingGroup" - -// TerminateInstanceInAutoScalingGroupRequest generates a "aws/request.Request" representing the -// client's request for the TerminateInstanceInAutoScalingGroup operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See TerminateInstanceInAutoScalingGroup for more information on using the TerminateInstanceInAutoScalingGroup -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the TerminateInstanceInAutoScalingGroupRequest method. -// req, resp := client.TerminateInstanceInAutoScalingGroupRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TerminateInstanceInAutoScalingGroup -func (c *AutoScaling) TerminateInstanceInAutoScalingGroupRequest(input *TerminateInstanceInAutoScalingGroupInput) (req *request.Request, output *TerminateInstanceInAutoScalingGroupOutput) { - op := &request.Operation{ - Name: opTerminateInstanceInAutoScalingGroup, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &TerminateInstanceInAutoScalingGroupInput{} - } - - output = &TerminateInstanceInAutoScalingGroupOutput{} - req = c.newRequest(op, input, output) - return -} - -// TerminateInstanceInAutoScalingGroup API operation for Auto Scaling. -// -// Terminates the specified instance and optionally adjusts the desired group -// size. This operation cannot be called on instances in a warm pool. -// -// This call simply makes a termination request. The instance is not terminated -// immediately. When an instance is terminated, the instance status changes -// to terminated. You can't connect to or start an instance after you've terminated -// it. -// -// If you do not specify the option to decrement the desired capacity, Amazon -// EC2 Auto Scaling launches instances to replace the ones that are terminated. -// -// By default, Amazon EC2 Auto Scaling balances instances across all Availability -// Zones. If you decrement the desired capacity, your Auto Scaling group can -// become unbalanced between Availability Zones. Amazon EC2 Auto Scaling tries -// to rebalance the group, and rebalancing might terminate instances in other -// zones. For more information, see Rebalancing activities (https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-benefits.html#AutoScalingBehavior.InstanceUsage) -// in the Amazon EC2 Auto Scaling User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation TerminateInstanceInAutoScalingGroup for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeScalingActivityInProgressFault "ScalingActivityInProgress" -// The operation can't be performed because there are scaling activities in -// progress. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TerminateInstanceInAutoScalingGroup -func (c *AutoScaling) TerminateInstanceInAutoScalingGroup(input *TerminateInstanceInAutoScalingGroupInput) (*TerminateInstanceInAutoScalingGroupOutput, error) { - req, out := c.TerminateInstanceInAutoScalingGroupRequest(input) - return out, req.Send() -} - -// TerminateInstanceInAutoScalingGroupWithContext is the same as TerminateInstanceInAutoScalingGroup with the addition of -// the ability to pass a context and additional request options. -// -// See TerminateInstanceInAutoScalingGroup for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) TerminateInstanceInAutoScalingGroupWithContext(ctx aws.Context, input *TerminateInstanceInAutoScalingGroupInput, opts ...request.Option) (*TerminateInstanceInAutoScalingGroupOutput, error) { - req, out := c.TerminateInstanceInAutoScalingGroupRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdateAutoScalingGroup = "UpdateAutoScalingGroup" - -// UpdateAutoScalingGroupRequest generates a "aws/request.Request" representing the -// client's request for the UpdateAutoScalingGroup operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdateAutoScalingGroup for more information on using the UpdateAutoScalingGroup -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the UpdateAutoScalingGroupRequest method. -// req, resp := client.UpdateAutoScalingGroupRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/UpdateAutoScalingGroup -func (c *AutoScaling) UpdateAutoScalingGroupRequest(input *UpdateAutoScalingGroupInput) (req *request.Request, output *UpdateAutoScalingGroupOutput) { - op := &request.Operation{ - Name: opUpdateAutoScalingGroup, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &UpdateAutoScalingGroupInput{} - } - - output = &UpdateAutoScalingGroupOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// UpdateAutoScalingGroup API operation for Auto Scaling. -// -// We strongly recommend that all Auto Scaling groups use launch templates to -// ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2. -// -// Updates the configuration for the specified Auto Scaling group. -// -// To update an Auto Scaling group, specify the name of the group and the property -// that you want to change. Any properties that you don't specify are not changed -// by this update request. The new settings take effect on any scaling activities -// after this call returns. -// -// If you associate a new launch configuration or template with an Auto Scaling -// group, all new instances will get the updated configuration. Existing instances -// continue to run with the configuration that they were originally launched -// with. When you update a group to specify a mixed instances policy instead -// of a launch configuration or template, existing instances may be replaced -// to match the new purchasing options that you specified in the policy. For -// example, if the group currently has 100% On-Demand capacity and the policy -// specifies 50% Spot capacity, this means that half of your instances will -// be gradually terminated and relaunched as Spot Instances. When replacing -// instances, Amazon EC2 Auto Scaling launches new instances before terminating -// the old ones, so that updating your group does not compromise the performance -// or availability of your application. -// -// Note the following about changing DesiredCapacity, MaxSize, or MinSize: -// -// - If a scale-in activity occurs as a result of a new DesiredCapacity value -// that is lower than the current size of the group, the Auto Scaling group -// uses its termination policy to determine which instances to terminate. -// -// - If you specify a new value for MinSize without specifying a value for -// DesiredCapacity, and the new MinSize is larger than the current size of -// the group, this sets the group's DesiredCapacity to the new MinSize value. -// -// - If you specify a new value for MaxSize without specifying a value for -// DesiredCapacity, and the new MaxSize is smaller than the current size -// of the group, this sets the group's DesiredCapacity to the new MaxSize -// value. -// -// To see which properties have been set, call the DescribeAutoScalingGroups -// API. To view the scaling policies for an Auto Scaling group, call the DescribePolicies -// API. If the group has scaling policies, you can update them by calling the -// PutScalingPolicy API. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Auto Scaling's -// API operation UpdateAutoScalingGroup for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeScalingActivityInProgressFault "ScalingActivityInProgress" -// The operation can't be performed because there are scaling activities in -// progress. -// -// - ErrCodeResourceContentionFault "ResourceContention" -// You already have a pending update to an Amazon EC2 Auto Scaling resource -// (for example, an Auto Scaling group, instance, or load balancer). -// -// - ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" -// The service-linked role is not yet ready for use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/UpdateAutoScalingGroup -func (c *AutoScaling) UpdateAutoScalingGroup(input *UpdateAutoScalingGroupInput) (*UpdateAutoScalingGroupOutput, error) { - req, out := c.UpdateAutoScalingGroupRequest(input) - return out, req.Send() -} - -// UpdateAutoScalingGroupWithContext is the same as UpdateAutoScalingGroup with the addition of -// the ability to pass a context and additional request options. -// -// See UpdateAutoScalingGroup for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) UpdateAutoScalingGroupWithContext(ctx aws.Context, input *UpdateAutoScalingGroupInput, opts ...request.Option) (*UpdateAutoScalingGroupOutput, error) { - req, out := c.UpdateAutoScalingGroupRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// Specifies the minimum and maximum for the AcceleratorCount object when you -// specify InstanceRequirements for an Auto Scaling group. -type AcceleratorCountRequest struct { - _ struct{} `type:"structure"` - - // The maximum value. - Max *int64 `type:"integer"` - - // The minimum value. - Min *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AcceleratorCountRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AcceleratorCountRequest) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *AcceleratorCountRequest) SetMax(v int64) *AcceleratorCountRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *AcceleratorCountRequest) SetMin(v int64) *AcceleratorCountRequest { - s.Min = &v - return s -} - -// Specifies the minimum and maximum for the AcceleratorTotalMemoryMiB object -// when you specify InstanceRequirements for an Auto Scaling group. -type AcceleratorTotalMemoryMiBRequest struct { - _ struct{} `type:"structure"` - - // The memory maximum in MiB. - Max *int64 `type:"integer"` - - // The memory minimum in MiB. - Min *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AcceleratorTotalMemoryMiBRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AcceleratorTotalMemoryMiBRequest) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *AcceleratorTotalMemoryMiBRequest) SetMax(v int64) *AcceleratorTotalMemoryMiBRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *AcceleratorTotalMemoryMiBRequest) SetMin(v int64) *AcceleratorTotalMemoryMiBRequest { - s.Min = &v - return s -} - -// Describes scaling activity, which is a long-running process that represents -// a change to your Auto Scaling group, such as changing its size or replacing -// an instance. -type Activity struct { - _ struct{} `type:"structure"` - - // The ID of the activity. - // - // ActivityId is a required field - ActivityId *string `type:"string" required:"true"` - - // The Amazon Resource Name (ARN) of the Auto Scaling group. - AutoScalingGroupARN *string `min:"1" type:"string"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The state of the Auto Scaling group, which is either InService or Deleted. - AutoScalingGroupState *string `min:"1" type:"string"` - - // The reason the activity began. - // - // Cause is a required field - Cause *string `min:"1" type:"string" required:"true"` - - // A friendly, more verbose description of the activity. - Description *string `type:"string"` - - // The details about the activity. - Details *string `type:"string"` - - // The end time of the activity. - EndTime *time.Time `type:"timestamp"` - - // A value between 0 and 100 that indicates the progress of the activity. - Progress *int64 `type:"integer"` - - // The start time of the activity. - // - // StartTime is a required field - StartTime *time.Time `type:"timestamp" required:"true"` - - // The current status of the activity. - // - // StatusCode is a required field - StatusCode *string `type:"string" required:"true" enum:"ScalingActivityStatusCode"` - - // A friendly, more verbose description of the activity status. - StatusMessage *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Activity) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Activity) GoString() string { - return s.String() -} - -// SetActivityId sets the ActivityId field's value. -func (s *Activity) SetActivityId(v string) *Activity { - s.ActivityId = &v - return s -} - -// SetAutoScalingGroupARN sets the AutoScalingGroupARN field's value. -func (s *Activity) SetAutoScalingGroupARN(v string) *Activity { - s.AutoScalingGroupARN = &v - return s -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *Activity) SetAutoScalingGroupName(v string) *Activity { - s.AutoScalingGroupName = &v - return s -} - -// SetAutoScalingGroupState sets the AutoScalingGroupState field's value. -func (s *Activity) SetAutoScalingGroupState(v string) *Activity { - s.AutoScalingGroupState = &v - return s -} - -// SetCause sets the Cause field's value. -func (s *Activity) SetCause(v string) *Activity { - s.Cause = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *Activity) SetDescription(v string) *Activity { - s.Description = &v - return s -} - -// SetDetails sets the Details field's value. -func (s *Activity) SetDetails(v string) *Activity { - s.Details = &v - return s -} - -// SetEndTime sets the EndTime field's value. -func (s *Activity) SetEndTime(v time.Time) *Activity { - s.EndTime = &v - return s -} - -// SetProgress sets the Progress field's value. -func (s *Activity) SetProgress(v int64) *Activity { - s.Progress = &v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *Activity) SetStartTime(v time.Time) *Activity { - s.StartTime = &v - return s -} - -// SetStatusCode sets the StatusCode field's value. -func (s *Activity) SetStatusCode(v string) *Activity { - s.StatusCode = &v - return s -} - -// SetStatusMessage sets the StatusMessage field's value. -func (s *Activity) SetStatusMessage(v string) *Activity { - s.StatusMessage = &v - return s -} - -// Describes a policy adjustment type. -type AdjustmentType struct { - _ struct{} `type:"structure"` - - // The policy adjustment type. The valid values are ChangeInCapacity, ExactCapacity, - // and PercentChangeInCapacity. - AdjustmentType *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AdjustmentType) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AdjustmentType) GoString() string { - return s.String() -} - -// SetAdjustmentType sets the AdjustmentType field's value. -func (s *AdjustmentType) SetAdjustmentType(v string) *AdjustmentType { - s.AdjustmentType = &v - return s -} - -// Describes an alarm. -type Alarm struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the alarm. - AlarmARN *string `min:"1" type:"string"` - - // The name of the alarm. - AlarmName *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Alarm) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Alarm) GoString() string { - return s.String() -} - -// SetAlarmARN sets the AlarmARN field's value. -func (s *Alarm) SetAlarmARN(v string) *Alarm { - s.AlarmARN = &v - return s -} - -// SetAlarmName sets the AlarmName field's value. -func (s *Alarm) SetAlarmName(v string) *Alarm { - s.AlarmName = &v - return s -} - -type AttachInstancesInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The IDs of the instances. You can specify up to 20 instances. - InstanceIds []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachInstancesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachInstancesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AttachInstancesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AttachInstancesInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *AttachInstancesInput) SetAutoScalingGroupName(v string) *AttachInstancesInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceIds sets the InstanceIds field's value. -func (s *AttachInstancesInput) SetInstanceIds(v []*string) *AttachInstancesInput { - s.InstanceIds = v - return s -} - -type AttachInstancesOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachInstancesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachInstancesOutput) GoString() string { - return s.String() -} - -type AttachLoadBalancerTargetGroupsInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The Amazon Resource Names (ARN) of the target groups. You can specify up - // to 10 target groups. To get the ARN of a target group, use the Elastic Load - // Balancing DescribeTargetGroups (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) - // API operation. - // - // TargetGroupARNs is a required field - TargetGroupARNs []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerTargetGroupsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerTargetGroupsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AttachLoadBalancerTargetGroupsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AttachLoadBalancerTargetGroupsInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.TargetGroupARNs == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupARNs")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *AttachLoadBalancerTargetGroupsInput) SetAutoScalingGroupName(v string) *AttachLoadBalancerTargetGroupsInput { - s.AutoScalingGroupName = &v - return s -} - -// SetTargetGroupARNs sets the TargetGroupARNs field's value. -func (s *AttachLoadBalancerTargetGroupsInput) SetTargetGroupARNs(v []*string) *AttachLoadBalancerTargetGroupsInput { - s.TargetGroupARNs = v - return s -} - -type AttachLoadBalancerTargetGroupsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerTargetGroupsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerTargetGroupsOutput) GoString() string { - return s.String() -} - -type AttachLoadBalancersInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The names of the load balancers. You can specify up to 10 load balancers. - // - // LoadBalancerNames is a required field - LoadBalancerNames []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AttachLoadBalancersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AttachLoadBalancersInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.LoadBalancerNames == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerNames")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *AttachLoadBalancersInput) SetAutoScalingGroupName(v string) *AttachLoadBalancersInput { - s.AutoScalingGroupName = &v - return s -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *AttachLoadBalancersInput) SetLoadBalancerNames(v []*string) *AttachLoadBalancersInput { - s.LoadBalancerNames = v - return s -} - -type AttachLoadBalancersOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancersOutput) GoString() string { - return s.String() -} - -// Specifies the minimum and maximum for the BaselineEbsBandwidthMbps object -// when you specify InstanceRequirements for an Auto Scaling group. -type BaselineEbsBandwidthMbpsRequest struct { - _ struct{} `type:"structure"` - - // The maximum value in Mbps. - Max *int64 `type:"integer"` - - // The minimum value in Mbps. - Min *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BaselineEbsBandwidthMbpsRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BaselineEbsBandwidthMbpsRequest) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *BaselineEbsBandwidthMbpsRequest) SetMax(v int64) *BaselineEbsBandwidthMbpsRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *BaselineEbsBandwidthMbpsRequest) SetMin(v int64) *BaselineEbsBandwidthMbpsRequest { - s.Min = &v - return s -} - -type BatchDeleteScheduledActionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The names of the scheduled actions to delete. The maximum number allowed - // is 50. - // - // ScheduledActionNames is a required field - ScheduledActionNames []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchDeleteScheduledActionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchDeleteScheduledActionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *BatchDeleteScheduledActionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BatchDeleteScheduledActionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.ScheduledActionNames == nil { - invalidParams.Add(request.NewErrParamRequired("ScheduledActionNames")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *BatchDeleteScheduledActionInput) SetAutoScalingGroupName(v string) *BatchDeleteScheduledActionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetScheduledActionNames sets the ScheduledActionNames field's value. -func (s *BatchDeleteScheduledActionInput) SetScheduledActionNames(v []*string) *BatchDeleteScheduledActionInput { - s.ScheduledActionNames = v - return s -} - -type BatchDeleteScheduledActionOutput struct { - _ struct{} `type:"structure"` - - // The names of the scheduled actions that could not be deleted, including an - // error message. - FailedScheduledActions []*FailedScheduledUpdateGroupActionRequest `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchDeleteScheduledActionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchDeleteScheduledActionOutput) GoString() string { - return s.String() -} - -// SetFailedScheduledActions sets the FailedScheduledActions field's value. -func (s *BatchDeleteScheduledActionOutput) SetFailedScheduledActions(v []*FailedScheduledUpdateGroupActionRequest) *BatchDeleteScheduledActionOutput { - s.FailedScheduledActions = v - return s -} - -type BatchPutScheduledUpdateGroupActionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // One or more scheduled actions. The maximum number allowed is 50. - // - // ScheduledUpdateGroupActions is a required field - ScheduledUpdateGroupActions []*ScheduledUpdateGroupActionRequest `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchPutScheduledUpdateGroupActionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchPutScheduledUpdateGroupActionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *BatchPutScheduledUpdateGroupActionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BatchPutScheduledUpdateGroupActionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.ScheduledUpdateGroupActions == nil { - invalidParams.Add(request.NewErrParamRequired("ScheduledUpdateGroupActions")) - } - if s.ScheduledUpdateGroupActions != nil { - for i, v := range s.ScheduledUpdateGroupActions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ScheduledUpdateGroupActions", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *BatchPutScheduledUpdateGroupActionInput) SetAutoScalingGroupName(v string) *BatchPutScheduledUpdateGroupActionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetScheduledUpdateGroupActions sets the ScheduledUpdateGroupActions field's value. -func (s *BatchPutScheduledUpdateGroupActionInput) SetScheduledUpdateGroupActions(v []*ScheduledUpdateGroupActionRequest) *BatchPutScheduledUpdateGroupActionInput { - s.ScheduledUpdateGroupActions = v - return s -} - -type BatchPutScheduledUpdateGroupActionOutput struct { - _ struct{} `type:"structure"` - - // The names of the scheduled actions that could not be created or updated, - // including an error message. - FailedScheduledUpdateGroupActions []*FailedScheduledUpdateGroupActionRequest `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchPutScheduledUpdateGroupActionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BatchPutScheduledUpdateGroupActionOutput) GoString() string { - return s.String() -} - -// SetFailedScheduledUpdateGroupActions sets the FailedScheduledUpdateGroupActions field's value. -func (s *BatchPutScheduledUpdateGroupActionOutput) SetFailedScheduledUpdateGroupActions(v []*FailedScheduledUpdateGroupActionRequest) *BatchPutScheduledUpdateGroupActionOutput { - s.FailedScheduledUpdateGroupActions = v - return s -} - -// Describes a block device mapping. -type BlockDeviceMapping struct { - _ struct{} `type:"structure"` - - // The device name assigned to the volume (for example, /dev/sdh or xvdh). For - // more information, see Device naming on Linux instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // To define a block device mapping, set the device name and exactly one of - // the following properties: Ebs, NoDevice, or VirtualName. - // - // DeviceName is a required field - DeviceName *string `min:"1" type:"string" required:"true"` - - // Information to attach an EBS volume to an instance at launch. - Ebs *Ebs `type:"structure"` - - // Setting this value to true prevents a volume that is included in the block - // device mapping of the AMI from being mapped to the specified device name - // at launch. - // - // If NoDevice is true for the root device, instances might fail the EC2 health - // check. In that case, Amazon EC2 Auto Scaling launches replacement instances. - NoDevice *bool `type:"boolean"` - - // The name of the instance store volume (virtual device) to attach to an instance - // at launch. The name must be in the form ephemeralX where X is a number starting - // from zero (0), for example, ephemeral0. - VirtualName *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BlockDeviceMapping) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BlockDeviceMapping) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *BlockDeviceMapping) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BlockDeviceMapping"} - if s.DeviceName == nil { - invalidParams.Add(request.NewErrParamRequired("DeviceName")) - } - if s.DeviceName != nil && len(*s.DeviceName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("DeviceName", 1)) - } - if s.VirtualName != nil && len(*s.VirtualName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("VirtualName", 1)) - } - if s.Ebs != nil { - if err := s.Ebs.Validate(); err != nil { - invalidParams.AddNested("Ebs", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDeviceName sets the DeviceName field's value. -func (s *BlockDeviceMapping) SetDeviceName(v string) *BlockDeviceMapping { - s.DeviceName = &v - return s -} - -// SetEbs sets the Ebs field's value. -func (s *BlockDeviceMapping) SetEbs(v *Ebs) *BlockDeviceMapping { - s.Ebs = v - return s -} - -// SetNoDevice sets the NoDevice field's value. -func (s *BlockDeviceMapping) SetNoDevice(v bool) *BlockDeviceMapping { - s.NoDevice = &v - return s -} - -// SetVirtualName sets the VirtualName field's value. -func (s *BlockDeviceMapping) SetVirtualName(v string) *BlockDeviceMapping { - s.VirtualName = &v - return s -} - -type CancelInstanceRefreshInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelInstanceRefreshInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelInstanceRefreshInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CancelInstanceRefreshInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CancelInstanceRefreshInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *CancelInstanceRefreshInput) SetAutoScalingGroupName(v string) *CancelInstanceRefreshInput { - s.AutoScalingGroupName = &v - return s -} - -type CancelInstanceRefreshOutput struct { - _ struct{} `type:"structure"` - - // The instance refresh ID. - InstanceRefreshId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelInstanceRefreshOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelInstanceRefreshOutput) GoString() string { - return s.String() -} - -// SetInstanceRefreshId sets the InstanceRefreshId field's value. -func (s *CancelInstanceRefreshOutput) SetInstanceRefreshId(v string) *CancelInstanceRefreshOutput { - s.InstanceRefreshId = &v - return s -} - -// A GetPredictiveScalingForecast call returns the capacity forecast for a predictive -// scaling policy. This structure includes the data points for that capacity -// forecast, along with the timestamps of those data points. -type CapacityForecast struct { - _ struct{} `type:"structure"` - - // The timestamps for the data points, in UTC format. - // - // Timestamps is a required field - Timestamps []*time.Time `type:"list" required:"true"` - - // The values of the data points. - // - // Values is a required field - Values []*float64 `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CapacityForecast) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CapacityForecast) GoString() string { - return s.String() -} - -// SetTimestamps sets the Timestamps field's value. -func (s *CapacityForecast) SetTimestamps(v []*time.Time) *CapacityForecast { - s.Timestamps = v - return s -} - -// SetValues sets the Values field's value. -func (s *CapacityForecast) SetValues(v []*float64) *CapacityForecast { - s.Values = v - return s -} - -type CompleteLifecycleActionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The ID of the instance. - InstanceId *string `min:"1" type:"string"` - - // The action for the group to take. You can specify either CONTINUE or ABANDON. - // - // LifecycleActionResult is a required field - LifecycleActionResult *string `type:"string" required:"true"` - - // A universally unique identifier (UUID) that identifies a specific lifecycle - // action associated with an instance. Amazon EC2 Auto Scaling sends this token - // to the notification target you specified when you created the lifecycle hook. - LifecycleActionToken *string `min:"36" type:"string"` - - // The name of the lifecycle hook. - // - // LifecycleHookName is a required field - LifecycleHookName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CompleteLifecycleActionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CompleteLifecycleActionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CompleteLifecycleActionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CompleteLifecycleActionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.InstanceId != nil && len(*s.InstanceId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceId", 1)) - } - if s.LifecycleActionResult == nil { - invalidParams.Add(request.NewErrParamRequired("LifecycleActionResult")) - } - if s.LifecycleActionToken != nil && len(*s.LifecycleActionToken) < 36 { - invalidParams.Add(request.NewErrParamMinLen("LifecycleActionToken", 36)) - } - if s.LifecycleHookName == nil { - invalidParams.Add(request.NewErrParamRequired("LifecycleHookName")) - } - if s.LifecycleHookName != nil && len(*s.LifecycleHookName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LifecycleHookName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *CompleteLifecycleActionInput) SetAutoScalingGroupName(v string) *CompleteLifecycleActionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *CompleteLifecycleActionInput) SetInstanceId(v string) *CompleteLifecycleActionInput { - s.InstanceId = &v - return s -} - -// SetLifecycleActionResult sets the LifecycleActionResult field's value. -func (s *CompleteLifecycleActionInput) SetLifecycleActionResult(v string) *CompleteLifecycleActionInput { - s.LifecycleActionResult = &v - return s -} - -// SetLifecycleActionToken sets the LifecycleActionToken field's value. -func (s *CompleteLifecycleActionInput) SetLifecycleActionToken(v string) *CompleteLifecycleActionInput { - s.LifecycleActionToken = &v - return s -} - -// SetLifecycleHookName sets the LifecycleHookName field's value. -func (s *CompleteLifecycleActionInput) SetLifecycleHookName(v string) *CompleteLifecycleActionInput { - s.LifecycleHookName = &v - return s -} - -type CompleteLifecycleActionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CompleteLifecycleActionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CompleteLifecycleActionOutput) GoString() string { - return s.String() -} - -type CreateAutoScalingGroupInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. This name must be unique per Region per - // account. - // - // The name can contain any ASCII character 33 to 126 including most punctuation - // characters, digits, and upper and lowercased letters. - // - // You cannot use a colon (:) in the name. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // A list of Availability Zones where instances in the Auto Scaling group can - // be created. Used for launching into the default VPC subnet in each Availability - // Zone when not using the VPCZoneIdentifier property, or for attaching a network - // interface when an existing network interface ID is specified in a launch - // template. - AvailabilityZones []*string `type:"list"` - - // Indicates whether Capacity Rebalancing is enabled. Otherwise, Capacity Rebalancing - // is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling - // attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot - // Instance is at an elevated risk of interruption. After launching a new instance, - // it then terminates an old instance. For more information, see Use Capacity - // Rebalancing to handle Amazon EC2 Spot Interruptions (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) - // in the in the Amazon EC2 Auto Scaling User Guide. - CapacityRebalance *bool `type:"boolean"` - - // Reserved. - Context *string `type:"string"` - - // Only needed if you use simple scaling policies. - // - // The amount of time, in seconds, between one scaling activity ending and another - // one starting due to simple scaling policies. For more information, see Scaling - // cooldowns for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Default: 300 seconds - DefaultCooldown *int64 `type:"integer"` - - // The amount of time, in seconds, until a newly launched instance can contribute - // to the Amazon CloudWatch metrics. This delay lets an instance finish initializing - // before Amazon EC2 Auto Scaling aggregates instance metrics, resulting in - // more reliable usage data. Set this value equal to the amount of time that - // it takes for resource consumption to become stable after an instance reaches - // the InService state. For more information, see Set the default instance warmup - // for an Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // To manage your warm-up settings at the group level, we recommend that you - // set the default instance warmup, even if its value is set to 0 seconds. This - // also optimizes the performance of scaling policies that scale continuously, - // such as target tracking and step scaling policies. - // - // If you need to remove a value that you previously set, include the property - // but specify -1 for the value. However, we strongly recommend keeping the - // default instance warmup enabled by specifying a minimum value of 0. - // - // Default: None - DefaultInstanceWarmup *int64 `type:"integer"` - - // The desired capacity is the initial capacity of the Auto Scaling group at - // the time of its creation and the capacity it attempts to maintain. It can - // scale beyond this capacity if you configure auto scaling. This number must - // be greater than or equal to the minimum size of the group and less than or - // equal to the maximum size of the group. If you do not specify a desired capacity, - // the default is the minimum size of the group. - DesiredCapacity *int64 `type:"integer"` - - // The unit of measurement for the value specified for desired capacity. Amazon - // EC2 Auto Scaling supports DesiredCapacityType for attribute-based instance - // type selection only. For more information, see Creating an Auto Scaling group - // using attribute-based instance type selection (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-instance-type-requirements.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // By default, Amazon EC2 Auto Scaling specifies units, which translates into - // number of instances. - // - // Valid values: units | vcpu | memory-mib - DesiredCapacityType *string `min:"1" type:"string"` - - // The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before - // checking the health status of an EC2 instance that has come into service - // and marking it unhealthy due to a failed Elastic Load Balancing or custom - // health check. This is useful if your instances do not immediately pass these - // health checks after they enter the InService state. For more information, - // see Set the health check grace period for an Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/health-check-grace-period.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Default: 0 seconds - HealthCheckGracePeriod *int64 `type:"integer"` - - // The service to use for the health checks. The valid values are EC2 (default) - // and ELB. If you configure an Auto Scaling group to use load balancer (ELB) - // health checks, it considers the instance unhealthy if it fails either the - // EC2 status checks or the load balancer health checks. For more information, - // see Health checks for Auto Scaling instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html) - // in the Amazon EC2 Auto Scaling User Guide. - HealthCheckType *string `min:"1" type:"string"` - - // The ID of the instance used to base the launch configuration on. If specified, - // Amazon EC2 Auto Scaling uses the configuration values from the specified - // instance to create a new launch configuration. To get the instance ID, use - // the Amazon EC2 DescribeInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html) - // API operation. For more information, see Creating an Auto Scaling group using - // an EC2 instance (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-from-instance.html) - // in the Amazon EC2 Auto Scaling User Guide. - InstanceId *string `min:"1" type:"string"` - - // The name of the launch configuration to use to launch instances. - // - // Conditional: You must specify either a launch template (LaunchTemplate or - // MixedInstancesPolicy) or a launch configuration (LaunchConfigurationName - // or InstanceId). - LaunchConfigurationName *string `min:"1" type:"string"` - - // Information used to specify the launch template and version to use to launch - // instances. - // - // Conditional: You must specify either a launch template (LaunchTemplate or - // MixedInstancesPolicy) or a launch configuration (LaunchConfigurationName - // or InstanceId). - // - // The launch template that is specified must be configured for use with an - // Auto Scaling group. For more information, see Creating a launch template - // for an Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html) - // in the Amazon EC2 Auto Scaling User Guide. - LaunchTemplate *LaunchTemplateSpecification `type:"structure"` - - // One or more lifecycle hooks to add to the Auto Scaling group before instances - // are launched. - LifecycleHookSpecificationList []*LifecycleHookSpecification `type:"list"` - - // A list of Classic Load Balancers associated with this Auto Scaling group. - // For Application Load Balancers, Network Load Balancers, and Gateway Load - // Balancer, specify the TargetGroupARNs property instead. - LoadBalancerNames []*string `type:"list"` - - // The maximum amount of time, in seconds, that an instance can be in service. - // The default is null. If specified, the value must be either 0 or a number - // equal to or greater than 86,400 seconds (1 day). For more information, see - // Replacing Auto Scaling instances based on maximum instance lifetime (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html) - // in the Amazon EC2 Auto Scaling User Guide. - MaxInstanceLifetime *int64 `type:"integer"` - - // The maximum size of the group. - // - // With a mixed instances policy that uses instance weighting, Amazon EC2 Auto - // Scaling may need to go above MaxSize to meet your capacity requirements. - // In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more - // than your largest instance weight (weights that define how many units each - // instance contributes to the desired capacity of the group). - // - // MaxSize is a required field - MaxSize *int64 `type:"integer" required:"true"` - - // The minimum size of the group. - // - // MinSize is a required field - MinSize *int64 `type:"integer" required:"true"` - - // The mixed instances policy. For more information, see Auto Scaling groups - // with multiple instance types and purchase options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) - // in the Amazon EC2 Auto Scaling User Guide. - MixedInstancesPolicy *MixedInstancesPolicy `type:"structure"` - - // Indicates whether newly launched instances are protected from termination - // by Amazon EC2 Auto Scaling when scaling in. For more information about preventing - // instances from terminating on scale in, see Using instance scale-in protection - // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-protection.html) - // in the Amazon EC2 Auto Scaling User Guide. - NewInstancesProtectedFromScaleIn *bool `type:"boolean"` - - // The name of the placement group into which to launch your instances. For - // more information, see Placement groups (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // A cluster placement group is a logical grouping of instances within a single - // Availability Zone. You cannot specify multiple Availability Zones and a cluster - // placement group. - PlacementGroup *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling - // group uses to call other Amazon Web Services service on your behalf. By default, - // Amazon EC2 Auto Scaling uses a service-linked role named AWSServiceRoleForAutoScaling, - // which it creates if it does not exist. For more information, see Service-linked - // roles (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html) - // in the Amazon EC2 Auto Scaling User Guide. - ServiceLinkedRoleARN *string `min:"1" type:"string"` - - // One or more tags. You can tag your Auto Scaling group and propagate the tags - // to the Amazon EC2 instances it launches. Tags are not propagated to Amazon - // EBS volumes. To add tags to Amazon EBS volumes, specify the tags in a launch - // template but use caution. If the launch template specifies an instance tag - // with a key that is also specified for the Auto Scaling group, Amazon EC2 - // Auto Scaling overrides the value of that instance tag with the value specified - // by the Auto Scaling group. For more information, see Tag Auto Scaling groups - // and instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html) - // in the Amazon EC2 Auto Scaling User Guide. - Tags []*Tag `type:"list"` - - // The Amazon Resource Names (ARN) of the target groups to associate with the - // Auto Scaling group. Instances are registered as targets with the target groups. - // The target groups receive incoming traffic and route requests to one or more - // registered targets. For more information, see Use Elastic Load Balancing - // to distribute traffic across the instances in your Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) - // in the Amazon EC2 Auto Scaling User Guide. - TargetGroupARNs []*string `type:"list"` - - // A policy or a list of policies that are used to select the instance to terminate. - // These policies are executed in the order that you list them. For more information, - // see Work with Amazon EC2 Auto Scaling termination policies (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-termination-policies.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Valid values: Default | AllocationStrategy | ClosestToNextInstanceHour | - // NewestInstance | OldestInstance | OldestLaunchConfiguration | OldestLaunchTemplate - // | arn:aws:lambda:region:account-id:function:my-function:my-alias - TerminationPolicies []*string `type:"list"` - - // A comma-separated list of subnet IDs for a virtual private cloud (VPC) where - // instances in the Auto Scaling group can be created. If you specify VPCZoneIdentifier - // with AvailabilityZones, the subnets that you specify must reside in those - // Availability Zones. - VPCZoneIdentifier *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAutoScalingGroupInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAutoScalingGroupInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateAutoScalingGroupInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateAutoScalingGroupInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.DesiredCapacityType != nil && len(*s.DesiredCapacityType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("DesiredCapacityType", 1)) - } - if s.HealthCheckType != nil && len(*s.HealthCheckType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("HealthCheckType", 1)) - } - if s.InstanceId != nil && len(*s.InstanceId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceId", 1)) - } - if s.LaunchConfigurationName != nil && len(*s.LaunchConfigurationName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LaunchConfigurationName", 1)) - } - if s.MaxSize == nil { - invalidParams.Add(request.NewErrParamRequired("MaxSize")) - } - if s.MinSize == nil { - invalidParams.Add(request.NewErrParamRequired("MinSize")) - } - if s.PlacementGroup != nil && len(*s.PlacementGroup) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PlacementGroup", 1)) - } - if s.ServiceLinkedRoleARN != nil && len(*s.ServiceLinkedRoleARN) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ServiceLinkedRoleARN", 1)) - } - if s.VPCZoneIdentifier != nil && len(*s.VPCZoneIdentifier) < 1 { - invalidParams.Add(request.NewErrParamMinLen("VPCZoneIdentifier", 1)) - } - if s.LaunchTemplate != nil { - if err := s.LaunchTemplate.Validate(); err != nil { - invalidParams.AddNested("LaunchTemplate", err.(request.ErrInvalidParams)) - } - } - if s.LifecycleHookSpecificationList != nil { - for i, v := range s.LifecycleHookSpecificationList { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LifecycleHookSpecificationList", i), err.(request.ErrInvalidParams)) - } - } - } - if s.MixedInstancesPolicy != nil { - if err := s.MixedInstancesPolicy.Validate(); err != nil { - invalidParams.AddNested("MixedInstancesPolicy", err.(request.ErrInvalidParams)) - } - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *CreateAutoScalingGroupInput) SetAutoScalingGroupName(v string) *CreateAutoScalingGroupInput { - s.AutoScalingGroupName = &v - return s -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *CreateAutoScalingGroupInput) SetAvailabilityZones(v []*string) *CreateAutoScalingGroupInput { - s.AvailabilityZones = v - return s -} - -// SetCapacityRebalance sets the CapacityRebalance field's value. -func (s *CreateAutoScalingGroupInput) SetCapacityRebalance(v bool) *CreateAutoScalingGroupInput { - s.CapacityRebalance = &v - return s -} - -// SetContext sets the Context field's value. -func (s *CreateAutoScalingGroupInput) SetContext(v string) *CreateAutoScalingGroupInput { - s.Context = &v - return s -} - -// SetDefaultCooldown sets the DefaultCooldown field's value. -func (s *CreateAutoScalingGroupInput) SetDefaultCooldown(v int64) *CreateAutoScalingGroupInput { - s.DefaultCooldown = &v - return s -} - -// SetDefaultInstanceWarmup sets the DefaultInstanceWarmup field's value. -func (s *CreateAutoScalingGroupInput) SetDefaultInstanceWarmup(v int64) *CreateAutoScalingGroupInput { - s.DefaultInstanceWarmup = &v - return s -} - -// SetDesiredCapacity sets the DesiredCapacity field's value. -func (s *CreateAutoScalingGroupInput) SetDesiredCapacity(v int64) *CreateAutoScalingGroupInput { - s.DesiredCapacity = &v - return s -} - -// SetDesiredCapacityType sets the DesiredCapacityType field's value. -func (s *CreateAutoScalingGroupInput) SetDesiredCapacityType(v string) *CreateAutoScalingGroupInput { - s.DesiredCapacityType = &v - return s -} - -// SetHealthCheckGracePeriod sets the HealthCheckGracePeriod field's value. -func (s *CreateAutoScalingGroupInput) SetHealthCheckGracePeriod(v int64) *CreateAutoScalingGroupInput { - s.HealthCheckGracePeriod = &v - return s -} - -// SetHealthCheckType sets the HealthCheckType field's value. -func (s *CreateAutoScalingGroupInput) SetHealthCheckType(v string) *CreateAutoScalingGroupInput { - s.HealthCheckType = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *CreateAutoScalingGroupInput) SetInstanceId(v string) *CreateAutoScalingGroupInput { - s.InstanceId = &v - return s -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *CreateAutoScalingGroupInput) SetLaunchConfigurationName(v string) *CreateAutoScalingGroupInput { - s.LaunchConfigurationName = &v - return s -} - -// SetLaunchTemplate sets the LaunchTemplate field's value. -func (s *CreateAutoScalingGroupInput) SetLaunchTemplate(v *LaunchTemplateSpecification) *CreateAutoScalingGroupInput { - s.LaunchTemplate = v - return s -} - -// SetLifecycleHookSpecificationList sets the LifecycleHookSpecificationList field's value. -func (s *CreateAutoScalingGroupInput) SetLifecycleHookSpecificationList(v []*LifecycleHookSpecification) *CreateAutoScalingGroupInput { - s.LifecycleHookSpecificationList = v - return s -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *CreateAutoScalingGroupInput) SetLoadBalancerNames(v []*string) *CreateAutoScalingGroupInput { - s.LoadBalancerNames = v - return s -} - -// SetMaxInstanceLifetime sets the MaxInstanceLifetime field's value. -func (s *CreateAutoScalingGroupInput) SetMaxInstanceLifetime(v int64) *CreateAutoScalingGroupInput { - s.MaxInstanceLifetime = &v - return s -} - -// SetMaxSize sets the MaxSize field's value. -func (s *CreateAutoScalingGroupInput) SetMaxSize(v int64) *CreateAutoScalingGroupInput { - s.MaxSize = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *CreateAutoScalingGroupInput) SetMinSize(v int64) *CreateAutoScalingGroupInput { - s.MinSize = &v - return s -} - -// SetMixedInstancesPolicy sets the MixedInstancesPolicy field's value. -func (s *CreateAutoScalingGroupInput) SetMixedInstancesPolicy(v *MixedInstancesPolicy) *CreateAutoScalingGroupInput { - s.MixedInstancesPolicy = v - return s -} - -// SetNewInstancesProtectedFromScaleIn sets the NewInstancesProtectedFromScaleIn field's value. -func (s *CreateAutoScalingGroupInput) SetNewInstancesProtectedFromScaleIn(v bool) *CreateAutoScalingGroupInput { - s.NewInstancesProtectedFromScaleIn = &v - return s -} - -// SetPlacementGroup sets the PlacementGroup field's value. -func (s *CreateAutoScalingGroupInput) SetPlacementGroup(v string) *CreateAutoScalingGroupInput { - s.PlacementGroup = &v - return s -} - -// SetServiceLinkedRoleARN sets the ServiceLinkedRoleARN field's value. -func (s *CreateAutoScalingGroupInput) SetServiceLinkedRoleARN(v string) *CreateAutoScalingGroupInput { - s.ServiceLinkedRoleARN = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *CreateAutoScalingGroupInput) SetTags(v []*Tag) *CreateAutoScalingGroupInput { - s.Tags = v - return s -} - -// SetTargetGroupARNs sets the TargetGroupARNs field's value. -func (s *CreateAutoScalingGroupInput) SetTargetGroupARNs(v []*string) *CreateAutoScalingGroupInput { - s.TargetGroupARNs = v - return s -} - -// SetTerminationPolicies sets the TerminationPolicies field's value. -func (s *CreateAutoScalingGroupInput) SetTerminationPolicies(v []*string) *CreateAutoScalingGroupInput { - s.TerminationPolicies = v - return s -} - -// SetVPCZoneIdentifier sets the VPCZoneIdentifier field's value. -func (s *CreateAutoScalingGroupInput) SetVPCZoneIdentifier(v string) *CreateAutoScalingGroupInput { - s.VPCZoneIdentifier = &v - return s -} - -type CreateAutoScalingGroupOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAutoScalingGroupOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAutoScalingGroupOutput) GoString() string { - return s.String() -} - -type CreateLaunchConfigurationInput struct { - _ struct{} `type:"structure"` - - // Specifies whether to assign a public IPv4 address to the group's instances. - // If the instance is launched into a default subnet, the default is to assign - // a public IPv4 address, unless you disabled the option to assign a public - // IPv4 address on the subnet. If the instance is launched into a nondefault - // subnet, the default is not to assign a public IPv4 address, unless you enabled - // the option to assign a public IPv4 address on the subnet. - // - // If you specify true, each instance in the Auto Scaling group receives a unique - // public IPv4 address. For more information, see Launching Auto Scaling instances - // in a VPC (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // If you specify this property, you must specify at least one subnet for VPCZoneIdentifier - // when you create your group. - AssociatePublicIpAddress *bool `type:"boolean"` - - // The block device mapping entries that define the block devices to attach - // to the instances at launch. By default, the block devices specified in the - // block device mapping for the AMI are used. For more information, see Block - // device mappings (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) - // in the Amazon EC2 User Guide for Linux Instances. - BlockDeviceMappings []*BlockDeviceMapping `type:"list"` - - // Available for backward compatibility. - ClassicLinkVPCId *string `min:"1" type:"string"` - - // Available for backward compatibility. - ClassicLinkVPCSecurityGroups []*string `type:"list"` - - // Specifies whether the launch configuration is optimized for EBS I/O (true) - // or not (false). The optimization provides dedicated throughput to Amazon - // EBS and an optimized configuration stack to provide optimal I/O performance. - // This optimization is not available with all instance types. Additional fees - // are incurred when you enable EBS optimization for an instance type that is - // not EBS-optimized by default. For more information, see Amazon EBS-optimized - // instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // The default value is false. - EbsOptimized *bool `type:"boolean"` - - // The name or the Amazon Resource Name (ARN) of the instance profile associated - // with the IAM role for the instance. The instance profile contains the IAM - // role. For more information, see IAM role for applications that run on Amazon - // EC2 instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html) - // in the Amazon EC2 Auto Scaling User Guide. - IamInstanceProfile *string `min:"1" type:"string"` - - // The ID of the Amazon Machine Image (AMI) that was assigned during registration. - // For more information, see Finding a Linux AMI (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // If you specify InstanceId, an ImageId is not required. - ImageId *string `min:"1" type:"string"` - - // The ID of the instance to use to create the launch configuration. The new - // launch configuration derives attributes from the instance, except for the - // block device mapping. - // - // To create a launch configuration with a block device mapping or override - // any other instance attributes, specify them as part of the same request. - // - // For more information, see Creating a launch configuration using an EC2 instance - // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-lc-with-instanceID.html) - // in the Amazon EC2 Auto Scaling User Guide. - InstanceId *string `min:"1" type:"string"` - - // Controls whether instances in this group are launched with detailed (true) - // or basic (false) monitoring. - // - // The default value is true (enabled). - // - // When detailed monitoring is enabled, Amazon CloudWatch generates metrics - // every minute and your account is charged a fee. When you disable detailed - // monitoring, CloudWatch generates metrics every 5 minutes. For more information, - // see Configure Monitoring for Auto Scaling Instances (https://docs.aws.amazon.com/autoscaling/latest/userguide/enable-as-instance-metrics.html) - // in the Amazon EC2 Auto Scaling User Guide. - InstanceMonitoring *InstanceMonitoring `type:"structure"` - - // Specifies the instance type of the EC2 instance. For information about available - // instance types, see Available instance types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) - // in the Amazon EC2 User Guide for Linux Instances. - // - // If you specify InstanceId, an InstanceType is not required. - InstanceType *string `min:"1" type:"string"` - - // The ID of the kernel associated with the AMI. - // - // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more - // information, see User provided kernels (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) - // in the Amazon EC2 User Guide for Linux Instances. - KernelId *string `min:"1" type:"string"` - - // The name of the key pair. For more information, see Amazon EC2 key pairs - // and Linux instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) - // in the Amazon EC2 User Guide for Linux Instances. - KeyName *string `min:"1" type:"string"` - - // The name of the launch configuration. This name must be unique per Region - // per account. - // - // LaunchConfigurationName is a required field - LaunchConfigurationName *string `min:"1" type:"string" required:"true"` - - // The metadata options for the instances. For more information, see Configuring - // the Instance Metadata Options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) - // in the Amazon EC2 Auto Scaling User Guide. - MetadataOptions *InstanceMetadataOptions `type:"structure"` - - // The tenancy of the instance, either default or dedicated. An instance with - // dedicated tenancy runs on isolated, single-tenant hardware and can only be - // launched into a VPC. To launch dedicated instances into a shared tenancy - // VPC (a VPC with the instance placement tenancy attribute set to default), - // you must set the value of this property to dedicated. For more information, - // see Configuring instance tenancy with Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-dedicated-instances.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // If you specify PlacementTenancy, you must specify at least one subnet for - // VPCZoneIdentifier when you create your group. - // - // Valid values: default | dedicated - PlacementTenancy *string `min:"1" type:"string"` - - // The ID of the RAM disk to select. - // - // We recommend that you use PV-GRUB instead of kernels and RAM disks. For more - // information, see User provided kernels (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) - // in the Amazon EC2 User Guide for Linux Instances. - RamdiskId *string `min:"1" type:"string"` - - // A list that contains the security group IDs to assign to the instances in - // the Auto Scaling group. For more information, see Control traffic to resources - // using security groups (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) - // in the Amazon Virtual Private Cloud User Guide. - SecurityGroups []*string `type:"list"` - - // The maximum hourly price to be paid for any Spot Instance launched to fulfill - // the request. Spot Instances are launched when the price you specify exceeds - // the current Spot price. For more information, see Request Spot Instances - // for fault-tolerant and flexible applications (https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-template-spot-instances.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Valid Range: Minimum value of 0.001 - // - // When you change your maximum price by creating a new launch configuration, - // running instances will continue to run as long as the maximum price for those - // running instances is higher than the current Spot price. - SpotPrice *string `min:"1" type:"string"` - - // The user data to make available to the launched EC2 instances. For more information, - // see Instance metadata and user data (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) - // (Linux) and Instance metadata and user data (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html) - // (Windows). If you are using a 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. User data is limited to 16 KB. - UserData *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLaunchConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLaunchConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateLaunchConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateLaunchConfigurationInput"} - if s.ClassicLinkVPCId != nil && len(*s.ClassicLinkVPCId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ClassicLinkVPCId", 1)) - } - if s.IamInstanceProfile != nil && len(*s.IamInstanceProfile) < 1 { - invalidParams.Add(request.NewErrParamMinLen("IamInstanceProfile", 1)) - } - if s.ImageId != nil && len(*s.ImageId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ImageId", 1)) - } - if s.InstanceId != nil && len(*s.InstanceId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceId", 1)) - } - if s.InstanceType != nil && len(*s.InstanceType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceType", 1)) - } - if s.KernelId != nil && len(*s.KernelId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KernelId", 1)) - } - if s.KeyName != nil && len(*s.KeyName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyName", 1)) - } - if s.LaunchConfigurationName == nil { - invalidParams.Add(request.NewErrParamRequired("LaunchConfigurationName")) - } - if s.LaunchConfigurationName != nil && len(*s.LaunchConfigurationName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LaunchConfigurationName", 1)) - } - if s.PlacementTenancy != nil && len(*s.PlacementTenancy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PlacementTenancy", 1)) - } - if s.RamdiskId != nil && len(*s.RamdiskId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RamdiskId", 1)) - } - if s.SpotPrice != nil && len(*s.SpotPrice) < 1 { - invalidParams.Add(request.NewErrParamMinLen("SpotPrice", 1)) - } - if s.BlockDeviceMappings != nil { - for i, v := range s.BlockDeviceMappings { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "BlockDeviceMappings", i), err.(request.ErrInvalidParams)) - } - } - } - if s.MetadataOptions != nil { - if err := s.MetadataOptions.Validate(); err != nil { - invalidParams.AddNested("MetadataOptions", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAssociatePublicIpAddress sets the AssociatePublicIpAddress field's value. -func (s *CreateLaunchConfigurationInput) SetAssociatePublicIpAddress(v bool) *CreateLaunchConfigurationInput { - s.AssociatePublicIpAddress = &v - return s -} - -// SetBlockDeviceMappings sets the BlockDeviceMappings field's value. -func (s *CreateLaunchConfigurationInput) SetBlockDeviceMappings(v []*BlockDeviceMapping) *CreateLaunchConfigurationInput { - s.BlockDeviceMappings = v - return s -} - -// SetClassicLinkVPCId sets the ClassicLinkVPCId field's value. -func (s *CreateLaunchConfigurationInput) SetClassicLinkVPCId(v string) *CreateLaunchConfigurationInput { - s.ClassicLinkVPCId = &v - return s -} - -// SetClassicLinkVPCSecurityGroups sets the ClassicLinkVPCSecurityGroups field's value. -func (s *CreateLaunchConfigurationInput) SetClassicLinkVPCSecurityGroups(v []*string) *CreateLaunchConfigurationInput { - s.ClassicLinkVPCSecurityGroups = v - return s -} - -// SetEbsOptimized sets the EbsOptimized field's value. -func (s *CreateLaunchConfigurationInput) SetEbsOptimized(v bool) *CreateLaunchConfigurationInput { - s.EbsOptimized = &v - return s -} - -// SetIamInstanceProfile sets the IamInstanceProfile field's value. -func (s *CreateLaunchConfigurationInput) SetIamInstanceProfile(v string) *CreateLaunchConfigurationInput { - s.IamInstanceProfile = &v - return s -} - -// SetImageId sets the ImageId field's value. -func (s *CreateLaunchConfigurationInput) SetImageId(v string) *CreateLaunchConfigurationInput { - s.ImageId = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *CreateLaunchConfigurationInput) SetInstanceId(v string) *CreateLaunchConfigurationInput { - s.InstanceId = &v - return s -} - -// SetInstanceMonitoring sets the InstanceMonitoring field's value. -func (s *CreateLaunchConfigurationInput) SetInstanceMonitoring(v *InstanceMonitoring) *CreateLaunchConfigurationInput { - s.InstanceMonitoring = v - return s -} - -// SetInstanceType sets the InstanceType field's value. -func (s *CreateLaunchConfigurationInput) SetInstanceType(v string) *CreateLaunchConfigurationInput { - s.InstanceType = &v - return s -} - -// SetKernelId sets the KernelId field's value. -func (s *CreateLaunchConfigurationInput) SetKernelId(v string) *CreateLaunchConfigurationInput { - s.KernelId = &v - return s -} - -// SetKeyName sets the KeyName field's value. -func (s *CreateLaunchConfigurationInput) SetKeyName(v string) *CreateLaunchConfigurationInput { - s.KeyName = &v - return s -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *CreateLaunchConfigurationInput) SetLaunchConfigurationName(v string) *CreateLaunchConfigurationInput { - s.LaunchConfigurationName = &v - return s -} - -// SetMetadataOptions sets the MetadataOptions field's value. -func (s *CreateLaunchConfigurationInput) SetMetadataOptions(v *InstanceMetadataOptions) *CreateLaunchConfigurationInput { - s.MetadataOptions = v - return s -} - -// SetPlacementTenancy sets the PlacementTenancy field's value. -func (s *CreateLaunchConfigurationInput) SetPlacementTenancy(v string) *CreateLaunchConfigurationInput { - s.PlacementTenancy = &v - return s -} - -// SetRamdiskId sets the RamdiskId field's value. -func (s *CreateLaunchConfigurationInput) SetRamdiskId(v string) *CreateLaunchConfigurationInput { - s.RamdiskId = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *CreateLaunchConfigurationInput) SetSecurityGroups(v []*string) *CreateLaunchConfigurationInput { - s.SecurityGroups = v - return s -} - -// SetSpotPrice sets the SpotPrice field's value. -func (s *CreateLaunchConfigurationInput) SetSpotPrice(v string) *CreateLaunchConfigurationInput { - s.SpotPrice = &v - return s -} - -// SetUserData sets the UserData field's value. -func (s *CreateLaunchConfigurationInput) SetUserData(v string) *CreateLaunchConfigurationInput { - s.UserData = &v - return s -} - -type CreateLaunchConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLaunchConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLaunchConfigurationOutput) GoString() string { - return s.String() -} - -type CreateOrUpdateTagsInput struct { - _ struct{} `type:"structure"` - - // One or more tags. - // - // Tags is a required field - Tags []*Tag `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateOrUpdateTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateOrUpdateTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateOrUpdateTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateOrUpdateTagsInput"} - if s.Tags == nil { - invalidParams.Add(request.NewErrParamRequired("Tags")) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTags sets the Tags field's value. -func (s *CreateOrUpdateTagsInput) SetTags(v []*Tag) *CreateOrUpdateTagsInput { - s.Tags = v - return s -} - -type CreateOrUpdateTagsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateOrUpdateTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateOrUpdateTagsOutput) GoString() string { - return s.String() -} - -// Represents a CloudWatch metric of your choosing for a target tracking scaling -// policy to use with Amazon EC2 Auto Scaling. -// -// To create your customized metric specification: -// -// - Add values for each required property from CloudWatch. You can use an -// existing metric, or a new metric that you create. To use your own metric, -// you must first publish the metric to CloudWatch. For more information, -// see Publish custom metrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) -// in the Amazon CloudWatch User Guide. -// -// - Choose a metric that changes proportionally with capacity. The value -// of the metric should increase or decrease in inverse proportion to the -// number of capacity units. That is, the value of the metric should decrease -// when capacity increases. -// -// For more information about the CloudWatch terminology below, see Amazon CloudWatch -// concepts (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html). -// -// Each individual service provides information about the metrics, namespace, -// and dimensions they use. For more information, see Amazon Web Services services -// that publish CloudWatch metrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) -// in the Amazon CloudWatch User Guide. -type CustomizedMetricSpecification struct { - _ struct{} `type:"structure"` - - // The dimensions of the metric. - // - // Conditional: If you published your metric with dimensions, you must specify - // the same dimensions in your scaling policy. - Dimensions []*MetricDimension `type:"list"` - - // The name of the metric. To get the exact metric name, namespace, and dimensions, - // inspect the Metric (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Metric.html) - // object that is returned by a call to ListMetrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html). - // - // MetricName is a required field - MetricName *string `type:"string" required:"true"` - - // The namespace of the metric. - // - // Namespace is a required field - Namespace *string `type:"string" required:"true"` - - // The statistic of the metric. - // - // Statistic is a required field - Statistic *string `type:"string" required:"true" enum:"MetricStatistic"` - - // The unit of the metric. For a complete list of the units that CloudWatch - // supports, see the MetricDatum (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html) - // data type in the Amazon CloudWatch API Reference. - Unit *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomizedMetricSpecification) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomizedMetricSpecification) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CustomizedMetricSpecification) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CustomizedMetricSpecification"} - if s.MetricName == nil { - invalidParams.Add(request.NewErrParamRequired("MetricName")) - } - if s.Namespace == nil { - invalidParams.Add(request.NewErrParamRequired("Namespace")) - } - if s.Statistic == nil { - invalidParams.Add(request.NewErrParamRequired("Statistic")) - } - if s.Dimensions != nil { - for i, v := range s.Dimensions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDimensions sets the Dimensions field's value. -func (s *CustomizedMetricSpecification) SetDimensions(v []*MetricDimension) *CustomizedMetricSpecification { - s.Dimensions = v - return s -} - -// SetMetricName sets the MetricName field's value. -func (s *CustomizedMetricSpecification) SetMetricName(v string) *CustomizedMetricSpecification { - s.MetricName = &v - return s -} - -// SetNamespace sets the Namespace field's value. -func (s *CustomizedMetricSpecification) SetNamespace(v string) *CustomizedMetricSpecification { - s.Namespace = &v - return s -} - -// SetStatistic sets the Statistic field's value. -func (s *CustomizedMetricSpecification) SetStatistic(v string) *CustomizedMetricSpecification { - s.Statistic = &v - return s -} - -// SetUnit sets the Unit field's value. -func (s *CustomizedMetricSpecification) SetUnit(v string) *CustomizedMetricSpecification { - s.Unit = &v - return s -} - -type DeleteAutoScalingGroupInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // Specifies that the group is to be deleted along with all instances associated - // with the group, without waiting for all instances to be terminated. This - // action also deletes any outstanding lifecycle actions associated with the - // group. - ForceDelete *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAutoScalingGroupInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAutoScalingGroupInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteAutoScalingGroupInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteAutoScalingGroupInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DeleteAutoScalingGroupInput) SetAutoScalingGroupName(v string) *DeleteAutoScalingGroupInput { - s.AutoScalingGroupName = &v - return s -} - -// SetForceDelete sets the ForceDelete field's value. -func (s *DeleteAutoScalingGroupInput) SetForceDelete(v bool) *DeleteAutoScalingGroupInput { - s.ForceDelete = &v - return s -} - -type DeleteAutoScalingGroupOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAutoScalingGroupOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAutoScalingGroupOutput) GoString() string { - return s.String() -} - -type DeleteLaunchConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the launch configuration. - // - // LaunchConfigurationName is a required field - LaunchConfigurationName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLaunchConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLaunchConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteLaunchConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteLaunchConfigurationInput"} - if s.LaunchConfigurationName == nil { - invalidParams.Add(request.NewErrParamRequired("LaunchConfigurationName")) - } - if s.LaunchConfigurationName != nil && len(*s.LaunchConfigurationName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LaunchConfigurationName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *DeleteLaunchConfigurationInput) SetLaunchConfigurationName(v string) *DeleteLaunchConfigurationInput { - s.LaunchConfigurationName = &v - return s -} - -type DeleteLaunchConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLaunchConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLaunchConfigurationOutput) GoString() string { - return s.String() -} - -type DeleteLifecycleHookInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The name of the lifecycle hook. - // - // LifecycleHookName is a required field - LifecycleHookName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLifecycleHookInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLifecycleHookInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteLifecycleHookInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteLifecycleHookInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.LifecycleHookName == nil { - invalidParams.Add(request.NewErrParamRequired("LifecycleHookName")) - } - if s.LifecycleHookName != nil && len(*s.LifecycleHookName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LifecycleHookName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DeleteLifecycleHookInput) SetAutoScalingGroupName(v string) *DeleteLifecycleHookInput { - s.AutoScalingGroupName = &v - return s -} - -// SetLifecycleHookName sets the LifecycleHookName field's value. -func (s *DeleteLifecycleHookInput) SetLifecycleHookName(v string) *DeleteLifecycleHookInput { - s.LifecycleHookName = &v - return s -} - -type DeleteLifecycleHookOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLifecycleHookOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLifecycleHookOutput) GoString() string { - return s.String() -} - -type DeleteNotificationConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The Amazon Resource Name (ARN) of the Amazon SNS topic. - // - // TopicARN is a required field - TopicARN *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteNotificationConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteNotificationConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteNotificationConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteNotificationConfigurationInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.TopicARN == nil { - invalidParams.Add(request.NewErrParamRequired("TopicARN")) - } - if s.TopicARN != nil && len(*s.TopicARN) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TopicARN", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DeleteNotificationConfigurationInput) SetAutoScalingGroupName(v string) *DeleteNotificationConfigurationInput { - s.AutoScalingGroupName = &v - return s -} - -// SetTopicARN sets the TopicARN field's value. -func (s *DeleteNotificationConfigurationInput) SetTopicARN(v string) *DeleteNotificationConfigurationInput { - s.TopicARN = &v - return s -} - -type DeleteNotificationConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteNotificationConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteNotificationConfigurationOutput) GoString() string { - return s.String() -} - -type DeletePolicyInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // The name or Amazon Resource Name (ARN) of the policy. - // - // PolicyName is a required field - PolicyName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeletePolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeletePolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeletePolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeletePolicyInput"} - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - if s.PolicyName != nil && len(*s.PolicyName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DeletePolicyInput) SetAutoScalingGroupName(v string) *DeletePolicyInput { - s.AutoScalingGroupName = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *DeletePolicyInput) SetPolicyName(v string) *DeletePolicyInput { - s.PolicyName = &v - return s -} - -type DeletePolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeletePolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeletePolicyOutput) GoString() string { - return s.String() -} - -type DeleteScheduledActionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The name of the action to delete. - // - // ScheduledActionName is a required field - ScheduledActionName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteScheduledActionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteScheduledActionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteScheduledActionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteScheduledActionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.ScheduledActionName == nil { - invalidParams.Add(request.NewErrParamRequired("ScheduledActionName")) - } - if s.ScheduledActionName != nil && len(*s.ScheduledActionName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ScheduledActionName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DeleteScheduledActionInput) SetAutoScalingGroupName(v string) *DeleteScheduledActionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetScheduledActionName sets the ScheduledActionName field's value. -func (s *DeleteScheduledActionInput) SetScheduledActionName(v string) *DeleteScheduledActionInput { - s.ScheduledActionName = &v - return s -} - -type DeleteScheduledActionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteScheduledActionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteScheduledActionOutput) GoString() string { - return s.String() -} - -type DeleteTagsInput struct { - _ struct{} `type:"structure"` - - // One or more tags. - // - // Tags is a required field - Tags []*Tag `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -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.Tags == nil { - invalidParams.Add(request.NewErrParamRequired("Tags")) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTags sets the Tags field's value. -func (s *DeleteTagsInput) SetTags(v []*Tag) *DeleteTagsInput { - s.Tags = v - return s -} - -type DeleteTagsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteTagsOutput) GoString() string { - return s.String() -} - -type DeleteWarmPoolInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // Specifies that the warm pool is to be deleted along with all of its associated - // instances, without waiting for all instances to be terminated. This parameter - // also deletes any outstanding lifecycle actions associated with the warm pool - // instances. - ForceDelete *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteWarmPoolInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteWarmPoolInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteWarmPoolInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteWarmPoolInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DeleteWarmPoolInput) SetAutoScalingGroupName(v string) *DeleteWarmPoolInput { - s.AutoScalingGroupName = &v - return s -} - -// SetForceDelete sets the ForceDelete field's value. -func (s *DeleteWarmPoolInput) SetForceDelete(v bool) *DeleteWarmPoolInput { - s.ForceDelete = &v - return s -} - -type DeleteWarmPoolOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteWarmPoolOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteWarmPoolOutput) GoString() string { - return s.String() -} - -type DescribeAccountLimitsInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsInput) GoString() string { - return s.String() -} - -type DescribeAccountLimitsOutput struct { - _ struct{} `type:"structure"` - - // The maximum number of groups allowed for your account. The default is 200 - // groups per Region. - MaxNumberOfAutoScalingGroups *int64 `type:"integer"` - - // The maximum number of launch configurations allowed for your account. The - // default is 200 launch configurations per Region. - MaxNumberOfLaunchConfigurations *int64 `type:"integer"` - - // The current number of groups for your account. - NumberOfAutoScalingGroups *int64 `type:"integer"` - - // The current number of launch configurations for your account. - NumberOfLaunchConfigurations *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsOutput) GoString() string { - return s.String() -} - -// SetMaxNumberOfAutoScalingGroups sets the MaxNumberOfAutoScalingGroups field's value. -func (s *DescribeAccountLimitsOutput) SetMaxNumberOfAutoScalingGroups(v int64) *DescribeAccountLimitsOutput { - s.MaxNumberOfAutoScalingGroups = &v - return s -} - -// SetMaxNumberOfLaunchConfigurations sets the MaxNumberOfLaunchConfigurations field's value. -func (s *DescribeAccountLimitsOutput) SetMaxNumberOfLaunchConfigurations(v int64) *DescribeAccountLimitsOutput { - s.MaxNumberOfLaunchConfigurations = &v - return s -} - -// SetNumberOfAutoScalingGroups sets the NumberOfAutoScalingGroups field's value. -func (s *DescribeAccountLimitsOutput) SetNumberOfAutoScalingGroups(v int64) *DescribeAccountLimitsOutput { - s.NumberOfAutoScalingGroups = &v - return s -} - -// SetNumberOfLaunchConfigurations sets the NumberOfLaunchConfigurations field's value. -func (s *DescribeAccountLimitsOutput) SetNumberOfLaunchConfigurations(v int64) *DescribeAccountLimitsOutput { - s.NumberOfLaunchConfigurations = &v - return s -} - -type DescribeAdjustmentTypesInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAdjustmentTypesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAdjustmentTypesInput) GoString() string { - return s.String() -} - -type DescribeAdjustmentTypesOutput struct { - _ struct{} `type:"structure"` - - // The policy adjustment types. - AdjustmentTypes []*AdjustmentType `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAdjustmentTypesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAdjustmentTypesOutput) GoString() string { - return s.String() -} - -// SetAdjustmentTypes sets the AdjustmentTypes field's value. -func (s *DescribeAdjustmentTypesOutput) SetAdjustmentTypes(v []*AdjustmentType) *DescribeAdjustmentTypesOutput { - s.AdjustmentTypes = v - return s -} - -type DescribeAutoScalingGroupsInput struct { - _ struct{} `type:"structure"` - - // The names of the Auto Scaling groups. By default, you can only specify up - // to 50 names. You can optionally increase this limit using the MaxRecords - // property. - // - // If you omit this property, all Auto Scaling groups are described. - AutoScalingGroupNames []*string `type:"list"` - - // One or more filters to limit the results based on specific tags. - Filters []*Filter `type:"list"` - - // The maximum number of items to return with this call. The default value is - // 50 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingGroupsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingGroupsInput) GoString() string { - return s.String() -} - -// SetAutoScalingGroupNames sets the AutoScalingGroupNames field's value. -func (s *DescribeAutoScalingGroupsInput) SetAutoScalingGroupNames(v []*string) *DescribeAutoScalingGroupsInput { - s.AutoScalingGroupNames = v - return s -} - -// SetFilters sets the Filters field's value. -func (s *DescribeAutoScalingGroupsInput) SetFilters(v []*Filter) *DescribeAutoScalingGroupsInput { - s.Filters = v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeAutoScalingGroupsInput) SetMaxRecords(v int64) *DescribeAutoScalingGroupsInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeAutoScalingGroupsInput) SetNextToken(v string) *DescribeAutoScalingGroupsInput { - s.NextToken = &v - return s -} - -type DescribeAutoScalingGroupsOutput struct { - _ struct{} `type:"structure"` - - // The groups. - // - // AutoScalingGroups is a required field - AutoScalingGroups []*Group `type:"list" required:"true"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingGroupsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingGroupsOutput) GoString() string { - return s.String() -} - -// SetAutoScalingGroups sets the AutoScalingGroups field's value. -func (s *DescribeAutoScalingGroupsOutput) SetAutoScalingGroups(v []*Group) *DescribeAutoScalingGroupsOutput { - s.AutoScalingGroups = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeAutoScalingGroupsOutput) SetNextToken(v string) *DescribeAutoScalingGroupsOutput { - s.NextToken = &v - return s -} - -type DescribeAutoScalingInstancesInput struct { - _ struct{} `type:"structure"` - - // The IDs of the instances. If you omit this property, all Auto Scaling instances - // are described. If you specify an ID that does not exist, it is ignored with - // no error. - // - // Array Members: Maximum number of 50 items. - InstanceIds []*string `type:"list"` - - // The maximum number of items to return with this call. The default value is - // 50 and the maximum value is 50. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingInstancesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingInstancesInput) GoString() string { - return s.String() -} - -// SetInstanceIds sets the InstanceIds field's value. -func (s *DescribeAutoScalingInstancesInput) SetInstanceIds(v []*string) *DescribeAutoScalingInstancesInput { - s.InstanceIds = v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeAutoScalingInstancesInput) SetMaxRecords(v int64) *DescribeAutoScalingInstancesInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeAutoScalingInstancesInput) SetNextToken(v string) *DescribeAutoScalingInstancesInput { - s.NextToken = &v - return s -} - -type DescribeAutoScalingInstancesOutput struct { - _ struct{} `type:"structure"` - - // The instances. - AutoScalingInstances []*InstanceDetails `type:"list"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingInstancesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingInstancesOutput) GoString() string { - return s.String() -} - -// SetAutoScalingInstances sets the AutoScalingInstances field's value. -func (s *DescribeAutoScalingInstancesOutput) SetAutoScalingInstances(v []*InstanceDetails) *DescribeAutoScalingInstancesOutput { - s.AutoScalingInstances = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeAutoScalingInstancesOutput) SetNextToken(v string) *DescribeAutoScalingInstancesOutput { - s.NextToken = &v - return s -} - -type DescribeAutoScalingNotificationTypesInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingNotificationTypesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingNotificationTypesInput) GoString() string { - return s.String() -} - -type DescribeAutoScalingNotificationTypesOutput struct { - _ struct{} `type:"structure"` - - // The notification types. - AutoScalingNotificationTypes []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingNotificationTypesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAutoScalingNotificationTypesOutput) GoString() string { - return s.String() -} - -// SetAutoScalingNotificationTypes sets the AutoScalingNotificationTypes field's value. -func (s *DescribeAutoScalingNotificationTypesOutput) SetAutoScalingNotificationTypes(v []*string) *DescribeAutoScalingNotificationTypesOutput { - s.AutoScalingNotificationTypes = v - return s -} - -type DescribeInstanceRefreshesInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // One or more instance refresh IDs. - InstanceRefreshIds []*string `type:"list"` - - // The maximum number of items to return with this call. The default value is - // 50 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceRefreshesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceRefreshesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeInstanceRefreshesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeInstanceRefreshesInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribeInstanceRefreshesInput) SetAutoScalingGroupName(v string) *DescribeInstanceRefreshesInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceRefreshIds sets the InstanceRefreshIds field's value. -func (s *DescribeInstanceRefreshesInput) SetInstanceRefreshIds(v []*string) *DescribeInstanceRefreshesInput { - s.InstanceRefreshIds = v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeInstanceRefreshesInput) SetMaxRecords(v int64) *DescribeInstanceRefreshesInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeInstanceRefreshesInput) SetNextToken(v string) *DescribeInstanceRefreshesInput { - s.NextToken = &v - return s -} - -type DescribeInstanceRefreshesOutput struct { - _ struct{} `type:"structure"` - - // The instance refreshes for the specified group, sorted by creation timestamp - // in descending order. - InstanceRefreshes []*InstanceRefresh `type:"list"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceRefreshesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceRefreshesOutput) GoString() string { - return s.String() -} - -// SetInstanceRefreshes sets the InstanceRefreshes field's value. -func (s *DescribeInstanceRefreshesOutput) SetInstanceRefreshes(v []*InstanceRefresh) *DescribeInstanceRefreshesOutput { - s.InstanceRefreshes = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeInstanceRefreshesOutput) SetNextToken(v string) *DescribeInstanceRefreshesOutput { - s.NextToken = &v - return s -} - -type DescribeLaunchConfigurationsInput struct { - _ struct{} `type:"structure"` - - // The launch configuration names. If you omit this property, all launch configurations - // are described. - // - // Array Members: Maximum number of 50 items. - LaunchConfigurationNames []*string `type:"list"` - - // The maximum number of items to return with this call. The default value is - // 50 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLaunchConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLaunchConfigurationsInput) GoString() string { - return s.String() -} - -// SetLaunchConfigurationNames sets the LaunchConfigurationNames field's value. -func (s *DescribeLaunchConfigurationsInput) SetLaunchConfigurationNames(v []*string) *DescribeLaunchConfigurationsInput { - s.LaunchConfigurationNames = v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeLaunchConfigurationsInput) SetMaxRecords(v int64) *DescribeLaunchConfigurationsInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeLaunchConfigurationsInput) SetNextToken(v string) *DescribeLaunchConfigurationsInput { - s.NextToken = &v - return s -} - -type DescribeLaunchConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // The launch configurations. - // - // LaunchConfigurations is a required field - LaunchConfigurations []*LaunchConfiguration `type:"list" required:"true"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLaunchConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLaunchConfigurationsOutput) GoString() string { - return s.String() -} - -// SetLaunchConfigurations sets the LaunchConfigurations field's value. -func (s *DescribeLaunchConfigurationsOutput) SetLaunchConfigurations(v []*LaunchConfiguration) *DescribeLaunchConfigurationsOutput { - s.LaunchConfigurations = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeLaunchConfigurationsOutput) SetNextToken(v string) *DescribeLaunchConfigurationsOutput { - s.NextToken = &v - return s -} - -type DescribeLifecycleHookTypesInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHookTypesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHookTypesInput) GoString() string { - return s.String() -} - -type DescribeLifecycleHookTypesOutput struct { - _ struct{} `type:"structure"` - - // The lifecycle hook types. - LifecycleHookTypes []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHookTypesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHookTypesOutput) GoString() string { - return s.String() -} - -// SetLifecycleHookTypes sets the LifecycleHookTypes field's value. -func (s *DescribeLifecycleHookTypesOutput) SetLifecycleHookTypes(v []*string) *DescribeLifecycleHookTypesOutput { - s.LifecycleHookTypes = v - return s -} - -type DescribeLifecycleHooksInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The names of one or more lifecycle hooks. If you omit this property, all - // lifecycle hooks are described. - LifecycleHookNames []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHooksInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHooksInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeLifecycleHooksInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeLifecycleHooksInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribeLifecycleHooksInput) SetAutoScalingGroupName(v string) *DescribeLifecycleHooksInput { - s.AutoScalingGroupName = &v - return s -} - -// SetLifecycleHookNames sets the LifecycleHookNames field's value. -func (s *DescribeLifecycleHooksInput) SetLifecycleHookNames(v []*string) *DescribeLifecycleHooksInput { - s.LifecycleHookNames = v - return s -} - -type DescribeLifecycleHooksOutput struct { - _ struct{} `type:"structure"` - - // The lifecycle hooks for the specified group. - LifecycleHooks []*LifecycleHook `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHooksOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLifecycleHooksOutput) GoString() string { - return s.String() -} - -// SetLifecycleHooks sets the LifecycleHooks field's value. -func (s *DescribeLifecycleHooksOutput) SetLifecycleHooks(v []*LifecycleHook) *DescribeLifecycleHooksOutput { - s.LifecycleHooks = v - return s -} - -type DescribeLoadBalancerTargetGroupsInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The maximum number of items to return with this call. The default value is - // 100 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerTargetGroupsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerTargetGroupsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeLoadBalancerTargetGroupsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeLoadBalancerTargetGroupsInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribeLoadBalancerTargetGroupsInput) SetAutoScalingGroupName(v string) *DescribeLoadBalancerTargetGroupsInput { - s.AutoScalingGroupName = &v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeLoadBalancerTargetGroupsInput) SetMaxRecords(v int64) *DescribeLoadBalancerTargetGroupsInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeLoadBalancerTargetGroupsInput) SetNextToken(v string) *DescribeLoadBalancerTargetGroupsInput { - s.NextToken = &v - return s -} - -type DescribeLoadBalancerTargetGroupsOutput struct { - _ struct{} `type:"structure"` - - // Information about the target groups. - LoadBalancerTargetGroups []*LoadBalancerTargetGroupState `type:"list"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerTargetGroupsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerTargetGroupsOutput) GoString() string { - return s.String() -} - -// SetLoadBalancerTargetGroups sets the LoadBalancerTargetGroups field's value. -func (s *DescribeLoadBalancerTargetGroupsOutput) SetLoadBalancerTargetGroups(v []*LoadBalancerTargetGroupState) *DescribeLoadBalancerTargetGroupsOutput { - s.LoadBalancerTargetGroups = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeLoadBalancerTargetGroupsOutput) SetNextToken(v string) *DescribeLoadBalancerTargetGroupsOutput { - s.NextToken = &v - return s -} - -type DescribeLoadBalancersInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The maximum number of items to return with this call. The default value is - // 100 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeLoadBalancersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeLoadBalancersInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribeLoadBalancersInput) SetAutoScalingGroupName(v string) *DescribeLoadBalancersInput { - s.AutoScalingGroupName = &v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeLoadBalancersInput) SetMaxRecords(v int64) *DescribeLoadBalancersInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeLoadBalancersInput) SetNextToken(v string) *DescribeLoadBalancersInput { - s.NextToken = &v - return s -} - -type DescribeLoadBalancersOutput struct { - _ struct{} `type:"structure"` - - // The load balancers. - LoadBalancers []*LoadBalancerState `type:"list"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersOutput) GoString() string { - return s.String() -} - -// SetLoadBalancers sets the LoadBalancers field's value. -func (s *DescribeLoadBalancersOutput) SetLoadBalancers(v []*LoadBalancerState) *DescribeLoadBalancersOutput { - s.LoadBalancers = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeLoadBalancersOutput) SetNextToken(v string) *DescribeLoadBalancersOutput { - s.NextToken = &v - return s -} - -type DescribeMetricCollectionTypesInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeMetricCollectionTypesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeMetricCollectionTypesInput) GoString() string { - return s.String() -} - -type DescribeMetricCollectionTypesOutput struct { - _ struct{} `type:"structure"` - - // The granularities for the metrics. - Granularities []*MetricGranularityType `type:"list"` - - // The metrics. - Metrics []*MetricCollectionType `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeMetricCollectionTypesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeMetricCollectionTypesOutput) GoString() string { - return s.String() -} - -// SetGranularities sets the Granularities field's value. -func (s *DescribeMetricCollectionTypesOutput) SetGranularities(v []*MetricGranularityType) *DescribeMetricCollectionTypesOutput { - s.Granularities = v - return s -} - -// SetMetrics sets the Metrics field's value. -func (s *DescribeMetricCollectionTypesOutput) SetMetrics(v []*MetricCollectionType) *DescribeMetricCollectionTypesOutput { - s.Metrics = v - return s -} - -type DescribeNotificationConfigurationsInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupNames []*string `type:"list"` - - // The maximum number of items to return with this call. The default value is - // 50 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeNotificationConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeNotificationConfigurationsInput) GoString() string { - return s.String() -} - -// SetAutoScalingGroupNames sets the AutoScalingGroupNames field's value. -func (s *DescribeNotificationConfigurationsInput) SetAutoScalingGroupNames(v []*string) *DescribeNotificationConfigurationsInput { - s.AutoScalingGroupNames = v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeNotificationConfigurationsInput) SetMaxRecords(v int64) *DescribeNotificationConfigurationsInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeNotificationConfigurationsInput) SetNextToken(v string) *DescribeNotificationConfigurationsInput { - s.NextToken = &v - return s -} - -type DescribeNotificationConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` - - // The notification configurations. - // - // NotificationConfigurations is a required field - NotificationConfigurations []*NotificationConfiguration `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeNotificationConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeNotificationConfigurationsOutput) GoString() string { - return s.String() -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeNotificationConfigurationsOutput) SetNextToken(v string) *DescribeNotificationConfigurationsOutput { - s.NextToken = &v - return s -} - -// SetNotificationConfigurations sets the NotificationConfigurations field's value. -func (s *DescribeNotificationConfigurationsOutput) SetNotificationConfigurations(v []*NotificationConfiguration) *DescribeNotificationConfigurationsOutput { - s.NotificationConfigurations = v - return s -} - -type DescribePoliciesInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // The maximum number of items to be returned with each call. The default value - // is 50 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` - - // The names of one or more policies. If you omit this property, all policies - // are described. If a group name is provided, the results are limited to that - // group. If you specify an unknown policy name, it is ignored with no error. - // - // Array Members: Maximum number of 50 items. - PolicyNames []*string `type:"list"` - - // One or more policy types. The valid values are SimpleScaling, StepScaling, - // TargetTrackingScaling, and PredictiveScaling. - PolicyTypes []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribePoliciesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribePoliciesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribePoliciesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribePoliciesInput"} - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribePoliciesInput) SetAutoScalingGroupName(v string) *DescribePoliciesInput { - s.AutoScalingGroupName = &v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribePoliciesInput) SetMaxRecords(v int64) *DescribePoliciesInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribePoliciesInput) SetNextToken(v string) *DescribePoliciesInput { - s.NextToken = &v - return s -} - -// SetPolicyNames sets the PolicyNames field's value. -func (s *DescribePoliciesInput) SetPolicyNames(v []*string) *DescribePoliciesInput { - s.PolicyNames = v - return s -} - -// SetPolicyTypes sets the PolicyTypes field's value. -func (s *DescribePoliciesInput) SetPolicyTypes(v []*string) *DescribePoliciesInput { - s.PolicyTypes = v - return s -} - -type DescribePoliciesOutput struct { - _ struct{} `type:"structure"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` - - // The scaling policies. - ScalingPolicies []*ScalingPolicy `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribePoliciesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribePoliciesOutput) GoString() string { - return s.String() -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribePoliciesOutput) SetNextToken(v string) *DescribePoliciesOutput { - s.NextToken = &v - return s -} - -// SetScalingPolicies sets the ScalingPolicies field's value. -func (s *DescribePoliciesOutput) SetScalingPolicies(v []*ScalingPolicy) *DescribePoliciesOutput { - s.ScalingPolicies = v - return s -} - -type DescribeScalingActivitiesInput struct { - _ struct{} `type:"structure"` - - // The activity IDs of the desired scaling activities. If you omit this property, - // all activities for the past six weeks are described. If unknown activities - // are requested, they are ignored with no error. If you specify an Auto Scaling - // group, the results are limited to that group. - // - // Array Members: Maximum number of 50 IDs. - ActivityIds []*string `type:"list"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // Indicates whether to include scaling activity from deleted Auto Scaling groups. - IncludeDeletedGroups *bool `type:"boolean"` - - // The maximum number of items to return with this call. The default value is - // 100 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingActivitiesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingActivitiesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeScalingActivitiesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeScalingActivitiesInput"} - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetActivityIds sets the ActivityIds field's value. -func (s *DescribeScalingActivitiesInput) SetActivityIds(v []*string) *DescribeScalingActivitiesInput { - s.ActivityIds = v - return s -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribeScalingActivitiesInput) SetAutoScalingGroupName(v string) *DescribeScalingActivitiesInput { - s.AutoScalingGroupName = &v - return s -} - -// SetIncludeDeletedGroups sets the IncludeDeletedGroups field's value. -func (s *DescribeScalingActivitiesInput) SetIncludeDeletedGroups(v bool) *DescribeScalingActivitiesInput { - s.IncludeDeletedGroups = &v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeScalingActivitiesInput) SetMaxRecords(v int64) *DescribeScalingActivitiesInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeScalingActivitiesInput) SetNextToken(v string) *DescribeScalingActivitiesInput { - s.NextToken = &v - return s -} - -type DescribeScalingActivitiesOutput struct { - _ struct{} `type:"structure"` - - // The scaling activities. Activities are sorted by start time. Activities still - // in progress are described first. - // - // Activities is a required field - Activities []*Activity `type:"list" required:"true"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingActivitiesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingActivitiesOutput) GoString() string { - return s.String() -} - -// SetActivities sets the Activities field's value. -func (s *DescribeScalingActivitiesOutput) SetActivities(v []*Activity) *DescribeScalingActivitiesOutput { - s.Activities = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeScalingActivitiesOutput) SetNextToken(v string) *DescribeScalingActivitiesOutput { - s.NextToken = &v - return s -} - -type DescribeScalingProcessTypesInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingProcessTypesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingProcessTypesInput) GoString() string { - return s.String() -} - -type DescribeScalingProcessTypesOutput struct { - _ struct{} `type:"structure"` - - // The names of the process types. - Processes []*ProcessType `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingProcessTypesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScalingProcessTypesOutput) GoString() string { - return s.String() -} - -// SetProcesses sets the Processes field's value. -func (s *DescribeScalingProcessTypesOutput) SetProcesses(v []*ProcessType) *DescribeScalingProcessTypesOutput { - s.Processes = v - return s -} - -type DescribeScheduledActionsInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // The latest scheduled start time to return. If scheduled action names are - // provided, this property is ignored. - EndTime *time.Time `type:"timestamp"` - - // The maximum number of items to return with this call. The default value is - // 50 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` - - // The names of one or more scheduled actions. If you omit this property, all - // scheduled actions are described. If you specify an unknown scheduled action, - // it is ignored with no error. - // - // Array Members: Maximum number of 50 actions. - ScheduledActionNames []*string `type:"list"` - - // The earliest scheduled start time to return. If scheduled action names are - // provided, this property is ignored. - StartTime *time.Time `type:"timestamp"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScheduledActionsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScheduledActionsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeScheduledActionsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeScheduledActionsInput"} - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribeScheduledActionsInput) SetAutoScalingGroupName(v string) *DescribeScheduledActionsInput { - s.AutoScalingGroupName = &v - return s -} - -// SetEndTime sets the EndTime field's value. -func (s *DescribeScheduledActionsInput) SetEndTime(v time.Time) *DescribeScheduledActionsInput { - s.EndTime = &v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeScheduledActionsInput) SetMaxRecords(v int64) *DescribeScheduledActionsInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeScheduledActionsInput) SetNextToken(v string) *DescribeScheduledActionsInput { - s.NextToken = &v - return s -} - -// SetScheduledActionNames sets the ScheduledActionNames field's value. -func (s *DescribeScheduledActionsInput) SetScheduledActionNames(v []*string) *DescribeScheduledActionsInput { - s.ScheduledActionNames = v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *DescribeScheduledActionsInput) SetStartTime(v time.Time) *DescribeScheduledActionsInput { - s.StartTime = &v - return s -} - -type DescribeScheduledActionsOutput struct { - _ struct{} `type:"structure"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` - - // The scheduled actions. - ScheduledUpdateGroupActions []*ScheduledUpdateGroupAction `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScheduledActionsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeScheduledActionsOutput) GoString() string { - return s.String() -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeScheduledActionsOutput) SetNextToken(v string) *DescribeScheduledActionsOutput { - s.NextToken = &v - return s -} - -// SetScheduledUpdateGroupActions sets the ScheduledUpdateGroupActions field's value. -func (s *DescribeScheduledActionsOutput) SetScheduledUpdateGroupActions(v []*ScheduledUpdateGroupAction) *DescribeScheduledActionsOutput { - s.ScheduledUpdateGroupActions = v - return s -} - -type DescribeTagsInput struct { - _ struct{} `type:"structure"` - - // One or more filters to scope the tags to return. The maximum number of filters - // per filter type (for example, auto-scaling-group) is 1000. - Filters []*Filter `type:"list"` - - // The maximum number of items to return with this call. The default value is - // 50 and the maximum value is 100. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsInput) GoString() string { - return s.String() -} - -// SetFilters sets the Filters field's value. -func (s *DescribeTagsInput) SetFilters(v []*Filter) *DescribeTagsInput { - s.Filters = v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeTagsInput) SetMaxRecords(v int64) *DescribeTagsInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeTagsInput) SetNextToken(v string) *DescribeTagsInput { - s.NextToken = &v - return s -} - -type DescribeTagsOutput struct { - _ struct{} `type:"structure"` - - // A string that indicates that the response contains more items than can be - // returned in a single response. To receive additional items, specify this - // string for the NextToken value when requesting the next set of items. This - // value is null when there are no more items to return. - NextToken *string `type:"string"` - - // One or more tags. - Tags []*TagDescription `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsOutput) GoString() string { - return s.String() -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeTagsOutput) SetNextToken(v string) *DescribeTagsOutput { - s.NextToken = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *DescribeTagsOutput) SetTags(v []*TagDescription) *DescribeTagsOutput { - s.Tags = v - return s -} - -type DescribeTerminationPolicyTypesInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTerminationPolicyTypesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTerminationPolicyTypesInput) GoString() string { - return s.String() -} - -type DescribeTerminationPolicyTypesOutput struct { - _ struct{} `type:"structure"` - - // The termination policies supported by Amazon EC2 Auto Scaling: OldestInstance, - // OldestLaunchConfiguration, NewestInstance, ClosestToNextInstanceHour, Default, - // OldestLaunchTemplate, and AllocationStrategy. - TerminationPolicyTypes []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTerminationPolicyTypesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTerminationPolicyTypesOutput) GoString() string { - return s.String() -} - -// SetTerminationPolicyTypes sets the TerminationPolicyTypes field's value. -func (s *DescribeTerminationPolicyTypesOutput) SetTerminationPolicyTypes(v []*string) *DescribeTerminationPolicyTypesOutput { - s.TerminationPolicyTypes = v - return s -} - -type DescribeWarmPoolInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The maximum number of instances to return with this call. The maximum value - // is 50. - MaxRecords *int64 `type:"integer"` - - // The token for the next set of instances to return. (You received this token - // from a previous call.) - NextToken *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeWarmPoolInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeWarmPoolInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeWarmPoolInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeWarmPoolInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DescribeWarmPoolInput) SetAutoScalingGroupName(v string) *DescribeWarmPoolInput { - s.AutoScalingGroupName = &v - return s -} - -// SetMaxRecords sets the MaxRecords field's value. -func (s *DescribeWarmPoolInput) SetMaxRecords(v int64) *DescribeWarmPoolInput { - s.MaxRecords = &v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeWarmPoolInput) SetNextToken(v string) *DescribeWarmPoolInput { - s.NextToken = &v - return s -} - -type DescribeWarmPoolOutput struct { - _ struct{} `type:"structure"` - - // The instances that are currently in the warm pool. - Instances []*Instance `type:"list"` - - // The token for the next set of items to return. (You received this token from - // a previous call.) - NextToken *string `type:"string"` - - // The warm pool configuration details. - WarmPoolConfiguration *WarmPoolConfiguration `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeWarmPoolOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeWarmPoolOutput) GoString() string { - return s.String() -} - -// SetInstances sets the Instances field's value. -func (s *DescribeWarmPoolOutput) SetInstances(v []*Instance) *DescribeWarmPoolOutput { - s.Instances = v - return s -} - -// SetNextToken sets the NextToken field's value. -func (s *DescribeWarmPoolOutput) SetNextToken(v string) *DescribeWarmPoolOutput { - s.NextToken = &v - return s -} - -// SetWarmPoolConfiguration sets the WarmPoolConfiguration field's value. -func (s *DescribeWarmPoolOutput) SetWarmPoolConfiguration(v *WarmPoolConfiguration) *DescribeWarmPoolOutput { - s.WarmPoolConfiguration = v - return s -} - -// Describes the desired configuration for an instance refresh. -// -// If you specify a desired configuration, you must specify either a LaunchTemplate -// or a MixedInstancesPolicy. -type DesiredConfiguration struct { - _ struct{} `type:"structure"` - - // Describes the launch template and the version of the launch template that - // Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. For more information - // about launch templates, see Launch templates (https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchTemplates.html) - // in the Amazon EC2 Auto Scaling User Guide. - LaunchTemplate *LaunchTemplateSpecification `type:"structure"` - - // Use this structure to launch multiple instance types and On-Demand Instances - // and Spot Instances within a single Auto Scaling group. - // - // A mixed instances policy contains information that Amazon EC2 Auto Scaling - // can use to launch instances and help optimize your costs. For more information, - // see Auto Scaling groups with multiple instance types and purchase options - // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) - // in the Amazon EC2 Auto Scaling User Guide. - MixedInstancesPolicy *MixedInstancesPolicy `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DesiredConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DesiredConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DesiredConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DesiredConfiguration"} - if s.LaunchTemplate != nil { - if err := s.LaunchTemplate.Validate(); err != nil { - invalidParams.AddNested("LaunchTemplate", err.(request.ErrInvalidParams)) - } - } - if s.MixedInstancesPolicy != nil { - if err := s.MixedInstancesPolicy.Validate(); err != nil { - invalidParams.AddNested("MixedInstancesPolicy", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLaunchTemplate sets the LaunchTemplate field's value. -func (s *DesiredConfiguration) SetLaunchTemplate(v *LaunchTemplateSpecification) *DesiredConfiguration { - s.LaunchTemplate = v - return s -} - -// SetMixedInstancesPolicy sets the MixedInstancesPolicy field's value. -func (s *DesiredConfiguration) SetMixedInstancesPolicy(v *MixedInstancesPolicy) *DesiredConfiguration { - s.MixedInstancesPolicy = v - return s -} - -type DetachInstancesInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The IDs of the instances. You can specify up to 20 instances. - InstanceIds []*string `type:"list"` - - // Indicates whether the Auto Scaling group decrements the desired capacity - // value by the number of instances detached. - // - // ShouldDecrementDesiredCapacity is a required field - ShouldDecrementDesiredCapacity *bool `type:"boolean" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachInstancesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachInstancesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DetachInstancesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DetachInstancesInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.ShouldDecrementDesiredCapacity == nil { - invalidParams.Add(request.NewErrParamRequired("ShouldDecrementDesiredCapacity")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DetachInstancesInput) SetAutoScalingGroupName(v string) *DetachInstancesInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceIds sets the InstanceIds field's value. -func (s *DetachInstancesInput) SetInstanceIds(v []*string) *DetachInstancesInput { - s.InstanceIds = v - return s -} - -// SetShouldDecrementDesiredCapacity sets the ShouldDecrementDesiredCapacity field's value. -func (s *DetachInstancesInput) SetShouldDecrementDesiredCapacity(v bool) *DetachInstancesInput { - s.ShouldDecrementDesiredCapacity = &v - return s -} - -type DetachInstancesOutput struct { - _ struct{} `type:"structure"` - - // The activities related to detaching the instances from the Auto Scaling group. - Activities []*Activity `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachInstancesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachInstancesOutput) GoString() string { - return s.String() -} - -// SetActivities sets the Activities field's value. -func (s *DetachInstancesOutput) SetActivities(v []*Activity) *DetachInstancesOutput { - s.Activities = v - return s -} - -type DetachLoadBalancerTargetGroupsInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The Amazon Resource Names (ARN) of the target groups. You can specify up - // to 10 target groups. - // - // TargetGroupARNs is a required field - TargetGroupARNs []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerTargetGroupsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerTargetGroupsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DetachLoadBalancerTargetGroupsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DetachLoadBalancerTargetGroupsInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.TargetGroupARNs == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupARNs")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DetachLoadBalancerTargetGroupsInput) SetAutoScalingGroupName(v string) *DetachLoadBalancerTargetGroupsInput { - s.AutoScalingGroupName = &v - return s -} - -// SetTargetGroupARNs sets the TargetGroupARNs field's value. -func (s *DetachLoadBalancerTargetGroupsInput) SetTargetGroupARNs(v []*string) *DetachLoadBalancerTargetGroupsInput { - s.TargetGroupARNs = v - return s -} - -type DetachLoadBalancerTargetGroupsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerTargetGroupsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerTargetGroupsOutput) GoString() string { - return s.String() -} - -type DetachLoadBalancersInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The names of the load balancers. You can specify up to 10 load balancers. - // - // LoadBalancerNames is a required field - LoadBalancerNames []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DetachLoadBalancersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DetachLoadBalancersInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.LoadBalancerNames == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerNames")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DetachLoadBalancersInput) SetAutoScalingGroupName(v string) *DetachLoadBalancersInput { - s.AutoScalingGroupName = &v - return s -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *DetachLoadBalancersInput) SetLoadBalancerNames(v []*string) *DetachLoadBalancersInput { - s.LoadBalancerNames = v - return s -} - -type DetachLoadBalancersOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancersOutput) GoString() string { - return s.String() -} - -type DisableMetricsCollectionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // Identifies the metrics to disable. - // - // You can specify one or more of the following metrics: - // - // * GroupMinSize - // - // * GroupMaxSize - // - // * GroupDesiredCapacity - // - // * GroupInServiceInstances - // - // * GroupPendingInstances - // - // * GroupStandbyInstances - // - // * GroupTerminatingInstances - // - // * GroupTotalInstances - // - // * GroupInServiceCapacity - // - // * GroupPendingCapacity - // - // * GroupStandbyCapacity - // - // * GroupTerminatingCapacity - // - // * GroupTotalCapacity - // - // * WarmPoolDesiredCapacity - // - // * WarmPoolWarmedCapacity - // - // * WarmPoolPendingCapacity - // - // * WarmPoolTerminatingCapacity - // - // * WarmPoolTotalCapacity - // - // * GroupAndWarmPoolDesiredCapacity - // - // * GroupAndWarmPoolTotalCapacity - // - // If you omit this property, all metrics are disabled. - // - // For more information, see Auto Scaling group metrics (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-cloudwatch-monitoring.html#as-group-metrics) - // in the Amazon EC2 Auto Scaling User Guide. - Metrics []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableMetricsCollectionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableMetricsCollectionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DisableMetricsCollectionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DisableMetricsCollectionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *DisableMetricsCollectionInput) SetAutoScalingGroupName(v string) *DisableMetricsCollectionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetMetrics sets the Metrics field's value. -func (s *DisableMetricsCollectionInput) SetMetrics(v []*string) *DisableMetricsCollectionInput { - s.Metrics = v - return s -} - -type DisableMetricsCollectionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableMetricsCollectionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableMetricsCollectionOutput) GoString() string { - return s.String() -} - -// Describes information used to set up an Amazon EBS volume specified in a -// block device mapping. -type Ebs struct { - _ struct{} `type:"structure"` - - // Indicates whether the volume is deleted on instance termination. For Amazon - // EC2 Auto Scaling, the default value is true. - DeleteOnTermination *bool `type:"boolean"` - - // Specifies whether the volume should be encrypted. Encrypted EBS volumes can - // only be attached to instances that support Amazon EBS encryption. For more - // information, see Supported instance types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances). - // If your AMI uses encrypted volumes, you can also only launch it on supported - // instance types. - // - // If you are creating a volume from a snapshot, you cannot create an unencrypted - // volume from an encrypted snapshot. Also, you cannot specify a KMS key ID - // when using a launch configuration. - // - // If you enable encryption by default, the EBS volumes that you create are - // always encrypted, either using the Amazon Web Services managed KMS key or - // a customer-managed KMS key, regardless of whether the snapshot was encrypted. - // - // For more information, see Use Amazon Web Services KMS keys to encrypt Amazon - // EBS volumes (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-data-protection.html#encryption) - // in the Amazon EC2 Auto Scaling User Guide. - Encrypted *bool `type:"boolean"` - - // The number of input/output (I/O) operations per second (IOPS) to provision - // for the volume. For gp3 and 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. - // - // The following are the supported values for each volume type: - // - // * gp3: 3,000-16,000 IOPS - // - // * io1: 100-64,000 IOPS - // - // For io1 volumes, we guarantee 64,000 IOPS only for Instances built on the - // Nitro System (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances). - // Other instance families guarantee performance up to 32,000 IOPS. - // - // Iops is supported when the volume type is gp3 or io1 and required only when - // the volume type is io1. (Not used with standard, gp2, st1, or sc1 volumes.) - Iops *int64 `min:"100" type:"integer"` - - // The snapshot ID of the volume to use. - // - // You must specify either a VolumeSize or a SnapshotId. - SnapshotId *string `min:"1" type:"string"` - - // The throughput (MiBps) to provision for a gp3 volume. - Throughput *int64 `min:"125" type:"integer"` - - // The volume size, in GiBs. The following are the supported volumes sizes for - // each volume type: - // - // * gp2 and gp3: 1-16,384 - // - // * io1: 4-16,384 - // - // * st1 and sc1: 125-16,384 - // - // * standard: 1-1,024 - // - // You must specify either a SnapshotId or a VolumeSize. If you specify both - // SnapshotId and VolumeSize, the volume size must be equal or greater than - // the size of the snapshot. - VolumeSize *int64 `min:"1" type:"integer"` - - // The volume type. For more information, see Amazon EBS volume types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // Valid values: standard | io1 | gp2 | st1 | sc1 | gp3 - VolumeType *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Ebs) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Ebs) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Ebs) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Ebs"} - if s.Iops != nil && *s.Iops < 100 { - invalidParams.Add(request.NewErrParamMinValue("Iops", 100)) - } - if s.SnapshotId != nil && len(*s.SnapshotId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("SnapshotId", 1)) - } - if s.Throughput != nil && *s.Throughput < 125 { - invalidParams.Add(request.NewErrParamMinValue("Throughput", 125)) - } - if s.VolumeSize != nil && *s.VolumeSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("VolumeSize", 1)) - } - if s.VolumeType != nil && len(*s.VolumeType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("VolumeType", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDeleteOnTermination sets the DeleteOnTermination field's value. -func (s *Ebs) SetDeleteOnTermination(v bool) *Ebs { - s.DeleteOnTermination = &v - return s -} - -// SetEncrypted sets the Encrypted field's value. -func (s *Ebs) SetEncrypted(v bool) *Ebs { - s.Encrypted = &v - return s -} - -// SetIops sets the Iops field's value. -func (s *Ebs) SetIops(v int64) *Ebs { - s.Iops = &v - return s -} - -// SetSnapshotId sets the SnapshotId field's value. -func (s *Ebs) SetSnapshotId(v string) *Ebs { - s.SnapshotId = &v - return s -} - -// SetThroughput sets the Throughput field's value. -func (s *Ebs) SetThroughput(v int64) *Ebs { - s.Throughput = &v - return s -} - -// SetVolumeSize sets the VolumeSize field's value. -func (s *Ebs) SetVolumeSize(v int64) *Ebs { - s.VolumeSize = &v - return s -} - -// SetVolumeType sets the VolumeType field's value. -func (s *Ebs) SetVolumeType(v string) *Ebs { - s.VolumeType = &v - return s -} - -type EnableMetricsCollectionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The frequency at which Amazon EC2 Auto Scaling sends aggregated data to CloudWatch. - // The only valid value is 1Minute. - // - // Granularity is a required field - Granularity *string `min:"1" type:"string" required:"true"` - - // Identifies the metrics to enable. - // - // You can specify one or more of the following metrics: - // - // * GroupMinSize - // - // * GroupMaxSize - // - // * GroupDesiredCapacity - // - // * GroupInServiceInstances - // - // * GroupPendingInstances - // - // * GroupStandbyInstances - // - // * GroupTerminatingInstances - // - // * GroupTotalInstances - // - // * GroupInServiceCapacity - // - // * GroupPendingCapacity - // - // * GroupStandbyCapacity - // - // * GroupTerminatingCapacity - // - // * GroupTotalCapacity - // - // * WarmPoolDesiredCapacity - // - // * WarmPoolWarmedCapacity - // - // * WarmPoolPendingCapacity - // - // * WarmPoolTerminatingCapacity - // - // * WarmPoolTotalCapacity - // - // * GroupAndWarmPoolDesiredCapacity - // - // * GroupAndWarmPoolTotalCapacity - // - // If you specify Granularity and don't specify any metrics, all metrics are - // enabled. - // - // For more information, see Auto Scaling group metrics (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-cloudwatch-monitoring.html#as-group-metrics) - // in the Amazon EC2 Auto Scaling User Guide. - Metrics []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableMetricsCollectionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableMetricsCollectionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *EnableMetricsCollectionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EnableMetricsCollectionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.Granularity == nil { - invalidParams.Add(request.NewErrParamRequired("Granularity")) - } - if s.Granularity != nil && len(*s.Granularity) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Granularity", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *EnableMetricsCollectionInput) SetAutoScalingGroupName(v string) *EnableMetricsCollectionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetGranularity sets the Granularity field's value. -func (s *EnableMetricsCollectionInput) SetGranularity(v string) *EnableMetricsCollectionInput { - s.Granularity = &v - return s -} - -// SetMetrics sets the Metrics field's value. -func (s *EnableMetricsCollectionInput) SetMetrics(v []*string) *EnableMetricsCollectionInput { - s.Metrics = v - return s -} - -type EnableMetricsCollectionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableMetricsCollectionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableMetricsCollectionOutput) GoString() string { - return s.String() -} - -// Describes an enabled Auto Scaling group metric. -type EnabledMetric struct { - _ struct{} `type:"structure"` - - // The granularity of the metric. The only valid value is 1Minute. - Granularity *string `min:"1" type:"string"` - - // One of the following metrics: - // - // * GroupMinSize - // - // * GroupMaxSize - // - // * GroupDesiredCapacity - // - // * GroupInServiceInstances - // - // * GroupPendingInstances - // - // * GroupStandbyInstances - // - // * GroupTerminatingInstances - // - // * GroupTotalInstances - // - // * GroupInServiceCapacity - // - // * GroupPendingCapacity - // - // * GroupStandbyCapacity - // - // * GroupTerminatingCapacity - // - // * GroupTotalCapacity - // - // * WarmPoolDesiredCapacity - // - // * WarmPoolWarmedCapacity - // - // * WarmPoolPendingCapacity - // - // * WarmPoolTerminatingCapacity - // - // * WarmPoolTotalCapacity - // - // * GroupAndWarmPoolDesiredCapacity - // - // * GroupAndWarmPoolTotalCapacity - // - // For more information, see Auto Scaling group metrics (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-cloudwatch-monitoring.html#as-group-metrics) - // in the Amazon EC2 Auto Scaling User Guide. - Metric *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnabledMetric) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnabledMetric) GoString() string { - return s.String() -} - -// SetGranularity sets the Granularity field's value. -func (s *EnabledMetric) SetGranularity(v string) *EnabledMetric { - s.Granularity = &v - return s -} - -// SetMetric sets the Metric field's value. -func (s *EnabledMetric) SetMetric(v string) *EnabledMetric { - s.Metric = &v - return s -} - -type EnterStandbyInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The IDs of the instances. You can specify up to 20 instances. - InstanceIds []*string `type:"list"` - - // Indicates whether to decrement the desired capacity of the Auto Scaling group - // by the number of instances moved to Standby mode. - // - // ShouldDecrementDesiredCapacity is a required field - ShouldDecrementDesiredCapacity *bool `type:"boolean" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnterStandbyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnterStandbyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *EnterStandbyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EnterStandbyInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.ShouldDecrementDesiredCapacity == nil { - invalidParams.Add(request.NewErrParamRequired("ShouldDecrementDesiredCapacity")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *EnterStandbyInput) SetAutoScalingGroupName(v string) *EnterStandbyInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceIds sets the InstanceIds field's value. -func (s *EnterStandbyInput) SetInstanceIds(v []*string) *EnterStandbyInput { - s.InstanceIds = v - return s -} - -// SetShouldDecrementDesiredCapacity sets the ShouldDecrementDesiredCapacity field's value. -func (s *EnterStandbyInput) SetShouldDecrementDesiredCapacity(v bool) *EnterStandbyInput { - s.ShouldDecrementDesiredCapacity = &v - return s -} - -type EnterStandbyOutput struct { - _ struct{} `type:"structure"` - - // The activities related to moving instances into Standby mode. - Activities []*Activity `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnterStandbyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnterStandbyOutput) GoString() string { - return s.String() -} - -// SetActivities sets the Activities field's value. -func (s *EnterStandbyOutput) SetActivities(v []*Activity) *EnterStandbyOutput { - s.Activities = v - return s -} - -type ExecutePolicyInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // The breach threshold for the alarm. - // - // Required if the policy type is StepScaling and not supported otherwise. - BreachThreshold *float64 `type:"double"` - - // Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to - // complete before executing the policy. - // - // Valid only if the policy type is SimpleScaling. For more information, see - // Scaling cooldowns for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) - // in the Amazon EC2 Auto Scaling User Guide. - HonorCooldown *bool `type:"boolean"` - - // The metric value to compare to BreachThreshold. This enables you to execute - // a policy of type StepScaling and determine which step adjustment to use. - // For example, if the breach threshold is 50 and you want to use a step adjustment - // with a lower bound of 0 and an upper bound of 10, you can set the metric - // value to 59. - // - // If you specify a metric value that doesn't correspond to a step adjustment - // for the policy, the call returns an error. - // - // Required if the policy type is StepScaling and not supported otherwise. - MetricValue *float64 `type:"double"` - - // The name or ARN of the policy. - // - // PolicyName is a required field - PolicyName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExecutePolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExecutePolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ExecutePolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ExecutePolicyInput"} - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - if s.PolicyName != nil && len(*s.PolicyName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *ExecutePolicyInput) SetAutoScalingGroupName(v string) *ExecutePolicyInput { - s.AutoScalingGroupName = &v - return s -} - -// SetBreachThreshold sets the BreachThreshold field's value. -func (s *ExecutePolicyInput) SetBreachThreshold(v float64) *ExecutePolicyInput { - s.BreachThreshold = &v - return s -} - -// SetHonorCooldown sets the HonorCooldown field's value. -func (s *ExecutePolicyInput) SetHonorCooldown(v bool) *ExecutePolicyInput { - s.HonorCooldown = &v - return s -} - -// SetMetricValue sets the MetricValue field's value. -func (s *ExecutePolicyInput) SetMetricValue(v float64) *ExecutePolicyInput { - s.MetricValue = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *ExecutePolicyInput) SetPolicyName(v string) *ExecutePolicyInput { - s.PolicyName = &v - return s -} - -type ExecutePolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExecutePolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExecutePolicyOutput) GoString() string { - return s.String() -} - -type ExitStandbyInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The IDs of the instances. You can specify up to 20 instances. - InstanceIds []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExitStandbyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExitStandbyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ExitStandbyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ExitStandbyInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *ExitStandbyInput) SetAutoScalingGroupName(v string) *ExitStandbyInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceIds sets the InstanceIds field's value. -func (s *ExitStandbyInput) SetInstanceIds(v []*string) *ExitStandbyInput { - s.InstanceIds = v - return s -} - -type ExitStandbyOutput struct { - _ struct{} `type:"structure"` - - // The activities related to moving instances out of Standby mode. - Activities []*Activity `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExitStandbyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExitStandbyOutput) GoString() string { - return s.String() -} - -// SetActivities sets the Activities field's value. -func (s *ExitStandbyOutput) SetActivities(v []*Activity) *ExitStandbyOutput { - s.Activities = v - return s -} - -// Describes a scheduled action that could not be created, updated, or deleted. -type FailedScheduledUpdateGroupActionRequest struct { - _ struct{} `type:"structure"` - - // The error code. - ErrorCode *string `min:"1" type:"string"` - - // The error message accompanying the error code. - ErrorMessage *string `type:"string"` - - // The name of the scheduled action. - // - // ScheduledActionName is a required field - ScheduledActionName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s FailedScheduledUpdateGroupActionRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s FailedScheduledUpdateGroupActionRequest) GoString() string { - return s.String() -} - -// SetErrorCode sets the ErrorCode field's value. -func (s *FailedScheduledUpdateGroupActionRequest) SetErrorCode(v string) *FailedScheduledUpdateGroupActionRequest { - s.ErrorCode = &v - return s -} - -// SetErrorMessage sets the ErrorMessage field's value. -func (s *FailedScheduledUpdateGroupActionRequest) SetErrorMessage(v string) *FailedScheduledUpdateGroupActionRequest { - s.ErrorMessage = &v - return s -} - -// SetScheduledActionName sets the ScheduledActionName field's value. -func (s *FailedScheduledUpdateGroupActionRequest) SetScheduledActionName(v string) *FailedScheduledUpdateGroupActionRequest { - s.ScheduledActionName = &v - return s -} - -// Describes a filter that is used to return a more specific list of results -// from a describe operation. -// -// If you specify multiple filters, the filters are automatically logically -// joined with an AND, and the request returns only the results that match all -// of the specified filters. -// -// For more information, see Tag Auto Scaling groups and instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html) -// in the Amazon EC2 Auto Scaling User Guide. -type Filter struct { - _ struct{} `type:"structure"` - - // The name of the filter. - // - // The valid values for Name depend on which API operation you're using with - // the filter (DescribeAutoScalingGroups or DescribeTags). - // - // DescribeAutoScalingGroups - // - // Valid values for Name include the following: - // - // * tag-key - Accepts tag keys. The results only include information about - // the Auto Scaling groups associated with these tag keys. - // - // * tag-value - Accepts tag values. The results only include information - // about the Auto Scaling groups associated with these tag values. - // - // * tag: - Accepts the key/value combination of the tag. Use the tag - // key in the filter name and the tag value as the filter value. The results - // only include information about the Auto Scaling groups associated with - // the specified key/value combination. - // - // DescribeTags - // - // Valid values for Name include the following: - // - // * auto-scaling-group - Accepts the names of Auto Scaling groups. The results - // only include information about the tags associated with these Auto Scaling - // groups. - // - // * key - Accepts tag keys. The results only include information about the - // tags associated with these tag keys. - // - // * value - Accepts tag values. The results only include information about - // the tags associated with these tag values. - // - // * propagate-at-launch - Accepts a Boolean value, which specifies whether - // tags propagate to instances at launch. The results only include information - // about the tags associated with the specified Boolean value. - Name *string `type:"string"` - - // One or more filter values. Filter values are case-sensitive. - // - // If you specify multiple values for a filter, the values are automatically - // logically joined with an OR, and the request returns all results that match - // any of the specified values. For example, specify "tag:environment" for the - // filter name and "production,development" for the filter values to find Auto - // Scaling groups with the tag "environment=production" or "environment=development". - Values []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Filter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Filter) GoString() string { - return s.String() -} - -// SetName sets the Name field's value. -func (s *Filter) SetName(v string) *Filter { - s.Name = &v - return s -} - -// SetValues sets the Values field's value. -func (s *Filter) SetValues(v []*string) *Filter { - s.Values = v - return s -} - -type GetPredictiveScalingForecastInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The exclusive end time of the time range for the forecast data to get. The - // maximum time duration between the start and end time is 30 days. - // - // Although this parameter can accept a date and time that is more than two - // days in the future, the availability of forecast data has limits. Amazon - // EC2 Auto Scaling only issues forecasts for periods of two days in advance. - // - // EndTime is a required field - EndTime *time.Time `type:"timestamp" required:"true"` - - // The name of the policy. - // - // PolicyName is a required field - PolicyName *string `min:"1" type:"string" required:"true"` - - // The inclusive start time of the time range for the forecast data to get. - // At most, the date and time can be one year before the current date and time. - // - // StartTime is a required field - StartTime *time.Time `type:"timestamp" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPredictiveScalingForecastInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPredictiveScalingForecastInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetPredictiveScalingForecastInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetPredictiveScalingForecastInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.EndTime == nil { - invalidParams.Add(request.NewErrParamRequired("EndTime")) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - if s.PolicyName != nil && len(*s.PolicyName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1)) - } - if s.StartTime == nil { - invalidParams.Add(request.NewErrParamRequired("StartTime")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *GetPredictiveScalingForecastInput) SetAutoScalingGroupName(v string) *GetPredictiveScalingForecastInput { - s.AutoScalingGroupName = &v - return s -} - -// SetEndTime sets the EndTime field's value. -func (s *GetPredictiveScalingForecastInput) SetEndTime(v time.Time) *GetPredictiveScalingForecastInput { - s.EndTime = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *GetPredictiveScalingForecastInput) SetPolicyName(v string) *GetPredictiveScalingForecastInput { - s.PolicyName = &v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *GetPredictiveScalingForecastInput) SetStartTime(v time.Time) *GetPredictiveScalingForecastInput { - s.StartTime = &v - return s -} - -type GetPredictiveScalingForecastOutput struct { - _ struct{} `type:"structure"` - - // The capacity forecast. - // - // CapacityForecast is a required field - CapacityForecast *CapacityForecast `type:"structure" required:"true"` - - // The load forecast. - // - // LoadForecast is a required field - LoadForecast []*LoadForecast `type:"list" required:"true"` - - // The time the forecast was made. - // - // UpdateTime is a required field - UpdateTime *time.Time `type:"timestamp" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPredictiveScalingForecastOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPredictiveScalingForecastOutput) GoString() string { - return s.String() -} - -// SetCapacityForecast sets the CapacityForecast field's value. -func (s *GetPredictiveScalingForecastOutput) SetCapacityForecast(v *CapacityForecast) *GetPredictiveScalingForecastOutput { - s.CapacityForecast = v - return s -} - -// SetLoadForecast sets the LoadForecast field's value. -func (s *GetPredictiveScalingForecastOutput) SetLoadForecast(v []*LoadForecast) *GetPredictiveScalingForecastOutput { - s.LoadForecast = v - return s -} - -// SetUpdateTime sets the UpdateTime field's value. -func (s *GetPredictiveScalingForecastOutput) SetUpdateTime(v time.Time) *GetPredictiveScalingForecastOutput { - s.UpdateTime = &v - return s -} - -// Describes an Auto Scaling group. -type Group struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the Auto Scaling group. - AutoScalingGroupARN *string `min:"1" type:"string"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // One or more Availability Zones for the group. - // - // AvailabilityZones is a required field - AvailabilityZones []*string `type:"list" required:"true"` - - // Indicates whether Capacity Rebalancing is enabled. - CapacityRebalance *bool `type:"boolean"` - - // Reserved. - Context *string `type:"string"` - - // The date and time the group was created. - // - // CreatedTime is a required field - CreatedTime *time.Time `type:"timestamp" required:"true"` - - // The duration of the default cooldown period, in seconds. - // - // DefaultCooldown is a required field - DefaultCooldown *int64 `type:"integer" required:"true"` - - // The duration of the default instance warmup, in seconds. - DefaultInstanceWarmup *int64 `type:"integer"` - - // The desired size of the group. - // - // DesiredCapacity is a required field - DesiredCapacity *int64 `type:"integer" required:"true"` - - // The unit of measurement for the value specified for desired capacity. Amazon - // EC2 Auto Scaling supports DesiredCapacityType for attribute-based instance - // type selection only. - DesiredCapacityType *string `min:"1" type:"string"` - - // The metrics enabled for the group. - EnabledMetrics []*EnabledMetric `type:"list"` - - // The duration of the health check grace period, in seconds. - HealthCheckGracePeriod *int64 `type:"integer"` - - // The service to use for the health checks. The valid values are EC2 and ELB. - // If you configure an Auto Scaling group to use ELB health checks, it considers - // the instance unhealthy if it fails either the EC2 status checks or the load - // balancer health checks. - // - // HealthCheckType is a required field - HealthCheckType *string `min:"1" type:"string" required:"true"` - - // The EC2 instances associated with the group. - Instances []*Instance `type:"list"` - - // The name of the associated launch configuration. - LaunchConfigurationName *string `min:"1" type:"string"` - - // The launch template for the group. - LaunchTemplate *LaunchTemplateSpecification `type:"structure"` - - // One or more load balancers associated with the group. - LoadBalancerNames []*string `type:"list"` - - // The maximum amount of time, in seconds, that an instance can be in service. - // - // Valid Range: Minimum value of 0. - MaxInstanceLifetime *int64 `type:"integer"` - - // The maximum size of the group. - // - // MaxSize is a required field - MaxSize *int64 `type:"integer" required:"true"` - - // The minimum size of the group. - // - // MinSize is a required field - MinSize *int64 `type:"integer" required:"true"` - - // The mixed instances policy for the group. - MixedInstancesPolicy *MixedInstancesPolicy `type:"structure"` - - // Indicates whether newly launched instances are protected from termination - // by Amazon EC2 Auto Scaling when scaling in. - NewInstancesProtectedFromScaleIn *bool `type:"boolean"` - - // The name of the placement group into which to launch your instances, if any. - PlacementGroup *string `min:"1" type:"string"` - - // The predicted capacity of the group when it has a predictive scaling policy. - PredictedCapacity *int64 `type:"integer"` - - // The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling - // group uses to call other Amazon Web Services on your behalf. - ServiceLinkedRoleARN *string `min:"1" type:"string"` - - // The current state of the group when the DeleteAutoScalingGroup operation - // is in progress. - Status *string `min:"1" type:"string"` - - // The suspended processes associated with the group. - SuspendedProcesses []*SuspendedProcess `type:"list"` - - // The tags for the group. - Tags []*TagDescription `type:"list"` - - // The Amazon Resource Names (ARN) of the target groups for your load balancer. - TargetGroupARNs []*string `type:"list"` - - // The termination policies for the group. - TerminationPolicies []*string `type:"list"` - - // One or more subnet IDs, if applicable, separated by commas. - VPCZoneIdentifier *string `min:"1" type:"string"` - - // The warm pool for the group. - WarmPoolConfiguration *WarmPoolConfiguration `type:"structure"` - - // The current size of the warm pool. - WarmPoolSize *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Group) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Group) GoString() string { - return s.String() -} - -// SetAutoScalingGroupARN sets the AutoScalingGroupARN field's value. -func (s *Group) SetAutoScalingGroupARN(v string) *Group { - s.AutoScalingGroupARN = &v - return s -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *Group) SetAutoScalingGroupName(v string) *Group { - s.AutoScalingGroupName = &v - return s -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *Group) SetAvailabilityZones(v []*string) *Group { - s.AvailabilityZones = v - return s -} - -// SetCapacityRebalance sets the CapacityRebalance field's value. -func (s *Group) SetCapacityRebalance(v bool) *Group { - s.CapacityRebalance = &v - return s -} - -// SetContext sets the Context field's value. -func (s *Group) SetContext(v string) *Group { - s.Context = &v - return s -} - -// SetCreatedTime sets the CreatedTime field's value. -func (s *Group) SetCreatedTime(v time.Time) *Group { - s.CreatedTime = &v - return s -} - -// SetDefaultCooldown sets the DefaultCooldown field's value. -func (s *Group) SetDefaultCooldown(v int64) *Group { - s.DefaultCooldown = &v - return s -} - -// SetDefaultInstanceWarmup sets the DefaultInstanceWarmup field's value. -func (s *Group) SetDefaultInstanceWarmup(v int64) *Group { - s.DefaultInstanceWarmup = &v - return s -} - -// SetDesiredCapacity sets the DesiredCapacity field's value. -func (s *Group) SetDesiredCapacity(v int64) *Group { - s.DesiredCapacity = &v - return s -} - -// SetDesiredCapacityType sets the DesiredCapacityType field's value. -func (s *Group) SetDesiredCapacityType(v string) *Group { - s.DesiredCapacityType = &v - return s -} - -// SetEnabledMetrics sets the EnabledMetrics field's value. -func (s *Group) SetEnabledMetrics(v []*EnabledMetric) *Group { - s.EnabledMetrics = v - return s -} - -// SetHealthCheckGracePeriod sets the HealthCheckGracePeriod field's value. -func (s *Group) SetHealthCheckGracePeriod(v int64) *Group { - s.HealthCheckGracePeriod = &v - return s -} - -// SetHealthCheckType sets the HealthCheckType field's value. -func (s *Group) SetHealthCheckType(v string) *Group { - s.HealthCheckType = &v - return s -} - -// SetInstances sets the Instances field's value. -func (s *Group) SetInstances(v []*Instance) *Group { - s.Instances = v - return s -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *Group) SetLaunchConfigurationName(v string) *Group { - s.LaunchConfigurationName = &v - return s -} - -// SetLaunchTemplate sets the LaunchTemplate field's value. -func (s *Group) SetLaunchTemplate(v *LaunchTemplateSpecification) *Group { - s.LaunchTemplate = v - return s -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *Group) SetLoadBalancerNames(v []*string) *Group { - s.LoadBalancerNames = v - return s -} - -// SetMaxInstanceLifetime sets the MaxInstanceLifetime field's value. -func (s *Group) SetMaxInstanceLifetime(v int64) *Group { - s.MaxInstanceLifetime = &v - return s -} - -// SetMaxSize sets the MaxSize field's value. -func (s *Group) SetMaxSize(v int64) *Group { - s.MaxSize = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *Group) SetMinSize(v int64) *Group { - s.MinSize = &v - return s -} - -// SetMixedInstancesPolicy sets the MixedInstancesPolicy field's value. -func (s *Group) SetMixedInstancesPolicy(v *MixedInstancesPolicy) *Group { - s.MixedInstancesPolicy = v - return s -} - -// SetNewInstancesProtectedFromScaleIn sets the NewInstancesProtectedFromScaleIn field's value. -func (s *Group) SetNewInstancesProtectedFromScaleIn(v bool) *Group { - s.NewInstancesProtectedFromScaleIn = &v - return s -} - -// SetPlacementGroup sets the PlacementGroup field's value. -func (s *Group) SetPlacementGroup(v string) *Group { - s.PlacementGroup = &v - return s -} - -// SetPredictedCapacity sets the PredictedCapacity field's value. -func (s *Group) SetPredictedCapacity(v int64) *Group { - s.PredictedCapacity = &v - return s -} - -// SetServiceLinkedRoleARN sets the ServiceLinkedRoleARN field's value. -func (s *Group) SetServiceLinkedRoleARN(v string) *Group { - s.ServiceLinkedRoleARN = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *Group) SetStatus(v string) *Group { - s.Status = &v - return s -} - -// SetSuspendedProcesses sets the SuspendedProcesses field's value. -func (s *Group) SetSuspendedProcesses(v []*SuspendedProcess) *Group { - s.SuspendedProcesses = v - return s -} - -// SetTags sets the Tags field's value. -func (s *Group) SetTags(v []*TagDescription) *Group { - s.Tags = v - return s -} - -// SetTargetGroupARNs sets the TargetGroupARNs field's value. -func (s *Group) SetTargetGroupARNs(v []*string) *Group { - s.TargetGroupARNs = v - return s -} - -// SetTerminationPolicies sets the TerminationPolicies field's value. -func (s *Group) SetTerminationPolicies(v []*string) *Group { - s.TerminationPolicies = v - return s -} - -// SetVPCZoneIdentifier sets the VPCZoneIdentifier field's value. -func (s *Group) SetVPCZoneIdentifier(v string) *Group { - s.VPCZoneIdentifier = &v - return s -} - -// SetWarmPoolConfiguration sets the WarmPoolConfiguration field's value. -func (s *Group) SetWarmPoolConfiguration(v *WarmPoolConfiguration) *Group { - s.WarmPoolConfiguration = v - return s -} - -// SetWarmPoolSize sets the WarmPoolSize field's value. -func (s *Group) SetWarmPoolSize(v int64) *Group { - s.WarmPoolSize = &v - return s -} - -// Describes an EC2 instance. -type Instance struct { - _ struct{} `type:"structure"` - - // The Availability Zone in which the instance is running. - // - // AvailabilityZone is a required field - AvailabilityZone *string `min:"1" type:"string" required:"true"` - - // The last reported health status of the instance. "Healthy" means that the - // instance is healthy and should remain in service. "Unhealthy" means that - // the instance is unhealthy and that Amazon EC2 Auto Scaling should terminate - // and replace it. - // - // HealthStatus is a required field - HealthStatus *string `min:"1" type:"string" required:"true"` - - // The ID of the instance. - // - // InstanceId is a required field - InstanceId *string `min:"1" type:"string" required:"true"` - - // The instance type of the EC2 instance. - InstanceType *string `min:"1" type:"string"` - - // The launch configuration associated with the instance. - LaunchConfigurationName *string `min:"1" type:"string"` - - // The launch template for the instance. - LaunchTemplate *LaunchTemplateSpecification `type:"structure"` - - // A description of the current lifecycle state. The Quarantined state is not - // used. For information about lifecycle states, see Instance lifecycle (https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // LifecycleState is a required field - LifecycleState *string `type:"string" required:"true" enum:"LifecycleState"` - - // Indicates whether the instance is protected from termination by Amazon EC2 - // Auto Scaling when scaling in. - // - // ProtectedFromScaleIn is a required field - ProtectedFromScaleIn *bool `type:"boolean" required:"true"` - - // The number of capacity units contributed by the instance based on its instance - // type. - // - // Valid Range: Minimum value of 1. Maximum value of 999. - WeightedCapacity *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Instance) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Instance) GoString() string { - return s.String() -} - -// SetAvailabilityZone sets the AvailabilityZone field's value. -func (s *Instance) SetAvailabilityZone(v string) *Instance { - s.AvailabilityZone = &v - return s -} - -// SetHealthStatus sets the HealthStatus field's value. -func (s *Instance) SetHealthStatus(v string) *Instance { - s.HealthStatus = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *Instance) SetInstanceId(v string) *Instance { - s.InstanceId = &v - return s -} - -// SetInstanceType sets the InstanceType field's value. -func (s *Instance) SetInstanceType(v string) *Instance { - s.InstanceType = &v - return s -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *Instance) SetLaunchConfigurationName(v string) *Instance { - s.LaunchConfigurationName = &v - return s -} - -// SetLaunchTemplate sets the LaunchTemplate field's value. -func (s *Instance) SetLaunchTemplate(v *LaunchTemplateSpecification) *Instance { - s.LaunchTemplate = v - return s -} - -// SetLifecycleState sets the LifecycleState field's value. -func (s *Instance) SetLifecycleState(v string) *Instance { - s.LifecycleState = &v - return s -} - -// SetProtectedFromScaleIn sets the ProtectedFromScaleIn field's value. -func (s *Instance) SetProtectedFromScaleIn(v bool) *Instance { - s.ProtectedFromScaleIn = &v - return s -} - -// SetWeightedCapacity sets the WeightedCapacity field's value. -func (s *Instance) SetWeightedCapacity(v string) *Instance { - s.WeightedCapacity = &v - return s -} - -// Describes an EC2 instance associated with an Auto Scaling group. -type InstanceDetails struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group for the instance. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The Availability Zone for the instance. - // - // AvailabilityZone is a required field - AvailabilityZone *string `min:"1" type:"string" required:"true"` - - // The last reported health status of this instance. "Healthy" means that the - // instance is healthy and should remain in service. "Unhealthy" means that - // the instance is unhealthy and Amazon EC2 Auto Scaling should terminate and - // replace it. - // - // HealthStatus is a required field - HealthStatus *string `min:"1" type:"string" required:"true"` - - // The ID of the instance. - // - // InstanceId is a required field - InstanceId *string `min:"1" type:"string" required:"true"` - - // The instance type of the EC2 instance. - InstanceType *string `min:"1" type:"string"` - - // The launch configuration used to launch the instance. This value is not available - // if you attached the instance to the Auto Scaling group. - LaunchConfigurationName *string `min:"1" type:"string"` - - // The launch template for the instance. - LaunchTemplate *LaunchTemplateSpecification `type:"structure"` - - // The lifecycle state for the instance. The Quarantined state is not used. - // For information about lifecycle states, see Instance lifecycle (https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Valid values: Pending | Pending:Wait | Pending:Proceed | Quarantined | InService - // | Terminating | Terminating:Wait | Terminating:Proceed | Terminated | Detaching - // | Detached | EnteringStandby | Standby | Warmed:Pending | Warmed:Pending:Wait - // | Warmed:Pending:Proceed | Warmed:Terminating | Warmed:Terminating:Wait | - // Warmed:Terminating:Proceed | Warmed:Terminated | Warmed:Stopped | Warmed:Running - // - // LifecycleState is a required field - LifecycleState *string `min:"1" type:"string" required:"true"` - - // Indicates whether the instance is protected from termination by Amazon EC2 - // Auto Scaling when scaling in. - // - // ProtectedFromScaleIn is a required field - ProtectedFromScaleIn *bool `type:"boolean" required:"true"` - - // The number of capacity units contributed by the instance based on its instance - // type. - // - // Valid Range: Minimum value of 1. Maximum value of 999. - WeightedCapacity *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceDetails) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceDetails) GoString() string { - return s.String() -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *InstanceDetails) SetAutoScalingGroupName(v string) *InstanceDetails { - s.AutoScalingGroupName = &v - return s -} - -// SetAvailabilityZone sets the AvailabilityZone field's value. -func (s *InstanceDetails) SetAvailabilityZone(v string) *InstanceDetails { - s.AvailabilityZone = &v - return s -} - -// SetHealthStatus sets the HealthStatus field's value. -func (s *InstanceDetails) SetHealthStatus(v string) *InstanceDetails { - s.HealthStatus = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *InstanceDetails) SetInstanceId(v string) *InstanceDetails { - s.InstanceId = &v - return s -} - -// SetInstanceType sets the InstanceType field's value. -func (s *InstanceDetails) SetInstanceType(v string) *InstanceDetails { - s.InstanceType = &v - return s -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *InstanceDetails) SetLaunchConfigurationName(v string) *InstanceDetails { - s.LaunchConfigurationName = &v - return s -} - -// SetLaunchTemplate sets the LaunchTemplate field's value. -func (s *InstanceDetails) SetLaunchTemplate(v *LaunchTemplateSpecification) *InstanceDetails { - s.LaunchTemplate = v - return s -} - -// SetLifecycleState sets the LifecycleState field's value. -func (s *InstanceDetails) SetLifecycleState(v string) *InstanceDetails { - s.LifecycleState = &v - return s -} - -// SetProtectedFromScaleIn sets the ProtectedFromScaleIn field's value. -func (s *InstanceDetails) SetProtectedFromScaleIn(v bool) *InstanceDetails { - s.ProtectedFromScaleIn = &v - return s -} - -// SetWeightedCapacity sets the WeightedCapacity field's value. -func (s *InstanceDetails) SetWeightedCapacity(v string) *InstanceDetails { - s.WeightedCapacity = &v - return s -} - -// The metadata options for the instances. For more information, see Configuring -// the Instance Metadata Options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) -// in the Amazon EC2 Auto Scaling User Guide. -type InstanceMetadataOptions struct { - _ struct{} `type:"structure"` - - // This parameter enables or disables the HTTP metadata endpoint on your instances. - // If the parameter is not specified, the default state is enabled. - // - // If you specify a value of disabled, you will not be able to access your instance - // metadata. - HttpEndpoint *string `type:"string" enum:"InstanceMetadataEndpointState"` - - // The desired HTTP PUT response hop limit for instance metadata requests. The - // larger the number, the further instance metadata requests can travel. - // - // Default: 1 - HttpPutResponseHopLimit *int64 `min:"1" type:"integer"` - - // The state of token usage for your instance metadata requests. If the parameter - // is not specified in the request, the default state is optional. - // - // If the state is optional, you can choose to retrieve instance metadata with - // or without a signed token header on your request. If you retrieve the IAM - // role credentials without a token, the version 1.0 role credentials are returned. - // If you retrieve the IAM role credentials using a valid signed token, the - // version 2.0 role credentials are returned. - // - // If the state is required, you must send a signed token header with any instance - // metadata retrieval requests. In this state, retrieving the IAM role credentials - // always returns the version 2.0 credentials; the version 1.0 credentials are - // not available. - HttpTokens *string `type:"string" enum:"InstanceMetadataHttpTokensState"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceMetadataOptions) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceMetadataOptions) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InstanceMetadataOptions) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InstanceMetadataOptions"} - if s.HttpPutResponseHopLimit != nil && *s.HttpPutResponseHopLimit < 1 { - invalidParams.Add(request.NewErrParamMinValue("HttpPutResponseHopLimit", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHttpEndpoint sets the HttpEndpoint field's value. -func (s *InstanceMetadataOptions) SetHttpEndpoint(v string) *InstanceMetadataOptions { - s.HttpEndpoint = &v - return s -} - -// SetHttpPutResponseHopLimit sets the HttpPutResponseHopLimit field's value. -func (s *InstanceMetadataOptions) SetHttpPutResponseHopLimit(v int64) *InstanceMetadataOptions { - s.HttpPutResponseHopLimit = &v - return s -} - -// SetHttpTokens sets the HttpTokens field's value. -func (s *InstanceMetadataOptions) SetHttpTokens(v string) *InstanceMetadataOptions { - s.HttpTokens = &v - return s -} - -// Describes whether detailed monitoring is enabled for the Auto Scaling instances. -type InstanceMonitoring struct { - _ struct{} `type:"structure"` - - // If true, detailed monitoring is enabled. Otherwise, basic monitoring is enabled. - Enabled *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceMonitoring) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceMonitoring) GoString() string { - return s.String() -} - -// SetEnabled sets the Enabled field's value. -func (s *InstanceMonitoring) SetEnabled(v bool) *InstanceMonitoring { - s.Enabled = &v - return s -} - -// Describes an instance refresh for an Auto Scaling group. -type InstanceRefresh struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // Describes the specific update you want to deploy. - DesiredConfiguration *DesiredConfiguration `type:"structure"` - - // The date and time at which the instance refresh ended. - EndTime *time.Time `type:"timestamp"` - - // The instance refresh ID. - InstanceRefreshId *string `min:"1" type:"string"` - - // The number of instances remaining to update before the instance refresh is - // complete. - InstancesToUpdate *int64 `type:"integer"` - - // The percentage of the instance refresh that is complete. For each instance - // replacement, Amazon EC2 Auto Scaling tracks the instance's health status - // and warm-up time. When the instance's health status changes to healthy and - // the specified warm-up time passes, the instance is considered updated and - // is added to the percentage complete. - PercentageComplete *int64 `type:"integer"` - - // Describes the preferences for an instance refresh. - Preferences *RefreshPreferences `type:"structure"` - - // Additional progress details for an Auto Scaling group that has a warm pool. - ProgressDetails *InstanceRefreshProgressDetails `type:"structure"` - - // The date and time at which the instance refresh began. - StartTime *time.Time `type:"timestamp"` - - // The current status for the instance refresh operation: - // - // * Pending - The request was created, but the operation has not started. - // - // * InProgress - The operation is in progress. - // - // * Successful - The operation completed successfully. - // - // * Failed - The operation failed to complete. You can troubleshoot using - // the status reason and the scaling activities. - // - // * Cancelling - An ongoing operation is being cancelled. Cancellation does - // not roll back any replacements that have already been completed, but it - // prevents new replacements from being started. - // - // * Cancelled - The operation is cancelled. - Status *string `type:"string" enum:"InstanceRefreshStatus"` - - // Provides more details about the current status of the instance refresh. - StatusReason *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefresh) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefresh) GoString() string { - return s.String() -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *InstanceRefresh) SetAutoScalingGroupName(v string) *InstanceRefresh { - s.AutoScalingGroupName = &v - return s -} - -// SetDesiredConfiguration sets the DesiredConfiguration field's value. -func (s *InstanceRefresh) SetDesiredConfiguration(v *DesiredConfiguration) *InstanceRefresh { - s.DesiredConfiguration = v - return s -} - -// SetEndTime sets the EndTime field's value. -func (s *InstanceRefresh) SetEndTime(v time.Time) *InstanceRefresh { - s.EndTime = &v - return s -} - -// SetInstanceRefreshId sets the InstanceRefreshId field's value. -func (s *InstanceRefresh) SetInstanceRefreshId(v string) *InstanceRefresh { - s.InstanceRefreshId = &v - return s -} - -// SetInstancesToUpdate sets the InstancesToUpdate field's value. -func (s *InstanceRefresh) SetInstancesToUpdate(v int64) *InstanceRefresh { - s.InstancesToUpdate = &v - return s -} - -// SetPercentageComplete sets the PercentageComplete field's value. -func (s *InstanceRefresh) SetPercentageComplete(v int64) *InstanceRefresh { - s.PercentageComplete = &v - return s -} - -// SetPreferences sets the Preferences field's value. -func (s *InstanceRefresh) SetPreferences(v *RefreshPreferences) *InstanceRefresh { - s.Preferences = v - return s -} - -// SetProgressDetails sets the ProgressDetails field's value. -func (s *InstanceRefresh) SetProgressDetails(v *InstanceRefreshProgressDetails) *InstanceRefresh { - s.ProgressDetails = v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *InstanceRefresh) SetStartTime(v time.Time) *InstanceRefresh { - s.StartTime = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *InstanceRefresh) SetStatus(v string) *InstanceRefresh { - s.Status = &v - return s -} - -// SetStatusReason sets the StatusReason field's value. -func (s *InstanceRefresh) SetStatusReason(v string) *InstanceRefresh { - s.StatusReason = &v - return s -} - -// Reports the progress of an instance refresh on instances that are in the -// Auto Scaling group. -type InstanceRefreshLivePoolProgress struct { - _ struct{} `type:"structure"` - - // The number of instances remaining to update. - InstancesToUpdate *int64 `type:"integer"` - - // The percentage of instances in the Auto Scaling group that have been replaced. - // For each instance replacement, Amazon EC2 Auto Scaling tracks the instance's - // health status and warm-up time. When the instance's health status changes - // to healthy and the specified warm-up time passes, the instance is considered - // updated and is added to the percentage complete. - PercentageComplete *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefreshLivePoolProgress) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefreshLivePoolProgress) GoString() string { - return s.String() -} - -// SetInstancesToUpdate sets the InstancesToUpdate field's value. -func (s *InstanceRefreshLivePoolProgress) SetInstancesToUpdate(v int64) *InstanceRefreshLivePoolProgress { - s.InstancesToUpdate = &v - return s -} - -// SetPercentageComplete sets the PercentageComplete field's value. -func (s *InstanceRefreshLivePoolProgress) SetPercentageComplete(v int64) *InstanceRefreshLivePoolProgress { - s.PercentageComplete = &v - return s -} - -// Reports the progress of an instance refresh on an Auto Scaling group that -// has a warm pool. This includes separate details for instances in the warm -// pool and instances in the Auto Scaling group (the live pool). -type InstanceRefreshProgressDetails struct { - _ struct{} `type:"structure"` - - // Indicates the progress of an instance refresh on instances that are in the - // Auto Scaling group. - LivePoolProgress *InstanceRefreshLivePoolProgress `type:"structure"` - - // Indicates the progress of an instance refresh on instances that are in the - // warm pool. - WarmPoolProgress *InstanceRefreshWarmPoolProgress `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefreshProgressDetails) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefreshProgressDetails) GoString() string { - return s.String() -} - -// SetLivePoolProgress sets the LivePoolProgress field's value. -func (s *InstanceRefreshProgressDetails) SetLivePoolProgress(v *InstanceRefreshLivePoolProgress) *InstanceRefreshProgressDetails { - s.LivePoolProgress = v - return s -} - -// SetWarmPoolProgress sets the WarmPoolProgress field's value. -func (s *InstanceRefreshProgressDetails) SetWarmPoolProgress(v *InstanceRefreshWarmPoolProgress) *InstanceRefreshProgressDetails { - s.WarmPoolProgress = v - return s -} - -// Reports the progress of an instance refresh on instances that are in the -// warm pool. -type InstanceRefreshWarmPoolProgress struct { - _ struct{} `type:"structure"` - - // The number of instances remaining to update. - InstancesToUpdate *int64 `type:"integer"` - - // The percentage of instances in the warm pool that have been replaced. For - // each instance replacement, Amazon EC2 Auto Scaling tracks the instance's - // health status and warm-up time. When the instance's health status changes - // to healthy and the specified warm-up time passes, the instance is considered - // updated and is added to the percentage complete. - PercentageComplete *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefreshWarmPoolProgress) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRefreshWarmPoolProgress) GoString() string { - return s.String() -} - -// SetInstancesToUpdate sets the InstancesToUpdate field's value. -func (s *InstanceRefreshWarmPoolProgress) SetInstancesToUpdate(v int64) *InstanceRefreshWarmPoolProgress { - s.InstancesToUpdate = &v - return s -} - -// SetPercentageComplete sets the PercentageComplete field's value. -func (s *InstanceRefreshWarmPoolProgress) SetPercentageComplete(v int64) *InstanceRefreshWarmPoolProgress { - s.PercentageComplete = &v - return s -} - -// The attributes for the instance types for a mixed instances policy. Amazon -// EC2 Auto Scaling uses your specified requirements to identify instance types. -// Then, it uses your On-Demand and Spot allocation strategies to launch instances -// from these instance types. -// -// When you specify multiple attributes, you get instance types that satisfy -// all of the specified attributes. If you specify multiple values for an attribute, -// you get instance types that satisfy any of the specified values. -// -// To limit the list of instance types from which Amazon EC2 Auto Scaling can -// identify matching instance types, you can use one of the following parameters, -// but not both in the same request: -// -// - AllowedInstanceTypes - The instance types to include in the list. All -// other instance types are ignored, even if they match your specified attributes. -// -// - ExcludedInstanceTypes - The instance types to exclude from the list, -// even if they match your specified attributes. -// -// You must specify VCpuCount and MemoryMiB. All other attributes are optional. -// Any unspecified optional attribute is set to its default. -// -// For more information, see Creating an Auto Scaling group using attribute-based -// instance type selection (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-instance-type-requirements.html) -// in the Amazon EC2 Auto Scaling User Guide. For help determining which instance -// types match your attributes before you apply them to your Auto Scaling group, -// see Preview instance types with specified attributes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-attribute-based-instance-type-selection.html#ec2fleet-get-instance-types-from-instance-requirements) -// in the Amazon EC2 User Guide for Linux Instances. -type InstanceRequirements struct { - _ struct{} `type:"structure"` - - // The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web - // Services Inferentia chips) for an instance type. - // - // To exclude accelerator-enabled instance types, set Max to 0. - // - // Default: No minimum or maximum limits - AcceleratorCount *AcceleratorCountRequest `type:"structure"` - - // Indicates whether instance types must have accelerators by specific manufacturers. - // - // * For instance types with NVIDIA devices, specify nvidia. - // - // * For instance types with AMD devices, specify amd. - // - // * For instance types with Amazon Web Services devices, specify amazon-web-services. - // - // * For instance types with Xilinx devices, specify xilinx. - // - // Default: Any manufacturer - AcceleratorManufacturers []*string `type:"list" enum:"AcceleratorManufacturer"` - - // Lists the accelerators that must be on an instance type. - // - // * For instance types with NVIDIA A100 GPUs, specify a100. - // - // * For instance types with NVIDIA V100 GPUs, specify v100. - // - // * For instance types with NVIDIA K80 GPUs, specify k80. - // - // * For instance types with NVIDIA T4 GPUs, specify t4. - // - // * For instance types with NVIDIA M60 GPUs, specify m60. - // - // * For instance types with AMD Radeon Pro V520 GPUs, specify radeon-pro-v520. - // - // * For instance types with Xilinx VU9P FPGAs, specify vu9p. - // - // Default: Any accelerator - AcceleratorNames []*string `type:"list" enum:"AcceleratorName"` - - // The minimum and maximum total memory size for the accelerators on an instance - // type, in MiB. - // - // Default: No minimum or maximum limits - AcceleratorTotalMemoryMiB *AcceleratorTotalMemoryMiBRequest `type:"structure"` - - // Lists the accelerator types that must be on an instance type. - // - // * For instance types with GPU accelerators, specify gpu. - // - // * For instance types with FPGA accelerators, specify fpga. - // - // * For instance types with inference accelerators, specify inference. - // - // Default: Any accelerator type - AcceleratorTypes []*string `type:"list" enum:"AcceleratorType"` - - // The instance types to apply your specified attributes against. All other - // instance types are ignored, even if they match your specified attributes. - // - // You can use strings with one or more wild cards, represented by an asterisk - // (*), to allow an instance type, size, or generation. The following are examples: - // m5.8xlarge, c5*.*, m5a.*, r*, *3*. - // - // For example, if you specify c5*, Amazon EC2 Auto Scaling will allow the entire - // C5 instance family, which includes all C5a and C5n instance types. If you - // specify m5a.*, Amazon EC2 Auto Scaling will allow all the M5a instance types, - // but not the M5n instance types. - // - // If you specify AllowedInstanceTypes, you can't specify ExcludedInstanceTypes. - // - // Default: All instance types - AllowedInstanceTypes []*string `type:"list"` - - // Indicates whether bare metal instance types are included, excluded, or required. - // - // Default: excluded - BareMetal *string `type:"string" enum:"BareMetal"` - - // The minimum and maximum baseline bandwidth performance for an instance type, - // in Mbps. For more information, see Amazon EBS–optimized instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // Default: No minimum or maximum limits - BaselineEbsBandwidthMbps *BaselineEbsBandwidthMbpsRequest `type:"structure"` - - // Indicates whether burstable performance instance types are included, excluded, - // or required. For more information, see Burstable performance instances (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // Default: excluded - BurstablePerformance *string `type:"string" enum:"BurstablePerformance"` - - // Lists which specific CPU manufacturers to include. - // - // * For instance types with Intel CPUs, specify intel. - // - // * For instance types with AMD CPUs, specify amd. - // - // * For instance types with Amazon Web Services CPUs, specify amazon-web-services. - // - // Don't confuse the CPU hardware manufacturer with the CPU hardware architecture. - // Instances will be launched with a compatible CPU architecture based on the - // Amazon Machine Image (AMI) that you specify in your launch template. - // - // Default: Any manufacturer - CpuManufacturers []*string `type:"list" enum:"CpuManufacturer"` - - // The instance types to exclude. You can use strings with one or more wild - // cards, represented by an asterisk (*), to exclude an instance family, type, - // size, or generation. The following are examples: m5.8xlarge, c5*.*, m5a.*, - // r*, *3*. - // - // For example, if you specify c5*, you are excluding the entire C5 instance - // family, which includes all C5a and C5n instance types. If you specify m5a.*, - // Amazon EC2 Auto Scaling will exclude all the M5a instance types, but not - // the M5n instance types. - // - // If you specify ExcludedInstanceTypes, you can't specify AllowedInstanceTypes. - // - // Default: No excluded instance types - ExcludedInstanceTypes []*string `type:"list"` - - // Indicates whether current or previous generation instance types are included. - // - // * For current generation instance types, specify current. The current - // generation includes EC2 instance types currently recommended for use. - // This typically includes the latest two to three generations in each instance - // family. For more information, see Instance types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // * For previous generation instance types, specify previous. - // - // Default: Any current or previous generation - InstanceGenerations []*string `type:"list" enum:"InstanceGeneration"` - - // Indicates whether instance types with instance store volumes are included, - // excluded, or required. For more information, see Amazon EC2 instance store - // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // Default: included - LocalStorage *string `type:"string" enum:"LocalStorage"` - - // Indicates the type of local storage that is required. - // - // * For instance types with hard disk drive (HDD) storage, specify hdd. - // - // * For instance types with solid state drive (SSD) storage, specify ssd. - // - // Default: Any local storage type - LocalStorageTypes []*string `type:"list" enum:"LocalStorageType"` - - // The minimum and maximum amount of memory per vCPU for an instance type, in - // GiB. - // - // Default: No minimum or maximum limits - MemoryGiBPerVCpu *MemoryGiBPerVCpuRequest `type:"structure"` - - // The minimum and maximum instance memory size for an instance type, in MiB. - // - // MemoryMiB is a required field - MemoryMiB *MemoryMiBRequest `type:"structure" required:"true"` - - // The minimum and maximum amount of network bandwidth, in gigabits per second - // (Gbps). - // - // Default: No minimum or maximum limits - NetworkBandwidthGbps *NetworkBandwidthGbpsRequest `type:"structure"` - - // The minimum and maximum number of network interfaces for an instance type. - // - // Default: No minimum or maximum limits - NetworkInterfaceCount *NetworkInterfaceCountRequest `type:"structure"` - - // The price protection threshold for On-Demand Instances. This is the maximum - // you’ll pay for an On-Demand Instance, expressed as a percentage higher - // than the least expensive current generation M, C, or R instance type with - // your specified attributes. When Amazon EC2 Auto Scaling selects instance - // types with your attributes, we will exclude instance types whose price is - // higher than your threshold. The parameter accepts an integer, which Amazon - // EC2 Auto Scaling interprets as a percentage. To turn off price protection, - // specify a high value, such as 999999. - // - // If you set DesiredCapacityType to vcpu or memory-mib, the price protection - // threshold is applied based on the per vCPU or per memory price instead of - // the per instance price. - // - // Default: 20 - OnDemandMaxPricePercentageOverLowestPrice *int64 `type:"integer"` - - // Indicates whether instance types must provide On-Demand Instance hibernation - // support. - // - // Default: false - RequireHibernateSupport *bool `type:"boolean"` - - // The price protection threshold for Spot Instances. This is the maximum you’ll - // pay for a Spot Instance, expressed as a percentage higher than the least - // expensive current generation M, C, or R instance type with your specified - // attributes. When Amazon EC2 Auto Scaling selects instance types with your - // attributes, we will exclude instance types whose price is higher than your - // threshold. The parameter accepts an integer, which Amazon EC2 Auto Scaling - // interprets as a percentage. To turn off price protection, specify a high - // value, such as 999999. - // - // If you set DesiredCapacityType to vcpu or memory-mib, the price protection - // threshold is applied based on the per vCPU or per memory price instead of - // the per instance price. - // - // Default: 100 - SpotMaxPricePercentageOverLowestPrice *int64 `type:"integer"` - - // The minimum and maximum total local storage size for an instance type, in - // GB. - // - // Default: No minimum or maximum limits - TotalLocalStorageGB *TotalLocalStorageGBRequest `type:"structure"` - - // The minimum and maximum number of vCPUs for an instance type. - // - // VCpuCount is a required field - VCpuCount *VCpuCountRequest `type:"structure" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRequirements) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceRequirements) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InstanceRequirements) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InstanceRequirements"} - if s.MemoryMiB == nil { - invalidParams.Add(request.NewErrParamRequired("MemoryMiB")) - } - if s.VCpuCount == nil { - invalidParams.Add(request.NewErrParamRequired("VCpuCount")) - } - if s.MemoryMiB != nil { - if err := s.MemoryMiB.Validate(); err != nil { - invalidParams.AddNested("MemoryMiB", err.(request.ErrInvalidParams)) - } - } - if s.VCpuCount != nil { - if err := s.VCpuCount.Validate(); err != nil { - invalidParams.AddNested("VCpuCount", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAcceleratorCount sets the AcceleratorCount field's value. -func (s *InstanceRequirements) SetAcceleratorCount(v *AcceleratorCountRequest) *InstanceRequirements { - s.AcceleratorCount = v - return s -} - -// SetAcceleratorManufacturers sets the AcceleratorManufacturers field's value. -func (s *InstanceRequirements) SetAcceleratorManufacturers(v []*string) *InstanceRequirements { - s.AcceleratorManufacturers = v - return s -} - -// SetAcceleratorNames sets the AcceleratorNames field's value. -func (s *InstanceRequirements) SetAcceleratorNames(v []*string) *InstanceRequirements { - s.AcceleratorNames = v - return s -} - -// SetAcceleratorTotalMemoryMiB sets the AcceleratorTotalMemoryMiB field's value. -func (s *InstanceRequirements) SetAcceleratorTotalMemoryMiB(v *AcceleratorTotalMemoryMiBRequest) *InstanceRequirements { - s.AcceleratorTotalMemoryMiB = v - return s -} - -// SetAcceleratorTypes sets the AcceleratorTypes field's value. -func (s *InstanceRequirements) SetAcceleratorTypes(v []*string) *InstanceRequirements { - s.AcceleratorTypes = v - return s -} - -// SetAllowedInstanceTypes sets the AllowedInstanceTypes field's value. -func (s *InstanceRequirements) SetAllowedInstanceTypes(v []*string) *InstanceRequirements { - s.AllowedInstanceTypes = v - return s -} - -// SetBareMetal sets the BareMetal field's value. -func (s *InstanceRequirements) SetBareMetal(v string) *InstanceRequirements { - s.BareMetal = &v - return s -} - -// SetBaselineEbsBandwidthMbps sets the BaselineEbsBandwidthMbps field's value. -func (s *InstanceRequirements) SetBaselineEbsBandwidthMbps(v *BaselineEbsBandwidthMbpsRequest) *InstanceRequirements { - s.BaselineEbsBandwidthMbps = v - return s -} - -// SetBurstablePerformance sets the BurstablePerformance field's value. -func (s *InstanceRequirements) SetBurstablePerformance(v string) *InstanceRequirements { - s.BurstablePerformance = &v - return s -} - -// SetCpuManufacturers sets the CpuManufacturers field's value. -func (s *InstanceRequirements) SetCpuManufacturers(v []*string) *InstanceRequirements { - s.CpuManufacturers = v - return s -} - -// SetExcludedInstanceTypes sets the ExcludedInstanceTypes field's value. -func (s *InstanceRequirements) SetExcludedInstanceTypes(v []*string) *InstanceRequirements { - s.ExcludedInstanceTypes = v - return s -} - -// SetInstanceGenerations sets the InstanceGenerations field's value. -func (s *InstanceRequirements) SetInstanceGenerations(v []*string) *InstanceRequirements { - s.InstanceGenerations = v - return s -} - -// SetLocalStorage sets the LocalStorage field's value. -func (s *InstanceRequirements) SetLocalStorage(v string) *InstanceRequirements { - s.LocalStorage = &v - return s -} - -// SetLocalStorageTypes sets the LocalStorageTypes field's value. -func (s *InstanceRequirements) SetLocalStorageTypes(v []*string) *InstanceRequirements { - s.LocalStorageTypes = v - return s -} - -// SetMemoryGiBPerVCpu sets the MemoryGiBPerVCpu field's value. -func (s *InstanceRequirements) SetMemoryGiBPerVCpu(v *MemoryGiBPerVCpuRequest) *InstanceRequirements { - s.MemoryGiBPerVCpu = v - return s -} - -// SetMemoryMiB sets the MemoryMiB field's value. -func (s *InstanceRequirements) SetMemoryMiB(v *MemoryMiBRequest) *InstanceRequirements { - s.MemoryMiB = v - return s -} - -// SetNetworkBandwidthGbps sets the NetworkBandwidthGbps field's value. -func (s *InstanceRequirements) SetNetworkBandwidthGbps(v *NetworkBandwidthGbpsRequest) *InstanceRequirements { - s.NetworkBandwidthGbps = v - return s -} - -// SetNetworkInterfaceCount sets the NetworkInterfaceCount field's value. -func (s *InstanceRequirements) SetNetworkInterfaceCount(v *NetworkInterfaceCountRequest) *InstanceRequirements { - s.NetworkInterfaceCount = v - return s -} - -// SetOnDemandMaxPricePercentageOverLowestPrice sets the OnDemandMaxPricePercentageOverLowestPrice field's value. -func (s *InstanceRequirements) SetOnDemandMaxPricePercentageOverLowestPrice(v int64) *InstanceRequirements { - s.OnDemandMaxPricePercentageOverLowestPrice = &v - return s -} - -// SetRequireHibernateSupport sets the RequireHibernateSupport field's value. -func (s *InstanceRequirements) SetRequireHibernateSupport(v bool) *InstanceRequirements { - s.RequireHibernateSupport = &v - return s -} - -// SetSpotMaxPricePercentageOverLowestPrice sets the SpotMaxPricePercentageOverLowestPrice field's value. -func (s *InstanceRequirements) SetSpotMaxPricePercentageOverLowestPrice(v int64) *InstanceRequirements { - s.SpotMaxPricePercentageOverLowestPrice = &v - return s -} - -// SetTotalLocalStorageGB sets the TotalLocalStorageGB field's value. -func (s *InstanceRequirements) SetTotalLocalStorageGB(v *TotalLocalStorageGBRequest) *InstanceRequirements { - s.TotalLocalStorageGB = v - return s -} - -// SetVCpuCount sets the VCpuCount field's value. -func (s *InstanceRequirements) SetVCpuCount(v *VCpuCountRequest) *InstanceRequirements { - s.VCpuCount = v - return s -} - -// Describes an instance reuse policy for a warm pool. -// -// For more information, see Warm pools for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) -// in the Amazon EC2 Auto Scaling User Guide. -type InstanceReusePolicy struct { - _ struct{} `type:"structure"` - - // Specifies whether instances in the Auto Scaling group can be returned to - // the warm pool on scale in. - ReuseOnScaleIn *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceReusePolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceReusePolicy) GoString() string { - return s.String() -} - -// SetReuseOnScaleIn sets the ReuseOnScaleIn field's value. -func (s *InstanceReusePolicy) SetReuseOnScaleIn(v bool) *InstanceReusePolicy { - s.ReuseOnScaleIn = &v - return s -} - -// Use this structure to specify the distribution of On-Demand Instances and -// Spot Instances and the allocation strategies used to fulfill On-Demand and -// Spot capacities for a mixed instances policy. -type InstancesDistribution struct { - _ struct{} `type:"structure"` - - // The allocation strategy to apply to your On-Demand Instances when they are - // launched. Possible instance types are determined by the launch template overrides - // that you specify. - // - // The following lists the valid values: - // - // lowest-price - // - // Uses price to determine which instance types are the highest priority, launching - // the lowest priced instance types within an Availability Zone first. This - // is the default value for Auto Scaling groups that specify InstanceRequirements. - // - // prioritized - // - // You set the order of instance types for the launch template overrides from - // highest to lowest priority (from first to last in the list). Amazon EC2 Auto - // Scaling launches your highest priority instance types first. If all your - // On-Demand capacity cannot be fulfilled using your highest priority instance - // type, then Amazon EC2 Auto Scaling launches the remaining capacity using - // the second priority instance type, and so on. This is the default value for - // Auto Scaling groups that don't specify InstanceRequirements and cannot be - // used for groups that do. - OnDemandAllocationStrategy *string `type:"string"` - - // The minimum amount of the Auto Scaling group's capacity that must be fulfilled - // by On-Demand Instances. This base portion is launched first as your group - // scales. - // - // This number has the same unit of measurement as the group's desired capacity. - // If you change the default unit of measurement (number of instances) by specifying - // weighted capacity values in your launch template overrides list, or by changing - // the default desired capacity type setting of the group, you must specify - // this number using the same unit of measurement. - // - // Default: 0 - OnDemandBaseCapacity *int64 `type:"integer"` - - // Controls the percentages of On-Demand Instances and Spot Instances for your - // additional capacity beyond OnDemandBaseCapacity. Expressed as a number (for - // example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set - // to 100, only On-Demand Instances are used. - // - // Default: 100 - OnDemandPercentageAboveBaseCapacity *int64 `type:"integer"` - - // The allocation strategy to apply to your Spot Instances when they are launched. - // Possible instance types are determined by the launch template overrides that - // you specify. - // - // The following lists the valid values: - // - // capacity-optimized - // - // Requests Spot Instances using pools that are optimally chosen based on the - // available Spot capacity. This strategy has the lowest risk of interruption. - // To give certain instance types a higher chance of launching first, use capacity-optimized-prioritized. - // - // capacity-optimized-prioritized - // - // You set the order of instance types for the launch template overrides from - // highest to lowest priority (from first to last in the list). Amazon EC2 Auto - // Scaling honors the instance type priorities on a best effort basis but optimizes - // for capacity first. Note that if the On-Demand allocation strategy is set - // to prioritized, the same priority is applied when fulfilling On-Demand capacity. - // This is not a valid value for Auto Scaling groups that specify InstanceRequirements. - // - // lowest-price - // - // Requests Spot Instances using the lowest priced pools within an Availability - // Zone, across the number of Spot pools that you specify for the SpotInstancePools - // property. To ensure that your desired capacity is met, you might receive - // Spot Instances from several pools. This is the default value, but it might - // lead to high interruption rates because this strategy only considers instance - // price and not available capacity. - // - // price-capacity-optimized (recommended) - // - // Amazon EC2 Auto Scaling identifies the pools with the highest capacity availability - // for the number of instances that are launching. This means that we will request - // Spot Instances from the pools that we believe have the lowest chance of interruption - // in the near term. Amazon EC2 Auto Scaling then requests Spot Instances from - // the lowest priced of these pools. - SpotAllocationStrategy *string `type:"string"` - - // The number of Spot Instance pools across which to allocate your Spot Instances. - // The Spot pools are determined from the different instance types in the overrides. - // Valid only when the SpotAllocationStrategy is lowest-price. Value must be - // in the range of 1–20. - // - // Default: 2 - SpotInstancePools *int64 `type:"integer"` - - // The maximum price per unit hour that you are willing to pay for a Spot Instance. - // If your maximum price is lower than the Spot price for the instance types - // that you selected, your Spot Instances are not launched. We do not recommend - // specifying a maximum price because it can lead to increased interruptions. - // When Spot Instances launch, you pay the current Spot price. To remove a maximum - // price that you previously set, include the property but specify an empty - // string ("") for the value. - // - // If you specify a maximum price, your instances will be interrupted more frequently - // than if you do not specify one. - // - // Valid Range: Minimum value of 0.001 - SpotMaxPrice *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstancesDistribution) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstancesDistribution) GoString() string { - return s.String() -} - -// SetOnDemandAllocationStrategy sets the OnDemandAllocationStrategy field's value. -func (s *InstancesDistribution) SetOnDemandAllocationStrategy(v string) *InstancesDistribution { - s.OnDemandAllocationStrategy = &v - return s -} - -// SetOnDemandBaseCapacity sets the OnDemandBaseCapacity field's value. -func (s *InstancesDistribution) SetOnDemandBaseCapacity(v int64) *InstancesDistribution { - s.OnDemandBaseCapacity = &v - return s -} - -// SetOnDemandPercentageAboveBaseCapacity sets the OnDemandPercentageAboveBaseCapacity field's value. -func (s *InstancesDistribution) SetOnDemandPercentageAboveBaseCapacity(v int64) *InstancesDistribution { - s.OnDemandPercentageAboveBaseCapacity = &v - return s -} - -// SetSpotAllocationStrategy sets the SpotAllocationStrategy field's value. -func (s *InstancesDistribution) SetSpotAllocationStrategy(v string) *InstancesDistribution { - s.SpotAllocationStrategy = &v - return s -} - -// SetSpotInstancePools sets the SpotInstancePools field's value. -func (s *InstancesDistribution) SetSpotInstancePools(v int64) *InstancesDistribution { - s.SpotInstancePools = &v - return s -} - -// SetSpotMaxPrice sets the SpotMaxPrice field's value. -func (s *InstancesDistribution) SetSpotMaxPrice(v string) *InstancesDistribution { - s.SpotMaxPrice = &v - return s -} - -// Describes a launch configuration. -type LaunchConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies whether to assign a public IPv4 address to the group's instances. - // If the instance is launched into a default subnet, the default is to assign - // a public IPv4 address, unless you disabled the option to assign a public - // IPv4 address on the subnet. If the instance is launched into a nondefault - // subnet, the default is not to assign a public IPv4 address, unless you enabled - // the option to assign a public IPv4 address on the subnet. For more information, - // see Launching Auto Scaling instances in a VPC (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html) - // in the Amazon EC2 Auto Scaling User Guide. - AssociatePublicIpAddress *bool `type:"boolean"` - - // The block device mapping entries that define the block devices to attach - // to the instances at launch. By default, the block devices specified in the - // block device mapping for the AMI are used. For more information, see Block - // Device Mapping (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) - // in the Amazon EC2 User Guide for Linux Instances. - BlockDeviceMappings []*BlockDeviceMapping `type:"list"` - - // Available for backward compatibility. - ClassicLinkVPCId *string `min:"1" type:"string"` - - // Available for backward compatibility. - ClassicLinkVPCSecurityGroups []*string `type:"list"` - - // The creation date and time for the launch configuration. - // - // CreatedTime is a required field - CreatedTime *time.Time `type:"timestamp" required:"true"` - - // Specifies whether the launch configuration is optimized for EBS I/O (true) - // or not (false). For more information, see Amazon EBS-Optimized Instances - // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) in - // the Amazon EC2 User Guide for Linux Instances. - EbsOptimized *bool `type:"boolean"` - - // The name or the Amazon Resource Name (ARN) of the instance profile associated - // with the IAM role for the instance. The instance profile contains the IAM - // role. For more information, see IAM role for applications that run on Amazon - // EC2 instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html) - // in the Amazon EC2 Auto Scaling User Guide. - IamInstanceProfile *string `min:"1" type:"string"` - - // The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. - // For more information, see Find a Linux AMI (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // ImageId is a required field - ImageId *string `min:"1" type:"string" required:"true"` - - // Controls whether instances in this group are launched with detailed (true) - // or basic (false) monitoring. - // - // For more information, see Configure Monitoring for Auto Scaling Instances - // (https://docs.aws.amazon.com/autoscaling/latest/userguide/enable-as-instance-metrics.html) - // in the Amazon EC2 Auto Scaling User Guide. - InstanceMonitoring *InstanceMonitoring `type:"structure"` - - // The instance type for the instances. For information about available instance - // types, see Available instance types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) - // in the Amazon EC2 User Guide for Linux Instances. - // - // InstanceType is a required field - InstanceType *string `min:"1" type:"string" required:"true"` - - // The ID of the kernel associated with the AMI. - KernelId *string `min:"1" type:"string"` - - // The name of the key pair. - // - // For more information, see Amazon EC2 Key Pairs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) - // in the Amazon EC2 User Guide for Linux Instances. - KeyName *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the launch configuration. - LaunchConfigurationARN *string `min:"1" type:"string"` - - // The name of the launch configuration. - // - // LaunchConfigurationName is a required field - LaunchConfigurationName *string `min:"1" type:"string" required:"true"` - - // The metadata options for the instances. For more information, see Configuring - // the Instance Metadata Options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) - // in the Amazon EC2 Auto Scaling User Guide. - MetadataOptions *InstanceMetadataOptions `type:"structure"` - - // The tenancy of the instance, either default or dedicated. An instance with - // dedicated tenancy runs on isolated, single-tenant hardware and can only be - // launched into a VPC. - // - // For more information, see Configuring instance tenancy with Amazon EC2 Auto - // Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-dedicated-instances.html) - // in the Amazon EC2 Auto Scaling User Guide. - PlacementTenancy *string `min:"1" type:"string"` - - // The ID of the RAM disk associated with the AMI. - RamdiskId *string `min:"1" type:"string"` - - // A list that contains the security groups to assign to the instances in the - // Auto Scaling group. For more information, see Security Groups for Your VPC - // (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) - // in the Amazon Virtual Private Cloud User Guide. - SecurityGroups []*string `type:"list"` - - // The maximum hourly price to be paid for any Spot Instance launched to fulfill - // the request. Spot Instances are launched when the price you specify exceeds - // the current Spot price. For more information, see Requesting Spot Instances - // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-launch-spot-instances.html) - // in the Amazon EC2 Auto Scaling User Guide. - SpotPrice *string `min:"1" type:"string"` - - // The user data to make available to the launched EC2 instances. For more information, - // see Instance metadata and user data (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) - // (Linux) and Instance metadata and user data (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html) - // (Windows). If you are using a 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. User data is limited to 16 KB. - UserData *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchConfiguration) GoString() string { - return s.String() -} - -// SetAssociatePublicIpAddress sets the AssociatePublicIpAddress field's value. -func (s *LaunchConfiguration) SetAssociatePublicIpAddress(v bool) *LaunchConfiguration { - s.AssociatePublicIpAddress = &v - return s -} - -// SetBlockDeviceMappings sets the BlockDeviceMappings field's value. -func (s *LaunchConfiguration) SetBlockDeviceMappings(v []*BlockDeviceMapping) *LaunchConfiguration { - s.BlockDeviceMappings = v - return s -} - -// SetClassicLinkVPCId sets the ClassicLinkVPCId field's value. -func (s *LaunchConfiguration) SetClassicLinkVPCId(v string) *LaunchConfiguration { - s.ClassicLinkVPCId = &v - return s -} - -// SetClassicLinkVPCSecurityGroups sets the ClassicLinkVPCSecurityGroups field's value. -func (s *LaunchConfiguration) SetClassicLinkVPCSecurityGroups(v []*string) *LaunchConfiguration { - s.ClassicLinkVPCSecurityGroups = v - return s -} - -// SetCreatedTime sets the CreatedTime field's value. -func (s *LaunchConfiguration) SetCreatedTime(v time.Time) *LaunchConfiguration { - s.CreatedTime = &v - return s -} - -// SetEbsOptimized sets the EbsOptimized field's value. -func (s *LaunchConfiguration) SetEbsOptimized(v bool) *LaunchConfiguration { - s.EbsOptimized = &v - return s -} - -// SetIamInstanceProfile sets the IamInstanceProfile field's value. -func (s *LaunchConfiguration) SetIamInstanceProfile(v string) *LaunchConfiguration { - s.IamInstanceProfile = &v - return s -} - -// SetImageId sets the ImageId field's value. -func (s *LaunchConfiguration) SetImageId(v string) *LaunchConfiguration { - s.ImageId = &v - return s -} - -// SetInstanceMonitoring sets the InstanceMonitoring field's value. -func (s *LaunchConfiguration) SetInstanceMonitoring(v *InstanceMonitoring) *LaunchConfiguration { - s.InstanceMonitoring = v - return s -} - -// SetInstanceType sets the InstanceType field's value. -func (s *LaunchConfiguration) SetInstanceType(v string) *LaunchConfiguration { - s.InstanceType = &v - return s -} - -// SetKernelId sets the KernelId field's value. -func (s *LaunchConfiguration) SetKernelId(v string) *LaunchConfiguration { - s.KernelId = &v - return s -} - -// SetKeyName sets the KeyName field's value. -func (s *LaunchConfiguration) SetKeyName(v string) *LaunchConfiguration { - s.KeyName = &v - return s -} - -// SetLaunchConfigurationARN sets the LaunchConfigurationARN field's value. -func (s *LaunchConfiguration) SetLaunchConfigurationARN(v string) *LaunchConfiguration { - s.LaunchConfigurationARN = &v - return s -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *LaunchConfiguration) SetLaunchConfigurationName(v string) *LaunchConfiguration { - s.LaunchConfigurationName = &v - return s -} - -// SetMetadataOptions sets the MetadataOptions field's value. -func (s *LaunchConfiguration) SetMetadataOptions(v *InstanceMetadataOptions) *LaunchConfiguration { - s.MetadataOptions = v - return s -} - -// SetPlacementTenancy sets the PlacementTenancy field's value. -func (s *LaunchConfiguration) SetPlacementTenancy(v string) *LaunchConfiguration { - s.PlacementTenancy = &v - return s -} - -// SetRamdiskId sets the RamdiskId field's value. -func (s *LaunchConfiguration) SetRamdiskId(v string) *LaunchConfiguration { - s.RamdiskId = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *LaunchConfiguration) SetSecurityGroups(v []*string) *LaunchConfiguration { - s.SecurityGroups = v - return s -} - -// SetSpotPrice sets the SpotPrice field's value. -func (s *LaunchConfiguration) SetSpotPrice(v string) *LaunchConfiguration { - s.SpotPrice = &v - return s -} - -// SetUserData sets the UserData field's value. -func (s *LaunchConfiguration) SetUserData(v string) *LaunchConfiguration { - s.UserData = &v - return s -} - -// Use this structure to specify the launch templates and instance types (overrides) -// for a mixed instances policy. -type LaunchTemplate struct { - _ struct{} `type:"structure"` - - // The launch template. - LaunchTemplateSpecification *LaunchTemplateSpecification `type:"structure"` - - // Any properties that you specify override the same properties in the launch - // template. - Overrides []*LaunchTemplateOverrides `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchTemplate) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchTemplate) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LaunchTemplate) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LaunchTemplate"} - if s.LaunchTemplateSpecification != nil { - if err := s.LaunchTemplateSpecification.Validate(); err != nil { - invalidParams.AddNested("LaunchTemplateSpecification", err.(request.ErrInvalidParams)) - } - } - if s.Overrides != nil { - for i, v := range s.Overrides { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Overrides", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLaunchTemplateSpecification sets the LaunchTemplateSpecification field's value. -func (s *LaunchTemplate) SetLaunchTemplateSpecification(v *LaunchTemplateSpecification) *LaunchTemplate { - s.LaunchTemplateSpecification = v - return s -} - -// SetOverrides sets the Overrides field's value. -func (s *LaunchTemplate) SetOverrides(v []*LaunchTemplateOverrides) *LaunchTemplate { - s.Overrides = v - return s -} - -// Use this structure to let Amazon EC2 Auto Scaling do the following when the -// Auto Scaling group has a mixed instances policy: -// -// - Override the instance type that is specified in the launch template. -// -// - Use multiple instance types. -// -// Specify the instance types that you want, or define your instance requirements -// instead and let Amazon EC2 Auto Scaling provision the available instance -// types that meet your requirements. This can provide Amazon EC2 Auto Scaling -// with a larger selection of instance types to choose from when fulfilling -// Spot and On-Demand capacities. You can view which instance types are matched -// before you apply the instance requirements to your Auto Scaling group. -// -// After you define your instance requirements, you don't have to keep updating -// these settings to get new EC2 instance types automatically. Amazon EC2 Auto -// Scaling uses the instance requirements of the Auto Scaling group to determine -// whether a new EC2 instance type can be used. -type LaunchTemplateOverrides struct { - _ struct{} `type:"structure"` - - // The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements - // to identify instance types. Then, it uses your On-Demand and Spot allocation - // strategies to launch instances from these instance types. - // - // You can specify up to four separate sets of instance requirements per Auto - // Scaling group. This is useful for provisioning instances from different Amazon - // Machine Images (AMIs) in the same Auto Scaling group. To do this, create - // the AMIs and create a new launch template for each AMI. Then, create a compatible - // set of instance requirements for each launch template. - // - // If you specify InstanceRequirements, you can't specify InstanceType. - InstanceRequirements *InstanceRequirements `type:"structure"` - - // The instance type, such as m3.xlarge. You must specify an instance type that - // is supported in your requested Region and Availability Zones. For more information, - // see Instance types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) - // in the Amazon Elastic Compute Cloud User Guide. - // - // You can specify up to 40 instance types per Auto Scaling group. - InstanceType *string `min:"1" type:"string"` - - // Provides a launch template for the specified instance type or set of instance - // requirements. For example, some instance types might require a launch template - // with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch - // template that's specified in the LaunchTemplate definition. For more information, - // see Specifying a different launch template for an instance type (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups-launch-template-overrides.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // You can specify up to 20 launch templates per Auto Scaling group. The launch - // templates specified in the overrides and in the LaunchTemplate definition - // count towards this limit. - LaunchTemplateSpecification *LaunchTemplateSpecification `type:"structure"` - - // If you provide a list of instance types to use, you can specify the number - // of capacity units provided by each instance type in terms of virtual CPUs, - // memory, storage, throughput, or other relative performance characteristic. - // When a Spot or On-Demand Instance is launched, the capacity units count toward - // the desired capacity. Amazon EC2 Auto Scaling launches instances until the - // desired capacity is totally fulfilled, even if this results in an overage. - // For example, if there are two units remaining to fulfill capacity, and Amazon - // EC2 Auto Scaling can only launch an instance with a WeightedCapacity of five - // units, the instance is launched, and the desired capacity is exceeded by - // three units. For more information, see Configuring instance weighting for - // Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups-instance-weighting.html) - // in the Amazon EC2 Auto Scaling User Guide. Value must be in the range of - // 1–999. - // - // If you specify a value for WeightedCapacity for one instance type, you must - // specify a value for WeightedCapacity for all of them. - // - // Every Auto Scaling group has three size parameters (DesiredCapacity, MaxSize, - // and MinSize). Usually, you set these sizes based on a specific number of - // instances. However, if you configure a mixed instances policy that defines - // weights for the instance types, you must specify these sizes with the same - // units that you use for weighting instances. - WeightedCapacity *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchTemplateOverrides) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchTemplateOverrides) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LaunchTemplateOverrides) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LaunchTemplateOverrides"} - if s.InstanceType != nil && len(*s.InstanceType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceType", 1)) - } - if s.WeightedCapacity != nil && len(*s.WeightedCapacity) < 1 { - invalidParams.Add(request.NewErrParamMinLen("WeightedCapacity", 1)) - } - if s.InstanceRequirements != nil { - if err := s.InstanceRequirements.Validate(); err != nil { - invalidParams.AddNested("InstanceRequirements", err.(request.ErrInvalidParams)) - } - } - if s.LaunchTemplateSpecification != nil { - if err := s.LaunchTemplateSpecification.Validate(); err != nil { - invalidParams.AddNested("LaunchTemplateSpecification", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstanceRequirements sets the InstanceRequirements field's value. -func (s *LaunchTemplateOverrides) SetInstanceRequirements(v *InstanceRequirements) *LaunchTemplateOverrides { - s.InstanceRequirements = v - return s -} - -// SetInstanceType sets the InstanceType field's value. -func (s *LaunchTemplateOverrides) SetInstanceType(v string) *LaunchTemplateOverrides { - s.InstanceType = &v - return s -} - -// SetLaunchTemplateSpecification sets the LaunchTemplateSpecification field's value. -func (s *LaunchTemplateOverrides) SetLaunchTemplateSpecification(v *LaunchTemplateSpecification) *LaunchTemplateOverrides { - s.LaunchTemplateSpecification = v - return s -} - -// SetWeightedCapacity sets the WeightedCapacity field's value. -func (s *LaunchTemplateOverrides) SetWeightedCapacity(v string) *LaunchTemplateOverrides { - s.WeightedCapacity = &v - return s -} - -// Describes the launch template and the version of the launch template that -// Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. For more information -// about launch templates, see Launch templates (https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchTemplates.html) -// in the Amazon EC2 Auto Scaling User Guide. -type LaunchTemplateSpecification struct { - _ struct{} `type:"structure"` - - // The ID of the launch template. To get the template ID, use the Amazon EC2 - // DescribeLaunchTemplates (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplates.html) - // API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate - // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html) - // API. - // - // Conditional: You must specify either a LaunchTemplateId or a LaunchTemplateName. - LaunchTemplateId *string `min:"1" type:"string"` - - // The name of the launch template. To get the template name, use the Amazon - // EC2 DescribeLaunchTemplates (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplates.html) - // API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate - // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html) - // API. - // - // Conditional: You must specify either a LaunchTemplateId or a LaunchTemplateName. - LaunchTemplateName *string `min:"3" type:"string"` - - // The version number, $Latest, or $Default. To get the version number, use - // the Amazon EC2 DescribeLaunchTemplateVersions (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplateVersions.html) - // API operation. New launch template versions can be created using the Amazon - // EC2 CreateLaunchTemplateVersion (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplateVersion.html) - // API. If the value is $Latest, Amazon EC2 Auto Scaling selects the latest - // version of the launch template when launching instances. If the value is - // $Default, Amazon EC2 Auto Scaling selects the default version of the launch - // template when launching instances. The default value is $Default. - Version *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchTemplateSpecification) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LaunchTemplateSpecification) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LaunchTemplateSpecification) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LaunchTemplateSpecification"} - if s.LaunchTemplateId != nil && len(*s.LaunchTemplateId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LaunchTemplateId", 1)) - } - if s.LaunchTemplateName != nil && len(*s.LaunchTemplateName) < 3 { - invalidParams.Add(request.NewErrParamMinLen("LaunchTemplateName", 3)) - } - if s.Version != nil && len(*s.Version) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Version", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLaunchTemplateId sets the LaunchTemplateId field's value. -func (s *LaunchTemplateSpecification) SetLaunchTemplateId(v string) *LaunchTemplateSpecification { - s.LaunchTemplateId = &v - return s -} - -// SetLaunchTemplateName sets the LaunchTemplateName field's value. -func (s *LaunchTemplateSpecification) SetLaunchTemplateName(v string) *LaunchTemplateSpecification { - s.LaunchTemplateName = &v - return s -} - -// SetVersion sets the Version field's value. -func (s *LaunchTemplateSpecification) SetVersion(v string) *LaunchTemplateSpecification { - s.Version = &v - return s -} - -// Describes a lifecycle hook. A lifecycle hook lets you create solutions that -// are aware of events in the Auto Scaling instance lifecycle, and then perform -// a custom action on instances when the corresponding lifecycle event occurs. -type LifecycleHook struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group for the lifecycle hook. - AutoScalingGroupName *string `min:"1" type:"string"` - - // The action the Auto Scaling group takes when the lifecycle hook timeout elapses - // or if an unexpected failure occurs. - // - // Valid values: CONTINUE | ABANDON - DefaultResult *string `type:"string"` - - // The maximum time, in seconds, that an instance can remain in a wait state. - // The maximum is 172800 seconds (48 hours) or 100 times HeartbeatTimeout, whichever - // is smaller. - GlobalTimeout *int64 `type:"integer"` - - // The maximum time, in seconds, that can elapse before the lifecycle hook times - // out. If the lifecycle hook times out, Amazon EC2 Auto Scaling performs the - // action that you specified in the DefaultResult property. - HeartbeatTimeout *int64 `type:"integer"` - - // The name of the lifecycle hook. - LifecycleHookName *string `min:"1" type:"string"` - - // The lifecycle transition. - // - // Valid values: autoscaling:EC2_INSTANCE_LAUNCHING | autoscaling:EC2_INSTANCE_TERMINATING - LifecycleTransition *string `type:"string"` - - // Additional information that is included any time Amazon EC2 Auto Scaling - // sends a message to the notification target. - NotificationMetadata *string `min:"1" type:"string"` - - // The ARN of the target that Amazon EC2 Auto Scaling sends notifications to - // when an instance is in a wait state for the lifecycle hook. - NotificationTargetARN *string `type:"string"` - - // The ARN of the IAM role that allows the Auto Scaling group to publish to - // the specified notification target (an Amazon SNS topic or an Amazon SQS queue). - RoleARN *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LifecycleHook) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LifecycleHook) GoString() string { - return s.String() -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *LifecycleHook) SetAutoScalingGroupName(v string) *LifecycleHook { - s.AutoScalingGroupName = &v - return s -} - -// SetDefaultResult sets the DefaultResult field's value. -func (s *LifecycleHook) SetDefaultResult(v string) *LifecycleHook { - s.DefaultResult = &v - return s -} - -// SetGlobalTimeout sets the GlobalTimeout field's value. -func (s *LifecycleHook) SetGlobalTimeout(v int64) *LifecycleHook { - s.GlobalTimeout = &v - return s -} - -// SetHeartbeatTimeout sets the HeartbeatTimeout field's value. -func (s *LifecycleHook) SetHeartbeatTimeout(v int64) *LifecycleHook { - s.HeartbeatTimeout = &v - return s -} - -// SetLifecycleHookName sets the LifecycleHookName field's value. -func (s *LifecycleHook) SetLifecycleHookName(v string) *LifecycleHook { - s.LifecycleHookName = &v - return s -} - -// SetLifecycleTransition sets the LifecycleTransition field's value. -func (s *LifecycleHook) SetLifecycleTransition(v string) *LifecycleHook { - s.LifecycleTransition = &v - return s -} - -// SetNotificationMetadata sets the NotificationMetadata field's value. -func (s *LifecycleHook) SetNotificationMetadata(v string) *LifecycleHook { - s.NotificationMetadata = &v - return s -} - -// SetNotificationTargetARN sets the NotificationTargetARN field's value. -func (s *LifecycleHook) SetNotificationTargetARN(v string) *LifecycleHook { - s.NotificationTargetARN = &v - return s -} - -// SetRoleARN sets the RoleARN field's value. -func (s *LifecycleHook) SetRoleARN(v string) *LifecycleHook { - s.RoleARN = &v - return s -} - -// Describes information used to specify a lifecycle hook for an Auto Scaling -// group. -// -// For more information, see Amazon EC2 Auto Scaling lifecycle hooks (https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) -// in the Amazon EC2 Auto Scaling User Guide. -type LifecycleHookSpecification struct { - _ struct{} `type:"structure"` - - // The action the Auto Scaling group takes when the lifecycle hook timeout elapses - // or if an unexpected failure occurs. The default value is ABANDON. - // - // Valid values: CONTINUE | ABANDON - DefaultResult *string `type:"string"` - - // The maximum time, in seconds, that can elapse before the lifecycle hook times - // out. The range is from 30 to 7200 seconds. The default value is 3600 seconds - // (1 hour). - HeartbeatTimeout *int64 `type:"integer"` - - // The name of the lifecycle hook. - // - // LifecycleHookName is a required field - LifecycleHookName *string `min:"1" type:"string" required:"true"` - - // The lifecycle transition. For Auto Scaling groups, there are two major lifecycle - // transitions. - // - // * To create a lifecycle hook for scale-out events, specify autoscaling:EC2_INSTANCE_LAUNCHING. - // - // * To create a lifecycle hook for scale-in events, specify autoscaling:EC2_INSTANCE_TERMINATING. - // - // LifecycleTransition is a required field - LifecycleTransition *string `type:"string" required:"true"` - - // Additional information that you want to include any time Amazon EC2 Auto - // Scaling sends a message to the notification target. - NotificationMetadata *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the notification target that Amazon EC2 - // Auto Scaling sends notifications to when an instance is in a wait state for - // the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS - // queue. - NotificationTargetARN *string `type:"string"` - - // The ARN of the IAM role that allows the Auto Scaling group to publish to - // the specified notification target. For information about creating this role, - // see Configure a notification target for a lifecycle hook (https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Valid only if the notification target is an Amazon SNS topic or an Amazon - // SQS queue. - RoleARN *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LifecycleHookSpecification) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LifecycleHookSpecification) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleHookSpecification) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleHookSpecification"} - if s.LifecycleHookName == nil { - invalidParams.Add(request.NewErrParamRequired("LifecycleHookName")) - } - if s.LifecycleHookName != nil && len(*s.LifecycleHookName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LifecycleHookName", 1)) - } - if s.LifecycleTransition == nil { - invalidParams.Add(request.NewErrParamRequired("LifecycleTransition")) - } - if s.NotificationMetadata != nil && len(*s.NotificationMetadata) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NotificationMetadata", 1)) - } - if s.RoleARN != nil && len(*s.RoleARN) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RoleARN", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDefaultResult sets the DefaultResult field's value. -func (s *LifecycleHookSpecification) SetDefaultResult(v string) *LifecycleHookSpecification { - s.DefaultResult = &v - return s -} - -// SetHeartbeatTimeout sets the HeartbeatTimeout field's value. -func (s *LifecycleHookSpecification) SetHeartbeatTimeout(v int64) *LifecycleHookSpecification { - s.HeartbeatTimeout = &v - return s -} - -// SetLifecycleHookName sets the LifecycleHookName field's value. -func (s *LifecycleHookSpecification) SetLifecycleHookName(v string) *LifecycleHookSpecification { - s.LifecycleHookName = &v - return s -} - -// SetLifecycleTransition sets the LifecycleTransition field's value. -func (s *LifecycleHookSpecification) SetLifecycleTransition(v string) *LifecycleHookSpecification { - s.LifecycleTransition = &v - return s -} - -// SetNotificationMetadata sets the NotificationMetadata field's value. -func (s *LifecycleHookSpecification) SetNotificationMetadata(v string) *LifecycleHookSpecification { - s.NotificationMetadata = &v - return s -} - -// SetNotificationTargetARN sets the NotificationTargetARN field's value. -func (s *LifecycleHookSpecification) SetNotificationTargetARN(v string) *LifecycleHookSpecification { - s.NotificationTargetARN = &v - return s -} - -// SetRoleARN sets the RoleARN field's value. -func (s *LifecycleHookSpecification) SetRoleARN(v string) *LifecycleHookSpecification { - s.RoleARN = &v - return s -} - -// Describes the state of a Classic Load Balancer. -type LoadBalancerState struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - LoadBalancerName *string `min:"1" type:"string"` - - // One of the following load balancer states: - // - // * Adding - The Auto Scaling instances are being registered with the load - // balancer. - // - // * Added - All Auto Scaling instances are registered with the load balancer. - // - // * InService - At least one Auto Scaling instance passed an ELB health - // check. - // - // * Removing - The Auto Scaling instances are being deregistered from the - // load balancer. If connection draining is enabled, Elastic Load Balancing - // waits for in-flight requests to complete before deregistering the instances. - // - // * Removed - All Auto Scaling instances are deregistered from the load - // balancer. - State *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerState) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerState) GoString() string { - return s.String() -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *LoadBalancerState) SetLoadBalancerName(v string) *LoadBalancerState { - s.LoadBalancerName = &v - return s -} - -// SetState sets the State field's value. -func (s *LoadBalancerState) SetState(v string) *LoadBalancerState { - s.State = &v - return s -} - -// Describes the state of a target group. -type LoadBalancerTargetGroupState struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - LoadBalancerTargetGroupARN *string `min:"1" type:"string"` - - // The state of the target group. - // - // * Adding - The Auto Scaling instances are being registered with the target - // group. - // - // * Added - All Auto Scaling instances are registered with the target group. - // - // * InService - At least one Auto Scaling instance passed an ELB health - // check. - // - // * Removing - The Auto Scaling instances are being deregistered from the - // target group. If connection draining is enabled, Elastic Load Balancing - // waits for in-flight requests to complete before deregistering the instances. - // - // * Removed - All Auto Scaling instances are deregistered from the target - // group. - State *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerTargetGroupState) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerTargetGroupState) GoString() string { - return s.String() -} - -// SetLoadBalancerTargetGroupARN sets the LoadBalancerTargetGroupARN field's value. -func (s *LoadBalancerTargetGroupState) SetLoadBalancerTargetGroupARN(v string) *LoadBalancerTargetGroupState { - s.LoadBalancerTargetGroupARN = &v - return s -} - -// SetState sets the State field's value. -func (s *LoadBalancerTargetGroupState) SetState(v string) *LoadBalancerTargetGroupState { - s.State = &v - return s -} - -// A GetPredictiveScalingForecast call returns the load forecast for a predictive -// scaling policy. This structure includes the data points for that load forecast, -// along with the timestamps of those data points and the metric specification. -type LoadForecast struct { - _ struct{} `type:"structure"` - - // The metric specification for the load forecast. - // - // MetricSpecification is a required field - MetricSpecification *PredictiveScalingMetricSpecification `type:"structure" required:"true"` - - // The timestamps for the data points, in UTC format. - // - // Timestamps is a required field - Timestamps []*time.Time `type:"list" required:"true"` - - // The values of the data points. - // - // Values is a required field - Values []*float64 `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadForecast) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadForecast) GoString() string { - return s.String() -} - -// SetMetricSpecification sets the MetricSpecification field's value. -func (s *LoadForecast) SetMetricSpecification(v *PredictiveScalingMetricSpecification) *LoadForecast { - s.MetricSpecification = v - return s -} - -// SetTimestamps sets the Timestamps field's value. -func (s *LoadForecast) SetTimestamps(v []*time.Time) *LoadForecast { - s.Timestamps = v - return s -} - -// SetValues sets the Values field's value. -func (s *LoadForecast) SetValues(v []*float64) *LoadForecast { - s.Values = v - return s -} - -// Specifies the minimum and maximum for the MemoryGiBPerVCpu object when you -// specify InstanceRequirements for an Auto Scaling group. -type MemoryGiBPerVCpuRequest struct { - _ struct{} `type:"structure"` - - // The memory maximum in GiB. - Max *float64 `type:"double"` - - // The memory minimum in GiB. - Min *float64 `type:"double"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MemoryGiBPerVCpuRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MemoryGiBPerVCpuRequest) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *MemoryGiBPerVCpuRequest) SetMax(v float64) *MemoryGiBPerVCpuRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *MemoryGiBPerVCpuRequest) SetMin(v float64) *MemoryGiBPerVCpuRequest { - s.Min = &v - return s -} - -// Specifies the minimum and maximum for the MemoryMiB object when you specify -// InstanceRequirements for an Auto Scaling group. -type MemoryMiBRequest struct { - _ struct{} `type:"structure"` - - // The memory maximum in MiB. - Max *int64 `type:"integer"` - - // The memory minimum in MiB. - // - // Min is a required field - Min *int64 `type:"integer" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MemoryMiBRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MemoryMiBRequest) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MemoryMiBRequest) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MemoryMiBRequest"} - if s.Min == nil { - invalidParams.Add(request.NewErrParamRequired("Min")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMax sets the Max field's value. -func (s *MemoryMiBRequest) SetMax(v int64) *MemoryMiBRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *MemoryMiBRequest) SetMin(v int64) *MemoryMiBRequest { - s.Min = &v - return s -} - -// Represents a specific metric. -type Metric struct { - _ struct{} `type:"structure"` - - // The dimensions for the metric. For the list of available dimensions, see - // the Amazon Web Services documentation available from the table in Amazon - // Web Services services that publish CloudWatch metrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) - // in the Amazon CloudWatch User Guide. - // - // Conditional: If you published your metric with dimensions, you must specify - // the same dimensions in your scaling policy. - Dimensions []*MetricDimension `type:"list"` - - // The name of the metric. - // - // MetricName is a required field - MetricName *string `type:"string" required:"true"` - - // The namespace of the metric. For more information, see the table in Amazon - // Web Services services that publish CloudWatch metrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) - // in the Amazon CloudWatch User Guide. - // - // Namespace is a required field - Namespace *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Metric) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Metric) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Metric) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Metric"} - if s.MetricName == nil { - invalidParams.Add(request.NewErrParamRequired("MetricName")) - } - if s.Namespace == nil { - invalidParams.Add(request.NewErrParamRequired("Namespace")) - } - if s.Dimensions != nil { - for i, v := range s.Dimensions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDimensions sets the Dimensions field's value. -func (s *Metric) SetDimensions(v []*MetricDimension) *Metric { - s.Dimensions = v - return s -} - -// SetMetricName sets the MetricName field's value. -func (s *Metric) SetMetricName(v string) *Metric { - s.MetricName = &v - return s -} - -// SetNamespace sets the Namespace field's value. -func (s *Metric) SetNamespace(v string) *Metric { - s.Namespace = &v - return s -} - -// Describes a metric. -type MetricCollectionType struct { - _ struct{} `type:"structure"` - - // One of the following metrics: - // - // * GroupMinSize - // - // * GroupMaxSize - // - // * GroupDesiredCapacity - // - // * GroupInServiceInstances - // - // * GroupPendingInstances - // - // * GroupStandbyInstances - // - // * GroupTerminatingInstances - // - // * GroupTotalInstances - // - // * GroupInServiceCapacity - // - // * GroupPendingCapacity - // - // * GroupStandbyCapacity - // - // * GroupTerminatingCapacity - // - // * GroupTotalCapacity - // - // * WarmPoolDesiredCapacity - // - // * WarmPoolWarmedCapacity - // - // * WarmPoolPendingCapacity - // - // * WarmPoolTerminatingCapacity - // - // * WarmPoolTotalCapacity - // - // * GroupAndWarmPoolDesiredCapacity - // - // * GroupAndWarmPoolTotalCapacity - Metric *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricCollectionType) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricCollectionType) GoString() string { - return s.String() -} - -// SetMetric sets the Metric field's value. -func (s *MetricCollectionType) SetMetric(v string) *MetricCollectionType { - s.Metric = &v - return s -} - -// The metric data to return. Also defines whether this call is returning data -// for one metric only, or whether it is performing a math expression on the -// values of returned metric statistics to create a new time series. A time -// series is a series of data points, each of which is associated with a timestamp. -// -// For more information and examples, see Advanced predictive scaling policy -// configurations using custom metrics (https://docs.aws.amazon.com/autoscaling/ec2/userguide/predictive-scaling-customized-metric-specification.html) -// in the Amazon EC2 Auto Scaling User Guide. -type MetricDataQuery struct { - _ struct{} `type:"structure"` - - // The math expression to perform on the returned data, if this object is performing - // a math expression. This expression can use the Id of the other metrics to - // refer to those metrics, and can also use the Id of other expressions to use - // the result of those expressions. - // - // Conditional: Within each MetricDataQuery object, you must specify either - // Expression or MetricStat, but not both. - Expression *string `min:"1" type:"string"` - - // A short name that identifies the object's results in the response. This name - // must be unique among all MetricDataQuery objects specified for a single scaling - // policy. If you are performing math expressions on this set of data, this - // name represents that data and can serve as a variable in the mathematical - // expression. The valid characters are letters, numbers, and underscores. The - // first character must be a lowercase letter. - // - // Id is a required field - Id *string `min:"1" type:"string" required:"true"` - - // A human-readable label for this metric or expression. This is especially - // useful if this is a math expression, so that you know what the value represents. - Label *string `type:"string"` - - // Information about the metric data to return. - // - // Conditional: Within each MetricDataQuery object, you must specify either - // Expression or MetricStat, but not both. - MetricStat *MetricStat `type:"structure"` - - // Indicates whether to return the timestamps and raw data values of this metric. - // - // If you use any math expressions, specify true for this value for only the - // final math expression that the metric specification is based on. You must - // specify false for ReturnData for all the other metrics and expressions used - // in the metric specification. - // - // If you are only retrieving metrics and not performing any math expressions, - // do not specify anything for ReturnData. This sets it to its default (true). - ReturnData *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricDataQuery) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricDataQuery) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricDataQuery) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricDataQuery"} - if s.Expression != nil && len(*s.Expression) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Expression", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.Id != nil && len(*s.Id) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Id", 1)) - } - if s.MetricStat != nil { - if err := s.MetricStat.Validate(); err != nil { - invalidParams.AddNested("MetricStat", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetExpression sets the Expression field's value. -func (s *MetricDataQuery) SetExpression(v string) *MetricDataQuery { - s.Expression = &v - return s -} - -// SetId sets the Id field's value. -func (s *MetricDataQuery) SetId(v string) *MetricDataQuery { - s.Id = &v - return s -} - -// SetLabel sets the Label field's value. -func (s *MetricDataQuery) SetLabel(v string) *MetricDataQuery { - s.Label = &v - return s -} - -// SetMetricStat sets the MetricStat field's value. -func (s *MetricDataQuery) SetMetricStat(v *MetricStat) *MetricDataQuery { - s.MetricStat = v - return s -} - -// SetReturnData sets the ReturnData field's value. -func (s *MetricDataQuery) SetReturnData(v bool) *MetricDataQuery { - s.ReturnData = &v - return s -} - -// Describes the dimension of a metric. -type MetricDimension struct { - _ struct{} `type:"structure"` - - // The name of the dimension. - // - // Name is a required field - Name *string `type:"string" required:"true"` - - // The value of the dimension. - // - // Value is a required field - Value *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricDimension) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricDimension) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricDimension) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricDimension"} - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - if s.Value == nil { - invalidParams.Add(request.NewErrParamRequired("Value")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetName sets the Name field's value. -func (s *MetricDimension) SetName(v string) *MetricDimension { - s.Name = &v - return s -} - -// SetValue sets the Value field's value. -func (s *MetricDimension) SetValue(v string) *MetricDimension { - s.Value = &v - return s -} - -// Describes a granularity of a metric. -type MetricGranularityType struct { - _ struct{} `type:"structure"` - - // The granularity. The only valid value is 1Minute. - Granularity *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricGranularityType) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricGranularityType) GoString() string { - return s.String() -} - -// SetGranularity sets the Granularity field's value. -func (s *MetricGranularityType) SetGranularity(v string) *MetricGranularityType { - s.Granularity = &v - return s -} - -// This structure defines the CloudWatch metric to return, along with the statistic, -// period, and unit. -// -// For more information about the CloudWatch terminology below, see Amazon CloudWatch -// concepts (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html) -// in the Amazon CloudWatch User Guide. -type MetricStat struct { - _ struct{} `type:"structure"` - - // The CloudWatch metric to return, including the metric name, namespace, and - // dimensions. To get the exact metric name, namespace, and dimensions, inspect - // the Metric (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Metric.html) - // object that is returned by a call to ListMetrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html). - // - // Metric is a required field - Metric *Metric `type:"structure" required:"true"` - - // The statistic to return. It can include any CloudWatch statistic or extended - // statistic. For a list of valid values, see the table in Statistics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Statistic) - // in the Amazon CloudWatch User Guide. - // - // The most commonly used metrics for predictive scaling are Average and Sum. - // - // Stat is a required field - Stat *string `min:"1" type:"string" required:"true"` - - // The unit to use for the returned data points. For a complete list of the - // units that CloudWatch supports, see the MetricDatum (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html) - // data type in the Amazon CloudWatch API Reference. - Unit *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricStat) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MetricStat) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricStat) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricStat"} - if s.Metric == nil { - invalidParams.Add(request.NewErrParamRequired("Metric")) - } - if s.Stat == nil { - invalidParams.Add(request.NewErrParamRequired("Stat")) - } - if s.Stat != nil && len(*s.Stat) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Stat", 1)) - } - if s.Metric != nil { - if err := s.Metric.Validate(); err != nil { - invalidParams.AddNested("Metric", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMetric sets the Metric field's value. -func (s *MetricStat) SetMetric(v *Metric) *MetricStat { - s.Metric = v - return s -} - -// SetStat sets the Stat field's value. -func (s *MetricStat) SetStat(v string) *MetricStat { - s.Stat = &v - return s -} - -// SetUnit sets the Unit field's value. -func (s *MetricStat) SetUnit(v string) *MetricStat { - s.Unit = &v - return s -} - -// Use this structure to launch multiple instance types and On-Demand Instances -// and Spot Instances within a single Auto Scaling group. -// -// A mixed instances policy contains information that Amazon EC2 Auto Scaling -// can use to launch instances and help optimize your costs. For more information, -// see Auto Scaling groups with multiple instance types and purchase options -// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) -// in the Amazon EC2 Auto Scaling User Guide. -type MixedInstancesPolicy struct { - _ struct{} `type:"structure"` - - // The instances distribution. - InstancesDistribution *InstancesDistribution `type:"structure"` - - // One or more launch templates and the instance types (overrides) that are - // used to launch EC2 instances to fulfill On-Demand and Spot capacities. - LaunchTemplate *LaunchTemplate `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MixedInstancesPolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MixedInstancesPolicy) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MixedInstancesPolicy) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MixedInstancesPolicy"} - if s.LaunchTemplate != nil { - if err := s.LaunchTemplate.Validate(); err != nil { - invalidParams.AddNested("LaunchTemplate", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstancesDistribution sets the InstancesDistribution field's value. -func (s *MixedInstancesPolicy) SetInstancesDistribution(v *InstancesDistribution) *MixedInstancesPolicy { - s.InstancesDistribution = v - return s -} - -// SetLaunchTemplate sets the LaunchTemplate field's value. -func (s *MixedInstancesPolicy) SetLaunchTemplate(v *LaunchTemplate) *MixedInstancesPolicy { - s.LaunchTemplate = v - return s -} - -// Specifies the minimum and maximum for the NetworkBandwidthGbps object when -// you specify InstanceRequirements for an Auto Scaling group. -// -// Setting the minimum bandwidth does not guarantee that your instance will -// achieve the minimum bandwidth. Amazon EC2 will identify instance types that -// support the specified minimum bandwidth, but the actual bandwidth of your -// instance might go below the specified minimum at times. For more information, -// see Available instance bandwidth (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-bandwidth.html#available-instance-bandwidth) -// in the Amazon EC2 User Guide for Linux Instances. -type NetworkBandwidthGbpsRequest struct { - _ struct{} `type:"structure"` - - // The maximum amount of network bandwidth, in gigabits per second (Gbps). - Max *float64 `type:"double"` - - // The minimum amount of network bandwidth, in gigabits per second (Gbps). - Min *float64 `type:"double"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NetworkBandwidthGbpsRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NetworkBandwidthGbpsRequest) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *NetworkBandwidthGbpsRequest) SetMax(v float64) *NetworkBandwidthGbpsRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *NetworkBandwidthGbpsRequest) SetMin(v float64) *NetworkBandwidthGbpsRequest { - s.Min = &v - return s -} - -// Specifies the minimum and maximum for the NetworkInterfaceCount object when -// you specify InstanceRequirements for an Auto Scaling group. -type NetworkInterfaceCountRequest struct { - _ struct{} `type:"structure"` - - // The maximum number of network interfaces. - Max *int64 `type:"integer"` - - // The minimum number of network interfaces. - Min *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NetworkInterfaceCountRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NetworkInterfaceCountRequest) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *NetworkInterfaceCountRequest) SetMax(v int64) *NetworkInterfaceCountRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *NetworkInterfaceCountRequest) SetMin(v int64) *NetworkInterfaceCountRequest { - s.Min = &v - return s -} - -// Describes a notification. -type NotificationConfiguration struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // One of the following event notification types: - // - // * autoscaling:EC2_INSTANCE_LAUNCH - // - // * autoscaling:EC2_INSTANCE_LAUNCH_ERROR - // - // * autoscaling:EC2_INSTANCE_TERMINATE - // - // * autoscaling:EC2_INSTANCE_TERMINATE_ERROR - // - // * autoscaling:TEST_NOTIFICATION - NotificationType *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the Amazon SNS topic. - TopicARN *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NotificationConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NotificationConfiguration) GoString() string { - return s.String() -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *NotificationConfiguration) SetAutoScalingGroupName(v string) *NotificationConfiguration { - s.AutoScalingGroupName = &v - return s -} - -// SetNotificationType sets the NotificationType field's value. -func (s *NotificationConfiguration) SetNotificationType(v string) *NotificationConfiguration { - s.NotificationType = &v - return s -} - -// SetTopicARN sets the TopicARN field's value. -func (s *NotificationConfiguration) SetTopicARN(v string) *NotificationConfiguration { - s.TopicARN = &v - return s -} - -// Represents a predefined metric for a target tracking scaling policy to use -// with Amazon EC2 Auto Scaling. -type PredefinedMetricSpecification struct { - _ struct{} `type:"structure"` - - // The metric type. The following predefined metrics are available: - // - // * ASGAverageCPUUtilization - Average CPU utilization of the Auto Scaling - // group. - // - // * ASGAverageNetworkIn - Average number of bytes received on all network - // interfaces by the Auto Scaling group. - // - // * ASGAverageNetworkOut - Average number of bytes sent out on all network - // interfaces by the Auto Scaling group. - // - // * ALBRequestCountPerTarget - Average Application Load Balancer request - // count per target for your Auto Scaling group. - // - // PredefinedMetricType is a required field - PredefinedMetricType *string `type:"string" required:"true" enum:"MetricType"` - - // A label that uniquely identifies a specific Application Load Balancer target - // group from which to determine the average request count served by your Auto - // Scaling group. You can't specify a resource label unless the target group - // is attached to the Auto Scaling group. - // - // You create the resource label by appending the final portion of the load - // balancer ARN and the final portion of the target group ARN into a single - // value, separated by a forward slash (/). The format of the resource label - // is: - // - // app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff. - // - // Where: - // - // * app// is the final portion of - // the load balancer ARN - // - // * targetgroup// is the final portion - // of the target group ARN. - // - // To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) - // API operation. To find the ARN for the target group, use the DescribeTargetGroups - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) - // API operation. - ResourceLabel *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredefinedMetricSpecification) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredefinedMetricSpecification) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredefinedMetricSpecification) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredefinedMetricSpecification"} - if s.PredefinedMetricType == nil { - invalidParams.Add(request.NewErrParamRequired("PredefinedMetricType")) - } - if s.ResourceLabel != nil && len(*s.ResourceLabel) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ResourceLabel", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPredefinedMetricType sets the PredefinedMetricType field's value. -func (s *PredefinedMetricSpecification) SetPredefinedMetricType(v string) *PredefinedMetricSpecification { - s.PredefinedMetricType = &v - return s -} - -// SetResourceLabel sets the ResourceLabel field's value. -func (s *PredefinedMetricSpecification) SetResourceLabel(v string) *PredefinedMetricSpecification { - s.ResourceLabel = &v - return s -} - -// Represents a predictive scaling policy configuration to use with Amazon EC2 -// Auto Scaling. -type PredictiveScalingConfiguration struct { - _ struct{} `type:"structure"` - - // Defines the behavior that should be applied if the forecast capacity approaches - // or exceeds the maximum capacity of the Auto Scaling group. Defaults to HonorMaxCapacity - // if not specified. - // - // The following are possible values: - // - // * HonorMaxCapacity - Amazon EC2 Auto Scaling cannot scale out capacity - // higher than the maximum capacity. The maximum capacity is enforced as - // a hard limit. - // - // * IncreaseMaxCapacity - Amazon EC2 Auto Scaling can scale out capacity - // higher than the maximum capacity when the forecast capacity is close to - // or exceeds the maximum capacity. The upper limit is determined by the - // forecasted capacity and the value for MaxCapacityBuffer. - MaxCapacityBreachBehavior *string `type:"string" enum:"PredictiveScalingMaxCapacityBreachBehavior"` - - // The size of the capacity buffer to use when the forecast capacity is close - // to or exceeds the maximum capacity. The value is specified as a percentage - // relative to the forecast capacity. For example, if the buffer is 10, this - // means a 10 percent buffer, such that if the forecast capacity is 50, and - // the maximum capacity is 40, then the effective maximum capacity is 55. - // - // If set to 0, Amazon EC2 Auto Scaling may scale capacity higher than the maximum - // capacity to equal but not exceed forecast capacity. - // - // Required if the MaxCapacityBreachBehavior property is set to IncreaseMaxCapacity, - // and cannot be used otherwise. - MaxCapacityBuffer *int64 `type:"integer"` - - // This structure includes the metrics and target utilization to use for predictive - // scaling. - // - // This is an array, but we currently only support a single metric specification. - // That is, you can specify a target value and a single metric pair, or a target - // value and one scaling metric and one load metric. - // - // MetricSpecifications is a required field - MetricSpecifications []*PredictiveScalingMetricSpecification `type:"list" required:"true"` - - // The predictive scaling mode. Defaults to ForecastOnly if not specified. - Mode *string `type:"string" enum:"PredictiveScalingMode"` - - // The amount of time, in seconds, by which the instance launch time can be - // advanced. For example, the forecast says to add capacity at 10:00 AM, and - // you choose to pre-launch instances by 5 minutes. In that case, the instances - // will be launched at 9:55 AM. The intention is to give resources time to be - // provisioned. It can take a few minutes to launch an EC2 instance. The actual - // amount of time required depends on several factors, such as the size of the - // instance and whether there are startup scripts to complete. - // - // The value must be less than the forecast interval duration of 3600 seconds - // (60 minutes). Defaults to 300 seconds if not specified. - SchedulingBufferTime *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingConfiguration"} - if s.MetricSpecifications == nil { - invalidParams.Add(request.NewErrParamRequired("MetricSpecifications")) - } - if s.MetricSpecifications != nil { - for i, v := range s.MetricSpecifications { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricSpecifications", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMaxCapacityBreachBehavior sets the MaxCapacityBreachBehavior field's value. -func (s *PredictiveScalingConfiguration) SetMaxCapacityBreachBehavior(v string) *PredictiveScalingConfiguration { - s.MaxCapacityBreachBehavior = &v - return s -} - -// SetMaxCapacityBuffer sets the MaxCapacityBuffer field's value. -func (s *PredictiveScalingConfiguration) SetMaxCapacityBuffer(v int64) *PredictiveScalingConfiguration { - s.MaxCapacityBuffer = &v - return s -} - -// SetMetricSpecifications sets the MetricSpecifications field's value. -func (s *PredictiveScalingConfiguration) SetMetricSpecifications(v []*PredictiveScalingMetricSpecification) *PredictiveScalingConfiguration { - s.MetricSpecifications = v - return s -} - -// SetMode sets the Mode field's value. -func (s *PredictiveScalingConfiguration) SetMode(v string) *PredictiveScalingConfiguration { - s.Mode = &v - return s -} - -// SetSchedulingBufferTime sets the SchedulingBufferTime field's value. -func (s *PredictiveScalingConfiguration) SetSchedulingBufferTime(v int64) *PredictiveScalingConfiguration { - s.SchedulingBufferTime = &v - return s -} - -// Describes a customized capacity metric for a predictive scaling policy. -type PredictiveScalingCustomizedCapacityMetric struct { - _ struct{} `type:"structure"` - - // One or more metric data queries to provide the data points for a capacity - // metric. Use multiple metric data queries only if you are performing a math - // expression on returned data. - // - // MetricDataQueries is a required field - MetricDataQueries []*MetricDataQuery `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingCustomizedCapacityMetric) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingCustomizedCapacityMetric) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingCustomizedCapacityMetric) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingCustomizedCapacityMetric"} - if s.MetricDataQueries == nil { - invalidParams.Add(request.NewErrParamRequired("MetricDataQueries")) - } - if s.MetricDataQueries != nil { - for i, v := range s.MetricDataQueries { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricDataQueries", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMetricDataQueries sets the MetricDataQueries field's value. -func (s *PredictiveScalingCustomizedCapacityMetric) SetMetricDataQueries(v []*MetricDataQuery) *PredictiveScalingCustomizedCapacityMetric { - s.MetricDataQueries = v - return s -} - -// Describes a custom load metric for a predictive scaling policy. -type PredictiveScalingCustomizedLoadMetric struct { - _ struct{} `type:"structure"` - - // One or more metric data queries to provide the data points for a load metric. - // Use multiple metric data queries only if you are performing a math expression - // on returned data. - // - // MetricDataQueries is a required field - MetricDataQueries []*MetricDataQuery `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingCustomizedLoadMetric) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingCustomizedLoadMetric) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingCustomizedLoadMetric) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingCustomizedLoadMetric"} - if s.MetricDataQueries == nil { - invalidParams.Add(request.NewErrParamRequired("MetricDataQueries")) - } - if s.MetricDataQueries != nil { - for i, v := range s.MetricDataQueries { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricDataQueries", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMetricDataQueries sets the MetricDataQueries field's value. -func (s *PredictiveScalingCustomizedLoadMetric) SetMetricDataQueries(v []*MetricDataQuery) *PredictiveScalingCustomizedLoadMetric { - s.MetricDataQueries = v - return s -} - -// Describes a custom scaling metric for a predictive scaling policy. -type PredictiveScalingCustomizedScalingMetric struct { - _ struct{} `type:"structure"` - - // One or more metric data queries to provide the data points for a scaling - // metric. Use multiple metric data queries only if you are performing a math - // expression on returned data. - // - // MetricDataQueries is a required field - MetricDataQueries []*MetricDataQuery `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingCustomizedScalingMetric) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingCustomizedScalingMetric) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingCustomizedScalingMetric) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingCustomizedScalingMetric"} - if s.MetricDataQueries == nil { - invalidParams.Add(request.NewErrParamRequired("MetricDataQueries")) - } - if s.MetricDataQueries != nil { - for i, v := range s.MetricDataQueries { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricDataQueries", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMetricDataQueries sets the MetricDataQueries field's value. -func (s *PredictiveScalingCustomizedScalingMetric) SetMetricDataQueries(v []*MetricDataQuery) *PredictiveScalingCustomizedScalingMetric { - s.MetricDataQueries = v - return s -} - -// This structure specifies the metrics and target utilization settings for -// a predictive scaling policy. -// -// You must specify either a metric pair, or a load metric and a scaling metric -// individually. Specifying a metric pair instead of individual metrics provides -// a simpler way to configure metrics for a scaling policy. You choose the metric -// pair, and the policy automatically knows the correct sum and average statistics -// to use for the load metric and the scaling metric. -// -// Example -// -// - You create a predictive scaling policy and specify ALBRequestCount as -// the value for the metric pair and 1000.0 as the target value. For this -// type of metric, you must provide the metric dimension for the corresponding -// target group, so you also provide a resource label for the Application -// Load Balancer target group that is attached to your Auto Scaling group. -// -// - The number of requests the target group receives per minute provides -// the load metric, and the request count averaged between the members of -// the target group provides the scaling metric. In CloudWatch, this refers -// to the RequestCount and RequestCountPerTarget metrics, respectively. -// -// - For optimal use of predictive scaling, you adhere to the best practice -// of using a dynamic scaling policy to automatically scale between the minimum -// capacity and maximum capacity in response to real-time changes in resource -// utilization. -// -// - Amazon EC2 Auto Scaling consumes data points for the load metric over -// the last 14 days and creates an hourly load forecast for predictive scaling. -// (A minimum of 24 hours of data is required.) -// -// - After creating the load forecast, Amazon EC2 Auto Scaling determines -// when to reduce or increase the capacity of your Auto Scaling group in -// each hour of the forecast period so that the average number of requests -// received by each instance is as close to 1000 requests per minute as possible -// at all times. -// -// For information about using custom metrics with predictive scaling, see Advanced -// predictive scaling policy configurations using custom metrics (https://docs.aws.amazon.com/autoscaling/ec2/userguide/predictive-scaling-customized-metric-specification.html) -// in the Amazon EC2 Auto Scaling User Guide. -type PredictiveScalingMetricSpecification struct { - _ struct{} `type:"structure"` - - // The customized capacity metric specification. - CustomizedCapacityMetricSpecification *PredictiveScalingCustomizedCapacityMetric `type:"structure"` - - // The customized load metric specification. - CustomizedLoadMetricSpecification *PredictiveScalingCustomizedLoadMetric `type:"structure"` - - // The customized scaling metric specification. - CustomizedScalingMetricSpecification *PredictiveScalingCustomizedScalingMetric `type:"structure"` - - // The predefined load metric specification. - PredefinedLoadMetricSpecification *PredictiveScalingPredefinedLoadMetric `type:"structure"` - - // The predefined metric pair specification from which Amazon EC2 Auto Scaling - // determines the appropriate scaling metric and load metric to use. - PredefinedMetricPairSpecification *PredictiveScalingPredefinedMetricPair `type:"structure"` - - // The predefined scaling metric specification. - PredefinedScalingMetricSpecification *PredictiveScalingPredefinedScalingMetric `type:"structure"` - - // Specifies the target utilization. - // - // Some metrics are based on a count instead of a percentage, such as the request - // count for an Application Load Balancer or the number of messages in an SQS - // queue. If the scaling policy specifies one of these metrics, specify the - // target utilization as the optimal average request or message count per instance - // during any one-minute interval. - // - // TargetValue is a required field - TargetValue *float64 `type:"double" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingMetricSpecification) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingMetricSpecification) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingMetricSpecification) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingMetricSpecification"} - if s.TargetValue == nil { - invalidParams.Add(request.NewErrParamRequired("TargetValue")) - } - if s.CustomizedCapacityMetricSpecification != nil { - if err := s.CustomizedCapacityMetricSpecification.Validate(); err != nil { - invalidParams.AddNested("CustomizedCapacityMetricSpecification", err.(request.ErrInvalidParams)) - } - } - if s.CustomizedLoadMetricSpecification != nil { - if err := s.CustomizedLoadMetricSpecification.Validate(); err != nil { - invalidParams.AddNested("CustomizedLoadMetricSpecification", err.(request.ErrInvalidParams)) - } - } - if s.CustomizedScalingMetricSpecification != nil { - if err := s.CustomizedScalingMetricSpecification.Validate(); err != nil { - invalidParams.AddNested("CustomizedScalingMetricSpecification", err.(request.ErrInvalidParams)) - } - } - if s.PredefinedLoadMetricSpecification != nil { - if err := s.PredefinedLoadMetricSpecification.Validate(); err != nil { - invalidParams.AddNested("PredefinedLoadMetricSpecification", err.(request.ErrInvalidParams)) - } - } - if s.PredefinedMetricPairSpecification != nil { - if err := s.PredefinedMetricPairSpecification.Validate(); err != nil { - invalidParams.AddNested("PredefinedMetricPairSpecification", err.(request.ErrInvalidParams)) - } - } - if s.PredefinedScalingMetricSpecification != nil { - if err := s.PredefinedScalingMetricSpecification.Validate(); err != nil { - invalidParams.AddNested("PredefinedScalingMetricSpecification", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomizedCapacityMetricSpecification sets the CustomizedCapacityMetricSpecification field's value. -func (s *PredictiveScalingMetricSpecification) SetCustomizedCapacityMetricSpecification(v *PredictiveScalingCustomizedCapacityMetric) *PredictiveScalingMetricSpecification { - s.CustomizedCapacityMetricSpecification = v - return s -} - -// SetCustomizedLoadMetricSpecification sets the CustomizedLoadMetricSpecification field's value. -func (s *PredictiveScalingMetricSpecification) SetCustomizedLoadMetricSpecification(v *PredictiveScalingCustomizedLoadMetric) *PredictiveScalingMetricSpecification { - s.CustomizedLoadMetricSpecification = v - return s -} - -// SetCustomizedScalingMetricSpecification sets the CustomizedScalingMetricSpecification field's value. -func (s *PredictiveScalingMetricSpecification) SetCustomizedScalingMetricSpecification(v *PredictiveScalingCustomizedScalingMetric) *PredictiveScalingMetricSpecification { - s.CustomizedScalingMetricSpecification = v - return s -} - -// SetPredefinedLoadMetricSpecification sets the PredefinedLoadMetricSpecification field's value. -func (s *PredictiveScalingMetricSpecification) SetPredefinedLoadMetricSpecification(v *PredictiveScalingPredefinedLoadMetric) *PredictiveScalingMetricSpecification { - s.PredefinedLoadMetricSpecification = v - return s -} - -// SetPredefinedMetricPairSpecification sets the PredefinedMetricPairSpecification field's value. -func (s *PredictiveScalingMetricSpecification) SetPredefinedMetricPairSpecification(v *PredictiveScalingPredefinedMetricPair) *PredictiveScalingMetricSpecification { - s.PredefinedMetricPairSpecification = v - return s -} - -// SetPredefinedScalingMetricSpecification sets the PredefinedScalingMetricSpecification field's value. -func (s *PredictiveScalingMetricSpecification) SetPredefinedScalingMetricSpecification(v *PredictiveScalingPredefinedScalingMetric) *PredictiveScalingMetricSpecification { - s.PredefinedScalingMetricSpecification = v - return s -} - -// SetTargetValue sets the TargetValue field's value. -func (s *PredictiveScalingMetricSpecification) SetTargetValue(v float64) *PredictiveScalingMetricSpecification { - s.TargetValue = &v - return s -} - -// Describes a load metric for a predictive scaling policy. -// -// When returned in the output of DescribePolicies, it indicates that a predictive -// scaling policy uses individually specified load and scaling metrics instead -// of a metric pair. -type PredictiveScalingPredefinedLoadMetric struct { - _ struct{} `type:"structure"` - - // The metric type. - // - // PredefinedMetricType is a required field - PredefinedMetricType *string `type:"string" required:"true" enum:"PredefinedLoadMetricType"` - - // A label that uniquely identifies a specific Application Load Balancer target - // group from which to determine the request count served by your Auto Scaling - // group. You can't specify a resource label unless the target group is attached - // to the Auto Scaling group. - // - // You create the resource label by appending the final portion of the load - // balancer ARN and the final portion of the target group ARN into a single - // value, separated by a forward slash (/). The format of the resource label - // is: - // - // app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff. - // - // Where: - // - // * app// is the final portion of - // the load balancer ARN - // - // * targetgroup// is the final portion - // of the target group ARN. - // - // To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) - // API operation. To find the ARN for the target group, use the DescribeTargetGroups - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) - // API operation. - ResourceLabel *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingPredefinedLoadMetric) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingPredefinedLoadMetric) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingPredefinedLoadMetric) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingPredefinedLoadMetric"} - if s.PredefinedMetricType == nil { - invalidParams.Add(request.NewErrParamRequired("PredefinedMetricType")) - } - if s.ResourceLabel != nil && len(*s.ResourceLabel) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ResourceLabel", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPredefinedMetricType sets the PredefinedMetricType field's value. -func (s *PredictiveScalingPredefinedLoadMetric) SetPredefinedMetricType(v string) *PredictiveScalingPredefinedLoadMetric { - s.PredefinedMetricType = &v - return s -} - -// SetResourceLabel sets the ResourceLabel field's value. -func (s *PredictiveScalingPredefinedLoadMetric) SetResourceLabel(v string) *PredictiveScalingPredefinedLoadMetric { - s.ResourceLabel = &v - return s -} - -// Represents a metric pair for a predictive scaling policy. -type PredictiveScalingPredefinedMetricPair struct { - _ struct{} `type:"structure"` - - // Indicates which metrics to use. There are two different types of metrics - // for each metric type: one is a load metric and one is a scaling metric. For - // example, if the metric type is ASGCPUUtilization, the Auto Scaling group's - // total CPU metric is used as the load metric, and the average CPU metric is - // used for the scaling metric. - // - // PredefinedMetricType is a required field - PredefinedMetricType *string `type:"string" required:"true" enum:"PredefinedMetricPairType"` - - // A label that uniquely identifies a specific Application Load Balancer target - // group from which to determine the total and average request count served - // by your Auto Scaling group. You can't specify a resource label unless the - // target group is attached to the Auto Scaling group. - // - // You create the resource label by appending the final portion of the load - // balancer ARN and the final portion of the target group ARN into a single - // value, separated by a forward slash (/). The format of the resource label - // is: - // - // app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff. - // - // Where: - // - // * app// is the final portion of - // the load balancer ARN - // - // * targetgroup// is the final portion - // of the target group ARN. - // - // To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) - // API operation. To find the ARN for the target group, use the DescribeTargetGroups - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) - // API operation. - ResourceLabel *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingPredefinedMetricPair) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingPredefinedMetricPair) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingPredefinedMetricPair) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingPredefinedMetricPair"} - if s.PredefinedMetricType == nil { - invalidParams.Add(request.NewErrParamRequired("PredefinedMetricType")) - } - if s.ResourceLabel != nil && len(*s.ResourceLabel) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ResourceLabel", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPredefinedMetricType sets the PredefinedMetricType field's value. -func (s *PredictiveScalingPredefinedMetricPair) SetPredefinedMetricType(v string) *PredictiveScalingPredefinedMetricPair { - s.PredefinedMetricType = &v - return s -} - -// SetResourceLabel sets the ResourceLabel field's value. -func (s *PredictiveScalingPredefinedMetricPair) SetResourceLabel(v string) *PredictiveScalingPredefinedMetricPair { - s.ResourceLabel = &v - return s -} - -// Describes a scaling metric for a predictive scaling policy. -// -// When returned in the output of DescribePolicies, it indicates that a predictive -// scaling policy uses individually specified load and scaling metrics instead -// of a metric pair. -type PredictiveScalingPredefinedScalingMetric struct { - _ struct{} `type:"structure"` - - // The metric type. - // - // PredefinedMetricType is a required field - PredefinedMetricType *string `type:"string" required:"true" enum:"PredefinedScalingMetricType"` - - // A label that uniquely identifies a specific Application Load Balancer target - // group from which to determine the average request count served by your Auto - // Scaling group. You can't specify a resource label unless the target group - // is attached to the Auto Scaling group. - // - // You create the resource label by appending the final portion of the load - // balancer ARN and the final portion of the target group ARN into a single - // value, separated by a forward slash (/). The format of the resource label - // is: - // - // app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff. - // - // Where: - // - // * app// is the final portion of - // the load balancer ARN - // - // * targetgroup// is the final portion - // of the target group ARN. - // - // To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) - // API operation. To find the ARN for the target group, use the DescribeTargetGroups - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) - // API operation. - ResourceLabel *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingPredefinedScalingMetric) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PredictiveScalingPredefinedScalingMetric) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PredictiveScalingPredefinedScalingMetric) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PredictiveScalingPredefinedScalingMetric"} - if s.PredefinedMetricType == nil { - invalidParams.Add(request.NewErrParamRequired("PredefinedMetricType")) - } - if s.ResourceLabel != nil && len(*s.ResourceLabel) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ResourceLabel", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPredefinedMetricType sets the PredefinedMetricType field's value. -func (s *PredictiveScalingPredefinedScalingMetric) SetPredefinedMetricType(v string) *PredictiveScalingPredefinedScalingMetric { - s.PredefinedMetricType = &v - return s -} - -// SetResourceLabel sets the ResourceLabel field's value. -func (s *PredictiveScalingPredefinedScalingMetric) SetResourceLabel(v string) *PredictiveScalingPredefinedScalingMetric { - s.ResourceLabel = &v - return s -} - -// Describes a process type. -// -// For more information, see Scaling processes (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types) -// in the Amazon EC2 Auto Scaling User Guide. -type ProcessType struct { - _ struct{} `type:"structure"` - - // One of the following processes: - // - // * Launch - // - // * Terminate - // - // * AddToLoadBalancer - // - // * AlarmNotification - // - // * AZRebalance - // - // * HealthCheck - // - // * InstanceRefresh - // - // * ReplaceUnhealthy - // - // * ScheduledActions - // - // ProcessName is a required field - ProcessName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ProcessType) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ProcessType) GoString() string { - return s.String() -} - -// SetProcessName sets the ProcessName field's value. -func (s *ProcessType) SetProcessName(v string) *ProcessType { - s.ProcessName = &v - return s -} - -type PutLifecycleHookInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The action the Auto Scaling group takes when the lifecycle hook timeout elapses - // or if an unexpected failure occurs. The default value is ABANDON. - // - // Valid values: CONTINUE | ABANDON - DefaultResult *string `type:"string"` - - // The maximum time, in seconds, that can elapse before the lifecycle hook times - // out. The range is from 30 to 7200 seconds. The default value is 3600 seconds - // (1 hour). - HeartbeatTimeout *int64 `type:"integer"` - - // The name of the lifecycle hook. - // - // LifecycleHookName is a required field - LifecycleHookName *string `min:"1" type:"string" required:"true"` - - // The lifecycle transition. For Auto Scaling groups, there are two major lifecycle - // transitions. - // - // * To create a lifecycle hook for scale-out events, specify autoscaling:EC2_INSTANCE_LAUNCHING. - // - // * To create a lifecycle hook for scale-in events, specify autoscaling:EC2_INSTANCE_TERMINATING. - // - // Required for new lifecycle hooks, but optional when updating existing hooks. - LifecycleTransition *string `type:"string"` - - // Additional information that you want to include any time Amazon EC2 Auto - // Scaling sends a message to the notification target. - NotificationMetadata *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the notification target that Amazon EC2 - // Auto Scaling uses to notify you when an instance is in a wait state for the - // lifecycle hook. You can specify either an Amazon SNS topic or an Amazon SQS - // queue. - // - // If you specify an empty string, this overrides the current ARN. - // - // This operation uses the JSON format when sending notifications to an Amazon - // SQS queue, and an email key-value pair format when sending notifications - // to an Amazon SNS topic. - // - // When you specify a notification target, Amazon EC2 Auto Scaling sends it - // a test message. Test messages contain the following additional key-value - // pair: "Event": "autoscaling:TEST_NOTIFICATION". - NotificationTargetARN *string `type:"string"` - - // The ARN of the IAM role that allows the Auto Scaling group to publish to - // the specified notification target. - // - // Valid only if the notification target is an Amazon SNS topic or an Amazon - // SQS queue. Required for new lifecycle hooks, but optional when updating existing - // hooks. - RoleARN *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutLifecycleHookInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutLifecycleHookInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutLifecycleHookInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutLifecycleHookInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.LifecycleHookName == nil { - invalidParams.Add(request.NewErrParamRequired("LifecycleHookName")) - } - if s.LifecycleHookName != nil && len(*s.LifecycleHookName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LifecycleHookName", 1)) - } - if s.NotificationMetadata != nil && len(*s.NotificationMetadata) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NotificationMetadata", 1)) - } - if s.RoleARN != nil && len(*s.RoleARN) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RoleARN", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *PutLifecycleHookInput) SetAutoScalingGroupName(v string) *PutLifecycleHookInput { - s.AutoScalingGroupName = &v - return s -} - -// SetDefaultResult sets the DefaultResult field's value. -func (s *PutLifecycleHookInput) SetDefaultResult(v string) *PutLifecycleHookInput { - s.DefaultResult = &v - return s -} - -// SetHeartbeatTimeout sets the HeartbeatTimeout field's value. -func (s *PutLifecycleHookInput) SetHeartbeatTimeout(v int64) *PutLifecycleHookInput { - s.HeartbeatTimeout = &v - return s -} - -// SetLifecycleHookName sets the LifecycleHookName field's value. -func (s *PutLifecycleHookInput) SetLifecycleHookName(v string) *PutLifecycleHookInput { - s.LifecycleHookName = &v - return s -} - -// SetLifecycleTransition sets the LifecycleTransition field's value. -func (s *PutLifecycleHookInput) SetLifecycleTransition(v string) *PutLifecycleHookInput { - s.LifecycleTransition = &v - return s -} - -// SetNotificationMetadata sets the NotificationMetadata field's value. -func (s *PutLifecycleHookInput) SetNotificationMetadata(v string) *PutLifecycleHookInput { - s.NotificationMetadata = &v - return s -} - -// SetNotificationTargetARN sets the NotificationTargetARN field's value. -func (s *PutLifecycleHookInput) SetNotificationTargetARN(v string) *PutLifecycleHookInput { - s.NotificationTargetARN = &v - return s -} - -// SetRoleARN sets the RoleARN field's value. -func (s *PutLifecycleHookInput) SetRoleARN(v string) *PutLifecycleHookInput { - s.RoleARN = &v - return s -} - -type PutLifecycleHookOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutLifecycleHookOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutLifecycleHookOutput) GoString() string { - return s.String() -} - -type PutNotificationConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The type of event that causes the notification to be sent. To query the notification - // types supported by Amazon EC2 Auto Scaling, call the DescribeAutoScalingNotificationTypes - // API. - // - // NotificationTypes is a required field - NotificationTypes []*string `type:"list" required:"true"` - - // The Amazon Resource Name (ARN) of the Amazon SNS topic. - // - // TopicARN is a required field - TopicARN *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutNotificationConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutNotificationConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutNotificationConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutNotificationConfigurationInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.NotificationTypes == nil { - invalidParams.Add(request.NewErrParamRequired("NotificationTypes")) - } - if s.TopicARN == nil { - invalidParams.Add(request.NewErrParamRequired("TopicARN")) - } - if s.TopicARN != nil && len(*s.TopicARN) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TopicARN", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *PutNotificationConfigurationInput) SetAutoScalingGroupName(v string) *PutNotificationConfigurationInput { - s.AutoScalingGroupName = &v - return s -} - -// SetNotificationTypes sets the NotificationTypes field's value. -func (s *PutNotificationConfigurationInput) SetNotificationTypes(v []*string) *PutNotificationConfigurationInput { - s.NotificationTypes = v - return s -} - -// SetTopicARN sets the TopicARN field's value. -func (s *PutNotificationConfigurationInput) SetTopicARN(v string) *PutNotificationConfigurationInput { - s.TopicARN = &v - return s -} - -type PutNotificationConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutNotificationConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutNotificationConfigurationOutput) GoString() string { - return s.String() -} - -type PutScalingPolicyInput struct { - _ struct{} `type:"structure"` - - // Specifies how the scaling adjustment is interpreted (for example, an absolute - // number or a percentage). The valid values are ChangeInCapacity, ExactCapacity, - // and PercentChangeInCapacity. - // - // Required if the policy type is StepScaling or SimpleScaling. For more information, - // see Scaling adjustment types (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment) - // in the Amazon EC2 Auto Scaling User Guide. - AdjustmentType *string `min:"1" type:"string"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // A cooldown period, in seconds, that applies to a specific simple scaling - // policy. When a cooldown period is specified here, it overrides the default - // cooldown. - // - // Valid only if the policy type is SimpleScaling. For more information, see - // Scaling cooldowns for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Default: None - Cooldown *int64 `type:"integer"` - - // Indicates whether the scaling policy is enabled or disabled. The default - // is enabled. For more information, see Disabling a scaling policy for an Auto - // Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enable-disable-scaling-policy.html) - // in the Amazon EC2 Auto Scaling User Guide. - Enabled *bool `type:"boolean"` - - // Not needed if the default instance warmup is defined for the group. - // - // The estimated time, in seconds, until a newly launched instance can contribute - // to the CloudWatch metrics. This warm-up period applies to instances launched - // due to a specific target tracking or step scaling policy. When a warm-up - // period is specified here, it overrides the default instance warmup. - // - // Valid only if the policy type is TargetTrackingScaling or StepScaling. - // - // The default is to use the value for the default instance warmup defined for - // the group. If default instance warmup is null, then EstimatedInstanceWarmup - // falls back to the value of default cooldown. - EstimatedInstanceWarmup *int64 `type:"integer"` - - // The aggregation type for the CloudWatch metrics. The valid values are Minimum, - // Maximum, and Average. If the aggregation type is null, the value is treated - // as Average. - // - // Valid only if the policy type is StepScaling. - MetricAggregationType *string `min:"1" type:"string"` - - // The minimum value to scale by when the adjustment type is PercentChangeInCapacity. - // For example, suppose that you create a step scaling policy to scale out an - // Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude - // of 2. If the group has 4 instances and the scaling policy is performed, 25 - // percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude - // of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances. - // - // Valid only if the policy type is StepScaling or SimpleScaling. For more information, - // see Scaling adjustment types (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Some Auto Scaling groups use instance weights. In this case, set the MinAdjustmentMagnitude - // to a value that is at least as large as your largest instance weight. - MinAdjustmentMagnitude *int64 `type:"integer"` - - // Available for backward compatibility. Use MinAdjustmentMagnitude instead. - MinAdjustmentStep *int64 `deprecated:"true" type:"integer"` - - // The name of the policy. - // - // PolicyName is a required field - PolicyName *string `min:"1" type:"string" required:"true"` - - // One of the following policy types: - // - // * TargetTrackingScaling - // - // * StepScaling - // - // * SimpleScaling (default) - // - // * PredictiveScaling - PolicyType *string `min:"1" type:"string"` - - // A predictive scaling policy. Provides support for predefined and custom metrics. - // - // Predefined metrics include CPU utilization, network in/out, and the Application - // Load Balancer request count. - // - // For more information, see PredictiveScalingConfiguration (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_PredictiveScalingConfiguration.html) - // in the Amazon EC2 Auto Scaling API Reference. - // - // Required if the policy type is PredictiveScaling. - PredictiveScalingConfiguration *PredictiveScalingConfiguration `type:"structure"` - - // The amount by which to scale, based on the specified adjustment type. A positive - // value adds to the current capacity while a negative number removes from the - // current capacity. For exact capacity, you must specify a positive value. - // - // Required if the policy type is SimpleScaling. (Not used with any other policy - // type.) - ScalingAdjustment *int64 `type:"integer"` - - // A set of adjustments that enable you to scale based on the size of the alarm - // breach. - // - // Required if the policy type is StepScaling. (Not used with any other policy - // type.) - StepAdjustments []*StepAdjustment `type:"list"` - - // A target tracking scaling policy. Provides support for predefined or custom - // metrics. - // - // The following predefined metrics are available: - // - // * ASGAverageCPUUtilization - // - // * ASGAverageNetworkIn - // - // * ASGAverageNetworkOut - // - // * ALBRequestCountPerTarget - // - // If you specify ALBRequestCountPerTarget for the metric, you must specify - // the ResourceLabel property with the PredefinedMetricSpecification. - // - // For more information, see TargetTrackingConfiguration (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_TargetTrackingConfiguration.html) - // in the Amazon EC2 Auto Scaling API Reference. - // - // Required if the policy type is TargetTrackingScaling. - TargetTrackingConfiguration *TargetTrackingConfiguration `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScalingPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScalingPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutScalingPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutScalingPolicyInput"} - if s.AdjustmentType != nil && len(*s.AdjustmentType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AdjustmentType", 1)) - } - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.MetricAggregationType != nil && len(*s.MetricAggregationType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("MetricAggregationType", 1)) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - if s.PolicyName != nil && len(*s.PolicyName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1)) - } - if s.PolicyType != nil && len(*s.PolicyType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PolicyType", 1)) - } - if s.PredictiveScalingConfiguration != nil { - if err := s.PredictiveScalingConfiguration.Validate(); err != nil { - invalidParams.AddNested("PredictiveScalingConfiguration", err.(request.ErrInvalidParams)) - } - } - if s.StepAdjustments != nil { - for i, v := range s.StepAdjustments { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "StepAdjustments", i), err.(request.ErrInvalidParams)) - } - } - } - if s.TargetTrackingConfiguration != nil { - if err := s.TargetTrackingConfiguration.Validate(); err != nil { - invalidParams.AddNested("TargetTrackingConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAdjustmentType sets the AdjustmentType field's value. -func (s *PutScalingPolicyInput) SetAdjustmentType(v string) *PutScalingPolicyInput { - s.AdjustmentType = &v - return s -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *PutScalingPolicyInput) SetAutoScalingGroupName(v string) *PutScalingPolicyInput { - s.AutoScalingGroupName = &v - return s -} - -// SetCooldown sets the Cooldown field's value. -func (s *PutScalingPolicyInput) SetCooldown(v int64) *PutScalingPolicyInput { - s.Cooldown = &v - return s -} - -// SetEnabled sets the Enabled field's value. -func (s *PutScalingPolicyInput) SetEnabled(v bool) *PutScalingPolicyInput { - s.Enabled = &v - return s -} - -// SetEstimatedInstanceWarmup sets the EstimatedInstanceWarmup field's value. -func (s *PutScalingPolicyInput) SetEstimatedInstanceWarmup(v int64) *PutScalingPolicyInput { - s.EstimatedInstanceWarmup = &v - return s -} - -// SetMetricAggregationType sets the MetricAggregationType field's value. -func (s *PutScalingPolicyInput) SetMetricAggregationType(v string) *PutScalingPolicyInput { - s.MetricAggregationType = &v - return s -} - -// SetMinAdjustmentMagnitude sets the MinAdjustmentMagnitude field's value. -func (s *PutScalingPolicyInput) SetMinAdjustmentMagnitude(v int64) *PutScalingPolicyInput { - s.MinAdjustmentMagnitude = &v - return s -} - -// SetMinAdjustmentStep sets the MinAdjustmentStep field's value. -func (s *PutScalingPolicyInput) SetMinAdjustmentStep(v int64) *PutScalingPolicyInput { - s.MinAdjustmentStep = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *PutScalingPolicyInput) SetPolicyName(v string) *PutScalingPolicyInput { - s.PolicyName = &v - return s -} - -// SetPolicyType sets the PolicyType field's value. -func (s *PutScalingPolicyInput) SetPolicyType(v string) *PutScalingPolicyInput { - s.PolicyType = &v - return s -} - -// SetPredictiveScalingConfiguration sets the PredictiveScalingConfiguration field's value. -func (s *PutScalingPolicyInput) SetPredictiveScalingConfiguration(v *PredictiveScalingConfiguration) *PutScalingPolicyInput { - s.PredictiveScalingConfiguration = v - return s -} - -// SetScalingAdjustment sets the ScalingAdjustment field's value. -func (s *PutScalingPolicyInput) SetScalingAdjustment(v int64) *PutScalingPolicyInput { - s.ScalingAdjustment = &v - return s -} - -// SetStepAdjustments sets the StepAdjustments field's value. -func (s *PutScalingPolicyInput) SetStepAdjustments(v []*StepAdjustment) *PutScalingPolicyInput { - s.StepAdjustments = v - return s -} - -// SetTargetTrackingConfiguration sets the TargetTrackingConfiguration field's value. -func (s *PutScalingPolicyInput) SetTargetTrackingConfiguration(v *TargetTrackingConfiguration) *PutScalingPolicyInput { - s.TargetTrackingConfiguration = v - return s -} - -// Contains the output of PutScalingPolicy. -type PutScalingPolicyOutput struct { - _ struct{} `type:"structure"` - - // The CloudWatch alarms created for the target tracking scaling policy. - Alarms []*Alarm `type:"list"` - - // The Amazon Resource Name (ARN) of the policy. - PolicyARN *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScalingPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScalingPolicyOutput) GoString() string { - return s.String() -} - -// SetAlarms sets the Alarms field's value. -func (s *PutScalingPolicyOutput) SetAlarms(v []*Alarm) *PutScalingPolicyOutput { - s.Alarms = v - return s -} - -// SetPolicyARN sets the PolicyARN field's value. -func (s *PutScalingPolicyOutput) SetPolicyARN(v string) *PutScalingPolicyOutput { - s.PolicyARN = &v - return s -} - -type PutScheduledUpdateGroupActionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The desired capacity is the initial capacity of the Auto Scaling group after - // the scheduled action runs and the capacity it attempts to maintain. It can - // scale beyond this capacity if you add more scaling conditions. - // - // You must specify at least one of the following properties: MaxSize, MinSize, - // or DesiredCapacity. - DesiredCapacity *int64 `type:"integer"` - - // The date and time for the recurring schedule to end, in UTC. For example, - // "2021-06-01T00:00:00Z". - EndTime *time.Time `type:"timestamp"` - - // The maximum size of the Auto Scaling group. - MaxSize *int64 `type:"integer"` - - // The minimum size of the Auto Scaling group. - MinSize *int64 `type:"integer"` - - // The recurring schedule for this action. This format consists of five fields - // separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] - // [Day_of_Week]. The value must be in quotes (for example, "30 0 1 1,6,12 *"). - // For more information about this format, see Crontab (http://crontab.org). - // - // When StartTime and EndTime are specified with Recurrence, they form the boundaries - // of when the recurring action starts and stops. - // - // Cron expressions use Universal Coordinated Time (UTC) by default. - Recurrence *string `min:"1" type:"string"` - - // The name of this scaling action. - // - // ScheduledActionName is a required field - ScheduledActionName *string `min:"1" type:"string" required:"true"` - - // The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format - // in UTC/GMT only and in quotes (for example, "2021-06-01T00:00:00Z"). - // - // If you specify Recurrence and StartTime, Amazon EC2 Auto Scaling performs - // the action at this time, and then performs the action based on the specified - // recurrence. - StartTime *time.Time `type:"timestamp"` - - // This property is no longer used. - Time *time.Time `type:"timestamp"` - - // Specifies the time zone for a cron expression. If a time zone is not provided, - // UTC is used by default. - // - // Valid values are the canonical names of the IANA time zones, derived from - // the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti). For more - // information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - // (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - TimeZone *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScheduledUpdateGroupActionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScheduledUpdateGroupActionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutScheduledUpdateGroupActionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutScheduledUpdateGroupActionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.Recurrence != nil && len(*s.Recurrence) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Recurrence", 1)) - } - if s.ScheduledActionName == nil { - invalidParams.Add(request.NewErrParamRequired("ScheduledActionName")) - } - if s.ScheduledActionName != nil && len(*s.ScheduledActionName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ScheduledActionName", 1)) - } - if s.TimeZone != nil && len(*s.TimeZone) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TimeZone", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *PutScheduledUpdateGroupActionInput) SetAutoScalingGroupName(v string) *PutScheduledUpdateGroupActionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetDesiredCapacity sets the DesiredCapacity field's value. -func (s *PutScheduledUpdateGroupActionInput) SetDesiredCapacity(v int64) *PutScheduledUpdateGroupActionInput { - s.DesiredCapacity = &v - return s -} - -// SetEndTime sets the EndTime field's value. -func (s *PutScheduledUpdateGroupActionInput) SetEndTime(v time.Time) *PutScheduledUpdateGroupActionInput { - s.EndTime = &v - return s -} - -// SetMaxSize sets the MaxSize field's value. -func (s *PutScheduledUpdateGroupActionInput) SetMaxSize(v int64) *PutScheduledUpdateGroupActionInput { - s.MaxSize = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *PutScheduledUpdateGroupActionInput) SetMinSize(v int64) *PutScheduledUpdateGroupActionInput { - s.MinSize = &v - return s -} - -// SetRecurrence sets the Recurrence field's value. -func (s *PutScheduledUpdateGroupActionInput) SetRecurrence(v string) *PutScheduledUpdateGroupActionInput { - s.Recurrence = &v - return s -} - -// SetScheduledActionName sets the ScheduledActionName field's value. -func (s *PutScheduledUpdateGroupActionInput) SetScheduledActionName(v string) *PutScheduledUpdateGroupActionInput { - s.ScheduledActionName = &v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *PutScheduledUpdateGroupActionInput) SetStartTime(v time.Time) *PutScheduledUpdateGroupActionInput { - s.StartTime = &v - return s -} - -// SetTime sets the Time field's value. -func (s *PutScheduledUpdateGroupActionInput) SetTime(v time.Time) *PutScheduledUpdateGroupActionInput { - s.Time = &v - return s -} - -// SetTimeZone sets the TimeZone field's value. -func (s *PutScheduledUpdateGroupActionInput) SetTimeZone(v string) *PutScheduledUpdateGroupActionInput { - s.TimeZone = &v - return s -} - -type PutScheduledUpdateGroupActionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScheduledUpdateGroupActionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutScheduledUpdateGroupActionOutput) GoString() string { - return s.String() -} - -type PutWarmPoolInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // Indicates whether instances in the Auto Scaling group can be returned to - // the warm pool on scale in. The default is to terminate instances in the Auto - // Scaling group when the group scales in. - InstanceReusePolicy *InstanceReusePolicy `type:"structure"` - - // Specifies the maximum number of instances that are allowed to be in the warm - // pool or in any state except Terminated for the Auto Scaling group. This is - // an optional property. Specify it only if you do not want the warm pool size - // to be determined by the difference between the group's maximum capacity and - // its desired capacity. - // - // If a value for MaxGroupPreparedCapacity is not specified, Amazon EC2 Auto - // Scaling launches and maintains the difference between the group's maximum - // capacity and its desired capacity. If you specify a value for MaxGroupPreparedCapacity, - // Amazon EC2 Auto Scaling uses the difference between the MaxGroupPreparedCapacity - // and the desired capacity instead. - // - // The size of the warm pool is dynamic. Only when MaxGroupPreparedCapacity - // and MinSize are set to the same value does the warm pool have an absolute - // size. - // - // If the desired capacity of the Auto Scaling group is higher than the MaxGroupPreparedCapacity, - // the capacity of the warm pool is 0, unless you specify a value for MinSize. - // To remove a value that you previously set, include the property but specify - // -1 for the value. - MaxGroupPreparedCapacity *int64 `type:"integer"` - - // Specifies the minimum number of instances to maintain in the warm pool. This - // helps you to ensure that there is always a certain number of warmed instances - // available to handle traffic spikes. Defaults to 0 if not specified. - MinSize *int64 `type:"integer"` - - // Sets the instance state to transition to after the lifecycle actions are - // complete. Default is Stopped. - PoolState *string `type:"string" enum:"WarmPoolState"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutWarmPoolInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutWarmPoolInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutWarmPoolInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutWarmPoolInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.MaxGroupPreparedCapacity != nil && *s.MaxGroupPreparedCapacity < -1 { - invalidParams.Add(request.NewErrParamMinValue("MaxGroupPreparedCapacity", -1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *PutWarmPoolInput) SetAutoScalingGroupName(v string) *PutWarmPoolInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceReusePolicy sets the InstanceReusePolicy field's value. -func (s *PutWarmPoolInput) SetInstanceReusePolicy(v *InstanceReusePolicy) *PutWarmPoolInput { - s.InstanceReusePolicy = v - return s -} - -// SetMaxGroupPreparedCapacity sets the MaxGroupPreparedCapacity field's value. -func (s *PutWarmPoolInput) SetMaxGroupPreparedCapacity(v int64) *PutWarmPoolInput { - s.MaxGroupPreparedCapacity = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *PutWarmPoolInput) SetMinSize(v int64) *PutWarmPoolInput { - s.MinSize = &v - return s -} - -// SetPoolState sets the PoolState field's value. -func (s *PutWarmPoolInput) SetPoolState(v string) *PutWarmPoolInput { - s.PoolState = &v - return s -} - -type PutWarmPoolOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutWarmPoolOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutWarmPoolOutput) GoString() string { - return s.String() -} - -type RecordLifecycleActionHeartbeatInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The ID of the instance. - InstanceId *string `min:"1" type:"string"` - - // A token that uniquely identifies a specific lifecycle action associated with - // an instance. Amazon EC2 Auto Scaling sends this token to the notification - // target that you specified when you created the lifecycle hook. - LifecycleActionToken *string `min:"36" type:"string"` - - // The name of the lifecycle hook. - // - // LifecycleHookName is a required field - LifecycleHookName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RecordLifecycleActionHeartbeatInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RecordLifecycleActionHeartbeatInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RecordLifecycleActionHeartbeatInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RecordLifecycleActionHeartbeatInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.InstanceId != nil && len(*s.InstanceId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceId", 1)) - } - if s.LifecycleActionToken != nil && len(*s.LifecycleActionToken) < 36 { - invalidParams.Add(request.NewErrParamMinLen("LifecycleActionToken", 36)) - } - if s.LifecycleHookName == nil { - invalidParams.Add(request.NewErrParamRequired("LifecycleHookName")) - } - if s.LifecycleHookName != nil && len(*s.LifecycleHookName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LifecycleHookName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *RecordLifecycleActionHeartbeatInput) SetAutoScalingGroupName(v string) *RecordLifecycleActionHeartbeatInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *RecordLifecycleActionHeartbeatInput) SetInstanceId(v string) *RecordLifecycleActionHeartbeatInput { - s.InstanceId = &v - return s -} - -// SetLifecycleActionToken sets the LifecycleActionToken field's value. -func (s *RecordLifecycleActionHeartbeatInput) SetLifecycleActionToken(v string) *RecordLifecycleActionHeartbeatInput { - s.LifecycleActionToken = &v - return s -} - -// SetLifecycleHookName sets the LifecycleHookName field's value. -func (s *RecordLifecycleActionHeartbeatInput) SetLifecycleHookName(v string) *RecordLifecycleActionHeartbeatInput { - s.LifecycleHookName = &v - return s -} - -type RecordLifecycleActionHeartbeatOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RecordLifecycleActionHeartbeatOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RecordLifecycleActionHeartbeatOutput) GoString() string { - return s.String() -} - -// Describes the preferences for an instance refresh. -type RefreshPreferences struct { - _ struct{} `type:"structure"` - - // The amount of time, in seconds, to wait after a checkpoint before continuing. - // This property is optional, but if you specify a value for it, you must also - // specify a value for CheckpointPercentages. If you specify a value for CheckpointPercentages - // and not for CheckpointDelay, the CheckpointDelay defaults to 3600 (1 hour). - CheckpointDelay *int64 `type:"integer"` - - // Threshold values for each checkpoint in ascending order. Each number must - // be unique. To replace all instances in the Auto Scaling group, the last number - // in the array must be 100. - // - // For usage examples, see Adding checkpoints to an instance refresh (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-adding-checkpoints-instance-refresh.html) - // in the Amazon EC2 Auto Scaling User Guide. - CheckpointPercentages []*int64 `type:"list"` - - // Not needed if the default instance warmup is defined for the group. - // - // The duration of the instance warmup, in seconds. - // - // The default is to use the value for the default instance warmup defined for - // the group. If default instance warmup is null, then InstanceWarmup falls - // back to the value of the health check grace period. - InstanceWarmup *int64 `type:"integer"` - - // The amount of capacity in the Auto Scaling group that must pass your group's - // health checks to allow the operation to continue. The value is expressed - // as a percentage of the desired capacity of the Auto Scaling group (rounded - // up to the nearest integer). The default is 90. - // - // Setting the minimum healthy percentage to 100 percent limits the rate of - // replacement to one instance at a time. In contrast, setting it to 0 percent - // has the effect of replacing all instances at the same time. - MinHealthyPercentage *int64 `type:"integer"` - - // A boolean value that indicates whether skip matching is enabled. If true, - // then Amazon EC2 Auto Scaling skips replacing instances that match the desired - // configuration. If no desired configuration is specified, then it skips replacing - // instances that have the same configuration that is already set on the group. - // The default is false. - SkipMatching *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RefreshPreferences) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RefreshPreferences) GoString() string { - return s.String() -} - -// SetCheckpointDelay sets the CheckpointDelay field's value. -func (s *RefreshPreferences) SetCheckpointDelay(v int64) *RefreshPreferences { - s.CheckpointDelay = &v - return s -} - -// SetCheckpointPercentages sets the CheckpointPercentages field's value. -func (s *RefreshPreferences) SetCheckpointPercentages(v []*int64) *RefreshPreferences { - s.CheckpointPercentages = v - return s -} - -// SetInstanceWarmup sets the InstanceWarmup field's value. -func (s *RefreshPreferences) SetInstanceWarmup(v int64) *RefreshPreferences { - s.InstanceWarmup = &v - return s -} - -// SetMinHealthyPercentage sets the MinHealthyPercentage field's value. -func (s *RefreshPreferences) SetMinHealthyPercentage(v int64) *RefreshPreferences { - s.MinHealthyPercentage = &v - return s -} - -// SetSkipMatching sets the SkipMatching field's value. -func (s *RefreshPreferences) SetSkipMatching(v bool) *RefreshPreferences { - s.SkipMatching = &v - return s -} - -type ResumeProcessesOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ResumeProcessesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ResumeProcessesOutput) GoString() string { - return s.String() -} - -// Describes a scaling policy. -type ScalingPolicy struct { - _ struct{} `type:"structure"` - - // Specifies how the scaling adjustment is interpreted (for example, an absolute - // number or a percentage). The valid values are ChangeInCapacity, ExactCapacity, - // and PercentChangeInCapacity. - AdjustmentType *string `min:"1" type:"string"` - - // The CloudWatch alarms related to the policy. - Alarms []*Alarm `type:"list"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // The duration of the policy's cooldown period, in seconds. - Cooldown *int64 `type:"integer"` - - // Indicates whether the policy is enabled (true) or disabled (false). - Enabled *bool `type:"boolean"` - - // The estimated time, in seconds, until a newly launched instance can contribute - // to the CloudWatch metrics. - EstimatedInstanceWarmup *int64 `type:"integer"` - - // The aggregation type for the CloudWatch metrics. The valid values are Minimum, - // Maximum, and Average. - MetricAggregationType *string `min:"1" type:"string"` - - // The minimum value to scale by when the adjustment type is PercentChangeInCapacity. - MinAdjustmentMagnitude *int64 `type:"integer"` - - // Available for backward compatibility. Use MinAdjustmentMagnitude instead. - MinAdjustmentStep *int64 `deprecated:"true" type:"integer"` - - // The Amazon Resource Name (ARN) of the policy. - PolicyARN *string `min:"1" type:"string"` - - // The name of the scaling policy. - PolicyName *string `min:"1" type:"string"` - - // One of the following policy types: - // - // * TargetTrackingScaling - // - // * StepScaling - // - // * SimpleScaling (default) - // - // * PredictiveScaling - // - // For more information, see Target tracking scaling policies (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html) - // and Step and simple scaling policies (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html) - // in the Amazon EC2 Auto Scaling User Guide. - PolicyType *string `min:"1" type:"string"` - - // A predictive scaling policy. - PredictiveScalingConfiguration *PredictiveScalingConfiguration `type:"structure"` - - // The amount by which to scale, based on the specified adjustment type. A positive - // value adds to the current capacity while a negative number removes from the - // current capacity. - ScalingAdjustment *int64 `type:"integer"` - - // A set of adjustments that enable you to scale based on the size of the alarm - // breach. - StepAdjustments []*StepAdjustment `type:"list"` - - // A target tracking scaling policy. - TargetTrackingConfiguration *TargetTrackingConfiguration `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScalingPolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScalingPolicy) GoString() string { - return s.String() -} - -// SetAdjustmentType sets the AdjustmentType field's value. -func (s *ScalingPolicy) SetAdjustmentType(v string) *ScalingPolicy { - s.AdjustmentType = &v - return s -} - -// SetAlarms sets the Alarms field's value. -func (s *ScalingPolicy) SetAlarms(v []*Alarm) *ScalingPolicy { - s.Alarms = v - return s -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *ScalingPolicy) SetAutoScalingGroupName(v string) *ScalingPolicy { - s.AutoScalingGroupName = &v - return s -} - -// SetCooldown sets the Cooldown field's value. -func (s *ScalingPolicy) SetCooldown(v int64) *ScalingPolicy { - s.Cooldown = &v - return s -} - -// SetEnabled sets the Enabled field's value. -func (s *ScalingPolicy) SetEnabled(v bool) *ScalingPolicy { - s.Enabled = &v - return s -} - -// SetEstimatedInstanceWarmup sets the EstimatedInstanceWarmup field's value. -func (s *ScalingPolicy) SetEstimatedInstanceWarmup(v int64) *ScalingPolicy { - s.EstimatedInstanceWarmup = &v - return s -} - -// SetMetricAggregationType sets the MetricAggregationType field's value. -func (s *ScalingPolicy) SetMetricAggregationType(v string) *ScalingPolicy { - s.MetricAggregationType = &v - return s -} - -// SetMinAdjustmentMagnitude sets the MinAdjustmentMagnitude field's value. -func (s *ScalingPolicy) SetMinAdjustmentMagnitude(v int64) *ScalingPolicy { - s.MinAdjustmentMagnitude = &v - return s -} - -// SetMinAdjustmentStep sets the MinAdjustmentStep field's value. -func (s *ScalingPolicy) SetMinAdjustmentStep(v int64) *ScalingPolicy { - s.MinAdjustmentStep = &v - return s -} - -// SetPolicyARN sets the PolicyARN field's value. -func (s *ScalingPolicy) SetPolicyARN(v string) *ScalingPolicy { - s.PolicyARN = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *ScalingPolicy) SetPolicyName(v string) *ScalingPolicy { - s.PolicyName = &v - return s -} - -// SetPolicyType sets the PolicyType field's value. -func (s *ScalingPolicy) SetPolicyType(v string) *ScalingPolicy { - s.PolicyType = &v - return s -} - -// SetPredictiveScalingConfiguration sets the PredictiveScalingConfiguration field's value. -func (s *ScalingPolicy) SetPredictiveScalingConfiguration(v *PredictiveScalingConfiguration) *ScalingPolicy { - s.PredictiveScalingConfiguration = v - return s -} - -// SetScalingAdjustment sets the ScalingAdjustment field's value. -func (s *ScalingPolicy) SetScalingAdjustment(v int64) *ScalingPolicy { - s.ScalingAdjustment = &v - return s -} - -// SetStepAdjustments sets the StepAdjustments field's value. -func (s *ScalingPolicy) SetStepAdjustments(v []*StepAdjustment) *ScalingPolicy { - s.StepAdjustments = v - return s -} - -// SetTargetTrackingConfiguration sets the TargetTrackingConfiguration field's value. -func (s *ScalingPolicy) SetTargetTrackingConfiguration(v *TargetTrackingConfiguration) *ScalingPolicy { - s.TargetTrackingConfiguration = v - return s -} - -type ScalingProcessQuery struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // One or more of the following processes: - // - // * Launch - // - // * Terminate - // - // * AddToLoadBalancer - // - // * AlarmNotification - // - // * AZRebalance - // - // * HealthCheck - // - // * InstanceRefresh - // - // * ReplaceUnhealthy - // - // * ScheduledActions - // - // If you omit this property, all processes are specified. - ScalingProcesses []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScalingProcessQuery) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScalingProcessQuery) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ScalingProcessQuery) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ScalingProcessQuery"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *ScalingProcessQuery) SetAutoScalingGroupName(v string) *ScalingProcessQuery { - s.AutoScalingGroupName = &v - return s -} - -// SetScalingProcesses sets the ScalingProcesses field's value. -func (s *ScalingProcessQuery) SetScalingProcesses(v []*string) *ScalingProcessQuery { - s.ScalingProcesses = v - return s -} - -// Describes a scheduled scaling action. -type ScheduledUpdateGroupAction struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - AutoScalingGroupName *string `min:"1" type:"string"` - - // The desired capacity is the initial capacity of the Auto Scaling group after - // the scheduled action runs and the capacity it attempts to maintain. - DesiredCapacity *int64 `type:"integer"` - - // The date and time in UTC for the recurring schedule to end. For example, - // "2019-06-01T00:00:00Z". - EndTime *time.Time `type:"timestamp"` - - // The maximum size of the Auto Scaling group. - MaxSize *int64 `type:"integer"` - - // The minimum size of the Auto Scaling group. - MinSize *int64 `type:"integer"` - - // The recurring schedule for the action, in Unix cron syntax format. - // - // When StartTime and EndTime are specified with Recurrence, they form the boundaries - // of when the recurring action starts and stops. - Recurrence *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the scheduled action. - ScheduledActionARN *string `min:"1" type:"string"` - - // The name of the scheduled action. - ScheduledActionName *string `min:"1" type:"string"` - - // The date and time in UTC for this action to start. For example, "2019-06-01T00:00:00Z". - StartTime *time.Time `type:"timestamp"` - - // This property is no longer used. - Time *time.Time `type:"timestamp"` - - // The time zone for the cron expression. - TimeZone *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduledUpdateGroupAction) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduledUpdateGroupAction) GoString() string { - return s.String() -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *ScheduledUpdateGroupAction) SetAutoScalingGroupName(v string) *ScheduledUpdateGroupAction { - s.AutoScalingGroupName = &v - return s -} - -// SetDesiredCapacity sets the DesiredCapacity field's value. -func (s *ScheduledUpdateGroupAction) SetDesiredCapacity(v int64) *ScheduledUpdateGroupAction { - s.DesiredCapacity = &v - return s -} - -// SetEndTime sets the EndTime field's value. -func (s *ScheduledUpdateGroupAction) SetEndTime(v time.Time) *ScheduledUpdateGroupAction { - s.EndTime = &v - return s -} - -// SetMaxSize sets the MaxSize field's value. -func (s *ScheduledUpdateGroupAction) SetMaxSize(v int64) *ScheduledUpdateGroupAction { - s.MaxSize = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *ScheduledUpdateGroupAction) SetMinSize(v int64) *ScheduledUpdateGroupAction { - s.MinSize = &v - return s -} - -// SetRecurrence sets the Recurrence field's value. -func (s *ScheduledUpdateGroupAction) SetRecurrence(v string) *ScheduledUpdateGroupAction { - s.Recurrence = &v - return s -} - -// SetScheduledActionARN sets the ScheduledActionARN field's value. -func (s *ScheduledUpdateGroupAction) SetScheduledActionARN(v string) *ScheduledUpdateGroupAction { - s.ScheduledActionARN = &v - return s -} - -// SetScheduledActionName sets the ScheduledActionName field's value. -func (s *ScheduledUpdateGroupAction) SetScheduledActionName(v string) *ScheduledUpdateGroupAction { - s.ScheduledActionName = &v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *ScheduledUpdateGroupAction) SetStartTime(v time.Time) *ScheduledUpdateGroupAction { - s.StartTime = &v - return s -} - -// SetTime sets the Time field's value. -func (s *ScheduledUpdateGroupAction) SetTime(v time.Time) *ScheduledUpdateGroupAction { - s.Time = &v - return s -} - -// SetTimeZone sets the TimeZone field's value. -func (s *ScheduledUpdateGroupAction) SetTimeZone(v string) *ScheduledUpdateGroupAction { - s.TimeZone = &v - return s -} - -// Describes information used for one or more scheduled scaling action updates -// in a BatchPutScheduledUpdateGroupAction operation. -type ScheduledUpdateGroupActionRequest struct { - _ struct{} `type:"structure"` - - // The desired capacity is the initial capacity of the Auto Scaling group after - // the scheduled action runs and the capacity it attempts to maintain. - DesiredCapacity *int64 `type:"integer"` - - // The date and time for the recurring schedule to end, in UTC. - EndTime *time.Time `type:"timestamp"` - - // The maximum size of the Auto Scaling group. - MaxSize *int64 `type:"integer"` - - // The minimum size of the Auto Scaling group. - MinSize *int64 `type:"integer"` - - // The recurring schedule for the action, in Unix cron syntax format. This format - // consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] - // [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, - // "30 0 1 1,6,12 *"). For more information about this format, see Crontab (http://crontab.org). - // - // When StartTime and EndTime are specified with Recurrence, they form the boundaries - // of when the recurring action starts and stops. - // - // Cron expressions use Universal Coordinated Time (UTC) by default. - Recurrence *string `min:"1" type:"string"` - - // The name of the scaling action. - // - // ScheduledActionName is a required field - ScheduledActionName *string `min:"1" type:"string" required:"true"` - - // The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ format - // in UTC/GMT only and in quotes (for example, "2019-06-01T00:00:00Z"). - // - // If you specify Recurrence and StartTime, Amazon EC2 Auto Scaling performs - // the action at this time, and then performs the action based on the specified - // recurrence. - // - // If you try to schedule the action in the past, Amazon EC2 Auto Scaling returns - // an error message. - StartTime *time.Time `type:"timestamp"` - - // Specifies the time zone for a cron expression. If a time zone is not provided, - // UTC is used by default. - // - // Valid values are the canonical names of the IANA time zones, derived from - // the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti). For more - // information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - // (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - TimeZone *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduledUpdateGroupActionRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduledUpdateGroupActionRequest) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ScheduledUpdateGroupActionRequest) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ScheduledUpdateGroupActionRequest"} - if s.Recurrence != nil && len(*s.Recurrence) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Recurrence", 1)) - } - if s.ScheduledActionName == nil { - invalidParams.Add(request.NewErrParamRequired("ScheduledActionName")) - } - if s.ScheduledActionName != nil && len(*s.ScheduledActionName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ScheduledActionName", 1)) - } - if s.TimeZone != nil && len(*s.TimeZone) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TimeZone", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDesiredCapacity sets the DesiredCapacity field's value. -func (s *ScheduledUpdateGroupActionRequest) SetDesiredCapacity(v int64) *ScheduledUpdateGroupActionRequest { - s.DesiredCapacity = &v - return s -} - -// SetEndTime sets the EndTime field's value. -func (s *ScheduledUpdateGroupActionRequest) SetEndTime(v time.Time) *ScheduledUpdateGroupActionRequest { - s.EndTime = &v - return s -} - -// SetMaxSize sets the MaxSize field's value. -func (s *ScheduledUpdateGroupActionRequest) SetMaxSize(v int64) *ScheduledUpdateGroupActionRequest { - s.MaxSize = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *ScheduledUpdateGroupActionRequest) SetMinSize(v int64) *ScheduledUpdateGroupActionRequest { - s.MinSize = &v - return s -} - -// SetRecurrence sets the Recurrence field's value. -func (s *ScheduledUpdateGroupActionRequest) SetRecurrence(v string) *ScheduledUpdateGroupActionRequest { - s.Recurrence = &v - return s -} - -// SetScheduledActionName sets the ScheduledActionName field's value. -func (s *ScheduledUpdateGroupActionRequest) SetScheduledActionName(v string) *ScheduledUpdateGroupActionRequest { - s.ScheduledActionName = &v - return s -} - -// SetStartTime sets the StartTime field's value. -func (s *ScheduledUpdateGroupActionRequest) SetStartTime(v time.Time) *ScheduledUpdateGroupActionRequest { - s.StartTime = &v - return s -} - -// SetTimeZone sets the TimeZone field's value. -func (s *ScheduledUpdateGroupActionRequest) SetTimeZone(v string) *ScheduledUpdateGroupActionRequest { - s.TimeZone = &v - return s -} - -type SetDesiredCapacityInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The desired capacity is the initial capacity of the Auto Scaling group after - // this operation completes and the capacity it attempts to maintain. - // - // DesiredCapacity is a required field - DesiredCapacity *int64 `type:"integer" required:"true"` - - // Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to - // complete before initiating a scaling activity to set your Auto Scaling group - // to its new capacity. By default, Amazon EC2 Auto Scaling does not honor the - // cooldown period during manual scaling activities. - HonorCooldown *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetDesiredCapacityInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetDesiredCapacityInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetDesiredCapacityInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetDesiredCapacityInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.DesiredCapacity == nil { - invalidParams.Add(request.NewErrParamRequired("DesiredCapacity")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *SetDesiredCapacityInput) SetAutoScalingGroupName(v string) *SetDesiredCapacityInput { - s.AutoScalingGroupName = &v - return s -} - -// SetDesiredCapacity sets the DesiredCapacity field's value. -func (s *SetDesiredCapacityInput) SetDesiredCapacity(v int64) *SetDesiredCapacityInput { - s.DesiredCapacity = &v - return s -} - -// SetHonorCooldown sets the HonorCooldown field's value. -func (s *SetDesiredCapacityInput) SetHonorCooldown(v bool) *SetDesiredCapacityInput { - s.HonorCooldown = &v - return s -} - -type SetDesiredCapacityOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetDesiredCapacityOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetDesiredCapacityOutput) GoString() string { - return s.String() -} - -type SetInstanceHealthInput struct { - _ struct{} `type:"structure"` - - // The health status of the instance. Set to Healthy to have the instance remain - // in service. Set to Unhealthy to have the instance be out of service. Amazon - // EC2 Auto Scaling terminates and replaces the unhealthy instance. - // - // HealthStatus is a required field - HealthStatus *string `min:"1" type:"string" required:"true"` - - // The ID of the instance. - // - // InstanceId is a required field - InstanceId *string `min:"1" type:"string" required:"true"` - - // If the Auto Scaling group of the specified instance has a HealthCheckGracePeriod - // specified for the group, by default, this call respects the grace period. - // Set this to False, to have the call not respect the grace period associated - // with the group. - // - // For more information about the health check grace period, see CreateAutoScalingGroup - // (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CreateAutoScalingGroup.html) - // in the Amazon EC2 Auto Scaling API Reference. - ShouldRespectGracePeriod *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceHealthInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceHealthInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetInstanceHealthInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetInstanceHealthInput"} - if s.HealthStatus == nil { - invalidParams.Add(request.NewErrParamRequired("HealthStatus")) - } - if s.HealthStatus != nil && len(*s.HealthStatus) < 1 { - invalidParams.Add(request.NewErrParamMinLen("HealthStatus", 1)) - } - if s.InstanceId == nil { - invalidParams.Add(request.NewErrParamRequired("InstanceId")) - } - if s.InstanceId != nil && len(*s.InstanceId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHealthStatus sets the HealthStatus field's value. -func (s *SetInstanceHealthInput) SetHealthStatus(v string) *SetInstanceHealthInput { - s.HealthStatus = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *SetInstanceHealthInput) SetInstanceId(v string) *SetInstanceHealthInput { - s.InstanceId = &v - return s -} - -// SetShouldRespectGracePeriod sets the ShouldRespectGracePeriod field's value. -func (s *SetInstanceHealthInput) SetShouldRespectGracePeriod(v bool) *SetInstanceHealthInput { - s.ShouldRespectGracePeriod = &v - return s -} - -type SetInstanceHealthOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceHealthOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceHealthOutput) GoString() string { - return s.String() -} - -type SetInstanceProtectionInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // One or more instance IDs. You can specify up to 50 instances. - // - // InstanceIds is a required field - InstanceIds []*string `type:"list" required:"true"` - - // Indicates whether the instance is protected from termination by Amazon EC2 - // Auto Scaling when scaling in. - // - // ProtectedFromScaleIn is a required field - ProtectedFromScaleIn *bool `type:"boolean" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceProtectionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceProtectionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetInstanceProtectionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetInstanceProtectionInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.InstanceIds == nil { - invalidParams.Add(request.NewErrParamRequired("InstanceIds")) - } - if s.ProtectedFromScaleIn == nil { - invalidParams.Add(request.NewErrParamRequired("ProtectedFromScaleIn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *SetInstanceProtectionInput) SetAutoScalingGroupName(v string) *SetInstanceProtectionInput { - s.AutoScalingGroupName = &v - return s -} - -// SetInstanceIds sets the InstanceIds field's value. -func (s *SetInstanceProtectionInput) SetInstanceIds(v []*string) *SetInstanceProtectionInput { - s.InstanceIds = v - return s -} - -// SetProtectedFromScaleIn sets the ProtectedFromScaleIn field's value. -func (s *SetInstanceProtectionInput) SetProtectedFromScaleIn(v bool) *SetInstanceProtectionInput { - s.ProtectedFromScaleIn = &v - return s -} - -type SetInstanceProtectionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceProtectionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetInstanceProtectionOutput) GoString() string { - return s.String() -} - -type StartInstanceRefreshInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // The desired configuration. For example, the desired configuration can specify - // a new launch template or a new version of the current launch template. - // - // Once the instance refresh succeeds, Amazon EC2 Auto Scaling updates the settings - // of the Auto Scaling group to reflect the new desired configuration. - // - // When you specify a new launch template or a new version of the current launch - // template for your desired configuration, consider enabling the SkipMatching - // property in preferences. If it's enabled, Amazon EC2 Auto Scaling skips replacing - // instances that already use the specified launch template and version. This - // can help you reduce the number of replacements that are required to apply - // updates. - DesiredConfiguration *DesiredConfiguration `type:"structure"` - - // Set of preferences associated with the instance refresh request. If not provided, - // the default values are used. - Preferences *RefreshPreferences `type:"structure"` - - // The strategy to use for the instance refresh. The only valid value is Rolling. - // - // A rolling update helps you update your instances gradually. A rolling update - // can fail due to failed health checks or if instances are on standby or are - // protected from scale in. If the rolling update process fails, any instances - // that are replaced are not rolled back to their previous configuration. - Strategy *string `type:"string" enum:"RefreshStrategy"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s StartInstanceRefreshInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s StartInstanceRefreshInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *StartInstanceRefreshInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "StartInstanceRefreshInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.DesiredConfiguration != nil { - if err := s.DesiredConfiguration.Validate(); err != nil { - invalidParams.AddNested("DesiredConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *StartInstanceRefreshInput) SetAutoScalingGroupName(v string) *StartInstanceRefreshInput { - s.AutoScalingGroupName = &v - return s -} - -// SetDesiredConfiguration sets the DesiredConfiguration field's value. -func (s *StartInstanceRefreshInput) SetDesiredConfiguration(v *DesiredConfiguration) *StartInstanceRefreshInput { - s.DesiredConfiguration = v - return s -} - -// SetPreferences sets the Preferences field's value. -func (s *StartInstanceRefreshInput) SetPreferences(v *RefreshPreferences) *StartInstanceRefreshInput { - s.Preferences = v - return s -} - -// SetStrategy sets the Strategy field's value. -func (s *StartInstanceRefreshInput) SetStrategy(v string) *StartInstanceRefreshInput { - s.Strategy = &v - return s -} - -type StartInstanceRefreshOutput struct { - _ struct{} `type:"structure"` - - // A unique ID for tracking the progress of the request. - InstanceRefreshId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s StartInstanceRefreshOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s StartInstanceRefreshOutput) GoString() string { - return s.String() -} - -// SetInstanceRefreshId sets the InstanceRefreshId field's value. -func (s *StartInstanceRefreshOutput) SetInstanceRefreshId(v string) *StartInstanceRefreshOutput { - s.InstanceRefreshId = &v - return s -} - -// Describes information used to create a step adjustment for a step scaling -// policy. -// -// For the following examples, suppose that you have an alarm with a breach -// threshold of 50: -// -// - To trigger the adjustment when the metric is greater than or equal to -// 50 and less than 60, specify a lower bound of 0 and an upper bound of -// 10. -// -// - To trigger the adjustment when the metric is greater than 40 and less -// than or equal to 50, specify a lower bound of -10 and an upper bound of -// 0. -// -// There are a few rules for the step adjustments for your step policy: -// -// - The ranges of your step adjustments can't overlap or have a gap. -// -// - At most, one step adjustment can have a null lower bound. If one step -// adjustment has a negative lower bound, then there must be a step adjustment -// with a null lower bound. -// -// - At most, one step adjustment can have a null upper bound. If one step -// adjustment has a positive upper bound, then there must be a step adjustment -// with a null upper bound. -// -// - The upper and lower bound can't be null in the same step adjustment. -// -// For more information, see Step adjustments (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-steps) -// in the Amazon EC2 Auto Scaling User Guide. -type StepAdjustment struct { - _ struct{} `type:"structure"` - - // The lower bound for the difference between the alarm threshold and the CloudWatch - // metric. If the metric value is above the breach threshold, the lower bound - // is inclusive (the metric must be greater than or equal to the threshold plus - // the lower bound). Otherwise, it is exclusive (the metric must be greater - // than the threshold plus the lower bound). A null value indicates negative - // infinity. - MetricIntervalLowerBound *float64 `type:"double"` - - // The upper bound for the difference between the alarm threshold and the CloudWatch - // metric. If the metric value is above the breach threshold, the upper bound - // is exclusive (the metric must be less than the threshold plus the upper bound). - // Otherwise, it is inclusive (the metric must be less than or equal to the - // threshold plus the upper bound). A null value indicates positive infinity. - // - // The upper bound must be greater than the lower bound. - MetricIntervalUpperBound *float64 `type:"double"` - - // The amount by which to scale, based on the specified adjustment type. A positive - // value adds to the current capacity while a negative number removes from the - // current capacity. - // - // The amount by which to scale. The adjustment is based on the value that you - // specified in the AdjustmentType property (either an absolute number or a - // percentage). A positive value adds to the current capacity and a negative - // number subtracts from the current capacity. - // - // ScalingAdjustment is a required field - ScalingAdjustment *int64 `type:"integer" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s StepAdjustment) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s StepAdjustment) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *StepAdjustment) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "StepAdjustment"} - if s.ScalingAdjustment == nil { - invalidParams.Add(request.NewErrParamRequired("ScalingAdjustment")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMetricIntervalLowerBound sets the MetricIntervalLowerBound field's value. -func (s *StepAdjustment) SetMetricIntervalLowerBound(v float64) *StepAdjustment { - s.MetricIntervalLowerBound = &v - return s -} - -// SetMetricIntervalUpperBound sets the MetricIntervalUpperBound field's value. -func (s *StepAdjustment) SetMetricIntervalUpperBound(v float64) *StepAdjustment { - s.MetricIntervalUpperBound = &v - return s -} - -// SetScalingAdjustment sets the ScalingAdjustment field's value. -func (s *StepAdjustment) SetScalingAdjustment(v int64) *StepAdjustment { - s.ScalingAdjustment = &v - return s -} - -type SuspendProcessesOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SuspendProcessesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SuspendProcessesOutput) GoString() string { - return s.String() -} - -// Describes an auto scaling process that has been suspended. -// -// For more information, see Scaling processes (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types) -// in the Amazon EC2 Auto Scaling User Guide. -type SuspendedProcess struct { - _ struct{} `type:"structure"` - - // The name of the suspended process. - ProcessName *string `min:"1" type:"string"` - - // The reason that the process was suspended. - SuspensionReason *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SuspendedProcess) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SuspendedProcess) GoString() string { - return s.String() -} - -// SetProcessName sets the ProcessName field's value. -func (s *SuspendedProcess) SetProcessName(v string) *SuspendedProcess { - s.ProcessName = &v - return s -} - -// SetSuspensionReason sets the SuspensionReason field's value. -func (s *SuspendedProcess) SetSuspensionReason(v string) *SuspendedProcess { - s.SuspensionReason = &v - return s -} - -// Describes a tag for an Auto Scaling group. -type Tag struct { - _ struct{} `type:"structure"` - - // The tag key. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // Determines whether the tag is added to new instances as they are launched - // in the group. - PropagateAtLaunch *bool `type:"boolean"` - - // The name of the Auto Scaling group. - ResourceId *string `type:"string"` - - // The type of resource. The only supported value is auto-scaling-group. - ResourceType *string `type:"string"` - - // The tag value. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Tag) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -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 invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *Tag) SetKey(v string) *Tag { - s.Key = &v - return s -} - -// SetPropagateAtLaunch sets the PropagateAtLaunch field's value. -func (s *Tag) SetPropagateAtLaunch(v bool) *Tag { - s.PropagateAtLaunch = &v - return s -} - -// SetResourceId sets the ResourceId field's value. -func (s *Tag) SetResourceId(v string) *Tag { - s.ResourceId = &v - return s -} - -// SetResourceType sets the ResourceType field's value. -func (s *Tag) SetResourceType(v string) *Tag { - s.ResourceType = &v - return s -} - -// SetValue sets the Value field's value. -func (s *Tag) SetValue(v string) *Tag { - s.Value = &v - return s -} - -// Describes a tag for an Auto Scaling group. -type TagDescription struct { - _ struct{} `type:"structure"` - - // The tag key. - Key *string `min:"1" type:"string"` - - // Determines whether the tag is added to new instances as they are launched - // in the group. - PropagateAtLaunch *bool `type:"boolean"` - - // The name of the group. - ResourceId *string `type:"string"` - - // The type of resource. The only supported value is auto-scaling-group. - ResourceType *string `type:"string"` - - // The tag value. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagDescription) GoString() string { - return s.String() -} - -// SetKey sets the Key field's value. -func (s *TagDescription) SetKey(v string) *TagDescription { - s.Key = &v - return s -} - -// SetPropagateAtLaunch sets the PropagateAtLaunch field's value. -func (s *TagDescription) SetPropagateAtLaunch(v bool) *TagDescription { - s.PropagateAtLaunch = &v - return s -} - -// SetResourceId sets the ResourceId field's value. -func (s *TagDescription) SetResourceId(v string) *TagDescription { - s.ResourceId = &v - return s -} - -// SetResourceType sets the ResourceType field's value. -func (s *TagDescription) SetResourceType(v string) *TagDescription { - s.ResourceType = &v - return s -} - -// SetValue sets the Value field's value. -func (s *TagDescription) SetValue(v string) *TagDescription { - s.Value = &v - return s -} - -// Represents a target tracking scaling policy configuration to use with Amazon -// EC2 Auto Scaling. -type TargetTrackingConfiguration struct { - _ struct{} `type:"structure"` - - // A customized metric. You must specify either a predefined metric or a customized - // metric. - CustomizedMetricSpecification *CustomizedMetricSpecification `type:"structure"` - - // Indicates whether scaling in by the target tracking scaling policy is disabled. - // If scaling in is disabled, the target tracking scaling policy doesn't remove - // instances from the Auto Scaling group. Otherwise, the target tracking scaling - // policy can remove instances from the Auto Scaling group. The default is false. - DisableScaleIn *bool `type:"boolean"` - - // A predefined metric. You must specify either a predefined metric or a customized - // metric. - PredefinedMetricSpecification *PredefinedMetricSpecification `type:"structure"` - - // The target value for the metric. - // - // Some metrics are based on a count instead of a percentage, such as the request - // count for an Application Load Balancer or the number of messages in an SQS - // queue. If the scaling policy specifies one of these metrics, specify the - // target utilization as the optimal average request or message count per instance - // during any one-minute interval. - // - // TargetValue is a required field - TargetValue *float64 `type:"double" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetTrackingConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetTrackingConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TargetTrackingConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TargetTrackingConfiguration"} - if s.TargetValue == nil { - invalidParams.Add(request.NewErrParamRequired("TargetValue")) - } - if s.CustomizedMetricSpecification != nil { - if err := s.CustomizedMetricSpecification.Validate(); err != nil { - invalidParams.AddNested("CustomizedMetricSpecification", err.(request.ErrInvalidParams)) - } - } - if s.PredefinedMetricSpecification != nil { - if err := s.PredefinedMetricSpecification.Validate(); err != nil { - invalidParams.AddNested("PredefinedMetricSpecification", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomizedMetricSpecification sets the CustomizedMetricSpecification field's value. -func (s *TargetTrackingConfiguration) SetCustomizedMetricSpecification(v *CustomizedMetricSpecification) *TargetTrackingConfiguration { - s.CustomizedMetricSpecification = v - return s -} - -// SetDisableScaleIn sets the DisableScaleIn field's value. -func (s *TargetTrackingConfiguration) SetDisableScaleIn(v bool) *TargetTrackingConfiguration { - s.DisableScaleIn = &v - return s -} - -// SetPredefinedMetricSpecification sets the PredefinedMetricSpecification field's value. -func (s *TargetTrackingConfiguration) SetPredefinedMetricSpecification(v *PredefinedMetricSpecification) *TargetTrackingConfiguration { - s.PredefinedMetricSpecification = v - return s -} - -// SetTargetValue sets the TargetValue field's value. -func (s *TargetTrackingConfiguration) SetTargetValue(v float64) *TargetTrackingConfiguration { - s.TargetValue = &v - return s -} - -type TerminateInstanceInAutoScalingGroupInput struct { - _ struct{} `type:"structure"` - - // The ID of the instance. - // - // InstanceId is a required field - InstanceId *string `min:"1" type:"string" required:"true"` - - // Indicates whether terminating the instance also decrements the size of the - // Auto Scaling group. - // - // ShouldDecrementDesiredCapacity is a required field - ShouldDecrementDesiredCapacity *bool `type:"boolean" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TerminateInstanceInAutoScalingGroupInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TerminateInstanceInAutoScalingGroupInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TerminateInstanceInAutoScalingGroupInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TerminateInstanceInAutoScalingGroupInput"} - if s.InstanceId == nil { - invalidParams.Add(request.NewErrParamRequired("InstanceId")) - } - if s.InstanceId != nil && len(*s.InstanceId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InstanceId", 1)) - } - if s.ShouldDecrementDesiredCapacity == nil { - invalidParams.Add(request.NewErrParamRequired("ShouldDecrementDesiredCapacity")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstanceId sets the InstanceId field's value. -func (s *TerminateInstanceInAutoScalingGroupInput) SetInstanceId(v string) *TerminateInstanceInAutoScalingGroupInput { - s.InstanceId = &v - return s -} - -// SetShouldDecrementDesiredCapacity sets the ShouldDecrementDesiredCapacity field's value. -func (s *TerminateInstanceInAutoScalingGroupInput) SetShouldDecrementDesiredCapacity(v bool) *TerminateInstanceInAutoScalingGroupInput { - s.ShouldDecrementDesiredCapacity = &v - return s -} - -type TerminateInstanceInAutoScalingGroupOutput struct { - _ struct{} `type:"structure"` - - // A scaling activity. - Activity *Activity `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TerminateInstanceInAutoScalingGroupOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TerminateInstanceInAutoScalingGroupOutput) GoString() string { - return s.String() -} - -// SetActivity sets the Activity field's value. -func (s *TerminateInstanceInAutoScalingGroupOutput) SetActivity(v *Activity) *TerminateInstanceInAutoScalingGroupOutput { - s.Activity = v - return s -} - -// Specifies the minimum and maximum for the TotalLocalStorageGB object when -// you specify InstanceRequirements for an Auto Scaling group. -type TotalLocalStorageGBRequest struct { - _ struct{} `type:"structure"` - - // The storage maximum in GB. - Max *float64 `type:"double"` - - // The storage minimum in GB. - Min *float64 `type:"double"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TotalLocalStorageGBRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TotalLocalStorageGBRequest) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *TotalLocalStorageGBRequest) SetMax(v float64) *TotalLocalStorageGBRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *TotalLocalStorageGBRequest) SetMin(v float64) *TotalLocalStorageGBRequest { - s.Min = &v - return s -} - -type UpdateAutoScalingGroupInput struct { - _ struct{} `type:"structure"` - - // The name of the Auto Scaling group. - // - // AutoScalingGroupName is a required field - AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - - // One or more Availability Zones for the group. - AvailabilityZones []*string `type:"list"` - - // Enables or disables Capacity Rebalancing. For more information, see Use Capacity - // Rebalancing to handle Amazon EC2 Spot Interruptions (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) - // in the Amazon EC2 Auto Scaling User Guide. - CapacityRebalance *bool `type:"boolean"` - - // Reserved. - Context *string `type:"string"` - - // Only needed if you use simple scaling policies. - // - // The amount of time, in seconds, between one scaling activity ending and another - // one starting due to simple scaling policies. For more information, see Scaling - // cooldowns for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) - // in the Amazon EC2 Auto Scaling User Guide. - DefaultCooldown *int64 `type:"integer"` - - // The amount of time, in seconds, until a newly launched instance can contribute - // to the Amazon CloudWatch metrics. This delay lets an instance finish initializing - // before Amazon EC2 Auto Scaling aggregates instance metrics, resulting in - // more reliable usage data. Set this value equal to the amount of time that - // it takes for resource consumption to become stable after an instance reaches - // the InService state. For more information, see Set the default instance warmup - // for an Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // To manage your warm-up settings at the group level, we recommend that you - // set the default instance warmup, even if its value is set to 0 seconds. This - // also optimizes the performance of scaling policies that scale continuously, - // such as target tracking and step scaling policies. - // - // If you need to remove a value that you previously set, include the property - // but specify -1 for the value. However, we strongly recommend keeping the - // default instance warmup enabled by specifying a minimum value of 0. - DefaultInstanceWarmup *int64 `type:"integer"` - - // The desired capacity is the initial capacity of the Auto Scaling group after - // this operation completes and the capacity it attempts to maintain. This number - // must be greater than or equal to the minimum size of the group and less than - // or equal to the maximum size of the group. - DesiredCapacity *int64 `type:"integer"` - - // The unit of measurement for the value specified for desired capacity. Amazon - // EC2 Auto Scaling supports DesiredCapacityType for attribute-based instance - // type selection only. For more information, see Creating an Auto Scaling group - // using attribute-based instance type selection (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-instance-type-requirements.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // By default, Amazon EC2 Auto Scaling specifies units, which translates into - // number of instances. - // - // Valid values: units | vcpu | memory-mib - DesiredCapacityType *string `min:"1" type:"string"` - - // The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before - // checking the health status of an EC2 instance that has come into service - // and marking it unhealthy due to a failed Elastic Load Balancing or custom - // health check. This is useful if your instances do not immediately pass these - // health checks after they enter the InService state. For more information, - // see Set the health check grace period for an Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/health-check-grace-period.html) - // in the Amazon EC2 Auto Scaling User Guide. - HealthCheckGracePeriod *int64 `type:"integer"` - - // The service to use for the health checks. The valid values are EC2 and ELB. - // If you configure an Auto Scaling group to use ELB health checks, it considers - // the instance unhealthy if it fails either the EC2 status checks or the load - // balancer health checks. - HealthCheckType *string `min:"1" type:"string"` - - // The name of the launch configuration. If you specify LaunchConfigurationName - // in your update request, you can't specify LaunchTemplate or MixedInstancesPolicy. - LaunchConfigurationName *string `min:"1" type:"string"` - - // The launch template and version to use to specify the updates. If you specify - // LaunchTemplate in your update request, you can't specify LaunchConfigurationName - // or MixedInstancesPolicy. - LaunchTemplate *LaunchTemplateSpecification `type:"structure"` - - // The maximum amount of time, in seconds, that an instance can be in service. - // The default is null. If specified, the value must be either 0 or a number - // equal to or greater than 86,400 seconds (1 day). To clear a previously set - // value, specify a new value of 0. For more information, see Replacing Auto - // Scaling instances based on maximum instance lifetime (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html) - // in the Amazon EC2 Auto Scaling User Guide. - MaxInstanceLifetime *int64 `type:"integer"` - - // The maximum size of the Auto Scaling group. - // - // With a mixed instances policy that uses instance weighting, Amazon EC2 Auto - // Scaling may need to go above MaxSize to meet your capacity requirements. - // In this event, Amazon EC2 Auto Scaling will never go above MaxSize by more - // than your largest instance weight (weights that define how many units each - // instance contributes to the desired capacity of the group). - MaxSize *int64 `type:"integer"` - - // The minimum size of the Auto Scaling group. - MinSize *int64 `type:"integer"` - - // The mixed instances policy. For more information, see Auto Scaling groups - // with multiple instance types and purchase options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) - // in the Amazon EC2 Auto Scaling User Guide. - MixedInstancesPolicy *MixedInstancesPolicy `type:"structure"` - - // Indicates whether newly launched instances are protected from termination - // by Amazon EC2 Auto Scaling when scaling in. For more information about preventing - // instances from terminating on scale in, see Using instance scale-in protection - // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-protection.html) - // in the Amazon EC2 Auto Scaling User Guide. - NewInstancesProtectedFromScaleIn *bool `type:"boolean"` - - // The name of an existing placement group into which to launch your instances. - // For more information, see Placement groups (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) - // in the Amazon EC2 User Guide for Linux Instances. - // - // A cluster placement group is a logical grouping of instances within a single - // Availability Zone. You cannot specify multiple Availability Zones and a cluster - // placement group. - PlacementGroup *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling - // group uses to call other Amazon Web Services on your behalf. For more information, - // see Service-linked roles (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html) - // in the Amazon EC2 Auto Scaling User Guide. - ServiceLinkedRoleARN *string `min:"1" type:"string"` - - // A policy or a list of policies that are used to select the instances to terminate. - // The policies are executed in the order that you list them. For more information, - // see Work with Amazon EC2 Auto Scaling termination policies (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-termination-policies.html) - // in the Amazon EC2 Auto Scaling User Guide. - // - // Valid values: Default | AllocationStrategy | ClosestToNextInstanceHour | - // NewestInstance | OldestInstance | OldestLaunchConfiguration | OldestLaunchTemplate - // | arn:aws:lambda:region:account-id:function:my-function:my-alias - TerminationPolicies []*string `type:"list"` - - // A comma-separated list of subnet IDs for a virtual private cloud (VPC). If - // you specify VPCZoneIdentifier with AvailabilityZones, the subnets that you - // specify must reside in those Availability Zones. - VPCZoneIdentifier *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAutoScalingGroupInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAutoScalingGroupInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdateAutoScalingGroupInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdateAutoScalingGroupInput"} - if s.AutoScalingGroupName == nil { - invalidParams.Add(request.NewErrParamRequired("AutoScalingGroupName")) - } - if s.AutoScalingGroupName != nil && len(*s.AutoScalingGroupName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AutoScalingGroupName", 1)) - } - if s.DesiredCapacityType != nil && len(*s.DesiredCapacityType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("DesiredCapacityType", 1)) - } - if s.HealthCheckType != nil && len(*s.HealthCheckType) < 1 { - invalidParams.Add(request.NewErrParamMinLen("HealthCheckType", 1)) - } - if s.LaunchConfigurationName != nil && len(*s.LaunchConfigurationName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LaunchConfigurationName", 1)) - } - if s.PlacementGroup != nil && len(*s.PlacementGroup) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PlacementGroup", 1)) - } - if s.ServiceLinkedRoleARN != nil && len(*s.ServiceLinkedRoleARN) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ServiceLinkedRoleARN", 1)) - } - if s.VPCZoneIdentifier != nil && len(*s.VPCZoneIdentifier) < 1 { - invalidParams.Add(request.NewErrParamMinLen("VPCZoneIdentifier", 1)) - } - if s.LaunchTemplate != nil { - if err := s.LaunchTemplate.Validate(); err != nil { - invalidParams.AddNested("LaunchTemplate", err.(request.ErrInvalidParams)) - } - } - if s.MixedInstancesPolicy != nil { - if err := s.MixedInstancesPolicy.Validate(); err != nil { - invalidParams.AddNested("MixedInstancesPolicy", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAutoScalingGroupName sets the AutoScalingGroupName field's value. -func (s *UpdateAutoScalingGroupInput) SetAutoScalingGroupName(v string) *UpdateAutoScalingGroupInput { - s.AutoScalingGroupName = &v - return s -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *UpdateAutoScalingGroupInput) SetAvailabilityZones(v []*string) *UpdateAutoScalingGroupInput { - s.AvailabilityZones = v - return s -} - -// SetCapacityRebalance sets the CapacityRebalance field's value. -func (s *UpdateAutoScalingGroupInput) SetCapacityRebalance(v bool) *UpdateAutoScalingGroupInput { - s.CapacityRebalance = &v - return s -} - -// SetContext sets the Context field's value. -func (s *UpdateAutoScalingGroupInput) SetContext(v string) *UpdateAutoScalingGroupInput { - s.Context = &v - return s -} - -// SetDefaultCooldown sets the DefaultCooldown field's value. -func (s *UpdateAutoScalingGroupInput) SetDefaultCooldown(v int64) *UpdateAutoScalingGroupInput { - s.DefaultCooldown = &v - return s -} - -// SetDefaultInstanceWarmup sets the DefaultInstanceWarmup field's value. -func (s *UpdateAutoScalingGroupInput) SetDefaultInstanceWarmup(v int64) *UpdateAutoScalingGroupInput { - s.DefaultInstanceWarmup = &v - return s -} - -// SetDesiredCapacity sets the DesiredCapacity field's value. -func (s *UpdateAutoScalingGroupInput) SetDesiredCapacity(v int64) *UpdateAutoScalingGroupInput { - s.DesiredCapacity = &v - return s -} - -// SetDesiredCapacityType sets the DesiredCapacityType field's value. -func (s *UpdateAutoScalingGroupInput) SetDesiredCapacityType(v string) *UpdateAutoScalingGroupInput { - s.DesiredCapacityType = &v - return s -} - -// SetHealthCheckGracePeriod sets the HealthCheckGracePeriod field's value. -func (s *UpdateAutoScalingGroupInput) SetHealthCheckGracePeriod(v int64) *UpdateAutoScalingGroupInput { - s.HealthCheckGracePeriod = &v - return s -} - -// SetHealthCheckType sets the HealthCheckType field's value. -func (s *UpdateAutoScalingGroupInput) SetHealthCheckType(v string) *UpdateAutoScalingGroupInput { - s.HealthCheckType = &v - return s -} - -// SetLaunchConfigurationName sets the LaunchConfigurationName field's value. -func (s *UpdateAutoScalingGroupInput) SetLaunchConfigurationName(v string) *UpdateAutoScalingGroupInput { - s.LaunchConfigurationName = &v - return s -} - -// SetLaunchTemplate sets the LaunchTemplate field's value. -func (s *UpdateAutoScalingGroupInput) SetLaunchTemplate(v *LaunchTemplateSpecification) *UpdateAutoScalingGroupInput { - s.LaunchTemplate = v - return s -} - -// SetMaxInstanceLifetime sets the MaxInstanceLifetime field's value. -func (s *UpdateAutoScalingGroupInput) SetMaxInstanceLifetime(v int64) *UpdateAutoScalingGroupInput { - s.MaxInstanceLifetime = &v - return s -} - -// SetMaxSize sets the MaxSize field's value. -func (s *UpdateAutoScalingGroupInput) SetMaxSize(v int64) *UpdateAutoScalingGroupInput { - s.MaxSize = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *UpdateAutoScalingGroupInput) SetMinSize(v int64) *UpdateAutoScalingGroupInput { - s.MinSize = &v - return s -} - -// SetMixedInstancesPolicy sets the MixedInstancesPolicy field's value. -func (s *UpdateAutoScalingGroupInput) SetMixedInstancesPolicy(v *MixedInstancesPolicy) *UpdateAutoScalingGroupInput { - s.MixedInstancesPolicy = v - return s -} - -// SetNewInstancesProtectedFromScaleIn sets the NewInstancesProtectedFromScaleIn field's value. -func (s *UpdateAutoScalingGroupInput) SetNewInstancesProtectedFromScaleIn(v bool) *UpdateAutoScalingGroupInput { - s.NewInstancesProtectedFromScaleIn = &v - return s -} - -// SetPlacementGroup sets the PlacementGroup field's value. -func (s *UpdateAutoScalingGroupInput) SetPlacementGroup(v string) *UpdateAutoScalingGroupInput { - s.PlacementGroup = &v - return s -} - -// SetServiceLinkedRoleARN sets the ServiceLinkedRoleARN field's value. -func (s *UpdateAutoScalingGroupInput) SetServiceLinkedRoleARN(v string) *UpdateAutoScalingGroupInput { - s.ServiceLinkedRoleARN = &v - return s -} - -// SetTerminationPolicies sets the TerminationPolicies field's value. -func (s *UpdateAutoScalingGroupInput) SetTerminationPolicies(v []*string) *UpdateAutoScalingGroupInput { - s.TerminationPolicies = v - return s -} - -// SetVPCZoneIdentifier sets the VPCZoneIdentifier field's value. -func (s *UpdateAutoScalingGroupInput) SetVPCZoneIdentifier(v string) *UpdateAutoScalingGroupInput { - s.VPCZoneIdentifier = &v - return s -} - -type UpdateAutoScalingGroupOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAutoScalingGroupOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAutoScalingGroupOutput) GoString() string { - return s.String() -} - -// Specifies the minimum and maximum for the VCpuCount object when you specify -// InstanceRequirements for an Auto Scaling group. -type VCpuCountRequest struct { - _ struct{} `type:"structure"` - - // The maximum number of vCPUs. - Max *int64 `type:"integer"` - - // The minimum number of vCPUs. - // - // Min is a required field - Min *int64 `type:"integer" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VCpuCountRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VCpuCountRequest) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *VCpuCountRequest) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "VCpuCountRequest"} - if s.Min == nil { - invalidParams.Add(request.NewErrParamRequired("Min")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMax sets the Max field's value. -func (s *VCpuCountRequest) SetMax(v int64) *VCpuCountRequest { - s.Max = &v - return s -} - -// SetMin sets the Min field's value. -func (s *VCpuCountRequest) SetMin(v int64) *VCpuCountRequest { - s.Min = &v - return s -} - -// Describes a warm pool configuration. -type WarmPoolConfiguration struct { - _ struct{} `type:"structure"` - - // The instance reuse policy. - InstanceReusePolicy *InstanceReusePolicy `type:"structure"` - - // The maximum number of instances that are allowed to be in the warm pool or - // in any state except Terminated for the Auto Scaling group. - MaxGroupPreparedCapacity *int64 `type:"integer"` - - // The minimum number of instances to maintain in the warm pool. - MinSize *int64 `type:"integer"` - - // The instance state to transition to after the lifecycle actions are complete. - PoolState *string `type:"string" enum:"WarmPoolState"` - - // The status of a warm pool that is marked for deletion. - Status *string `type:"string" enum:"WarmPoolStatus"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s WarmPoolConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s WarmPoolConfiguration) GoString() string { - return s.String() -} - -// SetInstanceReusePolicy sets the InstanceReusePolicy field's value. -func (s *WarmPoolConfiguration) SetInstanceReusePolicy(v *InstanceReusePolicy) *WarmPoolConfiguration { - s.InstanceReusePolicy = v - return s -} - -// SetMaxGroupPreparedCapacity sets the MaxGroupPreparedCapacity field's value. -func (s *WarmPoolConfiguration) SetMaxGroupPreparedCapacity(v int64) *WarmPoolConfiguration { - s.MaxGroupPreparedCapacity = &v - return s -} - -// SetMinSize sets the MinSize field's value. -func (s *WarmPoolConfiguration) SetMinSize(v int64) *WarmPoolConfiguration { - s.MinSize = &v - return s -} - -// SetPoolState sets the PoolState field's value. -func (s *WarmPoolConfiguration) SetPoolState(v string) *WarmPoolConfiguration { - s.PoolState = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *WarmPoolConfiguration) SetStatus(v string) *WarmPoolConfiguration { - s.Status = &v - return s -} - -const ( - // AcceleratorManufacturerNvidia is a AcceleratorManufacturer enum value - AcceleratorManufacturerNvidia = "nvidia" - - // AcceleratorManufacturerAmd is a AcceleratorManufacturer enum value - AcceleratorManufacturerAmd = "amd" - - // AcceleratorManufacturerAmazonWebServices is a AcceleratorManufacturer enum value - AcceleratorManufacturerAmazonWebServices = "amazon-web-services" - - // AcceleratorManufacturerXilinx is a AcceleratorManufacturer enum value - AcceleratorManufacturerXilinx = "xilinx" -) - -// AcceleratorManufacturer_Values returns all elements of the AcceleratorManufacturer enum -func AcceleratorManufacturer_Values() []string { - return []string{ - AcceleratorManufacturerNvidia, - AcceleratorManufacturerAmd, - AcceleratorManufacturerAmazonWebServices, - AcceleratorManufacturerXilinx, - } -} - -const ( - // AcceleratorNameA100 is a AcceleratorName enum value - AcceleratorNameA100 = "a100" - - // AcceleratorNameV100 is a AcceleratorName enum value - AcceleratorNameV100 = "v100" - - // AcceleratorNameK80 is a AcceleratorName enum value - AcceleratorNameK80 = "k80" - - // AcceleratorNameT4 is a AcceleratorName enum value - AcceleratorNameT4 = "t4" - - // AcceleratorNameM60 is a AcceleratorName enum value - AcceleratorNameM60 = "m60" - - // AcceleratorNameRadeonProV520 is a AcceleratorName enum value - AcceleratorNameRadeonProV520 = "radeon-pro-v520" - - // AcceleratorNameVu9p is a AcceleratorName enum value - AcceleratorNameVu9p = "vu9p" -) - -// AcceleratorName_Values returns all elements of the AcceleratorName enum -func AcceleratorName_Values() []string { - return []string{ - AcceleratorNameA100, - AcceleratorNameV100, - AcceleratorNameK80, - AcceleratorNameT4, - AcceleratorNameM60, - AcceleratorNameRadeonProV520, - AcceleratorNameVu9p, - } -} - -const ( - // AcceleratorTypeGpu is a AcceleratorType enum value - AcceleratorTypeGpu = "gpu" - - // AcceleratorTypeFpga is a AcceleratorType enum value - AcceleratorTypeFpga = "fpga" - - // AcceleratorTypeInference is a AcceleratorType enum value - AcceleratorTypeInference = "inference" -) - -// AcceleratorType_Values returns all elements of the AcceleratorType enum -func AcceleratorType_Values() []string { - return []string{ - AcceleratorTypeGpu, - AcceleratorTypeFpga, - AcceleratorTypeInference, - } -} - -const ( - // BareMetalIncluded is a BareMetal enum value - BareMetalIncluded = "included" - - // BareMetalExcluded is a BareMetal enum value - BareMetalExcluded = "excluded" - - // BareMetalRequired is a BareMetal enum value - BareMetalRequired = "required" -) - -// BareMetal_Values returns all elements of the BareMetal enum -func BareMetal_Values() []string { - return []string{ - BareMetalIncluded, - BareMetalExcluded, - BareMetalRequired, - } -} - -const ( - // BurstablePerformanceIncluded is a BurstablePerformance enum value - BurstablePerformanceIncluded = "included" - - // BurstablePerformanceExcluded is a BurstablePerformance enum value - BurstablePerformanceExcluded = "excluded" - - // BurstablePerformanceRequired is a BurstablePerformance enum value - BurstablePerformanceRequired = "required" -) - -// BurstablePerformance_Values returns all elements of the BurstablePerformance enum -func BurstablePerformance_Values() []string { - return []string{ - BurstablePerformanceIncluded, - BurstablePerformanceExcluded, - BurstablePerformanceRequired, - } -} - -const ( - // CpuManufacturerIntel is a CpuManufacturer enum value - CpuManufacturerIntel = "intel" - - // CpuManufacturerAmd is a CpuManufacturer enum value - CpuManufacturerAmd = "amd" - - // CpuManufacturerAmazonWebServices is a CpuManufacturer enum value - CpuManufacturerAmazonWebServices = "amazon-web-services" -) - -// CpuManufacturer_Values returns all elements of the CpuManufacturer enum -func CpuManufacturer_Values() []string { - return []string{ - CpuManufacturerIntel, - CpuManufacturerAmd, - CpuManufacturerAmazonWebServices, - } -} - -const ( - // InstanceGenerationCurrent is a InstanceGeneration enum value - InstanceGenerationCurrent = "current" - - // InstanceGenerationPrevious is a InstanceGeneration enum value - InstanceGenerationPrevious = "previous" -) - -// InstanceGeneration_Values returns all elements of the InstanceGeneration enum -func InstanceGeneration_Values() []string { - return []string{ - InstanceGenerationCurrent, - InstanceGenerationPrevious, - } -} - -const ( - // InstanceMetadataEndpointStateDisabled is a InstanceMetadataEndpointState enum value - InstanceMetadataEndpointStateDisabled = "disabled" - - // InstanceMetadataEndpointStateEnabled is a InstanceMetadataEndpointState enum value - InstanceMetadataEndpointStateEnabled = "enabled" -) - -// InstanceMetadataEndpointState_Values returns all elements of the InstanceMetadataEndpointState enum -func InstanceMetadataEndpointState_Values() []string { - return []string{ - InstanceMetadataEndpointStateDisabled, - InstanceMetadataEndpointStateEnabled, - } -} - -const ( - // InstanceMetadataHttpTokensStateOptional is a InstanceMetadataHttpTokensState enum value - InstanceMetadataHttpTokensStateOptional = "optional" - - // InstanceMetadataHttpTokensStateRequired is a InstanceMetadataHttpTokensState enum value - InstanceMetadataHttpTokensStateRequired = "required" -) - -// InstanceMetadataHttpTokensState_Values returns all elements of the InstanceMetadataHttpTokensState enum -func InstanceMetadataHttpTokensState_Values() []string { - return []string{ - InstanceMetadataHttpTokensStateOptional, - InstanceMetadataHttpTokensStateRequired, - } -} - -const ( - // InstanceRefreshStatusPending is a InstanceRefreshStatus enum value - InstanceRefreshStatusPending = "Pending" - - // InstanceRefreshStatusInProgress is a InstanceRefreshStatus enum value - InstanceRefreshStatusInProgress = "InProgress" - - // InstanceRefreshStatusSuccessful is a InstanceRefreshStatus enum value - InstanceRefreshStatusSuccessful = "Successful" - - // InstanceRefreshStatusFailed is a InstanceRefreshStatus enum value - InstanceRefreshStatusFailed = "Failed" - - // InstanceRefreshStatusCancelling is a InstanceRefreshStatus enum value - InstanceRefreshStatusCancelling = "Cancelling" - - // InstanceRefreshStatusCancelled is a InstanceRefreshStatus enum value - InstanceRefreshStatusCancelled = "Cancelled" -) - -// InstanceRefreshStatus_Values returns all elements of the InstanceRefreshStatus enum -func InstanceRefreshStatus_Values() []string { - return []string{ - InstanceRefreshStatusPending, - InstanceRefreshStatusInProgress, - InstanceRefreshStatusSuccessful, - InstanceRefreshStatusFailed, - InstanceRefreshStatusCancelling, - InstanceRefreshStatusCancelled, - } -} - -const ( - // LifecycleStatePending is a LifecycleState enum value - LifecycleStatePending = "Pending" - - // LifecycleStatePendingWait is a LifecycleState enum value - LifecycleStatePendingWait = "Pending:Wait" - - // LifecycleStatePendingProceed is a LifecycleState enum value - LifecycleStatePendingProceed = "Pending:Proceed" - - // LifecycleStateQuarantined is a LifecycleState enum value - LifecycleStateQuarantined = "Quarantined" - - // LifecycleStateInService is a LifecycleState enum value - LifecycleStateInService = "InService" - - // LifecycleStateTerminating is a LifecycleState enum value - LifecycleStateTerminating = "Terminating" - - // LifecycleStateTerminatingWait is a LifecycleState enum value - LifecycleStateTerminatingWait = "Terminating:Wait" - - // LifecycleStateTerminatingProceed is a LifecycleState enum value - LifecycleStateTerminatingProceed = "Terminating:Proceed" - - // LifecycleStateTerminated is a LifecycleState enum value - LifecycleStateTerminated = "Terminated" - - // LifecycleStateDetaching is a LifecycleState enum value - LifecycleStateDetaching = "Detaching" - - // LifecycleStateDetached is a LifecycleState enum value - LifecycleStateDetached = "Detached" - - // LifecycleStateEnteringStandby is a LifecycleState enum value - LifecycleStateEnteringStandby = "EnteringStandby" - - // LifecycleStateStandby is a LifecycleState enum value - LifecycleStateStandby = "Standby" - - // LifecycleStateWarmedPending is a LifecycleState enum value - LifecycleStateWarmedPending = "Warmed:Pending" - - // LifecycleStateWarmedPendingWait is a LifecycleState enum value - LifecycleStateWarmedPendingWait = "Warmed:Pending:Wait" - - // LifecycleStateWarmedPendingProceed is a LifecycleState enum value - LifecycleStateWarmedPendingProceed = "Warmed:Pending:Proceed" - - // LifecycleStateWarmedTerminating is a LifecycleState enum value - LifecycleStateWarmedTerminating = "Warmed:Terminating" - - // LifecycleStateWarmedTerminatingWait is a LifecycleState enum value - LifecycleStateWarmedTerminatingWait = "Warmed:Terminating:Wait" - - // LifecycleStateWarmedTerminatingProceed is a LifecycleState enum value - LifecycleStateWarmedTerminatingProceed = "Warmed:Terminating:Proceed" - - // LifecycleStateWarmedTerminated is a LifecycleState enum value - LifecycleStateWarmedTerminated = "Warmed:Terminated" - - // LifecycleStateWarmedStopped is a LifecycleState enum value - LifecycleStateWarmedStopped = "Warmed:Stopped" - - // LifecycleStateWarmedRunning is a LifecycleState enum value - LifecycleStateWarmedRunning = "Warmed:Running" - - // LifecycleStateWarmedHibernated is a LifecycleState enum value - LifecycleStateWarmedHibernated = "Warmed:Hibernated" -) - -// LifecycleState_Values returns all elements of the LifecycleState enum -func LifecycleState_Values() []string { - return []string{ - LifecycleStatePending, - LifecycleStatePendingWait, - LifecycleStatePendingProceed, - LifecycleStateQuarantined, - LifecycleStateInService, - LifecycleStateTerminating, - LifecycleStateTerminatingWait, - LifecycleStateTerminatingProceed, - LifecycleStateTerminated, - LifecycleStateDetaching, - LifecycleStateDetached, - LifecycleStateEnteringStandby, - LifecycleStateStandby, - LifecycleStateWarmedPending, - LifecycleStateWarmedPendingWait, - LifecycleStateWarmedPendingProceed, - LifecycleStateWarmedTerminating, - LifecycleStateWarmedTerminatingWait, - LifecycleStateWarmedTerminatingProceed, - LifecycleStateWarmedTerminated, - LifecycleStateWarmedStopped, - LifecycleStateWarmedRunning, - LifecycleStateWarmedHibernated, - } -} - -const ( - // LocalStorageIncluded is a LocalStorage enum value - LocalStorageIncluded = "included" - - // LocalStorageExcluded is a LocalStorage enum value - LocalStorageExcluded = "excluded" - - // LocalStorageRequired is a LocalStorage enum value - LocalStorageRequired = "required" -) - -// LocalStorage_Values returns all elements of the LocalStorage enum -func LocalStorage_Values() []string { - return []string{ - LocalStorageIncluded, - LocalStorageExcluded, - LocalStorageRequired, - } -} - -const ( - // LocalStorageTypeHdd is a LocalStorageType enum value - LocalStorageTypeHdd = "hdd" - - // LocalStorageTypeSsd is a LocalStorageType enum value - LocalStorageTypeSsd = "ssd" -) - -// LocalStorageType_Values returns all elements of the LocalStorageType enum -func LocalStorageType_Values() []string { - return []string{ - LocalStorageTypeHdd, - LocalStorageTypeSsd, - } -} - -const ( - // MetricStatisticAverage is a MetricStatistic enum value - MetricStatisticAverage = "Average" - - // MetricStatisticMinimum is a MetricStatistic enum value - MetricStatisticMinimum = "Minimum" - - // MetricStatisticMaximum is a MetricStatistic enum value - MetricStatisticMaximum = "Maximum" - - // MetricStatisticSampleCount is a MetricStatistic enum value - MetricStatisticSampleCount = "SampleCount" - - // MetricStatisticSum is a MetricStatistic enum value - MetricStatisticSum = "Sum" -) - -// MetricStatistic_Values returns all elements of the MetricStatistic enum -func MetricStatistic_Values() []string { - return []string{ - MetricStatisticAverage, - MetricStatisticMinimum, - MetricStatisticMaximum, - MetricStatisticSampleCount, - MetricStatisticSum, - } -} - -const ( - // MetricTypeAsgaverageCpuutilization is a MetricType enum value - MetricTypeAsgaverageCpuutilization = "ASGAverageCPUUtilization" - - // MetricTypeAsgaverageNetworkIn is a MetricType enum value - MetricTypeAsgaverageNetworkIn = "ASGAverageNetworkIn" - - // MetricTypeAsgaverageNetworkOut is a MetricType enum value - MetricTypeAsgaverageNetworkOut = "ASGAverageNetworkOut" - - // MetricTypeAlbrequestCountPerTarget is a MetricType enum value - MetricTypeAlbrequestCountPerTarget = "ALBRequestCountPerTarget" -) - -// MetricType_Values returns all elements of the MetricType enum -func MetricType_Values() []string { - return []string{ - MetricTypeAsgaverageCpuutilization, - MetricTypeAsgaverageNetworkIn, - MetricTypeAsgaverageNetworkOut, - MetricTypeAlbrequestCountPerTarget, - } -} - -const ( - // PredefinedLoadMetricTypeAsgtotalCpuutilization is a PredefinedLoadMetricType enum value - PredefinedLoadMetricTypeAsgtotalCpuutilization = "ASGTotalCPUUtilization" - - // PredefinedLoadMetricTypeAsgtotalNetworkIn is a PredefinedLoadMetricType enum value - PredefinedLoadMetricTypeAsgtotalNetworkIn = "ASGTotalNetworkIn" - - // PredefinedLoadMetricTypeAsgtotalNetworkOut is a PredefinedLoadMetricType enum value - PredefinedLoadMetricTypeAsgtotalNetworkOut = "ASGTotalNetworkOut" - - // PredefinedLoadMetricTypeAlbtargetGroupRequestCount is a PredefinedLoadMetricType enum value - PredefinedLoadMetricTypeAlbtargetGroupRequestCount = "ALBTargetGroupRequestCount" -) - -// PredefinedLoadMetricType_Values returns all elements of the PredefinedLoadMetricType enum -func PredefinedLoadMetricType_Values() []string { - return []string{ - PredefinedLoadMetricTypeAsgtotalCpuutilization, - PredefinedLoadMetricTypeAsgtotalNetworkIn, - PredefinedLoadMetricTypeAsgtotalNetworkOut, - PredefinedLoadMetricTypeAlbtargetGroupRequestCount, - } -} - -const ( - // PredefinedMetricPairTypeAsgcpuutilization is a PredefinedMetricPairType enum value - PredefinedMetricPairTypeAsgcpuutilization = "ASGCPUUtilization" - - // PredefinedMetricPairTypeAsgnetworkIn is a PredefinedMetricPairType enum value - PredefinedMetricPairTypeAsgnetworkIn = "ASGNetworkIn" - - // PredefinedMetricPairTypeAsgnetworkOut is a PredefinedMetricPairType enum value - PredefinedMetricPairTypeAsgnetworkOut = "ASGNetworkOut" - - // PredefinedMetricPairTypeAlbrequestCount is a PredefinedMetricPairType enum value - PredefinedMetricPairTypeAlbrequestCount = "ALBRequestCount" -) - -// PredefinedMetricPairType_Values returns all elements of the PredefinedMetricPairType enum -func PredefinedMetricPairType_Values() []string { - return []string{ - PredefinedMetricPairTypeAsgcpuutilization, - PredefinedMetricPairTypeAsgnetworkIn, - PredefinedMetricPairTypeAsgnetworkOut, - PredefinedMetricPairTypeAlbrequestCount, - } -} - -const ( - // PredefinedScalingMetricTypeAsgaverageCpuutilization is a PredefinedScalingMetricType enum value - PredefinedScalingMetricTypeAsgaverageCpuutilization = "ASGAverageCPUUtilization" - - // PredefinedScalingMetricTypeAsgaverageNetworkIn is a PredefinedScalingMetricType enum value - PredefinedScalingMetricTypeAsgaverageNetworkIn = "ASGAverageNetworkIn" - - // PredefinedScalingMetricTypeAsgaverageNetworkOut is a PredefinedScalingMetricType enum value - PredefinedScalingMetricTypeAsgaverageNetworkOut = "ASGAverageNetworkOut" - - // PredefinedScalingMetricTypeAlbrequestCountPerTarget is a PredefinedScalingMetricType enum value - PredefinedScalingMetricTypeAlbrequestCountPerTarget = "ALBRequestCountPerTarget" -) - -// PredefinedScalingMetricType_Values returns all elements of the PredefinedScalingMetricType enum -func PredefinedScalingMetricType_Values() []string { - return []string{ - PredefinedScalingMetricTypeAsgaverageCpuutilization, - PredefinedScalingMetricTypeAsgaverageNetworkIn, - PredefinedScalingMetricTypeAsgaverageNetworkOut, - PredefinedScalingMetricTypeAlbrequestCountPerTarget, - } -} - -const ( - // PredictiveScalingMaxCapacityBreachBehaviorHonorMaxCapacity is a PredictiveScalingMaxCapacityBreachBehavior enum value - PredictiveScalingMaxCapacityBreachBehaviorHonorMaxCapacity = "HonorMaxCapacity" - - // PredictiveScalingMaxCapacityBreachBehaviorIncreaseMaxCapacity is a PredictiveScalingMaxCapacityBreachBehavior enum value - PredictiveScalingMaxCapacityBreachBehaviorIncreaseMaxCapacity = "IncreaseMaxCapacity" -) - -// PredictiveScalingMaxCapacityBreachBehavior_Values returns all elements of the PredictiveScalingMaxCapacityBreachBehavior enum -func PredictiveScalingMaxCapacityBreachBehavior_Values() []string { - return []string{ - PredictiveScalingMaxCapacityBreachBehaviorHonorMaxCapacity, - PredictiveScalingMaxCapacityBreachBehaviorIncreaseMaxCapacity, - } -} - -const ( - // PredictiveScalingModeForecastAndScale is a PredictiveScalingMode enum value - PredictiveScalingModeForecastAndScale = "ForecastAndScale" - - // PredictiveScalingModeForecastOnly is a PredictiveScalingMode enum value - PredictiveScalingModeForecastOnly = "ForecastOnly" -) - -// PredictiveScalingMode_Values returns all elements of the PredictiveScalingMode enum -func PredictiveScalingMode_Values() []string { - return []string{ - PredictiveScalingModeForecastAndScale, - PredictiveScalingModeForecastOnly, - } -} - -const ( - // RefreshStrategyRolling is a RefreshStrategy enum value - RefreshStrategyRolling = "Rolling" -) - -// RefreshStrategy_Values returns all elements of the RefreshStrategy enum -func RefreshStrategy_Values() []string { - return []string{ - RefreshStrategyRolling, - } -} - -const ( - // ScalingActivityStatusCodePendingSpotBidPlacement is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodePendingSpotBidPlacement = "PendingSpotBidPlacement" - - // ScalingActivityStatusCodeWaitingForSpotInstanceRequestId is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeWaitingForSpotInstanceRequestId = "WaitingForSpotInstanceRequestId" - - // ScalingActivityStatusCodeWaitingForSpotInstanceId is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeWaitingForSpotInstanceId = "WaitingForSpotInstanceId" - - // ScalingActivityStatusCodeWaitingForInstanceId is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeWaitingForInstanceId = "WaitingForInstanceId" - - // ScalingActivityStatusCodePreInService is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodePreInService = "PreInService" - - // ScalingActivityStatusCodeInProgress is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeInProgress = "InProgress" - - // ScalingActivityStatusCodeWaitingForElbconnectionDraining is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeWaitingForElbconnectionDraining = "WaitingForELBConnectionDraining" - - // ScalingActivityStatusCodeMidLifecycleAction is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeMidLifecycleAction = "MidLifecycleAction" - - // ScalingActivityStatusCodeWaitingForInstanceWarmup is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeWaitingForInstanceWarmup = "WaitingForInstanceWarmup" - - // ScalingActivityStatusCodeSuccessful is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeSuccessful = "Successful" - - // ScalingActivityStatusCodeFailed is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeFailed = "Failed" - - // ScalingActivityStatusCodeCancelled is a ScalingActivityStatusCode enum value - ScalingActivityStatusCodeCancelled = "Cancelled" -) - -// ScalingActivityStatusCode_Values returns all elements of the ScalingActivityStatusCode enum -func ScalingActivityStatusCode_Values() []string { - return []string{ - ScalingActivityStatusCodePendingSpotBidPlacement, - ScalingActivityStatusCodeWaitingForSpotInstanceRequestId, - ScalingActivityStatusCodeWaitingForSpotInstanceId, - ScalingActivityStatusCodeWaitingForInstanceId, - ScalingActivityStatusCodePreInService, - ScalingActivityStatusCodeInProgress, - ScalingActivityStatusCodeWaitingForElbconnectionDraining, - ScalingActivityStatusCodeMidLifecycleAction, - ScalingActivityStatusCodeWaitingForInstanceWarmup, - ScalingActivityStatusCodeSuccessful, - ScalingActivityStatusCodeFailed, - ScalingActivityStatusCodeCancelled, - } -} - -const ( - // WarmPoolStateStopped is a WarmPoolState enum value - WarmPoolStateStopped = "Stopped" - - // WarmPoolStateRunning is a WarmPoolState enum value - WarmPoolStateRunning = "Running" - - // WarmPoolStateHibernated is a WarmPoolState enum value - WarmPoolStateHibernated = "Hibernated" -) - -// WarmPoolState_Values returns all elements of the WarmPoolState enum -func WarmPoolState_Values() []string { - return []string{ - WarmPoolStateStopped, - WarmPoolStateRunning, - WarmPoolStateHibernated, - } -} - -const ( - // WarmPoolStatusPendingDelete is a WarmPoolStatus enum value - WarmPoolStatusPendingDelete = "PendingDelete" -) - -// WarmPoolStatus_Values returns all elements of the WarmPoolStatus enum -func WarmPoolStatus_Values() []string { - return []string{ - WarmPoolStatusPendingDelete, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/doc.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/doc.go deleted file mode 100644 index 5a6d19efdac..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/doc.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package autoscaling provides the client and types for making API -// requests to Auto Scaling. -// -// Amazon EC2 Auto Scaling is designed to automatically launch and terminate -// EC2 instances based on user-defined scaling policies, scheduled actions, -// and health checks. -// -// For more information, see the Amazon EC2 Auto Scaling User Guide (https://docs.aws.amazon.com/autoscaling/ec2/userguide/) -// and the Amazon EC2 Auto Scaling API Reference (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/Welcome.html). -// -// See https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01 for more information on this service. -// -// See autoscaling package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/autoscaling/ -// -// # Using the Client -// -// To contact Auto Scaling with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the Auto Scaling client AutoScaling for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/autoscaling/#New -package autoscaling diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go deleted file mode 100644 index 85e907df74f..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package autoscaling - -const ( - - // ErrCodeActiveInstanceRefreshNotFoundFault for service response error code - // "ActiveInstanceRefreshNotFound". - // - // The request failed because an active instance refresh for the specified Auto - // Scaling group was not found. - ErrCodeActiveInstanceRefreshNotFoundFault = "ActiveInstanceRefreshNotFound" - - // ErrCodeAlreadyExistsFault for service response error code - // "AlreadyExists". - // - // You already have an Auto Scaling group or launch configuration with this - // name. - ErrCodeAlreadyExistsFault = "AlreadyExists" - - // ErrCodeInstanceRefreshInProgressFault for service response error code - // "InstanceRefreshInProgress". - // - // The request failed because an active instance refresh operation already exists - // for the specified Auto Scaling group. - ErrCodeInstanceRefreshInProgressFault = "InstanceRefreshInProgress" - - // ErrCodeInvalidNextToken for service response error code - // "InvalidNextToken". - // - // The NextToken value is not valid. - ErrCodeInvalidNextToken = "InvalidNextToken" - - // ErrCodeLimitExceededFault for service response error code - // "LimitExceeded". - // - // You have already reached a limit for your Amazon EC2 Auto Scaling resources - // (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). - // For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) - // in the Amazon EC2 Auto Scaling API Reference. - ErrCodeLimitExceededFault = "LimitExceeded" - - // ErrCodeResourceContentionFault for service response error code - // "ResourceContention". - // - // You already have a pending update to an Amazon EC2 Auto Scaling resource - // (for example, an Auto Scaling group, instance, or load balancer). - ErrCodeResourceContentionFault = "ResourceContention" - - // ErrCodeResourceInUseFault for service response error code - // "ResourceInUse". - // - // The operation can't be performed because the resource is in use. - ErrCodeResourceInUseFault = "ResourceInUse" - - // ErrCodeScalingActivityInProgressFault for service response error code - // "ScalingActivityInProgress". - // - // The operation can't be performed because there are scaling activities in - // progress. - ErrCodeScalingActivityInProgressFault = "ScalingActivityInProgress" - - // ErrCodeServiceLinkedRoleFailure for service response error code - // "ServiceLinkedRoleFailure". - // - // The service-linked role is not yet ready for use. - ErrCodeServiceLinkedRoleFailure = "ServiceLinkedRoleFailure" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go deleted file mode 100644 index 9ed3e6fdefe..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package autoscaling - -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/query" -) - -// AutoScaling provides the API operation methods for making requests to -// Auto Scaling. See this package's package overview docs -// for details on the service. -// -// AutoScaling methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type AutoScaling 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) - -// Service information constants -const ( - ServiceName = "autoscaling" // Name of service. - EndpointsID = ServiceName // ID to lookup a service endpoint with. - ServiceID = "Auto Scaling" // ServiceID is a unique identifier of a specific service. -) - -// New creates a new instance of the AutoScaling 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: -// -// mySession := session.Must(session.NewSession()) -// -// // Create a AutoScaling client from just a session. -// svc := autoscaling.New(mySession) -// -// // Create a AutoScaling client with additional configuration -// svc := autoscaling.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *AutoScaling { - c := p.ClientConfig(EndpointsID, cfgs...) - if c.SigningNameDerived || len(c.SigningName) == 0 { - c.SigningName = EndpointsID - // No Fallback - } - return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *AutoScaling { - svc := &AutoScaling{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - ServiceID: ServiceID, - SigningName: signingName, - SigningRegion: signingRegion, - PartitionID: partitionID, - Endpoint: endpoint, - APIVersion: "2011-01-01", - ResolvedRegion: resolvedRegion, - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a AutoScaling operation and runs any -// custom request initialization. -func (c *AutoScaling) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - // Run custom request initialization if present - if initRequest != nil { - initRequest(req) - } - - return req -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go deleted file mode 100644 index c2e7e2ed8d2..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go +++ /dev/null @@ -1,163 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package autoscaling - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// WaitUntilGroupExists uses the Auto Scaling API operation -// DescribeAutoScalingGroups to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *AutoScaling) WaitUntilGroupExists(input *DescribeAutoScalingGroupsInput) error { - return c.WaitUntilGroupExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilGroupExistsWithContext is an extended version of WaitUntilGroupExists. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) WaitUntilGroupExistsWithContext(ctx aws.Context, input *DescribeAutoScalingGroupsInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilGroupExists", - MaxAttempts: 10, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathWaiterMatch, Argument: "length(AutoScalingGroups) > `0`", - Expected: true, - }, - { - State: request.RetryWaiterState, - Matcher: request.PathWaiterMatch, Argument: "length(AutoScalingGroups) > `0`", - Expected: false, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeAutoScalingGroupsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeAutoScalingGroupsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilGroupInService uses the Auto Scaling API operation -// DescribeAutoScalingGroups to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *AutoScaling) WaitUntilGroupInService(input *DescribeAutoScalingGroupsInput) error { - return c.WaitUntilGroupInServiceWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilGroupInServiceWithContext is an extended version of WaitUntilGroupInService. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) WaitUntilGroupInServiceWithContext(ctx aws.Context, input *DescribeAutoScalingGroupsInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilGroupInService", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathWaiterMatch, Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)", - Expected: false, - }, - { - State: request.RetryWaiterState, - Matcher: request.PathWaiterMatch, Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)", - Expected: true, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeAutoScalingGroupsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeAutoScalingGroupsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilGroupNotExists uses the Auto Scaling API operation -// DescribeAutoScalingGroups to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *AutoScaling) WaitUntilGroupNotExists(input *DescribeAutoScalingGroupsInput) error { - return c.WaitUntilGroupNotExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilGroupNotExistsWithContext is an extended version of WaitUntilGroupNotExists. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *AutoScaling) WaitUntilGroupNotExistsWithContext(ctx aws.Context, input *DescribeAutoScalingGroupsInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilGroupNotExists", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathWaiterMatch, Argument: "length(AutoScalingGroups) > `0`", - Expected: false, - }, - { - State: request.RetryWaiterState, - Matcher: request.PathWaiterMatch, Argument: "length(AutoScalingGroups) > `0`", - Expected: true, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeAutoScalingGroupsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeAutoScalingGroupsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elb/api.go b/vendor/github.com/aws/aws-sdk-go/service/elb/api.go deleted file mode 100644 index 8d6bcf5f8b5..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/api.go +++ /dev/null @@ -1,7168 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elb - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/query" -) - -const opAddTags = "AddTags" - -// AddTagsRequest generates a "aws/request.Request" representing the -// client's request for the AddTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AddTags for more information on using the AddTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the AddTagsRequest method. -// req, resp := client.AddTagsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/AddTags -func (c *ELB) AddTagsRequest(input *AddTagsInput) (req *request.Request, output *AddTagsOutput) { - op := &request.Operation{ - Name: opAddTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AddTagsInput{} - } - - output = &AddTagsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// AddTags API operation for Elastic Load Balancing. -// -// Adds the specified tags to the specified load balancer. Each load balancer -// can have a maximum of 10 tags. -// -// Each tag consists of a key and an optional value. If a tag with the same -// key is already associated with the load balancer, AddTags updates its value. -// -// For more information, see Tag Your Classic Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/add-remove-tags.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation AddTags for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// The quota for the number of tags that can be assigned to a load balancer -// has been reached. -// -// - ErrCodeDuplicateTagKeysException "DuplicateTagKeys" -// A tag key was specified more than once. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/AddTags -func (c *ELB) AddTags(input *AddTagsInput) (*AddTagsOutput, error) { - req, out := c.AddTagsRequest(input) - return out, req.Send() -} - -// AddTagsWithContext is the same as AddTags with the addition of -// the ability to pass a context and additional request options. -// -// See AddTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) AddTagsWithContext(ctx aws.Context, input *AddTagsInput, opts ...request.Option) (*AddTagsOutput, error) { - req, out := c.AddTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opApplySecurityGroupsToLoadBalancer = "ApplySecurityGroupsToLoadBalancer" - -// ApplySecurityGroupsToLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the ApplySecurityGroupsToLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ApplySecurityGroupsToLoadBalancer for more information on using the ApplySecurityGroupsToLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ApplySecurityGroupsToLoadBalancerRequest method. -// req, resp := client.ApplySecurityGroupsToLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/ApplySecurityGroupsToLoadBalancer -func (c *ELB) ApplySecurityGroupsToLoadBalancerRequest(input *ApplySecurityGroupsToLoadBalancerInput) (req *request.Request, output *ApplySecurityGroupsToLoadBalancerOutput) { - op := &request.Operation{ - Name: opApplySecurityGroupsToLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ApplySecurityGroupsToLoadBalancerInput{} - } - - output = &ApplySecurityGroupsToLoadBalancerOutput{} - req = c.newRequest(op, input, output) - return -} - -// ApplySecurityGroupsToLoadBalancer API operation for Elastic Load Balancing. -// -// Associates one or more security groups with your load balancer in a virtual -// private cloud (VPC). The specified security groups override the previously -// associated security groups. -// -// For more information, see Security Groups for Load Balancers in a VPC (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-groups.html#elb-vpc-security-groups) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ApplySecurityGroupsToLoadBalancer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// - ErrCodeInvalidSecurityGroupException "InvalidSecurityGroup" -// One or more of the specified security groups do not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/ApplySecurityGroupsToLoadBalancer -func (c *ELB) ApplySecurityGroupsToLoadBalancer(input *ApplySecurityGroupsToLoadBalancerInput) (*ApplySecurityGroupsToLoadBalancerOutput, error) { - req, out := c.ApplySecurityGroupsToLoadBalancerRequest(input) - return out, req.Send() -} - -// ApplySecurityGroupsToLoadBalancerWithContext is the same as ApplySecurityGroupsToLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See ApplySecurityGroupsToLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) ApplySecurityGroupsToLoadBalancerWithContext(ctx aws.Context, input *ApplySecurityGroupsToLoadBalancerInput, opts ...request.Option) (*ApplySecurityGroupsToLoadBalancerOutput, error) { - req, out := c.ApplySecurityGroupsToLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAttachLoadBalancerToSubnets = "AttachLoadBalancerToSubnets" - -// AttachLoadBalancerToSubnetsRequest generates a "aws/request.Request" representing the -// client's request for the AttachLoadBalancerToSubnets operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AttachLoadBalancerToSubnets for more information on using the AttachLoadBalancerToSubnets -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the AttachLoadBalancerToSubnetsRequest method. -// req, resp := client.AttachLoadBalancerToSubnetsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/AttachLoadBalancerToSubnets -func (c *ELB) AttachLoadBalancerToSubnetsRequest(input *AttachLoadBalancerToSubnetsInput) (req *request.Request, output *AttachLoadBalancerToSubnetsOutput) { - op := &request.Operation{ - Name: opAttachLoadBalancerToSubnets, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AttachLoadBalancerToSubnetsInput{} - } - - output = &AttachLoadBalancerToSubnetsOutput{} - req = c.newRequest(op, input, output) - return -} - -// AttachLoadBalancerToSubnets API operation for Elastic Load Balancing. -// -// Adds one or more subnets to the set of configured subnets for the specified -// load balancer. -// -// The load balancer evenly distributes requests across all registered subnets. -// For more information, see Add or Remove Subnets for Your Load Balancer in -// a VPC (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-manage-subnets.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation AttachLoadBalancerToSubnets for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// - ErrCodeSubnetNotFoundException "SubnetNotFound" -// One or more of the specified subnets do not exist. -// -// - ErrCodeInvalidSubnetException "InvalidSubnet" -// The specified VPC has no associated Internet gateway. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/AttachLoadBalancerToSubnets -func (c *ELB) AttachLoadBalancerToSubnets(input *AttachLoadBalancerToSubnetsInput) (*AttachLoadBalancerToSubnetsOutput, error) { - req, out := c.AttachLoadBalancerToSubnetsRequest(input) - return out, req.Send() -} - -// AttachLoadBalancerToSubnetsWithContext is the same as AttachLoadBalancerToSubnets with the addition of -// the ability to pass a context and additional request options. -// -// See AttachLoadBalancerToSubnets for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) AttachLoadBalancerToSubnetsWithContext(ctx aws.Context, input *AttachLoadBalancerToSubnetsInput, opts ...request.Option) (*AttachLoadBalancerToSubnetsOutput, error) { - req, out := c.AttachLoadBalancerToSubnetsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opConfigureHealthCheck = "ConfigureHealthCheck" - -// ConfigureHealthCheckRequest generates a "aws/request.Request" representing the -// client's request for the ConfigureHealthCheck operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ConfigureHealthCheck for more information on using the ConfigureHealthCheck -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ConfigureHealthCheckRequest method. -// req, resp := client.ConfigureHealthCheckRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/ConfigureHealthCheck -func (c *ELB) ConfigureHealthCheckRequest(input *ConfigureHealthCheckInput) (req *request.Request, output *ConfigureHealthCheckOutput) { - op := &request.Operation{ - Name: opConfigureHealthCheck, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ConfigureHealthCheckInput{} - } - - output = &ConfigureHealthCheckOutput{} - req = c.newRequest(op, input, output) - return -} - -// ConfigureHealthCheck API operation for Elastic Load Balancing. -// -// Specifies the health check settings to use when evaluating the health state -// of your EC2 instances. -// -// For more information, see Configure Health Checks for Your Load Balancer -// (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-healthchecks.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ConfigureHealthCheck for usage and error information. -// -// Returned Error Codes: -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/ConfigureHealthCheck -func (c *ELB) ConfigureHealthCheck(input *ConfigureHealthCheckInput) (*ConfigureHealthCheckOutput, error) { - req, out := c.ConfigureHealthCheckRequest(input) - return out, req.Send() -} - -// ConfigureHealthCheckWithContext is the same as ConfigureHealthCheck with the addition of -// the ability to pass a context and additional request options. -// -// See ConfigureHealthCheck for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) ConfigureHealthCheckWithContext(ctx aws.Context, input *ConfigureHealthCheckInput, opts ...request.Option) (*ConfigureHealthCheckOutput, error) { - req, out := c.ConfigureHealthCheckRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateAppCookieStickinessPolicy = "CreateAppCookieStickinessPolicy" - -// CreateAppCookieStickinessPolicyRequest generates a "aws/request.Request" representing the -// client's request for the CreateAppCookieStickinessPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateAppCookieStickinessPolicy for more information on using the CreateAppCookieStickinessPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateAppCookieStickinessPolicyRequest method. -// req, resp := client.CreateAppCookieStickinessPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateAppCookieStickinessPolicy -func (c *ELB) CreateAppCookieStickinessPolicyRequest(input *CreateAppCookieStickinessPolicyInput) (req *request.Request, output *CreateAppCookieStickinessPolicyOutput) { - op := &request.Operation{ - Name: opCreateAppCookieStickinessPolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateAppCookieStickinessPolicyInput{} - } - - output = &CreateAppCookieStickinessPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateAppCookieStickinessPolicy API operation for Elastic Load Balancing. -// -// Generates a stickiness policy with sticky session lifetimes that follow that -// of an application-generated cookie. This policy can be associated only with -// HTTP/HTTPS listeners. -// -// This policy is similar to the policy created by CreateLBCookieStickinessPolicy, -// except that the lifetime of the special Elastic Load Balancing cookie, AWSELB, -// follows the lifetime of the application-generated cookie specified in the -// policy configuration. The load balancer only inserts a new stickiness cookie -// when the application response includes a new application cookie. -// -// If the application cookie is explicitly removed or expires, the session stops -// being sticky until a new application cookie is issued. -// -// For more information, see Application-Controlled Session Stickiness (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-application) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateAppCookieStickinessPolicy for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeDuplicatePolicyNameException "DuplicatePolicyName" -// A policy with the specified name already exists for this load balancer. -// -// - ErrCodeTooManyPoliciesException "TooManyPolicies" -// The quota for the number of policies for this load balancer has been reached. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateAppCookieStickinessPolicy -func (c *ELB) CreateAppCookieStickinessPolicy(input *CreateAppCookieStickinessPolicyInput) (*CreateAppCookieStickinessPolicyOutput, error) { - req, out := c.CreateAppCookieStickinessPolicyRequest(input) - return out, req.Send() -} - -// CreateAppCookieStickinessPolicyWithContext is the same as CreateAppCookieStickinessPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See CreateAppCookieStickinessPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) CreateAppCookieStickinessPolicyWithContext(ctx aws.Context, input *CreateAppCookieStickinessPolicyInput, opts ...request.Option) (*CreateAppCookieStickinessPolicyOutput, error) { - req, out := c.CreateAppCookieStickinessPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateLBCookieStickinessPolicy = "CreateLBCookieStickinessPolicy" - -// CreateLBCookieStickinessPolicyRequest generates a "aws/request.Request" representing the -// client's request for the CreateLBCookieStickinessPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateLBCookieStickinessPolicy for more information on using the CreateLBCookieStickinessPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateLBCookieStickinessPolicyRequest method. -// req, resp := client.CreateLBCookieStickinessPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLBCookieStickinessPolicy -func (c *ELB) CreateLBCookieStickinessPolicyRequest(input *CreateLBCookieStickinessPolicyInput) (req *request.Request, output *CreateLBCookieStickinessPolicyOutput) { - op := &request.Operation{ - Name: opCreateLBCookieStickinessPolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateLBCookieStickinessPolicyInput{} - } - - output = &CreateLBCookieStickinessPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateLBCookieStickinessPolicy API operation for Elastic Load Balancing. -// -// Generates a stickiness policy with sticky session lifetimes controlled by -// the lifetime of the browser (user-agent) or a specified expiration period. -// This policy can be associated only with HTTP/HTTPS listeners. -// -// When a load balancer implements this policy, the load balancer uses a special -// cookie to track the instance for each request. When the load balancer receives -// a request, it first checks to see if this cookie is present in the request. -// If so, the load balancer sends the request to the application server specified -// in the cookie. If not, the load balancer sends the request to a server that -// is chosen based on the existing load-balancing algorithm. -// -// A cookie is inserted into the response for binding subsequent requests from -// the same user to that server. The validity of the cookie is based on the -// cookie expiration time, which is specified in the policy configuration. -// -// For more information, see Duration-Based Session Stickiness (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-duration) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateLBCookieStickinessPolicy for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeDuplicatePolicyNameException "DuplicatePolicyName" -// A policy with the specified name already exists for this load balancer. -// -// - ErrCodeTooManyPoliciesException "TooManyPolicies" -// The quota for the number of policies for this load balancer has been reached. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLBCookieStickinessPolicy -func (c *ELB) CreateLBCookieStickinessPolicy(input *CreateLBCookieStickinessPolicyInput) (*CreateLBCookieStickinessPolicyOutput, error) { - req, out := c.CreateLBCookieStickinessPolicyRequest(input) - return out, req.Send() -} - -// CreateLBCookieStickinessPolicyWithContext is the same as CreateLBCookieStickinessPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See CreateLBCookieStickinessPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) CreateLBCookieStickinessPolicyWithContext(ctx aws.Context, input *CreateLBCookieStickinessPolicyInput, opts ...request.Option) (*CreateLBCookieStickinessPolicyOutput, error) { - req, out := c.CreateLBCookieStickinessPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateLoadBalancer = "CreateLoadBalancer" - -// CreateLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the CreateLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateLoadBalancer for more information on using the CreateLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateLoadBalancerRequest method. -// req, resp := client.CreateLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLoadBalancer -func (c *ELB) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (req *request.Request, output *CreateLoadBalancerOutput) { - op := &request.Operation{ - Name: opCreateLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateLoadBalancerInput{} - } - - output = &CreateLoadBalancerOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateLoadBalancer API operation for Elastic Load Balancing. -// -// Creates a Classic Load Balancer. -// -// You can add listeners, security groups, subnets, and tags when you create -// your load balancer, or you can add them later using CreateLoadBalancerListeners, -// ApplySecurityGroupsToLoadBalancer, AttachLoadBalancerToSubnets, and AddTags. -// -// To describe your current load balancers, see DescribeLoadBalancers. When -// you are finished with a load balancer, you can delete it using DeleteLoadBalancer. -// -// You can create up to 20 load balancers per region per account. You can request -// an increase for the number of load balancers for your account. For more information, -// see Limits for Your Classic Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-limits.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateLoadBalancer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeDuplicateAccessPointNameException "DuplicateLoadBalancerName" -// The specified load balancer name already exists for this account. -// -// - ErrCodeTooManyAccessPointsException "TooManyLoadBalancers" -// The quota for the number of load balancers has been reached. -// -// - ErrCodeCertificateNotFoundException "CertificateNotFound" -// The specified ARN does not refer to a valid SSL certificate in AWS Identity -// and Access Management (IAM) or AWS Certificate Manager (ACM). Note that if -// you recently uploaded the certificate to IAM, this error might indicate that -// the certificate is not fully available yet. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// - ErrCodeSubnetNotFoundException "SubnetNotFound" -// One or more of the specified subnets do not exist. -// -// - ErrCodeInvalidSubnetException "InvalidSubnet" -// The specified VPC has no associated Internet gateway. -// -// - ErrCodeInvalidSecurityGroupException "InvalidSecurityGroup" -// One or more of the specified security groups do not exist. -// -// - ErrCodeInvalidSchemeException "InvalidScheme" -// The specified value for the schema is not valid. You can only specify a scheme -// for load balancers in a VPC. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// The quota for the number of tags that can be assigned to a load balancer -// has been reached. -// -// - ErrCodeDuplicateTagKeysException "DuplicateTagKeys" -// A tag key was specified more than once. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol or signature version is not supported. -// -// - ErrCodeOperationNotPermittedException "OperationNotPermitted" -// This operation is not allowed. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLoadBalancer -func (c *ELB) CreateLoadBalancer(input *CreateLoadBalancerInput) (*CreateLoadBalancerOutput, error) { - req, out := c.CreateLoadBalancerRequest(input) - return out, req.Send() -} - -// CreateLoadBalancerWithContext is the same as CreateLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See CreateLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) CreateLoadBalancerWithContext(ctx aws.Context, input *CreateLoadBalancerInput, opts ...request.Option) (*CreateLoadBalancerOutput, error) { - req, out := c.CreateLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateLoadBalancerListeners = "CreateLoadBalancerListeners" - -// CreateLoadBalancerListenersRequest generates a "aws/request.Request" representing the -// client's request for the CreateLoadBalancerListeners operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateLoadBalancerListeners for more information on using the CreateLoadBalancerListeners -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateLoadBalancerListenersRequest method. -// req, resp := client.CreateLoadBalancerListenersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLoadBalancerListeners -func (c *ELB) CreateLoadBalancerListenersRequest(input *CreateLoadBalancerListenersInput) (req *request.Request, output *CreateLoadBalancerListenersOutput) { - op := &request.Operation{ - Name: opCreateLoadBalancerListeners, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateLoadBalancerListenersInput{} - } - - output = &CreateLoadBalancerListenersOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateLoadBalancerListeners API operation for Elastic Load Balancing. -// -// Creates one or more listeners for the specified load balancer. If a listener -// with the specified port does not already exist, it is created; otherwise, -// the properties of the new listener must match the properties of the existing -// listener. -// -// For more information, see Listeners for Your Classic Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-listener-config.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateLoadBalancerListeners for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeDuplicateListenerException "DuplicateListener" -// A listener already exists for the specified load balancer name and port, -// but with a different instance port, protocol, or SSL certificate. -// -// - ErrCodeCertificateNotFoundException "CertificateNotFound" -// The specified ARN does not refer to a valid SSL certificate in AWS Identity -// and Access Management (IAM) or AWS Certificate Manager (ACM). Note that if -// you recently uploaded the certificate to IAM, this error might indicate that -// the certificate is not fully available yet. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol or signature version is not supported. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLoadBalancerListeners -func (c *ELB) CreateLoadBalancerListeners(input *CreateLoadBalancerListenersInput) (*CreateLoadBalancerListenersOutput, error) { - req, out := c.CreateLoadBalancerListenersRequest(input) - return out, req.Send() -} - -// CreateLoadBalancerListenersWithContext is the same as CreateLoadBalancerListeners with the addition of -// the ability to pass a context and additional request options. -// -// See CreateLoadBalancerListeners for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) CreateLoadBalancerListenersWithContext(ctx aws.Context, input *CreateLoadBalancerListenersInput, opts ...request.Option) (*CreateLoadBalancerListenersOutput, error) { - req, out := c.CreateLoadBalancerListenersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateLoadBalancerPolicy = "CreateLoadBalancerPolicy" - -// CreateLoadBalancerPolicyRequest generates a "aws/request.Request" representing the -// client's request for the CreateLoadBalancerPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateLoadBalancerPolicy for more information on using the CreateLoadBalancerPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateLoadBalancerPolicyRequest method. -// req, resp := client.CreateLoadBalancerPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLoadBalancerPolicy -func (c *ELB) CreateLoadBalancerPolicyRequest(input *CreateLoadBalancerPolicyInput) (req *request.Request, output *CreateLoadBalancerPolicyOutput) { - op := &request.Operation{ - Name: opCreateLoadBalancerPolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateLoadBalancerPolicyInput{} - } - - output = &CreateLoadBalancerPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateLoadBalancerPolicy API operation for Elastic Load Balancing. -// -// Creates a policy with the specified attributes for the specified load balancer. -// -// Policies are settings that are saved for your load balancer and that can -// be applied to the listener or the application server, depending on the policy -// type. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateLoadBalancerPolicy for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodePolicyTypeNotFoundException "PolicyTypeNotFound" -// One or more of the specified policy types do not exist. -// -// - ErrCodeDuplicatePolicyNameException "DuplicatePolicyName" -// A policy with the specified name already exists for this load balancer. -// -// - ErrCodeTooManyPoliciesException "TooManyPolicies" -// The quota for the number of policies for this load balancer has been reached. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/CreateLoadBalancerPolicy -func (c *ELB) CreateLoadBalancerPolicy(input *CreateLoadBalancerPolicyInput) (*CreateLoadBalancerPolicyOutput, error) { - req, out := c.CreateLoadBalancerPolicyRequest(input) - return out, req.Send() -} - -// CreateLoadBalancerPolicyWithContext is the same as CreateLoadBalancerPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See CreateLoadBalancerPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) CreateLoadBalancerPolicyWithContext(ctx aws.Context, input *CreateLoadBalancerPolicyInput, opts ...request.Option) (*CreateLoadBalancerPolicyOutput, error) { - req, out := c.CreateLoadBalancerPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteLoadBalancer = "DeleteLoadBalancer" - -// DeleteLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the DeleteLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteLoadBalancer for more information on using the DeleteLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteLoadBalancerRequest method. -// req, resp := client.DeleteLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeleteLoadBalancer -func (c *ELB) DeleteLoadBalancerRequest(input *DeleteLoadBalancerInput) (req *request.Request, output *DeleteLoadBalancerOutput) { - op := &request.Operation{ - Name: opDeleteLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteLoadBalancerInput{} - } - - output = &DeleteLoadBalancerOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteLoadBalancer API operation for Elastic Load Balancing. -// -// Deletes the specified load balancer. -// -// If you are attempting to recreate a load balancer, you must reconfigure all -// settings. The DNS name associated with a deleted load balancer are no longer -// usable. The name and associated DNS record of the deleted load balancer no -// longer exist and traffic sent to any of its IP addresses is no longer delivered -// to your instances. -// -// If the load balancer does not exist or has already been deleted, the call -// to DeleteLoadBalancer still succeeds. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeleteLoadBalancer for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeleteLoadBalancer -func (c *ELB) DeleteLoadBalancer(input *DeleteLoadBalancerInput) (*DeleteLoadBalancerOutput, error) { - req, out := c.DeleteLoadBalancerRequest(input) - return out, req.Send() -} - -// DeleteLoadBalancerWithContext is the same as DeleteLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DeleteLoadBalancerWithContext(ctx aws.Context, input *DeleteLoadBalancerInput, opts ...request.Option) (*DeleteLoadBalancerOutput, error) { - req, out := c.DeleteLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteLoadBalancerListeners = "DeleteLoadBalancerListeners" - -// DeleteLoadBalancerListenersRequest generates a "aws/request.Request" representing the -// client's request for the DeleteLoadBalancerListeners operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteLoadBalancerListeners for more information on using the DeleteLoadBalancerListeners -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteLoadBalancerListenersRequest method. -// req, resp := client.DeleteLoadBalancerListenersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeleteLoadBalancerListeners -func (c *ELB) DeleteLoadBalancerListenersRequest(input *DeleteLoadBalancerListenersInput) (req *request.Request, output *DeleteLoadBalancerListenersOutput) { - op := &request.Operation{ - Name: opDeleteLoadBalancerListeners, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteLoadBalancerListenersInput{} - } - - output = &DeleteLoadBalancerListenersOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteLoadBalancerListeners API operation for Elastic Load Balancing. -// -// Deletes the specified listeners from the specified load balancer. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeleteLoadBalancerListeners for usage and error information. -// -// Returned Error Codes: -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeleteLoadBalancerListeners -func (c *ELB) DeleteLoadBalancerListeners(input *DeleteLoadBalancerListenersInput) (*DeleteLoadBalancerListenersOutput, error) { - req, out := c.DeleteLoadBalancerListenersRequest(input) - return out, req.Send() -} - -// DeleteLoadBalancerListenersWithContext is the same as DeleteLoadBalancerListeners with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteLoadBalancerListeners for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DeleteLoadBalancerListenersWithContext(ctx aws.Context, input *DeleteLoadBalancerListenersInput, opts ...request.Option) (*DeleteLoadBalancerListenersOutput, error) { - req, out := c.DeleteLoadBalancerListenersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteLoadBalancerPolicy = "DeleteLoadBalancerPolicy" - -// DeleteLoadBalancerPolicyRequest generates a "aws/request.Request" representing the -// client's request for the DeleteLoadBalancerPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteLoadBalancerPolicy for more information on using the DeleteLoadBalancerPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteLoadBalancerPolicyRequest method. -// req, resp := client.DeleteLoadBalancerPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeleteLoadBalancerPolicy -func (c *ELB) DeleteLoadBalancerPolicyRequest(input *DeleteLoadBalancerPolicyInput) (req *request.Request, output *DeleteLoadBalancerPolicyOutput) { - op := &request.Operation{ - Name: opDeleteLoadBalancerPolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteLoadBalancerPolicyInput{} - } - - output = &DeleteLoadBalancerPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteLoadBalancerPolicy API operation for Elastic Load Balancing. -// -// Deletes the specified policy from the specified load balancer. This policy -// must not be enabled for any listeners. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeleteLoadBalancerPolicy for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeleteLoadBalancerPolicy -func (c *ELB) DeleteLoadBalancerPolicy(input *DeleteLoadBalancerPolicyInput) (*DeleteLoadBalancerPolicyOutput, error) { - req, out := c.DeleteLoadBalancerPolicyRequest(input) - return out, req.Send() -} - -// DeleteLoadBalancerPolicyWithContext is the same as DeleteLoadBalancerPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteLoadBalancerPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DeleteLoadBalancerPolicyWithContext(ctx aws.Context, input *DeleteLoadBalancerPolicyInput, opts ...request.Option) (*DeleteLoadBalancerPolicyOutput, error) { - req, out := c.DeleteLoadBalancerPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeregisterInstancesFromLoadBalancer = "DeregisterInstancesFromLoadBalancer" - -// DeregisterInstancesFromLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the DeregisterInstancesFromLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeregisterInstancesFromLoadBalancer for more information on using the DeregisterInstancesFromLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeregisterInstancesFromLoadBalancerRequest method. -// req, resp := client.DeregisterInstancesFromLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeregisterInstancesFromLoadBalancer -func (c *ELB) DeregisterInstancesFromLoadBalancerRequest(input *DeregisterInstancesFromLoadBalancerInput) (req *request.Request, output *DeregisterInstancesFromLoadBalancerOutput) { - op := &request.Operation{ - Name: opDeregisterInstancesFromLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeregisterInstancesFromLoadBalancerInput{} - } - - output = &DeregisterInstancesFromLoadBalancerOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeregisterInstancesFromLoadBalancer API operation for Elastic Load Balancing. -// -// Deregisters the specified instances from the specified load balancer. After -// the instance is deregistered, it no longer receives traffic from the load -// balancer. -// -// You can use DescribeLoadBalancers to verify that the instance is deregistered -// from the load balancer. -// -// For more information, see Register or De-Register EC2 Instances (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-deregister-register-instances.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeregisterInstancesFromLoadBalancer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidEndPointException "InvalidInstance" -// The specified endpoint is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DeregisterInstancesFromLoadBalancer -func (c *ELB) DeregisterInstancesFromLoadBalancer(input *DeregisterInstancesFromLoadBalancerInput) (*DeregisterInstancesFromLoadBalancerOutput, error) { - req, out := c.DeregisterInstancesFromLoadBalancerRequest(input) - return out, req.Send() -} - -// DeregisterInstancesFromLoadBalancerWithContext is the same as DeregisterInstancesFromLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See DeregisterInstancesFromLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DeregisterInstancesFromLoadBalancerWithContext(ctx aws.Context, input *DeregisterInstancesFromLoadBalancerInput, opts ...request.Option) (*DeregisterInstancesFromLoadBalancerOutput, error) { - req, out := c.DeregisterInstancesFromLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeAccountLimits = "DescribeAccountLimits" - -// DescribeAccountLimitsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeAccountLimits operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeAccountLimits for more information on using the DescribeAccountLimits -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeAccountLimitsRequest method. -// req, resp := client.DescribeAccountLimitsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeAccountLimits -func (c *ELB) DescribeAccountLimitsRequest(input *DescribeAccountLimitsInput) (req *request.Request, output *DescribeAccountLimitsOutput) { - op := &request.Operation{ - Name: opDescribeAccountLimits, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeAccountLimitsInput{} - } - - output = &DescribeAccountLimitsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeAccountLimits API operation for Elastic Load Balancing. -// -// Describes the current Elastic Load Balancing resource limits for your AWS -// account. -// -// For more information, see Limits for Your Classic Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-limits.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeAccountLimits for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeAccountLimits -func (c *ELB) DescribeAccountLimits(input *DescribeAccountLimitsInput) (*DescribeAccountLimitsOutput, error) { - req, out := c.DescribeAccountLimitsRequest(input) - return out, req.Send() -} - -// DescribeAccountLimitsWithContext is the same as DescribeAccountLimits with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeAccountLimits for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeAccountLimitsWithContext(ctx aws.Context, input *DescribeAccountLimitsInput, opts ...request.Option) (*DescribeAccountLimitsOutput, error) { - req, out := c.DescribeAccountLimitsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeInstanceHealth = "DescribeInstanceHealth" - -// DescribeInstanceHealthRequest generates a "aws/request.Request" representing the -// client's request for the DescribeInstanceHealth operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeInstanceHealth for more information on using the DescribeInstanceHealth -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeInstanceHealthRequest method. -// req, resp := client.DescribeInstanceHealthRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeInstanceHealth -func (c *ELB) DescribeInstanceHealthRequest(input *DescribeInstanceHealthInput) (req *request.Request, output *DescribeInstanceHealthOutput) { - op := &request.Operation{ - Name: opDescribeInstanceHealth, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeInstanceHealthInput{} - } - - output = &DescribeInstanceHealthOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeInstanceHealth API operation for Elastic Load Balancing. -// -// Describes the state of the specified instances with respect to the specified -// load balancer. If no instances are specified, the call describes the state -// of all instances that are currently registered with the load balancer. If -// instances are specified, their state is returned even if they are no longer -// registered with the load balancer. The state of terminated instances is not -// returned. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeInstanceHealth for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidEndPointException "InvalidInstance" -// The specified endpoint is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeInstanceHealth -func (c *ELB) DescribeInstanceHealth(input *DescribeInstanceHealthInput) (*DescribeInstanceHealthOutput, error) { - req, out := c.DescribeInstanceHealthRequest(input) - return out, req.Send() -} - -// DescribeInstanceHealthWithContext is the same as DescribeInstanceHealth with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeInstanceHealth for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeInstanceHealthWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.Option) (*DescribeInstanceHealthOutput, error) { - req, out := c.DescribeInstanceHealthRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLoadBalancerAttributes = "DescribeLoadBalancerAttributes" - -// DescribeLoadBalancerAttributesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancerAttributes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancerAttributes for more information on using the DescribeLoadBalancerAttributes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancerAttributesRequest method. -// req, resp := client.DescribeLoadBalancerAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancerAttributes -func (c *ELB) DescribeLoadBalancerAttributesRequest(input *DescribeLoadBalancerAttributesInput) (req *request.Request, output *DescribeLoadBalancerAttributesOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancerAttributes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLoadBalancerAttributesInput{} - } - - output = &DescribeLoadBalancerAttributesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancerAttributes API operation for Elastic Load Balancing. -// -// Describes the attributes for the specified load balancer. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeLoadBalancerAttributes for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeLoadBalancerAttributeNotFoundException "LoadBalancerAttributeNotFound" -// The specified load balancer attribute does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancerAttributes -func (c *ELB) DescribeLoadBalancerAttributes(input *DescribeLoadBalancerAttributesInput) (*DescribeLoadBalancerAttributesOutput, error) { - req, out := c.DescribeLoadBalancerAttributesRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancerAttributesWithContext is the same as DescribeLoadBalancerAttributes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancerAttributes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeLoadBalancerAttributesWithContext(ctx aws.Context, input *DescribeLoadBalancerAttributesInput, opts ...request.Option) (*DescribeLoadBalancerAttributesOutput, error) { - req, out := c.DescribeLoadBalancerAttributesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLoadBalancerPolicies = "DescribeLoadBalancerPolicies" - -// DescribeLoadBalancerPoliciesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancerPolicies operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancerPolicies for more information on using the DescribeLoadBalancerPolicies -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancerPoliciesRequest method. -// req, resp := client.DescribeLoadBalancerPoliciesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancerPolicies -func (c *ELB) DescribeLoadBalancerPoliciesRequest(input *DescribeLoadBalancerPoliciesInput) (req *request.Request, output *DescribeLoadBalancerPoliciesOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancerPolicies, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLoadBalancerPoliciesInput{} - } - - output = &DescribeLoadBalancerPoliciesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancerPolicies API operation for Elastic Load Balancing. -// -// Describes the specified policies. -// -// If you specify a load balancer name, the action returns the descriptions -// of all policies created for the load balancer. If you specify a policy name -// associated with your load balancer, the action returns the description of -// that policy. If you don't specify a load balancer name, the action returns -// descriptions of the specified sample policies, or descriptions of all sample -// policies. The names of the sample policies have the ELBSample- prefix. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeLoadBalancerPolicies for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodePolicyNotFoundException "PolicyNotFound" -// One or more of the specified policies do not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancerPolicies -func (c *ELB) DescribeLoadBalancerPolicies(input *DescribeLoadBalancerPoliciesInput) (*DescribeLoadBalancerPoliciesOutput, error) { - req, out := c.DescribeLoadBalancerPoliciesRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancerPoliciesWithContext is the same as DescribeLoadBalancerPolicies with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancerPolicies for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeLoadBalancerPoliciesWithContext(ctx aws.Context, input *DescribeLoadBalancerPoliciesInput, opts ...request.Option) (*DescribeLoadBalancerPoliciesOutput, error) { - req, out := c.DescribeLoadBalancerPoliciesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLoadBalancerPolicyTypes = "DescribeLoadBalancerPolicyTypes" - -// DescribeLoadBalancerPolicyTypesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancerPolicyTypes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancerPolicyTypes for more information on using the DescribeLoadBalancerPolicyTypes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancerPolicyTypesRequest method. -// req, resp := client.DescribeLoadBalancerPolicyTypesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancerPolicyTypes -func (c *ELB) DescribeLoadBalancerPolicyTypesRequest(input *DescribeLoadBalancerPolicyTypesInput) (req *request.Request, output *DescribeLoadBalancerPolicyTypesOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancerPolicyTypes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLoadBalancerPolicyTypesInput{} - } - - output = &DescribeLoadBalancerPolicyTypesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancerPolicyTypes API operation for Elastic Load Balancing. -// -// Describes the specified load balancer policy types or all load balancer policy -// types. -// -// The description of each type indicates how it can be used. For example, some -// policies can be used only with layer 7 listeners, some policies can be used -// only with layer 4 listeners, and some policies can be used only with your -// EC2 instances. -// -// You can use CreateLoadBalancerPolicy to create a policy configuration for -// any of these policy types. Then, depending on the policy type, use either -// SetLoadBalancerPoliciesOfListener or SetLoadBalancerPoliciesForBackendServer -// to set the policy. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeLoadBalancerPolicyTypes for usage and error information. -// -// Returned Error Codes: -// - ErrCodePolicyTypeNotFoundException "PolicyTypeNotFound" -// One or more of the specified policy types do not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancerPolicyTypes -func (c *ELB) DescribeLoadBalancerPolicyTypes(input *DescribeLoadBalancerPolicyTypesInput) (*DescribeLoadBalancerPolicyTypesOutput, error) { - req, out := c.DescribeLoadBalancerPolicyTypesRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancerPolicyTypesWithContext is the same as DescribeLoadBalancerPolicyTypes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancerPolicyTypes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeLoadBalancerPolicyTypesWithContext(ctx aws.Context, input *DescribeLoadBalancerPolicyTypesInput, opts ...request.Option) (*DescribeLoadBalancerPolicyTypesOutput, error) { - req, out := c.DescribeLoadBalancerPolicyTypesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLoadBalancers = "DescribeLoadBalancers" - -// DescribeLoadBalancersRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancers operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancers for more information on using the DescribeLoadBalancers -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancersRequest method. -// req, resp := client.DescribeLoadBalancersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancers -func (c *ELB) DescribeLoadBalancersRequest(input *DescribeLoadBalancersInput) (req *request.Request, output *DescribeLoadBalancersOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancers, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeLoadBalancersInput{} - } - - output = &DescribeLoadBalancersOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancers API operation for Elastic Load Balancing. -// -// Describes the specified the load balancers. If no load balancers are specified, -// the call describes all of your load balancers. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeLoadBalancers for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeDependencyThrottleException "DependencyThrottle" -// A request made by Elastic Load Balancing to another service exceeds the maximum -// request rate permitted for your account. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancers -func (c *ELB) DescribeLoadBalancers(input *DescribeLoadBalancersInput) (*DescribeLoadBalancersOutput, error) { - req, out := c.DescribeLoadBalancersRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancersWithContext is the same as DescribeLoadBalancers with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancers for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeLoadBalancersWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.Option) (*DescribeLoadBalancersOutput, error) { - req, out := c.DescribeLoadBalancersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeLoadBalancersPages iterates over the pages of a DescribeLoadBalancers operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeLoadBalancers 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 DescribeLoadBalancers operation. -// pageNum := 0 -// err := client.DescribeLoadBalancersPages(params, -// func(page *elb.DescribeLoadBalancersOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *ELB) DescribeLoadBalancersPages(input *DescribeLoadBalancersInput, fn func(*DescribeLoadBalancersOutput, bool) bool) error { - return c.DescribeLoadBalancersPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeLoadBalancersPagesWithContext same as DescribeLoadBalancersPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeLoadBalancersPagesWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, fn func(*DescribeLoadBalancersOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeLoadBalancersInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeLoadBalancersRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeLoadBalancersOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeTags = "DescribeTags" - -// DescribeTagsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeTags for more information on using the DescribeTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // 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) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeTags -func (c *ELB) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Request, output *DescribeTagsOutput) { - op := &request.Operation{ - Name: opDescribeTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeTagsInput{} - } - - output = &DescribeTagsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeTags API operation for Elastic Load Balancing. -// -// Describes the tags associated with the specified load balancers. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeTags for usage and error information. -// -// Returned Error Codes: -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeTags -func (c *ELB) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error) { - req, out := c.DescribeTagsRequest(input) - return out, req.Send() -} - -// DescribeTagsWithContext is the same as DescribeTags with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DescribeTagsWithContext(ctx aws.Context, input *DescribeTagsInput, opts ...request.Option) (*DescribeTagsOutput, error) { - req, out := c.DescribeTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDetachLoadBalancerFromSubnets = "DetachLoadBalancerFromSubnets" - -// DetachLoadBalancerFromSubnetsRequest generates a "aws/request.Request" representing the -// client's request for the DetachLoadBalancerFromSubnets operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DetachLoadBalancerFromSubnets for more information on using the DetachLoadBalancerFromSubnets -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DetachLoadBalancerFromSubnetsRequest method. -// req, resp := client.DetachLoadBalancerFromSubnetsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DetachLoadBalancerFromSubnets -func (c *ELB) DetachLoadBalancerFromSubnetsRequest(input *DetachLoadBalancerFromSubnetsInput) (req *request.Request, output *DetachLoadBalancerFromSubnetsOutput) { - op := &request.Operation{ - Name: opDetachLoadBalancerFromSubnets, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DetachLoadBalancerFromSubnetsInput{} - } - - output = &DetachLoadBalancerFromSubnetsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DetachLoadBalancerFromSubnets API operation for Elastic Load Balancing. -// -// Removes the specified subnets from the set of configured subnets for the -// load balancer. -// -// After a subnet is removed, all EC2 instances registered with the load balancer -// in the removed subnet go into the OutOfService state. Then, the load balancer -// balances the traffic among the remaining routable subnets. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DetachLoadBalancerFromSubnets for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DetachLoadBalancerFromSubnets -func (c *ELB) DetachLoadBalancerFromSubnets(input *DetachLoadBalancerFromSubnetsInput) (*DetachLoadBalancerFromSubnetsOutput, error) { - req, out := c.DetachLoadBalancerFromSubnetsRequest(input) - return out, req.Send() -} - -// DetachLoadBalancerFromSubnetsWithContext is the same as DetachLoadBalancerFromSubnets with the addition of -// the ability to pass a context and additional request options. -// -// See DetachLoadBalancerFromSubnets for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DetachLoadBalancerFromSubnetsWithContext(ctx aws.Context, input *DetachLoadBalancerFromSubnetsInput, opts ...request.Option) (*DetachLoadBalancerFromSubnetsOutput, error) { - req, out := c.DetachLoadBalancerFromSubnetsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDisableAvailabilityZonesForLoadBalancer = "DisableAvailabilityZonesForLoadBalancer" - -// DisableAvailabilityZonesForLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the DisableAvailabilityZonesForLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DisableAvailabilityZonesForLoadBalancer for more information on using the DisableAvailabilityZonesForLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DisableAvailabilityZonesForLoadBalancerRequest method. -// req, resp := client.DisableAvailabilityZonesForLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DisableAvailabilityZonesForLoadBalancer -func (c *ELB) DisableAvailabilityZonesForLoadBalancerRequest(input *DisableAvailabilityZonesForLoadBalancerInput) (req *request.Request, output *DisableAvailabilityZonesForLoadBalancerOutput) { - op := &request.Operation{ - Name: opDisableAvailabilityZonesForLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DisableAvailabilityZonesForLoadBalancerInput{} - } - - output = &DisableAvailabilityZonesForLoadBalancerOutput{} - req = c.newRequest(op, input, output) - return -} - -// DisableAvailabilityZonesForLoadBalancer API operation for Elastic Load Balancing. -// -// Removes the specified Availability Zones from the set of Availability Zones -// for the specified load balancer in EC2-Classic or a default VPC. -// -// For load balancers in a non-default VPC, use DetachLoadBalancerFromSubnets. -// -// There must be at least one Availability Zone registered with a load balancer -// at all times. After an Availability Zone is removed, all instances registered -// with the load balancer that are in the removed Availability Zone go into -// the OutOfService state. Then, the load balancer attempts to equally balance -// the traffic among its remaining Availability Zones. -// -// For more information, see Add or Remove Availability Zones (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-disable-az.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DisableAvailabilityZonesForLoadBalancer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DisableAvailabilityZonesForLoadBalancer -func (c *ELB) DisableAvailabilityZonesForLoadBalancer(input *DisableAvailabilityZonesForLoadBalancerInput) (*DisableAvailabilityZonesForLoadBalancerOutput, error) { - req, out := c.DisableAvailabilityZonesForLoadBalancerRequest(input) - return out, req.Send() -} - -// DisableAvailabilityZonesForLoadBalancerWithContext is the same as DisableAvailabilityZonesForLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See DisableAvailabilityZonesForLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) DisableAvailabilityZonesForLoadBalancerWithContext(ctx aws.Context, input *DisableAvailabilityZonesForLoadBalancerInput, opts ...request.Option) (*DisableAvailabilityZonesForLoadBalancerOutput, error) { - req, out := c.DisableAvailabilityZonesForLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opEnableAvailabilityZonesForLoadBalancer = "EnableAvailabilityZonesForLoadBalancer" - -// EnableAvailabilityZonesForLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the EnableAvailabilityZonesForLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See EnableAvailabilityZonesForLoadBalancer for more information on using the EnableAvailabilityZonesForLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the EnableAvailabilityZonesForLoadBalancerRequest method. -// req, resp := client.EnableAvailabilityZonesForLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/EnableAvailabilityZonesForLoadBalancer -func (c *ELB) EnableAvailabilityZonesForLoadBalancerRequest(input *EnableAvailabilityZonesForLoadBalancerInput) (req *request.Request, output *EnableAvailabilityZonesForLoadBalancerOutput) { - op := &request.Operation{ - Name: opEnableAvailabilityZonesForLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &EnableAvailabilityZonesForLoadBalancerInput{} - } - - output = &EnableAvailabilityZonesForLoadBalancerOutput{} - req = c.newRequest(op, input, output) - return -} - -// EnableAvailabilityZonesForLoadBalancer API operation for Elastic Load Balancing. -// -// Adds the specified Availability Zones to the set of Availability Zones for -// the specified load balancer in EC2-Classic or a default VPC. -// -// For load balancers in a non-default VPC, use AttachLoadBalancerToSubnets. -// -// The load balancer evenly distributes requests across all its registered Availability -// Zones that contain instances. For more information, see Add or Remove Availability -// Zones (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-disable-az.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation EnableAvailabilityZonesForLoadBalancer for usage and error information. -// -// Returned Error Codes: -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/EnableAvailabilityZonesForLoadBalancer -func (c *ELB) EnableAvailabilityZonesForLoadBalancer(input *EnableAvailabilityZonesForLoadBalancerInput) (*EnableAvailabilityZonesForLoadBalancerOutput, error) { - req, out := c.EnableAvailabilityZonesForLoadBalancerRequest(input) - return out, req.Send() -} - -// EnableAvailabilityZonesForLoadBalancerWithContext is the same as EnableAvailabilityZonesForLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See EnableAvailabilityZonesForLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) EnableAvailabilityZonesForLoadBalancerWithContext(ctx aws.Context, input *EnableAvailabilityZonesForLoadBalancerInput, opts ...request.Option) (*EnableAvailabilityZonesForLoadBalancerOutput, error) { - req, out := c.EnableAvailabilityZonesForLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opModifyLoadBalancerAttributes = "ModifyLoadBalancerAttributes" - -// ModifyLoadBalancerAttributesRequest generates a "aws/request.Request" representing the -// client's request for the ModifyLoadBalancerAttributes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ModifyLoadBalancerAttributes for more information on using the ModifyLoadBalancerAttributes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ModifyLoadBalancerAttributesRequest method. -// req, resp := client.ModifyLoadBalancerAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/ModifyLoadBalancerAttributes -func (c *ELB) ModifyLoadBalancerAttributesRequest(input *ModifyLoadBalancerAttributesInput) (req *request.Request, output *ModifyLoadBalancerAttributesOutput) { - op := &request.Operation{ - Name: opModifyLoadBalancerAttributes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyLoadBalancerAttributesInput{} - } - - output = &ModifyLoadBalancerAttributesOutput{} - req = c.newRequest(op, input, output) - return -} - -// ModifyLoadBalancerAttributes API operation for Elastic Load Balancing. -// -// Modifies the attributes of the specified load balancer. -// -// You can modify the load balancer attributes, such as AccessLogs, ConnectionDraining, -// and CrossZoneLoadBalancing by either enabling or disabling them. Or, you -// can modify the load balancer attribute ConnectionSettings by specifying an -// idle connection timeout value for your load balancer. -// -// For more information, see the following in the Classic Load Balancers Guide: -// -// - Cross-Zone Load Balancing (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-disable-crosszone-lb.html) -// -// - Connection Draining (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-conn-drain.html) -// -// - Access Logs (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/access-log-collection.html) -// -// - Idle Connection Timeout (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ModifyLoadBalancerAttributes for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeLoadBalancerAttributeNotFoundException "LoadBalancerAttributeNotFound" -// The specified load balancer attribute does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/ModifyLoadBalancerAttributes -func (c *ELB) ModifyLoadBalancerAttributes(input *ModifyLoadBalancerAttributesInput) (*ModifyLoadBalancerAttributesOutput, error) { - req, out := c.ModifyLoadBalancerAttributesRequest(input) - return out, req.Send() -} - -// ModifyLoadBalancerAttributesWithContext is the same as ModifyLoadBalancerAttributes with the addition of -// the ability to pass a context and additional request options. -// -// See ModifyLoadBalancerAttributes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) ModifyLoadBalancerAttributesWithContext(ctx aws.Context, input *ModifyLoadBalancerAttributesInput, opts ...request.Option) (*ModifyLoadBalancerAttributesOutput, error) { - req, out := c.ModifyLoadBalancerAttributesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRegisterInstancesWithLoadBalancer = "RegisterInstancesWithLoadBalancer" - -// RegisterInstancesWithLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the RegisterInstancesWithLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RegisterInstancesWithLoadBalancer for more information on using the RegisterInstancesWithLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RegisterInstancesWithLoadBalancerRequest method. -// req, resp := client.RegisterInstancesWithLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/RegisterInstancesWithLoadBalancer -func (c *ELB) RegisterInstancesWithLoadBalancerRequest(input *RegisterInstancesWithLoadBalancerInput) (req *request.Request, output *RegisterInstancesWithLoadBalancerOutput) { - op := &request.Operation{ - Name: opRegisterInstancesWithLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RegisterInstancesWithLoadBalancerInput{} - } - - output = &RegisterInstancesWithLoadBalancerOutput{} - req = c.newRequest(op, input, output) - return -} - -// RegisterInstancesWithLoadBalancer API operation for Elastic Load Balancing. -// -// Adds the specified instances to the specified load balancer. -// -// The instance must be a running instance in the same network as the load balancer -// (EC2-Classic or the same VPC). If you have EC2-Classic instances and a load -// balancer in a VPC with ClassicLink enabled, you can link the EC2-Classic -// instances to that VPC and then register the linked EC2-Classic instances -// with the load balancer in the VPC. -// -// Note that RegisterInstanceWithLoadBalancer completes when the request has -// been registered. Instance registration takes a little time to complete. To -// check the state of the registered instances, use DescribeLoadBalancers or -// DescribeInstanceHealth. -// -// After the instance is registered, it starts receiving traffic and requests -// from the load balancer. Any instance that is not in one of the Availability -// Zones registered for the load balancer is moved to the OutOfService state. -// If an Availability Zone is added to the load balancer later, any instances -// registered with the load balancer move to the InService state. -// -// To deregister instances from a load balancer, use DeregisterInstancesFromLoadBalancer. -// -// For more information, see Register or De-Register EC2 Instances (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-deregister-register-instances.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation RegisterInstancesWithLoadBalancer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidEndPointException "InvalidInstance" -// The specified endpoint is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/RegisterInstancesWithLoadBalancer -func (c *ELB) RegisterInstancesWithLoadBalancer(input *RegisterInstancesWithLoadBalancerInput) (*RegisterInstancesWithLoadBalancerOutput, error) { - req, out := c.RegisterInstancesWithLoadBalancerRequest(input) - return out, req.Send() -} - -// RegisterInstancesWithLoadBalancerWithContext is the same as RegisterInstancesWithLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See RegisterInstancesWithLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) RegisterInstancesWithLoadBalancerWithContext(ctx aws.Context, input *RegisterInstancesWithLoadBalancerInput, opts ...request.Option) (*RegisterInstancesWithLoadBalancerOutput, error) { - req, out := c.RegisterInstancesWithLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRemoveTags = "RemoveTags" - -// RemoveTagsRequest generates a "aws/request.Request" representing the -// client's request for the RemoveTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RemoveTags for more information on using the RemoveTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RemoveTagsRequest method. -// req, resp := client.RemoveTagsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/RemoveTags -func (c *ELB) RemoveTagsRequest(input *RemoveTagsInput) (req *request.Request, output *RemoveTagsOutput) { - op := &request.Operation{ - Name: opRemoveTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RemoveTagsInput{} - } - - output = &RemoveTagsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// RemoveTags API operation for Elastic Load Balancing. -// -// Removes one or more tags from the specified load balancer. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation RemoveTags for usage and error information. -// -// Returned Error Codes: -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/RemoveTags -func (c *ELB) RemoveTags(input *RemoveTagsInput) (*RemoveTagsOutput, error) { - req, out := c.RemoveTagsRequest(input) - return out, req.Send() -} - -// RemoveTagsWithContext is the same as RemoveTags with the addition of -// the ability to pass a context and additional request options. -// -// See RemoveTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) RemoveTagsWithContext(ctx aws.Context, input *RemoveTagsInput, opts ...request.Option) (*RemoveTagsOutput, error) { - req, out := c.RemoveTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetLoadBalancerListenerSSLCertificate = "SetLoadBalancerListenerSSLCertificate" - -// SetLoadBalancerListenerSSLCertificateRequest generates a "aws/request.Request" representing the -// client's request for the SetLoadBalancerListenerSSLCertificate operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetLoadBalancerListenerSSLCertificate for more information on using the SetLoadBalancerListenerSSLCertificate -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetLoadBalancerListenerSSLCertificateRequest method. -// req, resp := client.SetLoadBalancerListenerSSLCertificateRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/SetLoadBalancerListenerSSLCertificate -func (c *ELB) SetLoadBalancerListenerSSLCertificateRequest(input *SetLoadBalancerListenerSSLCertificateInput) (req *request.Request, output *SetLoadBalancerListenerSSLCertificateOutput) { - op := &request.Operation{ - Name: opSetLoadBalancerListenerSSLCertificate, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetLoadBalancerListenerSSLCertificateInput{} - } - - output = &SetLoadBalancerListenerSSLCertificateOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// SetLoadBalancerListenerSSLCertificate API operation for Elastic Load Balancing. -// -// Sets the certificate that terminates the specified listener's SSL connections. -// The specified certificate replaces any prior certificate that was used on -// the same load balancer and port. -// -// For more information about updating your SSL certificate, see Replace the -// SSL Certificate for Your Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-update-ssl-cert.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation SetLoadBalancerListenerSSLCertificate for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeCertificateNotFoundException "CertificateNotFound" -// The specified ARN does not refer to a valid SSL certificate in AWS Identity -// and Access Management (IAM) or AWS Certificate Manager (ACM). Note that if -// you recently uploaded the certificate to IAM, this error might indicate that -// the certificate is not fully available yet. -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The load balancer does not have a listener configured at the specified port. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol or signature version is not supported. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/SetLoadBalancerListenerSSLCertificate -func (c *ELB) SetLoadBalancerListenerSSLCertificate(input *SetLoadBalancerListenerSSLCertificateInput) (*SetLoadBalancerListenerSSLCertificateOutput, error) { - req, out := c.SetLoadBalancerListenerSSLCertificateRequest(input) - return out, req.Send() -} - -// SetLoadBalancerListenerSSLCertificateWithContext is the same as SetLoadBalancerListenerSSLCertificate with the addition of -// the ability to pass a context and additional request options. -// -// See SetLoadBalancerListenerSSLCertificate for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) SetLoadBalancerListenerSSLCertificateWithContext(ctx aws.Context, input *SetLoadBalancerListenerSSLCertificateInput, opts ...request.Option) (*SetLoadBalancerListenerSSLCertificateOutput, error) { - req, out := c.SetLoadBalancerListenerSSLCertificateRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetLoadBalancerPoliciesForBackendServer = "SetLoadBalancerPoliciesForBackendServer" - -// SetLoadBalancerPoliciesForBackendServerRequest generates a "aws/request.Request" representing the -// client's request for the SetLoadBalancerPoliciesForBackendServer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetLoadBalancerPoliciesForBackendServer for more information on using the SetLoadBalancerPoliciesForBackendServer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetLoadBalancerPoliciesForBackendServerRequest method. -// req, resp := client.SetLoadBalancerPoliciesForBackendServerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/SetLoadBalancerPoliciesForBackendServer -func (c *ELB) SetLoadBalancerPoliciesForBackendServerRequest(input *SetLoadBalancerPoliciesForBackendServerInput) (req *request.Request, output *SetLoadBalancerPoliciesForBackendServerOutput) { - op := &request.Operation{ - Name: opSetLoadBalancerPoliciesForBackendServer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetLoadBalancerPoliciesForBackendServerInput{} - } - - output = &SetLoadBalancerPoliciesForBackendServerOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// SetLoadBalancerPoliciesForBackendServer API operation for Elastic Load Balancing. -// -// Replaces the set of policies associated with the specified port on which -// the EC2 instance is listening with a new set of policies. At this time, only -// the back-end server authentication policy type can be applied to the instance -// ports; this policy type is composed of multiple public key policies. -// -// Each time you use SetLoadBalancerPoliciesForBackendServer to enable the policies, -// use the PolicyNames parameter to list the policies that you want to enable. -// -// You can use DescribeLoadBalancers or DescribeLoadBalancerPolicies to verify -// that the policy is associated with the EC2 instance. -// -// For more information about enabling back-end instance authentication, see -// Configure Back-end Instance Authentication (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create-https-ssl-load-balancer.html#configure_backendauth_clt) -// in the Classic Load Balancers Guide. For more information about Proxy Protocol, -// see Configure Proxy Protocol Support (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-proxy-protocol.html) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation SetLoadBalancerPoliciesForBackendServer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodePolicyNotFoundException "PolicyNotFound" -// One or more of the specified policies do not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/SetLoadBalancerPoliciesForBackendServer -func (c *ELB) SetLoadBalancerPoliciesForBackendServer(input *SetLoadBalancerPoliciesForBackendServerInput) (*SetLoadBalancerPoliciesForBackendServerOutput, error) { - req, out := c.SetLoadBalancerPoliciesForBackendServerRequest(input) - return out, req.Send() -} - -// SetLoadBalancerPoliciesForBackendServerWithContext is the same as SetLoadBalancerPoliciesForBackendServer with the addition of -// the ability to pass a context and additional request options. -// -// See SetLoadBalancerPoliciesForBackendServer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) SetLoadBalancerPoliciesForBackendServerWithContext(ctx aws.Context, input *SetLoadBalancerPoliciesForBackendServerInput, opts ...request.Option) (*SetLoadBalancerPoliciesForBackendServerOutput, error) { - req, out := c.SetLoadBalancerPoliciesForBackendServerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetLoadBalancerPoliciesOfListener = "SetLoadBalancerPoliciesOfListener" - -// SetLoadBalancerPoliciesOfListenerRequest generates a "aws/request.Request" representing the -// client's request for the SetLoadBalancerPoliciesOfListener operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetLoadBalancerPoliciesOfListener for more information on using the SetLoadBalancerPoliciesOfListener -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetLoadBalancerPoliciesOfListenerRequest method. -// req, resp := client.SetLoadBalancerPoliciesOfListenerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/SetLoadBalancerPoliciesOfListener -func (c *ELB) SetLoadBalancerPoliciesOfListenerRequest(input *SetLoadBalancerPoliciesOfListenerInput) (req *request.Request, output *SetLoadBalancerPoliciesOfListenerOutput) { - op := &request.Operation{ - Name: opSetLoadBalancerPoliciesOfListener, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetLoadBalancerPoliciesOfListenerInput{} - } - - output = &SetLoadBalancerPoliciesOfListenerOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// SetLoadBalancerPoliciesOfListener API operation for Elastic Load Balancing. -// -// Replaces the current set of policies for the specified load balancer port -// with the specified set of policies. -// -// To enable back-end server authentication, use SetLoadBalancerPoliciesForBackendServer. -// -// For more information about setting policies, see Update the SSL Negotiation -// Configuration (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/ssl-config-update.html), -// Duration-Based Session Stickiness (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-duration), -// and Application-Controlled Session Stickiness (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html#enable-sticky-sessions-application) -// in the Classic Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation SetLoadBalancerPoliciesOfListener for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeAccessPointNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodePolicyNotFoundException "PolicyNotFound" -// One or more of the specified policies do not exist. -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The load balancer does not have a listener configured at the specified port. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration change is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/SetLoadBalancerPoliciesOfListener -func (c *ELB) SetLoadBalancerPoliciesOfListener(input *SetLoadBalancerPoliciesOfListenerInput) (*SetLoadBalancerPoliciesOfListenerOutput, error) { - req, out := c.SetLoadBalancerPoliciesOfListenerRequest(input) - return out, req.Send() -} - -// SetLoadBalancerPoliciesOfListenerWithContext is the same as SetLoadBalancerPoliciesOfListener with the addition of -// the ability to pass a context and additional request options. -// -// See SetLoadBalancerPoliciesOfListener for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) SetLoadBalancerPoliciesOfListenerWithContext(ctx aws.Context, input *SetLoadBalancerPoliciesOfListenerInput, opts ...request.Option) (*SetLoadBalancerPoliciesOfListenerOutput, error) { - req, out := c.SetLoadBalancerPoliciesOfListenerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// Information about the AccessLog attribute. -type AccessLog struct { - _ struct{} `type:"structure"` - - // The interval for publishing the access logs. You can specify an interval - // of either 5 minutes or 60 minutes. - // - // Default: 60 minutes - EmitInterval *int64 `type:"integer"` - - // Specifies whether access logs are enabled for the load balancer. - // - // Enabled is a required field - Enabled *bool `type:"boolean" required:"true"` - - // The name of the Amazon S3 bucket where the access logs are stored. - S3BucketName *string `type:"string"` - - // The logical hierarchy you created for your Amazon S3 bucket, for example - // my-bucket-prefix/prod. If the prefix is not provided, the log is placed at - // the root level of the bucket. - S3BucketPrefix *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AccessLog) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AccessLog) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AccessLog) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AccessLog"} - if s.Enabled == nil { - invalidParams.Add(request.NewErrParamRequired("Enabled")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEmitInterval sets the EmitInterval field's value. -func (s *AccessLog) SetEmitInterval(v int64) *AccessLog { - s.EmitInterval = &v - return s -} - -// SetEnabled sets the Enabled field's value. -func (s *AccessLog) SetEnabled(v bool) *AccessLog { - s.Enabled = &v - return s -} - -// SetS3BucketName sets the S3BucketName field's value. -func (s *AccessLog) SetS3BucketName(v string) *AccessLog { - s.S3BucketName = &v - return s -} - -// SetS3BucketPrefix sets the S3BucketPrefix field's value. -func (s *AccessLog) SetS3BucketPrefix(v string) *AccessLog { - s.S3BucketPrefix = &v - return s -} - -// Contains the parameters for AddTags. -type AddTagsInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. You can specify one load balancer only. - // - // LoadBalancerNames is a required field - LoadBalancerNames []*string `type:"list" required:"true"` - - // The tags. - // - // Tags is a required field - Tags []*Tag `min:"1" type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AddTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AddTagsInput"} - if s.LoadBalancerNames == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerNames")) - } - if s.Tags == nil { - invalidParams.Add(request.NewErrParamRequired("Tags")) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *AddTagsInput) SetLoadBalancerNames(v []*string) *AddTagsInput { - s.LoadBalancerNames = v - return s -} - -// SetTags sets the Tags field's value. -func (s *AddTagsInput) SetTags(v []*Tag) *AddTagsInput { - s.Tags = v - return s -} - -// Contains the output of AddTags. -type AddTagsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsOutput) GoString() string { - return s.String() -} - -// Information about additional load balancer attributes. -type AdditionalAttribute struct { - _ struct{} `type:"structure"` - - // The name of the attribute. - // - // The following attribute is supported. - // - // * elb.http.desyncmitigationmode - Determines how the load balancer handles - // requests that might pose a security risk to your application. The possible - // values are monitor, defensive, and strictest. The default is defensive. - Key *string `type:"string"` - - // This value of the attribute. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AdditionalAttribute) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AdditionalAttribute) GoString() string { - return s.String() -} - -// SetKey sets the Key field's value. -func (s *AdditionalAttribute) SetKey(v string) *AdditionalAttribute { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *AdditionalAttribute) SetValue(v string) *AdditionalAttribute { - s.Value = &v - return s -} - -// Information about a policy for application-controlled session stickiness. -type AppCookieStickinessPolicy struct { - _ struct{} `type:"structure"` - - // The name of the application cookie used for stickiness. - CookieName *string `type:"string"` - - // The mnemonic name for the policy being created. The name must be unique within - // a set of policies for this load balancer. - PolicyName *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AppCookieStickinessPolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AppCookieStickinessPolicy) GoString() string { - return s.String() -} - -// SetCookieName sets the CookieName field's value. -func (s *AppCookieStickinessPolicy) SetCookieName(v string) *AppCookieStickinessPolicy { - s.CookieName = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *AppCookieStickinessPolicy) SetPolicyName(v string) *AppCookieStickinessPolicy { - s.PolicyName = &v - return s -} - -// Contains the parameters for ApplySecurityGroupsToLoadBalancer. -type ApplySecurityGroupsToLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The IDs of the security groups to associate with the load balancer. Note - // that you cannot specify the name of the security group. - // - // SecurityGroups is a required field - SecurityGroups []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ApplySecurityGroupsToLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ApplySecurityGroupsToLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ApplySecurityGroupsToLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ApplySecurityGroupsToLoadBalancerInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.SecurityGroups == nil { - invalidParams.Add(request.NewErrParamRequired("SecurityGroups")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *ApplySecurityGroupsToLoadBalancerInput) SetLoadBalancerName(v string) *ApplySecurityGroupsToLoadBalancerInput { - s.LoadBalancerName = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *ApplySecurityGroupsToLoadBalancerInput) SetSecurityGroups(v []*string) *ApplySecurityGroupsToLoadBalancerInput { - s.SecurityGroups = v - return s -} - -// Contains the output of ApplySecurityGroupsToLoadBalancer. -type ApplySecurityGroupsToLoadBalancerOutput struct { - _ struct{} `type:"structure"` - - // The IDs of the security groups associated with the load balancer. - SecurityGroups []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ApplySecurityGroupsToLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ApplySecurityGroupsToLoadBalancerOutput) GoString() string { - return s.String() -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *ApplySecurityGroupsToLoadBalancerOutput) SetSecurityGroups(v []*string) *ApplySecurityGroupsToLoadBalancerOutput { - s.SecurityGroups = v - return s -} - -// Contains the parameters for AttachLoaBalancerToSubnets. -type AttachLoadBalancerToSubnetsInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The IDs of the subnets to add. You can add only one subnet per Availability - // Zone. - // - // Subnets is a required field - Subnets []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerToSubnetsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerToSubnetsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AttachLoadBalancerToSubnetsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AttachLoadBalancerToSubnetsInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.Subnets == nil { - invalidParams.Add(request.NewErrParamRequired("Subnets")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *AttachLoadBalancerToSubnetsInput) SetLoadBalancerName(v string) *AttachLoadBalancerToSubnetsInput { - s.LoadBalancerName = &v - return s -} - -// SetSubnets sets the Subnets field's value. -func (s *AttachLoadBalancerToSubnetsInput) SetSubnets(v []*string) *AttachLoadBalancerToSubnetsInput { - s.Subnets = v - return s -} - -// Contains the output of AttachLoadBalancerToSubnets. -type AttachLoadBalancerToSubnetsOutput struct { - _ struct{} `type:"structure"` - - // The IDs of the subnets attached to the load balancer. - Subnets []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerToSubnetsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AttachLoadBalancerToSubnetsOutput) GoString() string { - return s.String() -} - -// SetSubnets sets the Subnets field's value. -func (s *AttachLoadBalancerToSubnetsOutput) SetSubnets(v []*string) *AttachLoadBalancerToSubnetsOutput { - s.Subnets = v - return s -} - -// Information about the configuration of an EC2 instance. -type BackendServerDescription struct { - _ struct{} `type:"structure"` - - // The port on which the EC2 instance is listening. - InstancePort *int64 `min:"1" type:"integer"` - - // The names of the policies enabled for the EC2 instance. - PolicyNames []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BackendServerDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s BackendServerDescription) GoString() string { - return s.String() -} - -// SetInstancePort sets the InstancePort field's value. -func (s *BackendServerDescription) SetInstancePort(v int64) *BackendServerDescription { - s.InstancePort = &v - return s -} - -// SetPolicyNames sets the PolicyNames field's value. -func (s *BackendServerDescription) SetPolicyNames(v []*string) *BackendServerDescription { - s.PolicyNames = v - return s -} - -// Contains the parameters for ConfigureHealthCheck. -type ConfigureHealthCheckInput struct { - _ struct{} `type:"structure"` - - // The configuration information. - // - // HealthCheck is a required field - HealthCheck *HealthCheck `type:"structure" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConfigureHealthCheckInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConfigureHealthCheckInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ConfigureHealthCheckInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ConfigureHealthCheckInput"} - if s.HealthCheck == nil { - invalidParams.Add(request.NewErrParamRequired("HealthCheck")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.HealthCheck != nil { - if err := s.HealthCheck.Validate(); err != nil { - invalidParams.AddNested("HealthCheck", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHealthCheck sets the HealthCheck field's value. -func (s *ConfigureHealthCheckInput) SetHealthCheck(v *HealthCheck) *ConfigureHealthCheckInput { - s.HealthCheck = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *ConfigureHealthCheckInput) SetLoadBalancerName(v string) *ConfigureHealthCheckInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output of ConfigureHealthCheck. -type ConfigureHealthCheckOutput struct { - _ struct{} `type:"structure"` - - // The updated health check. - HealthCheck *HealthCheck `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConfigureHealthCheckOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConfigureHealthCheckOutput) GoString() string { - return s.String() -} - -// SetHealthCheck sets the HealthCheck field's value. -func (s *ConfigureHealthCheckOutput) SetHealthCheck(v *HealthCheck) *ConfigureHealthCheckOutput { - s.HealthCheck = v - return s -} - -// Information about the ConnectionDraining attribute. -type ConnectionDraining struct { - _ struct{} `type:"structure"` - - // Specifies whether connection draining is enabled for the load balancer. - // - // Enabled is a required field - Enabled *bool `type:"boolean" required:"true"` - - // The maximum time, in seconds, to keep the existing connections open before - // deregistering the instances. - Timeout *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectionDraining) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectionDraining) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ConnectionDraining) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ConnectionDraining"} - if s.Enabled == nil { - invalidParams.Add(request.NewErrParamRequired("Enabled")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEnabled sets the Enabled field's value. -func (s *ConnectionDraining) SetEnabled(v bool) *ConnectionDraining { - s.Enabled = &v - return s -} - -// SetTimeout sets the Timeout field's value. -func (s *ConnectionDraining) SetTimeout(v int64) *ConnectionDraining { - s.Timeout = &v - return s -} - -// Information about the ConnectionSettings attribute. -type ConnectionSettings struct { - _ struct{} `type:"structure"` - - // The time, in seconds, that the connection is allowed to be idle (no data - // has been sent over the connection) before it is closed by the load balancer. - // - // IdleTimeout is a required field - IdleTimeout *int64 `min:"1" type:"integer" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectionSettings) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectionSettings) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ConnectionSettings) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ConnectionSettings"} - if s.IdleTimeout == nil { - invalidParams.Add(request.NewErrParamRequired("IdleTimeout")) - } - if s.IdleTimeout != nil && *s.IdleTimeout < 1 { - invalidParams.Add(request.NewErrParamMinValue("IdleTimeout", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetIdleTimeout sets the IdleTimeout field's value. -func (s *ConnectionSettings) SetIdleTimeout(v int64) *ConnectionSettings { - s.IdleTimeout = &v - return s -} - -// Contains the parameters for CreateAppCookieStickinessPolicy. -type CreateAppCookieStickinessPolicyInput struct { - _ struct{} `type:"structure"` - - // The name of the application cookie used for stickiness. - // - // CookieName is a required field - CookieName *string `type:"string" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The name of the policy being created. Policy names must consist of alphanumeric - // characters and dashes (-). This name must be unique within the set of policies - // for this load balancer. - // - // PolicyName is a required field - PolicyName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAppCookieStickinessPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAppCookieStickinessPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateAppCookieStickinessPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateAppCookieStickinessPolicyInput"} - if s.CookieName == nil { - invalidParams.Add(request.NewErrParamRequired("CookieName")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCookieName sets the CookieName field's value. -func (s *CreateAppCookieStickinessPolicyInput) SetCookieName(v string) *CreateAppCookieStickinessPolicyInput { - s.CookieName = &v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *CreateAppCookieStickinessPolicyInput) SetLoadBalancerName(v string) *CreateAppCookieStickinessPolicyInput { - s.LoadBalancerName = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *CreateAppCookieStickinessPolicyInput) SetPolicyName(v string) *CreateAppCookieStickinessPolicyInput { - s.PolicyName = &v - return s -} - -// Contains the output for CreateAppCookieStickinessPolicy. -type CreateAppCookieStickinessPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAppCookieStickinessPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAppCookieStickinessPolicyOutput) GoString() string { - return s.String() -} - -// Contains the parameters for CreateLBCookieStickinessPolicy. -type CreateLBCookieStickinessPolicyInput struct { - _ struct{} `type:"structure"` - - // The time period, in seconds, after which the cookie should be considered - // stale. If you do not specify this parameter, the default value is 0, which - // indicates that the sticky session should last for the duration of the browser - // session. - CookieExpirationPeriod *int64 `type:"long"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The name of the policy being created. Policy names must consist of alphanumeric - // characters and dashes (-). This name must be unique within the set of policies - // for this load balancer. - // - // PolicyName is a required field - PolicyName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLBCookieStickinessPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLBCookieStickinessPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateLBCookieStickinessPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateLBCookieStickinessPolicyInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCookieExpirationPeriod sets the CookieExpirationPeriod field's value. -func (s *CreateLBCookieStickinessPolicyInput) SetCookieExpirationPeriod(v int64) *CreateLBCookieStickinessPolicyInput { - s.CookieExpirationPeriod = &v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *CreateLBCookieStickinessPolicyInput) SetLoadBalancerName(v string) *CreateLBCookieStickinessPolicyInput { - s.LoadBalancerName = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *CreateLBCookieStickinessPolicyInput) SetPolicyName(v string) *CreateLBCookieStickinessPolicyInput { - s.PolicyName = &v - return s -} - -// Contains the output for CreateLBCookieStickinessPolicy. -type CreateLBCookieStickinessPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLBCookieStickinessPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLBCookieStickinessPolicyOutput) GoString() string { - return s.String() -} - -// Contains the parameters for CreateLoadBalancer. -type CreateLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // One or more Availability Zones from the same region as the load balancer. - // - // You must specify at least one Availability Zone. - // - // You can add more Availability Zones after you create the load balancer using - // EnableAvailabilityZonesForLoadBalancer. - AvailabilityZones []*string `type:"list"` - - // The listeners. - // - // For more information, see Listeners for Your Classic Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-listener-config.html) - // in the Classic Load Balancers Guide. - // - // Listeners is a required field - Listeners []*Listener `type:"list" required:"true"` - - // The name of the load balancer. - // - // This name must be unique within your set of load balancers for the region, - // must have a maximum of 32 characters, must contain only alphanumeric characters - // or hyphens, and cannot begin or end with a hyphen. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The type of a load balancer. Valid only for load balancers in a VPC. - // - // By default, Elastic Load Balancing creates an Internet-facing load balancer - // with a DNS name that resolves to public IP addresses. For more information - // about Internet-facing and Internal load balancers, see Load Balancer Scheme - // (https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html#load-balancer-scheme) - // in the Elastic Load Balancing User Guide. - // - // Specify internal to create a load balancer with a DNS name that resolves - // to private IP addresses. - Scheme *string `type:"string"` - - // The IDs of the security groups to assign to the load balancer. - SecurityGroups []*string `type:"list"` - - // The IDs of the subnets in your VPC to attach to the load balancer. Specify - // one subnet per Availability Zone specified in AvailabilityZones. - Subnets []*string `type:"list"` - - // A list of tags to assign to the load balancer. - // - // For more information about tagging your load balancer, see Tag Your Classic - // Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/add-remove-tags.html) - // in the Classic Load Balancers Guide. - Tags []*Tag `min:"1" type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateLoadBalancerInput"} - if s.Listeners == nil { - invalidParams.Add(request.NewErrParamRequired("Listeners")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.Listeners != nil { - for i, v := range s.Listeners { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Listeners", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *CreateLoadBalancerInput) SetAvailabilityZones(v []*string) *CreateLoadBalancerInput { - s.AvailabilityZones = v - return s -} - -// SetListeners sets the Listeners field's value. -func (s *CreateLoadBalancerInput) SetListeners(v []*Listener) *CreateLoadBalancerInput { - s.Listeners = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *CreateLoadBalancerInput) SetLoadBalancerName(v string) *CreateLoadBalancerInput { - s.LoadBalancerName = &v - return s -} - -// SetScheme sets the Scheme field's value. -func (s *CreateLoadBalancerInput) SetScheme(v string) *CreateLoadBalancerInput { - s.Scheme = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *CreateLoadBalancerInput) SetSecurityGroups(v []*string) *CreateLoadBalancerInput { - s.SecurityGroups = v - return s -} - -// SetSubnets sets the Subnets field's value. -func (s *CreateLoadBalancerInput) SetSubnets(v []*string) *CreateLoadBalancerInput { - s.Subnets = v - return s -} - -// SetTags sets the Tags field's value. -func (s *CreateLoadBalancerInput) SetTags(v []*Tag) *CreateLoadBalancerInput { - s.Tags = v - return s -} - -// Contains the parameters for CreateLoadBalancerListeners. -type CreateLoadBalancerListenersInput struct { - _ struct{} `type:"structure"` - - // The listeners. - // - // Listeners is a required field - Listeners []*Listener `type:"list" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerListenersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerListenersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateLoadBalancerListenersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateLoadBalancerListenersInput"} - if s.Listeners == nil { - invalidParams.Add(request.NewErrParamRequired("Listeners")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.Listeners != nil { - for i, v := range s.Listeners { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Listeners", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetListeners sets the Listeners field's value. -func (s *CreateLoadBalancerListenersInput) SetListeners(v []*Listener) *CreateLoadBalancerListenersInput { - s.Listeners = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *CreateLoadBalancerListenersInput) SetLoadBalancerName(v string) *CreateLoadBalancerListenersInput { - s.LoadBalancerName = &v - return s -} - -// Contains the parameters for CreateLoadBalancerListener. -type CreateLoadBalancerListenersOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerListenersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerListenersOutput) GoString() string { - return s.String() -} - -// Contains the output for CreateLoadBalancer. -type CreateLoadBalancerOutput struct { - _ struct{} `type:"structure"` - - // The DNS name of the load balancer. - DNSName *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerOutput) GoString() string { - return s.String() -} - -// SetDNSName sets the DNSName field's value. -func (s *CreateLoadBalancerOutput) SetDNSName(v string) *CreateLoadBalancerOutput { - s.DNSName = &v - return s -} - -// Contains the parameters for CreateLoadBalancerPolicy. -type CreateLoadBalancerPolicyInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The policy attributes. - PolicyAttributes []*PolicyAttribute `type:"list"` - - // The name of the load balancer policy to be created. This name must be unique - // within the set of policies for this load balancer. - // - // PolicyName is a required field - PolicyName *string `type:"string" required:"true"` - - // The name of the base policy type. To get the list of policy types, use DescribeLoadBalancerPolicyTypes. - // - // PolicyTypeName is a required field - PolicyTypeName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateLoadBalancerPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateLoadBalancerPolicyInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - if s.PolicyTypeName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyTypeName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *CreateLoadBalancerPolicyInput) SetLoadBalancerName(v string) *CreateLoadBalancerPolicyInput { - s.LoadBalancerName = &v - return s -} - -// SetPolicyAttributes sets the PolicyAttributes field's value. -func (s *CreateLoadBalancerPolicyInput) SetPolicyAttributes(v []*PolicyAttribute) *CreateLoadBalancerPolicyInput { - s.PolicyAttributes = v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *CreateLoadBalancerPolicyInput) SetPolicyName(v string) *CreateLoadBalancerPolicyInput { - s.PolicyName = &v - return s -} - -// SetPolicyTypeName sets the PolicyTypeName field's value. -func (s *CreateLoadBalancerPolicyInput) SetPolicyTypeName(v string) *CreateLoadBalancerPolicyInput { - s.PolicyTypeName = &v - return s -} - -// Contains the output of CreateLoadBalancerPolicy. -type CreateLoadBalancerPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerPolicyOutput) GoString() string { - return s.String() -} - -// Information about the CrossZoneLoadBalancing attribute. -type CrossZoneLoadBalancing struct { - _ struct{} `type:"structure"` - - // Specifies whether cross-zone load balancing is enabled for the load balancer. - // - // Enabled is a required field - Enabled *bool `type:"boolean" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CrossZoneLoadBalancing) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CrossZoneLoadBalancing) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CrossZoneLoadBalancing) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CrossZoneLoadBalancing"} - if s.Enabled == nil { - invalidParams.Add(request.NewErrParamRequired("Enabled")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEnabled sets the Enabled field's value. -func (s *CrossZoneLoadBalancing) SetEnabled(v bool) *CrossZoneLoadBalancing { - s.Enabled = &v - return s -} - -// Contains the parameters for DeleteLoadBalancer. -type DeleteLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteLoadBalancerInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DeleteLoadBalancerInput) SetLoadBalancerName(v string) *DeleteLoadBalancerInput { - s.LoadBalancerName = &v - return s -} - -// Contains the parameters for DeleteLoadBalancerListeners. -type DeleteLoadBalancerListenersInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The client port numbers of the listeners. - // - // LoadBalancerPorts is a required field - LoadBalancerPorts []*int64 `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerListenersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerListenersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteLoadBalancerListenersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteLoadBalancerListenersInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.LoadBalancerPorts == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerPorts")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DeleteLoadBalancerListenersInput) SetLoadBalancerName(v string) *DeleteLoadBalancerListenersInput { - s.LoadBalancerName = &v - return s -} - -// SetLoadBalancerPorts sets the LoadBalancerPorts field's value. -func (s *DeleteLoadBalancerListenersInput) SetLoadBalancerPorts(v []*int64) *DeleteLoadBalancerListenersInput { - s.LoadBalancerPorts = v - return s -} - -// Contains the output of DeleteLoadBalancerListeners. -type DeleteLoadBalancerListenersOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerListenersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerListenersOutput) GoString() string { - return s.String() -} - -// Contains the output of DeleteLoadBalancer. -type DeleteLoadBalancerOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerOutput) GoString() string { - return s.String() -} - -// Contains the parameters for DeleteLoadBalancerPolicy. -type DeleteLoadBalancerPolicyInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The name of the policy. - // - // PolicyName is a required field - PolicyName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteLoadBalancerPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteLoadBalancerPolicyInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DeleteLoadBalancerPolicyInput) SetLoadBalancerName(v string) *DeleteLoadBalancerPolicyInput { - s.LoadBalancerName = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *DeleteLoadBalancerPolicyInput) SetPolicyName(v string) *DeleteLoadBalancerPolicyInput { - s.PolicyName = &v - return s -} - -// Contains the output of DeleteLoadBalancerPolicy. -type DeleteLoadBalancerPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerPolicyOutput) GoString() string { - return s.String() -} - -// Contains the parameters for DeregisterInstancesFromLoadBalancer. -type DeregisterInstancesFromLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // The IDs of the instances. - // - // Instances is a required field - Instances []*Instance `type:"list" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterInstancesFromLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterInstancesFromLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeregisterInstancesFromLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeregisterInstancesFromLoadBalancerInput"} - if s.Instances == nil { - invalidParams.Add(request.NewErrParamRequired("Instances")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstances sets the Instances field's value. -func (s *DeregisterInstancesFromLoadBalancerInput) SetInstances(v []*Instance) *DeregisterInstancesFromLoadBalancerInput { - s.Instances = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DeregisterInstancesFromLoadBalancerInput) SetLoadBalancerName(v string) *DeregisterInstancesFromLoadBalancerInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output of DeregisterInstancesFromLoadBalancer. -type DeregisterInstancesFromLoadBalancerOutput struct { - _ struct{} `type:"structure"` - - // The remaining instances registered with the load balancer. - Instances []*Instance `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterInstancesFromLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterInstancesFromLoadBalancerOutput) GoString() string { - return s.String() -} - -// SetInstances sets the Instances field's value. -func (s *DeregisterInstancesFromLoadBalancerOutput) SetInstances(v []*Instance) *DeregisterInstancesFromLoadBalancerOutput { - s.Instances = v - return s -} - -type DescribeAccountLimitsInput struct { - _ struct{} `type:"structure"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeAccountLimitsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeAccountLimitsInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMarker sets the Marker field's value. -func (s *DescribeAccountLimitsInput) SetMarker(v string) *DescribeAccountLimitsInput { - s.Marker = &v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeAccountLimitsInput) SetPageSize(v int64) *DescribeAccountLimitsInput { - s.PageSize = &v - return s -} - -type DescribeAccountLimitsOutput struct { - _ struct{} `type:"structure"` - - // Information about the limits. - Limits []*Limit `type:"list"` - - // The marker to use when requesting the next set of results. If there are no - // additional results, the string is empty. - NextMarker *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsOutput) GoString() string { - return s.String() -} - -// SetLimits sets the Limits field's value. -func (s *DescribeAccountLimitsOutput) SetLimits(v []*Limit) *DescribeAccountLimitsOutput { - s.Limits = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeAccountLimitsOutput) SetNextMarker(v string) *DescribeAccountLimitsOutput { - s.NextMarker = &v - return s -} - -// Contains the parameters for DescribeInstanceHealth. -type DescribeInstanceHealthInput struct { - _ struct{} `type:"structure"` - - // The IDs of the instances. - Instances []*Instance `type:"list"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceHealthInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceHealthInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeInstanceHealthInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeInstanceHealthInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstances sets the Instances field's value. -func (s *DescribeInstanceHealthInput) SetInstances(v []*Instance) *DescribeInstanceHealthInput { - s.Instances = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DescribeInstanceHealthInput) SetLoadBalancerName(v string) *DescribeInstanceHealthInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output for DescribeInstanceHealth. -type DescribeInstanceHealthOutput struct { - _ struct{} `type:"structure"` - - // Information about the health of the instances. - InstanceStates []*InstanceState `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceHealthOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeInstanceHealthOutput) GoString() string { - return s.String() -} - -// SetInstanceStates sets the InstanceStates field's value. -func (s *DescribeInstanceHealthOutput) SetInstanceStates(v []*InstanceState) *DescribeInstanceHealthOutput { - s.InstanceStates = v - return s -} - -// Contains the parameters for DescribeLoadBalancerAttributes. -type DescribeLoadBalancerAttributesInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeLoadBalancerAttributesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeLoadBalancerAttributesInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DescribeLoadBalancerAttributesInput) SetLoadBalancerName(v string) *DescribeLoadBalancerAttributesInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output of DescribeLoadBalancerAttributes. -type DescribeLoadBalancerAttributesOutput struct { - _ struct{} `type:"structure"` - - // Information about the load balancer attributes. - LoadBalancerAttributes *LoadBalancerAttributes `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesOutput) GoString() string { - return s.String() -} - -// SetLoadBalancerAttributes sets the LoadBalancerAttributes field's value. -func (s *DescribeLoadBalancerAttributesOutput) SetLoadBalancerAttributes(v *LoadBalancerAttributes) *DescribeLoadBalancerAttributesOutput { - s.LoadBalancerAttributes = v - return s -} - -// Contains the parameters for DescribeLoadBalancerPolicies. -type DescribeLoadBalancerPoliciesInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - LoadBalancerName *string `type:"string"` - - // The names of the policies. - PolicyNames []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPoliciesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPoliciesInput) GoString() string { - return s.String() -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DescribeLoadBalancerPoliciesInput) SetLoadBalancerName(v string) *DescribeLoadBalancerPoliciesInput { - s.LoadBalancerName = &v - return s -} - -// SetPolicyNames sets the PolicyNames field's value. -func (s *DescribeLoadBalancerPoliciesInput) SetPolicyNames(v []*string) *DescribeLoadBalancerPoliciesInput { - s.PolicyNames = v - return s -} - -// Contains the output of DescribeLoadBalancerPolicies. -type DescribeLoadBalancerPoliciesOutput struct { - _ struct{} `type:"structure"` - - // Information about the policies. - PolicyDescriptions []*PolicyDescription `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPoliciesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPoliciesOutput) GoString() string { - return s.String() -} - -// SetPolicyDescriptions sets the PolicyDescriptions field's value. -func (s *DescribeLoadBalancerPoliciesOutput) SetPolicyDescriptions(v []*PolicyDescription) *DescribeLoadBalancerPoliciesOutput { - s.PolicyDescriptions = v - return s -} - -// Contains the parameters for DescribeLoadBalancerPolicyTypes. -type DescribeLoadBalancerPolicyTypesInput struct { - _ struct{} `type:"structure"` - - // The names of the policy types. If no names are specified, describes all policy - // types defined by Elastic Load Balancing. - PolicyTypeNames []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPolicyTypesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPolicyTypesInput) GoString() string { - return s.String() -} - -// SetPolicyTypeNames sets the PolicyTypeNames field's value. -func (s *DescribeLoadBalancerPolicyTypesInput) SetPolicyTypeNames(v []*string) *DescribeLoadBalancerPolicyTypesInput { - s.PolicyTypeNames = v - return s -} - -// Contains the output of DescribeLoadBalancerPolicyTypes. -type DescribeLoadBalancerPolicyTypesOutput struct { - _ struct{} `type:"structure"` - - // Information about the policy types. - PolicyTypeDescriptions []*PolicyTypeDescription `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPolicyTypesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerPolicyTypesOutput) GoString() string { - return s.String() -} - -// SetPolicyTypeDescriptions sets the PolicyTypeDescriptions field's value. -func (s *DescribeLoadBalancerPolicyTypesOutput) SetPolicyTypeDescriptions(v []*PolicyTypeDescription) *DescribeLoadBalancerPolicyTypesOutput { - s.PolicyTypeDescriptions = v - return s -} - -// Contains the parameters for DescribeLoadBalancers. -type DescribeLoadBalancersInput struct { - _ struct{} `type:"structure"` - - // The names of the load balancers. - LoadBalancerNames []*string `type:"list"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The maximum number of results to return with this call (a number from 1 to - // 400). The default is 400. - PageSize *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeLoadBalancersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeLoadBalancersInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *DescribeLoadBalancersInput) SetLoadBalancerNames(v []*string) *DescribeLoadBalancersInput { - s.LoadBalancerNames = v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeLoadBalancersInput) SetMarker(v string) *DescribeLoadBalancersInput { - s.Marker = &v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeLoadBalancersInput) SetPageSize(v int64) *DescribeLoadBalancersInput { - s.PageSize = &v - return s -} - -// Contains the parameters for DescribeLoadBalancers. -type DescribeLoadBalancersOutput struct { - _ struct{} `type:"structure"` - - // Information about the load balancers. - LoadBalancerDescriptions []*LoadBalancerDescription `type:"list"` - - // The marker to use when requesting the next set of results. If there are no - // additional results, the string is empty. - NextMarker *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersOutput) GoString() string { - return s.String() -} - -// SetLoadBalancerDescriptions sets the LoadBalancerDescriptions field's value. -func (s *DescribeLoadBalancersOutput) SetLoadBalancerDescriptions(v []*LoadBalancerDescription) *DescribeLoadBalancersOutput { - s.LoadBalancerDescriptions = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeLoadBalancersOutput) SetNextMarker(v string) *DescribeLoadBalancersOutput { - s.NextMarker = &v - return s -} - -// Contains the parameters for DescribeTags. -type DescribeTagsInput struct { - _ struct{} `type:"structure"` - - // The names of the load balancers. - // - // LoadBalancerNames is a required field - LoadBalancerNames []*string `min:"1" type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeTagsInput"} - if s.LoadBalancerNames == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerNames")) - } - if s.LoadBalancerNames != nil && len(s.LoadBalancerNames) < 1 { - invalidParams.Add(request.NewErrParamMinLen("LoadBalancerNames", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *DescribeTagsInput) SetLoadBalancerNames(v []*string) *DescribeTagsInput { - s.LoadBalancerNames = v - return s -} - -// Contains the output for DescribeTags. -type DescribeTagsOutput struct { - _ struct{} `type:"structure"` - - // Information about the tags. - TagDescriptions []*TagDescription `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsOutput) GoString() string { - return s.String() -} - -// SetTagDescriptions sets the TagDescriptions field's value. -func (s *DescribeTagsOutput) SetTagDescriptions(v []*TagDescription) *DescribeTagsOutput { - s.TagDescriptions = v - return s -} - -// Contains the parameters for DetachLoadBalancerFromSubnets. -type DetachLoadBalancerFromSubnetsInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The IDs of the subnets. - // - // Subnets is a required field - Subnets []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerFromSubnetsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerFromSubnetsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DetachLoadBalancerFromSubnetsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DetachLoadBalancerFromSubnetsInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.Subnets == nil { - invalidParams.Add(request.NewErrParamRequired("Subnets")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DetachLoadBalancerFromSubnetsInput) SetLoadBalancerName(v string) *DetachLoadBalancerFromSubnetsInput { - s.LoadBalancerName = &v - return s -} - -// SetSubnets sets the Subnets field's value. -func (s *DetachLoadBalancerFromSubnetsInput) SetSubnets(v []*string) *DetachLoadBalancerFromSubnetsInput { - s.Subnets = v - return s -} - -// Contains the output of DetachLoadBalancerFromSubnets. -type DetachLoadBalancerFromSubnetsOutput struct { - _ struct{} `type:"structure"` - - // The IDs of the remaining subnets for the load balancer. - Subnets []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerFromSubnetsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DetachLoadBalancerFromSubnetsOutput) GoString() string { - return s.String() -} - -// SetSubnets sets the Subnets field's value. -func (s *DetachLoadBalancerFromSubnetsOutput) SetSubnets(v []*string) *DetachLoadBalancerFromSubnetsOutput { - s.Subnets = v - return s -} - -// Contains the parameters for DisableAvailabilityZonesForLoadBalancer. -type DisableAvailabilityZonesForLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // The Availability Zones. - // - // AvailabilityZones is a required field - AvailabilityZones []*string `type:"list" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableAvailabilityZonesForLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableAvailabilityZonesForLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DisableAvailabilityZonesForLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DisableAvailabilityZonesForLoadBalancerInput"} - if s.AvailabilityZones == nil { - invalidParams.Add(request.NewErrParamRequired("AvailabilityZones")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *DisableAvailabilityZonesForLoadBalancerInput) SetAvailabilityZones(v []*string) *DisableAvailabilityZonesForLoadBalancerInput { - s.AvailabilityZones = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *DisableAvailabilityZonesForLoadBalancerInput) SetLoadBalancerName(v string) *DisableAvailabilityZonesForLoadBalancerInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output for DisableAvailabilityZonesForLoadBalancer. -type DisableAvailabilityZonesForLoadBalancerOutput struct { - _ struct{} `type:"structure"` - - // The remaining Availability Zones for the load balancer. - AvailabilityZones []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableAvailabilityZonesForLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableAvailabilityZonesForLoadBalancerOutput) GoString() string { - return s.String() -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *DisableAvailabilityZonesForLoadBalancerOutput) SetAvailabilityZones(v []*string) *DisableAvailabilityZonesForLoadBalancerOutput { - s.AvailabilityZones = v - return s -} - -// Contains the parameters for EnableAvailabilityZonesForLoadBalancer. -type EnableAvailabilityZonesForLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // The Availability Zones. These must be in the same region as the load balancer. - // - // AvailabilityZones is a required field - AvailabilityZones []*string `type:"list" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableAvailabilityZonesForLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableAvailabilityZonesForLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *EnableAvailabilityZonesForLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EnableAvailabilityZonesForLoadBalancerInput"} - if s.AvailabilityZones == nil { - invalidParams.Add(request.NewErrParamRequired("AvailabilityZones")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *EnableAvailabilityZonesForLoadBalancerInput) SetAvailabilityZones(v []*string) *EnableAvailabilityZonesForLoadBalancerInput { - s.AvailabilityZones = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *EnableAvailabilityZonesForLoadBalancerInput) SetLoadBalancerName(v string) *EnableAvailabilityZonesForLoadBalancerInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output of EnableAvailabilityZonesForLoadBalancer. -type EnableAvailabilityZonesForLoadBalancerOutput struct { - _ struct{} `type:"structure"` - - // The updated list of Availability Zones for the load balancer. - AvailabilityZones []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableAvailabilityZonesForLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableAvailabilityZonesForLoadBalancerOutput) GoString() string { - return s.String() -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *EnableAvailabilityZonesForLoadBalancerOutput) SetAvailabilityZones(v []*string) *EnableAvailabilityZonesForLoadBalancerOutput { - s.AvailabilityZones = v - return s -} - -// Information about a health check. -type HealthCheck struct { - _ struct{} `type:"structure"` - - // The number of consecutive health checks successes required before moving - // the instance to the Healthy state. - // - // HealthyThreshold is a required field - HealthyThreshold *int64 `min:"2" type:"integer" required:"true"` - - // The approximate interval, in seconds, between health checks of an individual - // instance. - // - // Interval is a required field - Interval *int64 `min:"5" type:"integer" required:"true"` - - // The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. - // The range of valid ports is one (1) through 65535. - // - // TCP is the default, specified as a TCP: port pair, for example "TCP:5000". - // In this case, a health check simply attempts to open a TCP connection to - // the instance on the specified port. Failure to connect within the configured - // timeout is considered unhealthy. - // - // SSL is also specified as SSL: port pair, for example, SSL:5000. - // - // For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified - // as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". - // In this case, a HTTP GET request is issued to the instance on the given port - // and path. Any answer other than "200 OK" within the timeout period is considered - // unhealthy. - // - // The total length of the HTTP ping target must be 1024 16-bit Unicode characters - // or less. - // - // Target is a required field - Target *string `type:"string" required:"true"` - - // The amount of time, in seconds, during which no response means a failed health - // check. - // - // This value must be less than the Interval value. - // - // Timeout is a required field - Timeout *int64 `min:"2" type:"integer" required:"true"` - - // The number of consecutive health check failures required before moving the - // instance to the Unhealthy state. - // - // UnhealthyThreshold is a required field - UnhealthyThreshold *int64 `min:"2" type:"integer" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HealthCheck) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HealthCheck) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *HealthCheck) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "HealthCheck"} - if s.HealthyThreshold == nil { - invalidParams.Add(request.NewErrParamRequired("HealthyThreshold")) - } - if s.HealthyThreshold != nil && *s.HealthyThreshold < 2 { - invalidParams.Add(request.NewErrParamMinValue("HealthyThreshold", 2)) - } - if s.Interval == nil { - invalidParams.Add(request.NewErrParamRequired("Interval")) - } - if s.Interval != nil && *s.Interval < 5 { - invalidParams.Add(request.NewErrParamMinValue("Interval", 5)) - } - if s.Target == nil { - invalidParams.Add(request.NewErrParamRequired("Target")) - } - if s.Timeout == nil { - invalidParams.Add(request.NewErrParamRequired("Timeout")) - } - if s.Timeout != nil && *s.Timeout < 2 { - invalidParams.Add(request.NewErrParamMinValue("Timeout", 2)) - } - if s.UnhealthyThreshold == nil { - invalidParams.Add(request.NewErrParamRequired("UnhealthyThreshold")) - } - if s.UnhealthyThreshold != nil && *s.UnhealthyThreshold < 2 { - invalidParams.Add(request.NewErrParamMinValue("UnhealthyThreshold", 2)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHealthyThreshold sets the HealthyThreshold field's value. -func (s *HealthCheck) SetHealthyThreshold(v int64) *HealthCheck { - s.HealthyThreshold = &v - return s -} - -// SetInterval sets the Interval field's value. -func (s *HealthCheck) SetInterval(v int64) *HealthCheck { - s.Interval = &v - return s -} - -// SetTarget sets the Target field's value. -func (s *HealthCheck) SetTarget(v string) *HealthCheck { - s.Target = &v - return s -} - -// SetTimeout sets the Timeout field's value. -func (s *HealthCheck) SetTimeout(v int64) *HealthCheck { - s.Timeout = &v - return s -} - -// SetUnhealthyThreshold sets the UnhealthyThreshold field's value. -func (s *HealthCheck) SetUnhealthyThreshold(v int64) *HealthCheck { - s.UnhealthyThreshold = &v - return s -} - -// The ID of an EC2 instance. -type Instance struct { - _ struct{} `type:"structure"` - - // The instance ID. - InstanceId *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Instance) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Instance) GoString() string { - return s.String() -} - -// SetInstanceId sets the InstanceId field's value. -func (s *Instance) SetInstanceId(v string) *Instance { - s.InstanceId = &v - return s -} - -// Information about the state of an EC2 instance. -type InstanceState struct { - _ struct{} `type:"structure"` - - // A description of the instance state. This string can contain one or more - // of the following messages. - // - // * N/A - // - // * A transient error occurred. Please try again later. - // - // * Instance has failed at least the UnhealthyThreshold number of health - // checks consecutively. - // - // * Instance has not passed the configured HealthyThreshold number of health - // checks consecutively. - // - // * Instance registration is still in progress. - // - // * Instance is in the EC2 Availability Zone for which LoadBalancer is not - // configured to route traffic to. - // - // * Instance is not currently registered with the LoadBalancer. - // - // * Instance deregistration currently in progress. - // - // * Disable Availability Zone is currently in progress. - // - // * Instance is in pending state. - // - // * Instance is in stopped state. - // - // * Instance is in terminated state. - Description *string `type:"string"` - - // The ID of the instance. - InstanceId *string `type:"string"` - - // Information about the cause of OutOfService instances. Specifically, whether - // the cause is Elastic Load Balancing or the instance. - // - // Valid values: ELB | Instance | N/A - ReasonCode *string `type:"string"` - - // The current state of the instance. - // - // Valid values: InService | OutOfService | Unknown - State *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceState) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InstanceState) GoString() string { - return s.String() -} - -// SetDescription sets the Description field's value. -func (s *InstanceState) SetDescription(v string) *InstanceState { - s.Description = &v - return s -} - -// SetInstanceId sets the InstanceId field's value. -func (s *InstanceState) SetInstanceId(v string) *InstanceState { - s.InstanceId = &v - return s -} - -// SetReasonCode sets the ReasonCode field's value. -func (s *InstanceState) SetReasonCode(v string) *InstanceState { - s.ReasonCode = &v - return s -} - -// SetState sets the State field's value. -func (s *InstanceState) SetState(v string) *InstanceState { - s.State = &v - return s -} - -// Information about a policy for duration-based session stickiness. -type LBCookieStickinessPolicy struct { - _ struct{} `type:"structure"` - - // The time period, in seconds, after which the cookie should be considered - // stale. If this parameter is not specified, the stickiness session lasts for - // the duration of the browser session. - CookieExpirationPeriod *int64 `type:"long"` - - // The name of the policy. This name must be unique within the set of policies - // for this load balancer. - PolicyName *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LBCookieStickinessPolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LBCookieStickinessPolicy) GoString() string { - return s.String() -} - -// SetCookieExpirationPeriod sets the CookieExpirationPeriod field's value. -func (s *LBCookieStickinessPolicy) SetCookieExpirationPeriod(v int64) *LBCookieStickinessPolicy { - s.CookieExpirationPeriod = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *LBCookieStickinessPolicy) SetPolicyName(v string) *LBCookieStickinessPolicy { - s.PolicyName = &v - return s -} - -// Information about an Elastic Load Balancing resource limit for your AWS account. -type Limit struct { - _ struct{} `type:"structure"` - - // The maximum value of the limit. - Max *string `type:"string"` - - // The name of the limit. The possible values are: - // - // * classic-listeners - // - // * classic-load-balancers - // - // * classic-registered-instances - Name *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Limit) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Limit) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *Limit) SetMax(v string) *Limit { - s.Max = &v - return s -} - -// SetName sets the Name field's value. -func (s *Limit) SetName(v string) *Limit { - s.Name = &v - return s -} - -// Information about a listener. -// -// For information about the protocols and the ports supported by Elastic Load -// Balancing, see Listeners for Your Classic Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-listener-config.html) -// in the Classic Load Balancers Guide. -type Listener struct { - _ struct{} `type:"structure"` - - // The port on which the instance is listening. - // - // InstancePort is a required field - InstancePort *int64 `min:"1" type:"integer" required:"true"` - - // The protocol to use for routing traffic to instances: HTTP, HTTPS, TCP, or - // SSL. - // - // If the front-end protocol is TCP or SSL, the back-end protocol must be TCP - // or SSL. If the front-end protocol is HTTP or HTTPS, the back-end protocol - // must be HTTP or HTTPS. - // - // If there is another listener with the same InstancePort whose InstanceProtocol - // is secure, (HTTPS or SSL), the listener's InstanceProtocol must also be secure. - // - // If there is another listener with the same InstancePort whose InstanceProtocol - // is HTTP or TCP, the listener's InstanceProtocol must be HTTP or TCP. - InstanceProtocol *string `type:"string"` - - // The port on which the load balancer is listening. On EC2-VPC, you can specify - // any port from the range 1-65535. On EC2-Classic, you can specify any port - // from the following list: 25, 80, 443, 465, 587, 1024-65535. - // - // LoadBalancerPort is a required field - LoadBalancerPort *int64 `type:"integer" required:"true"` - - // The load balancer transport protocol to use for routing: HTTP, HTTPS, TCP, - // or SSL. - // - // Protocol is a required field - Protocol *string `type:"string" required:"true"` - - // The Amazon Resource Name (ARN) of the server certificate. - SSLCertificateId *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Listener) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Listener) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Listener) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Listener"} - if s.InstancePort == nil { - invalidParams.Add(request.NewErrParamRequired("InstancePort")) - } - if s.InstancePort != nil && *s.InstancePort < 1 { - invalidParams.Add(request.NewErrParamMinValue("InstancePort", 1)) - } - if s.LoadBalancerPort == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerPort")) - } - if s.Protocol == nil { - invalidParams.Add(request.NewErrParamRequired("Protocol")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstancePort sets the InstancePort field's value. -func (s *Listener) SetInstancePort(v int64) *Listener { - s.InstancePort = &v - return s -} - -// SetInstanceProtocol sets the InstanceProtocol field's value. -func (s *Listener) SetInstanceProtocol(v string) *Listener { - s.InstanceProtocol = &v - return s -} - -// SetLoadBalancerPort sets the LoadBalancerPort field's value. -func (s *Listener) SetLoadBalancerPort(v int64) *Listener { - s.LoadBalancerPort = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *Listener) SetProtocol(v string) *Listener { - s.Protocol = &v - return s -} - -// SetSSLCertificateId sets the SSLCertificateId field's value. -func (s *Listener) SetSSLCertificateId(v string) *Listener { - s.SSLCertificateId = &v - return s -} - -// The policies enabled for a listener. -type ListenerDescription struct { - _ struct{} `type:"structure"` - - // The listener. - Listener *Listener `type:"structure"` - - // The policies. If there are no policies enabled, the list is empty. - PolicyNames []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListenerDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListenerDescription) GoString() string { - return s.String() -} - -// SetListener sets the Listener field's value. -func (s *ListenerDescription) SetListener(v *Listener) *ListenerDescription { - s.Listener = v - return s -} - -// SetPolicyNames sets the PolicyNames field's value. -func (s *ListenerDescription) SetPolicyNames(v []*string) *ListenerDescription { - s.PolicyNames = v - return s -} - -// The attributes for a load balancer. -type LoadBalancerAttributes struct { - _ struct{} `type:"structure"` - - // If enabled, the load balancer captures detailed information of all requests - // and delivers the information to the Amazon S3 bucket that you specify. - // - // For more information, see Enable Access Logs (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html) - // in the Classic Load Balancers Guide. - AccessLog *AccessLog `type:"structure"` - - // Any additional attributes. - AdditionalAttributes []*AdditionalAttribute `type:"list"` - - // If enabled, the load balancer allows existing requests to complete before - // the load balancer shifts traffic away from a deregistered or unhealthy instance. - // - // For more information, see Configure Connection Draining (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-conn-drain.html) - // in the Classic Load Balancers Guide. - ConnectionDraining *ConnectionDraining `type:"structure"` - - // If enabled, the load balancer allows the connections to remain idle (no data - // is sent over the connection) for the specified duration. - // - // By default, Elastic Load Balancing maintains a 60-second idle connection - // timeout for both front-end and back-end connections of your load balancer. - // For more information, see Configure Idle Connection Timeout (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html) - // in the Classic Load Balancers Guide. - ConnectionSettings *ConnectionSettings `type:"structure"` - - // If enabled, the load balancer routes the request traffic evenly across all - // instances regardless of the Availability Zones. - // - // For more information, see Configure Cross-Zone Load Balancing (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-disable-crosszone-lb.html) - // in the Classic Load Balancers Guide. - CrossZoneLoadBalancing *CrossZoneLoadBalancing `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerAttributes) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerAttributes) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LoadBalancerAttributes) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LoadBalancerAttributes"} - if s.AccessLog != nil { - if err := s.AccessLog.Validate(); err != nil { - invalidParams.AddNested("AccessLog", err.(request.ErrInvalidParams)) - } - } - if s.ConnectionDraining != nil { - if err := s.ConnectionDraining.Validate(); err != nil { - invalidParams.AddNested("ConnectionDraining", err.(request.ErrInvalidParams)) - } - } - if s.ConnectionSettings != nil { - if err := s.ConnectionSettings.Validate(); err != nil { - invalidParams.AddNested("ConnectionSettings", err.(request.ErrInvalidParams)) - } - } - if s.CrossZoneLoadBalancing != nil { - if err := s.CrossZoneLoadBalancing.Validate(); err != nil { - invalidParams.AddNested("CrossZoneLoadBalancing", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccessLog sets the AccessLog field's value. -func (s *LoadBalancerAttributes) SetAccessLog(v *AccessLog) *LoadBalancerAttributes { - s.AccessLog = v - return s -} - -// SetAdditionalAttributes sets the AdditionalAttributes field's value. -func (s *LoadBalancerAttributes) SetAdditionalAttributes(v []*AdditionalAttribute) *LoadBalancerAttributes { - s.AdditionalAttributes = v - return s -} - -// SetConnectionDraining sets the ConnectionDraining field's value. -func (s *LoadBalancerAttributes) SetConnectionDraining(v *ConnectionDraining) *LoadBalancerAttributes { - s.ConnectionDraining = v - return s -} - -// SetConnectionSettings sets the ConnectionSettings field's value. -func (s *LoadBalancerAttributes) SetConnectionSettings(v *ConnectionSettings) *LoadBalancerAttributes { - s.ConnectionSettings = v - return s -} - -// SetCrossZoneLoadBalancing sets the CrossZoneLoadBalancing field's value. -func (s *LoadBalancerAttributes) SetCrossZoneLoadBalancing(v *CrossZoneLoadBalancing) *LoadBalancerAttributes { - s.CrossZoneLoadBalancing = v - return s -} - -// Information about a load balancer. -type LoadBalancerDescription struct { - _ struct{} `type:"structure"` - - // The Availability Zones for the load balancer. - AvailabilityZones []*string `type:"list"` - - // Information about your EC2 instances. - BackendServerDescriptions []*BackendServerDescription `type:"list"` - - // The DNS name of the load balancer. - // - // For more information, see Configure a Custom Domain Name (https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/using-domain-names-with-elb.html) - // in the Classic Load Balancers Guide. - CanonicalHostedZoneName *string `type:"string"` - - // The ID of the Amazon Route 53 hosted zone for the load balancer. - CanonicalHostedZoneNameID *string `type:"string"` - - // The date and time the load balancer was created. - CreatedTime *time.Time `type:"timestamp"` - - // The DNS name of the load balancer. - DNSName *string `type:"string"` - - // Information about the health checks conducted on the load balancer. - HealthCheck *HealthCheck `type:"structure"` - - // The IDs of the instances for the load balancer. - Instances []*Instance `type:"list"` - - // The listeners for the load balancer. - ListenerDescriptions []*ListenerDescription `type:"list"` - - // The name of the load balancer. - LoadBalancerName *string `type:"string"` - - // The policies defined for the load balancer. - Policies *Policies `type:"structure"` - - // The type of load balancer. Valid only for load balancers in a VPC. - // - // If Scheme is internet-facing, the load balancer has a public DNS name that - // resolves to a public IP address. - // - // If Scheme is internal, the load balancer has a public DNS name that resolves - // to a private IP address. - Scheme *string `type:"string"` - - // The security groups for the load balancer. Valid only for load balancers - // in a VPC. - SecurityGroups []*string `type:"list"` - - // The security group for the load balancer, which you can use as part of your - // inbound rules for your registered instances. To only allow traffic from load - // balancers, add a security group rule that specifies this source security - // group as the inbound source. - SourceSecurityGroup *SourceSecurityGroup `type:"structure"` - - // The IDs of the subnets for the load balancer. - Subnets []*string `type:"list"` - - // The ID of the VPC for the load balancer. - VPCId *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerDescription) GoString() string { - return s.String() -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *LoadBalancerDescription) SetAvailabilityZones(v []*string) *LoadBalancerDescription { - s.AvailabilityZones = v - return s -} - -// SetBackendServerDescriptions sets the BackendServerDescriptions field's value. -func (s *LoadBalancerDescription) SetBackendServerDescriptions(v []*BackendServerDescription) *LoadBalancerDescription { - s.BackendServerDescriptions = v - return s -} - -// SetCanonicalHostedZoneName sets the CanonicalHostedZoneName field's value. -func (s *LoadBalancerDescription) SetCanonicalHostedZoneName(v string) *LoadBalancerDescription { - s.CanonicalHostedZoneName = &v - return s -} - -// SetCanonicalHostedZoneNameID sets the CanonicalHostedZoneNameID field's value. -func (s *LoadBalancerDescription) SetCanonicalHostedZoneNameID(v string) *LoadBalancerDescription { - s.CanonicalHostedZoneNameID = &v - return s -} - -// SetCreatedTime sets the CreatedTime field's value. -func (s *LoadBalancerDescription) SetCreatedTime(v time.Time) *LoadBalancerDescription { - s.CreatedTime = &v - return s -} - -// SetDNSName sets the DNSName field's value. -func (s *LoadBalancerDescription) SetDNSName(v string) *LoadBalancerDescription { - s.DNSName = &v - return s -} - -// SetHealthCheck sets the HealthCheck field's value. -func (s *LoadBalancerDescription) SetHealthCheck(v *HealthCheck) *LoadBalancerDescription { - s.HealthCheck = v - return s -} - -// SetInstances sets the Instances field's value. -func (s *LoadBalancerDescription) SetInstances(v []*Instance) *LoadBalancerDescription { - s.Instances = v - return s -} - -// SetListenerDescriptions sets the ListenerDescriptions field's value. -func (s *LoadBalancerDescription) SetListenerDescriptions(v []*ListenerDescription) *LoadBalancerDescription { - s.ListenerDescriptions = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *LoadBalancerDescription) SetLoadBalancerName(v string) *LoadBalancerDescription { - s.LoadBalancerName = &v - return s -} - -// SetPolicies sets the Policies field's value. -func (s *LoadBalancerDescription) SetPolicies(v *Policies) *LoadBalancerDescription { - s.Policies = v - return s -} - -// SetScheme sets the Scheme field's value. -func (s *LoadBalancerDescription) SetScheme(v string) *LoadBalancerDescription { - s.Scheme = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *LoadBalancerDescription) SetSecurityGroups(v []*string) *LoadBalancerDescription { - s.SecurityGroups = v - return s -} - -// SetSourceSecurityGroup sets the SourceSecurityGroup field's value. -func (s *LoadBalancerDescription) SetSourceSecurityGroup(v *SourceSecurityGroup) *LoadBalancerDescription { - s.SourceSecurityGroup = v - return s -} - -// SetSubnets sets the Subnets field's value. -func (s *LoadBalancerDescription) SetSubnets(v []*string) *LoadBalancerDescription { - s.Subnets = v - return s -} - -// SetVPCId sets the VPCId field's value. -func (s *LoadBalancerDescription) SetVPCId(v string) *LoadBalancerDescription { - s.VPCId = &v - return s -} - -// Contains the parameters for ModifyLoadBalancerAttributes. -type ModifyLoadBalancerAttributesInput struct { - _ struct{} `type:"structure"` - - // The attributes for the load balancer. - // - // LoadBalancerAttributes is a required field - LoadBalancerAttributes *LoadBalancerAttributes `type:"structure" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ModifyLoadBalancerAttributesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ModifyLoadBalancerAttributesInput"} - if s.LoadBalancerAttributes == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerAttributes")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.LoadBalancerAttributes != nil { - if err := s.LoadBalancerAttributes.Validate(); err != nil { - invalidParams.AddNested("LoadBalancerAttributes", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerAttributes sets the LoadBalancerAttributes field's value. -func (s *ModifyLoadBalancerAttributesInput) SetLoadBalancerAttributes(v *LoadBalancerAttributes) *ModifyLoadBalancerAttributesInput { - s.LoadBalancerAttributes = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *ModifyLoadBalancerAttributesInput) SetLoadBalancerName(v string) *ModifyLoadBalancerAttributesInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output of ModifyLoadBalancerAttributes. -type ModifyLoadBalancerAttributesOutput struct { - _ struct{} `type:"structure"` - - // Information about the load balancer attributes. - LoadBalancerAttributes *LoadBalancerAttributes `type:"structure"` - - // The name of the load balancer. - LoadBalancerName *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesOutput) GoString() string { - return s.String() -} - -// SetLoadBalancerAttributes sets the LoadBalancerAttributes field's value. -func (s *ModifyLoadBalancerAttributesOutput) SetLoadBalancerAttributes(v *LoadBalancerAttributes) *ModifyLoadBalancerAttributesOutput { - s.LoadBalancerAttributes = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *ModifyLoadBalancerAttributesOutput) SetLoadBalancerName(v string) *ModifyLoadBalancerAttributesOutput { - s.LoadBalancerName = &v - return s -} - -// The policies for a load balancer. -type Policies struct { - _ struct{} `type:"structure"` - - // The stickiness policies created using CreateAppCookieStickinessPolicy. - AppCookieStickinessPolicies []*AppCookieStickinessPolicy `type:"list"` - - // The stickiness policies created using CreateLBCookieStickinessPolicy. - LBCookieStickinessPolicies []*LBCookieStickinessPolicy `type:"list"` - - // The policies other than the stickiness policies. - OtherPolicies []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Policies) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Policies) GoString() string { - return s.String() -} - -// SetAppCookieStickinessPolicies sets the AppCookieStickinessPolicies field's value. -func (s *Policies) SetAppCookieStickinessPolicies(v []*AppCookieStickinessPolicy) *Policies { - s.AppCookieStickinessPolicies = v - return s -} - -// SetLBCookieStickinessPolicies sets the LBCookieStickinessPolicies field's value. -func (s *Policies) SetLBCookieStickinessPolicies(v []*LBCookieStickinessPolicy) *Policies { - s.LBCookieStickinessPolicies = v - return s -} - -// SetOtherPolicies sets the OtherPolicies field's value. -func (s *Policies) SetOtherPolicies(v []*string) *Policies { - s.OtherPolicies = v - return s -} - -// Information about a policy attribute. -type PolicyAttribute struct { - _ struct{} `type:"structure"` - - // The name of the attribute. - AttributeName *string `type:"string"` - - // The value of the attribute. - AttributeValue *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyAttribute) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyAttribute) GoString() string { - return s.String() -} - -// SetAttributeName sets the AttributeName field's value. -func (s *PolicyAttribute) SetAttributeName(v string) *PolicyAttribute { - s.AttributeName = &v - return s -} - -// SetAttributeValue sets the AttributeValue field's value. -func (s *PolicyAttribute) SetAttributeValue(v string) *PolicyAttribute { - s.AttributeValue = &v - return s -} - -// Information about a policy attribute. -type PolicyAttributeDescription struct { - _ struct{} `type:"structure"` - - // The name of the attribute. - AttributeName *string `type:"string"` - - // The value of the attribute. - AttributeValue *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyAttributeDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyAttributeDescription) GoString() string { - return s.String() -} - -// SetAttributeName sets the AttributeName field's value. -func (s *PolicyAttributeDescription) SetAttributeName(v string) *PolicyAttributeDescription { - s.AttributeName = &v - return s -} - -// SetAttributeValue sets the AttributeValue field's value. -func (s *PolicyAttributeDescription) SetAttributeValue(v string) *PolicyAttributeDescription { - s.AttributeValue = &v - return s -} - -// Information about a policy attribute type. -type PolicyAttributeTypeDescription struct { - _ struct{} `type:"structure"` - - // The name of the attribute. - AttributeName *string `type:"string"` - - // The type of the attribute. For example, Boolean or Integer. - AttributeType *string `type:"string"` - - // The cardinality of the attribute. - // - // Valid values: - // - // * ONE(1) : Single value required - // - // * ZERO_OR_ONE(0..1) : Up to one value is allowed - // - // * ZERO_OR_MORE(0..*) : Optional. Multiple values are allowed - // - // * ONE_OR_MORE(1..*0) : Required. Multiple values are allowed - Cardinality *string `type:"string"` - - // The default value of the attribute, if applicable. - DefaultValue *string `type:"string"` - - // A description of the attribute. - Description *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyAttributeTypeDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyAttributeTypeDescription) GoString() string { - return s.String() -} - -// SetAttributeName sets the AttributeName field's value. -func (s *PolicyAttributeTypeDescription) SetAttributeName(v string) *PolicyAttributeTypeDescription { - s.AttributeName = &v - return s -} - -// SetAttributeType sets the AttributeType field's value. -func (s *PolicyAttributeTypeDescription) SetAttributeType(v string) *PolicyAttributeTypeDescription { - s.AttributeType = &v - return s -} - -// SetCardinality sets the Cardinality field's value. -func (s *PolicyAttributeTypeDescription) SetCardinality(v string) *PolicyAttributeTypeDescription { - s.Cardinality = &v - return s -} - -// SetDefaultValue sets the DefaultValue field's value. -func (s *PolicyAttributeTypeDescription) SetDefaultValue(v string) *PolicyAttributeTypeDescription { - s.DefaultValue = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *PolicyAttributeTypeDescription) SetDescription(v string) *PolicyAttributeTypeDescription { - s.Description = &v - return s -} - -// Information about a policy. -type PolicyDescription struct { - _ struct{} `type:"structure"` - - // The policy attributes. - PolicyAttributeDescriptions []*PolicyAttributeDescription `type:"list"` - - // The name of the policy. - PolicyName *string `type:"string"` - - // The name of the policy type. - PolicyTypeName *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyDescription) GoString() string { - return s.String() -} - -// SetPolicyAttributeDescriptions sets the PolicyAttributeDescriptions field's value. -func (s *PolicyDescription) SetPolicyAttributeDescriptions(v []*PolicyAttributeDescription) *PolicyDescription { - s.PolicyAttributeDescriptions = v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *PolicyDescription) SetPolicyName(v string) *PolicyDescription { - s.PolicyName = &v - return s -} - -// SetPolicyTypeName sets the PolicyTypeName field's value. -func (s *PolicyDescription) SetPolicyTypeName(v string) *PolicyDescription { - s.PolicyTypeName = &v - return s -} - -// Information about a policy type. -type PolicyTypeDescription struct { - _ struct{} `type:"structure"` - - // A description of the policy type. - Description *string `type:"string"` - - // The description of the policy attributes associated with the policies defined - // by Elastic Load Balancing. - PolicyAttributeTypeDescriptions []*PolicyAttributeTypeDescription `type:"list"` - - // The name of the policy type. - PolicyTypeName *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyTypeDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PolicyTypeDescription) GoString() string { - return s.String() -} - -// SetDescription sets the Description field's value. -func (s *PolicyTypeDescription) SetDescription(v string) *PolicyTypeDescription { - s.Description = &v - return s -} - -// SetPolicyAttributeTypeDescriptions sets the PolicyAttributeTypeDescriptions field's value. -func (s *PolicyTypeDescription) SetPolicyAttributeTypeDescriptions(v []*PolicyAttributeTypeDescription) *PolicyTypeDescription { - s.PolicyAttributeTypeDescriptions = v - return s -} - -// SetPolicyTypeName sets the PolicyTypeName field's value. -func (s *PolicyTypeDescription) SetPolicyTypeName(v string) *PolicyTypeDescription { - s.PolicyTypeName = &v - return s -} - -// Contains the parameters for RegisterInstancesWithLoadBalancer. -type RegisterInstancesWithLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // The IDs of the instances. - // - // Instances is a required field - Instances []*Instance `type:"list" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterInstancesWithLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterInstancesWithLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RegisterInstancesWithLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RegisterInstancesWithLoadBalancerInput"} - if s.Instances == nil { - invalidParams.Add(request.NewErrParamRequired("Instances")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstances sets the Instances field's value. -func (s *RegisterInstancesWithLoadBalancerInput) SetInstances(v []*Instance) *RegisterInstancesWithLoadBalancerInput { - s.Instances = v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *RegisterInstancesWithLoadBalancerInput) SetLoadBalancerName(v string) *RegisterInstancesWithLoadBalancerInput { - s.LoadBalancerName = &v - return s -} - -// Contains the output of RegisterInstancesWithLoadBalancer. -type RegisterInstancesWithLoadBalancerOutput struct { - _ struct{} `type:"structure"` - - // The updated list of instances for the load balancer. - Instances []*Instance `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterInstancesWithLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterInstancesWithLoadBalancerOutput) GoString() string { - return s.String() -} - -// SetInstances sets the Instances field's value. -func (s *RegisterInstancesWithLoadBalancerOutput) SetInstances(v []*Instance) *RegisterInstancesWithLoadBalancerOutput { - s.Instances = v - return s -} - -// Contains the parameters for RemoveTags. -type RemoveTagsInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. You can specify a maximum of one load balancer - // name. - // - // LoadBalancerNames is a required field - LoadBalancerNames []*string `type:"list" required:"true"` - - // The list of tag keys to remove. - // - // Tags is a required field - Tags []*TagKeyOnly `min:"1" type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RemoveTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RemoveTagsInput"} - if s.LoadBalancerNames == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerNames")) - } - if s.Tags == nil { - invalidParams.Add(request.NewErrParamRequired("Tags")) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerNames sets the LoadBalancerNames field's value. -func (s *RemoveTagsInput) SetLoadBalancerNames(v []*string) *RemoveTagsInput { - s.LoadBalancerNames = v - return s -} - -// SetTags sets the Tags field's value. -func (s *RemoveTagsInput) SetTags(v []*TagKeyOnly) *RemoveTagsInput { - s.Tags = v - return s -} - -// Contains the output of RemoveTags. -type RemoveTagsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsOutput) GoString() string { - return s.String() -} - -// Contains the parameters for SetLoadBalancerListenerSSLCertificate. -type SetLoadBalancerListenerSSLCertificateInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The port that uses the specified SSL certificate. - // - // LoadBalancerPort is a required field - LoadBalancerPort *int64 `type:"integer" required:"true"` - - // The Amazon Resource Name (ARN) of the SSL certificate. - // - // SSLCertificateId is a required field - SSLCertificateId *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerListenerSSLCertificateInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerListenerSSLCertificateInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetLoadBalancerListenerSSLCertificateInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetLoadBalancerListenerSSLCertificateInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.LoadBalancerPort == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerPort")) - } - if s.SSLCertificateId == nil { - invalidParams.Add(request.NewErrParamRequired("SSLCertificateId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *SetLoadBalancerListenerSSLCertificateInput) SetLoadBalancerName(v string) *SetLoadBalancerListenerSSLCertificateInput { - s.LoadBalancerName = &v - return s -} - -// SetLoadBalancerPort sets the LoadBalancerPort field's value. -func (s *SetLoadBalancerListenerSSLCertificateInput) SetLoadBalancerPort(v int64) *SetLoadBalancerListenerSSLCertificateInput { - s.LoadBalancerPort = &v - return s -} - -// SetSSLCertificateId sets the SSLCertificateId field's value. -func (s *SetLoadBalancerListenerSSLCertificateInput) SetSSLCertificateId(v string) *SetLoadBalancerListenerSSLCertificateInput { - s.SSLCertificateId = &v - return s -} - -// Contains the output of SetLoadBalancerListenerSSLCertificate. -type SetLoadBalancerListenerSSLCertificateOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerListenerSSLCertificateOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerListenerSSLCertificateOutput) GoString() string { - return s.String() -} - -// Contains the parameters for SetLoadBalancerPoliciesForBackendServer. -type SetLoadBalancerPoliciesForBackendServerInput struct { - _ struct{} `type:"structure"` - - // The port number associated with the EC2 instance. - // - // InstancePort is a required field - InstancePort *int64 `type:"integer" required:"true"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The names of the policies. If the list is empty, then all current polices - // are removed from the EC2 instance. - // - // PolicyNames is a required field - PolicyNames []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesForBackendServerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesForBackendServerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetLoadBalancerPoliciesForBackendServerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetLoadBalancerPoliciesForBackendServerInput"} - if s.InstancePort == nil { - invalidParams.Add(request.NewErrParamRequired("InstancePort")) - } - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.PolicyNames == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyNames")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetInstancePort sets the InstancePort field's value. -func (s *SetLoadBalancerPoliciesForBackendServerInput) SetInstancePort(v int64) *SetLoadBalancerPoliciesForBackendServerInput { - s.InstancePort = &v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *SetLoadBalancerPoliciesForBackendServerInput) SetLoadBalancerName(v string) *SetLoadBalancerPoliciesForBackendServerInput { - s.LoadBalancerName = &v - return s -} - -// SetPolicyNames sets the PolicyNames field's value. -func (s *SetLoadBalancerPoliciesForBackendServerInput) SetPolicyNames(v []*string) *SetLoadBalancerPoliciesForBackendServerInput { - s.PolicyNames = v - return s -} - -// Contains the output of SetLoadBalancerPoliciesForBackendServer. -type SetLoadBalancerPoliciesForBackendServerOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesForBackendServerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesForBackendServerOutput) GoString() string { - return s.String() -} - -// Contains the parameters for SetLoadBalancePoliciesOfListener. -type SetLoadBalancerPoliciesOfListenerInput struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - // - // LoadBalancerName is a required field - LoadBalancerName *string `type:"string" required:"true"` - - // The external port of the load balancer. - // - // LoadBalancerPort is a required field - LoadBalancerPort *int64 `type:"integer" required:"true"` - - // The names of the policies. This list must include all policies to be enabled. - // If you omit a policy that is currently enabled, it is disabled. If the list - // is empty, all current policies are disabled. - // - // PolicyNames is a required field - PolicyNames []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesOfListenerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesOfListenerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetLoadBalancerPoliciesOfListenerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetLoadBalancerPoliciesOfListenerInput"} - if s.LoadBalancerName == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerName")) - } - if s.LoadBalancerPort == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerPort")) - } - if s.PolicyNames == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyNames")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *SetLoadBalancerPoliciesOfListenerInput) SetLoadBalancerName(v string) *SetLoadBalancerPoliciesOfListenerInput { - s.LoadBalancerName = &v - return s -} - -// SetLoadBalancerPort sets the LoadBalancerPort field's value. -func (s *SetLoadBalancerPoliciesOfListenerInput) SetLoadBalancerPort(v int64) *SetLoadBalancerPoliciesOfListenerInput { - s.LoadBalancerPort = &v - return s -} - -// SetPolicyNames sets the PolicyNames field's value. -func (s *SetLoadBalancerPoliciesOfListenerInput) SetPolicyNames(v []*string) *SetLoadBalancerPoliciesOfListenerInput { - s.PolicyNames = v - return s -} - -// Contains the output of SetLoadBalancePoliciesOfListener. -type SetLoadBalancerPoliciesOfListenerOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesOfListenerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetLoadBalancerPoliciesOfListenerOutput) GoString() string { - return s.String() -} - -// Information about a source security group. -type SourceSecurityGroup struct { - _ struct{} `type:"structure"` - - // The name of the security group. - GroupName *string `type:"string"` - - // The owner of the security group. - OwnerAlias *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SourceSecurityGroup) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SourceSecurityGroup) GoString() string { - return s.String() -} - -// SetGroupName sets the GroupName field's value. -func (s *SourceSecurityGroup) SetGroupName(v string) *SourceSecurityGroup { - s.GroupName = &v - return s -} - -// SetOwnerAlias sets the OwnerAlias field's value. -func (s *SourceSecurityGroup) SetOwnerAlias(v string) *SourceSecurityGroup { - s.OwnerAlias = &v - return s -} - -// Information about a tag. -type Tag struct { - _ struct{} `type:"structure"` - - // The key of the tag. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // The value of the tag. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Tag) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -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 invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *Tag) SetKey(v string) *Tag { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *Tag) SetValue(v string) *Tag { - s.Value = &v - return s -} - -// The tags associated with a load balancer. -type TagDescription struct { - _ struct{} `type:"structure"` - - // The name of the load balancer. - LoadBalancerName *string `type:"string"` - - // The tags. - Tags []*Tag `min:"1" type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagDescription) GoString() string { - return s.String() -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *TagDescription) SetLoadBalancerName(v string) *TagDescription { - s.LoadBalancerName = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *TagDescription) SetTags(v []*Tag) *TagDescription { - s.Tags = v - return s -} - -// The key of a tag. -type TagKeyOnly struct { - _ struct{} `type:"structure"` - - // The name of the key. - Key *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagKeyOnly) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagKeyOnly) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TagKeyOnly) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TagKeyOnly"} - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *TagKeyOnly) SetKey(v string) *TagKeyOnly { - s.Key = &v - return s -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elb/doc.go b/vendor/github.com/aws/aws-sdk-go/service/elb/doc.go deleted file mode 100644 index c4815ced0c5..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/doc.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package elb provides the client and types for making API -// requests to Elastic Load Balancing. -// -// A load balancer can distribute incoming traffic across your EC2 instances. -// This enables you to increase the availability of your application. The load -// balancer also monitors the health of its registered instances and ensures -// that it routes traffic only to healthy instances. You configure your load -// balancer to accept incoming traffic by specifying one or more listeners, -// which are configured with a protocol and port number for connections from -// clients to the load balancer and a protocol and port number for connections -// from the load balancer to the instances. -// -// Elastic Load Balancing supports three types of load balancers: Application -// Load Balancers, Network Load Balancers, and Classic Load Balancers. You can -// select a load balancer based on your application needs. For more information, -// see the Elastic Load Balancing User Guide (https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/). -// -// This reference covers the 2012-06-01 API, which supports Classic Load Balancers. -// The 2015-12-01 API supports Application Load Balancers and Network Load Balancers. -// -// To get started, create a load balancer with one or more listeners using CreateLoadBalancer. -// Register your instances with the load balancer using RegisterInstancesWithLoadBalancer. -// -// All Elastic Load Balancing operations are idempotent, which means that they -// complete at most one time. If you repeat an operation, it succeeds with a -// 200 OK response code. -// -// See https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01 for more information on this service. -// -// See elb package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/elb/ -// -// # Using the Client -// -// To contact Elastic Load Balancing with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the Elastic Load Balancing client ELB for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/elb/#New -package elb diff --git a/vendor/github.com/aws/aws-sdk-go/service/elb/errors.go b/vendor/github.com/aws/aws-sdk-go/service/elb/errors.go deleted file mode 100644 index 14f1e6717e4..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/errors.go +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elb - -const ( - - // ErrCodeAccessPointNotFoundException for service response error code - // "LoadBalancerNotFound". - // - // The specified load balancer does not exist. - ErrCodeAccessPointNotFoundException = "LoadBalancerNotFound" - - // ErrCodeCertificateNotFoundException for service response error code - // "CertificateNotFound". - // - // The specified ARN does not refer to a valid SSL certificate in AWS Identity - // and Access Management (IAM) or AWS Certificate Manager (ACM). Note that if - // you recently uploaded the certificate to IAM, this error might indicate that - // the certificate is not fully available yet. - ErrCodeCertificateNotFoundException = "CertificateNotFound" - - // ErrCodeDependencyThrottleException for service response error code - // "DependencyThrottle". - // - // A request made by Elastic Load Balancing to another service exceeds the maximum - // request rate permitted for your account. - ErrCodeDependencyThrottleException = "DependencyThrottle" - - // ErrCodeDuplicateAccessPointNameException for service response error code - // "DuplicateLoadBalancerName". - // - // The specified load balancer name already exists for this account. - ErrCodeDuplicateAccessPointNameException = "DuplicateLoadBalancerName" - - // ErrCodeDuplicateListenerException for service response error code - // "DuplicateListener". - // - // A listener already exists for the specified load balancer name and port, - // but with a different instance port, protocol, or SSL certificate. - ErrCodeDuplicateListenerException = "DuplicateListener" - - // ErrCodeDuplicatePolicyNameException for service response error code - // "DuplicatePolicyName". - // - // A policy with the specified name already exists for this load balancer. - ErrCodeDuplicatePolicyNameException = "DuplicatePolicyName" - - // ErrCodeDuplicateTagKeysException for service response error code - // "DuplicateTagKeys". - // - // A tag key was specified more than once. - ErrCodeDuplicateTagKeysException = "DuplicateTagKeys" - - // ErrCodeInvalidConfigurationRequestException for service response error code - // "InvalidConfigurationRequest". - // - // The requested configuration change is not valid. - ErrCodeInvalidConfigurationRequestException = "InvalidConfigurationRequest" - - // ErrCodeInvalidEndPointException for service response error code - // "InvalidInstance". - // - // The specified endpoint is not valid. - ErrCodeInvalidEndPointException = "InvalidInstance" - - // ErrCodeInvalidSchemeException for service response error code - // "InvalidScheme". - // - // The specified value for the schema is not valid. You can only specify a scheme - // for load balancers in a VPC. - ErrCodeInvalidSchemeException = "InvalidScheme" - - // ErrCodeInvalidSecurityGroupException for service response error code - // "InvalidSecurityGroup". - // - // One or more of the specified security groups do not exist. - ErrCodeInvalidSecurityGroupException = "InvalidSecurityGroup" - - // ErrCodeInvalidSubnetException for service response error code - // "InvalidSubnet". - // - // The specified VPC has no associated Internet gateway. - ErrCodeInvalidSubnetException = "InvalidSubnet" - - // ErrCodeListenerNotFoundException for service response error code - // "ListenerNotFound". - // - // The load balancer does not have a listener configured at the specified port. - ErrCodeListenerNotFoundException = "ListenerNotFound" - - // ErrCodeLoadBalancerAttributeNotFoundException for service response error code - // "LoadBalancerAttributeNotFound". - // - // The specified load balancer attribute does not exist. - ErrCodeLoadBalancerAttributeNotFoundException = "LoadBalancerAttributeNotFound" - - // ErrCodeOperationNotPermittedException for service response error code - // "OperationNotPermitted". - // - // This operation is not allowed. - ErrCodeOperationNotPermittedException = "OperationNotPermitted" - - // ErrCodePolicyNotFoundException for service response error code - // "PolicyNotFound". - // - // One or more of the specified policies do not exist. - ErrCodePolicyNotFoundException = "PolicyNotFound" - - // ErrCodePolicyTypeNotFoundException for service response error code - // "PolicyTypeNotFound". - // - // One or more of the specified policy types do not exist. - ErrCodePolicyTypeNotFoundException = "PolicyTypeNotFound" - - // ErrCodeSubnetNotFoundException for service response error code - // "SubnetNotFound". - // - // One or more of the specified subnets do not exist. - ErrCodeSubnetNotFoundException = "SubnetNotFound" - - // ErrCodeTooManyAccessPointsException for service response error code - // "TooManyLoadBalancers". - // - // The quota for the number of load balancers has been reached. - ErrCodeTooManyAccessPointsException = "TooManyLoadBalancers" - - // ErrCodeTooManyPoliciesException for service response error code - // "TooManyPolicies". - // - // The quota for the number of policies for this load balancer has been reached. - ErrCodeTooManyPoliciesException = "TooManyPolicies" - - // ErrCodeTooManyTagsException for service response error code - // "TooManyTags". - // - // The quota for the number of tags that can be assigned to a load balancer - // has been reached. - ErrCodeTooManyTagsException = "TooManyTags" - - // ErrCodeUnsupportedProtocolException for service response error code - // "UnsupportedProtocol". - // - // The specified protocol or signature version is not supported. - ErrCodeUnsupportedProtocolException = "UnsupportedProtocol" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/elb/service.go b/vendor/github.com/aws/aws-sdk-go/service/elb/service.go deleted file mode 100644 index 360f2870485..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/service.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elb - -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/query" -) - -// ELB provides the API operation methods for making requests to -// Elastic Load Balancing. See this package's package overview docs -// for details on the service. -// -// ELB methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type ELB 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) - -// Service information constants -const ( - ServiceName = "elasticloadbalancing" // Name of service. - EndpointsID = ServiceName // ID to lookup a service endpoint with. - ServiceID = "Elastic Load Balancing" // ServiceID is a unique identifier of a specific service. -) - -// New creates a new instance of the ELB 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: -// -// mySession := session.Must(session.NewSession()) -// -// // Create a ELB client from just a session. -// svc := elb.New(mySession) -// -// // Create a ELB client with additional configuration -// svc := elb.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *ELB { - c := p.ClientConfig(EndpointsID, cfgs...) - if c.SigningNameDerived || len(c.SigningName) == 0 { - c.SigningName = EndpointsID - // No Fallback - } - return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *ELB { - svc := &ELB{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - ServiceID: ServiceID, - SigningName: signingName, - SigningRegion: signingRegion, - PartitionID: partitionID, - Endpoint: endpoint, - APIVersion: "2012-06-01", - ResolvedRegion: resolvedRegion, - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a ELB operation and runs any -// custom request initialization. -func (c *ELB) 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/elb/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go deleted file mode 100644 index bdf449d36b1..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elb - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// WaitUntilAnyInstanceInService uses the Elastic Load Balancing API operation -// DescribeInstanceHealth to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELB) WaitUntilAnyInstanceInService(input *DescribeInstanceHealthInput) error { - return c.WaitUntilAnyInstanceInServiceWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilAnyInstanceInServiceWithContext is an extended version of WaitUntilAnyInstanceInService. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) WaitUntilAnyInstanceInServiceWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilAnyInstanceInService", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAnyWaiterMatch, Argument: "InstanceStates[].State", - Expected: "InService", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeInstanceHealthInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeInstanceHealthRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilInstanceDeregistered uses the Elastic Load Balancing API operation -// DescribeInstanceHealth to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELB) WaitUntilInstanceDeregistered(input *DescribeInstanceHealthInput) error { - return c.WaitUntilInstanceDeregisteredWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilInstanceDeregisteredWithContext is an extended version of WaitUntilInstanceDeregistered. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) WaitUntilInstanceDeregisteredWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilInstanceDeregistered", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, Argument: "InstanceStates[].State", - Expected: "OutOfService", - }, - { - State: request.SuccessWaiterState, - Matcher: request.ErrorWaiterMatch, - Expected: "InvalidInstance", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeInstanceHealthInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeInstanceHealthRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilInstanceInService uses the Elastic Load Balancing API operation -// DescribeInstanceHealth to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELB) WaitUntilInstanceInService(input *DescribeInstanceHealthInput) error { - return c.WaitUntilInstanceInServiceWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilInstanceInServiceWithContext is an extended version of WaitUntilInstanceInService. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELB) WaitUntilInstanceInServiceWithContext(ctx aws.Context, input *DescribeInstanceHealthInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilInstanceInService", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, Argument: "InstanceStates[].State", - Expected: "InService", - }, - { - State: request.RetryWaiterState, - Matcher: request.ErrorWaiterMatch, - Expected: "InvalidInstance", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeInstanceHealthInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeInstanceHealthRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go b/vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go deleted file mode 100644 index 74b09dec696..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go +++ /dev/null @@ -1,10571 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elbv2 - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/query" -) - -const opAddListenerCertificates = "AddListenerCertificates" - -// AddListenerCertificatesRequest generates a "aws/request.Request" representing the -// client's request for the AddListenerCertificates operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AddListenerCertificates for more information on using the AddListenerCertificates -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the AddListenerCertificatesRequest method. -// req, resp := client.AddListenerCertificatesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddListenerCertificates -func (c *ELBV2) AddListenerCertificatesRequest(input *AddListenerCertificatesInput) (req *request.Request, output *AddListenerCertificatesOutput) { - op := &request.Operation{ - Name: opAddListenerCertificates, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AddListenerCertificatesInput{} - } - - output = &AddListenerCertificatesOutput{} - req = c.newRequest(op, input, output) - return -} - -// AddListenerCertificates API operation for Elastic Load Balancing. -// -// Adds the specified SSL server certificate to the certificate list for the -// specified HTTPS or TLS listener. -// -// If the certificate in already in the certificate list, the call is successful -// but the certificate is not added again. -// -// For more information, see HTTPS listeners (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html) -// in the Application Load Balancers Guide or TLS listeners (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html) -// in the Network Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation AddListenerCertificates for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeTooManyCertificatesException "TooManyCertificates" -// You've reached the limit on the number of certificates per load balancer. -// -// - ErrCodeCertificateNotFoundException "CertificateNotFound" -// The specified certificate does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddListenerCertificates -func (c *ELBV2) AddListenerCertificates(input *AddListenerCertificatesInput) (*AddListenerCertificatesOutput, error) { - req, out := c.AddListenerCertificatesRequest(input) - return out, req.Send() -} - -// AddListenerCertificatesWithContext is the same as AddListenerCertificates with the addition of -// the ability to pass a context and additional request options. -// -// See AddListenerCertificates for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) AddListenerCertificatesWithContext(ctx aws.Context, input *AddListenerCertificatesInput, opts ...request.Option) (*AddListenerCertificatesOutput, error) { - req, out := c.AddListenerCertificatesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAddTags = "AddTags" - -// AddTagsRequest generates a "aws/request.Request" representing the -// client's request for the AddTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AddTags for more information on using the AddTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the AddTagsRequest method. -// req, resp := client.AddTagsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddTags -func (c *ELBV2) AddTagsRequest(input *AddTagsInput) (req *request.Request, output *AddTagsOutput) { - op := &request.Operation{ - Name: opAddTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AddTagsInput{} - } - - output = &AddTagsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// AddTags API operation for Elastic Load Balancing. -// -// Adds the specified tags to the specified Elastic Load Balancing resource. -// You can tag your Application Load Balancers, Network Load Balancers, Gateway -// Load Balancers, target groups, listeners, and rules. -// -// Each tag consists of a key and an optional value. If a resource already has -// a tag with the same key, AddTags updates its value. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation AddTags for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeDuplicateTagKeysException "DuplicateTagKeys" -// A tag key was specified more than once. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// You've reached the limit on the number of tags per load balancer. -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeRuleNotFoundException "RuleNotFound" -// The specified rule does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddTags -func (c *ELBV2) AddTags(input *AddTagsInput) (*AddTagsOutput, error) { - req, out := c.AddTagsRequest(input) - return out, req.Send() -} - -// AddTagsWithContext is the same as AddTags with the addition of -// the ability to pass a context and additional request options. -// -// See AddTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) AddTagsWithContext(ctx aws.Context, input *AddTagsInput, opts ...request.Option) (*AddTagsOutput, error) { - req, out := c.AddTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateListener = "CreateListener" - -// CreateListenerRequest generates a "aws/request.Request" representing the -// client's request for the CreateListener operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateListener for more information on using the CreateListener -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateListenerRequest method. -// req, resp := client.CreateListenerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateListener -func (c *ELBV2) CreateListenerRequest(input *CreateListenerInput) (req *request.Request, output *CreateListenerOutput) { - op := &request.Operation{ - Name: opCreateListener, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateListenerInput{} - } - - output = &CreateListenerOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateListener API operation for Elastic Load Balancing. -// -// Creates a listener for the specified Application Load Balancer, Network Load -// Balancer, or Gateway Load Balancer. -// -// For more information, see the following: -// -// - Listeners for your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html) -// -// - Listeners for your Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-listeners.html) -// -// - Listeners for your Gateway Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/gateway-listeners.html) -// -// This operation is idempotent, which means that it completes at most one time. -// If you attempt to create multiple listeners with the same settings, each -// call succeeds. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateListener for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeDuplicateListenerException "DuplicateListener" -// A listener with the specified port already exists. -// -// - ErrCodeTooManyListenersException "TooManyListeners" -// You've reached the limit on the number of listeners per load balancer. -// -// - ErrCodeTooManyCertificatesException "TooManyCertificates" -// You've reached the limit on the number of certificates per load balancer. -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" -// You've reached the limit on the number of load balancers per target group. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" -// The specified configuration is not valid with this protocol. -// -// - ErrCodeSSLPolicyNotFoundException "SSLPolicyNotFound" -// The specified SSL policy does not exist. -// -// - ErrCodeCertificateNotFoundException "CertificateNotFound" -// The specified certificate does not exist. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol is not supported. -// -// - ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" -// You've reached the limit on the number of times a target can be registered -// with a load balancer. -// -// - ErrCodeTooManyTargetsException "TooManyTargets" -// You've reached the limit on the number of targets. -// -// - ErrCodeTooManyActionsException "TooManyActions" -// You've reached the limit on the number of actions per rule. -// -// - ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" -// The requested action is not valid. -// -// - ErrCodeTooManyUniqueTargetGroupsPerLoadBalancerException "TooManyUniqueTargetGroupsPerLoadBalancer" -// You've reached the limit on the number of unique target groups per load balancer -// across all listeners. If a target group is used by multiple actions for a -// load balancer, it is counted as only one use. -// -// - ErrCodeALPNPolicyNotSupportedException "ALPNPolicyNotFound" -// The specified ALPN policy is not supported. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// You've reached the limit on the number of tags per load balancer. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateListener -func (c *ELBV2) CreateListener(input *CreateListenerInput) (*CreateListenerOutput, error) { - req, out := c.CreateListenerRequest(input) - return out, req.Send() -} - -// CreateListenerWithContext is the same as CreateListener with the addition of -// the ability to pass a context and additional request options. -// -// See CreateListener for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) CreateListenerWithContext(ctx aws.Context, input *CreateListenerInput, opts ...request.Option) (*CreateListenerOutput, error) { - req, out := c.CreateListenerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateLoadBalancer = "CreateLoadBalancer" - -// CreateLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the CreateLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateLoadBalancer for more information on using the CreateLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateLoadBalancerRequest method. -// req, resp := client.CreateLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateLoadBalancer -func (c *ELBV2) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (req *request.Request, output *CreateLoadBalancerOutput) { - op := &request.Operation{ - Name: opCreateLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateLoadBalancerInput{} - } - - output = &CreateLoadBalancerOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateLoadBalancer API operation for Elastic Load Balancing. -// -// Creates an Application Load Balancer, Network Load Balancer, or Gateway Load -// Balancer. -// -// For more information, see the following: -// -// - Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html) -// -// - Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html) -// -// - Gateway Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/gateway-load-balancers.html) -// -// This operation is idempotent, which means that it completes at most one time. -// If you attempt to create multiple load balancers with the same settings, -// each call succeeds. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateLoadBalancer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeDuplicateLoadBalancerNameException "DuplicateLoadBalancerName" -// A load balancer with the specified name already exists. -// -// - ErrCodeTooManyLoadBalancersException "TooManyLoadBalancers" -// You've reached the limit on the number of load balancers for your Amazon -// Web Services account. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeSubnetNotFoundException "SubnetNotFound" -// The specified subnet does not exist. -// -// - ErrCodeInvalidSubnetException "InvalidSubnet" -// The specified subnet is out of available addresses. -// -// - ErrCodeInvalidSecurityGroupException "InvalidSecurityGroup" -// The specified security group does not exist. -// -// - ErrCodeInvalidSchemeException "InvalidScheme" -// The requested scheme is not valid. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// You've reached the limit on the number of tags per load balancer. -// -// - ErrCodeDuplicateTagKeysException "DuplicateTagKeys" -// A tag key was specified more than once. -// -// - ErrCodeResourceInUseException "ResourceInUse" -// A specified resource is in use. -// -// - ErrCodeAllocationIdNotFoundException "AllocationIdNotFound" -// The specified allocation ID does not exist. -// -// - ErrCodeAvailabilityZoneNotSupportedException "AvailabilityZoneNotSupported" -// The specified Availability Zone is not supported. -// -// - ErrCodeOperationNotPermittedException "OperationNotPermitted" -// This operation is not allowed. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateLoadBalancer -func (c *ELBV2) CreateLoadBalancer(input *CreateLoadBalancerInput) (*CreateLoadBalancerOutput, error) { - req, out := c.CreateLoadBalancerRequest(input) - return out, req.Send() -} - -// CreateLoadBalancerWithContext is the same as CreateLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See CreateLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) CreateLoadBalancerWithContext(ctx aws.Context, input *CreateLoadBalancerInput, opts ...request.Option) (*CreateLoadBalancerOutput, error) { - req, out := c.CreateLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateRule = "CreateRule" - -// CreateRuleRequest generates a "aws/request.Request" representing the -// client's request for the CreateRule operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateRule for more information on using the CreateRule -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateRuleRequest method. -// req, resp := client.CreateRuleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateRule -func (c *ELBV2) CreateRuleRequest(input *CreateRuleInput) (req *request.Request, output *CreateRuleOutput) { - op := &request.Operation{ - Name: opCreateRule, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateRuleInput{} - } - - output = &CreateRuleOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateRule API operation for Elastic Load Balancing. -// -// Creates a rule for the specified listener. The listener must be associated -// with an Application Load Balancer. -// -// Each rule consists of a priority, one or more actions, and one or more conditions. -// Rules are evaluated in priority order, from the lowest value to the highest -// value. When the conditions for a rule are met, its actions are performed. -// If the conditions for no rules are met, the actions for the default rule -// are performed. For more information, see Listener rules (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#listener-rules) -// in the Application Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateRule for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodePriorityInUseException "PriorityInUse" -// The specified priority is in use. -// -// - ErrCodeTooManyTargetGroupsException "TooManyTargetGroups" -// You've reached the limit on the number of target groups for your Amazon Web -// Services account. -// -// - ErrCodeTooManyRulesException "TooManyRules" -// You've reached the limit on the number of rules per load balancer. -// -// - ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" -// You've reached the limit on the number of load balancers per target group. -// -// - ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" -// The specified configuration is not valid with this protocol. -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" -// You've reached the limit on the number of times a target can be registered -// with a load balancer. -// -// - ErrCodeTooManyTargetsException "TooManyTargets" -// You've reached the limit on the number of targets. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol is not supported. -// -// - ErrCodeTooManyActionsException "TooManyActions" -// You've reached the limit on the number of actions per rule. -// -// - ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" -// The requested action is not valid. -// -// - ErrCodeTooManyUniqueTargetGroupsPerLoadBalancerException "TooManyUniqueTargetGroupsPerLoadBalancer" -// You've reached the limit on the number of unique target groups per load balancer -// across all listeners. If a target group is used by multiple actions for a -// load balancer, it is counted as only one use. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// You've reached the limit on the number of tags per load balancer. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateRule -func (c *ELBV2) CreateRule(input *CreateRuleInput) (*CreateRuleOutput, error) { - req, out := c.CreateRuleRequest(input) - return out, req.Send() -} - -// CreateRuleWithContext is the same as CreateRule with the addition of -// the ability to pass a context and additional request options. -// -// See CreateRule for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) CreateRuleWithContext(ctx aws.Context, input *CreateRuleInput, opts ...request.Option) (*CreateRuleOutput, error) { - req, out := c.CreateRuleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateTargetGroup = "CreateTargetGroup" - -// CreateTargetGroupRequest generates a "aws/request.Request" representing the -// client's request for the CreateTargetGroup operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateTargetGroup for more information on using the CreateTargetGroup -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateTargetGroupRequest method. -// req, resp := client.CreateTargetGroupRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateTargetGroup -func (c *ELBV2) CreateTargetGroupRequest(input *CreateTargetGroupInput) (req *request.Request, output *CreateTargetGroupOutput) { - op := &request.Operation{ - Name: opCreateTargetGroup, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateTargetGroupInput{} - } - - output = &CreateTargetGroupOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateTargetGroup API operation for Elastic Load Balancing. -// -// Creates a target group. -// -// For more information, see the following: -// -// - Target groups for your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html) -// -// - Target groups for your Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html) -// -// - Target groups for your Gateway Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/target-groups.html) -// -// This operation is idempotent, which means that it completes at most one time. -// If you attempt to create multiple target groups with the same settings, each -// call succeeds. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation CreateTargetGroup for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeDuplicateTargetGroupNameException "DuplicateTargetGroupName" -// A target group with the specified name already exists. -// -// - ErrCodeTooManyTargetGroupsException "TooManyTargetGroups" -// You've reached the limit on the number of target groups for your Amazon Web -// Services account. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// You've reached the limit on the number of tags per load balancer. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateTargetGroup -func (c *ELBV2) CreateTargetGroup(input *CreateTargetGroupInput) (*CreateTargetGroupOutput, error) { - req, out := c.CreateTargetGroupRequest(input) - return out, req.Send() -} - -// CreateTargetGroupWithContext is the same as CreateTargetGroup with the addition of -// the ability to pass a context and additional request options. -// -// See CreateTargetGroup for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) CreateTargetGroupWithContext(ctx aws.Context, input *CreateTargetGroupInput, opts ...request.Option) (*CreateTargetGroupOutput, error) { - req, out := c.CreateTargetGroupRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteListener = "DeleteListener" - -// DeleteListenerRequest generates a "aws/request.Request" representing the -// client's request for the DeleteListener operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteListener for more information on using the DeleteListener -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteListenerRequest method. -// req, resp := client.DeleteListenerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteListener -func (c *ELBV2) DeleteListenerRequest(input *DeleteListenerInput) (req *request.Request, output *DeleteListenerOutput) { - op := &request.Operation{ - Name: opDeleteListener, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteListenerInput{} - } - - output = &DeleteListenerOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteListener API operation for Elastic Load Balancing. -// -// Deletes the specified listener. -// -// Alternatively, your listener is deleted when you delete the load balancer -// to which it is attached. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeleteListener for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeResourceInUseException "ResourceInUse" -// A specified resource is in use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteListener -func (c *ELBV2) DeleteListener(input *DeleteListenerInput) (*DeleteListenerOutput, error) { - req, out := c.DeleteListenerRequest(input) - return out, req.Send() -} - -// DeleteListenerWithContext is the same as DeleteListener with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteListener for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DeleteListenerWithContext(ctx aws.Context, input *DeleteListenerInput, opts ...request.Option) (*DeleteListenerOutput, error) { - req, out := c.DeleteListenerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteLoadBalancer = "DeleteLoadBalancer" - -// DeleteLoadBalancerRequest generates a "aws/request.Request" representing the -// client's request for the DeleteLoadBalancer operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteLoadBalancer for more information on using the DeleteLoadBalancer -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteLoadBalancerRequest method. -// req, resp := client.DeleteLoadBalancerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteLoadBalancer -func (c *ELBV2) DeleteLoadBalancerRequest(input *DeleteLoadBalancerInput) (req *request.Request, output *DeleteLoadBalancerOutput) { - op := &request.Operation{ - Name: opDeleteLoadBalancer, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteLoadBalancerInput{} - } - - output = &DeleteLoadBalancerOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteLoadBalancer API operation for Elastic Load Balancing. -// -// Deletes the specified Application Load Balancer, Network Load Balancer, or -// Gateway Load Balancer. Deleting a load balancer also deletes its listeners. -// -// You can't delete a load balancer if deletion protection is enabled. If the -// load balancer does not exist or has already been deleted, the call succeeds. -// -// Deleting a load balancer does not affect its registered targets. For example, -// your EC2 instances continue to run and are still registered to their target -// groups. If you no longer need these EC2 instances, you can stop or terminate -// them. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeleteLoadBalancer for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeOperationNotPermittedException "OperationNotPermitted" -// This operation is not allowed. -// -// - ErrCodeResourceInUseException "ResourceInUse" -// A specified resource is in use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteLoadBalancer -func (c *ELBV2) DeleteLoadBalancer(input *DeleteLoadBalancerInput) (*DeleteLoadBalancerOutput, error) { - req, out := c.DeleteLoadBalancerRequest(input) - return out, req.Send() -} - -// DeleteLoadBalancerWithContext is the same as DeleteLoadBalancer with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteLoadBalancer for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DeleteLoadBalancerWithContext(ctx aws.Context, input *DeleteLoadBalancerInput, opts ...request.Option) (*DeleteLoadBalancerOutput, error) { - req, out := c.DeleteLoadBalancerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteRule = "DeleteRule" - -// DeleteRuleRequest generates a "aws/request.Request" representing the -// client's request for the DeleteRule operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteRule for more information on using the DeleteRule -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteRuleRequest method. -// req, resp := client.DeleteRuleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteRule -func (c *ELBV2) DeleteRuleRequest(input *DeleteRuleInput) (req *request.Request, output *DeleteRuleOutput) { - op := &request.Operation{ - Name: opDeleteRule, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteRuleInput{} - } - - output = &DeleteRuleOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteRule API operation for Elastic Load Balancing. -// -// Deletes the specified rule. -// -// You can't delete the default rule. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeleteRule for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeRuleNotFoundException "RuleNotFound" -// The specified rule does not exist. -// -// - ErrCodeOperationNotPermittedException "OperationNotPermitted" -// This operation is not allowed. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteRule -func (c *ELBV2) DeleteRule(input *DeleteRuleInput) (*DeleteRuleOutput, error) { - req, out := c.DeleteRuleRequest(input) - return out, req.Send() -} - -// DeleteRuleWithContext is the same as DeleteRule with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteRule for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DeleteRuleWithContext(ctx aws.Context, input *DeleteRuleInput, opts ...request.Option) (*DeleteRuleOutput, error) { - req, out := c.DeleteRuleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteTargetGroup = "DeleteTargetGroup" - -// DeleteTargetGroupRequest generates a "aws/request.Request" representing the -// client's request for the DeleteTargetGroup operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteTargetGroup for more information on using the DeleteTargetGroup -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteTargetGroupRequest method. -// req, resp := client.DeleteTargetGroupRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteTargetGroup -func (c *ELBV2) DeleteTargetGroupRequest(input *DeleteTargetGroupInput) (req *request.Request, output *DeleteTargetGroupOutput) { - op := &request.Operation{ - Name: opDeleteTargetGroup, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteTargetGroupInput{} - } - - output = &DeleteTargetGroupOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteTargetGroup API operation for Elastic Load Balancing. -// -// Deletes the specified target group. -// -// You can delete a target group if it is not referenced by any actions. Deleting -// a target group also deletes any associated health checks. Deleting a target -// group does not affect its registered targets. For example, any EC2 instances -// continue to run until you stop or terminate them. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeleteTargetGroup for usage and error information. -// -// Returned Error Codes: -// - ErrCodeResourceInUseException "ResourceInUse" -// A specified resource is in use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteTargetGroup -func (c *ELBV2) DeleteTargetGroup(input *DeleteTargetGroupInput) (*DeleteTargetGroupOutput, error) { - req, out := c.DeleteTargetGroupRequest(input) - return out, req.Send() -} - -// DeleteTargetGroupWithContext is the same as DeleteTargetGroup with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteTargetGroup for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DeleteTargetGroupWithContext(ctx aws.Context, input *DeleteTargetGroupInput, opts ...request.Option) (*DeleteTargetGroupOutput, error) { - req, out := c.DeleteTargetGroupRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeregisterTargets = "DeregisterTargets" - -// DeregisterTargetsRequest generates a "aws/request.Request" representing the -// client's request for the DeregisterTargets operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeregisterTargets for more information on using the DeregisterTargets -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeregisterTargetsRequest method. -// req, resp := client.DeregisterTargetsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeregisterTargets -func (c *ELBV2) DeregisterTargetsRequest(input *DeregisterTargetsInput) (req *request.Request, output *DeregisterTargetsOutput) { - op := &request.Operation{ - Name: opDeregisterTargets, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeregisterTargetsInput{} - } - - output = &DeregisterTargetsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeregisterTargets API operation for Elastic Load Balancing. -// -// Deregisters the specified targets from the specified target group. After -// the targets are deregistered, they no longer receive traffic from the load -// balancer. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DeregisterTargets for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeInvalidTargetException "InvalidTarget" -// The specified target does not exist, is not in the same VPC as the target -// group, or has an unsupported instance type. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeregisterTargets -func (c *ELBV2) DeregisterTargets(input *DeregisterTargetsInput) (*DeregisterTargetsOutput, error) { - req, out := c.DeregisterTargetsRequest(input) - return out, req.Send() -} - -// DeregisterTargetsWithContext is the same as DeregisterTargets with the addition of -// the ability to pass a context and additional request options. -// -// See DeregisterTargets for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DeregisterTargetsWithContext(ctx aws.Context, input *DeregisterTargetsInput, opts ...request.Option) (*DeregisterTargetsOutput, error) { - req, out := c.DeregisterTargetsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeAccountLimits = "DescribeAccountLimits" - -// DescribeAccountLimitsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeAccountLimits operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeAccountLimits for more information on using the DescribeAccountLimits -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeAccountLimitsRequest method. -// req, resp := client.DescribeAccountLimitsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeAccountLimits -func (c *ELBV2) DescribeAccountLimitsRequest(input *DescribeAccountLimitsInput) (req *request.Request, output *DescribeAccountLimitsOutput) { - op := &request.Operation{ - Name: opDescribeAccountLimits, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeAccountLimitsInput{} - } - - output = &DescribeAccountLimitsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeAccountLimits API operation for Elastic Load Balancing. -// -// Describes the current Elastic Load Balancing resource limits for your Amazon -// Web Services account. -// -// For more information, see the following: -// -// - Quotas for your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html) -// -// - Quotas for your Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-limits.html) -// -// - Quotas for your Gateway Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/quotas-limits.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeAccountLimits for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeAccountLimits -func (c *ELBV2) DescribeAccountLimits(input *DescribeAccountLimitsInput) (*DescribeAccountLimitsOutput, error) { - req, out := c.DescribeAccountLimitsRequest(input) - return out, req.Send() -} - -// DescribeAccountLimitsWithContext is the same as DescribeAccountLimits with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeAccountLimits for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeAccountLimitsWithContext(ctx aws.Context, input *DescribeAccountLimitsInput, opts ...request.Option) (*DescribeAccountLimitsOutput, error) { - req, out := c.DescribeAccountLimitsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeListenerCertificates = "DescribeListenerCertificates" - -// DescribeListenerCertificatesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeListenerCertificates operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeListenerCertificates for more information on using the DescribeListenerCertificates -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeListenerCertificatesRequest method. -// req, resp := client.DescribeListenerCertificatesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListenerCertificates -func (c *ELBV2) DescribeListenerCertificatesRequest(input *DescribeListenerCertificatesInput) (req *request.Request, output *DescribeListenerCertificatesOutput) { - op := &request.Operation{ - Name: opDescribeListenerCertificates, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeListenerCertificatesInput{} - } - - output = &DescribeListenerCertificatesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeListenerCertificates API operation for Elastic Load Balancing. -// -// Describes the default certificate and the certificate list for the specified -// HTTPS or TLS listener. -// -// If the default certificate is also in the certificate list, it appears twice -// in the results (once with IsDefault set to true and once with IsDefault set -// to false). -// -// For more information, see SSL certificates (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#https-listener-certificates) -// in the Application Load Balancers Guide or Server certificates (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#tls-listener-certificate) -// in the Network Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeListenerCertificates for usage and error information. -// -// Returned Error Codes: -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListenerCertificates -func (c *ELBV2) DescribeListenerCertificates(input *DescribeListenerCertificatesInput) (*DescribeListenerCertificatesOutput, error) { - req, out := c.DescribeListenerCertificatesRequest(input) - return out, req.Send() -} - -// DescribeListenerCertificatesWithContext is the same as DescribeListenerCertificates with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeListenerCertificates for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeListenerCertificatesWithContext(ctx aws.Context, input *DescribeListenerCertificatesInput, opts ...request.Option) (*DescribeListenerCertificatesOutput, error) { - req, out := c.DescribeListenerCertificatesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeListeners = "DescribeListeners" - -// DescribeListenersRequest generates a "aws/request.Request" representing the -// client's request for the DescribeListeners operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeListeners for more information on using the DescribeListeners -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeListenersRequest method. -// req, resp := client.DescribeListenersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListeners -func (c *ELBV2) DescribeListenersRequest(input *DescribeListenersInput) (req *request.Request, output *DescribeListenersOutput) { - op := &request.Operation{ - Name: opDescribeListeners, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeListenersInput{} - } - - output = &DescribeListenersOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeListeners API operation for Elastic Load Balancing. -// -// Describes the specified listeners or the listeners for the specified Application -// Load Balancer, Network Load Balancer, or Gateway Load Balancer. You must -// specify either a load balancer or one or more listeners. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeListeners for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol is not supported. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListeners -func (c *ELBV2) DescribeListeners(input *DescribeListenersInput) (*DescribeListenersOutput, error) { - req, out := c.DescribeListenersRequest(input) - return out, req.Send() -} - -// DescribeListenersWithContext is the same as DescribeListeners with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeListeners for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeListenersWithContext(ctx aws.Context, input *DescribeListenersInput, opts ...request.Option) (*DescribeListenersOutput, error) { - req, out := c.DescribeListenersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeListenersPages iterates over the pages of a DescribeListeners operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeListeners 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 DescribeListeners operation. -// pageNum := 0 -// err := client.DescribeListenersPages(params, -// func(page *elbv2.DescribeListenersOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *ELBV2) DescribeListenersPages(input *DescribeListenersInput, fn func(*DescribeListenersOutput, bool) bool) error { - return c.DescribeListenersPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeListenersPagesWithContext same as DescribeListenersPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeListenersPagesWithContext(ctx aws.Context, input *DescribeListenersInput, fn func(*DescribeListenersOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeListenersInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeListenersRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeListenersOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeLoadBalancerAttributes = "DescribeLoadBalancerAttributes" - -// DescribeLoadBalancerAttributesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancerAttributes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancerAttributes for more information on using the DescribeLoadBalancerAttributes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancerAttributesRequest method. -// req, resp := client.DescribeLoadBalancerAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancerAttributes -func (c *ELBV2) DescribeLoadBalancerAttributesRequest(input *DescribeLoadBalancerAttributesInput) (req *request.Request, output *DescribeLoadBalancerAttributesOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancerAttributes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeLoadBalancerAttributesInput{} - } - - output = &DescribeLoadBalancerAttributesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancerAttributes API operation for Elastic Load Balancing. -// -// Describes the attributes for the specified Application Load Balancer, Network -// Load Balancer, or Gateway Load Balancer. -// -// For more information, see the following: -// -// - Load balancer attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#load-balancer-attributes) -// in the Application Load Balancers Guide -// -// - Load balancer attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#load-balancer-attributes) -// in the Network Load Balancers Guide -// -// - Load balancer attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/gateway-load-balancers.html#load-balancer-attributes) -// in the Gateway Load Balancers Guide -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeLoadBalancerAttributes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancerAttributes -func (c *ELBV2) DescribeLoadBalancerAttributes(input *DescribeLoadBalancerAttributesInput) (*DescribeLoadBalancerAttributesOutput, error) { - req, out := c.DescribeLoadBalancerAttributesRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancerAttributesWithContext is the same as DescribeLoadBalancerAttributes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancerAttributes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeLoadBalancerAttributesWithContext(ctx aws.Context, input *DescribeLoadBalancerAttributesInput, opts ...request.Option) (*DescribeLoadBalancerAttributesOutput, error) { - req, out := c.DescribeLoadBalancerAttributesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeLoadBalancers = "DescribeLoadBalancers" - -// DescribeLoadBalancersRequest generates a "aws/request.Request" representing the -// client's request for the DescribeLoadBalancers operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeLoadBalancers for more information on using the DescribeLoadBalancers -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeLoadBalancersRequest method. -// req, resp := client.DescribeLoadBalancersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancers -func (c *ELBV2) DescribeLoadBalancersRequest(input *DescribeLoadBalancersInput) (req *request.Request, output *DescribeLoadBalancersOutput) { - op := &request.Operation{ - Name: opDescribeLoadBalancers, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeLoadBalancersInput{} - } - - output = &DescribeLoadBalancersOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeLoadBalancers API operation for Elastic Load Balancing. -// -// Describes the specified load balancers or all of your load balancers. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeLoadBalancers for usage and error information. -// -// Returned Error Codes: -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancers -func (c *ELBV2) DescribeLoadBalancers(input *DescribeLoadBalancersInput) (*DescribeLoadBalancersOutput, error) { - req, out := c.DescribeLoadBalancersRequest(input) - return out, req.Send() -} - -// DescribeLoadBalancersWithContext is the same as DescribeLoadBalancers with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeLoadBalancers for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeLoadBalancersWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.Option) (*DescribeLoadBalancersOutput, error) { - req, out := c.DescribeLoadBalancersRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeLoadBalancersPages iterates over the pages of a DescribeLoadBalancers operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeLoadBalancers 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 DescribeLoadBalancers operation. -// pageNum := 0 -// err := client.DescribeLoadBalancersPages(params, -// func(page *elbv2.DescribeLoadBalancersOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *ELBV2) DescribeLoadBalancersPages(input *DescribeLoadBalancersInput, fn func(*DescribeLoadBalancersOutput, bool) bool) error { - return c.DescribeLoadBalancersPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeLoadBalancersPagesWithContext same as DescribeLoadBalancersPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeLoadBalancersPagesWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, fn func(*DescribeLoadBalancersOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeLoadBalancersInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeLoadBalancersRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeLoadBalancersOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeRules = "DescribeRules" - -// DescribeRulesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeRules operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeRules for more information on using the DescribeRules -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeRulesRequest method. -// req, resp := client.DescribeRulesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeRules -func (c *ELBV2) DescribeRulesRequest(input *DescribeRulesInput) (req *request.Request, output *DescribeRulesOutput) { - op := &request.Operation{ - Name: opDescribeRules, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeRulesInput{} - } - - output = &DescribeRulesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeRules API operation for Elastic Load Balancing. -// -// Describes the specified rules or the rules for the specified listener. You -// must specify either a listener or one or more rules. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeRules for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeRuleNotFoundException "RuleNotFound" -// The specified rule does not exist. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol is not supported. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeRules -func (c *ELBV2) DescribeRules(input *DescribeRulesInput) (*DescribeRulesOutput, error) { - req, out := c.DescribeRulesRequest(input) - return out, req.Send() -} - -// DescribeRulesWithContext is the same as DescribeRules with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeRules for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeRulesWithContext(ctx aws.Context, input *DescribeRulesInput, opts ...request.Option) (*DescribeRulesOutput, error) { - req, out := c.DescribeRulesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeSSLPolicies = "DescribeSSLPolicies" - -// DescribeSSLPoliciesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeSSLPolicies operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeSSLPolicies for more information on using the DescribeSSLPolicies -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeSSLPoliciesRequest method. -// req, resp := client.DescribeSSLPoliciesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeSSLPolicies -func (c *ELBV2) DescribeSSLPoliciesRequest(input *DescribeSSLPoliciesInput) (req *request.Request, output *DescribeSSLPoliciesOutput) { - op := &request.Operation{ - Name: opDescribeSSLPolicies, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeSSLPoliciesInput{} - } - - output = &DescribeSSLPoliciesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeSSLPolicies API operation for Elastic Load Balancing. -// -// Describes the specified policies or all policies used for SSL negotiation. -// -// For more information, see Security policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies) -// in the Application Load Balancers Guide or Security policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies) -// in the Network Load Balancers Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeSSLPolicies for usage and error information. -// -// Returned Error Codes: -// - ErrCodeSSLPolicyNotFoundException "SSLPolicyNotFound" -// The specified SSL policy does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeSSLPolicies -func (c *ELBV2) DescribeSSLPolicies(input *DescribeSSLPoliciesInput) (*DescribeSSLPoliciesOutput, error) { - req, out := c.DescribeSSLPoliciesRequest(input) - return out, req.Send() -} - -// DescribeSSLPoliciesWithContext is the same as DescribeSSLPolicies with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeSSLPolicies for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeSSLPoliciesWithContext(ctx aws.Context, input *DescribeSSLPoliciesInput, opts ...request.Option) (*DescribeSSLPoliciesOutput, error) { - req, out := c.DescribeSSLPoliciesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeTags = "DescribeTags" - -// DescribeTagsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeTags for more information on using the DescribeTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // 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) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTags -func (c *ELBV2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Request, output *DescribeTagsOutput) { - op := &request.Operation{ - Name: opDescribeTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeTagsInput{} - } - - output = &DescribeTagsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeTags API operation for Elastic Load Balancing. -// -// Describes the tags for the specified Elastic Load Balancing resources. You -// can describe the tags for one or more Application Load Balancers, Network -// Load Balancers, Gateway Load Balancers, target groups, listeners, or rules. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeTags for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeRuleNotFoundException "RuleNotFound" -// The specified rule does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTags -func (c *ELBV2) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error) { - req, out := c.DescribeTagsRequest(input) - return out, req.Send() -} - -// DescribeTagsWithContext is the same as DescribeTags with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeTagsWithContext(ctx aws.Context, input *DescribeTagsInput, opts ...request.Option) (*DescribeTagsOutput, error) { - req, out := c.DescribeTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeTargetGroupAttributes = "DescribeTargetGroupAttributes" - -// DescribeTargetGroupAttributesRequest generates a "aws/request.Request" representing the -// client's request for the DescribeTargetGroupAttributes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeTargetGroupAttributes for more information on using the DescribeTargetGroupAttributes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeTargetGroupAttributesRequest method. -// req, resp := client.DescribeTargetGroupAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroupAttributes -func (c *ELBV2) DescribeTargetGroupAttributesRequest(input *DescribeTargetGroupAttributesInput) (req *request.Request, output *DescribeTargetGroupAttributesOutput) { - op := &request.Operation{ - Name: opDescribeTargetGroupAttributes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeTargetGroupAttributesInput{} - } - - output = &DescribeTargetGroupAttributesOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeTargetGroupAttributes API operation for Elastic Load Balancing. -// -// Describes the attributes for the specified target group. -// -// For more information, see the following: -// -// - Target group attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-attributes) -// in the Application Load Balancers Guide -// -// - Target group attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#target-group-attributes) -// in the Network Load Balancers Guide -// -// - Target group attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/target-groups.html#target-group-attributes) -// in the Gateway Load Balancers Guide -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeTargetGroupAttributes for usage and error information. -// -// Returned Error Codes: -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroupAttributes -func (c *ELBV2) DescribeTargetGroupAttributes(input *DescribeTargetGroupAttributesInput) (*DescribeTargetGroupAttributesOutput, error) { - req, out := c.DescribeTargetGroupAttributesRequest(input) - return out, req.Send() -} - -// DescribeTargetGroupAttributesWithContext is the same as DescribeTargetGroupAttributes with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeTargetGroupAttributes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeTargetGroupAttributesWithContext(ctx aws.Context, input *DescribeTargetGroupAttributesInput, opts ...request.Option) (*DescribeTargetGroupAttributesOutput, error) { - req, out := c.DescribeTargetGroupAttributesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeTargetGroups = "DescribeTargetGroups" - -// DescribeTargetGroupsRequest generates a "aws/request.Request" representing the -// client's request for the DescribeTargetGroups operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeTargetGroups for more information on using the DescribeTargetGroups -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeTargetGroupsRequest method. -// req, resp := client.DescribeTargetGroupsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroups -func (c *ELBV2) DescribeTargetGroupsRequest(input *DescribeTargetGroupsInput) (req *request.Request, output *DescribeTargetGroupsOutput) { - op := &request.Operation{ - Name: opDescribeTargetGroups, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "", - TruncationToken: "", - }, - } - - if input == nil { - input = &DescribeTargetGroupsInput{} - } - - output = &DescribeTargetGroupsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeTargetGroups API operation for Elastic Load Balancing. -// -// Describes the specified target groups or all of your target groups. By default, -// all target groups are described. Alternatively, you can specify one of the -// following to filter the results: the ARN of the load balancer, the names -// of one or more target groups, or the ARNs of one or more target groups. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeTargetGroups for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroups -func (c *ELBV2) DescribeTargetGroups(input *DescribeTargetGroupsInput) (*DescribeTargetGroupsOutput, error) { - req, out := c.DescribeTargetGroupsRequest(input) - return out, req.Send() -} - -// DescribeTargetGroupsWithContext is the same as DescribeTargetGroups with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeTargetGroups for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeTargetGroupsWithContext(ctx aws.Context, input *DescribeTargetGroupsInput, opts ...request.Option) (*DescribeTargetGroupsOutput, error) { - req, out := c.DescribeTargetGroupsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeTargetGroupsPages iterates over the pages of a DescribeTargetGroups operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeTargetGroups 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 DescribeTargetGroups operation. -// pageNum := 0 -// err := client.DescribeTargetGroupsPages(params, -// func(page *elbv2.DescribeTargetGroupsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *ELBV2) DescribeTargetGroupsPages(input *DescribeTargetGroupsInput, fn func(*DescribeTargetGroupsOutput, bool) bool) error { - return c.DescribeTargetGroupsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeTargetGroupsPagesWithContext same as DescribeTargetGroupsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeTargetGroupsPagesWithContext(ctx aws.Context, input *DescribeTargetGroupsInput, fn func(*DescribeTargetGroupsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeTargetGroupsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeTargetGroupsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeTargetGroupsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeTargetHealth = "DescribeTargetHealth" - -// DescribeTargetHealthRequest generates a "aws/request.Request" representing the -// client's request for the DescribeTargetHealth operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeTargetHealth for more information on using the DescribeTargetHealth -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeTargetHealthRequest method. -// req, resp := client.DescribeTargetHealthRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetHealth -func (c *ELBV2) DescribeTargetHealthRequest(input *DescribeTargetHealthInput) (req *request.Request, output *DescribeTargetHealthOutput) { - op := &request.Operation{ - Name: opDescribeTargetHealth, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeTargetHealthInput{} - } - - output = &DescribeTargetHealthOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeTargetHealth API operation for Elastic Load Balancing. -// -// Describes the health of the specified targets or all of your targets. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation DescribeTargetHealth for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeInvalidTargetException "InvalidTarget" -// The specified target does not exist, is not in the same VPC as the target -// group, or has an unsupported instance type. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeHealthUnavailableException "HealthUnavailable" -// The health of the specified targets could not be retrieved due to an internal -// error. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetHealth -func (c *ELBV2) DescribeTargetHealth(input *DescribeTargetHealthInput) (*DescribeTargetHealthOutput, error) { - req, out := c.DescribeTargetHealthRequest(input) - return out, req.Send() -} - -// DescribeTargetHealthWithContext is the same as DescribeTargetHealth with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeTargetHealth for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) DescribeTargetHealthWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.Option) (*DescribeTargetHealthOutput, error) { - req, out := c.DescribeTargetHealthRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opModifyListener = "ModifyListener" - -// ModifyListenerRequest generates a "aws/request.Request" representing the -// client's request for the ModifyListener operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ModifyListener for more information on using the ModifyListener -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ModifyListenerRequest method. -// req, resp := client.ModifyListenerRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyListener -func (c *ELBV2) ModifyListenerRequest(input *ModifyListenerInput) (req *request.Request, output *ModifyListenerOutput) { - op := &request.Operation{ - Name: opModifyListener, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyListenerInput{} - } - - output = &ModifyListenerOutput{} - req = c.newRequest(op, input, output) - return -} - -// ModifyListener API operation for Elastic Load Balancing. -// -// Replaces the specified properties of the specified listener. Any properties -// that you do not specify remain unchanged. -// -// Changing the protocol from HTTPS to HTTP, or from TLS to TCP, removes the -// security policy and default certificate properties. If you change the protocol -// from HTTP to HTTPS, or from TCP to TLS, you must add the security policy -// and default certificate properties. -// -// To add an item to a list, remove an item from a list, or update an item in -// a list, you must provide the entire list. For example, to add an action, -// specify a list with the current actions plus the new action. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ModifyListener for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeDuplicateListenerException "DuplicateListener" -// A listener with the specified port already exists. -// -// - ErrCodeTooManyListenersException "TooManyListeners" -// You've reached the limit on the number of listeners per load balancer. -// -// - ErrCodeTooManyCertificatesException "TooManyCertificates" -// You've reached the limit on the number of certificates per load balancer. -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" -// You've reached the limit on the number of load balancers per target group. -// -// - ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" -// The specified configuration is not valid with this protocol. -// -// - ErrCodeSSLPolicyNotFoundException "SSLPolicyNotFound" -// The specified SSL policy does not exist. -// -// - ErrCodeCertificateNotFoundException "CertificateNotFound" -// The specified certificate does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol is not supported. -// -// - ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" -// You've reached the limit on the number of times a target can be registered -// with a load balancer. -// -// - ErrCodeTooManyTargetsException "TooManyTargets" -// You've reached the limit on the number of targets. -// -// - ErrCodeTooManyActionsException "TooManyActions" -// You've reached the limit on the number of actions per rule. -// -// - ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" -// The requested action is not valid. -// -// - ErrCodeTooManyUniqueTargetGroupsPerLoadBalancerException "TooManyUniqueTargetGroupsPerLoadBalancer" -// You've reached the limit on the number of unique target groups per load balancer -// across all listeners. If a target group is used by multiple actions for a -// load balancer, it is counted as only one use. -// -// - ErrCodeALPNPolicyNotSupportedException "ALPNPolicyNotFound" -// The specified ALPN policy is not supported. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyListener -func (c *ELBV2) ModifyListener(input *ModifyListenerInput) (*ModifyListenerOutput, error) { - req, out := c.ModifyListenerRequest(input) - return out, req.Send() -} - -// ModifyListenerWithContext is the same as ModifyListener with the addition of -// the ability to pass a context and additional request options. -// -// See ModifyListener for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) ModifyListenerWithContext(ctx aws.Context, input *ModifyListenerInput, opts ...request.Option) (*ModifyListenerOutput, error) { - req, out := c.ModifyListenerRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opModifyLoadBalancerAttributes = "ModifyLoadBalancerAttributes" - -// ModifyLoadBalancerAttributesRequest generates a "aws/request.Request" representing the -// client's request for the ModifyLoadBalancerAttributes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ModifyLoadBalancerAttributes for more information on using the ModifyLoadBalancerAttributes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ModifyLoadBalancerAttributesRequest method. -// req, resp := client.ModifyLoadBalancerAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyLoadBalancerAttributes -func (c *ELBV2) ModifyLoadBalancerAttributesRequest(input *ModifyLoadBalancerAttributesInput) (req *request.Request, output *ModifyLoadBalancerAttributesOutput) { - op := &request.Operation{ - Name: opModifyLoadBalancerAttributes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyLoadBalancerAttributesInput{} - } - - output = &ModifyLoadBalancerAttributesOutput{} - req = c.newRequest(op, input, output) - return -} - -// ModifyLoadBalancerAttributes API operation for Elastic Load Balancing. -// -// Modifies the specified attributes of the specified Application Load Balancer, -// Network Load Balancer, or Gateway Load Balancer. -// -// If any of the specified attributes can't be modified as requested, the call -// fails. Any existing attributes that you do not modify retain their current -// values. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ModifyLoadBalancerAttributes for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyLoadBalancerAttributes -func (c *ELBV2) ModifyLoadBalancerAttributes(input *ModifyLoadBalancerAttributesInput) (*ModifyLoadBalancerAttributesOutput, error) { - req, out := c.ModifyLoadBalancerAttributesRequest(input) - return out, req.Send() -} - -// ModifyLoadBalancerAttributesWithContext is the same as ModifyLoadBalancerAttributes with the addition of -// the ability to pass a context and additional request options. -// -// See ModifyLoadBalancerAttributes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) ModifyLoadBalancerAttributesWithContext(ctx aws.Context, input *ModifyLoadBalancerAttributesInput, opts ...request.Option) (*ModifyLoadBalancerAttributesOutput, error) { - req, out := c.ModifyLoadBalancerAttributesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opModifyRule = "ModifyRule" - -// ModifyRuleRequest generates a "aws/request.Request" representing the -// client's request for the ModifyRule operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ModifyRule for more information on using the ModifyRule -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ModifyRuleRequest method. -// req, resp := client.ModifyRuleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyRule -func (c *ELBV2) ModifyRuleRequest(input *ModifyRuleInput) (req *request.Request, output *ModifyRuleOutput) { - op := &request.Operation{ - Name: opModifyRule, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyRuleInput{} - } - - output = &ModifyRuleOutput{} - req = c.newRequest(op, input, output) - return -} - -// ModifyRule API operation for Elastic Load Balancing. -// -// Replaces the specified properties of the specified rule. Any properties that -// you do not specify are unchanged. -// -// To add an item to a list, remove an item from a list, or update an item in -// a list, you must provide the entire list. For example, to add an action, -// specify a list with the current actions plus the new action. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ModifyRule for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" -// You've reached the limit on the number of load balancers per target group. -// -// - ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" -// The specified configuration is not valid with this protocol. -// -// - ErrCodeRuleNotFoundException "RuleNotFound" -// The specified rule does not exist. -// -// - ErrCodeOperationNotPermittedException "OperationNotPermitted" -// This operation is not allowed. -// -// - ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" -// You've reached the limit on the number of times a target can be registered -// with a load balancer. -// -// - ErrCodeTooManyTargetsException "TooManyTargets" -// You've reached the limit on the number of targets. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeUnsupportedProtocolException "UnsupportedProtocol" -// The specified protocol is not supported. -// -// - ErrCodeTooManyActionsException "TooManyActions" -// You've reached the limit on the number of actions per rule. -// -// - ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" -// The requested action is not valid. -// -// - ErrCodeTooManyUniqueTargetGroupsPerLoadBalancerException "TooManyUniqueTargetGroupsPerLoadBalancer" -// You've reached the limit on the number of unique target groups per load balancer -// across all listeners. If a target group is used by multiple actions for a -// load balancer, it is counted as only one use. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyRule -func (c *ELBV2) ModifyRule(input *ModifyRuleInput) (*ModifyRuleOutput, error) { - req, out := c.ModifyRuleRequest(input) - return out, req.Send() -} - -// ModifyRuleWithContext is the same as ModifyRule with the addition of -// the ability to pass a context and additional request options. -// -// See ModifyRule for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) ModifyRuleWithContext(ctx aws.Context, input *ModifyRuleInput, opts ...request.Option) (*ModifyRuleOutput, error) { - req, out := c.ModifyRuleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opModifyTargetGroup = "ModifyTargetGroup" - -// ModifyTargetGroupRequest generates a "aws/request.Request" representing the -// client's request for the ModifyTargetGroup operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ModifyTargetGroup for more information on using the ModifyTargetGroup -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ModifyTargetGroupRequest method. -// req, resp := client.ModifyTargetGroupRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroup -func (c *ELBV2) ModifyTargetGroupRequest(input *ModifyTargetGroupInput) (req *request.Request, output *ModifyTargetGroupOutput) { - op := &request.Operation{ - Name: opModifyTargetGroup, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyTargetGroupInput{} - } - - output = &ModifyTargetGroupOutput{} - req = c.newRequest(op, input, output) - return -} - -// ModifyTargetGroup API operation for Elastic Load Balancing. -// -// Modifies the health checks used when evaluating the health state of the targets -// in the specified target group. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ModifyTargetGroup for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroup -func (c *ELBV2) ModifyTargetGroup(input *ModifyTargetGroupInput) (*ModifyTargetGroupOutput, error) { - req, out := c.ModifyTargetGroupRequest(input) - return out, req.Send() -} - -// ModifyTargetGroupWithContext is the same as ModifyTargetGroup with the addition of -// the ability to pass a context and additional request options. -// -// See ModifyTargetGroup for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) ModifyTargetGroupWithContext(ctx aws.Context, input *ModifyTargetGroupInput, opts ...request.Option) (*ModifyTargetGroupOutput, error) { - req, out := c.ModifyTargetGroupRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opModifyTargetGroupAttributes = "ModifyTargetGroupAttributes" - -// ModifyTargetGroupAttributesRequest generates a "aws/request.Request" representing the -// client's request for the ModifyTargetGroupAttributes operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ModifyTargetGroupAttributes for more information on using the ModifyTargetGroupAttributes -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ModifyTargetGroupAttributesRequest method. -// req, resp := client.ModifyTargetGroupAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroupAttributes -func (c *ELBV2) ModifyTargetGroupAttributesRequest(input *ModifyTargetGroupAttributesInput) (req *request.Request, output *ModifyTargetGroupAttributesOutput) { - op := &request.Operation{ - Name: opModifyTargetGroupAttributes, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyTargetGroupAttributesInput{} - } - - output = &ModifyTargetGroupAttributesOutput{} - req = c.newRequest(op, input, output) - return -} - -// ModifyTargetGroupAttributes API operation for Elastic Load Balancing. -// -// Modifies the specified attributes of the specified target group. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation ModifyTargetGroupAttributes for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroupAttributes -func (c *ELBV2) ModifyTargetGroupAttributes(input *ModifyTargetGroupAttributesInput) (*ModifyTargetGroupAttributesOutput, error) { - req, out := c.ModifyTargetGroupAttributesRequest(input) - return out, req.Send() -} - -// ModifyTargetGroupAttributesWithContext is the same as ModifyTargetGroupAttributes with the addition of -// the ability to pass a context and additional request options. -// -// See ModifyTargetGroupAttributes for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) ModifyTargetGroupAttributesWithContext(ctx aws.Context, input *ModifyTargetGroupAttributesInput, opts ...request.Option) (*ModifyTargetGroupAttributesOutput, error) { - req, out := c.ModifyTargetGroupAttributesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRegisterTargets = "RegisterTargets" - -// RegisterTargetsRequest generates a "aws/request.Request" representing the -// client's request for the RegisterTargets operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RegisterTargets for more information on using the RegisterTargets -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RegisterTargetsRequest method. -// req, resp := client.RegisterTargetsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RegisterTargets -func (c *ELBV2) RegisterTargetsRequest(input *RegisterTargetsInput) (req *request.Request, output *RegisterTargetsOutput) { - op := &request.Operation{ - Name: opRegisterTargets, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RegisterTargetsInput{} - } - - output = &RegisterTargetsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// RegisterTargets API operation for Elastic Load Balancing. -// -// Registers the specified targets with the specified target group. -// -// If the target is an EC2 instance, it must be in the running state when you -// register it. -// -// By default, the load balancer routes requests to registered targets using -// the protocol and port for the target group. Alternatively, you can override -// the port for a target when you register it. You can register each EC2 instance -// or IP address with the same target group multiple times using different ports. -// -// With a Network Load Balancer, you cannot register instances by instance ID -// if they have the following instance types: C1, CC1, CC2, CG1, CG2, CR1, CS1, -// G1, G2, HI1, HS1, M1, M2, M3, and T1. You can register instances of these -// types by IP address. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation RegisterTargets for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeTooManyTargetsException "TooManyTargets" -// You've reached the limit on the number of targets. -// -// - ErrCodeInvalidTargetException "InvalidTarget" -// The specified target does not exist, is not in the same VPC as the target -// group, or has an unsupported instance type. -// -// - ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" -// You've reached the limit on the number of times a target can be registered -// with a load balancer. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RegisterTargets -func (c *ELBV2) RegisterTargets(input *RegisterTargetsInput) (*RegisterTargetsOutput, error) { - req, out := c.RegisterTargetsRequest(input) - return out, req.Send() -} - -// RegisterTargetsWithContext is the same as RegisterTargets with the addition of -// the ability to pass a context and additional request options. -// -// See RegisterTargets for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) RegisterTargetsWithContext(ctx aws.Context, input *RegisterTargetsInput, opts ...request.Option) (*RegisterTargetsOutput, error) { - req, out := c.RegisterTargetsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRemoveListenerCertificates = "RemoveListenerCertificates" - -// RemoveListenerCertificatesRequest generates a "aws/request.Request" representing the -// client's request for the RemoveListenerCertificates operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RemoveListenerCertificates for more information on using the RemoveListenerCertificates -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RemoveListenerCertificatesRequest method. -// req, resp := client.RemoveListenerCertificatesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveListenerCertificates -func (c *ELBV2) RemoveListenerCertificatesRequest(input *RemoveListenerCertificatesInput) (req *request.Request, output *RemoveListenerCertificatesOutput) { - op := &request.Operation{ - Name: opRemoveListenerCertificates, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RemoveListenerCertificatesInput{} - } - - output = &RemoveListenerCertificatesOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// RemoveListenerCertificates API operation for Elastic Load Balancing. -// -// Removes the specified certificate from the certificate list for the specified -// HTTPS or TLS listener. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation RemoveListenerCertificates for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeOperationNotPermittedException "OperationNotPermitted" -// This operation is not allowed. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveListenerCertificates -func (c *ELBV2) RemoveListenerCertificates(input *RemoveListenerCertificatesInput) (*RemoveListenerCertificatesOutput, error) { - req, out := c.RemoveListenerCertificatesRequest(input) - return out, req.Send() -} - -// RemoveListenerCertificatesWithContext is the same as RemoveListenerCertificates with the addition of -// the ability to pass a context and additional request options. -// -// See RemoveListenerCertificates for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) RemoveListenerCertificatesWithContext(ctx aws.Context, input *RemoveListenerCertificatesInput, opts ...request.Option) (*RemoveListenerCertificatesOutput, error) { - req, out := c.RemoveListenerCertificatesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRemoveTags = "RemoveTags" - -// RemoveTagsRequest generates a "aws/request.Request" representing the -// client's request for the RemoveTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RemoveTags for more information on using the RemoveTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RemoveTagsRequest method. -// req, resp := client.RemoveTagsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveTags -func (c *ELBV2) RemoveTagsRequest(input *RemoveTagsInput) (req *request.Request, output *RemoveTagsOutput) { - op := &request.Operation{ - Name: opRemoveTags, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RemoveTagsInput{} - } - - output = &RemoveTagsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// RemoveTags API operation for Elastic Load Balancing. -// -// Removes the specified tags from the specified Elastic Load Balancing resources. -// You can remove the tags for one or more Application Load Balancers, Network -// Load Balancers, Gateway Load Balancers, target groups, listeners, or rules. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation RemoveTags for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" -// The specified target group does not exist. -// -// - ErrCodeListenerNotFoundException "ListenerNotFound" -// The specified listener does not exist. -// -// - ErrCodeRuleNotFoundException "RuleNotFound" -// The specified rule does not exist. -// -// - ErrCodeTooManyTagsException "TooManyTags" -// You've reached the limit on the number of tags per load balancer. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveTags -func (c *ELBV2) RemoveTags(input *RemoveTagsInput) (*RemoveTagsOutput, error) { - req, out := c.RemoveTagsRequest(input) - return out, req.Send() -} - -// RemoveTagsWithContext is the same as RemoveTags with the addition of -// the ability to pass a context and additional request options. -// -// See RemoveTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) RemoveTagsWithContext(ctx aws.Context, input *RemoveTagsInput, opts ...request.Option) (*RemoveTagsOutput, error) { - req, out := c.RemoveTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetIpAddressType = "SetIpAddressType" - -// SetIpAddressTypeRequest generates a "aws/request.Request" representing the -// client's request for the SetIpAddressType operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetIpAddressType for more information on using the SetIpAddressType -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetIpAddressTypeRequest method. -// req, resp := client.SetIpAddressTypeRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetIpAddressType -func (c *ELBV2) SetIpAddressTypeRequest(input *SetIpAddressTypeInput) (req *request.Request, output *SetIpAddressTypeOutput) { - op := &request.Operation{ - Name: opSetIpAddressType, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetIpAddressTypeInput{} - } - - output = &SetIpAddressTypeOutput{} - req = c.newRequest(op, input, output) - return -} - -// SetIpAddressType API operation for Elastic Load Balancing. -// -// Sets the type of IP addresses used by the subnets of the specified load balancer. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation SetIpAddressType for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeInvalidSubnetException "InvalidSubnet" -// The specified subnet is out of available addresses. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetIpAddressType -func (c *ELBV2) SetIpAddressType(input *SetIpAddressTypeInput) (*SetIpAddressTypeOutput, error) { - req, out := c.SetIpAddressTypeRequest(input) - return out, req.Send() -} - -// SetIpAddressTypeWithContext is the same as SetIpAddressType with the addition of -// the ability to pass a context and additional request options. -// -// See SetIpAddressType for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) SetIpAddressTypeWithContext(ctx aws.Context, input *SetIpAddressTypeInput, opts ...request.Option) (*SetIpAddressTypeOutput, error) { - req, out := c.SetIpAddressTypeRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetRulePriorities = "SetRulePriorities" - -// SetRulePrioritiesRequest generates a "aws/request.Request" representing the -// client's request for the SetRulePriorities operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetRulePriorities for more information on using the SetRulePriorities -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetRulePrioritiesRequest method. -// req, resp := client.SetRulePrioritiesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetRulePriorities -func (c *ELBV2) SetRulePrioritiesRequest(input *SetRulePrioritiesInput) (req *request.Request, output *SetRulePrioritiesOutput) { - op := &request.Operation{ - Name: opSetRulePriorities, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetRulePrioritiesInput{} - } - - output = &SetRulePrioritiesOutput{} - req = c.newRequest(op, input, output) - return -} - -// SetRulePriorities API operation for Elastic Load Balancing. -// -// Sets the priorities of the specified rules. -// -// You can reorder the rules as long as there are no priority conflicts in the -// new order. Any existing rules that you do not specify retain their current -// priority. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation SetRulePriorities for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeRuleNotFoundException "RuleNotFound" -// The specified rule does not exist. -// -// - ErrCodePriorityInUseException "PriorityInUse" -// The specified priority is in use. -// -// - ErrCodeOperationNotPermittedException "OperationNotPermitted" -// This operation is not allowed. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetRulePriorities -func (c *ELBV2) SetRulePriorities(input *SetRulePrioritiesInput) (*SetRulePrioritiesOutput, error) { - req, out := c.SetRulePrioritiesRequest(input) - return out, req.Send() -} - -// SetRulePrioritiesWithContext is the same as SetRulePriorities with the addition of -// the ability to pass a context and additional request options. -// -// See SetRulePriorities for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) SetRulePrioritiesWithContext(ctx aws.Context, input *SetRulePrioritiesInput, opts ...request.Option) (*SetRulePrioritiesOutput, error) { - req, out := c.SetRulePrioritiesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetSecurityGroups = "SetSecurityGroups" - -// SetSecurityGroupsRequest generates a "aws/request.Request" representing the -// client's request for the SetSecurityGroups operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetSecurityGroups for more information on using the SetSecurityGroups -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetSecurityGroupsRequest method. -// req, resp := client.SetSecurityGroupsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSecurityGroups -func (c *ELBV2) SetSecurityGroupsRequest(input *SetSecurityGroupsInput) (req *request.Request, output *SetSecurityGroupsOutput) { - op := &request.Operation{ - Name: opSetSecurityGroups, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetSecurityGroupsInput{} - } - - output = &SetSecurityGroupsOutput{} - req = c.newRequest(op, input, output) - return -} - -// SetSecurityGroups API operation for Elastic Load Balancing. -// -// Associates the specified security groups with the specified Application Load -// Balancer. The specified security groups override the previously associated -// security groups. -// -// You can't specify a security group for a Network Load Balancer or Gateway -// Load Balancer. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation SetSecurityGroups for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeInvalidSecurityGroupException "InvalidSecurityGroup" -// The specified security group does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSecurityGroups -func (c *ELBV2) SetSecurityGroups(input *SetSecurityGroupsInput) (*SetSecurityGroupsOutput, error) { - req, out := c.SetSecurityGroupsRequest(input) - return out, req.Send() -} - -// SetSecurityGroupsWithContext is the same as SetSecurityGroups with the addition of -// the ability to pass a context and additional request options. -// -// See SetSecurityGroups for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) SetSecurityGroupsWithContext(ctx aws.Context, input *SetSecurityGroupsInput, opts ...request.Option) (*SetSecurityGroupsOutput, error) { - req, out := c.SetSecurityGroupsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSetSubnets = "SetSubnets" - -// SetSubnetsRequest generates a "aws/request.Request" representing the -// client's request for the SetSubnets operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SetSubnets for more information on using the SetSubnets -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SetSubnetsRequest method. -// req, resp := client.SetSubnetsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSubnets -func (c *ELBV2) SetSubnetsRequest(input *SetSubnetsInput) (req *request.Request, output *SetSubnetsOutput) { - op := &request.Operation{ - Name: opSetSubnets, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SetSubnetsInput{} - } - - output = &SetSubnetsOutput{} - req = c.newRequest(op, input, output) - return -} - -// SetSubnets API operation for Elastic Load Balancing. -// -// Enables the Availability Zones for the specified public subnets for the specified -// Application Load Balancer or Network Load Balancer. The specified subnets -// replace the previously enabled subnets. -// -// When you specify subnets for a Network Load Balancer, you must include all -// subnets that were enabled previously, with their existing configurations, -// plus any additional subnets. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Elastic Load Balancing's -// API operation SetSubnets for usage and error information. -// -// Returned Error Codes: -// -// - ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" -// The specified load balancer does not exist. -// -// - ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" -// The requested configuration is not valid. -// -// - ErrCodeSubnetNotFoundException "SubnetNotFound" -// The specified subnet does not exist. -// -// - ErrCodeInvalidSubnetException "InvalidSubnet" -// The specified subnet is out of available addresses. -// -// - ErrCodeAllocationIdNotFoundException "AllocationIdNotFound" -// The specified allocation ID does not exist. -// -// - ErrCodeAvailabilityZoneNotSupportedException "AvailabilityZoneNotSupported" -// The specified Availability Zone is not supported. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSubnets -func (c *ELBV2) SetSubnets(input *SetSubnetsInput) (*SetSubnetsOutput, error) { - req, out := c.SetSubnetsRequest(input) - return out, req.Send() -} - -// SetSubnetsWithContext is the same as SetSubnets with the addition of -// the ability to pass a context and additional request options. -// -// See SetSubnets for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) SetSubnetsWithContext(ctx aws.Context, input *SetSubnetsInput, opts ...request.Option) (*SetSubnetsOutput, error) { - req, out := c.SetSubnetsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// Information about an action. -// -// Each rule must include exactly one of the following types of actions: forward, -// fixed-response, or redirect, and it must be the last action to be performed. -type Action struct { - _ struct{} `type:"structure"` - - // [HTTPS listeners] Information for using Amazon Cognito to authenticate users. - // Specify only when Type is authenticate-cognito. - AuthenticateCognitoConfig *AuthenticateCognitoActionConfig `type:"structure"` - - // [HTTPS listeners] Information about an identity provider that is compliant - // with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc. - AuthenticateOidcConfig *AuthenticateOidcActionConfig `type:"structure"` - - // [Application Load Balancer] Information for creating an action that returns - // a custom HTTP response. Specify only when Type is fixed-response. - FixedResponseConfig *FixedResponseActionConfig `type:"structure"` - - // Information for creating an action that distributes requests among one or - // more target groups. For Network Load Balancers, you can specify a single - // target group. Specify only when Type is forward. If you specify both ForwardConfig - // and TargetGroupArn, you can specify only one target group using ForwardConfig - // and it must be the same target group specified in TargetGroupArn. - ForwardConfig *ForwardActionConfig `type:"structure"` - - // The order for the action. This value is required for rules with multiple - // actions. The action with the lowest value for order is performed first. - Order *int64 `min:"1" type:"integer"` - - // [Application Load Balancer] Information for creating a redirect action. Specify - // only when Type is redirect. - RedirectConfig *RedirectActionConfig `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. Specify only when Type - // is forward and you want to route to a single target group. To route to one - // or more target groups, use ForwardConfig instead. - TargetGroupArn *string `type:"string"` - - // The type of action. - // - // Type is a required field - Type *string `type:"string" required:"true" enum:"ActionTypeEnum"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Action) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Action) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Action) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Action"} - if s.Order != nil && *s.Order < 1 { - invalidParams.Add(request.NewErrParamMinValue("Order", 1)) - } - if s.Type == nil { - invalidParams.Add(request.NewErrParamRequired("Type")) - } - if s.AuthenticateCognitoConfig != nil { - if err := s.AuthenticateCognitoConfig.Validate(); err != nil { - invalidParams.AddNested("AuthenticateCognitoConfig", err.(request.ErrInvalidParams)) - } - } - if s.AuthenticateOidcConfig != nil { - if err := s.AuthenticateOidcConfig.Validate(); err != nil { - invalidParams.AddNested("AuthenticateOidcConfig", err.(request.ErrInvalidParams)) - } - } - if s.FixedResponseConfig != nil { - if err := s.FixedResponseConfig.Validate(); err != nil { - invalidParams.AddNested("FixedResponseConfig", err.(request.ErrInvalidParams)) - } - } - if s.RedirectConfig != nil { - if err := s.RedirectConfig.Validate(); err != nil { - invalidParams.AddNested("RedirectConfig", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAuthenticateCognitoConfig sets the AuthenticateCognitoConfig field's value. -func (s *Action) SetAuthenticateCognitoConfig(v *AuthenticateCognitoActionConfig) *Action { - s.AuthenticateCognitoConfig = v - return s -} - -// SetAuthenticateOidcConfig sets the AuthenticateOidcConfig field's value. -func (s *Action) SetAuthenticateOidcConfig(v *AuthenticateOidcActionConfig) *Action { - s.AuthenticateOidcConfig = v - return s -} - -// SetFixedResponseConfig sets the FixedResponseConfig field's value. -func (s *Action) SetFixedResponseConfig(v *FixedResponseActionConfig) *Action { - s.FixedResponseConfig = v - return s -} - -// SetForwardConfig sets the ForwardConfig field's value. -func (s *Action) SetForwardConfig(v *ForwardActionConfig) *Action { - s.ForwardConfig = v - return s -} - -// SetOrder sets the Order field's value. -func (s *Action) SetOrder(v int64) *Action { - s.Order = &v - return s -} - -// SetRedirectConfig sets the RedirectConfig field's value. -func (s *Action) SetRedirectConfig(v *RedirectActionConfig) *Action { - s.RedirectConfig = v - return s -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *Action) SetTargetGroupArn(v string) *Action { - s.TargetGroupArn = &v - return s -} - -// SetType sets the Type field's value. -func (s *Action) SetType(v string) *Action { - s.Type = &v - return s -} - -type AddListenerCertificatesInput struct { - _ struct{} `type:"structure"` - - // The certificate to add. You can specify one certificate per call. Set CertificateArn - // to the certificate ARN but do not set IsDefault. - // - // Certificates is a required field - Certificates []*Certificate `type:"list" required:"true"` - - // The Amazon Resource Name (ARN) of the listener. - // - // ListenerArn is a required field - ListenerArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddListenerCertificatesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddListenerCertificatesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AddListenerCertificatesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AddListenerCertificatesInput"} - if s.Certificates == nil { - invalidParams.Add(request.NewErrParamRequired("Certificates")) - } - if s.ListenerArn == nil { - invalidParams.Add(request.NewErrParamRequired("ListenerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCertificates sets the Certificates field's value. -func (s *AddListenerCertificatesInput) SetCertificates(v []*Certificate) *AddListenerCertificatesInput { - s.Certificates = v - return s -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *AddListenerCertificatesInput) SetListenerArn(v string) *AddListenerCertificatesInput { - s.ListenerArn = &v - return s -} - -type AddListenerCertificatesOutput struct { - _ struct{} `type:"structure"` - - // Information about the certificates in the certificate list. - Certificates []*Certificate `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddListenerCertificatesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddListenerCertificatesOutput) GoString() string { - return s.String() -} - -// SetCertificates sets the Certificates field's value. -func (s *AddListenerCertificatesOutput) SetCertificates(v []*Certificate) *AddListenerCertificatesOutput { - s.Certificates = v - return s -} - -type AddTagsInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the resource. - // - // ResourceArns is a required field - ResourceArns []*string `type:"list" required:"true"` - - // The tags. - // - // Tags is a required field - Tags []*Tag `min:"1" type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AddTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AddTagsInput"} - if s.ResourceArns == nil { - invalidParams.Add(request.NewErrParamRequired("ResourceArns")) - } - if s.Tags == nil { - invalidParams.Add(request.NewErrParamRequired("Tags")) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetResourceArns sets the ResourceArns field's value. -func (s *AddTagsInput) SetResourceArns(v []*string) *AddTagsInput { - s.ResourceArns = v - return s -} - -// SetTags sets the Tags field's value. -func (s *AddTagsInput) SetTags(v []*Tag) *AddTagsInput { - s.Tags = v - return s -} - -type AddTagsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AddTagsOutput) GoString() string { - return s.String() -} - -// Request parameters to use when integrating with Amazon Cognito to authenticate -// users. -type AuthenticateCognitoActionConfig struct { - _ struct{} `type:"structure"` - - // The query parameters (up to 10) to include in the redirect request to the - // authorization endpoint. - AuthenticationRequestExtraParams map[string]*string `type:"map"` - - // The behavior if the user is not authenticated. The following are possible - // values: - // - // * deny - Return an HTTP 401 Unauthorized error. - // - // * allow - Allow the request to be forwarded to the target. - // - // * authenticate - Redirect the request to the IdP authorization endpoint. - // This is the default value. - OnUnauthenticatedRequest *string `type:"string" enum:"AuthenticateCognitoActionConditionalBehaviorEnum"` - - // The set of user claims to be requested from the IdP. The default is openid. - // - // To verify which scope values your IdP supports and how to separate multiple - // values, see the documentation for your IdP. - Scope *string `type:"string"` - - // The name of the cookie used to maintain session information. The default - // is AWSELBAuthSessionCookie. - SessionCookieName *string `type:"string"` - - // The maximum duration of the authentication session, in seconds. The default - // is 604800 seconds (7 days). - SessionTimeout *int64 `type:"long"` - - // The Amazon Resource Name (ARN) of the Amazon Cognito user pool. - // - // UserPoolArn is a required field - UserPoolArn *string `type:"string" required:"true"` - - // The ID of the Amazon Cognito user pool client. - // - // UserPoolClientId is a required field - UserPoolClientId *string `type:"string" required:"true"` - - // The domain prefix or fully-qualified domain name of the Amazon Cognito user - // pool. - // - // UserPoolDomain is a required field - UserPoolDomain *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AuthenticateCognitoActionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AuthenticateCognitoActionConfig) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AuthenticateCognitoActionConfig) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AuthenticateCognitoActionConfig"} - if s.UserPoolArn == nil { - invalidParams.Add(request.NewErrParamRequired("UserPoolArn")) - } - if s.UserPoolClientId == nil { - invalidParams.Add(request.NewErrParamRequired("UserPoolClientId")) - } - if s.UserPoolDomain == nil { - invalidParams.Add(request.NewErrParamRequired("UserPoolDomain")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAuthenticationRequestExtraParams sets the AuthenticationRequestExtraParams field's value. -func (s *AuthenticateCognitoActionConfig) SetAuthenticationRequestExtraParams(v map[string]*string) *AuthenticateCognitoActionConfig { - s.AuthenticationRequestExtraParams = v - return s -} - -// SetOnUnauthenticatedRequest sets the OnUnauthenticatedRequest field's value. -func (s *AuthenticateCognitoActionConfig) SetOnUnauthenticatedRequest(v string) *AuthenticateCognitoActionConfig { - s.OnUnauthenticatedRequest = &v - return s -} - -// SetScope sets the Scope field's value. -func (s *AuthenticateCognitoActionConfig) SetScope(v string) *AuthenticateCognitoActionConfig { - s.Scope = &v - return s -} - -// SetSessionCookieName sets the SessionCookieName field's value. -func (s *AuthenticateCognitoActionConfig) SetSessionCookieName(v string) *AuthenticateCognitoActionConfig { - s.SessionCookieName = &v - return s -} - -// SetSessionTimeout sets the SessionTimeout field's value. -func (s *AuthenticateCognitoActionConfig) SetSessionTimeout(v int64) *AuthenticateCognitoActionConfig { - s.SessionTimeout = &v - return s -} - -// SetUserPoolArn sets the UserPoolArn field's value. -func (s *AuthenticateCognitoActionConfig) SetUserPoolArn(v string) *AuthenticateCognitoActionConfig { - s.UserPoolArn = &v - return s -} - -// SetUserPoolClientId sets the UserPoolClientId field's value. -func (s *AuthenticateCognitoActionConfig) SetUserPoolClientId(v string) *AuthenticateCognitoActionConfig { - s.UserPoolClientId = &v - return s -} - -// SetUserPoolDomain sets the UserPoolDomain field's value. -func (s *AuthenticateCognitoActionConfig) SetUserPoolDomain(v string) *AuthenticateCognitoActionConfig { - s.UserPoolDomain = &v - return s -} - -// Request parameters when using an identity provider (IdP) that is compliant -// with OpenID Connect (OIDC) to authenticate users. -type AuthenticateOidcActionConfig struct { - _ struct{} `type:"structure"` - - // The query parameters (up to 10) to include in the redirect request to the - // authorization endpoint. - AuthenticationRequestExtraParams map[string]*string `type:"map"` - - // The authorization endpoint of the IdP. This must be a full URL, including - // the HTTPS protocol, the domain, and the path. - // - // AuthorizationEndpoint is a required field - AuthorizationEndpoint *string `type:"string" required:"true"` - - // The OAuth 2.0 client identifier. - // - // ClientId is a required field - ClientId *string `type:"string" required:"true"` - - // The OAuth 2.0 client secret. This parameter is required if you are creating - // a rule. If you are modifying a rule, you can omit this parameter if you set - // UseExistingClientSecret to true. - ClientSecret *string `type:"string"` - - // The OIDC issuer identifier of the IdP. This must be a full URL, including - // the HTTPS protocol, the domain, and the path. - // - // Issuer is a required field - Issuer *string `type:"string" required:"true"` - - // The behavior if the user is not authenticated. The following are possible - // values: - // - // * deny - Return an HTTP 401 Unauthorized error. - // - // * allow - Allow the request to be forwarded to the target. - // - // * authenticate - Redirect the request to the IdP authorization endpoint. - // This is the default value. - OnUnauthenticatedRequest *string `type:"string" enum:"AuthenticateOidcActionConditionalBehaviorEnum"` - - // The set of user claims to be requested from the IdP. The default is openid. - // - // To verify which scope values your IdP supports and how to separate multiple - // values, see the documentation for your IdP. - Scope *string `type:"string"` - - // The name of the cookie used to maintain session information. The default - // is AWSELBAuthSessionCookie. - SessionCookieName *string `type:"string"` - - // The maximum duration of the authentication session, in seconds. The default - // is 604800 seconds (7 days). - SessionTimeout *int64 `type:"long"` - - // The token endpoint of the IdP. This must be a full URL, including the HTTPS - // protocol, the domain, and the path. - // - // TokenEndpoint is a required field - TokenEndpoint *string `type:"string" required:"true"` - - // Indicates whether to use the existing client secret when modifying a rule. - // If you are creating a rule, you can omit this parameter or set it to false. - UseExistingClientSecret *bool `type:"boolean"` - - // The user info endpoint of the IdP. This must be a full URL, including the - // HTTPS protocol, the domain, and the path. - // - // UserInfoEndpoint is a required field - UserInfoEndpoint *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AuthenticateOidcActionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AuthenticateOidcActionConfig) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AuthenticateOidcActionConfig) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AuthenticateOidcActionConfig"} - if s.AuthorizationEndpoint == nil { - invalidParams.Add(request.NewErrParamRequired("AuthorizationEndpoint")) - } - if s.ClientId == nil { - invalidParams.Add(request.NewErrParamRequired("ClientId")) - } - if s.Issuer == nil { - invalidParams.Add(request.NewErrParamRequired("Issuer")) - } - if s.TokenEndpoint == nil { - invalidParams.Add(request.NewErrParamRequired("TokenEndpoint")) - } - if s.UserInfoEndpoint == nil { - invalidParams.Add(request.NewErrParamRequired("UserInfoEndpoint")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAuthenticationRequestExtraParams sets the AuthenticationRequestExtraParams field's value. -func (s *AuthenticateOidcActionConfig) SetAuthenticationRequestExtraParams(v map[string]*string) *AuthenticateOidcActionConfig { - s.AuthenticationRequestExtraParams = v - return s -} - -// SetAuthorizationEndpoint sets the AuthorizationEndpoint field's value. -func (s *AuthenticateOidcActionConfig) SetAuthorizationEndpoint(v string) *AuthenticateOidcActionConfig { - s.AuthorizationEndpoint = &v - return s -} - -// SetClientId sets the ClientId field's value. -func (s *AuthenticateOidcActionConfig) SetClientId(v string) *AuthenticateOidcActionConfig { - s.ClientId = &v - return s -} - -// SetClientSecret sets the ClientSecret field's value. -func (s *AuthenticateOidcActionConfig) SetClientSecret(v string) *AuthenticateOidcActionConfig { - s.ClientSecret = &v - return s -} - -// SetIssuer sets the Issuer field's value. -func (s *AuthenticateOidcActionConfig) SetIssuer(v string) *AuthenticateOidcActionConfig { - s.Issuer = &v - return s -} - -// SetOnUnauthenticatedRequest sets the OnUnauthenticatedRequest field's value. -func (s *AuthenticateOidcActionConfig) SetOnUnauthenticatedRequest(v string) *AuthenticateOidcActionConfig { - s.OnUnauthenticatedRequest = &v - return s -} - -// SetScope sets the Scope field's value. -func (s *AuthenticateOidcActionConfig) SetScope(v string) *AuthenticateOidcActionConfig { - s.Scope = &v - return s -} - -// SetSessionCookieName sets the SessionCookieName field's value. -func (s *AuthenticateOidcActionConfig) SetSessionCookieName(v string) *AuthenticateOidcActionConfig { - s.SessionCookieName = &v - return s -} - -// SetSessionTimeout sets the SessionTimeout field's value. -func (s *AuthenticateOidcActionConfig) SetSessionTimeout(v int64) *AuthenticateOidcActionConfig { - s.SessionTimeout = &v - return s -} - -// SetTokenEndpoint sets the TokenEndpoint field's value. -func (s *AuthenticateOidcActionConfig) SetTokenEndpoint(v string) *AuthenticateOidcActionConfig { - s.TokenEndpoint = &v - return s -} - -// SetUseExistingClientSecret sets the UseExistingClientSecret field's value. -func (s *AuthenticateOidcActionConfig) SetUseExistingClientSecret(v bool) *AuthenticateOidcActionConfig { - s.UseExistingClientSecret = &v - return s -} - -// SetUserInfoEndpoint sets the UserInfoEndpoint field's value. -func (s *AuthenticateOidcActionConfig) SetUserInfoEndpoint(v string) *AuthenticateOidcActionConfig { - s.UserInfoEndpoint = &v - return s -} - -// Information about an Availability Zone. -type AvailabilityZone struct { - _ struct{} `type:"structure"` - - // [Network Load Balancers] If you need static IP addresses for your load balancer, - // you can specify one Elastic IP address per Availability Zone when you create - // an internal-facing load balancer. For internal load balancers, you can specify - // a private IP address from the IPv4 range of the subnet. - LoadBalancerAddresses []*LoadBalancerAddress `type:"list"` - - // [Application Load Balancers on Outposts] The ID of the Outpost. - OutpostId *string `type:"string"` - - // The ID of the subnet. You can specify one subnet per Availability Zone. - SubnetId *string `type:"string"` - - // The name of the Availability Zone. - ZoneName *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AvailabilityZone) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AvailabilityZone) GoString() string { - return s.String() -} - -// SetLoadBalancerAddresses sets the LoadBalancerAddresses field's value. -func (s *AvailabilityZone) SetLoadBalancerAddresses(v []*LoadBalancerAddress) *AvailabilityZone { - s.LoadBalancerAddresses = v - return s -} - -// SetOutpostId sets the OutpostId field's value. -func (s *AvailabilityZone) SetOutpostId(v string) *AvailabilityZone { - s.OutpostId = &v - return s -} - -// SetSubnetId sets the SubnetId field's value. -func (s *AvailabilityZone) SetSubnetId(v string) *AvailabilityZone { - s.SubnetId = &v - return s -} - -// SetZoneName sets the ZoneName field's value. -func (s *AvailabilityZone) SetZoneName(v string) *AvailabilityZone { - s.ZoneName = &v - return s -} - -// Information about an SSL server certificate. -type Certificate struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the certificate. - CertificateArn *string `type:"string"` - - // Indicates whether the certificate is the default certificate. Do not set - // this value when specifying a certificate as an input. This value is not included - // in the output when describing a listener, but is included when describing - // listener certificates. - IsDefault *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Certificate) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Certificate) GoString() string { - return s.String() -} - -// SetCertificateArn sets the CertificateArn field's value. -func (s *Certificate) SetCertificateArn(v string) *Certificate { - s.CertificateArn = &v - return s -} - -// SetIsDefault sets the IsDefault field's value. -func (s *Certificate) SetIsDefault(v bool) *Certificate { - s.IsDefault = &v - return s -} - -// Information about a cipher used in a policy. -type Cipher struct { - _ struct{} `type:"structure"` - - // The name of the cipher. - Name *string `type:"string"` - - // The priority of the cipher. - Priority *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Cipher) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Cipher) GoString() string { - return s.String() -} - -// SetName sets the Name field's value. -func (s *Cipher) SetName(v string) *Cipher { - s.Name = &v - return s -} - -// SetPriority sets the Priority field's value. -func (s *Cipher) SetPriority(v int64) *Cipher { - s.Priority = &v - return s -} - -type CreateListenerInput struct { - _ struct{} `type:"structure"` - - // [TLS listeners] The name of the Application-Layer Protocol Negotiation (ALPN) - // policy. You can specify one policy name. The following are the possible values: - // - // * HTTP1Only - // - // * HTTP2Only - // - // * HTTP2Optional - // - // * HTTP2Preferred - // - // * None - // - // For more information, see ALPN policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#alpn-policies) - // in the Network Load Balancers Guide. - AlpnPolicy []*string `type:"list"` - - // [HTTPS and TLS listeners] The default certificate for the listener. You must - // provide exactly one certificate. Set CertificateArn to the certificate ARN - // but do not set IsDefault. - Certificates []*Certificate `type:"list"` - - // The actions for the default rule. - // - // DefaultActions is a required field - DefaultActions []*Action `type:"list" required:"true"` - - // The Amazon Resource Name (ARN) of the load balancer. - // - // LoadBalancerArn is a required field - LoadBalancerArn *string `type:"string" required:"true"` - - // The port on which the load balancer is listening. You cannot specify a port - // for a Gateway Load Balancer. - Port *int64 `min:"1" type:"integer"` - - // The protocol for connections from clients to the load balancer. For Application - // Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load - // Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t - // specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You cannot - // specify a protocol for a Gateway Load Balancer. - Protocol *string `type:"string" enum:"ProtocolEnum"` - - // [HTTPS and TLS listeners] The security policy that defines which protocols - // and ciphers are supported. - // - // For more information, see Security policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies) - // in the Application Load Balancers Guide and Security policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies) - // in the Network Load Balancers Guide. - SslPolicy *string `type:"string"` - - // The tags to assign to the listener. - Tags []*Tag `min:"1" type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateListenerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateListenerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateListenerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateListenerInput"} - if s.DefaultActions == nil { - invalidParams.Add(request.NewErrParamRequired("DefaultActions")) - } - if s.LoadBalancerArn == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerArn")) - } - if s.Port != nil && *s.Port < 1 { - invalidParams.Add(request.NewErrParamMinValue("Port", 1)) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.DefaultActions != nil { - for i, v := range s.DefaultActions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "DefaultActions", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAlpnPolicy sets the AlpnPolicy field's value. -func (s *CreateListenerInput) SetAlpnPolicy(v []*string) *CreateListenerInput { - s.AlpnPolicy = v - return s -} - -// SetCertificates sets the Certificates field's value. -func (s *CreateListenerInput) SetCertificates(v []*Certificate) *CreateListenerInput { - s.Certificates = v - return s -} - -// SetDefaultActions sets the DefaultActions field's value. -func (s *CreateListenerInput) SetDefaultActions(v []*Action) *CreateListenerInput { - s.DefaultActions = v - return s -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *CreateListenerInput) SetLoadBalancerArn(v string) *CreateListenerInput { - s.LoadBalancerArn = &v - return s -} - -// SetPort sets the Port field's value. -func (s *CreateListenerInput) SetPort(v int64) *CreateListenerInput { - s.Port = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *CreateListenerInput) SetProtocol(v string) *CreateListenerInput { - s.Protocol = &v - return s -} - -// SetSslPolicy sets the SslPolicy field's value. -func (s *CreateListenerInput) SetSslPolicy(v string) *CreateListenerInput { - s.SslPolicy = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *CreateListenerInput) SetTags(v []*Tag) *CreateListenerInput { - s.Tags = v - return s -} - -type CreateListenerOutput struct { - _ struct{} `type:"structure"` - - // Information about the listener. - Listeners []*Listener `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateListenerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateListenerOutput) GoString() string { - return s.String() -} - -// SetListeners sets the Listeners field's value. -func (s *CreateListenerOutput) SetListeners(v []*Listener) *CreateListenerOutput { - s.Listeners = v - return s -} - -type CreateLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // [Application Load Balancers on Outposts] The ID of the customer-owned address - // pool (CoIP pool). - CustomerOwnedIpv4Pool *string `type:"string"` - - // The type of IP addresses used by the subnets for your load balancer. The - // possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and - // IPv6 addresses). - IpAddressType *string `type:"string" enum:"IpAddressType"` - - // The name of the load balancer. - // - // This name must be unique per region per account, can have a maximum of 32 - // characters, must contain only alphanumeric characters or hyphens, must not - // begin or end with a hyphen, and must not begin with "internal-". - // - // Name is a required field - Name *string `type:"string" required:"true"` - - // The nodes of an Internet-facing load balancer have public IP addresses. The - // DNS name of an Internet-facing load balancer is publicly resolvable to the - // public IP addresses of the nodes. Therefore, Internet-facing load balancers - // can route requests from clients over the internet. - // - // The nodes of an internal load balancer have only private IP addresses. The - // DNS name of an internal load balancer is publicly resolvable to the private - // IP addresses of the nodes. Therefore, internal load balancers can route requests - // only from clients with access to the VPC for the load balancer. - // - // The default is an Internet-facing load balancer. - // - // You cannot specify a scheme for a Gateway Load Balancer. - Scheme *string `type:"string" enum:"LoadBalancerSchemeEnum"` - - // [Application Load Balancers] The IDs of the security groups for the load - // balancer. - SecurityGroups []*string `type:"list"` - - // The IDs of the public subnets. You can specify only one subnet per Availability - // Zone. You must specify either subnets or subnet mappings, but not both. - // - // [Application Load Balancers] You must specify subnets from at least two Availability - // Zones. You cannot specify Elastic IP addresses for your subnets. - // - // [Application Load Balancers on Outposts] You must specify one Outpost subnet. - // - // [Application Load Balancers on Local Zones] You can specify subnets from - // one or more Local Zones. - // - // [Network Load Balancers] You can specify subnets from one or more Availability - // Zones. You can specify one Elastic IP address per subnet if you need static - // IP addresses for your internet-facing load balancer. For internal load balancers, - // you can specify one private IP address per subnet from the IPv4 range of - // the subnet. For internet-facing load balancer, you can specify one IPv6 address - // per subnet. - // - // [Gateway Load Balancers] You can specify subnets from one or more Availability - // Zones. You cannot specify Elastic IP addresses for your subnets. - SubnetMappings []*SubnetMapping `type:"list"` - - // The IDs of the public subnets. You can specify only one subnet per Availability - // Zone. You must specify either subnets or subnet mappings, but not both. To - // specify an Elastic IP address, specify subnet mappings instead of subnets. - // - // [Application Load Balancers] You must specify subnets from at least two Availability - // Zones. - // - // [Application Load Balancers on Outposts] You must specify one Outpost subnet. - // - // [Application Load Balancers on Local Zones] You can specify subnets from - // one or more Local Zones. - // - // [Network Load Balancers] You can specify subnets from one or more Availability - // Zones. - // - // [Gateway Load Balancers] You can specify subnets from one or more Availability - // Zones. - Subnets []*string `type:"list"` - - // The tags to assign to the load balancer. - Tags []*Tag `min:"1" type:"list"` - - // The type of load balancer. The default is application. - Type *string `type:"string" enum:"LoadBalancerTypeEnum"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateLoadBalancerInput"} - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomerOwnedIpv4Pool sets the CustomerOwnedIpv4Pool field's value. -func (s *CreateLoadBalancerInput) SetCustomerOwnedIpv4Pool(v string) *CreateLoadBalancerInput { - s.CustomerOwnedIpv4Pool = &v - return s -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *CreateLoadBalancerInput) SetIpAddressType(v string) *CreateLoadBalancerInput { - s.IpAddressType = &v - return s -} - -// SetName sets the Name field's value. -func (s *CreateLoadBalancerInput) SetName(v string) *CreateLoadBalancerInput { - s.Name = &v - return s -} - -// SetScheme sets the Scheme field's value. -func (s *CreateLoadBalancerInput) SetScheme(v string) *CreateLoadBalancerInput { - s.Scheme = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *CreateLoadBalancerInput) SetSecurityGroups(v []*string) *CreateLoadBalancerInput { - s.SecurityGroups = v - return s -} - -// SetSubnetMappings sets the SubnetMappings field's value. -func (s *CreateLoadBalancerInput) SetSubnetMappings(v []*SubnetMapping) *CreateLoadBalancerInput { - s.SubnetMappings = v - return s -} - -// SetSubnets sets the Subnets field's value. -func (s *CreateLoadBalancerInput) SetSubnets(v []*string) *CreateLoadBalancerInput { - s.Subnets = v - return s -} - -// SetTags sets the Tags field's value. -func (s *CreateLoadBalancerInput) SetTags(v []*Tag) *CreateLoadBalancerInput { - s.Tags = v - return s -} - -// SetType sets the Type field's value. -func (s *CreateLoadBalancerInput) SetType(v string) *CreateLoadBalancerInput { - s.Type = &v - return s -} - -type CreateLoadBalancerOutput struct { - _ struct{} `type:"structure"` - - // Information about the load balancer. - LoadBalancers []*LoadBalancer `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateLoadBalancerOutput) GoString() string { - return s.String() -} - -// SetLoadBalancers sets the LoadBalancers field's value. -func (s *CreateLoadBalancerOutput) SetLoadBalancers(v []*LoadBalancer) *CreateLoadBalancerOutput { - s.LoadBalancers = v - return s -} - -type CreateRuleInput struct { - _ struct{} `type:"structure"` - - // The actions. - // - // Actions is a required field - Actions []*Action `type:"list" required:"true"` - - // The conditions. - // - // Conditions is a required field - Conditions []*RuleCondition `type:"list" required:"true"` - - // The Amazon Resource Name (ARN) of the listener. - // - // ListenerArn is a required field - ListenerArn *string `type:"string" required:"true"` - - // The rule priority. A listener can't have multiple rules with the same priority. - // - // Priority is a required field - Priority *int64 `min:"1" type:"integer" required:"true"` - - // The tags to assign to the rule. - Tags []*Tag `min:"1" type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateRuleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateRuleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateRuleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateRuleInput"} - if s.Actions == nil { - invalidParams.Add(request.NewErrParamRequired("Actions")) - } - if s.Conditions == nil { - invalidParams.Add(request.NewErrParamRequired("Conditions")) - } - if s.ListenerArn == nil { - invalidParams.Add(request.NewErrParamRequired("ListenerArn")) - } - if s.Priority == nil { - invalidParams.Add(request.NewErrParamRequired("Priority")) - } - if s.Priority != nil && *s.Priority < 1 { - invalidParams.Add(request.NewErrParamMinValue("Priority", 1)) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.Actions != nil { - for i, v := range s.Actions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Actions", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetActions sets the Actions field's value. -func (s *CreateRuleInput) SetActions(v []*Action) *CreateRuleInput { - s.Actions = v - return s -} - -// SetConditions sets the Conditions field's value. -func (s *CreateRuleInput) SetConditions(v []*RuleCondition) *CreateRuleInput { - s.Conditions = v - return s -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *CreateRuleInput) SetListenerArn(v string) *CreateRuleInput { - s.ListenerArn = &v - return s -} - -// SetPriority sets the Priority field's value. -func (s *CreateRuleInput) SetPriority(v int64) *CreateRuleInput { - s.Priority = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *CreateRuleInput) SetTags(v []*Tag) *CreateRuleInput { - s.Tags = v - return s -} - -type CreateRuleOutput struct { - _ struct{} `type:"structure"` - - // Information about the rule. - Rules []*Rule `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateRuleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateRuleOutput) GoString() string { - return s.String() -} - -// SetRules sets the Rules field's value. -func (s *CreateRuleOutput) SetRules(v []*Rule) *CreateRuleOutput { - s.Rules = v - return s -} - -type CreateTargetGroupInput struct { - _ struct{} `type:"structure"` - - // Indicates whether health checks are enabled. If the target type is lambda, - // health checks are disabled by default but can be enabled. If the target type - // is instance, ip, or alb, health checks are always enabled and cannot be disabled. - HealthCheckEnabled *bool `type:"boolean"` - - // The approximate amount of time, in seconds, between health checks of an individual - // target. The range is 5-300. If the target group protocol is TCP, TLS, UDP, - // TCP_UDP, HTTP or HTTPS, the default is 30 seconds. If the target group protocol - // is GENEVE, the default is 10 seconds. If the target type is lambda, the default - // is 35 seconds. - HealthCheckIntervalSeconds *int64 `min:"5" type:"integer"` - - // [HTTP/HTTPS health checks] The destination for health checks on the targets. - // - // [HTTP1 or HTTP2 protocol version] The ping path. The default is /. - // - // [GRPC protocol version] The path of a custom health check method with the - // format /package.service/method. The default is /Amazon Web Services.ALB/healthcheck. - HealthCheckPath *string `min:"1" type:"string"` - - // The port the load balancer uses when performing health checks on targets. - // If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the default is - // traffic-port, which is the port on which each target receives traffic from - // the load balancer. If the protocol is GENEVE, the default is port 80. - HealthCheckPort *string `type:"string"` - - // The protocol the load balancer uses when performing health checks on targets. - // For Application Load Balancers, the default is HTTP. For Network Load Balancers - // and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported - // for health checks if the protocol of the target group is HTTP or HTTPS. The - // GENEVE, TLS, UDP, and TCP_UDP protocols are not supported for health checks. - HealthCheckProtocol *string `type:"string" enum:"ProtocolEnum"` - - // The amount of time, in seconds, during which no response from a target means - // a failed health check. The range is 2–120 seconds. For target groups with - // a protocol of HTTP, the default is 6 seconds. For target groups with a protocol - // of TCP, TLS or HTTPS, the default is 10 seconds. For target groups with a - // protocol of GENEVE, the default is 5 seconds. If the target type is lambda, - // the default is 30 seconds. - HealthCheckTimeoutSeconds *int64 `min:"2" type:"integer"` - - // The number of consecutive health check successes required before considering - // a target healthy. The range is 2-10. If the target group protocol is TCP, - // TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 5. For target groups with - // a protocol of GENEVE, the default is 3. If the target type is lambda, the - // default is 5. - HealthyThresholdCount *int64 `min:"2" type:"integer"` - - // The type of IP address used for this target group. The possible values are - // ipv4 and ipv6. This is an optional parameter. If not specified, the IP address - // type defaults to ipv4. - IpAddressType *string `type:"string" enum:"TargetGroupIpAddressTypeEnum"` - - // [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for - // a successful response from a target. For target groups with a protocol of - // TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol - // of HTTP or HTTPS, the range is 200-499. For target groups with a protocol - // of GENEVE, the range is 200-399. - Matcher *Matcher `type:"structure"` - - // The name of the target group. - // - // This name must be unique per region per account, can have a maximum of 32 - // characters, must contain only alphanumeric characters or hyphens, and must - // not begin or end with a hyphen. - // - // Name is a required field - Name *string `type:"string" required:"true"` - - // The port on which the targets receive traffic. This port is used unless you - // specify a port override when registering the target. If the target is a Lambda - // function, this parameter does not apply. If the protocol is GENEVE, the supported - // port is 6081. - Port *int64 `min:"1" type:"integer"` - - // The protocol to use for routing traffic to the targets. For Application Load - // Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, - // the supported protocols are TCP, TLS, UDP, or TCP_UDP. For Gateway Load Balancers, - // the supported protocol is GENEVE. A TCP_UDP listener must be associated with - // a TCP_UDP target group. If the target is a Lambda function, this parameter - // does not apply. - Protocol *string `type:"string" enum:"ProtocolEnum"` - - // [HTTP/HTTPS protocol] The protocol version. Specify GRPC to send requests - // to targets using gRPC. Specify HTTP2 to send requests to targets using HTTP/2. - // The default is HTTP1, which sends requests to targets using HTTP/1.1. - ProtocolVersion *string `type:"string"` - - // The tags to assign to the target group. - Tags []*Tag `min:"1" type:"list"` - - // The type of target that you must specify when registering targets with this - // target group. You can't specify targets for a target group using more than - // one target type. - // - // * instance - Register targets by instance ID. This is the default value. - // - // * ip - Register targets by IP address. You can specify IP addresses from - // the subnets of the virtual private cloud (VPC) for the target group, the - // RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), and the - // RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP - // addresses. - // - // * lambda - Register a single Lambda function as a target. - // - // * alb - Register a single Application Load Balancer as a target. - TargetType *string `type:"string" enum:"TargetTypeEnum"` - - // The number of consecutive health check failures required before considering - // a target unhealthy. The range is 2-10. If the target group protocol is TCP, - // TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 2. For target groups with - // a protocol of GENEVE, the default is 3. If the target type is lambda, the - // default is 5. - UnhealthyThresholdCount *int64 `min:"2" type:"integer"` - - // The identifier of the virtual private cloud (VPC). If the target is a Lambda - // function, this parameter does not apply. Otherwise, this parameter is required. - VpcId *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateTargetGroupInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateTargetGroupInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateTargetGroupInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateTargetGroupInput"} - if s.HealthCheckIntervalSeconds != nil && *s.HealthCheckIntervalSeconds < 5 { - invalidParams.Add(request.NewErrParamMinValue("HealthCheckIntervalSeconds", 5)) - } - if s.HealthCheckPath != nil && len(*s.HealthCheckPath) < 1 { - invalidParams.Add(request.NewErrParamMinLen("HealthCheckPath", 1)) - } - if s.HealthCheckTimeoutSeconds != nil && *s.HealthCheckTimeoutSeconds < 2 { - invalidParams.Add(request.NewErrParamMinValue("HealthCheckTimeoutSeconds", 2)) - } - if s.HealthyThresholdCount != nil && *s.HealthyThresholdCount < 2 { - invalidParams.Add(request.NewErrParamMinValue("HealthyThresholdCount", 2)) - } - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - if s.Port != nil && *s.Port < 1 { - invalidParams.Add(request.NewErrParamMinValue("Port", 1)) - } - if s.Tags != nil && len(s.Tags) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) - } - if s.UnhealthyThresholdCount != nil && *s.UnhealthyThresholdCount < 2 { - invalidParams.Add(request.NewErrParamMinValue("UnhealthyThresholdCount", 2)) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHealthCheckEnabled sets the HealthCheckEnabled field's value. -func (s *CreateTargetGroupInput) SetHealthCheckEnabled(v bool) *CreateTargetGroupInput { - s.HealthCheckEnabled = &v - return s -} - -// SetHealthCheckIntervalSeconds sets the HealthCheckIntervalSeconds field's value. -func (s *CreateTargetGroupInput) SetHealthCheckIntervalSeconds(v int64) *CreateTargetGroupInput { - s.HealthCheckIntervalSeconds = &v - return s -} - -// SetHealthCheckPath sets the HealthCheckPath field's value. -func (s *CreateTargetGroupInput) SetHealthCheckPath(v string) *CreateTargetGroupInput { - s.HealthCheckPath = &v - return s -} - -// SetHealthCheckPort sets the HealthCheckPort field's value. -func (s *CreateTargetGroupInput) SetHealthCheckPort(v string) *CreateTargetGroupInput { - s.HealthCheckPort = &v - return s -} - -// SetHealthCheckProtocol sets the HealthCheckProtocol field's value. -func (s *CreateTargetGroupInput) SetHealthCheckProtocol(v string) *CreateTargetGroupInput { - s.HealthCheckProtocol = &v - return s -} - -// SetHealthCheckTimeoutSeconds sets the HealthCheckTimeoutSeconds field's value. -func (s *CreateTargetGroupInput) SetHealthCheckTimeoutSeconds(v int64) *CreateTargetGroupInput { - s.HealthCheckTimeoutSeconds = &v - return s -} - -// SetHealthyThresholdCount sets the HealthyThresholdCount field's value. -func (s *CreateTargetGroupInput) SetHealthyThresholdCount(v int64) *CreateTargetGroupInput { - s.HealthyThresholdCount = &v - return s -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *CreateTargetGroupInput) SetIpAddressType(v string) *CreateTargetGroupInput { - s.IpAddressType = &v - return s -} - -// SetMatcher sets the Matcher field's value. -func (s *CreateTargetGroupInput) SetMatcher(v *Matcher) *CreateTargetGroupInput { - s.Matcher = v - return s -} - -// SetName sets the Name field's value. -func (s *CreateTargetGroupInput) SetName(v string) *CreateTargetGroupInput { - s.Name = &v - return s -} - -// SetPort sets the Port field's value. -func (s *CreateTargetGroupInput) SetPort(v int64) *CreateTargetGroupInput { - s.Port = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *CreateTargetGroupInput) SetProtocol(v string) *CreateTargetGroupInput { - s.Protocol = &v - return s -} - -// SetProtocolVersion sets the ProtocolVersion field's value. -func (s *CreateTargetGroupInput) SetProtocolVersion(v string) *CreateTargetGroupInput { - s.ProtocolVersion = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *CreateTargetGroupInput) SetTags(v []*Tag) *CreateTargetGroupInput { - s.Tags = v - return s -} - -// SetTargetType sets the TargetType field's value. -func (s *CreateTargetGroupInput) SetTargetType(v string) *CreateTargetGroupInput { - s.TargetType = &v - return s -} - -// SetUnhealthyThresholdCount sets the UnhealthyThresholdCount field's value. -func (s *CreateTargetGroupInput) SetUnhealthyThresholdCount(v int64) *CreateTargetGroupInput { - s.UnhealthyThresholdCount = &v - return s -} - -// SetVpcId sets the VpcId field's value. -func (s *CreateTargetGroupInput) SetVpcId(v string) *CreateTargetGroupInput { - s.VpcId = &v - return s -} - -type CreateTargetGroupOutput struct { - _ struct{} `type:"structure"` - - // Information about the target group. - TargetGroups []*TargetGroup `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateTargetGroupOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateTargetGroupOutput) GoString() string { - return s.String() -} - -// SetTargetGroups sets the TargetGroups field's value. -func (s *CreateTargetGroupOutput) SetTargetGroups(v []*TargetGroup) *CreateTargetGroupOutput { - s.TargetGroups = v - return s -} - -type DeleteListenerInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the listener. - // - // ListenerArn is a required field - ListenerArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteListenerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteListenerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteListenerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteListenerInput"} - if s.ListenerArn == nil { - invalidParams.Add(request.NewErrParamRequired("ListenerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *DeleteListenerInput) SetListenerArn(v string) *DeleteListenerInput { - s.ListenerArn = &v - return s -} - -type DeleteListenerOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteListenerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteListenerOutput) GoString() string { - return s.String() -} - -type DeleteLoadBalancerInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the load balancer. - // - // LoadBalancerArn is a required field - LoadBalancerArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteLoadBalancerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteLoadBalancerInput"} - if s.LoadBalancerArn == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *DeleteLoadBalancerInput) SetLoadBalancerArn(v string) *DeleteLoadBalancerInput { - s.LoadBalancerArn = &v - return s -} - -type DeleteLoadBalancerOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteLoadBalancerOutput) GoString() string { - return s.String() -} - -type DeleteRuleInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the rule. - // - // RuleArn is a required field - RuleArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteRuleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteRuleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteRuleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteRuleInput"} - if s.RuleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RuleArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRuleArn sets the RuleArn field's value. -func (s *DeleteRuleInput) SetRuleArn(v string) *DeleteRuleInput { - s.RuleArn = &v - return s -} - -type DeleteRuleOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteRuleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteRuleOutput) GoString() string { - return s.String() -} - -type DeleteTargetGroupInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - // - // TargetGroupArn is a required field - TargetGroupArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteTargetGroupInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteTargetGroupInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteTargetGroupInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteTargetGroupInput"} - if s.TargetGroupArn == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *DeleteTargetGroupInput) SetTargetGroupArn(v string) *DeleteTargetGroupInput { - s.TargetGroupArn = &v - return s -} - -type DeleteTargetGroupOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteTargetGroupOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteTargetGroupOutput) GoString() string { - return s.String() -} - -type DeregisterTargetsInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - // - // TargetGroupArn is a required field - TargetGroupArn *string `type:"string" required:"true"` - - // The targets. If you specified a port override when you registered a target, - // you must specify both the target ID and the port when you deregister it. - // - // Targets is a required field - Targets []*TargetDescription `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterTargetsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterTargetsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeregisterTargetsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeregisterTargetsInput"} - if s.TargetGroupArn == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupArn")) - } - if s.Targets == nil { - invalidParams.Add(request.NewErrParamRequired("Targets")) - } - if s.Targets != nil { - for i, v := range s.Targets { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Targets", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *DeregisterTargetsInput) SetTargetGroupArn(v string) *DeregisterTargetsInput { - s.TargetGroupArn = &v - return s -} - -// SetTargets sets the Targets field's value. -func (s *DeregisterTargetsInput) SetTargets(v []*TargetDescription) *DeregisterTargetsInput { - s.Targets = v - return s -} - -type DeregisterTargetsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterTargetsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeregisterTargetsOutput) GoString() string { - return s.String() -} - -type DescribeAccountLimitsInput struct { - _ struct{} `type:"structure"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeAccountLimitsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeAccountLimitsInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetMarker sets the Marker field's value. -func (s *DescribeAccountLimitsInput) SetMarker(v string) *DescribeAccountLimitsInput { - s.Marker = &v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeAccountLimitsInput) SetPageSize(v int64) *DescribeAccountLimitsInput { - s.PageSize = &v - return s -} - -type DescribeAccountLimitsOutput struct { - _ struct{} `type:"structure"` - - // Information about the limits. - Limits []*Limit `type:"list"` - - // If there are additional results, this is the marker for the next set of results. - // Otherwise, this is null. - NextMarker *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeAccountLimitsOutput) GoString() string { - return s.String() -} - -// SetLimits sets the Limits field's value. -func (s *DescribeAccountLimitsOutput) SetLimits(v []*Limit) *DescribeAccountLimitsOutput { - s.Limits = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeAccountLimitsOutput) SetNextMarker(v string) *DescribeAccountLimitsOutput { - s.NextMarker = &v - return s -} - -type DescribeListenerCertificatesInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Names (ARN) of the listener. - // - // ListenerArn is a required field - ListenerArn *string `type:"string" required:"true"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenerCertificatesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenerCertificatesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeListenerCertificatesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeListenerCertificatesInput"} - if s.ListenerArn == nil { - invalidParams.Add(request.NewErrParamRequired("ListenerArn")) - } - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *DescribeListenerCertificatesInput) SetListenerArn(v string) *DescribeListenerCertificatesInput { - s.ListenerArn = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeListenerCertificatesInput) SetMarker(v string) *DescribeListenerCertificatesInput { - s.Marker = &v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeListenerCertificatesInput) SetPageSize(v int64) *DescribeListenerCertificatesInput { - s.PageSize = &v - return s -} - -type DescribeListenerCertificatesOutput struct { - _ struct{} `type:"structure"` - - // Information about the certificates. - Certificates []*Certificate `type:"list"` - - // If there are additional results, this is the marker for the next set of results. - // Otherwise, this is null. - NextMarker *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenerCertificatesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenerCertificatesOutput) GoString() string { - return s.String() -} - -// SetCertificates sets the Certificates field's value. -func (s *DescribeListenerCertificatesOutput) SetCertificates(v []*Certificate) *DescribeListenerCertificatesOutput { - s.Certificates = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeListenerCertificatesOutput) SetNextMarker(v string) *DescribeListenerCertificatesOutput { - s.NextMarker = &v - return s -} - -type DescribeListenersInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Names (ARN) of the listeners. - ListenerArns []*string `type:"list"` - - // The Amazon Resource Name (ARN) of the load balancer. - LoadBalancerArn *string `type:"string"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeListenersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeListenersInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetListenerArns sets the ListenerArns field's value. -func (s *DescribeListenersInput) SetListenerArns(v []*string) *DescribeListenersInput { - s.ListenerArns = v - return s -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *DescribeListenersInput) SetLoadBalancerArn(v string) *DescribeListenersInput { - s.LoadBalancerArn = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeListenersInput) SetMarker(v string) *DescribeListenersInput { - s.Marker = &v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeListenersInput) SetPageSize(v int64) *DescribeListenersInput { - s.PageSize = &v - return s -} - -type DescribeListenersOutput struct { - _ struct{} `type:"structure"` - - // Information about the listeners. - Listeners []*Listener `type:"list"` - - // If there are additional results, this is the marker for the next set of results. - // Otherwise, this is null. - NextMarker *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeListenersOutput) GoString() string { - return s.String() -} - -// SetListeners sets the Listeners field's value. -func (s *DescribeListenersOutput) SetListeners(v []*Listener) *DescribeListenersOutput { - s.Listeners = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeListenersOutput) SetNextMarker(v string) *DescribeListenersOutput { - s.NextMarker = &v - return s -} - -type DescribeLoadBalancerAttributesInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the load balancer. - // - // LoadBalancerArn is a required field - LoadBalancerArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeLoadBalancerAttributesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeLoadBalancerAttributesInput"} - if s.LoadBalancerArn == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *DescribeLoadBalancerAttributesInput) SetLoadBalancerArn(v string) *DescribeLoadBalancerAttributesInput { - s.LoadBalancerArn = &v - return s -} - -type DescribeLoadBalancerAttributesOutput struct { - _ struct{} `type:"structure"` - - // Information about the load balancer attributes. - Attributes []*LoadBalancerAttribute `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancerAttributesOutput) GoString() string { - return s.String() -} - -// SetAttributes sets the Attributes field's value. -func (s *DescribeLoadBalancerAttributesOutput) SetAttributes(v []*LoadBalancerAttribute) *DescribeLoadBalancerAttributesOutput { - s.Attributes = v - return s -} - -type DescribeLoadBalancersInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Names (ARN) of the load balancers. You can specify up - // to 20 load balancers in a single call. - LoadBalancerArns []*string `type:"list"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The names of the load balancers. - Names []*string `type:"list"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeLoadBalancersInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeLoadBalancersInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerArns sets the LoadBalancerArns field's value. -func (s *DescribeLoadBalancersInput) SetLoadBalancerArns(v []*string) *DescribeLoadBalancersInput { - s.LoadBalancerArns = v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeLoadBalancersInput) SetMarker(v string) *DescribeLoadBalancersInput { - s.Marker = &v - return s -} - -// SetNames sets the Names field's value. -func (s *DescribeLoadBalancersInput) SetNames(v []*string) *DescribeLoadBalancersInput { - s.Names = v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeLoadBalancersInput) SetPageSize(v int64) *DescribeLoadBalancersInput { - s.PageSize = &v - return s -} - -type DescribeLoadBalancersOutput struct { - _ struct{} `type:"structure"` - - // Information about the load balancers. - LoadBalancers []*LoadBalancer `type:"list"` - - // If there are additional results, this is the marker for the next set of results. - // Otherwise, this is null. - NextMarker *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeLoadBalancersOutput) GoString() string { - return s.String() -} - -// SetLoadBalancers sets the LoadBalancers field's value. -func (s *DescribeLoadBalancersOutput) SetLoadBalancers(v []*LoadBalancer) *DescribeLoadBalancersOutput { - s.LoadBalancers = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeLoadBalancersOutput) SetNextMarker(v string) *DescribeLoadBalancersOutput { - s.NextMarker = &v - return s -} - -type DescribeRulesInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the listener. - ListenerArn *string `type:"string"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` - - // The Amazon Resource Names (ARN) of the rules. - RuleArns []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeRulesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeRulesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeRulesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeRulesInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *DescribeRulesInput) SetListenerArn(v string) *DescribeRulesInput { - s.ListenerArn = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeRulesInput) SetMarker(v string) *DescribeRulesInput { - s.Marker = &v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeRulesInput) SetPageSize(v int64) *DescribeRulesInput { - s.PageSize = &v - return s -} - -// SetRuleArns sets the RuleArns field's value. -func (s *DescribeRulesInput) SetRuleArns(v []*string) *DescribeRulesInput { - s.RuleArns = v - return s -} - -type DescribeRulesOutput struct { - _ struct{} `type:"structure"` - - // If there are additional results, this is the marker for the next set of results. - // Otherwise, this is null. - NextMarker *string `type:"string"` - - // Information about the rules. - Rules []*Rule `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeRulesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeRulesOutput) GoString() string { - return s.String() -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeRulesOutput) SetNextMarker(v string) *DescribeRulesOutput { - s.NextMarker = &v - return s -} - -// SetRules sets the Rules field's value. -func (s *DescribeRulesOutput) SetRules(v []*Rule) *DescribeRulesOutput { - s.Rules = v - return s -} - -type DescribeSSLPoliciesInput struct { - _ struct{} `type:"structure"` - - // The type of load balancer. The default lists the SSL policies for all load - // balancers. - LoadBalancerType *string `type:"string" enum:"LoadBalancerTypeEnum"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The names of the policies. - Names []*string `type:"list"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeSSLPoliciesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeSSLPoliciesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeSSLPoliciesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeSSLPoliciesInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerType sets the LoadBalancerType field's value. -func (s *DescribeSSLPoliciesInput) SetLoadBalancerType(v string) *DescribeSSLPoliciesInput { - s.LoadBalancerType = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeSSLPoliciesInput) SetMarker(v string) *DescribeSSLPoliciesInput { - s.Marker = &v - return s -} - -// SetNames sets the Names field's value. -func (s *DescribeSSLPoliciesInput) SetNames(v []*string) *DescribeSSLPoliciesInput { - s.Names = v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeSSLPoliciesInput) SetPageSize(v int64) *DescribeSSLPoliciesInput { - s.PageSize = &v - return s -} - -type DescribeSSLPoliciesOutput struct { - _ struct{} `type:"structure"` - - // If there are additional results, this is the marker for the next set of results. - // Otherwise, this is null. - NextMarker *string `type:"string"` - - // Information about the security policies. - SslPolicies []*SslPolicy `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeSSLPoliciesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeSSLPoliciesOutput) GoString() string { - return s.String() -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeSSLPoliciesOutput) SetNextMarker(v string) *DescribeSSLPoliciesOutput { - s.NextMarker = &v - return s -} - -// SetSslPolicies sets the SslPolicies field's value. -func (s *DescribeSSLPoliciesOutput) SetSslPolicies(v []*SslPolicy) *DescribeSSLPoliciesOutput { - s.SslPolicies = v - return s -} - -type DescribeTagsInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Names (ARN) of the resources. You can specify up to 20 - // resources in a single call. - // - // ResourceArns is a required field - ResourceArns []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeTagsInput"} - if s.ResourceArns == nil { - invalidParams.Add(request.NewErrParamRequired("ResourceArns")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetResourceArns sets the ResourceArns field's value. -func (s *DescribeTagsInput) SetResourceArns(v []*string) *DescribeTagsInput { - s.ResourceArns = v - return s -} - -type DescribeTagsOutput struct { - _ struct{} `type:"structure"` - - // Information about the tags. - TagDescriptions []*TagDescription `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTagsOutput) GoString() string { - return s.String() -} - -// SetTagDescriptions sets the TagDescriptions field's value. -func (s *DescribeTagsOutput) SetTagDescriptions(v []*TagDescription) *DescribeTagsOutput { - s.TagDescriptions = v - return s -} - -type DescribeTargetGroupAttributesInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - // - // TargetGroupArn is a required field - TargetGroupArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupAttributesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupAttributesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeTargetGroupAttributesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeTargetGroupAttributesInput"} - if s.TargetGroupArn == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *DescribeTargetGroupAttributesInput) SetTargetGroupArn(v string) *DescribeTargetGroupAttributesInput { - s.TargetGroupArn = &v - return s -} - -type DescribeTargetGroupAttributesOutput struct { - _ struct{} `type:"structure"` - - // Information about the target group attributes - Attributes []*TargetGroupAttribute `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupAttributesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupAttributesOutput) GoString() string { - return s.String() -} - -// SetAttributes sets the Attributes field's value. -func (s *DescribeTargetGroupAttributesOutput) SetAttributes(v []*TargetGroupAttribute) *DescribeTargetGroupAttributesOutput { - s.Attributes = v - return s -} - -type DescribeTargetGroupsInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the load balancer. - LoadBalancerArn *string `type:"string"` - - // The marker for the next set of results. (You received this marker from a - // previous call.) - Marker *string `type:"string"` - - // The names of the target groups. - Names []*string `type:"list"` - - // The maximum number of results to return with this call. - PageSize *int64 `min:"1" type:"integer"` - - // The Amazon Resource Names (ARN) of the target groups. - TargetGroupArns []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeTargetGroupsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeTargetGroupsInput"} - if s.PageSize != nil && *s.PageSize < 1 { - invalidParams.Add(request.NewErrParamMinValue("PageSize", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *DescribeTargetGroupsInput) SetLoadBalancerArn(v string) *DescribeTargetGroupsInput { - s.LoadBalancerArn = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeTargetGroupsInput) SetMarker(v string) *DescribeTargetGroupsInput { - s.Marker = &v - return s -} - -// SetNames sets the Names field's value. -func (s *DescribeTargetGroupsInput) SetNames(v []*string) *DescribeTargetGroupsInput { - s.Names = v - return s -} - -// SetPageSize sets the PageSize field's value. -func (s *DescribeTargetGroupsInput) SetPageSize(v int64) *DescribeTargetGroupsInput { - s.PageSize = &v - return s -} - -// SetTargetGroupArns sets the TargetGroupArns field's value. -func (s *DescribeTargetGroupsInput) SetTargetGroupArns(v []*string) *DescribeTargetGroupsInput { - s.TargetGroupArns = v - return s -} - -type DescribeTargetGroupsOutput struct { - _ struct{} `type:"structure"` - - // If there are additional results, this is the marker for the next set of results. - // Otherwise, this is null. - NextMarker *string `type:"string"` - - // Information about the target groups. - TargetGroups []*TargetGroup `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetGroupsOutput) GoString() string { - return s.String() -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeTargetGroupsOutput) SetNextMarker(v string) *DescribeTargetGroupsOutput { - s.NextMarker = &v - return s -} - -// SetTargetGroups sets the TargetGroups field's value. -func (s *DescribeTargetGroupsOutput) SetTargetGroups(v []*TargetGroup) *DescribeTargetGroupsOutput { - s.TargetGroups = v - return s -} - -type DescribeTargetHealthInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - // - // TargetGroupArn is a required field - TargetGroupArn *string `type:"string" required:"true"` - - // The targets. - Targets []*TargetDescription `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetHealthInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetHealthInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeTargetHealthInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeTargetHealthInput"} - if s.TargetGroupArn == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupArn")) - } - if s.Targets != nil { - for i, v := range s.Targets { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Targets", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *DescribeTargetHealthInput) SetTargetGroupArn(v string) *DescribeTargetHealthInput { - s.TargetGroupArn = &v - return s -} - -// SetTargets sets the Targets field's value. -func (s *DescribeTargetHealthInput) SetTargets(v []*TargetDescription) *DescribeTargetHealthInput { - s.Targets = v - return s -} - -type DescribeTargetHealthOutput struct { - _ struct{} `type:"structure"` - - // Information about the health of the targets. - TargetHealthDescriptions []*TargetHealthDescription `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetHealthOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeTargetHealthOutput) GoString() string { - return s.String() -} - -// SetTargetHealthDescriptions sets the TargetHealthDescriptions field's value. -func (s *DescribeTargetHealthOutput) SetTargetHealthDescriptions(v []*TargetHealthDescription) *DescribeTargetHealthOutput { - s.TargetHealthDescriptions = v - return s -} - -// Information about an action that returns a custom HTTP response. -type FixedResponseActionConfig struct { - _ struct{} `type:"structure"` - - // The content type. - // - // Valid Values: text/plain | text/css | text/html | application/javascript - // | application/json - ContentType *string `type:"string"` - - // The message. - MessageBody *string `type:"string"` - - // The HTTP response code (2XX, 4XX, or 5XX). - // - // StatusCode is a required field - StatusCode *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s FixedResponseActionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s FixedResponseActionConfig) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *FixedResponseActionConfig) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "FixedResponseActionConfig"} - if s.StatusCode == nil { - invalidParams.Add(request.NewErrParamRequired("StatusCode")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetContentType sets the ContentType field's value. -func (s *FixedResponseActionConfig) SetContentType(v string) *FixedResponseActionConfig { - s.ContentType = &v - return s -} - -// SetMessageBody sets the MessageBody field's value. -func (s *FixedResponseActionConfig) SetMessageBody(v string) *FixedResponseActionConfig { - s.MessageBody = &v - return s -} - -// SetStatusCode sets the StatusCode field's value. -func (s *FixedResponseActionConfig) SetStatusCode(v string) *FixedResponseActionConfig { - s.StatusCode = &v - return s -} - -// Information about a forward action. -type ForwardActionConfig struct { - _ struct{} `type:"structure"` - - // The target group stickiness for the rule. - TargetGroupStickinessConfig *TargetGroupStickinessConfig `type:"structure"` - - // The target groups. For Network Load Balancers, you can specify a single target - // group. - TargetGroups []*TargetGroupTuple `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ForwardActionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ForwardActionConfig) GoString() string { - return s.String() -} - -// SetTargetGroupStickinessConfig sets the TargetGroupStickinessConfig field's value. -func (s *ForwardActionConfig) SetTargetGroupStickinessConfig(v *TargetGroupStickinessConfig) *ForwardActionConfig { - s.TargetGroupStickinessConfig = v - return s -} - -// SetTargetGroups sets the TargetGroups field's value. -func (s *ForwardActionConfig) SetTargetGroups(v []*TargetGroupTuple) *ForwardActionConfig { - s.TargetGroups = v - return s -} - -// Information about a host header condition. -type HostHeaderConditionConfig struct { - _ struct{} `type:"structure"` - - // The host names. The maximum size of each name is 128 characters. The comparison - // is case insensitive. The following wildcard characters are supported: * (matches - // 0 or more characters) and ? (matches exactly 1 character). - // - // If you specify multiple strings, the condition is satisfied if one of the - // strings matches the host name. - Values []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HostHeaderConditionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HostHeaderConditionConfig) GoString() string { - return s.String() -} - -// SetValues sets the Values field's value. -func (s *HostHeaderConditionConfig) SetValues(v []*string) *HostHeaderConditionConfig { - s.Values = v - return s -} - -// Information about an HTTP header condition. -// -// There is a set of standard HTTP header fields. You can also define custom -// HTTP header fields. -type HttpHeaderConditionConfig struct { - _ struct{} `type:"structure"` - - // The name of the HTTP header field. The maximum size is 40 characters. The - // header name is case insensitive. The allowed characters are specified by - // RFC 7230. Wildcards are not supported. - // - // You can't use an HTTP header condition to specify the host header. Use HostHeaderConditionConfig - // to specify a host header condition. - HttpHeaderName *string `type:"string"` - - // The strings to compare against the value of the HTTP header. The maximum - // size of each string is 128 characters. The comparison strings are case insensitive. - // The following wildcard characters are supported: * (matches 0 or more characters) - // and ? (matches exactly 1 character). - // - // If the same header appears multiple times in the request, we search them - // in order until a match is found. - // - // If you specify multiple strings, the condition is satisfied if one of the - // strings matches the value of the HTTP header. To require that all of the - // strings are a match, create one condition per string. - Values []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HttpHeaderConditionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HttpHeaderConditionConfig) GoString() string { - return s.String() -} - -// SetHttpHeaderName sets the HttpHeaderName field's value. -func (s *HttpHeaderConditionConfig) SetHttpHeaderName(v string) *HttpHeaderConditionConfig { - s.HttpHeaderName = &v - return s -} - -// SetValues sets the Values field's value. -func (s *HttpHeaderConditionConfig) SetValues(v []*string) *HttpHeaderConditionConfig { - s.Values = v - return s -} - -// Information about an HTTP method condition. -// -// HTTP defines a set of request methods, also referred to as HTTP verbs. For -// more information, see the HTTP Method Registry (https://www.iana.org/assignments/http-methods/http-methods.xhtml). -// You can also define custom HTTP methods. -type HttpRequestMethodConditionConfig struct { - _ struct{} `type:"structure"` - - // The name of the request method. The maximum size is 40 characters. The allowed - // characters are A-Z, hyphen (-), and underscore (_). The comparison is case - // sensitive. Wildcards are not supported; therefore, the method name must be - // an exact match. - // - // If you specify multiple strings, the condition is satisfied if one of the - // strings matches the HTTP request method. We recommend that you route GET - // and HEAD requests in the same way, because the response to a HEAD request - // may be cached. - Values []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HttpRequestMethodConditionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s HttpRequestMethodConditionConfig) GoString() string { - return s.String() -} - -// SetValues sets the Values field's value. -func (s *HttpRequestMethodConditionConfig) SetValues(v []*string) *HttpRequestMethodConditionConfig { - s.Values = v - return s -} - -// Information about an Elastic Load Balancing resource limit for your Amazon -// Web Services account. -type Limit struct { - _ struct{} `type:"structure"` - - // The maximum value of the limit. - Max *string `type:"string"` - - // The name of the limit. The possible values are: - // - // * application-load-balancers - // - // * condition-values-per-alb-rule - // - // * condition-wildcards-per-alb-rule - // - // * gateway-load-balancers - // - // * gateway-load-balancers-per-vpc - // - // * geneve-target-groups - // - // * listeners-per-application-load-balancer - // - // * listeners-per-network-load-balancer - // - // * network-load-balancers - // - // * rules-per-application-load-balancer - // - // * target-groups - // - // * target-groups-per-action-on-application-load-balancer - // - // * target-groups-per-action-on-network-load-balancer - // - // * target-groups-per-application-load-balancer - // - // * targets-per-application-load-balancer - // - // * targets-per-availability-zone-per-gateway-load-balancer - // - // * targets-per-availability-zone-per-network-load-balancer - // - // * targets-per-network-load-balancer - Name *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Limit) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Limit) GoString() string { - return s.String() -} - -// SetMax sets the Max field's value. -func (s *Limit) SetMax(v string) *Limit { - s.Max = &v - return s -} - -// SetName sets the Name field's value. -func (s *Limit) SetName(v string) *Limit { - s.Name = &v - return s -} - -// Information about a listener. -type Listener struct { - _ struct{} `type:"structure"` - - // [TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) - // policy. - AlpnPolicy []*string `type:"list"` - - // [HTTPS or TLS listener] The default certificate for the listener. - Certificates []*Certificate `type:"list"` - - // The default actions for the listener. - DefaultActions []*Action `type:"list"` - - // The Amazon Resource Name (ARN) of the listener. - ListenerArn *string `type:"string"` - - // The Amazon Resource Name (ARN) of the load balancer. - LoadBalancerArn *string `type:"string"` - - // The port on which the load balancer is listening. - Port *int64 `min:"1" type:"integer"` - - // The protocol for connections from clients to the load balancer. - Protocol *string `type:"string" enum:"ProtocolEnum"` - - // [HTTPS or TLS listener] The security policy that defines which protocols - // and ciphers are supported. - SslPolicy *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Listener) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Listener) GoString() string { - return s.String() -} - -// SetAlpnPolicy sets the AlpnPolicy field's value. -func (s *Listener) SetAlpnPolicy(v []*string) *Listener { - s.AlpnPolicy = v - return s -} - -// SetCertificates sets the Certificates field's value. -func (s *Listener) SetCertificates(v []*Certificate) *Listener { - s.Certificates = v - return s -} - -// SetDefaultActions sets the DefaultActions field's value. -func (s *Listener) SetDefaultActions(v []*Action) *Listener { - s.DefaultActions = v - return s -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *Listener) SetListenerArn(v string) *Listener { - s.ListenerArn = &v - return s -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *Listener) SetLoadBalancerArn(v string) *Listener { - s.LoadBalancerArn = &v - return s -} - -// SetPort sets the Port field's value. -func (s *Listener) SetPort(v int64) *Listener { - s.Port = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *Listener) SetProtocol(v string) *Listener { - s.Protocol = &v - return s -} - -// SetSslPolicy sets the SslPolicy field's value. -func (s *Listener) SetSslPolicy(v string) *Listener { - s.SslPolicy = &v - return s -} - -// Information about a load balancer. -type LoadBalancer struct { - _ struct{} `type:"structure"` - - // The subnets for the load balancer. - AvailabilityZones []*AvailabilityZone `type:"list"` - - // The ID of the Amazon Route 53 hosted zone associated with the load balancer. - CanonicalHostedZoneId *string `type:"string"` - - // The date and time the load balancer was created. - CreatedTime *time.Time `type:"timestamp"` - - // [Application Load Balancers on Outposts] The ID of the customer-owned address - // pool. - CustomerOwnedIpv4Pool *string `type:"string"` - - // The public DNS name of the load balancer. - DNSName *string `type:"string"` - - // The type of IP addresses used by the subnets for your load balancer. The - // possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and - // IPv6 addresses). - IpAddressType *string `type:"string" enum:"IpAddressType"` - - // The Amazon Resource Name (ARN) of the load balancer. - LoadBalancerArn *string `type:"string"` - - // The name of the load balancer. - LoadBalancerName *string `type:"string"` - - // The nodes of an Internet-facing load balancer have public IP addresses. The - // DNS name of an Internet-facing load balancer is publicly resolvable to the - // public IP addresses of the nodes. Therefore, Internet-facing load balancers - // can route requests from clients over the internet. - // - // The nodes of an internal load balancer have only private IP addresses. The - // DNS name of an internal load balancer is publicly resolvable to the private - // IP addresses of the nodes. Therefore, internal load balancers can route requests - // only from clients with access to the VPC for the load balancer. - Scheme *string `type:"string" enum:"LoadBalancerSchemeEnum"` - - // The IDs of the security groups for the load balancer. - SecurityGroups []*string `type:"list"` - - // The state of the load balancer. - State *LoadBalancerState `type:"structure"` - - // The type of load balancer. - Type *string `type:"string" enum:"LoadBalancerTypeEnum"` - - // The ID of the VPC for the load balancer. - VpcId *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancer) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancer) GoString() string { - return s.String() -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *LoadBalancer) SetAvailabilityZones(v []*AvailabilityZone) *LoadBalancer { - s.AvailabilityZones = v - return s -} - -// SetCanonicalHostedZoneId sets the CanonicalHostedZoneId field's value. -func (s *LoadBalancer) SetCanonicalHostedZoneId(v string) *LoadBalancer { - s.CanonicalHostedZoneId = &v - return s -} - -// SetCreatedTime sets the CreatedTime field's value. -func (s *LoadBalancer) SetCreatedTime(v time.Time) *LoadBalancer { - s.CreatedTime = &v - return s -} - -// SetCustomerOwnedIpv4Pool sets the CustomerOwnedIpv4Pool field's value. -func (s *LoadBalancer) SetCustomerOwnedIpv4Pool(v string) *LoadBalancer { - s.CustomerOwnedIpv4Pool = &v - return s -} - -// SetDNSName sets the DNSName field's value. -func (s *LoadBalancer) SetDNSName(v string) *LoadBalancer { - s.DNSName = &v - return s -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *LoadBalancer) SetIpAddressType(v string) *LoadBalancer { - s.IpAddressType = &v - return s -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *LoadBalancer) SetLoadBalancerArn(v string) *LoadBalancer { - s.LoadBalancerArn = &v - return s -} - -// SetLoadBalancerName sets the LoadBalancerName field's value. -func (s *LoadBalancer) SetLoadBalancerName(v string) *LoadBalancer { - s.LoadBalancerName = &v - return s -} - -// SetScheme sets the Scheme field's value. -func (s *LoadBalancer) SetScheme(v string) *LoadBalancer { - s.Scheme = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *LoadBalancer) SetSecurityGroups(v []*string) *LoadBalancer { - s.SecurityGroups = v - return s -} - -// SetState sets the State field's value. -func (s *LoadBalancer) SetState(v *LoadBalancerState) *LoadBalancer { - s.State = v - return s -} - -// SetType sets the Type field's value. -func (s *LoadBalancer) SetType(v string) *LoadBalancer { - s.Type = &v - return s -} - -// SetVpcId sets the VpcId field's value. -func (s *LoadBalancer) SetVpcId(v string) *LoadBalancer { - s.VpcId = &v - return s -} - -// Information about a static IP address for a load balancer. -type LoadBalancerAddress struct { - _ struct{} `type:"structure"` - - // [Network Load Balancers] The allocation ID of the Elastic IP address for - // an internal-facing load balancer. - AllocationId *string `type:"string"` - - // [Network Load Balancers] The IPv6 address. - IPv6Address *string `type:"string"` - - // The static IP address. - IpAddress *string `type:"string"` - - // [Network Load Balancers] The private IPv4 address for an internal load balancer. - PrivateIPv4Address *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerAddress) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerAddress) GoString() string { - return s.String() -} - -// SetAllocationId sets the AllocationId field's value. -func (s *LoadBalancerAddress) SetAllocationId(v string) *LoadBalancerAddress { - s.AllocationId = &v - return s -} - -// SetIPv6Address sets the IPv6Address field's value. -func (s *LoadBalancerAddress) SetIPv6Address(v string) *LoadBalancerAddress { - s.IPv6Address = &v - return s -} - -// SetIpAddress sets the IpAddress field's value. -func (s *LoadBalancerAddress) SetIpAddress(v string) *LoadBalancerAddress { - s.IpAddress = &v - return s -} - -// SetPrivateIPv4Address sets the PrivateIPv4Address field's value. -func (s *LoadBalancerAddress) SetPrivateIPv4Address(v string) *LoadBalancerAddress { - s.PrivateIPv4Address = &v - return s -} - -// Information about a load balancer attribute. -type LoadBalancerAttribute struct { - _ struct{} `type:"structure"` - - // The name of the attribute. - // - // The following attributes are supported by all load balancers: - // - // * deletion_protection.enabled - Indicates whether deletion protection - // is enabled. The value is true or false. The default is false. - // - // * load_balancing.cross_zone.enabled - Indicates whether cross-zone load - // balancing is enabled. The possible values are true and false. The default - // for Network Load Balancers and Gateway Load Balancers is false. The default - // for Application Load Balancers is true, and cannot be changed. - // - // The following attributes are supported by both Application Load Balancers - // and Network Load Balancers: - // - // * access_logs.s3.enabled - Indicates whether access logs are enabled. - // The value is true or false. The default is false. - // - // * access_logs.s3.bucket - The name of the S3 bucket for the access logs. - // This attribute is required if access logs are enabled. The bucket must - // exist in the same region as the load balancer and have a bucket policy - // that grants Elastic Load Balancing permissions to write to the bucket. - // - // * access_logs.s3.prefix - The prefix for the location in the S3 bucket - // for the access logs. - // - // * ipv6.deny_all_igw_traffic - Blocks internet gateway (IGW) access to - // the load balancer. It is set to false for internet-facing load balancers - // and true for internal load balancers, preventing unintended access to - // your internal load balancer through an internet gateway. - // - // The following attributes are supported by only Application Load Balancers: - // - // * idle_timeout.timeout_seconds - The idle timeout value, in seconds. The - // valid range is 1-4000 seconds. The default is 60 seconds. - // - // * routing.http.desync_mitigation_mode - Determines how the load balancer - // handles requests that might pose a security risk to your application. - // The possible values are monitor, defensive, and strictest. The default - // is defensive. - // - // * routing.http.drop_invalid_header_fields.enabled - Indicates whether - // HTTP headers with invalid header fields are removed by the load balancer - // (true) or routed to targets (false). The default is false. - // - // * routing.http.preserve_host_header.enabled - Indicates whether the Application - // Load Balancer should preserve the Host header in the HTTP request and - // send it to the target without any change. The possible values are true - // and false. The default is false. - // - // * routing.http.x_amzn_tls_version_and_cipher_suite.enabled - Indicates - // whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), - // which contain information about the negotiated TLS version and cipher - // suite, are added to the client request before sending it to the target. - // The x-amzn-tls-version header has information about the TLS protocol version - // negotiated with the client, and the x-amzn-tls-cipher-suite header has - // information about the cipher suite negotiated with the client. Both headers - // are in OpenSSL format. The possible values for the attribute are true - // and false. The default is false. - // - // * routing.http.xff_client_port.enabled - Indicates whether the X-Forwarded-For - // header should preserve the source port that the client used to connect - // to the load balancer. The possible values are true and false. The default - // is false. - // - // * routing.http.xff_header_processing.mode - Enables you to modify, preserve, - // or remove the X-Forwarded-For header in the HTTP request before the Application - // Load Balancer sends the request to the target. The possible values are - // append, preserve, and remove. The default is append. If the value is append, - // the Application Load Balancer adds the client IP address (of the last - // hop) to the X-Forwarded-For header in the HTTP request before it sends - // it to targets. If the value is preserve the Application Load Balancer - // preserves the X-Forwarded-For header in the HTTP request, and sends it - // to targets without any change. If the value is remove, the Application - // Load Balancer removes the X-Forwarded-For header in the HTTP request before - // it sends it to targets. - // - // * routing.http2.enabled - Indicates whether HTTP/2 is enabled. The possible - // values are true and false. The default is true. Elastic Load Balancing - // requires that message header names contain only alphanumeric characters - // and hyphens. - // - // * waf.fail_open.enabled - Indicates whether to allow a WAF-enabled load - // balancer to route requests to targets if it is unable to forward the request - // to Amazon Web Services WAF. The possible values are true and false. The - // default is false. - Key *string `type:"string"` - - // The value of the attribute. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerAttribute) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerAttribute) GoString() string { - return s.String() -} - -// SetKey sets the Key field's value. -func (s *LoadBalancerAttribute) SetKey(v string) *LoadBalancerAttribute { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *LoadBalancerAttribute) SetValue(v string) *LoadBalancerAttribute { - s.Value = &v - return s -} - -// Information about the state of the load balancer. -type LoadBalancerState struct { - _ struct{} `type:"structure"` - - // The state code. The initial state of the load balancer is provisioning. After - // the load balancer is fully set up and ready to route traffic, its state is - // active. If load balancer is routing traffic but does not have the resources - // it needs to scale, its state isactive_impaired. If the load balancer could - // not be set up, its state is failed. - Code *string `type:"string" enum:"LoadBalancerStateEnum"` - - // A description of the state. - Reason *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerState) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LoadBalancerState) GoString() string { - return s.String() -} - -// SetCode sets the Code field's value. -func (s *LoadBalancerState) SetCode(v string) *LoadBalancerState { - s.Code = &v - return s -} - -// SetReason sets the Reason field's value. -func (s *LoadBalancerState) SetReason(v string) *LoadBalancerState { - s.Reason = &v - return s -} - -// The codes to use when checking for a successful response from a target. If -// the protocol version is gRPC, these are gRPC codes. Otherwise, these are -// HTTP codes. -type Matcher struct { - _ struct{} `type:"structure"` - - // You can specify values between 0 and 99. You can specify multiple values - // (for example, "0,1") or a range of values (for example, "0-5"). The default - // value is 12. - GrpcCode *string `type:"string"` - - // For Application Load Balancers, you can specify values between 200 and 499, - // with the default value being 200. You can specify multiple values (for example, - // "200,202") or a range of values (for example, "200-299"). - // - // For Network Load Balancers, you can specify values between 200 and 599, with - // the default value being 200-399. You can specify multiple values (for example, - // "200,202") or a range of values (for example, "200-299"). - // - // For Gateway Load Balancers, this must be "200–399". - // - // Note that when using shorthand syntax, some values such as commas need to - // be escaped. - HttpCode *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Matcher) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Matcher) GoString() string { - return s.String() -} - -// SetGrpcCode sets the GrpcCode field's value. -func (s *Matcher) SetGrpcCode(v string) *Matcher { - s.GrpcCode = &v - return s -} - -// SetHttpCode sets the HttpCode field's value. -func (s *Matcher) SetHttpCode(v string) *Matcher { - s.HttpCode = &v - return s -} - -type ModifyListenerInput struct { - _ struct{} `type:"structure"` - - // [TLS listeners] The name of the Application-Layer Protocol Negotiation (ALPN) - // policy. You can specify one policy name. The following are the possible values: - // - // * HTTP1Only - // - // * HTTP2Only - // - // * HTTP2Optional - // - // * HTTP2Preferred - // - // * None - // - // For more information, see ALPN policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#alpn-policies) - // in the Network Load Balancers Guide. - AlpnPolicy []*string `type:"list"` - - // [HTTPS and TLS listeners] The default certificate for the listener. You must - // provide exactly one certificate. Set CertificateArn to the certificate ARN - // but do not set IsDefault. - Certificates []*Certificate `type:"list"` - - // The actions for the default rule. - DefaultActions []*Action `type:"list"` - - // The Amazon Resource Name (ARN) of the listener. - // - // ListenerArn is a required field - ListenerArn *string `type:"string" required:"true"` - - // The port for connections from clients to the load balancer. You cannot specify - // a port for a Gateway Load Balancer. - Port *int64 `min:"1" type:"integer"` - - // The protocol for connections from clients to the load balancer. Application - // Load Balancers support the HTTP and HTTPS protocols. Network Load Balancers - // support the TCP, TLS, UDP, and TCP_UDP protocols. You can’t change the - // protocol to UDP or TCP_UDP if dual-stack mode is enabled. You cannot specify - // a protocol for a Gateway Load Balancer. - Protocol *string `type:"string" enum:"ProtocolEnum"` - - // [HTTPS and TLS listeners] The security policy that defines which protocols - // and ciphers are supported. - // - // For more information, see Security policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies) - // in the Application Load Balancers Guide or Security policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies) - // in the Network Load Balancers Guide. - SslPolicy *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyListenerInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyListenerInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ModifyListenerInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ModifyListenerInput"} - if s.ListenerArn == nil { - invalidParams.Add(request.NewErrParamRequired("ListenerArn")) - } - if s.Port != nil && *s.Port < 1 { - invalidParams.Add(request.NewErrParamMinValue("Port", 1)) - } - if s.DefaultActions != nil { - for i, v := range s.DefaultActions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "DefaultActions", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAlpnPolicy sets the AlpnPolicy field's value. -func (s *ModifyListenerInput) SetAlpnPolicy(v []*string) *ModifyListenerInput { - s.AlpnPolicy = v - return s -} - -// SetCertificates sets the Certificates field's value. -func (s *ModifyListenerInput) SetCertificates(v []*Certificate) *ModifyListenerInput { - s.Certificates = v - return s -} - -// SetDefaultActions sets the DefaultActions field's value. -func (s *ModifyListenerInput) SetDefaultActions(v []*Action) *ModifyListenerInput { - s.DefaultActions = v - return s -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *ModifyListenerInput) SetListenerArn(v string) *ModifyListenerInput { - s.ListenerArn = &v - return s -} - -// SetPort sets the Port field's value. -func (s *ModifyListenerInput) SetPort(v int64) *ModifyListenerInput { - s.Port = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *ModifyListenerInput) SetProtocol(v string) *ModifyListenerInput { - s.Protocol = &v - return s -} - -// SetSslPolicy sets the SslPolicy field's value. -func (s *ModifyListenerInput) SetSslPolicy(v string) *ModifyListenerInput { - s.SslPolicy = &v - return s -} - -type ModifyListenerOutput struct { - _ struct{} `type:"structure"` - - // Information about the modified listener. - Listeners []*Listener `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyListenerOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyListenerOutput) GoString() string { - return s.String() -} - -// SetListeners sets the Listeners field's value. -func (s *ModifyListenerOutput) SetListeners(v []*Listener) *ModifyListenerOutput { - s.Listeners = v - return s -} - -type ModifyLoadBalancerAttributesInput struct { - _ struct{} `type:"structure"` - - // The load balancer attributes. - // - // Attributes is a required field - Attributes []*LoadBalancerAttribute `type:"list" required:"true"` - - // The Amazon Resource Name (ARN) of the load balancer. - // - // LoadBalancerArn is a required field - LoadBalancerArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ModifyLoadBalancerAttributesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ModifyLoadBalancerAttributesInput"} - if s.Attributes == nil { - invalidParams.Add(request.NewErrParamRequired("Attributes")) - } - if s.LoadBalancerArn == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAttributes sets the Attributes field's value. -func (s *ModifyLoadBalancerAttributesInput) SetAttributes(v []*LoadBalancerAttribute) *ModifyLoadBalancerAttributesInput { - s.Attributes = v - return s -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *ModifyLoadBalancerAttributesInput) SetLoadBalancerArn(v string) *ModifyLoadBalancerAttributesInput { - s.LoadBalancerArn = &v - return s -} - -type ModifyLoadBalancerAttributesOutput struct { - _ struct{} `type:"structure"` - - // Information about the load balancer attributes. - Attributes []*LoadBalancerAttribute `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyLoadBalancerAttributesOutput) GoString() string { - return s.String() -} - -// SetAttributes sets the Attributes field's value. -func (s *ModifyLoadBalancerAttributesOutput) SetAttributes(v []*LoadBalancerAttribute) *ModifyLoadBalancerAttributesOutput { - s.Attributes = v - return s -} - -type ModifyRuleInput struct { - _ struct{} `type:"structure"` - - // The actions. - Actions []*Action `type:"list"` - - // The conditions. - Conditions []*RuleCondition `type:"list"` - - // The Amazon Resource Name (ARN) of the rule. - // - // RuleArn is a required field - RuleArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyRuleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyRuleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ModifyRuleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ModifyRuleInput"} - if s.RuleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RuleArn")) - } - if s.Actions != nil { - for i, v := range s.Actions { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Actions", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetActions sets the Actions field's value. -func (s *ModifyRuleInput) SetActions(v []*Action) *ModifyRuleInput { - s.Actions = v - return s -} - -// SetConditions sets the Conditions field's value. -func (s *ModifyRuleInput) SetConditions(v []*RuleCondition) *ModifyRuleInput { - s.Conditions = v - return s -} - -// SetRuleArn sets the RuleArn field's value. -func (s *ModifyRuleInput) SetRuleArn(v string) *ModifyRuleInput { - s.RuleArn = &v - return s -} - -type ModifyRuleOutput struct { - _ struct{} `type:"structure"` - - // Information about the modified rule. - Rules []*Rule `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyRuleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyRuleOutput) GoString() string { - return s.String() -} - -// SetRules sets the Rules field's value. -func (s *ModifyRuleOutput) SetRules(v []*Rule) *ModifyRuleOutput { - s.Rules = v - return s -} - -type ModifyTargetGroupAttributesInput struct { - _ struct{} `type:"structure"` - - // The attributes. - // - // Attributes is a required field - Attributes []*TargetGroupAttribute `type:"list" required:"true"` - - // The Amazon Resource Name (ARN) of the target group. - // - // TargetGroupArn is a required field - TargetGroupArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupAttributesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupAttributesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ModifyTargetGroupAttributesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ModifyTargetGroupAttributesInput"} - if s.Attributes == nil { - invalidParams.Add(request.NewErrParamRequired("Attributes")) - } - if s.TargetGroupArn == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAttributes sets the Attributes field's value. -func (s *ModifyTargetGroupAttributesInput) SetAttributes(v []*TargetGroupAttribute) *ModifyTargetGroupAttributesInput { - s.Attributes = v - return s -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *ModifyTargetGroupAttributesInput) SetTargetGroupArn(v string) *ModifyTargetGroupAttributesInput { - s.TargetGroupArn = &v - return s -} - -type ModifyTargetGroupAttributesOutput struct { - _ struct{} `type:"structure"` - - // Information about the attributes. - Attributes []*TargetGroupAttribute `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupAttributesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupAttributesOutput) GoString() string { - return s.String() -} - -// SetAttributes sets the Attributes field's value. -func (s *ModifyTargetGroupAttributesOutput) SetAttributes(v []*TargetGroupAttribute) *ModifyTargetGroupAttributesOutput { - s.Attributes = v - return s -} - -type ModifyTargetGroupInput struct { - _ struct{} `type:"structure"` - - // Indicates whether health checks are enabled. - HealthCheckEnabled *bool `type:"boolean"` - - // The approximate amount of time, in seconds, between health checks of an individual - // target. - HealthCheckIntervalSeconds *int64 `min:"5" type:"integer"` - - // [HTTP/HTTPS health checks] The destination for health checks on the targets. - // - // [HTTP1 or HTTP2 protocol version] The ping path. The default is /. - // - // [GRPC protocol version] The path of a custom health check method with the - // format /package.service/method. The default is /Amazon Web Services.ALB/healthcheck. - HealthCheckPath *string `min:"1" type:"string"` - - // The port the load balancer uses when performing health checks on targets. - HealthCheckPort *string `type:"string"` - - // The protocol the load balancer uses when performing health checks on targets. - // For Application Load Balancers, the default is HTTP. For Network Load Balancers - // and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported - // for health checks if the protocol of the target group is HTTP or HTTPS. It - // is supported for health checks only if the protocol of the target group is - // TCP, TLS, UDP, or TCP_UDP. The GENEVE, TLS, UDP, and TCP_UDP protocols are - // not supported for health checks. - HealthCheckProtocol *string `type:"string" enum:"ProtocolEnum"` - - // [HTTP/HTTPS health checks] The amount of time, in seconds, during which no - // response means a failed health check. - HealthCheckTimeoutSeconds *int64 `min:"2" type:"integer"` - - // The number of consecutive health checks successes required before considering - // an unhealthy target healthy. - HealthyThresholdCount *int64 `min:"2" type:"integer"` - - // [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for - // a successful response from a target. For target groups with a protocol of - // TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol - // of HTTP or HTTPS, the range is 200-499. For target groups with a protocol - // of GENEVE, the range is 200-399. - Matcher *Matcher `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - // - // TargetGroupArn is a required field - TargetGroupArn *string `type:"string" required:"true"` - - // The number of consecutive health check failures required before considering - // the target unhealthy. - UnhealthyThresholdCount *int64 `min:"2" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ModifyTargetGroupInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ModifyTargetGroupInput"} - if s.HealthCheckIntervalSeconds != nil && *s.HealthCheckIntervalSeconds < 5 { - invalidParams.Add(request.NewErrParamMinValue("HealthCheckIntervalSeconds", 5)) - } - if s.HealthCheckPath != nil && len(*s.HealthCheckPath) < 1 { - invalidParams.Add(request.NewErrParamMinLen("HealthCheckPath", 1)) - } - if s.HealthCheckTimeoutSeconds != nil && *s.HealthCheckTimeoutSeconds < 2 { - invalidParams.Add(request.NewErrParamMinValue("HealthCheckTimeoutSeconds", 2)) - } - if s.HealthyThresholdCount != nil && *s.HealthyThresholdCount < 2 { - invalidParams.Add(request.NewErrParamMinValue("HealthyThresholdCount", 2)) - } - if s.TargetGroupArn == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupArn")) - } - if s.UnhealthyThresholdCount != nil && *s.UnhealthyThresholdCount < 2 { - invalidParams.Add(request.NewErrParamMinValue("UnhealthyThresholdCount", 2)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHealthCheckEnabled sets the HealthCheckEnabled field's value. -func (s *ModifyTargetGroupInput) SetHealthCheckEnabled(v bool) *ModifyTargetGroupInput { - s.HealthCheckEnabled = &v - return s -} - -// SetHealthCheckIntervalSeconds sets the HealthCheckIntervalSeconds field's value. -func (s *ModifyTargetGroupInput) SetHealthCheckIntervalSeconds(v int64) *ModifyTargetGroupInput { - s.HealthCheckIntervalSeconds = &v - return s -} - -// SetHealthCheckPath sets the HealthCheckPath field's value. -func (s *ModifyTargetGroupInput) SetHealthCheckPath(v string) *ModifyTargetGroupInput { - s.HealthCheckPath = &v - return s -} - -// SetHealthCheckPort sets the HealthCheckPort field's value. -func (s *ModifyTargetGroupInput) SetHealthCheckPort(v string) *ModifyTargetGroupInput { - s.HealthCheckPort = &v - return s -} - -// SetHealthCheckProtocol sets the HealthCheckProtocol field's value. -func (s *ModifyTargetGroupInput) SetHealthCheckProtocol(v string) *ModifyTargetGroupInput { - s.HealthCheckProtocol = &v - return s -} - -// SetHealthCheckTimeoutSeconds sets the HealthCheckTimeoutSeconds field's value. -func (s *ModifyTargetGroupInput) SetHealthCheckTimeoutSeconds(v int64) *ModifyTargetGroupInput { - s.HealthCheckTimeoutSeconds = &v - return s -} - -// SetHealthyThresholdCount sets the HealthyThresholdCount field's value. -func (s *ModifyTargetGroupInput) SetHealthyThresholdCount(v int64) *ModifyTargetGroupInput { - s.HealthyThresholdCount = &v - return s -} - -// SetMatcher sets the Matcher field's value. -func (s *ModifyTargetGroupInput) SetMatcher(v *Matcher) *ModifyTargetGroupInput { - s.Matcher = v - return s -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *ModifyTargetGroupInput) SetTargetGroupArn(v string) *ModifyTargetGroupInput { - s.TargetGroupArn = &v - return s -} - -// SetUnhealthyThresholdCount sets the UnhealthyThresholdCount field's value. -func (s *ModifyTargetGroupInput) SetUnhealthyThresholdCount(v int64) *ModifyTargetGroupInput { - s.UnhealthyThresholdCount = &v - return s -} - -type ModifyTargetGroupOutput struct { - _ struct{} `type:"structure"` - - // Information about the modified target group. - TargetGroups []*TargetGroup `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ModifyTargetGroupOutput) GoString() string { - return s.String() -} - -// SetTargetGroups sets the TargetGroups field's value. -func (s *ModifyTargetGroupOutput) SetTargetGroups(v []*TargetGroup) *ModifyTargetGroupOutput { - s.TargetGroups = v - return s -} - -// Information about a path pattern condition. -type PathPatternConditionConfig struct { - _ struct{} `type:"structure"` - - // The path patterns to compare against the request URL. The maximum size of - // each string is 128 characters. The comparison is case sensitive. The following - // wildcard characters are supported: * (matches 0 or more characters) and ? - // (matches exactly 1 character). - // - // If you specify multiple strings, the condition is satisfied if one of them - // matches the request URL. The path pattern is compared only to the path of - // the URL, not to its query string. To compare against the query string, use - // QueryStringConditionConfig. - Values []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PathPatternConditionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PathPatternConditionConfig) GoString() string { - return s.String() -} - -// SetValues sets the Values field's value. -func (s *PathPatternConditionConfig) SetValues(v []*string) *PathPatternConditionConfig { - s.Values = v - return s -} - -// Information about a query string condition. -// -// The query string component of a URI starts after the first '?' character -// and is terminated by either a '#' character or the end of the URI. A typical -// query string contains key/value pairs separated by '&' characters. The allowed -// characters are specified by RFC 3986. Any character can be percentage encoded. -type QueryStringConditionConfig struct { - _ struct{} `type:"structure"` - - // The key/value pairs or values to find in the query string. The maximum size - // of each string is 128 characters. The comparison is case insensitive. The - // following wildcard characters are supported: * (matches 0 or more characters) - // and ? (matches exactly 1 character). To search for a literal '*' or '?' character - // in a query string, you must escape these characters in Values using a '\' - // character. - // - // If you specify multiple key/value pairs or values, the condition is satisfied - // if one of them is found in the query string. - Values []*QueryStringKeyValuePair `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s QueryStringConditionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s QueryStringConditionConfig) GoString() string { - return s.String() -} - -// SetValues sets the Values field's value. -func (s *QueryStringConditionConfig) SetValues(v []*QueryStringKeyValuePair) *QueryStringConditionConfig { - s.Values = v - return s -} - -// Information about a key/value pair. -type QueryStringKeyValuePair struct { - _ struct{} `type:"structure"` - - // The key. You can omit the key. - Key *string `type:"string"` - - // The value. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s QueryStringKeyValuePair) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s QueryStringKeyValuePair) GoString() string { - return s.String() -} - -// SetKey sets the Key field's value. -func (s *QueryStringKeyValuePair) SetKey(v string) *QueryStringKeyValuePair { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *QueryStringKeyValuePair) SetValue(v string) *QueryStringKeyValuePair { - s.Value = &v - return s -} - -// Information about a redirect action. -// -// A URI consists of the following components: protocol://hostname:port/path?query. -// You must modify at least one of the following components to avoid a redirect -// loop: protocol, hostname, port, or path. Any components that you do not modify -// retain their original values. -// -// You can reuse URI components using the following reserved keywords: -// -// - #{protocol} -// -// - #{host} -// -// - #{port} -// -// - #{path} (the leading "/" is removed) -// -// - #{query} -// -// For example, you can change the path to "/new/#{path}", the hostname to "example.#{host}", -// or the query to "#{query}&value=xyz". -type RedirectActionConfig struct { - _ struct{} `type:"structure"` - - // The hostname. This component is not percent-encoded. The hostname can contain - // #{host}. - Host *string `min:"1" type:"string"` - - // The absolute path, starting with the leading "/". This component is not percent-encoded. - // The path can contain #{host}, #{path}, and #{port}. - Path *string `min:"1" type:"string"` - - // The port. You can specify a value from 1 to 65535 or #{port}. - Port *string `type:"string"` - - // The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect - // HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS - // to HTTP. - Protocol *string `type:"string"` - - // The query parameters, URL-encoded when necessary, but not percent-encoded. - // Do not include the leading "?", as it is automatically added. You can specify - // any of the reserved keywords. - Query *string `type:"string"` - - // The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary - // (HTTP 302). - // - // StatusCode is a required field - StatusCode *string `type:"string" required:"true" enum:"RedirectActionStatusCodeEnum"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RedirectActionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RedirectActionConfig) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RedirectActionConfig) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RedirectActionConfig"} - if s.Host != nil && len(*s.Host) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Host", 1)) - } - if s.Path != nil && len(*s.Path) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Path", 1)) - } - if s.StatusCode == nil { - invalidParams.Add(request.NewErrParamRequired("StatusCode")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHost sets the Host field's value. -func (s *RedirectActionConfig) SetHost(v string) *RedirectActionConfig { - s.Host = &v - return s -} - -// SetPath sets the Path field's value. -func (s *RedirectActionConfig) SetPath(v string) *RedirectActionConfig { - s.Path = &v - return s -} - -// SetPort sets the Port field's value. -func (s *RedirectActionConfig) SetPort(v string) *RedirectActionConfig { - s.Port = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *RedirectActionConfig) SetProtocol(v string) *RedirectActionConfig { - s.Protocol = &v - return s -} - -// SetQuery sets the Query field's value. -func (s *RedirectActionConfig) SetQuery(v string) *RedirectActionConfig { - s.Query = &v - return s -} - -// SetStatusCode sets the StatusCode field's value. -func (s *RedirectActionConfig) SetStatusCode(v string) *RedirectActionConfig { - s.StatusCode = &v - return s -} - -type RegisterTargetsInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - // - // TargetGroupArn is a required field - TargetGroupArn *string `type:"string" required:"true"` - - // The targets. - // - // Targets is a required field - Targets []*TargetDescription `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterTargetsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterTargetsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RegisterTargetsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RegisterTargetsInput"} - if s.TargetGroupArn == nil { - invalidParams.Add(request.NewErrParamRequired("TargetGroupArn")) - } - if s.Targets == nil { - invalidParams.Add(request.NewErrParamRequired("Targets")) - } - if s.Targets != nil { - for i, v := range s.Targets { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Targets", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *RegisterTargetsInput) SetTargetGroupArn(v string) *RegisterTargetsInput { - s.TargetGroupArn = &v - return s -} - -// SetTargets sets the Targets field's value. -func (s *RegisterTargetsInput) SetTargets(v []*TargetDescription) *RegisterTargetsInput { - s.Targets = v - return s -} - -type RegisterTargetsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterTargetsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RegisterTargetsOutput) GoString() string { - return s.String() -} - -type RemoveListenerCertificatesInput struct { - _ struct{} `type:"structure"` - - // The certificate to remove. You can specify one certificate per call. Set - // CertificateArn to the certificate ARN but do not set IsDefault. - // - // Certificates is a required field - Certificates []*Certificate `type:"list" required:"true"` - - // The Amazon Resource Name (ARN) of the listener. - // - // ListenerArn is a required field - ListenerArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveListenerCertificatesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveListenerCertificatesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RemoveListenerCertificatesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RemoveListenerCertificatesInput"} - if s.Certificates == nil { - invalidParams.Add(request.NewErrParamRequired("Certificates")) - } - if s.ListenerArn == nil { - invalidParams.Add(request.NewErrParamRequired("ListenerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCertificates sets the Certificates field's value. -func (s *RemoveListenerCertificatesInput) SetCertificates(v []*Certificate) *RemoveListenerCertificatesInput { - s.Certificates = v - return s -} - -// SetListenerArn sets the ListenerArn field's value. -func (s *RemoveListenerCertificatesInput) SetListenerArn(v string) *RemoveListenerCertificatesInput { - s.ListenerArn = &v - return s -} - -type RemoveListenerCertificatesOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveListenerCertificatesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveListenerCertificatesOutput) GoString() string { - return s.String() -} - -type RemoveTagsInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the resource. - // - // ResourceArns is a required field - ResourceArns []*string `type:"list" required:"true"` - - // The tag keys for the tags to remove. - // - // TagKeys is a required field - TagKeys []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RemoveTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RemoveTagsInput"} - if s.ResourceArns == nil { - invalidParams.Add(request.NewErrParamRequired("ResourceArns")) - } - if s.TagKeys == nil { - invalidParams.Add(request.NewErrParamRequired("TagKeys")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetResourceArns sets the ResourceArns field's value. -func (s *RemoveTagsInput) SetResourceArns(v []*string) *RemoveTagsInput { - s.ResourceArns = v - return s -} - -// SetTagKeys sets the TagKeys field's value. -func (s *RemoveTagsInput) SetTagKeys(v []*string) *RemoveTagsInput { - s.TagKeys = v - return s -} - -type RemoveTagsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RemoveTagsOutput) GoString() string { - return s.String() -} - -// Information about a rule. -type Rule struct { - _ struct{} `type:"structure"` - - // The actions. Each rule must include exactly one of the following types of - // actions: forward, redirect, or fixed-response, and it must be the last action - // to be performed. - Actions []*Action `type:"list"` - - // The conditions. Each rule can include zero or one of the following conditions: - // http-request-method, host-header, path-pattern, and source-ip, and zero or - // more of the following conditions: http-header and query-string. - Conditions []*RuleCondition `type:"list"` - - // Indicates whether this is the default rule. - IsDefault *bool `type:"boolean"` - - // The priority. - Priority *string `type:"string"` - - // The Amazon Resource Name (ARN) of the rule. - RuleArn *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Rule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Rule) GoString() string { - return s.String() -} - -// SetActions sets the Actions field's value. -func (s *Rule) SetActions(v []*Action) *Rule { - s.Actions = v - return s -} - -// SetConditions sets the Conditions field's value. -func (s *Rule) SetConditions(v []*RuleCondition) *Rule { - s.Conditions = v - return s -} - -// SetIsDefault sets the IsDefault field's value. -func (s *Rule) SetIsDefault(v bool) *Rule { - s.IsDefault = &v - return s -} - -// SetPriority sets the Priority field's value. -func (s *Rule) SetPriority(v string) *Rule { - s.Priority = &v - return s -} - -// SetRuleArn sets the RuleArn field's value. -func (s *Rule) SetRuleArn(v string) *Rule { - s.RuleArn = &v - return s -} - -// Information about a condition for a rule. -// -// Each rule can optionally include up to one of each of the following conditions: -// http-request-method, host-header, path-pattern, and source-ip. Each rule -// can also optionally include one or more of each of the following conditions: -// http-header and query-string. Note that the value for a condition cannot -// be empty. -type RuleCondition struct { - _ struct{} `type:"structure"` - - // The field in the HTTP request. The following are the possible values: - // - // * http-header - // - // * http-request-method - // - // * host-header - // - // * path-pattern - // - // * query-string - // - // * source-ip - Field *string `type:"string"` - - // Information for a host header condition. Specify only when Field is host-header. - HostHeaderConfig *HostHeaderConditionConfig `type:"structure"` - - // Information for an HTTP header condition. Specify only when Field is http-header. - HttpHeaderConfig *HttpHeaderConditionConfig `type:"structure"` - - // Information for an HTTP method condition. Specify only when Field is http-request-method. - HttpRequestMethodConfig *HttpRequestMethodConditionConfig `type:"structure"` - - // Information for a path pattern condition. Specify only when Field is path-pattern. - PathPatternConfig *PathPatternConditionConfig `type:"structure"` - - // Information for a query string condition. Specify only when Field is query-string. - QueryStringConfig *QueryStringConditionConfig `type:"structure"` - - // Information for a source IP condition. Specify only when Field is source-ip. - SourceIpConfig *SourceIpConditionConfig `type:"structure"` - - // The condition value. Specify only when Field is host-header or path-pattern. - // Alternatively, to specify multiple host names or multiple path patterns, - // use HostHeaderConfig or PathPatternConfig. - // - // If Field is host-header and you are not using HostHeaderConfig, you can specify - // a single host name (for example, my.example.com) in Values. A host name is - // case insensitive, can be up to 128 characters in length, and can contain - // any of the following characters. - // - // * A-Z, a-z, 0-9 - // - // * - . - // - // * * (matches 0 or more characters) - // - // * ? (matches exactly 1 character) - // - // If Field is path-pattern and you are not using PathPatternConfig, you can - // specify a single path pattern (for example, /img/*) in Values. A path pattern - // is case-sensitive, can be up to 128 characters in length, and can contain - // any of the following characters. - // - // * A-Z, a-z, 0-9 - // - // * _ - . $ / ~ " ' @ : + - // - // * & (using &) - // - // * * (matches 0 or more characters) - // - // * ? (matches exactly 1 character) - Values []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RuleCondition) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RuleCondition) GoString() string { - return s.String() -} - -// SetField sets the Field field's value. -func (s *RuleCondition) SetField(v string) *RuleCondition { - s.Field = &v - return s -} - -// SetHostHeaderConfig sets the HostHeaderConfig field's value. -func (s *RuleCondition) SetHostHeaderConfig(v *HostHeaderConditionConfig) *RuleCondition { - s.HostHeaderConfig = v - return s -} - -// SetHttpHeaderConfig sets the HttpHeaderConfig field's value. -func (s *RuleCondition) SetHttpHeaderConfig(v *HttpHeaderConditionConfig) *RuleCondition { - s.HttpHeaderConfig = v - return s -} - -// SetHttpRequestMethodConfig sets the HttpRequestMethodConfig field's value. -func (s *RuleCondition) SetHttpRequestMethodConfig(v *HttpRequestMethodConditionConfig) *RuleCondition { - s.HttpRequestMethodConfig = v - return s -} - -// SetPathPatternConfig sets the PathPatternConfig field's value. -func (s *RuleCondition) SetPathPatternConfig(v *PathPatternConditionConfig) *RuleCondition { - s.PathPatternConfig = v - return s -} - -// SetQueryStringConfig sets the QueryStringConfig field's value. -func (s *RuleCondition) SetQueryStringConfig(v *QueryStringConditionConfig) *RuleCondition { - s.QueryStringConfig = v - return s -} - -// SetSourceIpConfig sets the SourceIpConfig field's value. -func (s *RuleCondition) SetSourceIpConfig(v *SourceIpConditionConfig) *RuleCondition { - s.SourceIpConfig = v - return s -} - -// SetValues sets the Values field's value. -func (s *RuleCondition) SetValues(v []*string) *RuleCondition { - s.Values = v - return s -} - -// Information about the priorities for the rules for a listener. -type RulePriorityPair struct { - _ struct{} `type:"structure"` - - // The rule priority. - Priority *int64 `min:"1" type:"integer"` - - // The Amazon Resource Name (ARN) of the rule. - RuleArn *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RulePriorityPair) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RulePriorityPair) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RulePriorityPair) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RulePriorityPair"} - if s.Priority != nil && *s.Priority < 1 { - invalidParams.Add(request.NewErrParamMinValue("Priority", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPriority sets the Priority field's value. -func (s *RulePriorityPair) SetPriority(v int64) *RulePriorityPair { - s.Priority = &v - return s -} - -// SetRuleArn sets the RuleArn field's value. -func (s *RulePriorityPair) SetRuleArn(v string) *RulePriorityPair { - s.RuleArn = &v - return s -} - -type SetIpAddressTypeInput struct { - _ struct{} `type:"structure"` - - // The IP address type. The possible values are ipv4 (for IPv4 addresses) and - // dualstack (for IPv4 and IPv6 addresses). You can’t specify dualstack for - // a load balancer with a UDP or TCP_UDP listener. - // - // IpAddressType is a required field - IpAddressType *string `type:"string" required:"true" enum:"IpAddressType"` - - // The Amazon Resource Name (ARN) of the load balancer. - // - // LoadBalancerArn is a required field - LoadBalancerArn *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetIpAddressTypeInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetIpAddressTypeInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetIpAddressTypeInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetIpAddressTypeInput"} - if s.IpAddressType == nil { - invalidParams.Add(request.NewErrParamRequired("IpAddressType")) - } - if s.LoadBalancerArn == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *SetIpAddressTypeInput) SetIpAddressType(v string) *SetIpAddressTypeInput { - s.IpAddressType = &v - return s -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *SetIpAddressTypeInput) SetLoadBalancerArn(v string) *SetIpAddressTypeInput { - s.LoadBalancerArn = &v - return s -} - -type SetIpAddressTypeOutput struct { - _ struct{} `type:"structure"` - - // The IP address type. - IpAddressType *string `type:"string" enum:"IpAddressType"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetIpAddressTypeOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetIpAddressTypeOutput) GoString() string { - return s.String() -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *SetIpAddressTypeOutput) SetIpAddressType(v string) *SetIpAddressTypeOutput { - s.IpAddressType = &v - return s -} - -type SetRulePrioritiesInput struct { - _ struct{} `type:"structure"` - - // The rule priorities. - // - // RulePriorities is a required field - RulePriorities []*RulePriorityPair `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetRulePrioritiesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetRulePrioritiesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetRulePrioritiesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetRulePrioritiesInput"} - if s.RulePriorities == nil { - invalidParams.Add(request.NewErrParamRequired("RulePriorities")) - } - if s.RulePriorities != nil { - for i, v := range s.RulePriorities { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RulePriorities", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRulePriorities sets the RulePriorities field's value. -func (s *SetRulePrioritiesInput) SetRulePriorities(v []*RulePriorityPair) *SetRulePrioritiesInput { - s.RulePriorities = v - return s -} - -type SetRulePrioritiesOutput struct { - _ struct{} `type:"structure"` - - // Information about the rules. - Rules []*Rule `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetRulePrioritiesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetRulePrioritiesOutput) GoString() string { - return s.String() -} - -// SetRules sets the Rules field's value. -func (s *SetRulePrioritiesOutput) SetRules(v []*Rule) *SetRulePrioritiesOutput { - s.Rules = v - return s -} - -type SetSecurityGroupsInput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the load balancer. - // - // LoadBalancerArn is a required field - LoadBalancerArn *string `type:"string" required:"true"` - - // The IDs of the security groups. - // - // SecurityGroups is a required field - SecurityGroups []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSecurityGroupsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSecurityGroupsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetSecurityGroupsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetSecurityGroupsInput"} - if s.LoadBalancerArn == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerArn")) - } - if s.SecurityGroups == nil { - invalidParams.Add(request.NewErrParamRequired("SecurityGroups")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *SetSecurityGroupsInput) SetLoadBalancerArn(v string) *SetSecurityGroupsInput { - s.LoadBalancerArn = &v - return s -} - -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *SetSecurityGroupsInput) SetSecurityGroups(v []*string) *SetSecurityGroupsInput { - s.SecurityGroups = v - return s -} - -type SetSecurityGroupsOutput struct { - _ struct{} `type:"structure"` - - // The IDs of the security groups associated with the load balancer. - SecurityGroupIds []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSecurityGroupsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSecurityGroupsOutput) GoString() string { - return s.String() -} - -// SetSecurityGroupIds sets the SecurityGroupIds field's value. -func (s *SetSecurityGroupsOutput) SetSecurityGroupIds(v []*string) *SetSecurityGroupsOutput { - s.SecurityGroupIds = v - return s -} - -type SetSubnetsInput struct { - _ struct{} `type:"structure"` - - // [Network Load Balancers] The type of IP addresses used by the subnets for - // your load balancer. The possible values are ipv4 (for IPv4 addresses) and - // dualstack (for IPv4 and IPv6 addresses). You can’t specify dualstack for - // a load balancer with a UDP or TCP_UDP listener. . - IpAddressType *string `type:"string" enum:"IpAddressType"` - - // The Amazon Resource Name (ARN) of the load balancer. - // - // LoadBalancerArn is a required field - LoadBalancerArn *string `type:"string" required:"true"` - - // The IDs of the public subnets. You can specify only one subnet per Availability - // Zone. You must specify either subnets or subnet mappings. - // - // [Application Load Balancers] You must specify subnets from at least two Availability - // Zones. You cannot specify Elastic IP addresses for your subnets. - // - // [Application Load Balancers on Outposts] You must specify one Outpost subnet. - // - // [Application Load Balancers on Local Zones] You can specify subnets from - // one or more Local Zones. - // - // [Network Load Balancers] You can specify subnets from one or more Availability - // Zones. You can specify one Elastic IP address per subnet if you need static - // IP addresses for your internet-facing load balancer. For internal load balancers, - // you can specify one private IP address per subnet from the IPv4 range of - // the subnet. For internet-facing load balancer, you can specify one IPv6 address - // per subnet. - SubnetMappings []*SubnetMapping `type:"list"` - - // The IDs of the public subnets. You can specify only one subnet per Availability - // Zone. You must specify either subnets or subnet mappings. - // - // [Application Load Balancers] You must specify subnets from at least two Availability - // Zones. - // - // [Application Load Balancers on Outposts] You must specify one Outpost subnet. - // - // [Application Load Balancers on Local Zones] You can specify subnets from - // one or more Local Zones. - // - // [Network Load Balancers] You can specify subnets from one or more Availability - // Zones. - Subnets []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSubnetsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSubnetsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SetSubnetsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SetSubnetsInput"} - if s.LoadBalancerArn == nil { - invalidParams.Add(request.NewErrParamRequired("LoadBalancerArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *SetSubnetsInput) SetIpAddressType(v string) *SetSubnetsInput { - s.IpAddressType = &v - return s -} - -// SetLoadBalancerArn sets the LoadBalancerArn field's value. -func (s *SetSubnetsInput) SetLoadBalancerArn(v string) *SetSubnetsInput { - s.LoadBalancerArn = &v - return s -} - -// SetSubnetMappings sets the SubnetMappings field's value. -func (s *SetSubnetsInput) SetSubnetMappings(v []*SubnetMapping) *SetSubnetsInput { - s.SubnetMappings = v - return s -} - -// SetSubnets sets the Subnets field's value. -func (s *SetSubnetsInput) SetSubnets(v []*string) *SetSubnetsInput { - s.Subnets = v - return s -} - -type SetSubnetsOutput struct { - _ struct{} `type:"structure"` - - // Information about the subnets. - AvailabilityZones []*AvailabilityZone `type:"list"` - - // [Network Load Balancers] The IP address type. - IpAddressType *string `type:"string" enum:"IpAddressType"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSubnetsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SetSubnetsOutput) GoString() string { - return s.String() -} - -// SetAvailabilityZones sets the AvailabilityZones field's value. -func (s *SetSubnetsOutput) SetAvailabilityZones(v []*AvailabilityZone) *SetSubnetsOutput { - s.AvailabilityZones = v - return s -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *SetSubnetsOutput) SetIpAddressType(v string) *SetSubnetsOutput { - s.IpAddressType = &v - return s -} - -// Information about a source IP condition. -// -// You can use this condition to route based on the IP address of the source -// that connects to the load balancer. If a client is behind a proxy, this is -// the IP address of the proxy not the IP address of the client. -type SourceIpConditionConfig struct { - _ struct{} `type:"structure"` - - // The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. - // Wildcards are not supported. - // - // If you specify multiple addresses, the condition is satisfied if the source - // IP address of the request matches one of the CIDR blocks. This condition - // is not satisfied by the addresses in the X-Forwarded-For header. To search - // for addresses in the X-Forwarded-For header, use HttpHeaderConditionConfig. - Values []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SourceIpConditionConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SourceIpConditionConfig) GoString() string { - return s.String() -} - -// SetValues sets the Values field's value. -func (s *SourceIpConditionConfig) SetValues(v []*string) *SourceIpConditionConfig { - s.Values = v - return s -} - -// Information about a policy used for SSL negotiation. -type SslPolicy struct { - _ struct{} `type:"structure"` - - // The ciphers. - Ciphers []*Cipher `type:"list"` - - // The name of the policy. - Name *string `type:"string"` - - // The protocols. - SslProtocols []*string `type:"list"` - - // The supported load balancers. - SupportedLoadBalancerTypes []*string `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SslPolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SslPolicy) GoString() string { - return s.String() -} - -// SetCiphers sets the Ciphers field's value. -func (s *SslPolicy) SetCiphers(v []*Cipher) *SslPolicy { - s.Ciphers = v - return s -} - -// SetName sets the Name field's value. -func (s *SslPolicy) SetName(v string) *SslPolicy { - s.Name = &v - return s -} - -// SetSslProtocols sets the SslProtocols field's value. -func (s *SslPolicy) SetSslProtocols(v []*string) *SslPolicy { - s.SslProtocols = v - return s -} - -// SetSupportedLoadBalancerTypes sets the SupportedLoadBalancerTypes field's value. -func (s *SslPolicy) SetSupportedLoadBalancerTypes(v []*string) *SslPolicy { - s.SupportedLoadBalancerTypes = v - return s -} - -// Information about a subnet mapping. -type SubnetMapping struct { - _ struct{} `type:"structure"` - - // [Network Load Balancers] The allocation ID of the Elastic IP address for - // an internet-facing load balancer. - AllocationId *string `type:"string"` - - // [Network Load Balancers] The IPv6 address. - IPv6Address *string `type:"string"` - - // [Network Load Balancers] The private IPv4 address for an internal load balancer. - PrivateIPv4Address *string `type:"string"` - - // The ID of the subnet. - SubnetId *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SubnetMapping) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SubnetMapping) GoString() string { - return s.String() -} - -// SetAllocationId sets the AllocationId field's value. -func (s *SubnetMapping) SetAllocationId(v string) *SubnetMapping { - s.AllocationId = &v - return s -} - -// SetIPv6Address sets the IPv6Address field's value. -func (s *SubnetMapping) SetIPv6Address(v string) *SubnetMapping { - s.IPv6Address = &v - return s -} - -// SetPrivateIPv4Address sets the PrivateIPv4Address field's value. -func (s *SubnetMapping) SetPrivateIPv4Address(v string) *SubnetMapping { - s.PrivateIPv4Address = &v - return s -} - -// SetSubnetId sets the SubnetId field's value. -func (s *SubnetMapping) SetSubnetId(v string) *SubnetMapping { - s.SubnetId = &v - return s -} - -// Information about a tag. -type Tag struct { - _ struct{} `type:"structure"` - - // The key of the tag. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // The value of the tag. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Tag) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -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 invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *Tag) SetKey(v string) *Tag { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *Tag) SetValue(v string) *Tag { - s.Value = &v - return s -} - -// The tags associated with a resource. -type TagDescription struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the resource. - ResourceArn *string `type:"string"` - - // Information about the tags. - Tags []*Tag `min:"1" type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagDescription) GoString() string { - return s.String() -} - -// SetResourceArn sets the ResourceArn field's value. -func (s *TagDescription) SetResourceArn(v string) *TagDescription { - s.ResourceArn = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *TagDescription) SetTags(v []*Tag) *TagDescription { - s.Tags = v - return s -} - -// Information about a target. -type TargetDescription struct { - _ struct{} `type:"structure"` - - // An Availability Zone or all. This determines whether the target receives - // traffic from the load balancer nodes in the specified Availability Zone or - // from all enabled Availability Zones for the load balancer. - // - // For Application Load Balancer target groups, the specified Availability Zone - // value is only applicable when cross-zone load balancing is off. Otherwise - // the parameter is ignored and treated as all. - // - // This parameter is not supported if the target type of the target group is - // instance or alb. - // - // If the target type is ip and the IP address is in a subnet of the VPC for - // the target group, the Availability Zone is automatically detected and this - // parameter is optional. If the IP address is outside the VPC, this parameter - // is required. - // - // For Application Load Balancer target groups with cross-zone load balancing - // off, if the target type is ip and the IP address is outside of the VPC for - // the target group, this should be an Availability Zone inside the VPC for - // the target group. - // - // If the target type is lambda, this parameter is optional and the only supported - // value is all. - AvailabilityZone *string `type:"string"` - - // The ID of the target. If the target type of the target group is instance, - // specify an instance ID. If the target type is ip, specify an IP address. - // If the target type is lambda, specify the ARN of the Lambda function. If - // the target type is alb, specify the ARN of the Application Load Balancer - // target. - // - // Id is a required field - Id *string `type:"string" required:"true"` - - // The port on which the target is listening. If the target group protocol is - // GENEVE, the supported port is 6081. If the target type is alb, the targeted - // Application Load Balancer must have at least one listener whose port matches - // the target group port. Not used if the target is a Lambda function. - Port *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetDescription) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TargetDescription) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TargetDescription"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.Port != nil && *s.Port < 1 { - invalidParams.Add(request.NewErrParamMinValue("Port", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAvailabilityZone sets the AvailabilityZone field's value. -func (s *TargetDescription) SetAvailabilityZone(v string) *TargetDescription { - s.AvailabilityZone = &v - return s -} - -// SetId sets the Id field's value. -func (s *TargetDescription) SetId(v string) *TargetDescription { - s.Id = &v - return s -} - -// SetPort sets the Port field's value. -func (s *TargetDescription) SetPort(v int64) *TargetDescription { - s.Port = &v - return s -} - -// Information about a target group. -type TargetGroup struct { - _ struct{} `type:"structure"` - - // Indicates whether health checks are enabled. - HealthCheckEnabled *bool `type:"boolean"` - - // The approximate amount of time, in seconds, between health checks of an individual - // target. - HealthCheckIntervalSeconds *int64 `min:"5" type:"integer"` - - // The destination for health checks on the targets. - HealthCheckPath *string `min:"1" type:"string"` - - // The port to use to connect with the target. - HealthCheckPort *string `type:"string"` - - // The protocol to use to connect with the target. The GENEVE, TLS, UDP, and - // TCP_UDP protocols are not supported for health checks. - HealthCheckProtocol *string `type:"string" enum:"ProtocolEnum"` - - // The amount of time, in seconds, during which no response means a failed health - // check. - HealthCheckTimeoutSeconds *int64 `min:"2" type:"integer"` - - // The number of consecutive health checks successes required before considering - // an unhealthy target healthy. - HealthyThresholdCount *int64 `min:"2" type:"integer"` - - // The type of IP address used for this target group. The possible values are - // ipv4 and ipv6. This is an optional parameter. If not specified, the IP address - // type defaults to ipv4. - IpAddressType *string `type:"string" enum:"TargetGroupIpAddressTypeEnum"` - - // The Amazon Resource Names (ARN) of the load balancers that route traffic - // to this target group. - LoadBalancerArns []*string `type:"list"` - - // The HTTP or gRPC codes to use when checking for a successful response from - // a target. - Matcher *Matcher `type:"structure"` - - // The port on which the targets are listening. Not used if the target is a - // Lambda function. - Port *int64 `min:"1" type:"integer"` - - // The protocol to use for routing traffic to the targets. - Protocol *string `type:"string" enum:"ProtocolEnum"` - - // [HTTP/HTTPS protocol] The protocol version. The possible values are GRPC, - // HTTP1, and HTTP2. - ProtocolVersion *string `type:"string"` - - // The Amazon Resource Name (ARN) of the target group. - TargetGroupArn *string `type:"string"` - - // The name of the target group. - TargetGroupName *string `type:"string"` - - // The type of target that you must specify when registering targets with this - // target group. The possible values are instance (register targets by instance - // ID), ip (register targets by IP address), lambda (register a single Lambda - // function as a target), or alb (register a single Application Load Balancer - // as a target). - TargetType *string `type:"string" enum:"TargetTypeEnum"` - - // The number of consecutive health check failures required before considering - // the target unhealthy. - UnhealthyThresholdCount *int64 `min:"2" type:"integer"` - - // The ID of the VPC for the targets. - VpcId *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroup) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroup) GoString() string { - return s.String() -} - -// SetHealthCheckEnabled sets the HealthCheckEnabled field's value. -func (s *TargetGroup) SetHealthCheckEnabled(v bool) *TargetGroup { - s.HealthCheckEnabled = &v - return s -} - -// SetHealthCheckIntervalSeconds sets the HealthCheckIntervalSeconds field's value. -func (s *TargetGroup) SetHealthCheckIntervalSeconds(v int64) *TargetGroup { - s.HealthCheckIntervalSeconds = &v - return s -} - -// SetHealthCheckPath sets the HealthCheckPath field's value. -func (s *TargetGroup) SetHealthCheckPath(v string) *TargetGroup { - s.HealthCheckPath = &v - return s -} - -// SetHealthCheckPort sets the HealthCheckPort field's value. -func (s *TargetGroup) SetHealthCheckPort(v string) *TargetGroup { - s.HealthCheckPort = &v - return s -} - -// SetHealthCheckProtocol sets the HealthCheckProtocol field's value. -func (s *TargetGroup) SetHealthCheckProtocol(v string) *TargetGroup { - s.HealthCheckProtocol = &v - return s -} - -// SetHealthCheckTimeoutSeconds sets the HealthCheckTimeoutSeconds field's value. -func (s *TargetGroup) SetHealthCheckTimeoutSeconds(v int64) *TargetGroup { - s.HealthCheckTimeoutSeconds = &v - return s -} - -// SetHealthyThresholdCount sets the HealthyThresholdCount field's value. -func (s *TargetGroup) SetHealthyThresholdCount(v int64) *TargetGroup { - s.HealthyThresholdCount = &v - return s -} - -// SetIpAddressType sets the IpAddressType field's value. -func (s *TargetGroup) SetIpAddressType(v string) *TargetGroup { - s.IpAddressType = &v - return s -} - -// SetLoadBalancerArns sets the LoadBalancerArns field's value. -func (s *TargetGroup) SetLoadBalancerArns(v []*string) *TargetGroup { - s.LoadBalancerArns = v - return s -} - -// SetMatcher sets the Matcher field's value. -func (s *TargetGroup) SetMatcher(v *Matcher) *TargetGroup { - s.Matcher = v - return s -} - -// SetPort sets the Port field's value. -func (s *TargetGroup) SetPort(v int64) *TargetGroup { - s.Port = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *TargetGroup) SetProtocol(v string) *TargetGroup { - s.Protocol = &v - return s -} - -// SetProtocolVersion sets the ProtocolVersion field's value. -func (s *TargetGroup) SetProtocolVersion(v string) *TargetGroup { - s.ProtocolVersion = &v - return s -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *TargetGroup) SetTargetGroupArn(v string) *TargetGroup { - s.TargetGroupArn = &v - return s -} - -// SetTargetGroupName sets the TargetGroupName field's value. -func (s *TargetGroup) SetTargetGroupName(v string) *TargetGroup { - s.TargetGroupName = &v - return s -} - -// SetTargetType sets the TargetType field's value. -func (s *TargetGroup) SetTargetType(v string) *TargetGroup { - s.TargetType = &v - return s -} - -// SetUnhealthyThresholdCount sets the UnhealthyThresholdCount field's value. -func (s *TargetGroup) SetUnhealthyThresholdCount(v int64) *TargetGroup { - s.UnhealthyThresholdCount = &v - return s -} - -// SetVpcId sets the VpcId field's value. -func (s *TargetGroup) SetVpcId(v string) *TargetGroup { - s.VpcId = &v - return s -} - -// Information about a target group attribute. -type TargetGroupAttribute struct { - _ struct{} `type:"structure"` - - // The name of the attribute. - // - // The following attributes are supported by all load balancers: - // - // * deregistration_delay.timeout_seconds - The amount of time, in seconds, - // for Elastic Load Balancing to wait before changing the state of a deregistering - // target from draining to unused. The range is 0-3600 seconds. The default - // value is 300 seconds. If the target is a Lambda function, this attribute - // is not supported. - // - // * stickiness.enabled - Indicates whether target stickiness is enabled. - // The value is true or false. The default is false. - // - // * stickiness.type - Indicates the type of stickiness. The possible values - // are: lb_cookie and app_cookie for Application Load Balancers. source_ip - // for Network Load Balancers. source_ip_dest_ip and source_ip_dest_ip_proto - // for Gateway Load Balancers. - // - // The following attributes are supported by Application Load Balancers and - // Network Load Balancers: - // - // * load_balancing.cross_zone.enabled - Indicates whether cross zone load - // balancing is enabled. The value is true, false or use_load_balancer_configuration. - // The default is use_load_balancer_configuration. - // - // * target_group_health.dns_failover.minimum_healthy_targets.count - The - // minimum number of targets that must be healthy. If the number of healthy - // targets is below this value, mark the zone as unhealthy in DNS, so that - // traffic is routed only to healthy zones. The possible values are off or - // an integer from 1 to the maximum number of targets. The default is off. - // - // * target_group_health.dns_failover.minimum_healthy_targets.percentage - // - The minimum percentage of targets that must be healthy. If the percentage - // of healthy targets is below this value, mark the zone as unhealthy in - // DNS, so that traffic is routed only to healthy zones. The possible values - // are off or an integer from 1 to 100. The default is off. - // - // * target_group_health.unhealthy_state_routing.minimum_healthy_targets.count - // - The minimum number of targets that must be healthy. If the number of - // healthy targets is below this value, send traffic to all targets, including - // unhealthy targets. The possible values are 1 to the maximum number of - // targets. The default is 1. - // - // * target_group_health.unhealthy_state_routing.minimum_healthy_targets.percentage - // - The minimum percentage of targets that must be healthy. If the percentage - // of healthy targets is below this value, send traffic to all targets, including - // unhealthy targets. The possible values are off or an integer from 1 to - // 100. The default is off. - // - // The following attributes are supported only if the load balancer is an Application - // Load Balancer and the target is an instance or an IP address: - // - // * load_balancing.algorithm.type - The load balancing algorithm determines - // how the load balancer selects targets when routing requests. The value - // is round_robin or least_outstanding_requests. The default is round_robin. - // - // * slow_start.duration_seconds - The time period, in seconds, during which - // a newly registered target receives an increasing share of the traffic - // to the target group. After this time period ends, the target receives - // its full share of traffic. The range is 30-900 seconds (15 minutes). The - // default is 0 seconds (disabled). - // - // * stickiness.app_cookie.cookie_name - Indicates the name of the application-based - // cookie. Names that start with the following prefixes are not allowed: - // AWSALB, AWSALBAPP, and AWSALBTG; they're reserved for use by the load - // balancer. - // - // * stickiness.app_cookie.duration_seconds - The time period, in seconds, - // during which requests from a client should be routed to the same target. - // After this time period expires, the application-based cookie is considered - // stale. The range is 1 second to 1 week (604800 seconds). The default value - // is 1 day (86400 seconds). - // - // * stickiness.lb_cookie.duration_seconds - The time period, in seconds, - // during which requests from a client should be routed to the same target. - // After this time period expires, the load balancer-generated cookie is - // considered stale. The range is 1 second to 1 week (604800 seconds). The - // default value is 1 day (86400 seconds). - // - // The following attribute is supported only if the load balancer is an Application - // Load Balancer and the target is a Lambda function: - // - // * lambda.multi_value_headers.enabled - Indicates whether the request and - // response headers that are exchanged between the load balancer and the - // Lambda function include arrays of values or strings. The value is true - // or false. The default is false. If the value is false and the request - // contains a duplicate header field name or query parameter key, the load - // balancer uses the last value sent by the client. - // - // The following attributes are supported only by Network Load Balancers: - // - // * deregistration_delay.connection_termination.enabled - Indicates whether - // the load balancer terminates connections at the end of the deregistration - // timeout. The value is true or false. The default is false. - // - // * preserve_client_ip.enabled - Indicates whether client IP preservation - // is enabled. The value is true or false. The default is disabled if the - // target group type is IP address and the target group protocol is TCP or - // TLS. Otherwise, the default is enabled. Client IP preservation cannot - // be disabled for UDP and TCP_UDP target groups. - // - // * proxy_protocol_v2.enabled - Indicates whether Proxy Protocol version - // 2 is enabled. The value is true or false. The default is false. - // - // The following attributes are supported only by Gateway Load Balancers: - // - // * target_failover.on_deregistration - Indicates how the Gateway Load Balancer - // handles existing flows when a target is deregistered. The possible values - // are rebalance and no_rebalance. The default is no_rebalance. The two attributes - // (target_failover.on_deregistration and target_failover.on_unhealthy) can't - // be set independently. The value you set for both attributes must be the - // same. - // - // * target_failover.on_unhealthy - Indicates how the Gateway Load Balancer - // handles existing flows when a target is unhealthy. The possible values - // are rebalance and no_rebalance. The default is no_rebalance. The two attributes - // (target_failover.on_deregistration and target_failover.on_unhealthy) cannot - // be set independently. The value you set for both attributes must be the - // same. - Key *string `type:"string"` - - // The value of the attribute. - Value *string `type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroupAttribute) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroupAttribute) GoString() string { - return s.String() -} - -// SetKey sets the Key field's value. -func (s *TargetGroupAttribute) SetKey(v string) *TargetGroupAttribute { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *TargetGroupAttribute) SetValue(v string) *TargetGroupAttribute { - s.Value = &v - return s -} - -// Information about the target group stickiness for a rule. -type TargetGroupStickinessConfig struct { - _ struct{} `type:"structure"` - - // The time period, in seconds, during which requests from a client should be - // routed to the same target group. The range is 1-604800 seconds (7 days). - DurationSeconds *int64 `type:"integer"` - - // Indicates whether target group stickiness is enabled. - Enabled *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroupStickinessConfig) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroupStickinessConfig) GoString() string { - return s.String() -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *TargetGroupStickinessConfig) SetDurationSeconds(v int64) *TargetGroupStickinessConfig { - s.DurationSeconds = &v - return s -} - -// SetEnabled sets the Enabled field's value. -func (s *TargetGroupStickinessConfig) SetEnabled(v bool) *TargetGroupStickinessConfig { - s.Enabled = &v - return s -} - -// Information about how traffic will be distributed between multiple target -// groups in a forward rule. -type TargetGroupTuple struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the target group. - TargetGroupArn *string `type:"string"` - - // The weight. The range is 0 to 999. - Weight *int64 `type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroupTuple) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetGroupTuple) GoString() string { - return s.String() -} - -// SetTargetGroupArn sets the TargetGroupArn field's value. -func (s *TargetGroupTuple) SetTargetGroupArn(v string) *TargetGroupTuple { - s.TargetGroupArn = &v - return s -} - -// SetWeight sets the Weight field's value. -func (s *TargetGroupTuple) SetWeight(v int64) *TargetGroupTuple { - s.Weight = &v - return s -} - -// Information about the current health of a target. -type TargetHealth struct { - _ struct{} `type:"structure"` - - // A description of the target health that provides additional details. If the - // state is healthy, a description is not provided. - Description *string `type:"string"` - - // The reason code. - // - // If the target state is healthy, a reason code is not provided. - // - // If the target state is initial, the reason code can be one of the following - // values: - // - // * Elb.RegistrationInProgress - The target is in the process of being registered - // with the load balancer. - // - // * Elb.InitialHealthChecking - The load balancer is still sending the target - // the minimum number of health checks required to determine its health status. - // - // If the target state is unhealthy, the reason code can be one of the following - // values: - // - // * Target.ResponseCodeMismatch - The health checks did not return an expected - // HTTP code. Applies only to Application Load Balancers and Gateway Load - // Balancers. - // - // * Target.Timeout - The health check requests timed out. Applies only to - // Application Load Balancers and Gateway Load Balancers. - // - // * Target.FailedHealthChecks - The load balancer received an error while - // establishing a connection to the target or the target response was malformed. - // - // * Elb.InternalError - The health checks failed due to an internal error. - // Applies only to Application Load Balancers. - // - // If the target state is unused, the reason code can be one of the following - // values: - // - // * Target.NotRegistered - The target is not registered with the target - // group. - // - // * Target.NotInUse - The target group is not used by any load balancer - // or the target is in an Availability Zone that is not enabled for its load - // balancer. - // - // * Target.InvalidState - The target is in the stopped or terminated state. - // - // * Target.IpUnusable - The target IP address is reserved for use by a load - // balancer. - // - // If the target state is draining, the reason code can be the following value: - // - // * Target.DeregistrationInProgress - The target is in the process of being - // deregistered and the deregistration delay period has not expired. - // - // If the target state is unavailable, the reason code can be the following - // value: - // - // * Target.HealthCheckDisabled - Health checks are disabled for the target - // group. Applies only to Application Load Balancers. - // - // * Elb.InternalError - Target health is unavailable due to an internal - // error. Applies only to Network Load Balancers. - Reason *string `type:"string" enum:"TargetHealthReasonEnum"` - - // The state of the target. - State *string `type:"string" enum:"TargetHealthStateEnum"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetHealth) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetHealth) GoString() string { - return s.String() -} - -// SetDescription sets the Description field's value. -func (s *TargetHealth) SetDescription(v string) *TargetHealth { - s.Description = &v - return s -} - -// SetReason sets the Reason field's value. -func (s *TargetHealth) SetReason(v string) *TargetHealth { - s.Reason = &v - return s -} - -// SetState sets the State field's value. -func (s *TargetHealth) SetState(v string) *TargetHealth { - s.State = &v - return s -} - -// Information about the health of a target. -type TargetHealthDescription struct { - _ struct{} `type:"structure"` - - // The port to use to connect with the target. - HealthCheckPort *string `type:"string"` - - // The description of the target. - Target *TargetDescription `type:"structure"` - - // The health information for the target. - TargetHealth *TargetHealth `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetHealthDescription) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TargetHealthDescription) GoString() string { - return s.String() -} - -// SetHealthCheckPort sets the HealthCheckPort field's value. -func (s *TargetHealthDescription) SetHealthCheckPort(v string) *TargetHealthDescription { - s.HealthCheckPort = &v - return s -} - -// SetTarget sets the Target field's value. -func (s *TargetHealthDescription) SetTarget(v *TargetDescription) *TargetHealthDescription { - s.Target = v - return s -} - -// SetTargetHealth sets the TargetHealth field's value. -func (s *TargetHealthDescription) SetTargetHealth(v *TargetHealth) *TargetHealthDescription { - s.TargetHealth = v - return s -} - -const ( - // ActionTypeEnumForward is a ActionTypeEnum enum value - ActionTypeEnumForward = "forward" - - // ActionTypeEnumAuthenticateOidc is a ActionTypeEnum enum value - ActionTypeEnumAuthenticateOidc = "authenticate-oidc" - - // ActionTypeEnumAuthenticateCognito is a ActionTypeEnum enum value - ActionTypeEnumAuthenticateCognito = "authenticate-cognito" - - // ActionTypeEnumRedirect is a ActionTypeEnum enum value - ActionTypeEnumRedirect = "redirect" - - // ActionTypeEnumFixedResponse is a ActionTypeEnum enum value - ActionTypeEnumFixedResponse = "fixed-response" -) - -// ActionTypeEnum_Values returns all elements of the ActionTypeEnum enum -func ActionTypeEnum_Values() []string { - return []string{ - ActionTypeEnumForward, - ActionTypeEnumAuthenticateOidc, - ActionTypeEnumAuthenticateCognito, - ActionTypeEnumRedirect, - ActionTypeEnumFixedResponse, - } -} - -const ( - // AuthenticateCognitoActionConditionalBehaviorEnumDeny is a AuthenticateCognitoActionConditionalBehaviorEnum enum value - AuthenticateCognitoActionConditionalBehaviorEnumDeny = "deny" - - // AuthenticateCognitoActionConditionalBehaviorEnumAllow is a AuthenticateCognitoActionConditionalBehaviorEnum enum value - AuthenticateCognitoActionConditionalBehaviorEnumAllow = "allow" - - // AuthenticateCognitoActionConditionalBehaviorEnumAuthenticate is a AuthenticateCognitoActionConditionalBehaviorEnum enum value - AuthenticateCognitoActionConditionalBehaviorEnumAuthenticate = "authenticate" -) - -// AuthenticateCognitoActionConditionalBehaviorEnum_Values returns all elements of the AuthenticateCognitoActionConditionalBehaviorEnum enum -func AuthenticateCognitoActionConditionalBehaviorEnum_Values() []string { - return []string{ - AuthenticateCognitoActionConditionalBehaviorEnumDeny, - AuthenticateCognitoActionConditionalBehaviorEnumAllow, - AuthenticateCognitoActionConditionalBehaviorEnumAuthenticate, - } -} - -const ( - // AuthenticateOidcActionConditionalBehaviorEnumDeny is a AuthenticateOidcActionConditionalBehaviorEnum enum value - AuthenticateOidcActionConditionalBehaviorEnumDeny = "deny" - - // AuthenticateOidcActionConditionalBehaviorEnumAllow is a AuthenticateOidcActionConditionalBehaviorEnum enum value - AuthenticateOidcActionConditionalBehaviorEnumAllow = "allow" - - // AuthenticateOidcActionConditionalBehaviorEnumAuthenticate is a AuthenticateOidcActionConditionalBehaviorEnum enum value - AuthenticateOidcActionConditionalBehaviorEnumAuthenticate = "authenticate" -) - -// AuthenticateOidcActionConditionalBehaviorEnum_Values returns all elements of the AuthenticateOidcActionConditionalBehaviorEnum enum -func AuthenticateOidcActionConditionalBehaviorEnum_Values() []string { - return []string{ - AuthenticateOidcActionConditionalBehaviorEnumDeny, - AuthenticateOidcActionConditionalBehaviorEnumAllow, - AuthenticateOidcActionConditionalBehaviorEnumAuthenticate, - } -} - -const ( - // IpAddressTypeIpv4 is a IpAddressType enum value - IpAddressTypeIpv4 = "ipv4" - - // IpAddressTypeDualstack is a IpAddressType enum value - IpAddressTypeDualstack = "dualstack" -) - -// IpAddressType_Values returns all elements of the IpAddressType enum -func IpAddressType_Values() []string { - return []string{ - IpAddressTypeIpv4, - IpAddressTypeDualstack, - } -} - -const ( - // LoadBalancerSchemeEnumInternetFacing is a LoadBalancerSchemeEnum enum value - LoadBalancerSchemeEnumInternetFacing = "internet-facing" - - // LoadBalancerSchemeEnumInternal is a LoadBalancerSchemeEnum enum value - LoadBalancerSchemeEnumInternal = "internal" -) - -// LoadBalancerSchemeEnum_Values returns all elements of the LoadBalancerSchemeEnum enum -func LoadBalancerSchemeEnum_Values() []string { - return []string{ - LoadBalancerSchemeEnumInternetFacing, - LoadBalancerSchemeEnumInternal, - } -} - -const ( - // LoadBalancerStateEnumActive is a LoadBalancerStateEnum enum value - LoadBalancerStateEnumActive = "active" - - // LoadBalancerStateEnumProvisioning is a LoadBalancerStateEnum enum value - LoadBalancerStateEnumProvisioning = "provisioning" - - // LoadBalancerStateEnumActiveImpaired is a LoadBalancerStateEnum enum value - LoadBalancerStateEnumActiveImpaired = "active_impaired" - - // LoadBalancerStateEnumFailed is a LoadBalancerStateEnum enum value - LoadBalancerStateEnumFailed = "failed" -) - -// LoadBalancerStateEnum_Values returns all elements of the LoadBalancerStateEnum enum -func LoadBalancerStateEnum_Values() []string { - return []string{ - LoadBalancerStateEnumActive, - LoadBalancerStateEnumProvisioning, - LoadBalancerStateEnumActiveImpaired, - LoadBalancerStateEnumFailed, - } -} - -const ( - // LoadBalancerTypeEnumApplication is a LoadBalancerTypeEnum enum value - LoadBalancerTypeEnumApplication = "application" - - // LoadBalancerTypeEnumNetwork is a LoadBalancerTypeEnum enum value - LoadBalancerTypeEnumNetwork = "network" - - // LoadBalancerTypeEnumGateway is a LoadBalancerTypeEnum enum value - LoadBalancerTypeEnumGateway = "gateway" -) - -// LoadBalancerTypeEnum_Values returns all elements of the LoadBalancerTypeEnum enum -func LoadBalancerTypeEnum_Values() []string { - return []string{ - LoadBalancerTypeEnumApplication, - LoadBalancerTypeEnumNetwork, - LoadBalancerTypeEnumGateway, - } -} - -const ( - // ProtocolEnumHttp is a ProtocolEnum enum value - ProtocolEnumHttp = "HTTP" - - // ProtocolEnumHttps is a ProtocolEnum enum value - ProtocolEnumHttps = "HTTPS" - - // ProtocolEnumTcp is a ProtocolEnum enum value - ProtocolEnumTcp = "TCP" - - // ProtocolEnumTls is a ProtocolEnum enum value - ProtocolEnumTls = "TLS" - - // ProtocolEnumUdp is a ProtocolEnum enum value - ProtocolEnumUdp = "UDP" - - // ProtocolEnumTcpUdp is a ProtocolEnum enum value - ProtocolEnumTcpUdp = "TCP_UDP" - - // ProtocolEnumGeneve is a ProtocolEnum enum value - ProtocolEnumGeneve = "GENEVE" -) - -// ProtocolEnum_Values returns all elements of the ProtocolEnum enum -func ProtocolEnum_Values() []string { - return []string{ - ProtocolEnumHttp, - ProtocolEnumHttps, - ProtocolEnumTcp, - ProtocolEnumTls, - ProtocolEnumUdp, - ProtocolEnumTcpUdp, - ProtocolEnumGeneve, - } -} - -const ( - // RedirectActionStatusCodeEnumHttp301 is a RedirectActionStatusCodeEnum enum value - RedirectActionStatusCodeEnumHttp301 = "HTTP_301" - - // RedirectActionStatusCodeEnumHttp302 is a RedirectActionStatusCodeEnum enum value - RedirectActionStatusCodeEnumHttp302 = "HTTP_302" -) - -// RedirectActionStatusCodeEnum_Values returns all elements of the RedirectActionStatusCodeEnum enum -func RedirectActionStatusCodeEnum_Values() []string { - return []string{ - RedirectActionStatusCodeEnumHttp301, - RedirectActionStatusCodeEnumHttp302, - } -} - -const ( - // TargetGroupIpAddressTypeEnumIpv4 is a TargetGroupIpAddressTypeEnum enum value - TargetGroupIpAddressTypeEnumIpv4 = "ipv4" - - // TargetGroupIpAddressTypeEnumIpv6 is a TargetGroupIpAddressTypeEnum enum value - TargetGroupIpAddressTypeEnumIpv6 = "ipv6" -) - -// TargetGroupIpAddressTypeEnum_Values returns all elements of the TargetGroupIpAddressTypeEnum enum -func TargetGroupIpAddressTypeEnum_Values() []string { - return []string{ - TargetGroupIpAddressTypeEnumIpv4, - TargetGroupIpAddressTypeEnumIpv6, - } -} - -const ( - // TargetHealthReasonEnumElbRegistrationInProgress is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumElbRegistrationInProgress = "Elb.RegistrationInProgress" - - // TargetHealthReasonEnumElbInitialHealthChecking is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumElbInitialHealthChecking = "Elb.InitialHealthChecking" - - // TargetHealthReasonEnumTargetResponseCodeMismatch is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetResponseCodeMismatch = "Target.ResponseCodeMismatch" - - // TargetHealthReasonEnumTargetTimeout is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetTimeout = "Target.Timeout" - - // TargetHealthReasonEnumTargetFailedHealthChecks is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetFailedHealthChecks = "Target.FailedHealthChecks" - - // TargetHealthReasonEnumTargetNotRegistered is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetNotRegistered = "Target.NotRegistered" - - // TargetHealthReasonEnumTargetNotInUse is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetNotInUse = "Target.NotInUse" - - // TargetHealthReasonEnumTargetDeregistrationInProgress is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetDeregistrationInProgress = "Target.DeregistrationInProgress" - - // TargetHealthReasonEnumTargetInvalidState is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetInvalidState = "Target.InvalidState" - - // TargetHealthReasonEnumTargetIpUnusable is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetIpUnusable = "Target.IpUnusable" - - // TargetHealthReasonEnumTargetHealthCheckDisabled is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumTargetHealthCheckDisabled = "Target.HealthCheckDisabled" - - // TargetHealthReasonEnumElbInternalError is a TargetHealthReasonEnum enum value - TargetHealthReasonEnumElbInternalError = "Elb.InternalError" -) - -// TargetHealthReasonEnum_Values returns all elements of the TargetHealthReasonEnum enum -func TargetHealthReasonEnum_Values() []string { - return []string{ - TargetHealthReasonEnumElbRegistrationInProgress, - TargetHealthReasonEnumElbInitialHealthChecking, - TargetHealthReasonEnumTargetResponseCodeMismatch, - TargetHealthReasonEnumTargetTimeout, - TargetHealthReasonEnumTargetFailedHealthChecks, - TargetHealthReasonEnumTargetNotRegistered, - TargetHealthReasonEnumTargetNotInUse, - TargetHealthReasonEnumTargetDeregistrationInProgress, - TargetHealthReasonEnumTargetInvalidState, - TargetHealthReasonEnumTargetIpUnusable, - TargetHealthReasonEnumTargetHealthCheckDisabled, - TargetHealthReasonEnumElbInternalError, - } -} - -const ( - // TargetHealthStateEnumInitial is a TargetHealthStateEnum enum value - TargetHealthStateEnumInitial = "initial" - - // TargetHealthStateEnumHealthy is a TargetHealthStateEnum enum value - TargetHealthStateEnumHealthy = "healthy" - - // TargetHealthStateEnumUnhealthy is a TargetHealthStateEnum enum value - TargetHealthStateEnumUnhealthy = "unhealthy" - - // TargetHealthStateEnumUnused is a TargetHealthStateEnum enum value - TargetHealthStateEnumUnused = "unused" - - // TargetHealthStateEnumDraining is a TargetHealthStateEnum enum value - TargetHealthStateEnumDraining = "draining" - - // TargetHealthStateEnumUnavailable is a TargetHealthStateEnum enum value - TargetHealthStateEnumUnavailable = "unavailable" -) - -// TargetHealthStateEnum_Values returns all elements of the TargetHealthStateEnum enum -func TargetHealthStateEnum_Values() []string { - return []string{ - TargetHealthStateEnumInitial, - TargetHealthStateEnumHealthy, - TargetHealthStateEnumUnhealthy, - TargetHealthStateEnumUnused, - TargetHealthStateEnumDraining, - TargetHealthStateEnumUnavailable, - } -} - -const ( - // TargetTypeEnumInstance is a TargetTypeEnum enum value - TargetTypeEnumInstance = "instance" - - // TargetTypeEnumIp is a TargetTypeEnum enum value - TargetTypeEnumIp = "ip" - - // TargetTypeEnumLambda is a TargetTypeEnum enum value - TargetTypeEnumLambda = "lambda" - - // TargetTypeEnumAlb is a TargetTypeEnum enum value - TargetTypeEnumAlb = "alb" -) - -// TargetTypeEnum_Values returns all elements of the TargetTypeEnum enum -func TargetTypeEnum_Values() []string { - return []string{ - TargetTypeEnumInstance, - TargetTypeEnumIp, - TargetTypeEnumLambda, - TargetTypeEnumAlb, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/elbv2/doc.go b/vendor/github.com/aws/aws-sdk-go/service/elbv2/doc.go deleted file mode 100644 index 486753a0655..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elbv2/doc.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package elbv2 provides the client and types for making API -// requests to Elastic Load Balancing. -// -// A load balancer distributes incoming traffic across targets, such as your -// EC2 instances. This enables you to increase the availability of your application. -// The load balancer also monitors the health of its registered targets and -// ensures that it routes traffic only to healthy targets. You configure your -// load balancer to accept incoming traffic by specifying one or more listeners, -// which are configured with a protocol and port number for connections from -// clients to the load balancer. You configure a target group with a protocol -// and port number for connections from the load balancer to the targets, and -// with health check settings to be used when checking the health status of -// the targets. -// -// Elastic Load Balancing supports the following types of load balancers: Application -// Load Balancers, Network Load Balancers, Gateway Load Balancers, and Classic -// Load Balancers. This reference covers the following load balancer types: -// -// - Application Load Balancer - Operates at the application layer (layer -// 7) and supports HTTP and HTTPS. -// -// - Network Load Balancer - Operates at the transport layer (layer 4) and -// supports TCP, TLS, and UDP. -// -// - Gateway Load Balancer - Operates at the network layer (layer 3). -// -// For more information, see the Elastic Load Balancing User Guide (https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/). -// -// All Elastic Load Balancing operations are idempotent, which means that they -// complete at most one time. If you repeat an operation, it succeeds. -// -// See https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01 for more information on this service. -// -// See elbv2 package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/elbv2/ -// -// # Using the Client -// -// To contact Elastic Load Balancing with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the Elastic Load Balancing client ELBV2 for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/elbv2/#New -package elbv2 diff --git a/vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go b/vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go deleted file mode 100644 index 7ac5a2ff964..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go +++ /dev/null @@ -1,235 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elbv2 - -const ( - - // ErrCodeALPNPolicyNotSupportedException for service response error code - // "ALPNPolicyNotFound". - // - // The specified ALPN policy is not supported. - ErrCodeALPNPolicyNotSupportedException = "ALPNPolicyNotFound" - - // ErrCodeAllocationIdNotFoundException for service response error code - // "AllocationIdNotFound". - // - // The specified allocation ID does not exist. - ErrCodeAllocationIdNotFoundException = "AllocationIdNotFound" - - // ErrCodeAvailabilityZoneNotSupportedException for service response error code - // "AvailabilityZoneNotSupported". - // - // The specified Availability Zone is not supported. - ErrCodeAvailabilityZoneNotSupportedException = "AvailabilityZoneNotSupported" - - // ErrCodeCertificateNotFoundException for service response error code - // "CertificateNotFound". - // - // The specified certificate does not exist. - ErrCodeCertificateNotFoundException = "CertificateNotFound" - - // ErrCodeDuplicateListenerException for service response error code - // "DuplicateListener". - // - // A listener with the specified port already exists. - ErrCodeDuplicateListenerException = "DuplicateListener" - - // ErrCodeDuplicateLoadBalancerNameException for service response error code - // "DuplicateLoadBalancerName". - // - // A load balancer with the specified name already exists. - ErrCodeDuplicateLoadBalancerNameException = "DuplicateLoadBalancerName" - - // ErrCodeDuplicateTagKeysException for service response error code - // "DuplicateTagKeys". - // - // A tag key was specified more than once. - ErrCodeDuplicateTagKeysException = "DuplicateTagKeys" - - // ErrCodeDuplicateTargetGroupNameException for service response error code - // "DuplicateTargetGroupName". - // - // A target group with the specified name already exists. - ErrCodeDuplicateTargetGroupNameException = "DuplicateTargetGroupName" - - // ErrCodeHealthUnavailableException for service response error code - // "HealthUnavailable". - // - // The health of the specified targets could not be retrieved due to an internal - // error. - ErrCodeHealthUnavailableException = "HealthUnavailable" - - // ErrCodeIncompatibleProtocolsException for service response error code - // "IncompatibleProtocols". - // - // The specified configuration is not valid with this protocol. - ErrCodeIncompatibleProtocolsException = "IncompatibleProtocols" - - // ErrCodeInvalidConfigurationRequestException for service response error code - // "InvalidConfigurationRequest". - // - // The requested configuration is not valid. - ErrCodeInvalidConfigurationRequestException = "InvalidConfigurationRequest" - - // ErrCodeInvalidLoadBalancerActionException for service response error code - // "InvalidLoadBalancerAction". - // - // The requested action is not valid. - ErrCodeInvalidLoadBalancerActionException = "InvalidLoadBalancerAction" - - // ErrCodeInvalidSchemeException for service response error code - // "InvalidScheme". - // - // The requested scheme is not valid. - ErrCodeInvalidSchemeException = "InvalidScheme" - - // ErrCodeInvalidSecurityGroupException for service response error code - // "InvalidSecurityGroup". - // - // The specified security group does not exist. - ErrCodeInvalidSecurityGroupException = "InvalidSecurityGroup" - - // ErrCodeInvalidSubnetException for service response error code - // "InvalidSubnet". - // - // The specified subnet is out of available addresses. - ErrCodeInvalidSubnetException = "InvalidSubnet" - - // ErrCodeInvalidTargetException for service response error code - // "InvalidTarget". - // - // The specified target does not exist, is not in the same VPC as the target - // group, or has an unsupported instance type. - ErrCodeInvalidTargetException = "InvalidTarget" - - // ErrCodeListenerNotFoundException for service response error code - // "ListenerNotFound". - // - // The specified listener does not exist. - ErrCodeListenerNotFoundException = "ListenerNotFound" - - // ErrCodeLoadBalancerNotFoundException for service response error code - // "LoadBalancerNotFound". - // - // The specified load balancer does not exist. - ErrCodeLoadBalancerNotFoundException = "LoadBalancerNotFound" - - // ErrCodeOperationNotPermittedException for service response error code - // "OperationNotPermitted". - // - // This operation is not allowed. - ErrCodeOperationNotPermittedException = "OperationNotPermitted" - - // ErrCodePriorityInUseException for service response error code - // "PriorityInUse". - // - // The specified priority is in use. - ErrCodePriorityInUseException = "PriorityInUse" - - // ErrCodeResourceInUseException for service response error code - // "ResourceInUse". - // - // A specified resource is in use. - ErrCodeResourceInUseException = "ResourceInUse" - - // ErrCodeRuleNotFoundException for service response error code - // "RuleNotFound". - // - // The specified rule does not exist. - ErrCodeRuleNotFoundException = "RuleNotFound" - - // ErrCodeSSLPolicyNotFoundException for service response error code - // "SSLPolicyNotFound". - // - // The specified SSL policy does not exist. - ErrCodeSSLPolicyNotFoundException = "SSLPolicyNotFound" - - // ErrCodeSubnetNotFoundException for service response error code - // "SubnetNotFound". - // - // The specified subnet does not exist. - ErrCodeSubnetNotFoundException = "SubnetNotFound" - - // ErrCodeTargetGroupAssociationLimitException for service response error code - // "TargetGroupAssociationLimit". - // - // You've reached the limit on the number of load balancers per target group. - ErrCodeTargetGroupAssociationLimitException = "TargetGroupAssociationLimit" - - // ErrCodeTargetGroupNotFoundException for service response error code - // "TargetGroupNotFound". - // - // The specified target group does not exist. - ErrCodeTargetGroupNotFoundException = "TargetGroupNotFound" - - // ErrCodeTooManyActionsException for service response error code - // "TooManyActions". - // - // You've reached the limit on the number of actions per rule. - ErrCodeTooManyActionsException = "TooManyActions" - - // ErrCodeTooManyCertificatesException for service response error code - // "TooManyCertificates". - // - // You've reached the limit on the number of certificates per load balancer. - ErrCodeTooManyCertificatesException = "TooManyCertificates" - - // ErrCodeTooManyListenersException for service response error code - // "TooManyListeners". - // - // You've reached the limit on the number of listeners per load balancer. - ErrCodeTooManyListenersException = "TooManyListeners" - - // ErrCodeTooManyLoadBalancersException for service response error code - // "TooManyLoadBalancers". - // - // You've reached the limit on the number of load balancers for your Amazon - // Web Services account. - ErrCodeTooManyLoadBalancersException = "TooManyLoadBalancers" - - // ErrCodeTooManyRegistrationsForTargetIdException for service response error code - // "TooManyRegistrationsForTargetId". - // - // You've reached the limit on the number of times a target can be registered - // with a load balancer. - ErrCodeTooManyRegistrationsForTargetIdException = "TooManyRegistrationsForTargetId" - - // ErrCodeTooManyRulesException for service response error code - // "TooManyRules". - // - // You've reached the limit on the number of rules per load balancer. - ErrCodeTooManyRulesException = "TooManyRules" - - // ErrCodeTooManyTagsException for service response error code - // "TooManyTags". - // - // You've reached the limit on the number of tags per load balancer. - ErrCodeTooManyTagsException = "TooManyTags" - - // ErrCodeTooManyTargetGroupsException for service response error code - // "TooManyTargetGroups". - // - // You've reached the limit on the number of target groups for your Amazon Web - // Services account. - ErrCodeTooManyTargetGroupsException = "TooManyTargetGroups" - - // ErrCodeTooManyTargetsException for service response error code - // "TooManyTargets". - // - // You've reached the limit on the number of targets. - ErrCodeTooManyTargetsException = "TooManyTargets" - - // ErrCodeTooManyUniqueTargetGroupsPerLoadBalancerException for service response error code - // "TooManyUniqueTargetGroupsPerLoadBalancer". - // - // You've reached the limit on the number of unique target groups per load balancer - // across all listeners. If a target group is used by multiple actions for a - // load balancer, it is counted as only one use. - ErrCodeTooManyUniqueTargetGroupsPerLoadBalancerException = "TooManyUniqueTargetGroupsPerLoadBalancer" - - // ErrCodeUnsupportedProtocolException for service response error code - // "UnsupportedProtocol". - // - // The specified protocol is not supported. - ErrCodeUnsupportedProtocolException = "UnsupportedProtocol" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go b/vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go deleted file mode 100644 index d99cf2ae631..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elbv2 - -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/query" -) - -// ELBV2 provides the API operation methods for making requests to -// Elastic Load Balancing. See this package's package overview docs -// for details on the service. -// -// ELBV2 methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type ELBV2 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) - -// Service information constants -const ( - ServiceName = "elasticloadbalancing" // Name of service. - EndpointsID = ServiceName // ID to lookup a service endpoint with. - ServiceID = "Elastic Load Balancing v2" // ServiceID is a unique identifier of a specific service. -) - -// New creates a new instance of the ELBV2 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: -// -// mySession := session.Must(session.NewSession()) -// -// // Create a ELBV2 client from just a session. -// svc := elbv2.New(mySession) -// -// // Create a ELBV2 client with additional configuration -// svc := elbv2.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *ELBV2 { - c := p.ClientConfig(EndpointsID, cfgs...) - if c.SigningNameDerived || len(c.SigningName) == 0 { - c.SigningName = EndpointsID - // No Fallback - } - return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *ELBV2 { - svc := &ELBV2{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - ServiceID: ServiceID, - SigningName: signingName, - SigningRegion: signingRegion, - PartitionID: partitionID, - Endpoint: endpoint, - APIVersion: "2015-12-01", - ResolvedRegion: resolvedRegion, - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a ELBV2 operation and runs any -// custom request initialization. -func (c *ELBV2) 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/elbv2/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go deleted file mode 100644 index f08f1aaf203..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go +++ /dev/null @@ -1,270 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package elbv2 - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// WaitUntilLoadBalancerAvailable uses the Elastic Load Balancing v2 API operation -// DescribeLoadBalancers to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELBV2) WaitUntilLoadBalancerAvailable(input *DescribeLoadBalancersInput) error { - return c.WaitUntilLoadBalancerAvailableWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilLoadBalancerAvailableWithContext is an extended version of WaitUntilLoadBalancerAvailable. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) WaitUntilLoadBalancerAvailableWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilLoadBalancerAvailable", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, Argument: "LoadBalancers[].State.Code", - Expected: "active", - }, - { - State: request.RetryWaiterState, - Matcher: request.PathAnyWaiterMatch, Argument: "LoadBalancers[].State.Code", - Expected: "provisioning", - }, - { - State: request.RetryWaiterState, - Matcher: request.ErrorWaiterMatch, - Expected: "LoadBalancerNotFound", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeLoadBalancersInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeLoadBalancersRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilLoadBalancerExists uses the Elastic Load Balancing v2 API operation -// DescribeLoadBalancers to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELBV2) WaitUntilLoadBalancerExists(input *DescribeLoadBalancersInput) error { - return c.WaitUntilLoadBalancerExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilLoadBalancerExistsWithContext is an extended version of WaitUntilLoadBalancerExists. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) WaitUntilLoadBalancerExistsWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilLoadBalancerExists", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - { - State: request.RetryWaiterState, - Matcher: request.ErrorWaiterMatch, - Expected: "LoadBalancerNotFound", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeLoadBalancersInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeLoadBalancersRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilLoadBalancersDeleted uses the Elastic Load Balancing v2 API operation -// DescribeLoadBalancers to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELBV2) WaitUntilLoadBalancersDeleted(input *DescribeLoadBalancersInput) error { - return c.WaitUntilLoadBalancersDeletedWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilLoadBalancersDeletedWithContext is an extended version of WaitUntilLoadBalancersDeleted. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) WaitUntilLoadBalancersDeletedWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilLoadBalancersDeleted", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.RetryWaiterState, - Matcher: request.PathAllWaiterMatch, Argument: "LoadBalancers[].State.Code", - Expected: "active", - }, - { - State: request.SuccessWaiterState, - Matcher: request.ErrorWaiterMatch, - Expected: "LoadBalancerNotFound", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeLoadBalancersInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeLoadBalancersRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilTargetDeregistered uses the Elastic Load Balancing v2 API operation -// DescribeTargetHealth to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELBV2) WaitUntilTargetDeregistered(input *DescribeTargetHealthInput) error { - return c.WaitUntilTargetDeregisteredWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilTargetDeregisteredWithContext is an extended version of WaitUntilTargetDeregistered. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) WaitUntilTargetDeregisteredWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilTargetDeregistered", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.ErrorWaiterMatch, - Expected: "InvalidTarget", - }, - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, Argument: "TargetHealthDescriptions[].TargetHealth.State", - Expected: "unused", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeTargetHealthInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeTargetHealthRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilTargetInService uses the Elastic Load Balancing v2 API operation -// DescribeTargetHealth to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *ELBV2) WaitUntilTargetInService(input *DescribeTargetHealthInput) error { - return c.WaitUntilTargetInServiceWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilTargetInServiceWithContext is an extended version of WaitUntilTargetInService. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *ELBV2) WaitUntilTargetInServiceWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilTargetInService", - MaxAttempts: 40, - Delay: request.ConstantWaiterDelay(15 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.PathAllWaiterMatch, Argument: "TargetHealthDescriptions[].TargetHealth.State", - Expected: "healthy", - }, - { - State: request.RetryWaiterState, - Matcher: request.ErrorWaiterMatch, - Expected: "InvalidInstance", - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *DescribeTargetHealthInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeTargetHealthRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go b/vendor/github.com/aws/aws-sdk-go/service/kms/api.go deleted file mode 100644 index 2ac8aa1be1d..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go +++ /dev/null @@ -1,19280 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package kms - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" -) - -const opCancelKeyDeletion = "CancelKeyDeletion" - -// CancelKeyDeletionRequest generates a "aws/request.Request" representing the -// client's request for the CancelKeyDeletion operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CancelKeyDeletion for more information on using the CancelKeyDeletion -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CancelKeyDeletionRequest method. -// req, resp := client.CancelKeyDeletionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CancelKeyDeletion -func (c *KMS) CancelKeyDeletionRequest(input *CancelKeyDeletionInput) (req *request.Request, output *CancelKeyDeletionOutput) { - op := &request.Operation{ - Name: opCancelKeyDeletion, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CancelKeyDeletionInput{} - } - - output = &CancelKeyDeletionOutput{} - req = c.newRequest(op, input, output) - return -} - -// CancelKeyDeletion API operation for AWS Key Management Service. -// -// Cancels the deletion of a KMS key. When this operation succeeds, the key -// state of the KMS key is Disabled. To enable the KMS key, use EnableKey. -// -// For more information about scheduling and canceling deletion of a KMS key, -// see Deleting KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:CancelKeyDeletion (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: ScheduleKeyDeletion -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation CancelKeyDeletion for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CancelKeyDeletion -func (c *KMS) CancelKeyDeletion(input *CancelKeyDeletionInput) (*CancelKeyDeletionOutput, error) { - req, out := c.CancelKeyDeletionRequest(input) - return out, req.Send() -} - -// CancelKeyDeletionWithContext is the same as CancelKeyDeletion with the addition of -// the ability to pass a context and additional request options. -// -// See CancelKeyDeletion for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) CancelKeyDeletionWithContext(ctx aws.Context, input *CancelKeyDeletionInput, opts ...request.Option) (*CancelKeyDeletionOutput, error) { - req, out := c.CancelKeyDeletionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opConnectCustomKeyStore = "ConnectCustomKeyStore" - -// ConnectCustomKeyStoreRequest generates a "aws/request.Request" representing the -// client's request for the ConnectCustomKeyStore operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ConnectCustomKeyStore for more information on using the ConnectCustomKeyStore -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ConnectCustomKeyStoreRequest method. -// req, resp := client.ConnectCustomKeyStoreRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ConnectCustomKeyStore -func (c *KMS) ConnectCustomKeyStoreRequest(input *ConnectCustomKeyStoreInput) (req *request.Request, output *ConnectCustomKeyStoreOutput) { - op := &request.Operation{ - Name: opConnectCustomKeyStore, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ConnectCustomKeyStoreInput{} - } - - output = &ConnectCustomKeyStoreOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// ConnectCustomKeyStore API operation for AWS Key Management Service. -// -// Connects or reconnects a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// to its associated CloudHSM cluster. -// -// The custom key store must be connected before you can create KMS keys in -// the key store or use the KMS keys it contains. You can disconnect and reconnect -// a custom key store at any time. -// -// To connect a custom key store, its associated CloudHSM cluster must have -// at least one active HSM. To get the number of active HSMs in a cluster, use -// the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) -// operation. To add HSMs to the cluster, use the CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) -// operation. Also, the kmsuser crypto user (https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser) -// (CU) must not be logged into the cluster. This prevents KMS from using this -// account to log in. -// -// The connection process can take an extended amount of time to complete; up -// to 20 minutes. This operation starts the connection process, but it does -// not wait for it to complete. When it succeeds, this operation quickly returns -// an HTTP 200 response and a JSON object with no properties. However, this -// response does not indicate that the custom key store is connected. To get -// the connection state of the custom key store, use the DescribeCustomKeyStores -// operation. -// -// During the connection process, KMS finds the CloudHSM cluster that is associated -// with the custom key store, creates the connection infrastructure, connects -// to the cluster, logs into the CloudHSM client as the kmsuser CU, and rotates -// its password. -// -// The ConnectCustomKeyStore operation might fail for various reasons. To find -// the reason, use the DescribeCustomKeyStores operation and see the ConnectionErrorCode -// in the response. For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry. -// -// To fix the failure, use the DisconnectCustomKeyStore operation to disconnect -// the custom key store, correct the error, use the UpdateCustomKeyStore operation -// if necessary, and then use ConnectCustomKeyStore again. -// -// If you are having trouble connecting or disconnecting a custom key store, -// see Troubleshooting a Custom Key Store (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a custom key -// store in a different Amazon Web Services account. -// -// Required permissions: kms:ConnectCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// Related operations -// -// - CreateCustomKeyStore -// -// - DeleteCustomKeyStore -// -// - DescribeCustomKeyStores -// -// - DisconnectCustomKeyStore -// -// - UpdateCustomKeyStore -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ConnectCustomKeyStore for usage and error information. -// -// Returned Error Types: -// -// - CloudHsmClusterNotActiveException -// The request was rejected because the CloudHSM cluster that is associated -// with the custom key store is not active. Initialize and activate the cluster -// and try the command again. For detailed instructions, see Getting Started -// (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) -// in the CloudHSM User Guide. -// -// - CustomKeyStoreInvalidStateException -// The request was rejected because of the ConnectionState of the custom key -// store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// This exception is thrown under the following conditions: -// -// - You requested the CreateKey or GenerateRandom operation in a custom -// key store that is not connected. These operations are valid only when -// the custom key store ConnectionState is CONNECTED. -// -// - You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation -// on a custom key store that is not disconnected. This operation is valid -// only when the custom key store ConnectionState is DISCONNECTED. -// -// - You requested the ConnectCustomKeyStore operation on a custom key store -// with a ConnectionState of DISCONNECTING or FAILED. This operation is valid -// for all other ConnectionState values. -// -// - CustomKeyStoreNotFoundException -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - CloudHsmClusterInvalidConfigurationException -// The request was rejected because the associated CloudHSM cluster did not -// meet the configuration requirements for a custom key store. -// -// - The cluster must be configured with private subnets in at least two -// different Availability Zones in the Region. -// -// - The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// (cloudhsm-cluster--sg) must include inbound rules and outbound -// rules that allow TCP traffic on ports 2223-2225. The Source in the inbound -// rules and the Destination in the outbound rules must match the security -// group ID. These rules are set by default when you create the cluster. -// Do not delete or change them. To get information about a particular security -// group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) -// operation. -// -// - The cluster must contain at least as many HSMs as the operation requires. -// To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) -// operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey -// operations, the CloudHSM cluster must have at least two active HSMs, each -// in a different Availability Zone. For the ConnectCustomKeyStore operation, -// the CloudHSM must contain at least one active HSM. -// -// For information about the requirements for an CloudHSM cluster that is associated -// with a custom key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) -// in the Key Management Service Developer Guide. For information about creating -// a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) -// in the CloudHSM User Guide. For information about cluster security groups, -// see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// in the CloudHSM User Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ConnectCustomKeyStore -func (c *KMS) ConnectCustomKeyStore(input *ConnectCustomKeyStoreInput) (*ConnectCustomKeyStoreOutput, error) { - req, out := c.ConnectCustomKeyStoreRequest(input) - return out, req.Send() -} - -// ConnectCustomKeyStoreWithContext is the same as ConnectCustomKeyStore with the addition of -// the ability to pass a context and additional request options. -// -// See ConnectCustomKeyStore for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ConnectCustomKeyStoreWithContext(ctx aws.Context, input *ConnectCustomKeyStoreInput, opts ...request.Option) (*ConnectCustomKeyStoreOutput, error) { - req, out := c.ConnectCustomKeyStoreRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateAlias = "CreateAlias" - -// CreateAliasRequest generates a "aws/request.Request" representing the -// client's request for the CreateAlias operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateAlias for more information on using the CreateAlias -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateAliasRequest method. -// req, resp := client.CreateAliasRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateAlias -func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *request.Request, output *CreateAliasOutput) { - op := &request.Operation{ - Name: opCreateAlias, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateAliasInput{} - } - - output = &CreateAliasOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// CreateAlias API operation for AWS Key Management Service. -// -// Creates a friendly name for a KMS key. -// -// Adding, deleting, or updating an alias can allow or deny permission to the -// KMS key. For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) -// in the Key Management Service Developer Guide. -// -// You can use an alias to identify a KMS key in the KMS console, in the DescribeKey -// operation and in cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations), -// such as Encrypt and GenerateDataKey. You can also change the KMS key that's -// associated with the alias (UpdateAlias) or delete the alias (DeleteAlias) -// at any time. These operations don't affect the underlying KMS key. -// -// You can associate the alias with any customer managed key in the same Amazon -// Web Services Region. Each alias is associated with only one KMS key at a -// time, but a KMS key can have multiple aliases. A valid KMS key is required. -// You can't create an alias without a KMS key. -// -// The alias must be unique in the account and Region, but you can have aliases -// with the same name in different Regions. For detailed information about aliases, -// see Using aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html) -// in the Key Management Service Developer Guide. -// -// This operation does not return a response. To get the alias that you created, -// use the ListAliases operation. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on an alias in a -// different Amazon Web Services account. -// -// Required permissions -// -// - kms:CreateAlias (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// on the alias (IAM policy). -// -// - kms:CreateAlias (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// on the KMS key (key policy). -// -// For details, see Controlling access to aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html#alias-access) -// in the Key Management Service Developer Guide. -// -// Related operations: -// -// - DeleteAlias -// -// - ListAliases -// -// - UpdateAlias -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation CreateAlias for usage and error information. -// -// Returned Error Types: -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - AlreadyExistsException -// The request was rejected because it attempted to create a resource that already -// exists. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidAliasNameException -// The request was rejected because the specified alias name is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateAlias -func (c *KMS) CreateAlias(input *CreateAliasInput) (*CreateAliasOutput, error) { - req, out := c.CreateAliasRequest(input) - return out, req.Send() -} - -// CreateAliasWithContext is the same as CreateAlias with the addition of -// the ability to pass a context and additional request options. -// -// See CreateAlias for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) CreateAliasWithContext(ctx aws.Context, input *CreateAliasInput, opts ...request.Option) (*CreateAliasOutput, error) { - req, out := c.CreateAliasRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateCustomKeyStore = "CreateCustomKeyStore" - -// CreateCustomKeyStoreRequest generates a "aws/request.Request" representing the -// client's request for the CreateCustomKeyStore operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateCustomKeyStore for more information on using the CreateCustomKeyStore -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateCustomKeyStoreRequest method. -// req, resp := client.CreateCustomKeyStoreRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateCustomKeyStore -func (c *KMS) CreateCustomKeyStoreRequest(input *CreateCustomKeyStoreInput) (req *request.Request, output *CreateCustomKeyStoreOutput) { - op := &request.Operation{ - Name: opCreateCustomKeyStore, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateCustomKeyStoreInput{} - } - - output = &CreateCustomKeyStoreOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateCustomKeyStore API operation for AWS Key Management Service. -// -// Creates a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// that is associated with an CloudHSM cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/clusters.html) -// that you own and manage. -// -// This operation is part of the custom key store feature (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// feature in KMS, which combines the convenience and extensive integration -// of KMS with the isolation and control of a single-tenant key store. -// -// Before you create the custom key store, you must assemble the required elements, -// including an CloudHSM cluster that fulfills the requirements for a custom -// key store. For details about the required elements, see Assemble the Prerequisites -// (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) -// in the Key Management Service Developer Guide. -// -// When the operation completes successfully, it returns the ID of the new custom -// key store. Before you can use your new custom key store, you need to use -// the ConnectCustomKeyStore operation to connect the new key store to its CloudHSM -// cluster. Even if you are not going to use your custom key store immediately, -// you might want to connect it to verify that all settings are correct and -// then disconnect it until you are ready to use it. -// -// For help with failures, see Troubleshooting a Custom Key Store (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a custom key -// store in a different Amazon Web Services account. -// -// Required permissions: kms:CreateCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy). -// -// Related operations: -// -// - ConnectCustomKeyStore -// -// - DeleteCustomKeyStore -// -// - DescribeCustomKeyStores -// -// - DisconnectCustomKeyStore -// -// - UpdateCustomKeyStore -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation CreateCustomKeyStore for usage and error information. -// -// Returned Error Types: -// -// - CloudHsmClusterInUseException -// The request was rejected because the specified CloudHSM cluster is already -// associated with a custom key store or it shares a backup history with a cluster -// that is associated with a custom key store. Each custom key store must be -// associated with a different CloudHSM cluster. -// -// Clusters that share a backup history have the same cluster certificate. To -// view the cluster certificate of a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) -// operation. -// -// - CustomKeyStoreNameInUseException -// The request was rejected because the specified custom key store name is already -// assigned to another custom key store in the account. Try again with a custom -// key store name that is unique in the account. -// -// - CloudHsmClusterNotFoundException -// The request was rejected because KMS cannot find the CloudHSM cluster with -// the specified cluster ID. Retry the request with a different cluster ID. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - CloudHsmClusterNotActiveException -// The request was rejected because the CloudHSM cluster that is associated -// with the custom key store is not active. Initialize and activate the cluster -// and try the command again. For detailed instructions, see Getting Started -// (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) -// in the CloudHSM User Guide. -// -// - IncorrectTrustAnchorException -// The request was rejected because the trust anchor certificate in the request -// is not the trust anchor certificate for the specified CloudHSM cluster. -// -// When you initialize the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr), -// you create the trust anchor certificate and save it in the customerCA.crt -// file. -// -// - CloudHsmClusterInvalidConfigurationException -// The request was rejected because the associated CloudHSM cluster did not -// meet the configuration requirements for a custom key store. -// -// - The cluster must be configured with private subnets in at least two -// different Availability Zones in the Region. -// -// - The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// (cloudhsm-cluster--sg) must include inbound rules and outbound -// rules that allow TCP traffic on ports 2223-2225. The Source in the inbound -// rules and the Destination in the outbound rules must match the security -// group ID. These rules are set by default when you create the cluster. -// Do not delete or change them. To get information about a particular security -// group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) -// operation. -// -// - The cluster must contain at least as many HSMs as the operation requires. -// To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) -// operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey -// operations, the CloudHSM cluster must have at least two active HSMs, each -// in a different Availability Zone. For the ConnectCustomKeyStore operation, -// the CloudHSM must contain at least one active HSM. -// -// For information about the requirements for an CloudHSM cluster that is associated -// with a custom key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) -// in the Key Management Service Developer Guide. For information about creating -// a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) -// in the CloudHSM User Guide. For information about cluster security groups, -// see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// in the CloudHSM User Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateCustomKeyStore -func (c *KMS) CreateCustomKeyStore(input *CreateCustomKeyStoreInput) (*CreateCustomKeyStoreOutput, error) { - req, out := c.CreateCustomKeyStoreRequest(input) - return out, req.Send() -} - -// CreateCustomKeyStoreWithContext is the same as CreateCustomKeyStore with the addition of -// the ability to pass a context and additional request options. -// -// See CreateCustomKeyStore for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) CreateCustomKeyStoreWithContext(ctx aws.Context, input *CreateCustomKeyStoreInput, opts ...request.Option) (*CreateCustomKeyStoreOutput, error) { - req, out := c.CreateCustomKeyStoreRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateGrant = "CreateGrant" - -// CreateGrantRequest generates a "aws/request.Request" representing the -// client's request for the CreateGrant operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateGrant for more information on using the CreateGrant -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateGrantRequest method. -// req, resp := client.CreateGrantRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateGrant -func (c *KMS) CreateGrantRequest(input *CreateGrantInput) (req *request.Request, output *CreateGrantOutput) { - op := &request.Operation{ - Name: opCreateGrant, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateGrantInput{} - } - - output = &CreateGrantOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateGrant API operation for AWS Key Management Service. -// -// Adds a grant to a KMS key. -// -// A grant is a policy instrument that allows Amazon Web Services principals -// to use KMS keys in cryptographic operations. It also can allow them to view -// a KMS key (DescribeKey) and create and manage grants. When authorizing access -// to a KMS key, grants are considered along with key policies and IAM policies. -// Grants are often used for temporary permissions because you can create one, -// use its permissions, and delete it without changing your key policies or -// IAM policies. -// -// For detailed information about grants, including grant terminology, see Grants -// in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) -// in the Key Management Service Developer Guide . For examples of working with -// grants in several programming languages, see Programming grants (https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html). -// -// The CreateGrant operation returns a GrantToken and a GrantId. -// -// - When you create, retire, or revoke a grant, there might be a brief delay, -// usually less than five minutes, until the grant is available throughout -// KMS. This state is known as eventual consistency. Once the grant has achieved -// eventual consistency, the grantee principal can use the permissions in -// the grant without identifying the grant. However, to use the permissions -// in the grant immediately, use the GrantToken that CreateGrant returns. -// For details, see Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) -// in the Key Management Service Developer Guide . -// -// - The CreateGrant operation also returns a GrantId. You can use the GrantId -// and a key identifier to identify the grant in the RetireGrant and RevokeGrant -// operations. To find the grant ID, use the ListGrants or ListRetirableGrants -// operations. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation on a KMS key in a different -// Amazon Web Services account, specify the key ARN in the value of the KeyId -// parameter. -// -// Required permissions: kms:CreateGrant (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - ListGrants -// -// - ListRetirableGrants -// -// - RetireGrant -// -// - RevokeGrant -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation CreateGrant for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateGrant -func (c *KMS) CreateGrant(input *CreateGrantInput) (*CreateGrantOutput, error) { - req, out := c.CreateGrantRequest(input) - return out, req.Send() -} - -// CreateGrantWithContext is the same as CreateGrant with the addition of -// the ability to pass a context and additional request options. -// -// See CreateGrant for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) CreateGrantWithContext(ctx aws.Context, input *CreateGrantInput, opts ...request.Option) (*CreateGrantOutput, error) { - req, out := c.CreateGrantRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateKey = "CreateKey" - -// CreateKeyRequest generates a "aws/request.Request" representing the -// client's request for the CreateKey operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateKey for more information on using the CreateKey -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the CreateKeyRequest method. -// req, resp := client.CreateKeyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateKey -func (c *KMS) CreateKeyRequest(input *CreateKeyInput) (req *request.Request, output *CreateKeyOutput) { - op := &request.Operation{ - Name: opCreateKey, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateKeyInput{} - } - - output = &CreateKeyOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateKey API operation for AWS Key Management Service. -// -// Creates a unique customer managed KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms-keys) -// in your Amazon Web Services account and Region. -// -// In addition to the required parameters, you can use the optional parameters -// to specify a key policy, description, tags, and other useful elements for -// any key type. -// -// KMS is replacing the term customer master key (CMK) with KMS key and KMS -// key. The concept has not changed. To prevent breaking changes, KMS is keeping -// some variations of this term. -// -// To create different types of KMS keys, use the following guidance: -// -// # Symmetric encryption KMS key -// -// To create a symmetric encryption KMS key, you aren't required to specify -// any parameters. The default value for KeySpec, SYMMETRIC_DEFAULT, and the -// default value for KeyUsage, ENCRYPT_DECRYPT, create a symmetric encryption -// KMS key. For technical details, see SYMMETRIC_DEFAULT key spec (https://docs.aws.amazon.com/kms/latest/developerguide/asymmetric-key-specs.html#key-spec-symmetric-default) -// in the Key Management Service Developer Guide. -// -// If you need a key for basic encryption and decryption or you are creating -// a KMS key to protect your resources in an Amazon Web Services service, create -// a symmetric encryption KMS key. The key material in a symmetric encryption -// key never leaves KMS unencrypted. You can use a symmetric encryption KMS -// key to encrypt and decrypt data up to 4,096 bytes, but they are typically -// used to generate data keys and data keys pairs. For details, see GenerateDataKey -// and GenerateDataKeyPair. -// -// # Asymmetric KMS keys -// -// To create an asymmetric KMS key, use the KeySpec parameter to specify the -// type of key material in the KMS key. Then, use the KeyUsage parameter to -// determine whether the KMS key will be used to encrypt and decrypt or sign -// and verify. You can't change these properties after the KMS key is created. -// -// Asymmetric KMS keys contain an RSA key pair, Elliptic Curve (ECC) key pair, -// or an SM2 key pair (China Regions only). The private key in an asymmetric -// KMS key never leaves KMS unencrypted. However, you can use the GetPublicKey -// operation to download the public key so it can be used outside of KMS. KMS -// keys with RSA or SM2 key pairs can be used to encrypt or decrypt data or -// sign and verify messages (but not both). KMS keys with ECC key pairs can -// be used only to sign and verify messages. For information about asymmetric -// KMS keys, see Asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) -// in the Key Management Service Developer Guide. -// -// # HMAC KMS key -// -// To create an HMAC KMS key, set the KeySpec parameter to a key spec value -// for HMAC KMS keys. Then set the KeyUsage parameter to GENERATE_VERIFY_MAC. -// You must set the key usage even though GENERATE_VERIFY_MAC is the only valid -// key usage value for HMAC KMS keys. You can't change these properties after -// the KMS key is created. -// -// HMAC KMS keys are symmetric keys that never leave KMS unencrypted. You can -// use HMAC keys to generate (GenerateMac) and verify (VerifyMac) HMAC codes -// for messages up to 4096 bytes. -// -// HMAC KMS keys are not supported in all Amazon Web Services Regions. If you -// try to create an HMAC KMS key in an Amazon Web Services Region in which HMAC -// keys are not supported, the CreateKey operation returns an UnsupportedOperationException. -// For a list of Regions in which HMAC KMS keys are supported, see HMAC keys -// in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html) -// in the Key Management Service Developer Guide. -// -// # Multi-Region primary keys -// -// # Imported key material -// -// To create a multi-Region primary key in the local Amazon Web Services Region, -// use the MultiRegion parameter with a value of True. To create a multi-Region -// replica key, that is, a KMS key with the same key ID and key material as -// a primary key, but in a different Amazon Web Services Region, use the ReplicateKey -// operation. To change a replica key to a primary key, and its primary key -// to a replica key, use the UpdatePrimaryRegion operation. -// -// You can create multi-Region KMS keys for all supported KMS key types: symmetric -// encryption KMS keys, HMAC KMS keys, asymmetric encryption KMS keys, and asymmetric -// signing KMS keys. You can also create multi-Region keys with imported key -// material. However, you can't create multi-Region keys in a custom key store. -// -// This operation supports multi-Region keys, an KMS feature that lets you create -// multiple interoperable KMS keys in different Amazon Web Services Regions. -// Because these KMS keys have the same key ID, key material, and other metadata, -// you can use them interchangeably to encrypt data in one Amazon Web Services -// Region and decrypt it in a different Amazon Web Services Region without re-encrypting -// the data or making a cross-Region call. For more information about multi-Region -// keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) -// in the Key Management Service Developer Guide. -// -// To import your own key material, begin by creating a symmetric encryption -// KMS key with no key material. To do this, use the Origin parameter of CreateKey -// with a value of EXTERNAL. Next, use GetParametersForImport operation to get -// a public key and import token, and use the public key to encrypt your key -// material. Then, use ImportKeyMaterial with your import token to import the -// key material. For step-by-step instructions, see Importing Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) -// in the Key Management Service Developer Guide . -// -// This feature supports only symmetric encryption KMS keys, including multi-Region -// symmetric encryption KMS keys. You cannot import key material into any other -// type of KMS key. -// -// To create a multi-Region primary key with imported key material, use the -// Origin parameter of CreateKey with a value of EXTERNAL and the MultiRegion -// parameter with a value of True. To create replicas of the multi-Region primary -// key, use the ReplicateKey operation. For more information about multi-Region -// keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) -// in the Key Management Service Developer Guide. -// -// # Custom key store -// -// To create a symmetric encryption KMS key in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html), -// use the CustomKeyStoreId parameter to specify the custom key store. You must -// also use the Origin parameter with a value of AWS_CLOUDHSM. The CloudHSM -// cluster that is associated with the custom key store must have at least two -// active HSMs in different Availability Zones in the Amazon Web Services Region. -// -// Custom key stores support only symmetric encryption KMS keys. You cannot -// create an HMAC KMS key or an asymmetric KMS key in a custom key store. For -// information about custom key stores in KMS see Custom key stores in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// in the Key Management Service Developer Guide . -// -// Cross-account use: No. You cannot use this operation to create a KMS key -// in a different Amazon Web Services account. -// -// Required permissions: kms:CreateKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy). To use the Tags parameter, kms:TagResource (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy). For examples and information about related permissions, see -// Allow a user to create KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html#iam-policy-example-create-key) -// in the Key Management Service Developer Guide. -// -// Related operations: -// -// - DescribeKey -// -// - ListKeys -// -// - ScheduleKeyDeletion -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation CreateKey for usage and error information. -// -// Returned Error Types: -// -// - MalformedPolicyDocumentException -// The request was rejected because the specified policy is not syntactically -// or semantically correct. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - TagException -// The request was rejected because one or more tags are not valid. -// -// - CustomKeyStoreNotFoundException -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -// -// - CustomKeyStoreInvalidStateException -// The request was rejected because of the ConnectionState of the custom key -// store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// This exception is thrown under the following conditions: -// -// - You requested the CreateKey or GenerateRandom operation in a custom -// key store that is not connected. These operations are valid only when -// the custom key store ConnectionState is CONNECTED. -// -// - You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation -// on a custom key store that is not disconnected. This operation is valid -// only when the custom key store ConnectionState is DISCONNECTED. -// -// - You requested the ConnectCustomKeyStore operation on a custom key store -// with a ConnectionState of DISCONNECTING or FAILED. This operation is valid -// for all other ConnectionState values. -// -// - CloudHsmClusterInvalidConfigurationException -// The request was rejected because the associated CloudHSM cluster did not -// meet the configuration requirements for a custom key store. -// -// - The cluster must be configured with private subnets in at least two -// different Availability Zones in the Region. -// -// - The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// (cloudhsm-cluster--sg) must include inbound rules and outbound -// rules that allow TCP traffic on ports 2223-2225. The Source in the inbound -// rules and the Destination in the outbound rules must match the security -// group ID. These rules are set by default when you create the cluster. -// Do not delete or change them. To get information about a particular security -// group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) -// operation. -// -// - The cluster must contain at least as many HSMs as the operation requires. -// To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) -// operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey -// operations, the CloudHSM cluster must have at least two active HSMs, each -// in a different Availability Zone. For the ConnectCustomKeyStore operation, -// the CloudHSM must contain at least one active HSM. -// -// For information about the requirements for an CloudHSM cluster that is associated -// with a custom key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) -// in the Key Management Service Developer Guide. For information about creating -// a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) -// in the CloudHSM User Guide. For information about cluster security groups, -// see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// in the CloudHSM User Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateKey -func (c *KMS) CreateKey(input *CreateKeyInput) (*CreateKeyOutput, error) { - req, out := c.CreateKeyRequest(input) - return out, req.Send() -} - -// CreateKeyWithContext is the same as CreateKey with the addition of -// the ability to pass a context and additional request options. -// -// See CreateKey for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) CreateKeyWithContext(ctx aws.Context, input *CreateKeyInput, opts ...request.Option) (*CreateKeyOutput, error) { - req, out := c.CreateKeyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDecrypt = "Decrypt" - -// DecryptRequest generates a "aws/request.Request" representing the -// client's request for the Decrypt operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See Decrypt for more information on using the Decrypt -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DecryptRequest method. -// req, resp := client.DecryptRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Decrypt -func (c *KMS) DecryptRequest(input *DecryptInput) (req *request.Request, output *DecryptOutput) { - op := &request.Operation{ - Name: opDecrypt, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DecryptInput{} - } - - output = &DecryptOutput{} - req = c.newRequest(op, input, output) - return -} - -// Decrypt API operation for AWS Key Management Service. -// -// Decrypts ciphertext that was encrypted by a KMS key using any of the following -// operations: -// -// - Encrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyPair -// -// - GenerateDataKeyWithoutPlaintext -// -// - GenerateDataKeyPairWithoutPlaintext -// -// You can use this operation to decrypt ciphertext that was encrypted under -// a symmetric encryption KMS key or an asymmetric encryption KMS key. When -// the KMS key is asymmetric, you must specify the KMS key and the encryption -// algorithm that was used to encrypt the ciphertext. For information about -// asymmetric KMS keys, see Asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) -// in the Key Management Service Developer Guide. -// -// The Decrypt operation also decrypts ciphertext that was encrypted outside -// of KMS by the public key in an KMS asymmetric KMS key. However, it cannot -// decrypt ciphertext produced by other libraries, such as the Amazon Web Services -// Encryption SDK (https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/) -// or Amazon S3 client-side encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html). -// These libraries return a ciphertext format that is incompatible with KMS. -// -// If the ciphertext was encrypted under a symmetric encryption KMS key, the -// KeyId parameter is optional. KMS can get this information from metadata that -// it adds to the symmetric ciphertext blob. This feature adds durability to -// your implementation by ensuring that authorized users can decrypt ciphertext -// decades after it was encrypted, even if they've lost track of the key ID. -// However, specifying the KMS key is always recommended as a best practice. -// When you use the KeyId parameter to specify a KMS key, KMS only uses the -// KMS key you specify. If the ciphertext was encrypted under a different KMS -// key, the Decrypt operation fails. This practice ensures that you use the -// KMS key that you intend. -// -// Whenever possible, use key policies to give users permission to call the -// Decrypt operation on a particular KMS key, instead of using IAM policies. -// Otherwise, you might create an IAM user policy that gives the user Decrypt -// permission on all KMS keys. This user could decrypt ciphertext that was encrypted -// by KMS keys in other accounts if the key policy for the cross-account KMS -// key permits it. If you must use an IAM policy for Decrypt permissions, limit -// the user to particular KMS keys or particular trusted accounts. For details, -// see Best practices for IAM policies (https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html#iam-policies-best-practices) -// in the Key Management Service Developer Guide. -// -// Applications in Amazon Web Services Nitro Enclaves can call this operation -// by using the Amazon Web Services Nitro Enclaves Development Kit (https://github.com/aws/aws-nitro-enclaves-sdk-c). -// For information about the supporting parameters, see How Amazon Web Services -// Nitro Enclaves use KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:Decrypt (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - Encrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyPair -// -// - ReEncrypt -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation Decrypt for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - InvalidCiphertextException -// From the Decrypt or ReEncrypt operation, the request was rejected because -// the specified ciphertext, or additional authenticated data incorporated into -// the ciphertext, such as the encryption context, is corrupted, missing, or -// otherwise invalid. -// -// From the ImportKeyMaterial operation, the request was rejected because KMS -// could not decrypt the encrypted (wrapped) key material. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - IncorrectKeyException -// The request was rejected because the specified KMS key cannot decrypt the -// data. The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request -// must identify the same KMS key that was used to encrypt the ciphertext. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Decrypt -func (c *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error) { - req, out := c.DecryptRequest(input) - return out, req.Send() -} - -// DecryptWithContext is the same as Decrypt with the addition of -// the ability to pass a context and additional request options. -// -// See Decrypt for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DecryptWithContext(ctx aws.Context, input *DecryptInput, opts ...request.Option) (*DecryptOutput, error) { - req, out := c.DecryptRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteAlias = "DeleteAlias" - -// DeleteAliasRequest generates a "aws/request.Request" representing the -// client's request for the DeleteAlias operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteAlias for more information on using the DeleteAlias -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteAliasRequest method. -// req, resp := client.DeleteAliasRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteAlias -func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Request, output *DeleteAliasOutput) { - op := &request.Operation{ - Name: opDeleteAlias, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteAliasInput{} - } - - output = &DeleteAliasOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteAlias API operation for AWS Key Management Service. -// -// Deletes the specified alias. -// -// Adding, deleting, or updating an alias can allow or deny permission to the -// KMS key. For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) -// in the Key Management Service Developer Guide. -// -// Because an alias is not a property of a KMS key, you can delete and change -// the aliases of a KMS key without affecting the KMS key. Also, aliases do -// not appear in the response from the DescribeKey operation. To get the aliases -// of all KMS keys, use the ListAliases operation. -// -// Each KMS key can have multiple aliases. To change the alias of a KMS key, -// use DeleteAlias to delete the current alias and CreateAlias to create a new -// alias. To associate an existing alias with a different KMS key, call UpdateAlias. -// -// Cross-account use: No. You cannot perform this operation on an alias in a -// different Amazon Web Services account. -// -// Required permissions -// -// - kms:DeleteAlias (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// on the alias (IAM policy). -// -// - kms:DeleteAlias (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// on the KMS key (key policy). -// -// For details, see Controlling access to aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html#alias-access) -// in the Key Management Service Developer Guide. -// -// Related operations: -// -// - CreateAlias -// -// - ListAliases -// -// - UpdateAlias -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DeleteAlias for usage and error information. -// -// Returned Error Types: -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteAlias -func (c *KMS) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error) { - req, out := c.DeleteAliasRequest(input) - return out, req.Send() -} - -// DeleteAliasWithContext is the same as DeleteAlias with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteAlias for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DeleteAliasWithContext(ctx aws.Context, input *DeleteAliasInput, opts ...request.Option) (*DeleteAliasOutput, error) { - req, out := c.DeleteAliasRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteCustomKeyStore = "DeleteCustomKeyStore" - -// DeleteCustomKeyStoreRequest generates a "aws/request.Request" representing the -// client's request for the DeleteCustomKeyStore operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteCustomKeyStore for more information on using the DeleteCustomKeyStore -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteCustomKeyStoreRequest method. -// req, resp := client.DeleteCustomKeyStoreRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteCustomKeyStore -func (c *KMS) DeleteCustomKeyStoreRequest(input *DeleteCustomKeyStoreInput) (req *request.Request, output *DeleteCustomKeyStoreOutput) { - op := &request.Operation{ - Name: opDeleteCustomKeyStore, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteCustomKeyStoreInput{} - } - - output = &DeleteCustomKeyStoreOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteCustomKeyStore API operation for AWS Key Management Service. -// -// Deletes a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). -// This operation does not delete the CloudHSM cluster that is associated with -// the custom key store, or affect any users or keys in the cluster. -// -// The custom key store that you delete cannot contain any KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys). -// Before deleting the key store, verify that you will never need to use any -// of the KMS keys in the key store for any cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations). -// Then, use ScheduleKeyDeletion to delete the KMS keys from the key store. -// When the scheduled waiting period expires, the ScheduleKeyDeletion operation -// deletes the KMS keys. Then it makes a best effort to delete the key material -// from the associated cluster. However, you might need to manually delete the -// orphaned key material (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-orphaned-key) -// from the cluster and its backups. -// -// After all KMS keys are deleted from KMS, use DisconnectCustomKeyStore to -// disconnect the key store from KMS. Then, you can delete the custom key store. -// -// Instead of deleting the custom key store, consider using DisconnectCustomKeyStore -// to disconnect it from KMS. While the key store is disconnected, you cannot -// create or use the KMS keys in the key store. But, you do not need to delete -// KMS keys and you can reconnect a disconnected custom key store at any time. -// -// If the operation succeeds, it returns a JSON object with no properties. -// -// This operation is part of the custom key store feature (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// feature in KMS, which combines the convenience and extensive integration -// of KMS with the isolation and control of a single-tenant key store. -// -// Cross-account use: No. You cannot perform this operation on a custom key -// store in a different Amazon Web Services account. -// -// Required permissions: kms:DeleteCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// Related operations: -// -// - ConnectCustomKeyStore -// -// - CreateCustomKeyStore -// -// - DescribeCustomKeyStores -// -// - DisconnectCustomKeyStore -// -// - UpdateCustomKeyStore -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DeleteCustomKeyStore for usage and error information. -// -// Returned Error Types: -// -// - CustomKeyStoreHasCMKsException -// The request was rejected because the custom key store contains KMS keys. -// After verifying that you do not need to use the KMS keys, use the ScheduleKeyDeletion -// operation to delete the KMS keys. After they are deleted, you can delete -// the custom key store. -// -// - CustomKeyStoreInvalidStateException -// The request was rejected because of the ConnectionState of the custom key -// store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// This exception is thrown under the following conditions: -// -// - You requested the CreateKey or GenerateRandom operation in a custom -// key store that is not connected. These operations are valid only when -// the custom key store ConnectionState is CONNECTED. -// -// - You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation -// on a custom key store that is not disconnected. This operation is valid -// only when the custom key store ConnectionState is DISCONNECTED. -// -// - You requested the ConnectCustomKeyStore operation on a custom key store -// with a ConnectionState of DISCONNECTING or FAILED. This operation is valid -// for all other ConnectionState values. -// -// - CustomKeyStoreNotFoundException -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteCustomKeyStore -func (c *KMS) DeleteCustomKeyStore(input *DeleteCustomKeyStoreInput) (*DeleteCustomKeyStoreOutput, error) { - req, out := c.DeleteCustomKeyStoreRequest(input) - return out, req.Send() -} - -// DeleteCustomKeyStoreWithContext is the same as DeleteCustomKeyStore with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteCustomKeyStore for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DeleteCustomKeyStoreWithContext(ctx aws.Context, input *DeleteCustomKeyStoreInput, opts ...request.Option) (*DeleteCustomKeyStoreOutput, error) { - req, out := c.DeleteCustomKeyStoreRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteImportedKeyMaterial = "DeleteImportedKeyMaterial" - -// DeleteImportedKeyMaterialRequest generates a "aws/request.Request" representing the -// client's request for the DeleteImportedKeyMaterial operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteImportedKeyMaterial for more information on using the DeleteImportedKeyMaterial -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DeleteImportedKeyMaterialRequest method. -// req, resp := client.DeleteImportedKeyMaterialRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteImportedKeyMaterial -func (c *KMS) DeleteImportedKeyMaterialRequest(input *DeleteImportedKeyMaterialInput) (req *request.Request, output *DeleteImportedKeyMaterialOutput) { - op := &request.Operation{ - Name: opDeleteImportedKeyMaterial, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteImportedKeyMaterialInput{} - } - - output = &DeleteImportedKeyMaterialOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteImportedKeyMaterial API operation for AWS Key Management Service. -// -// Deletes key material that you previously imported. This operation makes the -// specified KMS key unusable. For more information about importing key material -// into KMS, see Importing Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) -// in the Key Management Service Developer Guide. -// -// When the specified KMS key is in the PendingDeletion state, this operation -// does not change the KMS key's state. Otherwise, it changes the KMS key's -// state to PendingImport. -// -// After you delete key material, you can use ImportKeyMaterial to reimport -// the same key material into the KMS key. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:DeleteImportedKeyMaterial (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - GetParametersForImport -// -// - ImportKeyMaterial -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DeleteImportedKeyMaterial for usage and error information. -// -// Returned Error Types: -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteImportedKeyMaterial -func (c *KMS) DeleteImportedKeyMaterial(input *DeleteImportedKeyMaterialInput) (*DeleteImportedKeyMaterialOutput, error) { - req, out := c.DeleteImportedKeyMaterialRequest(input) - return out, req.Send() -} - -// DeleteImportedKeyMaterialWithContext is the same as DeleteImportedKeyMaterial with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteImportedKeyMaterial for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DeleteImportedKeyMaterialWithContext(ctx aws.Context, input *DeleteImportedKeyMaterialInput, opts ...request.Option) (*DeleteImportedKeyMaterialOutput, error) { - req, out := c.DeleteImportedKeyMaterialRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDescribeCustomKeyStores = "DescribeCustomKeyStores" - -// DescribeCustomKeyStoresRequest generates a "aws/request.Request" representing the -// client's request for the DescribeCustomKeyStores operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeCustomKeyStores for more information on using the DescribeCustomKeyStores -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeCustomKeyStoresRequest method. -// req, resp := client.DescribeCustomKeyStoresRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeCustomKeyStores -func (c *KMS) DescribeCustomKeyStoresRequest(input *DescribeCustomKeyStoresInput) (req *request.Request, output *DescribeCustomKeyStoresOutput) { - op := &request.Operation{ - Name: opDescribeCustomKeyStores, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "Limit", - TruncationToken: "Truncated", - }, - } - - if input == nil { - input = &DescribeCustomKeyStoresInput{} - } - - output = &DescribeCustomKeyStoresOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeCustomKeyStores API operation for AWS Key Management Service. -// -// Gets information about custom key stores (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// in the account and Region. -// -// This operation is part of the custom key store feature (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// feature in KMS, which combines the convenience and extensive integration -// of KMS with the isolation and control of a single-tenant key store. -// -// By default, this operation returns information about all custom key stores -// in the account and Region. To get only information about a particular custom -// key store, use either the CustomKeyStoreName or CustomKeyStoreId parameter -// (but not both). -// -// To determine whether the custom key store is connected to its CloudHSM cluster, -// use the ConnectionState element in the response. If an attempt to connect -// the custom key store failed, the ConnectionState value is FAILED and the -// ConnectionErrorCode element in the response indicates the cause of the failure. -// For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry. -// -// Custom key stores have a DISCONNECTED connection state if the key store has -// never been connected or you use the DisconnectCustomKeyStore operation to -// disconnect it. If your custom key store state is CONNECTED but you are having -// trouble using it, make sure that its associated CloudHSM cluster is active -// and contains the minimum number of HSMs required for the operation, if any. -// -// For help repairing your custom key store, see the Troubleshooting Custom -// Key Stores (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html) -// topic in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a custom key -// store in a different Amazon Web Services account. -// -// Required permissions: kms:DescribeCustomKeyStores (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// Related operations: -// -// - ConnectCustomKeyStore -// -// - CreateCustomKeyStore -// -// - DeleteCustomKeyStore -// -// - DisconnectCustomKeyStore -// -// - UpdateCustomKeyStore -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DescribeCustomKeyStores for usage and error information. -// -// Returned Error Types: -// -// - CustomKeyStoreNotFoundException -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -// -// - InvalidMarkerException -// The request was rejected because the marker that specifies where pagination -// should next begin is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeCustomKeyStores -func (c *KMS) DescribeCustomKeyStores(input *DescribeCustomKeyStoresInput) (*DescribeCustomKeyStoresOutput, error) { - req, out := c.DescribeCustomKeyStoresRequest(input) - return out, req.Send() -} - -// DescribeCustomKeyStoresWithContext is the same as DescribeCustomKeyStores with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeCustomKeyStores for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DescribeCustomKeyStoresWithContext(ctx aws.Context, input *DescribeCustomKeyStoresInput, opts ...request.Option) (*DescribeCustomKeyStoresOutput, error) { - req, out := c.DescribeCustomKeyStoresRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// DescribeCustomKeyStoresPages iterates over the pages of a DescribeCustomKeyStores operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See DescribeCustomKeyStores 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 DescribeCustomKeyStores operation. -// pageNum := 0 -// err := client.DescribeCustomKeyStoresPages(params, -// func(page *kms.DescribeCustomKeyStoresOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *KMS) DescribeCustomKeyStoresPages(input *DescribeCustomKeyStoresInput, fn func(*DescribeCustomKeyStoresOutput, bool) bool) error { - return c.DescribeCustomKeyStoresPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// DescribeCustomKeyStoresPagesWithContext same as DescribeCustomKeyStoresPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DescribeCustomKeyStoresPagesWithContext(ctx aws.Context, input *DescribeCustomKeyStoresInput, fn func(*DescribeCustomKeyStoresOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *DescribeCustomKeyStoresInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.DescribeCustomKeyStoresRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*DescribeCustomKeyStoresOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opDescribeKey = "DescribeKey" - -// DescribeKeyRequest generates a "aws/request.Request" representing the -// client's request for the DescribeKey operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DescribeKey for more information on using the DescribeKey -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DescribeKeyRequest method. -// req, resp := client.DescribeKeyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeKey -func (c *KMS) DescribeKeyRequest(input *DescribeKeyInput) (req *request.Request, output *DescribeKeyOutput) { - op := &request.Operation{ - Name: opDescribeKey, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeKeyInput{} - } - - output = &DescribeKeyOutput{} - req = c.newRequest(op, input, output) - return -} - -// DescribeKey API operation for AWS Key Management Service. -// -// Provides detailed information about a KMS key. You can run DescribeKey on -// a customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) -// or an Amazon Web Services managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk). -// -// This detailed information includes the key ARN, creation date (and deletion -// date, if applicable), the key state, and the origin and expiration date (if -// any) of the key material. It includes fields, like KeySpec, that help you -// distinguish different types of KMS keys. It also displays the key usage (encryption, -// signing, or generating and verifying MACs) and the algorithms that the KMS -// key supports. For KMS keys in custom key stores, it includes information -// about the custom key store, such as the key store ID and the CloudHSM cluster -// ID. For multi-Region keys, it displays the primary key and all related replica -// keys. -// -// DescribeKey does not return the following information: -// -// - Aliases associated with the KMS key. To get this information, use ListAliases. -// -// - Whether automatic key rotation is enabled on the KMS key. To get this -// information, use GetKeyRotationStatus. Also, some key states prevent a -// KMS key from being automatically rotated. For details, see How Automatic -// Key Rotation Works (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-how-it-works) -// in the Key Management Service Developer Guide. -// -// - Tags on the KMS key. To get this information, use ListResourceTags. -// -// - Key policies and grants on the KMS key. To get this information, use -// GetKeyPolicy and ListGrants. -// -// In general, DescribeKey is a non-mutating operation. It returns data about -// KMS keys, but doesn't change them. However, Amazon Web Services services -// use DescribeKey to create Amazon Web Services managed keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) -// from a predefined Amazon Web Services alias with no key ID. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:DescribeKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - GetKeyPolicy -// -// - GetKeyRotationStatus -// -// - ListAliases -// -// - ListGrants -// -// - ListKeys -// -// - ListResourceTags -// -// - ListRetirableGrants -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DescribeKey for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeKey -func (c *KMS) DescribeKey(input *DescribeKeyInput) (*DescribeKeyOutput, error) { - req, out := c.DescribeKeyRequest(input) - return out, req.Send() -} - -// DescribeKeyWithContext is the same as DescribeKey with the addition of -// the ability to pass a context and additional request options. -// -// See DescribeKey for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DescribeKeyWithContext(ctx aws.Context, input *DescribeKeyInput, opts ...request.Option) (*DescribeKeyOutput, error) { - req, out := c.DescribeKeyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDisableKey = "DisableKey" - -// DisableKeyRequest generates a "aws/request.Request" representing the -// client's request for the DisableKey operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DisableKey for more information on using the DisableKey -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DisableKeyRequest method. -// req, resp := client.DisableKeyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKey -func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *request.Request, output *DisableKeyOutput) { - op := &request.Operation{ - Name: opDisableKey, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DisableKeyInput{} - } - - output = &DisableKeyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DisableKey API operation for AWS Key Management Service. -// -// Sets the state of a KMS key to disabled. This change temporarily prevents -// use of the KMS key for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations). -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:DisableKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: EnableKey -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DisableKey for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKey -func (c *KMS) DisableKey(input *DisableKeyInput) (*DisableKeyOutput, error) { - req, out := c.DisableKeyRequest(input) - return out, req.Send() -} - -// DisableKeyWithContext is the same as DisableKey with the addition of -// the ability to pass a context and additional request options. -// -// See DisableKey for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DisableKeyWithContext(ctx aws.Context, input *DisableKeyInput, opts ...request.Option) (*DisableKeyOutput, error) { - req, out := c.DisableKeyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDisableKeyRotation = "DisableKeyRotation" - -// DisableKeyRotationRequest generates a "aws/request.Request" representing the -// client's request for the DisableKeyRotation operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DisableKeyRotation for more information on using the DisableKeyRotation -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DisableKeyRotationRequest method. -// req, resp := client.DisableKeyRotationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKeyRotation -func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *request.Request, output *DisableKeyRotationOutput) { - op := &request.Operation{ - Name: opDisableKeyRotation, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DisableKeyRotationInput{} - } - - output = &DisableKeyRotationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DisableKeyRotation API operation for AWS Key Management Service. -// -// Disables automatic rotation of the key material (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html) -// of the specified symmetric encryption KMS key. -// -// Automatic key rotation is supported only on symmetric encryption KMS keys. -// You cannot enable or disable automatic rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html), -// HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html), -// KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html), -// or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). -// The key rotation status of these KMS keys is always false. To enable or disable -// automatic rotation of a set of related multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate), -// set the property on the primary key. -// -// You can enable (EnableKeyRotation) and disable automatic rotation of the -// key material in customer managed KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk). -// Key material rotation of Amazon Web Services managed KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) -// is not configurable. KMS always rotates the key material for every year. -// Rotation of Amazon Web Services owned KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk) -// varies. -// -// In May 2022, KMS changed the rotation schedule for Amazon Web Services managed -// keys from every three years to every year. For details, see EnableKeyRotation. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:DisableKeyRotation (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - EnableKeyRotation -// -// - GetKeyRotationStatus -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DisableKeyRotation for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKeyRotation -func (c *KMS) DisableKeyRotation(input *DisableKeyRotationInput) (*DisableKeyRotationOutput, error) { - req, out := c.DisableKeyRotationRequest(input) - return out, req.Send() -} - -// DisableKeyRotationWithContext is the same as DisableKeyRotation with the addition of -// the ability to pass a context and additional request options. -// -// See DisableKeyRotation for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DisableKeyRotationWithContext(ctx aws.Context, input *DisableKeyRotationInput, opts ...request.Option) (*DisableKeyRotationOutput, error) { - req, out := c.DisableKeyRotationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDisconnectCustomKeyStore = "DisconnectCustomKeyStore" - -// DisconnectCustomKeyStoreRequest generates a "aws/request.Request" representing the -// client's request for the DisconnectCustomKeyStore operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DisconnectCustomKeyStore for more information on using the DisconnectCustomKeyStore -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the DisconnectCustomKeyStoreRequest method. -// req, resp := client.DisconnectCustomKeyStoreRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisconnectCustomKeyStore -func (c *KMS) DisconnectCustomKeyStoreRequest(input *DisconnectCustomKeyStoreInput) (req *request.Request, output *DisconnectCustomKeyStoreOutput) { - op := &request.Operation{ - Name: opDisconnectCustomKeyStore, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DisconnectCustomKeyStoreInput{} - } - - output = &DisconnectCustomKeyStoreOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DisconnectCustomKeyStore API operation for AWS Key Management Service. -// -// Disconnects the custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// from its associated CloudHSM cluster. While a custom key store is disconnected, -// you can manage the custom key store and its KMS keys, but you cannot create -// or use KMS keys in the custom key store. You can reconnect the custom key -// store at any time. -// -// While a custom key store is disconnected, all attempts to create KMS keys -// in the custom key store or to use existing KMS keys in cryptographic operations -// (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) -// will fail. This action can prevent users from storing and accessing sensitive -// data. -// -// To find the connection state of a custom key store, use the DescribeCustomKeyStores -// operation. To reconnect a custom key store, use the ConnectCustomKeyStore -// operation. -// -// If the operation succeeds, it returns a JSON object with no properties. -// -// This operation is part of the custom key store feature (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// feature in KMS, which combines the convenience and extensive integration -// of KMS with the isolation and control of a single-tenant key store. -// -// Cross-account use: No. You cannot perform this operation on a custom key -// store in a different Amazon Web Services account. -// -// Required permissions: kms:DisconnectCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// Related operations: -// -// - ConnectCustomKeyStore -// -// - CreateCustomKeyStore -// -// - DeleteCustomKeyStore -// -// - DescribeCustomKeyStores -// -// - UpdateCustomKeyStore -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation DisconnectCustomKeyStore for usage and error information. -// -// Returned Error Types: -// -// - CustomKeyStoreInvalidStateException -// The request was rejected because of the ConnectionState of the custom key -// store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// This exception is thrown under the following conditions: -// -// - You requested the CreateKey or GenerateRandom operation in a custom -// key store that is not connected. These operations are valid only when -// the custom key store ConnectionState is CONNECTED. -// -// - You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation -// on a custom key store that is not disconnected. This operation is valid -// only when the custom key store ConnectionState is DISCONNECTED. -// -// - You requested the ConnectCustomKeyStore operation on a custom key store -// with a ConnectionState of DISCONNECTING or FAILED. This operation is valid -// for all other ConnectionState values. -// -// - CustomKeyStoreNotFoundException -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisconnectCustomKeyStore -func (c *KMS) DisconnectCustomKeyStore(input *DisconnectCustomKeyStoreInput) (*DisconnectCustomKeyStoreOutput, error) { - req, out := c.DisconnectCustomKeyStoreRequest(input) - return out, req.Send() -} - -// DisconnectCustomKeyStoreWithContext is the same as DisconnectCustomKeyStore with the addition of -// the ability to pass a context and additional request options. -// -// See DisconnectCustomKeyStore for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) DisconnectCustomKeyStoreWithContext(ctx aws.Context, input *DisconnectCustomKeyStoreInput, opts ...request.Option) (*DisconnectCustomKeyStoreOutput, error) { - req, out := c.DisconnectCustomKeyStoreRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opEnableKey = "EnableKey" - -// EnableKeyRequest generates a "aws/request.Request" representing the -// client's request for the EnableKey operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See EnableKey for more information on using the EnableKey -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the EnableKeyRequest method. -// req, resp := client.EnableKeyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKey -func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *request.Request, output *EnableKeyOutput) { - op := &request.Operation{ - Name: opEnableKey, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &EnableKeyInput{} - } - - output = &EnableKeyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// EnableKey API operation for AWS Key Management Service. -// -// Sets the key state of a KMS key to enabled. This allows you to use the KMS -// key for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations). -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:EnableKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: DisableKey -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation EnableKey for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKey -func (c *KMS) EnableKey(input *EnableKeyInput) (*EnableKeyOutput, error) { - req, out := c.EnableKeyRequest(input) - return out, req.Send() -} - -// EnableKeyWithContext is the same as EnableKey with the addition of -// the ability to pass a context and additional request options. -// -// See EnableKey for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) EnableKeyWithContext(ctx aws.Context, input *EnableKeyInput, opts ...request.Option) (*EnableKeyOutput, error) { - req, out := c.EnableKeyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opEnableKeyRotation = "EnableKeyRotation" - -// EnableKeyRotationRequest generates a "aws/request.Request" representing the -// client's request for the EnableKeyRotation operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See EnableKeyRotation for more information on using the EnableKeyRotation -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the EnableKeyRotationRequest method. -// req, resp := client.EnableKeyRotationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKeyRotation -func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *request.Request, output *EnableKeyRotationOutput) { - op := &request.Operation{ - Name: opEnableKeyRotation, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &EnableKeyRotationInput{} - } - - output = &EnableKeyRotationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// EnableKeyRotation API operation for AWS Key Management Service. -// -// Enables automatic rotation of the key material (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html) -// of the specified symmetric encryption KMS key. -// -// When you enable automatic rotation of acustomer managed KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk), -// KMS rotates the key material of the KMS key one year (approximately 365 days) -// from the enable date and every year thereafter. You can monitor rotation -// of the key material for your KMS keys in CloudTrail and Amazon CloudWatch. -// To disable rotation of the key material in a customer managed KMS key, use -// the DisableKeyRotation operation. -// -// Automatic key rotation is supported only on symmetric encryption KMS keys -// (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#symmetric-cmks). -// You cannot enable or disable automatic rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html), -// HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html), -// KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html), -// or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). -// The key rotation status of these KMS keys is always false. To enable or disable -// automatic rotation of a set of related multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate), -// set the property on the primary key. -// -// You cannot enable or disable automatic rotation Amazon Web Services managed -// KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk). -// KMS always rotates the key material of Amazon Web Services managed keys every -// year. Rotation of Amazon Web Services owned KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk) -// varies. -// -// In May 2022, KMS changed the rotation schedule for Amazon Web Services managed -// keys from every three years (approximately 1,095 days) to every year (approximately -// 365 days). -// -// New Amazon Web Services managed keys are automatically rotated one year after -// they are created, and approximately every year thereafter. -// -// Existing Amazon Web Services managed keys are automatically rotated one year -// after their most recent rotation, and every year thereafter. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:EnableKeyRotation (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - DisableKeyRotation -// -// - GetKeyRotationStatus -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation EnableKeyRotation for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKeyRotation -func (c *KMS) EnableKeyRotation(input *EnableKeyRotationInput) (*EnableKeyRotationOutput, error) { - req, out := c.EnableKeyRotationRequest(input) - return out, req.Send() -} - -// EnableKeyRotationWithContext is the same as EnableKeyRotation with the addition of -// the ability to pass a context and additional request options. -// -// See EnableKeyRotation for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) EnableKeyRotationWithContext(ctx aws.Context, input *EnableKeyRotationInput, opts ...request.Option) (*EnableKeyRotationOutput, error) { - req, out := c.EnableKeyRotationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opEncrypt = "Encrypt" - -// EncryptRequest generates a "aws/request.Request" representing the -// client's request for the Encrypt operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See Encrypt for more information on using the Encrypt -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the EncryptRequest method. -// req, resp := client.EncryptRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Encrypt -func (c *KMS) EncryptRequest(input *EncryptInput) (req *request.Request, output *EncryptOutput) { - op := &request.Operation{ - Name: opEncrypt, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &EncryptInput{} - } - - output = &EncryptOutput{} - req = c.newRequest(op, input, output) - return -} - -// Encrypt API operation for AWS Key Management Service. -// -// Encrypts plaintext of up to 4,096 bytes using a KMS key. You can use a symmetric -// or asymmetric KMS key with a KeyUsage of ENCRYPT_DECRYPT. -// -// You can use this operation to encrypt small amounts of arbitrary data, such -// as a personal identifier or database password, or other sensitive information. -// You don't need to use the Encrypt operation to encrypt a data key. The GenerateDataKey -// and GenerateDataKeyPair operations return a plaintext data key and an encrypted -// copy of that data key. -// -// If you use a symmetric encryption KMS key, you can use an encryption context -// to add additional security to your encryption operation. If you specify an -// EncryptionContext when encrypting data, you must specify the same encryption -// context (a case-sensitive exact match) when decrypting the data. Otherwise, -// the request to decrypt fails with an InvalidCiphertextException. For more -// information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) -// in the Key Management Service Developer Guide. -// -// If you specify an asymmetric KMS key, you must also specify the encryption -// algorithm. The algorithm must be compatible with the KMS key spec. -// -// When you use an asymmetric KMS key to encrypt or reencrypt data, be sure -// to record the KMS key and encryption algorithm that you choose. You will -// be required to provide the same KMS key and encryption algorithm when you -// decrypt the data. If the KMS key and algorithm do not match the values used -// to encrypt the data, the decrypt operation fails. -// -// You are not required to supply the key ID and encryption algorithm when you -// decrypt with symmetric encryption KMS keys because KMS stores this information -// in the ciphertext blob. KMS cannot store metadata in ciphertext generated -// with asymmetric keys. The standard format for asymmetric key ciphertext does -// not include configurable fields. -// -// The maximum size of the data that you can encrypt varies with the type of -// KMS key and the encryption algorithm that you choose. -// -// - Symmetric encryption KMS keys SYMMETRIC_DEFAULT: 4096 bytes -// -// - RSA_2048 RSAES_OAEP_SHA_1: 214 bytes RSAES_OAEP_SHA_256: 190 bytes -// -// - RSA_3072 RSAES_OAEP_SHA_1: 342 bytes RSAES_OAEP_SHA_256: 318 bytes -// -// - RSA_4096 RSAES_OAEP_SHA_1: 470 bytes RSAES_OAEP_SHA_256: 446 bytes -// -// - SM2PKE: 1024 bytes (China Regions only) -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:Encrypt (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - Decrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyPair -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation Encrypt for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Encrypt -func (c *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error) { - req, out := c.EncryptRequest(input) - return out, req.Send() -} - -// EncryptWithContext is the same as Encrypt with the addition of -// the ability to pass a context and additional request options. -// -// See Encrypt for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) EncryptWithContext(ctx aws.Context, input *EncryptInput, opts ...request.Option) (*EncryptOutput, error) { - req, out := c.EncryptRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGenerateDataKey = "GenerateDataKey" - -// GenerateDataKeyRequest generates a "aws/request.Request" representing the -// client's request for the GenerateDataKey operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GenerateDataKey for more information on using the GenerateDataKey -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GenerateDataKeyRequest method. -// req, resp := client.GenerateDataKeyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKey -func (c *KMS) GenerateDataKeyRequest(input *GenerateDataKeyInput) (req *request.Request, output *GenerateDataKeyOutput) { - op := &request.Operation{ - Name: opGenerateDataKey, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GenerateDataKeyInput{} - } - - output = &GenerateDataKeyOutput{} - req = c.newRequest(op, input, output) - return -} - -// GenerateDataKey API operation for AWS Key Management Service. -// -// Returns a unique symmetric data key for use outside of KMS. This operation -// returns a plaintext copy of the data key and a copy that is encrypted under -// a symmetric encryption KMS key that you specify. The bytes in the plaintext -// key are random; they are not related to the caller or the KMS key. You can -// use the plaintext key to encrypt your data outside of KMS and store the encrypted -// data key with the encrypted data. -// -// To generate a data key, specify the symmetric encryption KMS key that will -// be used to encrypt the data key. You cannot use an asymmetric KMS key to -// encrypt data keys. To get the type of your KMS key, use the DescribeKey operation. -// -// You must also specify the length of the data key. Use either the KeySpec -// or NumberOfBytes parameters (but not both). For 128-bit and 256-bit data -// keys, use the KeySpec parameter. -// -// To generate an SM4 data key (China Regions only), specify a KeySpec value -// of AES_128 or NumberOfBytes value of 128. The symmetric encryption key used -// in China Regions to encrypt your data key is an SM4 encryption key. -// -// To get only an encrypted copy of the data key, use GenerateDataKeyWithoutPlaintext. -// To generate an asymmetric data key pair, use the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext -// operation. To get a cryptographically secure random byte string, use GenerateRandom. -// -// You can use an optional encryption context to add additional security to -// the encryption operation. If you specify an EncryptionContext, you must specify -// the same encryption context (a case-sensitive exact match) when decrypting -// the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. -// For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) -// in the Key Management Service Developer Guide. -// -// Applications in Amazon Web Services Nitro Enclaves can call this operation -// by using the Amazon Web Services Nitro Enclaves Development Kit (https://github.com/aws/aws-nitro-enclaves-sdk-c). -// For information about the supporting parameters, see How Amazon Web Services -// Nitro Enclaves use KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// # How to use your data key -// -// We recommend that you use the following pattern to encrypt data locally in -// your application. You can write your own code or use a client-side encryption -// library, such as the Amazon Web Services Encryption SDK (https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/), -// the Amazon DynamoDB Encryption Client (https://docs.aws.amazon.com/dynamodb-encryption-client/latest/devguide/), -// or Amazon S3 client-side encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html) -// to do these tasks for you. -// -// To encrypt data outside of KMS: -// -// Use the GenerateDataKey operation to get a data key. -// -// Use the plaintext data key (in the Plaintext field of the response) to encrypt -// your data outside of KMS. Then erase the plaintext data key from memory. -// -// Store the encrypted data key (in the CiphertextBlob field of the response) -// with the encrypted data. -// -// To decrypt data outside of KMS: -// -// Use the Decrypt operation to decrypt the encrypted data key. The operation -// returns a plaintext copy of the data key. -// -// Use the plaintext data key to decrypt data outside of KMS, then erase the -// plaintext data key from memory. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:GenerateDataKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - Decrypt -// -// - Encrypt -// -// - GenerateDataKeyPair -// -// - GenerateDataKeyPairWithoutPlaintext -// -// - GenerateDataKeyWithoutPlaintext -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GenerateDataKey for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKey -func (c *KMS) GenerateDataKey(input *GenerateDataKeyInput) (*GenerateDataKeyOutput, error) { - req, out := c.GenerateDataKeyRequest(input) - return out, req.Send() -} - -// GenerateDataKeyWithContext is the same as GenerateDataKey with the addition of -// the ability to pass a context and additional request options. -// -// See GenerateDataKey for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GenerateDataKeyWithContext(ctx aws.Context, input *GenerateDataKeyInput, opts ...request.Option) (*GenerateDataKeyOutput, error) { - req, out := c.GenerateDataKeyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGenerateDataKeyPair = "GenerateDataKeyPair" - -// GenerateDataKeyPairRequest generates a "aws/request.Request" representing the -// client's request for the GenerateDataKeyPair operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GenerateDataKeyPair for more information on using the GenerateDataKeyPair -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GenerateDataKeyPairRequest method. -// req, resp := client.GenerateDataKeyPairRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPair -func (c *KMS) GenerateDataKeyPairRequest(input *GenerateDataKeyPairInput) (req *request.Request, output *GenerateDataKeyPairOutput) { - op := &request.Operation{ - Name: opGenerateDataKeyPair, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GenerateDataKeyPairInput{} - } - - output = &GenerateDataKeyPairOutput{} - req = c.newRequest(op, input, output) - return -} - -// GenerateDataKeyPair API operation for AWS Key Management Service. -// -// Returns a unique asymmetric data key pair for use outside of KMS. This operation -// returns a plaintext public key, a plaintext private key, and a copy of the -// private key that is encrypted under the symmetric encryption KMS key you -// specify. You can use the data key pair to perform asymmetric cryptography -// and implement digital signatures outside of KMS. The bytes in the keys are -// random; they not related to the caller or to the KMS key that is used to -// encrypt the private key. -// -// You can use the public key that GenerateDataKeyPair returns to encrypt data -// or verify a signature outside of KMS. Then, store the encrypted private key -// with the data. When you are ready to decrypt data or sign a message, you -// can use the Decrypt operation to decrypt the encrypted private key. -// -// To generate a data key pair, you must specify a symmetric encryption KMS -// key to encrypt the private key in a data key pair. You cannot use an asymmetric -// KMS key or a KMS key in a custom key store. To get the type and origin of -// your KMS key, use the DescribeKey operation. -// -// Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data -// key pair. In China Regions, you can also choose an SM2 data key pair. KMS -// recommends that you use ECC key pairs for signing, and use RSA and SM2 key -// pairs for either encryption or signing, but not both. However, KMS cannot -// enforce any restrictions on the use of data key pairs outside of KMS. -// -// If you are using the data key pair to encrypt data, or for any operation -// where you don't immediately need a private key, consider using the GenerateDataKeyPairWithoutPlaintext -// operation. GenerateDataKeyPairWithoutPlaintext returns a plaintext public -// key and an encrypted private key, but omits the plaintext private key that -// you need only to decrypt ciphertext or sign a message. Later, when you need -// to decrypt the data or sign a message, use the Decrypt operation to decrypt -// the encrypted private key in the data key pair. -// -// GenerateDataKeyPair returns a unique data key pair for each request. The -// bytes in the keys are random; they are not related to the caller or the KMS -// key that is used to encrypt the private key. The public key is a DER-encoded -// X.509 SubjectPublicKeyInfo, as specified in RFC 5280 (https://tools.ietf.org/html/rfc5280). -// The private key is a DER-encoded PKCS8 PrivateKeyInfo, as specified in RFC -// 5958 (https://tools.ietf.org/html/rfc5958). -// -// You can use an optional encryption context to add additional security to -// the encryption operation. If you specify an EncryptionContext, you must specify -// the same encryption context (a case-sensitive exact match) when decrypting -// the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. -// For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:GenerateDataKeyPair (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - Decrypt -// -// - Encrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyPairWithoutPlaintext -// -// - GenerateDataKeyWithoutPlaintext -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GenerateDataKeyPair for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPair -func (c *KMS) GenerateDataKeyPair(input *GenerateDataKeyPairInput) (*GenerateDataKeyPairOutput, error) { - req, out := c.GenerateDataKeyPairRequest(input) - return out, req.Send() -} - -// GenerateDataKeyPairWithContext is the same as GenerateDataKeyPair with the addition of -// the ability to pass a context and additional request options. -// -// See GenerateDataKeyPair for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GenerateDataKeyPairWithContext(ctx aws.Context, input *GenerateDataKeyPairInput, opts ...request.Option) (*GenerateDataKeyPairOutput, error) { - req, out := c.GenerateDataKeyPairRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGenerateDataKeyPairWithoutPlaintext = "GenerateDataKeyPairWithoutPlaintext" - -// GenerateDataKeyPairWithoutPlaintextRequest generates a "aws/request.Request" representing the -// client's request for the GenerateDataKeyPairWithoutPlaintext operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GenerateDataKeyPairWithoutPlaintext for more information on using the GenerateDataKeyPairWithoutPlaintext -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GenerateDataKeyPairWithoutPlaintextRequest method. -// req, resp := client.GenerateDataKeyPairWithoutPlaintextRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPairWithoutPlaintext -func (c *KMS) GenerateDataKeyPairWithoutPlaintextRequest(input *GenerateDataKeyPairWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyPairWithoutPlaintextOutput) { - op := &request.Operation{ - Name: opGenerateDataKeyPairWithoutPlaintext, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GenerateDataKeyPairWithoutPlaintextInput{} - } - - output = &GenerateDataKeyPairWithoutPlaintextOutput{} - req = c.newRequest(op, input, output) - return -} - -// GenerateDataKeyPairWithoutPlaintext API operation for AWS Key Management Service. -// -// Returns a unique asymmetric data key pair for use outside of KMS. This operation -// returns a plaintext public key and a copy of the private key that is encrypted -// under the symmetric encryption KMS key you specify. Unlike GenerateDataKeyPair, -// this operation does not return a plaintext private key. The bytes in the -// keys are random; they are not related to the caller or to the KMS key that -// is used to encrypt the private key. -// -// You can use the public key that GenerateDataKeyPairWithoutPlaintext returns -// to encrypt data or verify a signature outside of KMS. Then, store the encrypted -// private key with the data. When you are ready to decrypt data or sign a message, -// you can use the Decrypt operation to decrypt the encrypted private key. -// -// To generate a data key pair, you must specify a symmetric encryption KMS -// key to encrypt the private key in a data key pair. You cannot use an asymmetric -// KMS key or a KMS key in a custom key store. To get the type and origin of -// your KMS key, use the DescribeKey operation. -// -// Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data -// key pair. In China Regions, you can also choose an SM2 data key pair. KMS -// recommends that you use ECC key pairs for signing, and use RSA and SM2 key -// pairs for either encryption or signing, but not both. However, KMS cannot -// enforce any restrictions on the use of data key pairs outside of KMS. -// -// GenerateDataKeyPairWithoutPlaintext returns a unique data key pair for each -// request. The bytes in the key are not related to the caller or KMS key that -// is used to encrypt the private key. The public key is a DER-encoded X.509 -// SubjectPublicKeyInfo, as specified in RFC 5280 (https://tools.ietf.org/html/rfc5280). -// -// You can use an optional encryption context to add additional security to -// the encryption operation. If you specify an EncryptionContext, you must specify -// the same encryption context (a case-sensitive exact match) when decrypting -// the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. -// For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:GenerateDataKeyPairWithoutPlaintext (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - Decrypt -// -// - Encrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyPair -// -// - GenerateDataKeyWithoutPlaintext -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GenerateDataKeyPairWithoutPlaintext for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPairWithoutPlaintext -func (c *KMS) GenerateDataKeyPairWithoutPlaintext(input *GenerateDataKeyPairWithoutPlaintextInput) (*GenerateDataKeyPairWithoutPlaintextOutput, error) { - req, out := c.GenerateDataKeyPairWithoutPlaintextRequest(input) - return out, req.Send() -} - -// GenerateDataKeyPairWithoutPlaintextWithContext is the same as GenerateDataKeyPairWithoutPlaintext with the addition of -// the ability to pass a context and additional request options. -// -// See GenerateDataKeyPairWithoutPlaintext for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GenerateDataKeyPairWithoutPlaintextWithContext(ctx aws.Context, input *GenerateDataKeyPairWithoutPlaintextInput, opts ...request.Option) (*GenerateDataKeyPairWithoutPlaintextOutput, error) { - req, out := c.GenerateDataKeyPairWithoutPlaintextRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGenerateDataKeyWithoutPlaintext = "GenerateDataKeyWithoutPlaintext" - -// GenerateDataKeyWithoutPlaintextRequest generates a "aws/request.Request" representing the -// client's request for the GenerateDataKeyWithoutPlaintext operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GenerateDataKeyWithoutPlaintext for more information on using the GenerateDataKeyWithoutPlaintext -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GenerateDataKeyWithoutPlaintextRequest method. -// req, resp := client.GenerateDataKeyWithoutPlaintextRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyWithoutPlaintext -func (c *KMS) GenerateDataKeyWithoutPlaintextRequest(input *GenerateDataKeyWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyWithoutPlaintextOutput) { - op := &request.Operation{ - Name: opGenerateDataKeyWithoutPlaintext, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GenerateDataKeyWithoutPlaintextInput{} - } - - output = &GenerateDataKeyWithoutPlaintextOutput{} - req = c.newRequest(op, input, output) - return -} - -// GenerateDataKeyWithoutPlaintext API operation for AWS Key Management Service. -// -// Returns a unique symmetric data key for use outside of KMS. This operation -// returns a data key that is encrypted under a symmetric encryption KMS key -// that you specify. The bytes in the key are random; they are not related to -// the caller or to the KMS key. -// -// GenerateDataKeyWithoutPlaintext is identical to the GenerateDataKey operation -// except that it does not return a plaintext copy of the data key. -// -// This operation is useful for systems that need to encrypt data at some point, -// but not immediately. When you need to encrypt the data, you call the Decrypt -// operation on the encrypted copy of the key. -// -// It's also useful in distributed systems with different levels of trust. For -// example, you might store encrypted data in containers. One component of your -// system creates new containers and stores an encrypted data key with each -// container. Then, a different component puts the data into the containers. -// That component first decrypts the data key, uses the plaintext data key to -// encrypt data, puts the encrypted data into the container, and then destroys -// the plaintext data key. In this system, the component that creates the containers -// never sees the plaintext data key. -// -// To request an asymmetric data key pair, use the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext -// operations. -// -// To generate a data key, you must specify the symmetric encryption KMS key -// that is used to encrypt the data key. You cannot use an asymmetric KMS key -// or a key in a custom key store to generate a data key. To get the type of -// your KMS key, use the DescribeKey operation. -// -// If the operation succeeds, you will find the encrypted copy of the data key -// in the CiphertextBlob field. -// -// You can use an optional encryption context to add additional security to -// the encryption operation. If you specify an EncryptionContext, you must specify -// the same encryption context (a case-sensitive exact match) when decrypting -// the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. -// For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:GenerateDataKeyWithoutPlaintext (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - Decrypt -// -// - Encrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyPair -// -// - GenerateDataKeyPairWithoutPlaintext -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GenerateDataKeyWithoutPlaintext for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyWithoutPlaintext -func (c *KMS) GenerateDataKeyWithoutPlaintext(input *GenerateDataKeyWithoutPlaintextInput) (*GenerateDataKeyWithoutPlaintextOutput, error) { - req, out := c.GenerateDataKeyWithoutPlaintextRequest(input) - return out, req.Send() -} - -// GenerateDataKeyWithoutPlaintextWithContext is the same as GenerateDataKeyWithoutPlaintext with the addition of -// the ability to pass a context and additional request options. -// -// See GenerateDataKeyWithoutPlaintext for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GenerateDataKeyWithoutPlaintextWithContext(ctx aws.Context, input *GenerateDataKeyWithoutPlaintextInput, opts ...request.Option) (*GenerateDataKeyWithoutPlaintextOutput, error) { - req, out := c.GenerateDataKeyWithoutPlaintextRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGenerateMac = "GenerateMac" - -// GenerateMacRequest generates a "aws/request.Request" representing the -// client's request for the GenerateMac operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GenerateMac for more information on using the GenerateMac -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GenerateMacRequest method. -// req, resp := client.GenerateMacRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateMac -func (c *KMS) GenerateMacRequest(input *GenerateMacInput) (req *request.Request, output *GenerateMacOutput) { - op := &request.Operation{ - Name: opGenerateMac, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GenerateMacInput{} - } - - output = &GenerateMacOutput{} - req = c.newRequest(op, input, output) - return -} - -// GenerateMac API operation for AWS Key Management Service. -// -// Generates a hash-based message authentication code (HMAC) for a message using -// an HMAC KMS key and a MAC algorithm that the key supports. The MAC algorithm -// computes the HMAC for the message and the key as described in RFC 2104 (https://datatracker.ietf.org/doc/html/rfc2104). -// -// You can use the HMAC that this operation generates with the VerifyMac operation -// to demonstrate that the original message has not changed. Also, because a -// secret key is used to create the hash, you can verify that the party that -// generated the hash has the required secret key. This operation is part of -// KMS support for HMAC KMS keys. For details, see HMAC keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html) -// in the Key Management Service Developer Guide . -// -// Best practices recommend that you limit the time during which any signing -// mechanism, including an HMAC, is effective. This deters an attack where the -// actor uses a signed message to establish validity repeatedly or long after -// the message is superseded. HMAC tags do not include a timestamp, but you -// can include a timestamp in the token or message to help you detect when its -// time to refresh the HMAC. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:GenerateMac (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: VerifyMac -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GenerateMac for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateMac -func (c *KMS) GenerateMac(input *GenerateMacInput) (*GenerateMacOutput, error) { - req, out := c.GenerateMacRequest(input) - return out, req.Send() -} - -// GenerateMacWithContext is the same as GenerateMac with the addition of -// the ability to pass a context and additional request options. -// -// See GenerateMac for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GenerateMacWithContext(ctx aws.Context, input *GenerateMacInput, opts ...request.Option) (*GenerateMacOutput, error) { - req, out := c.GenerateMacRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGenerateRandom = "GenerateRandom" - -// GenerateRandomRequest generates a "aws/request.Request" representing the -// client's request for the GenerateRandom operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GenerateRandom for more information on using the GenerateRandom -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GenerateRandomRequest method. -// req, resp := client.GenerateRandomRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateRandom -func (c *KMS) GenerateRandomRequest(input *GenerateRandomInput) (req *request.Request, output *GenerateRandomOutput) { - op := &request.Operation{ - Name: opGenerateRandom, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GenerateRandomInput{} - } - - output = &GenerateRandomOutput{} - req = c.newRequest(op, input, output) - return -} - -// GenerateRandom API operation for AWS Key Management Service. -// -// Returns a random byte string that is cryptographically secure. -// -// You must use the NumberOfBytes parameter to specify the length of the random -// byte string. There is no default value for string length. -// -// By default, the random byte string is generated in KMS. To generate the byte -// string in the CloudHSM cluster that is associated with a custom key store -// (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html), -// specify the custom key store ID. -// -// Applications in Amazon Web Services Nitro Enclaves can call this operation -// by using the Amazon Web Services Nitro Enclaves Development Kit (https://github.com/aws/aws-nitro-enclaves-sdk-c). -// For information about the supporting parameters, see How Amazon Web Services -// Nitro Enclaves use KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) -// in the Key Management Service Developer Guide. -// -// For more information about entropy and random number generation, see Key -// Management Service Cryptographic Details (https://docs.aws.amazon.com/kms/latest/cryptographic-details/). -// -// Cross-account use: Not applicable. GenerateRandom does not use any account-specific -// resources, such as KMS keys. -// -// Required permissions: kms:GenerateRandom (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GenerateRandom for usage and error information. -// -// Returned Error Types: -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - CustomKeyStoreNotFoundException -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -// -// - CustomKeyStoreInvalidStateException -// The request was rejected because of the ConnectionState of the custom key -// store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// This exception is thrown under the following conditions: -// -// - You requested the CreateKey or GenerateRandom operation in a custom -// key store that is not connected. These operations are valid only when -// the custom key store ConnectionState is CONNECTED. -// -// - You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation -// on a custom key store that is not disconnected. This operation is valid -// only when the custom key store ConnectionState is DISCONNECTED. -// -// - You requested the ConnectCustomKeyStore operation on a custom key store -// with a ConnectionState of DISCONNECTING or FAILED. This operation is valid -// for all other ConnectionState values. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateRandom -func (c *KMS) GenerateRandom(input *GenerateRandomInput) (*GenerateRandomOutput, error) { - req, out := c.GenerateRandomRequest(input) - return out, req.Send() -} - -// GenerateRandomWithContext is the same as GenerateRandom with the addition of -// the ability to pass a context and additional request options. -// -// See GenerateRandom for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GenerateRandomWithContext(ctx aws.Context, input *GenerateRandomInput, opts ...request.Option) (*GenerateRandomOutput, error) { - req, out := c.GenerateRandomRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetKeyPolicy = "GetKeyPolicy" - -// GetKeyPolicyRequest generates a "aws/request.Request" representing the -// client's request for the GetKeyPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetKeyPolicy for more information on using the GetKeyPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GetKeyPolicyRequest method. -// req, resp := client.GetKeyPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyPolicy -func (c *KMS) GetKeyPolicyRequest(input *GetKeyPolicyInput) (req *request.Request, output *GetKeyPolicyOutput) { - op := &request.Operation{ - Name: opGetKeyPolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetKeyPolicyInput{} - } - - output = &GetKeyPolicyOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetKeyPolicy API operation for AWS Key Management Service. -// -// Gets a key policy attached to the specified KMS key. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:GetKeyPolicy (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: PutKeyPolicy -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GetKeyPolicy for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyPolicy -func (c *KMS) GetKeyPolicy(input *GetKeyPolicyInput) (*GetKeyPolicyOutput, error) { - req, out := c.GetKeyPolicyRequest(input) - return out, req.Send() -} - -// GetKeyPolicyWithContext is the same as GetKeyPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See GetKeyPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GetKeyPolicyWithContext(ctx aws.Context, input *GetKeyPolicyInput, opts ...request.Option) (*GetKeyPolicyOutput, error) { - req, out := c.GetKeyPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetKeyRotationStatus = "GetKeyRotationStatus" - -// GetKeyRotationStatusRequest generates a "aws/request.Request" representing the -// client's request for the GetKeyRotationStatus operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetKeyRotationStatus for more information on using the GetKeyRotationStatus -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GetKeyRotationStatusRequest method. -// req, resp := client.GetKeyRotationStatusRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyRotationStatus -func (c *KMS) GetKeyRotationStatusRequest(input *GetKeyRotationStatusInput) (req *request.Request, output *GetKeyRotationStatusOutput) { - op := &request.Operation{ - Name: opGetKeyRotationStatus, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetKeyRotationStatusInput{} - } - - output = &GetKeyRotationStatusOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetKeyRotationStatus API operation for AWS Key Management Service. -// -// Gets a Boolean value that indicates whether automatic rotation of the key -// material (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html) -// is enabled for the specified KMS key. -// -// When you enable automatic rotation for customer managed KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk), -// KMS rotates the key material of the KMS key one year (approximately 365 days) -// from the enable date and every year thereafter. You can monitor rotation -// of the key material for your KMS keys in CloudTrail and Amazon CloudWatch. -// -// Automatic key rotation is supported only on symmetric encryption KMS keys -// (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#symmetric-cmks). -// You cannot enable or disable automatic rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html), -// HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html), -// KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html), -// or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). -// The key rotation status of these KMS keys is always false. To enable or disable -// automatic rotation of a set of related multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate), -// set the property on the primary key.. -// -// You can enable (EnableKeyRotation) and disable automatic rotation (DisableKeyRotation) -// of the key material in customer managed KMS keys. Key material rotation of -// Amazon Web Services managed KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) -// is not configurable. KMS always rotates the key material in Amazon Web Services -// managed KMS keys every year. The key rotation status for Amazon Web Services -// managed KMS keys is always true. -// -// In May 2022, KMS changed the rotation schedule for Amazon Web Services managed -// keys from every three years to every year. For details, see EnableKeyRotation. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// - Disabled: The key rotation status does not change when you disable a -// KMS key. However, while the KMS key is disabled, KMS does not rotate the -// key material. When you re-enable the KMS key, rotation resumes. If the -// key material in the re-enabled KMS key hasn't been rotated in one year, -// KMS rotates it immediately, and every year thereafter. If it's been less -// than a year since the key material in the re-enabled KMS key was rotated, -// the KMS key resumes its prior rotation schedule. -// -// - Pending deletion: While a KMS key is pending deletion, its key rotation -// status is false and KMS does not rotate the key material. If you cancel -// the deletion, the original key rotation status returns to true. -// -// Cross-account use: Yes. To perform this operation on a KMS key in a different -// Amazon Web Services account, specify the key ARN in the value of the KeyId -// parameter. -// -// Required permissions: kms:GetKeyRotationStatus (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - DisableKeyRotation -// -// - EnableKeyRotation -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GetKeyRotationStatus for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyRotationStatus -func (c *KMS) GetKeyRotationStatus(input *GetKeyRotationStatusInput) (*GetKeyRotationStatusOutput, error) { - req, out := c.GetKeyRotationStatusRequest(input) - return out, req.Send() -} - -// GetKeyRotationStatusWithContext is the same as GetKeyRotationStatus with the addition of -// the ability to pass a context and additional request options. -// -// See GetKeyRotationStatus for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GetKeyRotationStatusWithContext(ctx aws.Context, input *GetKeyRotationStatusInput, opts ...request.Option) (*GetKeyRotationStatusOutput, error) { - req, out := c.GetKeyRotationStatusRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetParametersForImport = "GetParametersForImport" - -// GetParametersForImportRequest generates a "aws/request.Request" representing the -// client's request for the GetParametersForImport operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetParametersForImport for more information on using the GetParametersForImport -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GetParametersForImportRequest method. -// req, resp := client.GetParametersForImportRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetParametersForImport -func (c *KMS) GetParametersForImportRequest(input *GetParametersForImportInput) (req *request.Request, output *GetParametersForImportOutput) { - op := &request.Operation{ - Name: opGetParametersForImport, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetParametersForImportInput{} - } - - output = &GetParametersForImportOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetParametersForImport API operation for AWS Key Management Service. -// -// Returns the items you need to import key material into a symmetric encryption -// KMS key. For more information about importing key material into KMS, see -// Importing key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) -// in the Key Management Service Developer Guide. -// -// This operation returns a public key and an import token. Use the public key -// to encrypt the symmetric key material. Store the import token to send with -// a subsequent ImportKeyMaterial request. -// -// You must specify the key ID of the symmetric encryption KMS key into which -// you will import key material. This KMS key's Origin must be EXTERNAL. You -// must also specify the wrapping algorithm and type of wrapping key (public -// key) that you will use to encrypt the key material. You cannot perform this -// operation on an asymmetric KMS key, an HMAC KMS key, or on any KMS key in -// a different Amazon Web Services account. -// -// To import key material, you must use the public key and import token from -// the same response. These items are valid for 24 hours. The expiration date -// and time appear in the GetParametersForImport response. You cannot use an -// expired token in an ImportKeyMaterial request. If your key and token expire, -// send another GetParametersForImport request. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:GetParametersForImport (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - ImportKeyMaterial -// -// - DeleteImportedKeyMaterial -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GetParametersForImport for usage and error information. -// -// Returned Error Types: -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetParametersForImport -func (c *KMS) GetParametersForImport(input *GetParametersForImportInput) (*GetParametersForImportOutput, error) { - req, out := c.GetParametersForImportRequest(input) - return out, req.Send() -} - -// GetParametersForImportWithContext is the same as GetParametersForImport with the addition of -// the ability to pass a context and additional request options. -// -// See GetParametersForImport for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GetParametersForImportWithContext(ctx aws.Context, input *GetParametersForImportInput, opts ...request.Option) (*GetParametersForImportOutput, error) { - req, out := c.GetParametersForImportRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetPublicKey = "GetPublicKey" - -// GetPublicKeyRequest generates a "aws/request.Request" representing the -// client's request for the GetPublicKey operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetPublicKey for more information on using the GetPublicKey -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the GetPublicKeyRequest method. -// req, resp := client.GetPublicKeyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetPublicKey -func (c *KMS) GetPublicKeyRequest(input *GetPublicKeyInput) (req *request.Request, output *GetPublicKeyOutput) { - op := &request.Operation{ - Name: opGetPublicKey, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetPublicKeyInput{} - } - - output = &GetPublicKeyOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetPublicKey API operation for AWS Key Management Service. -// -// Returns the public key of an asymmetric KMS key. Unlike the private key of -// a asymmetric KMS key, which never leaves KMS unencrypted, callers with kms:GetPublicKey -// permission can download the public key of an asymmetric KMS key. You can -// share the public key to allow others to encrypt messages and verify signatures -// outside of KMS. For information about asymmetric KMS keys, see Asymmetric -// KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) -// in the Key Management Service Developer Guide. -// -// You do not need to download the public key. Instead, you can use the public -// key within KMS by calling the Encrypt, ReEncrypt, or Verify operations with -// the identifier of an asymmetric KMS key. When you use the public key within -// KMS, you benefit from the authentication, authorization, and logging that -// are part of every KMS operation. You also reduce of risk of encrypting data -// that cannot be decrypted. These features are not effective outside of KMS. -// -// To verify a signature outside of KMS with an SM2 public key (China Regions -// only), you must specify the distinguishing ID. By default, KMS uses 1234567812345678 -// as the distinguishing ID. For more information, see Offline verification -// with SM2 key pairs (https://docs.aws.amazon.com/kms/latest/developerguide/asymmetric-key-specs.html#key-spec-sm-offline-verification). -// -// To help you use the public key safely outside of KMS, GetPublicKey returns -// important information about the public key in the response, including: -// -// - KeySpec (https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-KeySpec): -// The type of key material in the public key, such as RSA_4096 or ECC_NIST_P521. -// -// - KeyUsage (https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-KeyUsage): -// Whether the key is used for encryption or signing. -// -// - EncryptionAlgorithms (https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-EncryptionAlgorithms) -// or SigningAlgorithms (https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html#KMS-GetPublicKey-response-SigningAlgorithms): -// A list of the encryption algorithms or the signing algorithms for the -// key. -// -// Although KMS cannot enforce these restrictions on external operations, it -// is crucial that you use this information to prevent the public key from being -// used improperly. For example, you can prevent a public signing key from being -// used encrypt data, or prevent a public key from being used with an encryption -// algorithm that is not supported by KMS. You can also avoid errors, such as -// using the wrong signing algorithm in a verification operation. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:GetPublicKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: CreateKey -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation GetPublicKey for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetPublicKey -func (c *KMS) GetPublicKey(input *GetPublicKeyInput) (*GetPublicKeyOutput, error) { - req, out := c.GetPublicKeyRequest(input) - return out, req.Send() -} - -// GetPublicKeyWithContext is the same as GetPublicKey with the addition of -// the ability to pass a context and additional request options. -// -// See GetPublicKey for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) GetPublicKeyWithContext(ctx aws.Context, input *GetPublicKeyInput, opts ...request.Option) (*GetPublicKeyOutput, error) { - req, out := c.GetPublicKeyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opImportKeyMaterial = "ImportKeyMaterial" - -// ImportKeyMaterialRequest generates a "aws/request.Request" representing the -// client's request for the ImportKeyMaterial operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ImportKeyMaterial for more information on using the ImportKeyMaterial -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ImportKeyMaterialRequest method. -// req, resp := client.ImportKeyMaterialRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ImportKeyMaterial -func (c *KMS) ImportKeyMaterialRequest(input *ImportKeyMaterialInput) (req *request.Request, output *ImportKeyMaterialOutput) { - op := &request.Operation{ - Name: opImportKeyMaterial, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ImportKeyMaterialInput{} - } - - output = &ImportKeyMaterialOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// ImportKeyMaterial API operation for AWS Key Management Service. -// -// Imports key material into an existing symmetric encryption KMS key that was -// created without key material. After you successfully import key material -// into a KMS key, you can reimport the same key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html#reimport-key-material) -// into that KMS key, but you cannot import different key material. -// -// You cannot perform this operation on an asymmetric KMS key, an HMAC KMS key, -// or on any KMS key in a different Amazon Web Services account. For more information -// about creating KMS keys with no key material and then importing key material, -// see Importing Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) -// in the Key Management Service Developer Guide. -// -// Before using this operation, call GetParametersForImport. Its response includes -// a public key and an import token. Use the public key to encrypt the key material. -// Then, submit the import token from the same GetParametersForImport response. -// -// When calling this operation, you must specify the following values: -// -// - The key ID or key ARN of a KMS key with no key material. Its Origin -// must be EXTERNAL. To create a KMS key with no key material, call CreateKey -// and set the value of its Origin parameter to EXTERNAL. To get the Origin -// of a KMS key, call DescribeKey.) -// -// - The encrypted key material. To get the public key to encrypt the key -// material, call GetParametersForImport. -// -// - The import token that GetParametersForImport returned. You must use -// a public key and token from the same GetParametersForImport response. -// -// - Whether the key material expires and if so, when. If you set an expiration -// date, KMS deletes the key material from the KMS key on the specified date, -// and the KMS key becomes unusable. To use the KMS key again, you must reimport -// the same key material. The only way to change an expiration date is by -// reimporting the same key material and specifying a new expiration date. -// -// When this operation is successful, the key state of the KMS key changes from -// PendingImport to Enabled, and you can use the KMS key. -// -// If this operation fails, use the exception to help determine the problem. -// If the error is related to the key material, the import token, or wrapping -// key, use GetParametersForImport to get a new public key and import token -// for the KMS key and repeat the import procedure. For help, see How To Import -// Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html#importing-keys-overview) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:ImportKeyMaterial (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - DeleteImportedKeyMaterial -// -// - GetParametersForImport -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ImportKeyMaterial for usage and error information. -// -// Returned Error Types: -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - InvalidCiphertextException -// From the Decrypt or ReEncrypt operation, the request was rejected because -// the specified ciphertext, or additional authenticated data incorporated into -// the ciphertext, such as the encryption context, is corrupted, missing, or -// otherwise invalid. -// -// From the ImportKeyMaterial operation, the request was rejected because KMS -// could not decrypt the encrypted (wrapped) key material. -// -// - IncorrectKeyMaterialException -// The request was rejected because the key material in the request is, expired, -// invalid, or is not the same key material that was previously imported into -// this KMS key. -// -// - ExpiredImportTokenException -// The request was rejected because the specified import token is expired. Use -// GetParametersForImport to get a new import token and public key, use the -// new public key to encrypt the key material, and then try the request again. -// -// - InvalidImportTokenException -// The request was rejected because the provided import token is invalid or -// is associated with a different KMS key. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ImportKeyMaterial -func (c *KMS) ImportKeyMaterial(input *ImportKeyMaterialInput) (*ImportKeyMaterialOutput, error) { - req, out := c.ImportKeyMaterialRequest(input) - return out, req.Send() -} - -// ImportKeyMaterialWithContext is the same as ImportKeyMaterial with the addition of -// the ability to pass a context and additional request options. -// -// See ImportKeyMaterial for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ImportKeyMaterialWithContext(ctx aws.Context, input *ImportKeyMaterialInput, opts ...request.Option) (*ImportKeyMaterialOutput, error) { - req, out := c.ImportKeyMaterialRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListAliases = "ListAliases" - -// ListAliasesRequest generates a "aws/request.Request" representing the -// client's request for the ListAliases operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListAliases for more information on using the ListAliases -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ListAliasesRequest method. -// req, resp := client.ListAliasesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListAliases -func (c *KMS) ListAliasesRequest(input *ListAliasesInput) (req *request.Request, output *ListAliasesOutput) { - op := &request.Operation{ - Name: opListAliases, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "Limit", - TruncationToken: "Truncated", - }, - } - - if input == nil { - input = &ListAliasesInput{} - } - - output = &ListAliasesOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListAliases API operation for AWS Key Management Service. -// -// Gets a list of aliases in the caller's Amazon Web Services account and region. -// For more information about aliases, see CreateAlias. -// -// By default, the ListAliases operation returns all aliases in the account -// and region. To get only the aliases associated with a particular KMS key, -// use the KeyId parameter. -// -// The ListAliases response can include aliases that you created and associated -// with your customer managed keys, and aliases that Amazon Web Services created -// and associated with Amazon Web Services managed keys in your account. You -// can recognize Amazon Web Services aliases because their names have the format -// aws/, such as aws/dynamodb. -// -// The response might also include aliases that have no TargetKeyId field. These -// are predefined aliases that Amazon Web Services has created but has not yet -// associated with a KMS key. Aliases that Amazon Web Services creates in your -// account, including predefined aliases, do not count against your KMS aliases -// quota (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html#aliases-limit). -// -// Cross-account use: No. ListAliases does not return aliases in other Amazon -// Web Services accounts. -// -// Required permissions: kms:ListAliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// For details, see Controlling access to aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html#alias-access) -// in the Key Management Service Developer Guide. -// -// Related operations: -// -// - CreateAlias -// -// - DeleteAlias -// -// - UpdateAlias -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ListAliases for usage and error information. -// -// Returned Error Types: -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidMarkerException -// The request was rejected because the marker that specifies where pagination -// should next begin is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListAliases -func (c *KMS) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error) { - req, out := c.ListAliasesRequest(input) - return out, req.Send() -} - -// ListAliasesWithContext is the same as ListAliases with the addition of -// the ability to pass a context and additional request options. -// -// See ListAliases for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListAliasesWithContext(ctx aws.Context, input *ListAliasesInput, opts ...request.Option) (*ListAliasesOutput, error) { - req, out := c.ListAliasesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListAliasesPages iterates over the pages of a ListAliases operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListAliases 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 ListAliases operation. -// pageNum := 0 -// err := client.ListAliasesPages(params, -// func(page *kms.ListAliasesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *KMS) ListAliasesPages(input *ListAliasesInput, fn func(*ListAliasesOutput, bool) bool) error { - return c.ListAliasesPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListAliasesPagesWithContext same as ListAliasesPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListAliasesPagesWithContext(ctx aws.Context, input *ListAliasesInput, fn func(*ListAliasesOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListAliasesInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListAliasesRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListAliasesOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListGrants = "ListGrants" - -// ListGrantsRequest generates a "aws/request.Request" representing the -// client's request for the ListGrants operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListGrants for more information on using the ListGrants -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ListGrantsRequest method. -// req, resp := client.ListGrantsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListGrants -func (c *KMS) ListGrantsRequest(input *ListGrantsInput) (req *request.Request, output *ListGrantsResponse) { - op := &request.Operation{ - Name: opListGrants, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "Limit", - TruncationToken: "Truncated", - }, - } - - if input == nil { - input = &ListGrantsInput{} - } - - output = &ListGrantsResponse{} - req = c.newRequest(op, input, output) - return -} - -// ListGrants API operation for AWS Key Management Service. -// -// Gets a list of all grants for the specified KMS key. -// -// You must specify the KMS key in all requests. You can filter the grant list -// by grant ID or grantee principal. -// -// For detailed information about grants, including grant terminology, see Grants -// in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) -// in the Key Management Service Developer Guide . For examples of working with -// grants in several programming languages, see Programming grants (https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html). -// -// The GranteePrincipal field in the ListGrants response usually contains the -// user or role designated as the grantee principal in the grant. However, when -// the grantee principal in the grant is an Amazon Web Services service, the -// GranteePrincipal field contains the service principal (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services), -// which might represent several different grantee principals. -// -// Cross-account use: Yes. To perform this operation on a KMS key in a different -// Amazon Web Services account, specify the key ARN in the value of the KeyId -// parameter. -// -// Required permissions: kms:ListGrants (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - CreateGrant -// -// - ListRetirableGrants -// -// - RetireGrant -// -// - RevokeGrant -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ListGrants for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidMarkerException -// The request was rejected because the marker that specifies where pagination -// should next begin is not valid. -// -// - InvalidGrantIdException -// The request was rejected because the specified GrantId is not valid. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListGrants -func (c *KMS) ListGrants(input *ListGrantsInput) (*ListGrantsResponse, error) { - req, out := c.ListGrantsRequest(input) - return out, req.Send() -} - -// ListGrantsWithContext is the same as ListGrants with the addition of -// the ability to pass a context and additional request options. -// -// See ListGrants for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListGrantsWithContext(ctx aws.Context, input *ListGrantsInput, opts ...request.Option) (*ListGrantsResponse, error) { - req, out := c.ListGrantsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListGrantsPages iterates over the pages of a ListGrants operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListGrants 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 ListGrants operation. -// pageNum := 0 -// err := client.ListGrantsPages(params, -// func(page *kms.ListGrantsResponse, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *KMS) ListGrantsPages(input *ListGrantsInput, fn func(*ListGrantsResponse, bool) bool) error { - return c.ListGrantsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListGrantsPagesWithContext same as ListGrantsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListGrantsPagesWithContext(ctx aws.Context, input *ListGrantsInput, fn func(*ListGrantsResponse, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListGrantsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListGrantsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListGrantsResponse), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListKeyPolicies = "ListKeyPolicies" - -// ListKeyPoliciesRequest generates a "aws/request.Request" representing the -// client's request for the ListKeyPolicies operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListKeyPolicies for more information on using the ListKeyPolicies -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ListKeyPoliciesRequest method. -// req, resp := client.ListKeyPoliciesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeyPolicies -func (c *KMS) ListKeyPoliciesRequest(input *ListKeyPoliciesInput) (req *request.Request, output *ListKeyPoliciesOutput) { - op := &request.Operation{ - Name: opListKeyPolicies, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "Limit", - TruncationToken: "Truncated", - }, - } - - if input == nil { - input = &ListKeyPoliciesInput{} - } - - output = &ListKeyPoliciesOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListKeyPolicies API operation for AWS Key Management Service. -// -// Gets the names of the key policies that are attached to a KMS key. This operation -// is designed to get policy names that you can use in a GetKeyPolicy operation. -// However, the only valid policy name is default. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:ListKeyPolicies (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - GetKeyPolicy -// -// - PutKeyPolicy -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ListKeyPolicies for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeyPolicies -func (c *KMS) ListKeyPolicies(input *ListKeyPoliciesInput) (*ListKeyPoliciesOutput, error) { - req, out := c.ListKeyPoliciesRequest(input) - return out, req.Send() -} - -// ListKeyPoliciesWithContext is the same as ListKeyPolicies with the addition of -// the ability to pass a context and additional request options. -// -// See ListKeyPolicies for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListKeyPoliciesWithContext(ctx aws.Context, input *ListKeyPoliciesInput, opts ...request.Option) (*ListKeyPoliciesOutput, error) { - req, out := c.ListKeyPoliciesRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListKeyPoliciesPages iterates over the pages of a ListKeyPolicies operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListKeyPolicies 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 ListKeyPolicies operation. -// pageNum := 0 -// err := client.ListKeyPoliciesPages(params, -// func(page *kms.ListKeyPoliciesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *KMS) ListKeyPoliciesPages(input *ListKeyPoliciesInput, fn func(*ListKeyPoliciesOutput, bool) bool) error { - return c.ListKeyPoliciesPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListKeyPoliciesPagesWithContext same as ListKeyPoliciesPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListKeyPoliciesPagesWithContext(ctx aws.Context, input *ListKeyPoliciesInput, fn func(*ListKeyPoliciesOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListKeyPoliciesInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListKeyPoliciesRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListKeyPoliciesOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListKeys = "ListKeys" - -// ListKeysRequest generates a "aws/request.Request" representing the -// client's request for the ListKeys operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListKeys for more information on using the ListKeys -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ListKeysRequest method. -// req, resp := client.ListKeysRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeys -func (c *KMS) ListKeysRequest(input *ListKeysInput) (req *request.Request, output *ListKeysOutput) { - op := &request.Operation{ - Name: opListKeys, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "Limit", - TruncationToken: "Truncated", - }, - } - - if input == nil { - input = &ListKeysInput{} - } - - output = &ListKeysOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListKeys API operation for AWS Key Management Service. -// -// Gets a list of all KMS keys in the caller's Amazon Web Services account and -// Region. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:ListKeys (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// Related operations: -// -// - CreateKey -// -// - DescribeKey -// -// - ListAliases -// -// - ListResourceTags -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ListKeys for usage and error information. -// -// Returned Error Types: -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidMarkerException -// The request was rejected because the marker that specifies where pagination -// should next begin is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeys -func (c *KMS) ListKeys(input *ListKeysInput) (*ListKeysOutput, error) { - req, out := c.ListKeysRequest(input) - return out, req.Send() -} - -// ListKeysWithContext is the same as ListKeys with the addition of -// the ability to pass a context and additional request options. -// -// See ListKeys for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListKeysWithContext(ctx aws.Context, input *ListKeysInput, opts ...request.Option) (*ListKeysOutput, error) { - req, out := c.ListKeysRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListKeysPages iterates over the pages of a ListKeys operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListKeys 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 ListKeys operation. -// pageNum := 0 -// err := client.ListKeysPages(params, -// func(page *kms.ListKeysOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *KMS) ListKeysPages(input *ListKeysInput, fn func(*ListKeysOutput, bool) bool) error { - return c.ListKeysPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListKeysPagesWithContext same as ListKeysPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListKeysPagesWithContext(ctx aws.Context, input *ListKeysInput, fn func(*ListKeysOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListKeysInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListKeysRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListKeysOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListResourceTags = "ListResourceTags" - -// ListResourceTagsRequest generates a "aws/request.Request" representing the -// client's request for the ListResourceTags operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListResourceTags for more information on using the ListResourceTags -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ListResourceTagsRequest method. -// req, resp := client.ListResourceTagsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListResourceTags -func (c *KMS) ListResourceTagsRequest(input *ListResourceTagsInput) (req *request.Request, output *ListResourceTagsOutput) { - op := &request.Operation{ - Name: opListResourceTags, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "Limit", - TruncationToken: "Truncated", - }, - } - - if input == nil { - input = &ListResourceTagsInput{} - } - - output = &ListResourceTagsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListResourceTags API operation for AWS Key Management Service. -// -// Returns all tags on the specified KMS key. -// -// For general information about tags, including the format and syntax, see -// Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) -// in the Amazon Web Services General Reference. For information about using -// tags in KMS, see Tagging keys (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html). -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:ListResourceTags (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: -// -// - CreateKey -// -// - ReplicateKey -// -// - TagResource -// -// - UntagResource -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ListResourceTags for usage and error information. -// -// Returned Error Types: -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidMarkerException -// The request was rejected because the marker that specifies where pagination -// should next begin is not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListResourceTags -func (c *KMS) ListResourceTags(input *ListResourceTagsInput) (*ListResourceTagsOutput, error) { - req, out := c.ListResourceTagsRequest(input) - return out, req.Send() -} - -// ListResourceTagsWithContext is the same as ListResourceTags with the addition of -// the ability to pass a context and additional request options. -// -// See ListResourceTags for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListResourceTagsWithContext(ctx aws.Context, input *ListResourceTagsInput, opts ...request.Option) (*ListResourceTagsOutput, error) { - req, out := c.ListResourceTagsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListResourceTagsPages iterates over the pages of a ListResourceTags operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListResourceTags 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 ListResourceTags operation. -// pageNum := 0 -// err := client.ListResourceTagsPages(params, -// func(page *kms.ListResourceTagsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *KMS) ListResourceTagsPages(input *ListResourceTagsInput, fn func(*ListResourceTagsOutput, bool) bool) error { - return c.ListResourceTagsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListResourceTagsPagesWithContext same as ListResourceTagsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListResourceTagsPagesWithContext(ctx aws.Context, input *ListResourceTagsInput, fn func(*ListResourceTagsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListResourceTagsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListResourceTagsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListResourceTagsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListRetirableGrants = "ListRetirableGrants" - -// ListRetirableGrantsRequest generates a "aws/request.Request" representing the -// client's request for the ListRetirableGrants operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListRetirableGrants for more information on using the ListRetirableGrants -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ListRetirableGrantsRequest method. -// req, resp := client.ListRetirableGrantsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListRetirableGrants -func (c *KMS) ListRetirableGrantsRequest(input *ListRetirableGrantsInput) (req *request.Request, output *ListGrantsResponse) { - op := &request.Operation{ - Name: opListRetirableGrants, - HTTPMethod: "POST", - HTTPPath: "/", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker"}, - LimitToken: "Limit", - TruncationToken: "Truncated", - }, - } - - if input == nil { - input = &ListRetirableGrantsInput{} - } - - output = &ListGrantsResponse{} - req = c.newRequest(op, input, output) - return -} - -// ListRetirableGrants API operation for AWS Key Management Service. -// -// Returns information about all grants in the Amazon Web Services account and -// Region that have the specified retiring principal. -// -// You can specify any principal in your Amazon Web Services account. The grants -// that are returned include grants for KMS keys in your Amazon Web Services -// account and other Amazon Web Services accounts. You might use this operation -// to determine which grants you may retire. To retire a grant, use the RetireGrant -// operation. -// -// For detailed information about grants, including grant terminology, see Grants -// in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) -// in the Key Management Service Developer Guide . For examples of working with -// grants in several programming languages, see Programming grants (https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html). -// -// Cross-account use: You must specify a principal in your Amazon Web Services -// account. However, this operation can return grants in any Amazon Web Services -// account. You do not need kms:ListRetirableGrants permission (or any other -// additional permission) in any Amazon Web Services account other than your -// own. -// -// Required permissions: kms:ListRetirableGrants (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) in your Amazon Web Services account. -// -// Related operations: -// -// - CreateGrant -// -// - ListGrants -// -// - RetireGrant -// -// - RevokeGrant -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ListRetirableGrants for usage and error information. -// -// Returned Error Types: -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidMarkerException -// The request was rejected because the marker that specifies where pagination -// should next begin is not valid. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListRetirableGrants -func (c *KMS) ListRetirableGrants(input *ListRetirableGrantsInput) (*ListGrantsResponse, error) { - req, out := c.ListRetirableGrantsRequest(input) - return out, req.Send() -} - -// ListRetirableGrantsWithContext is the same as ListRetirableGrants with the addition of -// the ability to pass a context and additional request options. -// -// See ListRetirableGrants for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListRetirableGrantsWithContext(ctx aws.Context, input *ListRetirableGrantsInput, opts ...request.Option) (*ListGrantsResponse, error) { - req, out := c.ListRetirableGrantsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListRetirableGrantsPages iterates over the pages of a ListRetirableGrants operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListRetirableGrants 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 ListRetirableGrants operation. -// pageNum := 0 -// err := client.ListRetirableGrantsPages(params, -// func(page *kms.ListGrantsResponse, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -func (c *KMS) ListRetirableGrantsPages(input *ListRetirableGrantsInput, fn func(*ListGrantsResponse, bool) bool) error { - return c.ListRetirableGrantsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListRetirableGrantsPagesWithContext same as ListRetirableGrantsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ListRetirableGrantsPagesWithContext(ctx aws.Context, input *ListRetirableGrantsInput, fn func(*ListGrantsResponse, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListRetirableGrantsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListRetirableGrantsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListGrantsResponse), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opPutKeyPolicy = "PutKeyPolicy" - -// PutKeyPolicyRequest generates a "aws/request.Request" representing the -// client's request for the PutKeyPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutKeyPolicy for more information on using the PutKeyPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the PutKeyPolicyRequest method. -// req, resp := client.PutKeyPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/PutKeyPolicy -func (c *KMS) PutKeyPolicyRequest(input *PutKeyPolicyInput) (req *request.Request, output *PutKeyPolicyOutput) { - op := &request.Operation{ - Name: opPutKeyPolicy, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &PutKeyPolicyInput{} - } - - output = &PutKeyPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutKeyPolicy API operation for AWS Key Management Service. -// -// Attaches a key policy to the specified KMS key. -// -// For more information about key policies, see Key Policies (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) -// in the Key Management Service Developer Guide. For help writing and formatting -// a JSON policy document, see the IAM JSON Policy Reference (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html) -// in the Identity and Access Management User Guide . For examples of adding -// a key policy in multiple programming languages, see Setting a key policy -// (https://docs.aws.amazon.com/kms/latest/developerguide/programming-key-policies.html#put-policy) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:PutKeyPolicy (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: GetKeyPolicy -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation PutKeyPolicy for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - MalformedPolicyDocumentException -// The request was rejected because the specified policy is not syntactically -// or semantically correct. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/PutKeyPolicy -func (c *KMS) PutKeyPolicy(input *PutKeyPolicyInput) (*PutKeyPolicyOutput, error) { - req, out := c.PutKeyPolicyRequest(input) - return out, req.Send() -} - -// PutKeyPolicyWithContext is the same as PutKeyPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See PutKeyPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) PutKeyPolicyWithContext(ctx aws.Context, input *PutKeyPolicyInput, opts ...request.Option) (*PutKeyPolicyOutput, error) { - req, out := c.PutKeyPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opReEncrypt = "ReEncrypt" - -// ReEncryptRequest generates a "aws/request.Request" representing the -// client's request for the ReEncrypt operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ReEncrypt for more information on using the ReEncrypt -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ReEncryptRequest method. -// req, resp := client.ReEncryptRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReEncrypt -func (c *KMS) ReEncryptRequest(input *ReEncryptInput) (req *request.Request, output *ReEncryptOutput) { - op := &request.Operation{ - Name: opReEncrypt, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ReEncryptInput{} - } - - output = &ReEncryptOutput{} - req = c.newRequest(op, input, output) - return -} - -// ReEncrypt API operation for AWS Key Management Service. -// -// Decrypts ciphertext and then reencrypts it entirely within KMS. You can use -// this operation to change the KMS key under which data is encrypted, such -// as when you manually rotate (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-manually) -// a KMS key or change the KMS key that protects a ciphertext. You can also -// use it to reencrypt ciphertext under the same KMS key, such as to change -// the encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) -// of a ciphertext. -// -// The ReEncrypt operation can decrypt ciphertext that was encrypted by using -// a KMS key in an KMS operation, such as Encrypt or GenerateDataKey. It can -// also decrypt ciphertext that was encrypted by using the public key of an -// asymmetric KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-concepts.html#asymmetric-cmks) -// outside of KMS. However, it cannot decrypt ciphertext produced by other libraries, -// such as the Amazon Web Services Encryption SDK (https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/) -// or Amazon S3 client-side encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html). -// These libraries return a ciphertext format that is incompatible with KMS. -// -// When you use the ReEncrypt operation, you need to provide information for -// the decrypt operation and the subsequent encrypt operation. -// -// - If your ciphertext was encrypted under an asymmetric KMS key, you must -// use the SourceKeyId parameter to identify the KMS key that encrypted the -// ciphertext. You must also supply the encryption algorithm that was used. -// This information is required to decrypt the data. -// -// - If your ciphertext was encrypted under a symmetric encryption KMS key, -// the SourceKeyId parameter is optional. KMS can get this information from -// metadata that it adds to the symmetric ciphertext blob. This feature adds -// durability to your implementation by ensuring that authorized users can -// decrypt ciphertext decades after it was encrypted, even if they've lost -// track of the key ID. However, specifying the source KMS key is always -// recommended as a best practice. When you use the SourceKeyId parameter -// to specify a KMS key, KMS uses only the KMS key you specify. If the ciphertext -// was encrypted under a different KMS key, the ReEncrypt operation fails. -// This practice ensures that you use the KMS key that you intend. -// -// - To reencrypt the data, you must use the DestinationKeyId parameter specify -// the KMS key that re-encrypts the data after it is decrypted. If the destination -// KMS key is an asymmetric KMS key, you must also provide the encryption -// algorithm. The algorithm that you choose must be compatible with the KMS -// key. When you use an asymmetric KMS key to encrypt or reencrypt data, -// be sure to record the KMS key and encryption algorithm that you choose. -// You will be required to provide the same KMS key and encryption algorithm -// when you decrypt the data. If the KMS key and algorithm do not match the -// values used to encrypt the data, the decrypt operation fails. You are -// not required to supply the key ID and encryption algorithm when you decrypt -// with symmetric encryption KMS keys because KMS stores this information -// in the ciphertext blob. KMS cannot store metadata in ciphertext generated -// with asymmetric keys. The standard format for asymmetric key ciphertext -// does not include configurable fields. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. The source KMS key and destination KMS key can be -// in different Amazon Web Services accounts. Either or both KMS keys can be -// in a different account than the caller. To specify a KMS key in a different -// account, you must use its key ARN or alias ARN. -// -// Required permissions: -// -// - kms:ReEncryptFrom (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// permission on the source KMS key (key policy) -// -// - kms:ReEncryptTo (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// permission on the destination KMS key (key policy) -// -// To permit reencryption from or to a KMS key, include the "kms:ReEncrypt*" -// permission in your key policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html). -// This permission is automatically included in the key policy when you use -// the console to create a KMS key. But you must include it manually when you -// create a KMS key programmatically or when you use the PutKeyPolicy operation -// to set a key policy. -// -// Related operations: -// -// - Decrypt -// -// - Encrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyPair -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ReEncrypt for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - InvalidCiphertextException -// From the Decrypt or ReEncrypt operation, the request was rejected because -// the specified ciphertext, or additional authenticated data incorporated into -// the ciphertext, such as the encryption context, is corrupted, missing, or -// otherwise invalid. -// -// From the ImportKeyMaterial operation, the request was rejected because KMS -// could not decrypt the encrypted (wrapped) key material. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - IncorrectKeyException -// The request was rejected because the specified KMS key cannot decrypt the -// data. The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request -// must identify the same KMS key that was used to encrypt the ciphertext. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReEncrypt -func (c *KMS) ReEncrypt(input *ReEncryptInput) (*ReEncryptOutput, error) { - req, out := c.ReEncryptRequest(input) - return out, req.Send() -} - -// ReEncryptWithContext is the same as ReEncrypt with the addition of -// the ability to pass a context and additional request options. -// -// See ReEncrypt for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ReEncryptWithContext(ctx aws.Context, input *ReEncryptInput, opts ...request.Option) (*ReEncryptOutput, error) { - req, out := c.ReEncryptRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opReplicateKey = "ReplicateKey" - -// ReplicateKeyRequest generates a "aws/request.Request" representing the -// client's request for the ReplicateKey operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ReplicateKey for more information on using the ReplicateKey -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ReplicateKeyRequest method. -// req, resp := client.ReplicateKeyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReplicateKey -func (c *KMS) ReplicateKeyRequest(input *ReplicateKeyInput) (req *request.Request, output *ReplicateKeyOutput) { - op := &request.Operation{ - Name: opReplicateKey, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ReplicateKeyInput{} - } - - output = &ReplicateKeyOutput{} - req = c.newRequest(op, input, output) - return -} - -// ReplicateKey API operation for AWS Key Management Service. -// -// Replicates a multi-Region key into the specified Region. This operation creates -// a multi-Region replica key based on a multi-Region primary key in a different -// Region of the same Amazon Web Services partition. You can create multiple -// replicas of a primary key, but each must be in a different Region. To create -// a multi-Region primary key, use the CreateKey operation. -// -// This operation supports multi-Region keys, an KMS feature that lets you create -// multiple interoperable KMS keys in different Amazon Web Services Regions. -// Because these KMS keys have the same key ID, key material, and other metadata, -// you can use them interchangeably to encrypt data in one Amazon Web Services -// Region and decrypt it in a different Amazon Web Services Region without re-encrypting -// the data or making a cross-Region call. For more information about multi-Region -// keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) -// in the Key Management Service Developer Guide. -// -// A replica key is a fully-functional KMS key that can be used independently -// of its primary and peer replica keys. A primary key and its replica keys -// share properties that make them interoperable. They have the same key ID -// (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-id) -// and key material. They also have the same key spec (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-spec), -// key usage (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-usage), -// key material origin (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-origin), -// and automatic key rotation status (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html). -// KMS automatically synchronizes these shared properties among related multi-Region -// keys. All other properties of a replica key can differ, including its key -// policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html), -// tags (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html), -// aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html), -// and Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html). -// KMS pricing and quotas for KMS keys apply to each primary key and replica -// key. -// -// When this operation completes, the new replica key has a transient key state -// of Creating. This key state changes to Enabled (or PendingImport) after a -// few seconds when the process of creating the new replica key is complete. -// While the key state is Creating, you can manage key, but you cannot yet use -// it in cryptographic operations. If you are creating and using the replica -// key programmatically, retry on KMSInvalidStateException or call DescribeKey -// to check its KeyState value before using it. For details about the Creating -// key state, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// You cannot create more than one replica of a primary key in any Region. If -// the Region already includes a replica of the key you're trying to replicate, -// ReplicateKey returns an AlreadyExistsException error. If the key state of -// the existing replica is PendingDeletion, you can cancel the scheduled key -// deletion (CancelKeyDeletion) or wait for the key to be deleted. The new replica -// key you create will have the same shared properties (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html#mrk-sync-properties) -// as the original replica key. -// -// The CloudTrail log of a ReplicateKey operation records a ReplicateKey operation -// in the primary key's Region and a CreateKey operation in the replica key's -// Region. -// -// If you replicate a multi-Region primary key with imported key material, the -// replica key is created with no key material. You must import the same key -// material that you imported into the primary key. For details, see Importing -// key material into multi-Region keys (kms/latest/developerguide/multi-region-keys-import.html) -// in the Key Management Service Developer Guide. -// -// To convert a replica key to a primary key, use the UpdatePrimaryRegion operation. -// -// ReplicateKey uses different default values for the KeyPolicy and Tags parameters -// than those used in the KMS console. For details, see the parameter descriptions. -// -// Cross-account use: No. You cannot use this operation to create a replica -// key in a different Amazon Web Services account. -// -// Required permissions: -// -// - kms:ReplicateKey on the primary key (in the primary key's Region). Include -// this permission in the primary key's key policy. -// -// - kms:CreateKey in an IAM policy in the replica Region. -// -// - To use the Tags parameter, kms:TagResource in an IAM policy in the replica -// Region. -// -// Related operations -// -// - CreateKey -// -// - UpdatePrimaryRegion -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ReplicateKey for usage and error information. -// -// Returned Error Types: -// -// - AlreadyExistsException -// The request was rejected because it attempted to create a resource that already -// exists. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - MalformedPolicyDocumentException -// The request was rejected because the specified policy is not syntactically -// or semantically correct. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - TagException -// The request was rejected because one or more tags are not valid. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReplicateKey -func (c *KMS) ReplicateKey(input *ReplicateKeyInput) (*ReplicateKeyOutput, error) { - req, out := c.ReplicateKeyRequest(input) - return out, req.Send() -} - -// ReplicateKeyWithContext is the same as ReplicateKey with the addition of -// the ability to pass a context and additional request options. -// -// See ReplicateKey for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ReplicateKeyWithContext(ctx aws.Context, input *ReplicateKeyInput, opts ...request.Option) (*ReplicateKeyOutput, error) { - req, out := c.ReplicateKeyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRetireGrant = "RetireGrant" - -// RetireGrantRequest generates a "aws/request.Request" representing the -// client's request for the RetireGrant operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RetireGrant for more information on using the RetireGrant -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RetireGrantRequest method. -// req, resp := client.RetireGrantRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RetireGrant -func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *request.Request, output *RetireGrantOutput) { - op := &request.Operation{ - Name: opRetireGrant, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RetireGrantInput{} - } - - output = &RetireGrantOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// RetireGrant API operation for AWS Key Management Service. -// -// Deletes a grant. Typically, you retire a grant when you no longer need its -// permissions. To identify the grant to retire, use a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token), -// or both the grant ID and a key identifier (key ID or key ARN) of the KMS -// key. The CreateGrant operation returns both values. -// -// This operation can be called by the retiring principal for a grant, by the -// grantee principal if the grant allows the RetireGrant operation, and by the -// Amazon Web Services account in which the grant is created. It can also be -// called by principals to whom permission for retiring a grant is delegated. -// For details, see Retiring and revoking grants (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete) -// in the Key Management Service Developer Guide. -// -// For detailed information about grants, including grant terminology, see Grants -// in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) -// in the Key Management Service Developer Guide . For examples of working with -// grants in several programming languages, see Programming grants (https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html). -// -// Cross-account use: Yes. You can retire a grant on a KMS key in a different -// Amazon Web Services account. -// -// Required permissions::Permission to retire a grant is determined primarily -// by the grant. For details, see Retiring and revoking grants (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete) -// in the Key Management Service Developer Guide. -// -// Related operations: -// -// - CreateGrant -// -// - ListGrants -// -// - ListRetirableGrants -// -// - RevokeGrant -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation RetireGrant for usage and error information. -// -// Returned Error Types: -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InvalidGrantIdException -// The request was rejected because the specified GrantId is not valid. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RetireGrant -func (c *KMS) RetireGrant(input *RetireGrantInput) (*RetireGrantOutput, error) { - req, out := c.RetireGrantRequest(input) - return out, req.Send() -} - -// RetireGrantWithContext is the same as RetireGrant with the addition of -// the ability to pass a context and additional request options. -// -// See RetireGrant for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) RetireGrantWithContext(ctx aws.Context, input *RetireGrantInput, opts ...request.Option) (*RetireGrantOutput, error) { - req, out := c.RetireGrantRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRevokeGrant = "RevokeGrant" - -// RevokeGrantRequest generates a "aws/request.Request" representing the -// client's request for the RevokeGrant operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RevokeGrant for more information on using the RevokeGrant -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the RevokeGrantRequest method. -// req, resp := client.RevokeGrantRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RevokeGrant -func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *request.Request, output *RevokeGrantOutput) { - op := &request.Operation{ - Name: opRevokeGrant, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &RevokeGrantInput{} - } - - output = &RevokeGrantOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// RevokeGrant API operation for AWS Key Management Service. -// -// Deletes the specified grant. You revoke a grant to terminate the permissions -// that the grant allows. For more information, see Retiring and revoking grants -// (https://docs.aws.amazon.com/kms/latest/developerguide/managing-grants.html#grant-delete) -// in the Key Management Service Developer Guide . -// -// When you create, retire, or revoke a grant, there might be a brief delay, -// usually less than five minutes, until the grant is available throughout KMS. -// This state is known as eventual consistency. For details, see Eventual consistency -// (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-eventual-consistency) -// in the Key Management Service Developer Guide . -// -// For detailed information about grants, including grant terminology, see Grants -// in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) -// in the Key Management Service Developer Guide . For examples of working with -// grants in several programming languages, see Programming grants (https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html). -// -// Cross-account use: Yes. To perform this operation on a KMS key in a different -// Amazon Web Services account, specify the key ARN in the value of the KeyId -// parameter. -// -// Required permissions: kms:RevokeGrant (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy). -// -// Related operations: -// -// - CreateGrant -// -// - ListGrants -// -// - ListRetirableGrants -// -// - RetireGrant -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation RevokeGrant for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidGrantIdException -// The request was rejected because the specified GrantId is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RevokeGrant -func (c *KMS) RevokeGrant(input *RevokeGrantInput) (*RevokeGrantOutput, error) { - req, out := c.RevokeGrantRequest(input) - return out, req.Send() -} - -// RevokeGrantWithContext is the same as RevokeGrant with the addition of -// the ability to pass a context and additional request options. -// -// See RevokeGrant for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) RevokeGrantWithContext(ctx aws.Context, input *RevokeGrantInput, opts ...request.Option) (*RevokeGrantOutput, error) { - req, out := c.RevokeGrantRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opScheduleKeyDeletion = "ScheduleKeyDeletion" - -// ScheduleKeyDeletionRequest generates a "aws/request.Request" representing the -// client's request for the ScheduleKeyDeletion operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ScheduleKeyDeletion for more information on using the ScheduleKeyDeletion -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the ScheduleKeyDeletionRequest method. -// req, resp := client.ScheduleKeyDeletionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ScheduleKeyDeletion -func (c *KMS) ScheduleKeyDeletionRequest(input *ScheduleKeyDeletionInput) (req *request.Request, output *ScheduleKeyDeletionOutput) { - op := &request.Operation{ - Name: opScheduleKeyDeletion, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ScheduleKeyDeletionInput{} - } - - output = &ScheduleKeyDeletionOutput{} - req = c.newRequest(op, input, output) - return -} - -// ScheduleKeyDeletion API operation for AWS Key Management Service. -// -// Schedules the deletion of a KMS key. By default, KMS applies a waiting period -// of 30 days, but you can specify a waiting period of 7-30 days. When this -// operation is successful, the key state of the KMS key changes to PendingDeletion -// and the key can't be used in any cryptographic operations. It remains in -// this state for the duration of the waiting period. Before the waiting period -// ends, you can use CancelKeyDeletion to cancel the deletion of the KMS key. -// After the waiting period ends, KMS deletes the KMS key, its key material, -// and all KMS data associated with it, including all aliases that refer to -// it. -// -// Deleting a KMS key is a destructive and potentially dangerous operation. -// When a KMS key is deleted, all data that was encrypted under the KMS key -// is unrecoverable. (The only exception is a multi-Region replica key.) To -// prevent the use of a KMS key without deleting it, use DisableKey. -// -// If you schedule deletion of a KMS key from a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html), -// when the waiting period expires, ScheduleKeyDeletion deletes the KMS key -// from KMS. Then KMS makes a best effort to delete the key material from the -// associated CloudHSM cluster. However, you might need to manually delete the -// orphaned key material (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-orphaned-key) -// from the cluster and its backups. -// -// You can schedule the deletion of a multi-Region primary key and its replica -// keys at any time. However, KMS will not delete a multi-Region primary key -// with existing replica keys. If you schedule the deletion of a primary key -// with replicas, its key state changes to PendingReplicaDeletion and it cannot -// be replicated or used in cryptographic operations. This status can continue -// indefinitely. When the last of its replicas keys is deleted (not just scheduled), -// the key state of the primary key changes to PendingDeletion and its waiting -// period (PendingWindowInDays) begins. For details, see Deleting multi-Region -// keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-delete.html) -// in the Key Management Service Developer Guide. -// -// For more information about scheduling a KMS key for deletion, see Deleting -// KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:ScheduleKeyDeletion (key policy) -// -// Related operations -// -// - CancelKeyDeletion -// -// - DisableKey -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation ScheduleKeyDeletion for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ScheduleKeyDeletion -func (c *KMS) ScheduleKeyDeletion(input *ScheduleKeyDeletionInput) (*ScheduleKeyDeletionOutput, error) { - req, out := c.ScheduleKeyDeletionRequest(input) - return out, req.Send() -} - -// ScheduleKeyDeletionWithContext is the same as ScheduleKeyDeletion with the addition of -// the ability to pass a context and additional request options. -// -// See ScheduleKeyDeletion for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) ScheduleKeyDeletionWithContext(ctx aws.Context, input *ScheduleKeyDeletionInput, opts ...request.Option) (*ScheduleKeyDeletionOutput, error) { - req, out := c.ScheduleKeyDeletionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSign = "Sign" - -// SignRequest generates a "aws/request.Request" representing the -// client's request for the Sign operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See Sign for more information on using the Sign -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the SignRequest method. -// req, resp := client.SignRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Sign -func (c *KMS) SignRequest(input *SignInput) (req *request.Request, output *SignOutput) { - op := &request.Operation{ - Name: opSign, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &SignInput{} - } - - output = &SignOutput{} - req = c.newRequest(op, input, output) - return -} - -// Sign API operation for AWS Key Management Service. -// -// Creates a digital signature (https://en.wikipedia.org/wiki/Digital_signature) -// for a message or message digest by using the private key in an asymmetric -// signing KMS key. To verify the signature, use the Verify operation, or use -// the public key in the same asymmetric KMS key outside of KMS. For information -// about asymmetric KMS keys, see Asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) -// in the Key Management Service Developer Guide. -// -// Digital signatures are generated and verified by using asymmetric key pair, -// such as an RSA or ECC pair that is represented by an asymmetric KMS key. -// The key owner (or an authorized user) uses their private key to sign a message. -// Anyone with the public key can verify that the message was signed with that -// particular private key and that the message hasn't changed since it was signed. -// -// To use the Sign operation, provide the following information: -// -// - Use the KeyId parameter to identify an asymmetric KMS key with a KeyUsage -// value of SIGN_VERIFY. To get the KeyUsage value of a KMS key, use the -// DescribeKey operation. The caller must have kms:Sign permission on the -// KMS key. -// -// - Use the Message parameter to specify the message or message digest to -// sign. You can submit messages of up to 4096 bytes. To sign a larger message, -// generate a hash digest of the message, and then provide the hash digest -// in the Message parameter. To indicate whether the message is a full message -// or a digest, use the MessageType parameter. -// -// - Choose a signing algorithm that is compatible with the KMS key. -// -// When signing a message, be sure to record the KMS key and the signing algorithm. -// This information is required to verify the signature. -// -// Best practices recommend that you limit the time during which any signature -// is effective. This deters an attack where the actor uses a signed message -// to establish validity repeatedly or long after the message is superseded. -// Signatures do not include a timestamp, but you can include a timestamp in -// the signed message to help you detect when its time to refresh the signature. -// -// To verify the signature that this operation generates, use the Verify operation. -// Or use the GetPublicKey operation to download the public key and then use -// the public key to verify the signature outside of KMS. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:Sign (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: Verify -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation Sign for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Sign -func (c *KMS) Sign(input *SignInput) (*SignOutput, error) { - req, out := c.SignRequest(input) - return out, req.Send() -} - -// SignWithContext is the same as Sign with the addition of -// the ability to pass a context and additional request options. -// -// See Sign for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) SignWithContext(ctx aws.Context, input *SignInput, opts ...request.Option) (*SignOutput, error) { - req, out := c.SignRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opTagResource = "TagResource" - -// TagResourceRequest generates a "aws/request.Request" representing the -// client's request for the TagResource operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See TagResource for more information on using the TagResource -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the TagResourceRequest method. -// req, resp := client.TagResourceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/TagResource -func (c *KMS) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { - op := &request.Operation{ - Name: opTagResource, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &TagResourceInput{} - } - - output = &TagResourceOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// TagResource API operation for AWS Key Management Service. -// -// Adds or edits tags on a customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk). -// -// Tagging or untagging a KMS key can allow or deny permission to the KMS key. -// For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) -// in the Key Management Service Developer Guide. -// -// Each tag consists of a tag key and a tag value, both of which are case-sensitive -// strings. The tag value can be an empty (null) string. To add a tag, specify -// a new tag key and a tag value. To edit a tag, specify an existing tag key -// and a new tag value. -// -// You can use this operation to tag a customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk), -// but you cannot tag an Amazon Web Services managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk), -// an Amazon Web Services owned key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk), -// a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#keystore-concept), -// or an alias (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#alias-concept). -// -// You can also add tags to a KMS key while creating it (CreateKey) or replicating -// it (ReplicateKey). -// -// For information about using tags in KMS, see Tagging keys (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html). -// For general information about tags, including the format and syntax, see -// Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) -// in the Amazon Web Services General Reference. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:TagResource (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations -// -// - CreateKey -// -// - ListResourceTags -// -// - ReplicateKey -// -// - UntagResource -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation TagResource for usage and error information. -// -// Returned Error Types: -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - TagException -// The request was rejected because one or more tags are not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/TagResource -func (c *KMS) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { - req, out := c.TagResourceRequest(input) - return out, req.Send() -} - -// TagResourceWithContext is the same as TagResource with the addition of -// the ability to pass a context and additional request options. -// -// See TagResource for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { - req, out := c.TagResourceRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUntagResource = "UntagResource" - -// UntagResourceRequest generates a "aws/request.Request" representing the -// client's request for the UntagResource operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UntagResource for more information on using the UntagResource -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the UntagResourceRequest method. -// req, resp := client.UntagResourceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UntagResource -func (c *KMS) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { - op := &request.Operation{ - Name: opUntagResource, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &UntagResourceInput{} - } - - output = &UntagResourceOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// UntagResource API operation for AWS Key Management Service. -// -// Deletes tags from a customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk). -// To delete a tag, specify the tag key and the KMS key. -// -// Tagging or untagging a KMS key can allow or deny permission to the KMS key. -// For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) -// in the Key Management Service Developer Guide. -// -// When it succeeds, the UntagResource operation doesn't return any output. -// Also, if the specified tag key isn't found on the KMS key, it doesn't throw -// an exception or return a response. To confirm that the operation worked, -// use the ListResourceTags operation. -// -// For information about using tags in KMS, see Tagging keys (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html). -// For general information about tags, including the format and syntax, see -// Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) -// in the Amazon Web Services General Reference. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:UntagResource (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations -// -// - CreateKey -// -// - ListResourceTags -// -// - ReplicateKey -// -// - TagResource -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation UntagResource for usage and error information. -// -// Returned Error Types: -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - TagException -// The request was rejected because one or more tags are not valid. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UntagResource -func (c *KMS) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { - req, out := c.UntagResourceRequest(input) - return out, req.Send() -} - -// UntagResourceWithContext is the same as UntagResource with the addition of -// the ability to pass a context and additional request options. -// -// See UntagResource for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { - req, out := c.UntagResourceRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdateAlias = "UpdateAlias" - -// UpdateAliasRequest generates a "aws/request.Request" representing the -// client's request for the UpdateAlias operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdateAlias for more information on using the UpdateAlias -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the UpdateAliasRequest method. -// req, resp := client.UpdateAliasRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateAlias -func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Request, output *UpdateAliasOutput) { - op := &request.Operation{ - Name: opUpdateAlias, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &UpdateAliasInput{} - } - - output = &UpdateAliasOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// UpdateAlias API operation for AWS Key Management Service. -// -// Associates an existing KMS alias with a different KMS key. Each alias is -// associated with only one KMS key at a time, although a KMS key can have multiple -// aliases. The alias and the KMS key must be in the same Amazon Web Services -// account and Region. -// -// Adding, deleting, or updating an alias can allow or deny permission to the -// KMS key. For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) -// in the Key Management Service Developer Guide. -// -// The current and new KMS key must be the same type (both symmetric or both -// asymmetric), and they must have the same key usage (ENCRYPT_DECRYPT or SIGN_VERIFY). -// This restriction prevents errors in code that uses aliases. If you must assign -// an alias to a different type of KMS key, use DeleteAlias to delete the old -// alias and CreateAlias to create a new alias. -// -// You cannot use UpdateAlias to change an alias name. To change an alias name, -// use DeleteAlias to delete the old alias and CreateAlias to create a new alias. -// -// Because an alias is not a property of a KMS key, you can create, update, -// and delete the aliases of a KMS key without affecting the KMS key. Also, -// aliases do not appear in the response from the DescribeKey operation. To -// get the aliases of all KMS keys in the account, use the ListAliases operation. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions -// -// - kms:UpdateAlias (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// on the alias (IAM policy). -// -// - kms:UpdateAlias (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// on the current KMS key (key policy). -// -// - kms:UpdateAlias (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// on the new KMS key (key policy). -// -// For details, see Controlling access to aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html#alias-access) -// in the Key Management Service Developer Guide. -// -// Related operations: -// -// - CreateAlias -// -// - DeleteAlias -// -// - ListAliases -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation UpdateAlias for usage and error information. -// -// Returned Error Types: -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - LimitExceededException -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateAlias -func (c *KMS) UpdateAlias(input *UpdateAliasInput) (*UpdateAliasOutput, error) { - req, out := c.UpdateAliasRequest(input) - return out, req.Send() -} - -// UpdateAliasWithContext is the same as UpdateAlias with the addition of -// the ability to pass a context and additional request options. -// -// See UpdateAlias for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) UpdateAliasWithContext(ctx aws.Context, input *UpdateAliasInput, opts ...request.Option) (*UpdateAliasOutput, error) { - req, out := c.UpdateAliasRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdateCustomKeyStore = "UpdateCustomKeyStore" - -// UpdateCustomKeyStoreRequest generates a "aws/request.Request" representing the -// client's request for the UpdateCustomKeyStore operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdateCustomKeyStore for more information on using the UpdateCustomKeyStore -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the UpdateCustomKeyStoreRequest method. -// req, resp := client.UpdateCustomKeyStoreRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateCustomKeyStore -func (c *KMS) UpdateCustomKeyStoreRequest(input *UpdateCustomKeyStoreInput) (req *request.Request, output *UpdateCustomKeyStoreOutput) { - op := &request.Operation{ - Name: opUpdateCustomKeyStore, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &UpdateCustomKeyStoreInput{} - } - - output = &UpdateCustomKeyStoreOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// UpdateCustomKeyStore API operation for AWS Key Management Service. -// -// Changes the properties of a custom key store. Use the CustomKeyStoreId parameter -// to identify the custom key store you want to edit. Use the remaining parameters -// to change the properties of the custom key store. -// -// You can only update a custom key store that is disconnected. To disconnect -// the custom key store, use DisconnectCustomKeyStore. To reconnect the custom -// key store after the update completes, use ConnectCustomKeyStore. To find -// the connection state of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// The CustomKeyStoreId parameter is required in all commands. Use the other -// parameters of UpdateCustomKeyStore to edit your key store settings. -// -// - Use the NewCustomKeyStoreName parameter to change the friendly name -// of the custom key store to the value that you specify. -// -// - Use the KeyStorePassword parameter tell KMS the current password of -// the kmsuser crypto user (CU) (https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser) -// in the associated CloudHSM cluster. You can use this parameter to fix -// connection failures (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-password) -// that occur when KMS cannot log into the associated cluster because the -// kmsuser password has changed. This value does not change the password -// in the CloudHSM cluster. -// -// - Use the CloudHsmClusterId parameter to associate the custom key store -// with a different, but related, CloudHSM cluster. You can use this parameter -// to repair a custom key store if its CloudHSM cluster becomes corrupted -// or is deleted, or when you need to create or restore a cluster from a -// backup. -// -// If the operation succeeds, it returns a JSON object with no properties. -// -// This operation is part of the custom key store feature (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) -// feature in KMS, which combines the convenience and extensive integration -// of KMS with the isolation and control of a single-tenant key store. -// -// Cross-account use: No. You cannot perform this operation on a custom key -// store in a different Amazon Web Services account. -// -// Required permissions: kms:UpdateCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (IAM policy) -// -// Related operations: -// -// - ConnectCustomKeyStore -// -// - CreateCustomKeyStore -// -// - DeleteCustomKeyStore -// -// - DescribeCustomKeyStores -// -// - DisconnectCustomKeyStore -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation UpdateCustomKeyStore for usage and error information. -// -// Returned Error Types: -// -// - CustomKeyStoreNotFoundException -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -// -// - CustomKeyStoreNameInUseException -// The request was rejected because the specified custom key store name is already -// assigned to another custom key store in the account. Try again with a custom -// key store name that is unique in the account. -// -// - CloudHsmClusterNotFoundException -// The request was rejected because KMS cannot find the CloudHSM cluster with -// the specified cluster ID. Retry the request with a different cluster ID. -// -// - CloudHsmClusterNotRelatedException -// The request was rejected because the specified CloudHSM cluster has a different -// cluster certificate than the original cluster. You cannot use the operation -// to specify an unrelated cluster. -// -// Specify a cluster that shares a backup history with the original cluster. -// This includes clusters that were created from a backup of the current cluster, -// and clusters that were created from the same backup that produced the current -// cluster. -// -// Clusters that share a backup history have the same cluster certificate. To -// view the cluster certificate of a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) -// operation. -// -// - CustomKeyStoreInvalidStateException -// The request was rejected because of the ConnectionState of the custom key -// store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// This exception is thrown under the following conditions: -// -// - You requested the CreateKey or GenerateRandom operation in a custom -// key store that is not connected. These operations are valid only when -// the custom key store ConnectionState is CONNECTED. -// -// - You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation -// on a custom key store that is not disconnected. This operation is valid -// only when the custom key store ConnectionState is DISCONNECTED. -// -// - You requested the ConnectCustomKeyStore operation on a custom key store -// with a ConnectionState of DISCONNECTING or FAILED. This operation is valid -// for all other ConnectionState values. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - CloudHsmClusterNotActiveException -// The request was rejected because the CloudHSM cluster that is associated -// with the custom key store is not active. Initialize and activate the cluster -// and try the command again. For detailed instructions, see Getting Started -// (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) -// in the CloudHSM User Guide. -// -// - CloudHsmClusterInvalidConfigurationException -// The request was rejected because the associated CloudHSM cluster did not -// meet the configuration requirements for a custom key store. -// -// - The cluster must be configured with private subnets in at least two -// different Availability Zones in the Region. -// -// - The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// (cloudhsm-cluster--sg) must include inbound rules and outbound -// rules that allow TCP traffic on ports 2223-2225. The Source in the inbound -// rules and the Destination in the outbound rules must match the security -// group ID. These rules are set by default when you create the cluster. -// Do not delete or change them. To get information about a particular security -// group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) -// operation. -// -// - The cluster must contain at least as many HSMs as the operation requires. -// To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) -// operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey -// operations, the CloudHSM cluster must have at least two active HSMs, each -// in a different Availability Zone. For the ConnectCustomKeyStore operation, -// the CloudHSM must contain at least one active HSM. -// -// For information about the requirements for an CloudHSM cluster that is associated -// with a custom key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) -// in the Key Management Service Developer Guide. For information about creating -// a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) -// in the CloudHSM User Guide. For information about cluster security groups, -// see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// in the CloudHSM User Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateCustomKeyStore -func (c *KMS) UpdateCustomKeyStore(input *UpdateCustomKeyStoreInput) (*UpdateCustomKeyStoreOutput, error) { - req, out := c.UpdateCustomKeyStoreRequest(input) - return out, req.Send() -} - -// UpdateCustomKeyStoreWithContext is the same as UpdateCustomKeyStore with the addition of -// the ability to pass a context and additional request options. -// -// See UpdateCustomKeyStore for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) UpdateCustomKeyStoreWithContext(ctx aws.Context, input *UpdateCustomKeyStoreInput, opts ...request.Option) (*UpdateCustomKeyStoreOutput, error) { - req, out := c.UpdateCustomKeyStoreRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdateKeyDescription = "UpdateKeyDescription" - -// UpdateKeyDescriptionRequest generates a "aws/request.Request" representing the -// client's request for the UpdateKeyDescription operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdateKeyDescription for more information on using the UpdateKeyDescription -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the UpdateKeyDescriptionRequest method. -// req, resp := client.UpdateKeyDescriptionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateKeyDescription -func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req *request.Request, output *UpdateKeyDescriptionOutput) { - op := &request.Operation{ - Name: opUpdateKeyDescription, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &UpdateKeyDescriptionInput{} - } - - output = &UpdateKeyDescriptionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// UpdateKeyDescription API operation for AWS Key Management Service. -// -// Updates the description of a KMS key. To see the description of a KMS key, -// use DescribeKey. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: No. You cannot perform this operation on a KMS key in -// a different Amazon Web Services account. -// -// Required permissions: kms:UpdateKeyDescription (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations -// -// - CreateKey -// -// - DescribeKey -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation UpdateKeyDescription for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateKeyDescription -func (c *KMS) UpdateKeyDescription(input *UpdateKeyDescriptionInput) (*UpdateKeyDescriptionOutput, error) { - req, out := c.UpdateKeyDescriptionRequest(input) - return out, req.Send() -} - -// UpdateKeyDescriptionWithContext is the same as UpdateKeyDescription with the addition of -// the ability to pass a context and additional request options. -// -// See UpdateKeyDescription for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) UpdateKeyDescriptionWithContext(ctx aws.Context, input *UpdateKeyDescriptionInput, opts ...request.Option) (*UpdateKeyDescriptionOutput, error) { - req, out := c.UpdateKeyDescriptionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUpdatePrimaryRegion = "UpdatePrimaryRegion" - -// UpdatePrimaryRegionRequest generates a "aws/request.Request" representing the -// client's request for the UpdatePrimaryRegion operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UpdatePrimaryRegion for more information on using the UpdatePrimaryRegion -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the UpdatePrimaryRegionRequest method. -// req, resp := client.UpdatePrimaryRegionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdatePrimaryRegion -func (c *KMS) UpdatePrimaryRegionRequest(input *UpdatePrimaryRegionInput) (req *request.Request, output *UpdatePrimaryRegionOutput) { - op := &request.Operation{ - Name: opUpdatePrimaryRegion, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &UpdatePrimaryRegionInput{} - } - - output = &UpdatePrimaryRegionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// UpdatePrimaryRegion API operation for AWS Key Management Service. -// -// Changes the primary key of a multi-Region key. -// -// This operation changes the replica key in the specified Region to a primary -// key and changes the former primary key to a replica key. For example, suppose -// you have a primary key in us-east-1 and a replica key in eu-west-2. If you -// run UpdatePrimaryRegion with a PrimaryRegion value of eu-west-2, the primary -// key is now the key in eu-west-2, and the key in us-east-1 becomes a replica -// key. For details, see Updating the primary Region (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-update) -// in the Key Management Service Developer Guide. -// -// This operation supports multi-Region keys, an KMS feature that lets you create -// multiple interoperable KMS keys in different Amazon Web Services Regions. -// Because these KMS keys have the same key ID, key material, and other metadata, -// you can use them interchangeably to encrypt data in one Amazon Web Services -// Region and decrypt it in a different Amazon Web Services Region without re-encrypting -// the data or making a cross-Region call. For more information about multi-Region -// keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) -// in the Key Management Service Developer Guide. -// -// The primary key of a multi-Region key is the source for properties that are -// always shared by primary and replica keys, including the key material, key -// ID (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-id), -// key spec (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-spec), -// key usage (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-usage), -// key material origin (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-origin), -// and automatic key rotation (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html). -// It's the only key that can be replicated. You cannot delete the primary key -// (https://docs.aws.amazon.com/kms/latest/APIReference/API_ScheduleKeyDeletion.html) -// until all replica keys are deleted. -// -// The key ID and primary Region that you specify uniquely identify the replica -// key that will become the primary key. The primary Region must already have -// a replica key. This operation does not create a KMS key in the specified -// Region. To find the replica keys, use the DescribeKey operation on the primary -// key or any replica key. To create a replica key, use the ReplicateKey operation. -// -// You can run this operation while using the affected multi-Region keys in -// cryptographic operations. This operation should not delay, interrupt, or -// cause failures in cryptographic operations. -// -// Even after this operation completes, the process of updating the primary -// Region might still be in progress for a few more seconds. Operations such -// as DescribeKey might display both the old and new primary keys as replicas. -// The old and new primary keys have a transient key state of Updating. The -// original key state is restored when the update is complete. While the key -// state is Updating, you can use the keys in cryptographic operations, but -// you cannot replicate the new primary key or perform certain management operations, -// such as enabling or disabling these keys. For details about the Updating -// key state, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// This operation does not return any output. To verify that primary key is -// changed, use the DescribeKey operation. -// -// Cross-account use: No. You cannot use this operation in a different Amazon -// Web Services account. -// -// Required permissions: -// -// - kms:UpdatePrimaryRegion on the current primary key (in the primary key's -// Region). Include this permission primary key's key policy. -// -// - kms:UpdatePrimaryRegion on the current replica key (in the replica key's -// Region). Include this permission in the replica key's key policy. -// -// Related operations -// -// - CreateKey -// -// - ReplicateKey -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation UpdatePrimaryRegion for usage and error information. -// -// Returned Error Types: -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - InvalidArnException -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - UnsupportedOperationException -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdatePrimaryRegion -func (c *KMS) UpdatePrimaryRegion(input *UpdatePrimaryRegionInput) (*UpdatePrimaryRegionOutput, error) { - req, out := c.UpdatePrimaryRegionRequest(input) - return out, req.Send() -} - -// UpdatePrimaryRegionWithContext is the same as UpdatePrimaryRegion with the addition of -// the ability to pass a context and additional request options. -// -// See UpdatePrimaryRegion for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) UpdatePrimaryRegionWithContext(ctx aws.Context, input *UpdatePrimaryRegionInput, opts ...request.Option) (*UpdatePrimaryRegionOutput, error) { - req, out := c.UpdatePrimaryRegionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opVerify = "Verify" - -// VerifyRequest generates a "aws/request.Request" representing the -// client's request for the Verify operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See Verify for more information on using the Verify -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the VerifyRequest method. -// req, resp := client.VerifyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Verify -func (c *KMS) VerifyRequest(input *VerifyInput) (req *request.Request, output *VerifyOutput) { - op := &request.Operation{ - Name: opVerify, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &VerifyInput{} - } - - output = &VerifyOutput{} - req = c.newRequest(op, input, output) - return -} - -// Verify API operation for AWS Key Management Service. -// -// Verifies a digital signature that was generated by the Sign operation. -// -// Verification confirms that an authorized user signed the message with the -// specified KMS key and signing algorithm, and the message hasn't changed since -// it was signed. If the signature is verified, the value of the SignatureValid -// field in the response is True. If the signature verification fails, the Verify -// operation fails with an KMSInvalidSignatureException exception. -// -// A digital signature is generated by using the private key in an asymmetric -// KMS key. The signature is verified by using the public key in the same asymmetric -// KMS key. For information about asymmetric KMS keys, see Asymmetric KMS keys -// (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) -// in the Key Management Service Developer Guide. -// -// To verify a digital signature, you can use the Verify operation. Specify -// the same asymmetric KMS key, message, and signing algorithm that were used -// to produce the signature. -// -// You can also verify the digital signature by using the public key of the -// KMS key outside of KMS. Use the GetPublicKey operation to download the public -// key in the asymmetric KMS key and then use the public key to verify the signature -// outside of KMS. To verify a signature outside of KMS with an SM2 public key, -// you must specify the distinguishing ID. By default, KMS uses 1234567812345678 -// as the distinguishing ID. For more information, see Offline verification -// with SM2 key pairs (https://docs.aws.amazon.com/kms/latest/developerguide/asymmetric-key-specs.html#key-spec-sm-offline-verification) -// in Key Management Service Developer Guide. The advantage of using the Verify -// operation is that it is performed within KMS. As a result, it's easy to call, -// the operation is performed within the FIPS boundary, it is logged in CloudTrail, -// and you can use key policy and IAM policy to determine who is authorized -// to use the KMS key to verify signatures. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:Verify (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: Sign -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation Verify for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - DependencyTimeoutException -// The system timed out while trying to fulfill the request. The request can -// be retried. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// - KMSInvalidSignatureException -// The request was rejected because the signature verification failed. Signature -// verification fails when it cannot confirm that signature was produced by -// signing the specified message with the specified KMS key and signing algorithm. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Verify -func (c *KMS) Verify(input *VerifyInput) (*VerifyOutput, error) { - req, out := c.VerifyRequest(input) - return out, req.Send() -} - -// VerifyWithContext is the same as Verify with the addition of -// the ability to pass a context and additional request options. -// -// See Verify for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) VerifyWithContext(ctx aws.Context, input *VerifyInput, opts ...request.Option) (*VerifyOutput, error) { - req, out := c.VerifyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opVerifyMac = "VerifyMac" - -// VerifyMacRequest generates a "aws/request.Request" representing the -// client's request for the VerifyMac operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See VerifyMac for more information on using the VerifyMac -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// // Example sending a request using the VerifyMacRequest method. -// req, resp := client.VerifyMacRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/VerifyMac -func (c *KMS) VerifyMacRequest(input *VerifyMacInput) (req *request.Request, output *VerifyMacOutput) { - op := &request.Operation{ - Name: opVerifyMac, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &VerifyMacInput{} - } - - output = &VerifyMacOutput{} - req = c.newRequest(op, input, output) - return -} - -// VerifyMac API operation for AWS Key Management Service. -// -// Verifies the hash-based message authentication code (HMAC) for a specified -// message, HMAC KMS key, and MAC algorithm. To verify the HMAC, VerifyMac computes -// an HMAC using the message, HMAC KMS key, and MAC algorithm that you specify, -// and compares the computed HMAC to the HMAC that you specify. If the HMACs -// are identical, the verification succeeds; otherwise, it fails. -// -// Verification indicates that the message hasn't changed since the HMAC was -// calculated, and the specified key was used to generate and verify the HMAC. -// -// This operation is part of KMS support for HMAC KMS keys. For details, see -// HMAC keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html) -// in the Key Management Service Developer Guide. -// -// The KMS key that you use for this operation must be in a compatible key state. -// For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide. -// -// Cross-account use: Yes. To perform this operation with a KMS key in a different -// Amazon Web Services account, specify the key ARN or alias ARN in the value -// of the KeyId parameter. -// -// Required permissions: kms:VerifyMac (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) -// (key policy) -// -// Related operations: GenerateMac -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Key Management Service's -// API operation VerifyMac for usage and error information. -// -// Returned Error Types: -// -// - NotFoundException -// The request was rejected because the specified entity or resource could not -// be found. -// -// - DisabledException -// The request was rejected because the specified KMS key is not enabled. -// -// - KeyUnavailableException -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -// -// - InvalidKeyUsageException -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -// -// - InvalidGrantTokenException -// The request was rejected because the specified grant token is not valid. -// -// - InternalException -// The request was rejected because an internal exception occurred. The request -// can be retried. -// -// - KMSInvalidMacException -// The request was rejected because the HMAC verification failed. HMAC verification -// fails when the HMAC computed by using the specified message, HMAC KMS key, -// and MAC algorithm does not match the HMAC specified in the request. -// -// - InvalidStateException -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/VerifyMac -func (c *KMS) VerifyMac(input *VerifyMacInput) (*VerifyMacOutput, error) { - req, out := c.VerifyMacRequest(input) - return out, req.Send() -} - -// VerifyMacWithContext is the same as VerifyMac with the addition of -// the ability to pass a context and additional request options. -// -// See VerifyMac for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *KMS) VerifyMacWithContext(ctx aws.Context, input *VerifyMacInput, opts ...request.Option) (*VerifyMacOutput, error) { - req, out := c.VerifyMacRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// Contains information about an alias. -type AliasListEntry struct { - _ struct{} `type:"structure"` - - // String that contains the key ARN. - AliasArn *string `min:"20" type:"string"` - - // String that contains the alias. This value begins with alias/. - AliasName *string `min:"1" type:"string"` - - // Date and time that the alias was most recently created in the account and - // Region. Formatted as Unix time. - CreationDate *time.Time `type:"timestamp"` - - // Date and time that the alias was most recently associated with a KMS key - // in the account and Region. Formatted as Unix time. - LastUpdatedDate *time.Time `type:"timestamp"` - - // String that contains the key identifier of the KMS key associated with the - // alias. - TargetKeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AliasListEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AliasListEntry) GoString() string { - return s.String() -} - -// SetAliasArn sets the AliasArn field's value. -func (s *AliasListEntry) SetAliasArn(v string) *AliasListEntry { - s.AliasArn = &v - return s -} - -// SetAliasName sets the AliasName field's value. -func (s *AliasListEntry) SetAliasName(v string) *AliasListEntry { - s.AliasName = &v - return s -} - -// SetCreationDate sets the CreationDate field's value. -func (s *AliasListEntry) SetCreationDate(v time.Time) *AliasListEntry { - s.CreationDate = &v - return s -} - -// SetLastUpdatedDate sets the LastUpdatedDate field's value. -func (s *AliasListEntry) SetLastUpdatedDate(v time.Time) *AliasListEntry { - s.LastUpdatedDate = &v - return s -} - -// SetTargetKeyId sets the TargetKeyId field's value. -func (s *AliasListEntry) SetTargetKeyId(v string) *AliasListEntry { - s.TargetKeyId = &v - return s -} - -// The request was rejected because it attempted to create a resource that already -// exists. -type AlreadyExistsException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AlreadyExistsException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s AlreadyExistsException) GoString() string { - return s.String() -} - -func newErrorAlreadyExistsException(v protocol.ResponseMetadata) error { - return &AlreadyExistsException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *AlreadyExistsException) Code() string { - return "AlreadyExistsException" -} - -// Message returns the exception's message. -func (s *AlreadyExistsException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *AlreadyExistsException) OrigErr() error { - return nil -} - -func (s *AlreadyExistsException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *AlreadyExistsException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *AlreadyExistsException) RequestID() string { - return s.RespMetadata.RequestID -} - -type CancelKeyDeletionInput struct { - _ struct{} `type:"structure"` - - // Identifies the KMS key whose deletion is being canceled. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelKeyDeletionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelKeyDeletionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CancelKeyDeletionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CancelKeyDeletionInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *CancelKeyDeletionInput) SetKeyId(v string) *CancelKeyDeletionInput { - s.KeyId = &v - return s -} - -type CancelKeyDeletionOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key whose deletion is canceled. - KeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelKeyDeletionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CancelKeyDeletionOutput) GoString() string { - return s.String() -} - -// SetKeyId sets the KeyId field's value. -func (s *CancelKeyDeletionOutput) SetKeyId(v string) *CancelKeyDeletionOutput { - s.KeyId = &v - return s -} - -// The request was rejected because the specified CloudHSM cluster is already -// associated with a custom key store or it shares a backup history with a cluster -// that is associated with a custom key store. Each custom key store must be -// associated with a different CloudHSM cluster. -// -// Clusters that share a backup history have the same cluster certificate. To -// view the cluster certificate of a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) -// operation. -type CloudHsmClusterInUseException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterInUseException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterInUseException) GoString() string { - return s.String() -} - -func newErrorCloudHsmClusterInUseException(v protocol.ResponseMetadata) error { - return &CloudHsmClusterInUseException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CloudHsmClusterInUseException) Code() string { - return "CloudHsmClusterInUseException" -} - -// Message returns the exception's message. -func (s *CloudHsmClusterInUseException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CloudHsmClusterInUseException) OrigErr() error { - return nil -} - -func (s *CloudHsmClusterInUseException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CloudHsmClusterInUseException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CloudHsmClusterInUseException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the associated CloudHSM cluster did not -// meet the configuration requirements for a custom key store. -// -// - The cluster must be configured with private subnets in at least two -// different Availability Zones in the Region. -// -// - The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// (cloudhsm-cluster--sg) must include inbound rules and outbound -// rules that allow TCP traffic on ports 2223-2225. The Source in the inbound -// rules and the Destination in the outbound rules must match the security -// group ID. These rules are set by default when you create the cluster. -// Do not delete or change them. To get information about a particular security -// group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) -// operation. -// -// - The cluster must contain at least as many HSMs as the operation requires. -// To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) -// operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey -// operations, the CloudHSM cluster must have at least two active HSMs, each -// in a different Availability Zone. For the ConnectCustomKeyStore operation, -// the CloudHSM must contain at least one active HSM. -// -// For information about the requirements for an CloudHSM cluster that is associated -// with a custom key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) -// in the Key Management Service Developer Guide. For information about creating -// a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) -// in the CloudHSM User Guide. For information about cluster security groups, -// see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) -// in the CloudHSM User Guide . -type CloudHsmClusterInvalidConfigurationException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterInvalidConfigurationException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterInvalidConfigurationException) GoString() string { - return s.String() -} - -func newErrorCloudHsmClusterInvalidConfigurationException(v protocol.ResponseMetadata) error { - return &CloudHsmClusterInvalidConfigurationException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CloudHsmClusterInvalidConfigurationException) Code() string { - return "CloudHsmClusterInvalidConfigurationException" -} - -// Message returns the exception's message. -func (s *CloudHsmClusterInvalidConfigurationException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CloudHsmClusterInvalidConfigurationException) OrigErr() error { - return nil -} - -func (s *CloudHsmClusterInvalidConfigurationException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CloudHsmClusterInvalidConfigurationException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CloudHsmClusterInvalidConfigurationException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the CloudHSM cluster that is associated -// with the custom key store is not active. Initialize and activate the cluster -// and try the command again. For detailed instructions, see Getting Started -// (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) -// in the CloudHSM User Guide. -type CloudHsmClusterNotActiveException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterNotActiveException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterNotActiveException) GoString() string { - return s.String() -} - -func newErrorCloudHsmClusterNotActiveException(v protocol.ResponseMetadata) error { - return &CloudHsmClusterNotActiveException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CloudHsmClusterNotActiveException) Code() string { - return "CloudHsmClusterNotActiveException" -} - -// Message returns the exception's message. -func (s *CloudHsmClusterNotActiveException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CloudHsmClusterNotActiveException) OrigErr() error { - return nil -} - -func (s *CloudHsmClusterNotActiveException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CloudHsmClusterNotActiveException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CloudHsmClusterNotActiveException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because KMS cannot find the CloudHSM cluster with -// the specified cluster ID. Retry the request with a different cluster ID. -type CloudHsmClusterNotFoundException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterNotFoundException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterNotFoundException) GoString() string { - return s.String() -} - -func newErrorCloudHsmClusterNotFoundException(v protocol.ResponseMetadata) error { - return &CloudHsmClusterNotFoundException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CloudHsmClusterNotFoundException) Code() string { - return "CloudHsmClusterNotFoundException" -} - -// Message returns the exception's message. -func (s *CloudHsmClusterNotFoundException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CloudHsmClusterNotFoundException) OrigErr() error { - return nil -} - -func (s *CloudHsmClusterNotFoundException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CloudHsmClusterNotFoundException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CloudHsmClusterNotFoundException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the specified CloudHSM cluster has a different -// cluster certificate than the original cluster. You cannot use the operation -// to specify an unrelated cluster. -// -// Specify a cluster that shares a backup history with the original cluster. -// This includes clusters that were created from a backup of the current cluster, -// and clusters that were created from the same backup that produced the current -// cluster. -// -// Clusters that share a backup history have the same cluster certificate. To -// view the cluster certificate of a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) -// operation. -type CloudHsmClusterNotRelatedException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterNotRelatedException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CloudHsmClusterNotRelatedException) GoString() string { - return s.String() -} - -func newErrorCloudHsmClusterNotRelatedException(v protocol.ResponseMetadata) error { - return &CloudHsmClusterNotRelatedException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CloudHsmClusterNotRelatedException) Code() string { - return "CloudHsmClusterNotRelatedException" -} - -// Message returns the exception's message. -func (s *CloudHsmClusterNotRelatedException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CloudHsmClusterNotRelatedException) OrigErr() error { - return nil -} - -func (s *CloudHsmClusterNotRelatedException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CloudHsmClusterNotRelatedException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CloudHsmClusterNotRelatedException) RequestID() string { - return s.RespMetadata.RequestID -} - -type ConnectCustomKeyStoreInput struct { - _ struct{} `type:"structure"` - - // Enter the key store ID of the custom key store that you want to connect. - // To find the ID of a custom key store, use the DescribeCustomKeyStores operation. - // - // CustomKeyStoreId is a required field - CustomKeyStoreId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectCustomKeyStoreInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectCustomKeyStoreInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ConnectCustomKeyStoreInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ConnectCustomKeyStoreInput"} - if s.CustomKeyStoreId == nil { - invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId")) - } - if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *ConnectCustomKeyStoreInput) SetCustomKeyStoreId(v string) *ConnectCustomKeyStoreInput { - s.CustomKeyStoreId = &v - return s -} - -type ConnectCustomKeyStoreOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectCustomKeyStoreOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ConnectCustomKeyStoreOutput) GoString() string { - return s.String() -} - -type CreateAliasInput struct { - _ struct{} `type:"structure"` - - // Specifies the alias name. This value must begin with alias/ followed by a - // name, such as alias/ExampleAlias. - // - // The AliasName value must be string of 1-256 characters. It can contain only - // alphanumeric characters, forward slashes (/), underscores (_), and dashes - // (-). The alias name cannot begin with alias/aws/. The alias/aws/ prefix is - // reserved for Amazon Web Services managed keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk). - // - // AliasName is a required field - AliasName *string `min:"1" type:"string" required:"true"` - - // Associates the alias with the specified customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk). - // The KMS key must be in the same Amazon Web Services Region. - // - // A valid key ID is required. If you supply a null or empty string value, this - // operation returns an error. - // - // For help finding the key ID and ARN, see Finding the Key ID and ARN (https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html#find-cmk-id-arn) - // in the Key Management Service Developer Guide . - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // TargetKeyId is a required field - TargetKeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAliasInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAliasInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateAliasInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateAliasInput"} - if s.AliasName == nil { - invalidParams.Add(request.NewErrParamRequired("AliasName")) - } - if s.AliasName != nil && len(*s.AliasName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AliasName", 1)) - } - if s.TargetKeyId == nil { - invalidParams.Add(request.NewErrParamRequired("TargetKeyId")) - } - if s.TargetKeyId != nil && len(*s.TargetKeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TargetKeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAliasName sets the AliasName field's value. -func (s *CreateAliasInput) SetAliasName(v string) *CreateAliasInput { - s.AliasName = &v - return s -} - -// SetTargetKeyId sets the TargetKeyId field's value. -func (s *CreateAliasInput) SetTargetKeyId(v string) *CreateAliasInput { - s.TargetKeyId = &v - return s -} - -type CreateAliasOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAliasOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateAliasOutput) GoString() string { - return s.String() -} - -type CreateCustomKeyStoreInput struct { - _ struct{} `type:"structure"` - - // Identifies the CloudHSM cluster for the custom key store. Enter the cluster - // ID of any active CloudHSM cluster that is not already associated with a custom - // key store. To find the cluster ID, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) - // operation. - CloudHsmClusterId *string `min:"19" type:"string"` - - // Specifies a friendly name for the custom key store. The name must be unique - // in your Amazon Web Services account. - // - // CustomKeyStoreName is a required field - CustomKeyStoreName *string `min:"1" type:"string" required:"true"` - - // Enter the password of the kmsuser crypto user (CU) account (https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser) - // in the specified CloudHSM cluster. KMS logs into the cluster as this user - // to manage key material on your behalf. - // - // The password must be a string of 7 to 32 characters. Its value is case sensitive. - // - // This parameter tells KMS the kmsuser account password; it does not change - // the password in the CloudHSM cluster. - // - // KeyStorePassword is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by CreateCustomKeyStoreInput's - // String and GoString methods. - KeyStorePassword *string `min:"7" type:"string" sensitive:"true"` - - // Enter the content of the trust anchor certificate for the cluster. This is - // the content of the customerCA.crt file that you created when you initialized - // the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html). - TrustAnchorCertificate *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateCustomKeyStoreInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateCustomKeyStoreInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateCustomKeyStoreInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateCustomKeyStoreInput"} - if s.CloudHsmClusterId != nil && len(*s.CloudHsmClusterId) < 19 { - invalidParams.Add(request.NewErrParamMinLen("CloudHsmClusterId", 19)) - } - if s.CustomKeyStoreName == nil { - invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreName")) - } - if s.CustomKeyStoreName != nil && len(*s.CustomKeyStoreName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreName", 1)) - } - if s.KeyStorePassword != nil && len(*s.KeyStorePassword) < 7 { - invalidParams.Add(request.NewErrParamMinLen("KeyStorePassword", 7)) - } - if s.TrustAnchorCertificate != nil && len(*s.TrustAnchorCertificate) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TrustAnchorCertificate", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCloudHsmClusterId sets the CloudHsmClusterId field's value. -func (s *CreateCustomKeyStoreInput) SetCloudHsmClusterId(v string) *CreateCustomKeyStoreInput { - s.CloudHsmClusterId = &v - return s -} - -// SetCustomKeyStoreName sets the CustomKeyStoreName field's value. -func (s *CreateCustomKeyStoreInput) SetCustomKeyStoreName(v string) *CreateCustomKeyStoreInput { - s.CustomKeyStoreName = &v - return s -} - -// SetKeyStorePassword sets the KeyStorePassword field's value. -func (s *CreateCustomKeyStoreInput) SetKeyStorePassword(v string) *CreateCustomKeyStoreInput { - s.KeyStorePassword = &v - return s -} - -// SetTrustAnchorCertificate sets the TrustAnchorCertificate field's value. -func (s *CreateCustomKeyStoreInput) SetTrustAnchorCertificate(v string) *CreateCustomKeyStoreInput { - s.TrustAnchorCertificate = &v - return s -} - -type CreateCustomKeyStoreOutput struct { - _ struct{} `type:"structure"` - - // A unique identifier for the new custom key store. - CustomKeyStoreId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateCustomKeyStoreOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateCustomKeyStoreOutput) GoString() string { - return s.String() -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *CreateCustomKeyStoreOutput) SetCustomKeyStoreId(v string) *CreateCustomKeyStoreOutput { - s.CustomKeyStoreId = &v - return s -} - -type CreateGrantInput struct { - _ struct{} `type:"structure"` - - // Specifies a grant constraint. - // - // KMS supports the EncryptionContextEquals and EncryptionContextSubset grant - // constraints. Each constraint value can include up to 8 encryption context - // pairs. The encryption context value in each constraint cannot exceed 384 - // characters. For information about grant constraints, see Using grant constraints - // (https://docs.aws.amazon.com/kms/latest/developerguide/create-grant-overview.html#grant-constraints) - // in the Key Management Service Developer Guide. For more information about - // encryption context, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide . - // - // The encryption context grant constraints allow the permissions in the grant - // only when the encryption context in the request matches (EncryptionContextEquals) - // or includes (EncryptionContextSubset) the encryption context specified in - // this structure. - // - // The encryption context grant constraints are supported only on grant operations - // (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations) - // that include an EncryptionContext parameter, such as cryptographic operations - // on symmetric encryption KMS keys. Grants with grant constraints can include - // the DescribeKey and RetireGrant operations, but the constraint doesn't apply - // to these operations. If a grant with a grant constraint includes the CreateGrant - // operation, the constraint requires that any grants created with the CreateGrant - // permission have an equally strict or stricter encryption context constraint. - // - // You cannot use an encryption context grant constraint for cryptographic operations - // with asymmetric KMS keys or HMAC KMS keys. These keys don't support an encryption - // context. - Constraints *GrantConstraints `type:"structure"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // The identity that gets the permissions specified in the grant. - // - // To specify the principal, use the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // of an Amazon Web Services principal. Valid Amazon Web Services principals - // include Amazon Web Services accounts (root), IAM users, IAM roles, federated - // users, and assumed role users. For examples of the ARN syntax to use for - // specifying a principal, see Amazon Web Services Identity and Access Management - // (IAM) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam) - // in the Example ARNs section of the Amazon Web Services General Reference. - // - // GranteePrincipal is a required field - GranteePrincipal *string `min:"1" type:"string" required:"true"` - - // Identifies the KMS key for the grant. The grant gives principals permission - // to use this KMS key. - // - // Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different - // Amazon Web Services account, you must use the key ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // A friendly name for the grant. Use this value to prevent the unintended creation - // of duplicate grants when retrying this request. - // - // When this value is absent, all CreateGrant requests result in a new grant - // with a unique GrantId even if all the supplied parameters are identical. - // This can result in unintended duplicates when you retry the CreateGrant request. - // - // When this value is present, you can retry a CreateGrant request with identical - // parameters; if the grant already exists, the original GrantId is returned - // without creating a new grant. Note that the returned grant token is unique - // with every CreateGrant request, even when a duplicate GrantId is returned. - // All grant tokens for the same grant ID can be used interchangeably. - Name *string `min:"1" type:"string"` - - // A list of operations that the grant permits. - // - // This list must include only operations that are permitted in a grant. Also, - // the operation must be supported on the KMS key. For example, you cannot create - // a grant for a symmetric encryption KMS key that allows the Sign operation, - // or a grant for an asymmetric KMS key that allows the GenerateDataKey operation. - // If you try, KMS returns a ValidationError exception. For details, see Grant - // operations (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations) - // in the Key Management Service Developer Guide. - // - // Operations is a required field - Operations []*string `type:"list" required:"true" enum:"GrantOperation"` - - // The principal that has permission to use the RetireGrant operation to retire - // the grant. - // - // To specify the principal, use the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // of an Amazon Web Services principal. Valid Amazon Web Services principals - // include Amazon Web Services accounts (root), IAM users, federated users, - // and assumed role users. For examples of the ARN syntax to use for specifying - // a principal, see Amazon Web Services Identity and Access Management (IAM) - // (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam) - // in the Example ARNs section of the Amazon Web Services General Reference. - // - // The grant determines the retiring principal. Other principals might have - // permission to retire the grant or revoke the grant. For details, see RevokeGrant - // and Retiring and revoking grants (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete) - // in the Key Management Service Developer Guide. - RetiringPrincipal *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateGrantInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateGrantInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateGrantInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateGrantInput"} - if s.GranteePrincipal == nil { - invalidParams.Add(request.NewErrParamRequired("GranteePrincipal")) - } - if s.GranteePrincipal != nil && len(*s.GranteePrincipal) < 1 { - invalidParams.Add(request.NewErrParamMinLen("GranteePrincipal", 1)) - } - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } - if s.Operations == nil { - invalidParams.Add(request.NewErrParamRequired("Operations")) - } - if s.RetiringPrincipal != nil && len(*s.RetiringPrincipal) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RetiringPrincipal", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetConstraints sets the Constraints field's value. -func (s *CreateGrantInput) SetConstraints(v *GrantConstraints) *CreateGrantInput { - s.Constraints = v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *CreateGrantInput) SetGrantTokens(v []*string) *CreateGrantInput { - s.GrantTokens = v - return s -} - -// SetGranteePrincipal sets the GranteePrincipal field's value. -func (s *CreateGrantInput) SetGranteePrincipal(v string) *CreateGrantInput { - s.GranteePrincipal = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *CreateGrantInput) SetKeyId(v string) *CreateGrantInput { - s.KeyId = &v - return s -} - -// SetName sets the Name field's value. -func (s *CreateGrantInput) SetName(v string) *CreateGrantInput { - s.Name = &v - return s -} - -// SetOperations sets the Operations field's value. -func (s *CreateGrantInput) SetOperations(v []*string) *CreateGrantInput { - s.Operations = v - return s -} - -// SetRetiringPrincipal sets the RetiringPrincipal field's value. -func (s *CreateGrantInput) SetRetiringPrincipal(v string) *CreateGrantInput { - s.RetiringPrincipal = &v - return s -} - -type CreateGrantOutput struct { - _ struct{} `type:"structure"` - - // The unique identifier for the grant. - // - // You can use the GrantId in a ListGrants, RetireGrant, or RevokeGrant operation. - GrantId *string `min:"1" type:"string"` - - // The grant token. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantToken *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateGrantOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateGrantOutput) GoString() string { - return s.String() -} - -// SetGrantId sets the GrantId field's value. -func (s *CreateGrantOutput) SetGrantId(v string) *CreateGrantOutput { - s.GrantId = &v - return s -} - -// SetGrantToken sets the GrantToken field's value. -func (s *CreateGrantOutput) SetGrantToken(v string) *CreateGrantOutput { - s.GrantToken = &v - return s -} - -type CreateKeyInput struct { - _ struct{} `type:"structure"` - - // A flag to indicate whether to bypass the key policy lockout safety check. - // - // Setting this value to true increases the risk that the KMS key becomes unmanageable. - // Do not set this value to true indiscriminately. - // - // For more information, refer to the scenario in the Default Key Policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) - // section in the Key Management Service Developer Guide . - // - // Use this parameter only when you include a policy in the request and you - // intend to prevent the principal that is making the request from making a - // subsequent PutKeyPolicy request on the KMS key. - // - // The default value is false. - BypassPolicyLockoutSafetyCheck *bool `type:"boolean"` - - // Creates the KMS key in the specified custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) - // and the key material in its associated CloudHSM cluster. To create a KMS - // key in a custom key store, you must also specify the Origin parameter with - // a value of AWS_CLOUDHSM. The CloudHSM cluster that is associated with the - // custom key store must have at least two active HSMs, each in a different - // Availability Zone in the Region. - // - // This parameter is valid only for symmetric encryption KMS keys in a single - // Region. You cannot create any other type of KMS key in a custom key store. - // - // To find the ID of a custom key store, use the DescribeCustomKeyStores operation. - // - // The response includes the custom key store ID and the ID of the CloudHSM - // cluster. - // - // This operation is part of the custom key store feature (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) - // feature in KMS, which combines the convenience and extensive integration - // of KMS with the isolation and control of a single-tenant key store. - CustomKeyStoreId *string `min:"1" type:"string"` - - // Instead, use the KeySpec parameter. - // - // The KeySpec and CustomerMasterKeySpec parameters work the same way. Only - // the names differ. We recommend that you use KeySpec parameter in your code. - // However, to avoid breaking changes, KMS will support both parameters. - // - // Deprecated: This parameter has been deprecated. Instead, use the KeySpec parameter. - CustomerMasterKeySpec *string `deprecated:"true" type:"string" enum:"CustomerMasterKeySpec"` - - // A description of the KMS key. - // - // Use a description that helps you decide whether the KMS key is appropriate - // for a task. The default value is an empty string (no description). - // - // To set or change the description after the key is created, use UpdateKeyDescription. - Description *string `type:"string"` - - // Specifies the type of KMS key to create. The default value, SYMMETRIC_DEFAULT, - // creates a KMS key with a 256-bit AES-GCM key that is used for encryption - // and decryption, except in China Regions, where it creates a 128-bit symmetric - // key that uses SM4 encryption. For help choosing a key spec for your KMS key, - // see Choosing a KMS key type (https://docs.aws.amazon.com/kms/latest/developerguide/key-types.html#symm-asymm-choose) - // in the Key Management Service Developer Guide . - // - // The KeySpec determines whether the KMS key contains a symmetric key or an - // asymmetric key pair. It also determines the cryptographic algorithms that - // the KMS key supports. You can't change the KeySpec after the KMS key is created. - // To further restrict the algorithms that can be used with the KMS key, use - // a condition key in its key policy or IAM policy. For more information, see - // kms:EncryptionAlgorithm (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-encryption-algorithm), - // kms:MacAlgorithm (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-mac-algorithm) - // or kms:Signing Algorithm (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-signing-algorithm) - // in the Key Management Service Developer Guide . - // - // Amazon Web Services services that are integrated with KMS (http://aws.amazon.com/kms/features/#AWS_Service_Integration) - // use symmetric encryption KMS keys to protect your data. These services do - // not support asymmetric KMS keys or HMAC KMS keys. - // - // KMS supports the following key specs for KMS keys: - // - // * Symmetric encryption key (default) SYMMETRIC_DEFAULT - // - // * HMAC keys (symmetric) HMAC_224 HMAC_256 HMAC_384 HMAC_512 - // - // * Asymmetric RSA key pairs RSA_2048 RSA_3072 RSA_4096 - // - // * Asymmetric NIST-recommended elliptic curve key pairs ECC_NIST_P256 (secp256r1) - // ECC_NIST_P384 (secp384r1) ECC_NIST_P521 (secp521r1) - // - // * Other asymmetric elliptic curve key pairs ECC_SECG_P256K1 (secp256k1), - // commonly used for cryptocurrencies. - // - // * SM2 key pairs (China Regions only) SM2 - KeySpec *string `type:"string" enum:"KeySpec"` - - // Determines the cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) - // for which you can use the KMS key. The default value is ENCRYPT_DECRYPT. - // This parameter is optional when you are creating a symmetric encryption KMS - // key; otherwise, it is required. You can't change the KeyUsage value after - // the KMS key is created. - // - // Select only one valid value. - // - // * For symmetric encryption KMS keys, omit the parameter or specify ENCRYPT_DECRYPT. - // - // * For HMAC KMS keys (symmetric), specify GENERATE_VERIFY_MAC. - // - // * For asymmetric KMS keys with RSA key material, specify ENCRYPT_DECRYPT - // or SIGN_VERIFY. - // - // * For asymmetric KMS keys with ECC key material, specify SIGN_VERIFY. - // - // * For asymmetric KMS keys with SM2 key material (China Regions only), - // specify ENCRYPT_DECRYPT or SIGN_VERIFY. - KeyUsage *string `type:"string" enum:"KeyUsageType"` - - // Creates a multi-Region primary key that you can replicate into other Amazon - // Web Services Regions. You cannot change this value after you create the KMS - // key. - // - // For a multi-Region key, set this parameter to True. For a single-Region KMS - // key, omit this parameter or set it to False. The default value is False. - // - // This operation supports multi-Region keys, an KMS feature that lets you create - // multiple interoperable KMS keys in different Amazon Web Services Regions. - // Because these KMS keys have the same key ID, key material, and other metadata, - // you can use them interchangeably to encrypt data in one Amazon Web Services - // Region and decrypt it in a different Amazon Web Services Region without re-encrypting - // the data or making a cross-Region call. For more information about multi-Region - // keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) - // in the Key Management Service Developer Guide. - // - // This value creates a primary key, not a replica. To create a replica key, - // use the ReplicateKey operation. - // - // You can create a multi-Region version of a symmetric encryption KMS key, - // an HMAC KMS key, an asymmetric KMS key, or a KMS key with imported key material. - // However, you cannot create a multi-Region key in a custom key store. - MultiRegion *bool `type:"boolean"` - - // The source of the key material for the KMS key. You cannot change the origin - // after you create the KMS key. The default is AWS_KMS, which means that KMS - // creates the key material. - // - // To create a KMS key with no key material (for imported key material), set - // the value to EXTERNAL. For more information about importing key material - // into KMS, see Importing Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) - // in the Key Management Service Developer Guide. This value is valid only for - // symmetric encryption KMS keys. - // - // To create a KMS key in an KMS custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) - // and create its key material in the associated CloudHSM cluster, set this - // value to AWS_CLOUDHSM. You must also use the CustomKeyStoreId parameter to - // identify the custom key store. This value is valid only for symmetric encryption - // KMS keys. - Origin *string `type:"string" enum:"OriginType"` - - // The key policy to attach to the KMS key. If you do not specify a key policy, - // KMS attaches a default key policy to the KMS key. For more information, see - // Default key policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default) - // in the Key Management Service Developer Guide. - // - // If you provide a key policy, it must meet the following criteria: - // - // * If you don't set BypassPolicyLockoutSafetyCheck to True, the key policy - // must allow the principal that is making the CreateKey request to make - // a subsequent PutKeyPolicy request on the KMS key. This reduces the risk - // that the KMS key becomes unmanageable. For more information, refer to - // the scenario in the Default Key Policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) - // section of the Key Management Service Developer Guide . - // - // * Each statement in the key policy must contain one or more principals. - // The principals in the key policy must exist and be visible to KMS. When - // you create a new Amazon Web Services principal (for example, an IAM user - // or role), you might need to enforce a delay before including the new principal - // in a key policy because the new principal might not be immediately visible - // to KMS. For more information, see Changes that I make are not always immediately - // visible (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency) - // in the Amazon Web Services Identity and Access Management User Guide. - // - // A key policy document can include only the following characters: - // - // * Printable ASCII characters from the space character (\u0020) through - // the end of the ASCII character range. - // - // * Printable characters in the Basic Latin and Latin-1 Supplement character - // set (through \u00FF). - // - // * The tab (\u0009), line feed (\u000A), and carriage return (\u000D) special - // characters - // - // For information about key policies, see Key policies in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) - // in the Key Management Service Developer Guide. For help writing and formatting - // a JSON policy document, see the IAM JSON Policy Reference (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html) - // in the Identity and Access Management User Guide . - Policy *string `min:"1" type:"string"` - - // Assigns one or more tags to the KMS key. Use this parameter to tag the KMS - // key when it is created. To tag an existing KMS key, use the TagResource operation. - // - // Tagging or untagging a KMS key can allow or deny permission to the KMS key. - // For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) - // in the Key Management Service Developer Guide. - // - // To use this parameter, you must have kms:TagResource (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) - // permission in an IAM policy. - // - // Each tag consists of a tag key and a tag value. Both the tag key and the - // tag value are required, but the tag value can be an empty (null) string. - // You cannot have more than one tag on a KMS key with the same tag key. If - // you specify an existing tag key with a different tag value, KMS replaces - // the current tag value with the specified one. - // - // When you add tags to an Amazon Web Services resource, Amazon Web Services - // generates a cost allocation report with usage and costs aggregated by tags. - // Tags can also be used to control access to a KMS key. For details, see Tagging - // Keys (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html). - Tags []*Tag `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateKeyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateKeyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateKeyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateKeyInput"} - if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBypassPolicyLockoutSafetyCheck sets the BypassPolicyLockoutSafetyCheck field's value. -func (s *CreateKeyInput) SetBypassPolicyLockoutSafetyCheck(v bool) *CreateKeyInput { - s.BypassPolicyLockoutSafetyCheck = &v - return s -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *CreateKeyInput) SetCustomKeyStoreId(v string) *CreateKeyInput { - s.CustomKeyStoreId = &v - return s -} - -// SetCustomerMasterKeySpec sets the CustomerMasterKeySpec field's value. -func (s *CreateKeyInput) SetCustomerMasterKeySpec(v string) *CreateKeyInput { - s.CustomerMasterKeySpec = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *CreateKeyInput) SetDescription(v string) *CreateKeyInput { - s.Description = &v - return s -} - -// SetKeySpec sets the KeySpec field's value. -func (s *CreateKeyInput) SetKeySpec(v string) *CreateKeyInput { - s.KeySpec = &v - return s -} - -// SetKeyUsage sets the KeyUsage field's value. -func (s *CreateKeyInput) SetKeyUsage(v string) *CreateKeyInput { - s.KeyUsage = &v - return s -} - -// SetMultiRegion sets the MultiRegion field's value. -func (s *CreateKeyInput) SetMultiRegion(v bool) *CreateKeyInput { - s.MultiRegion = &v - return s -} - -// SetOrigin sets the Origin field's value. -func (s *CreateKeyInput) SetOrigin(v string) *CreateKeyInput { - s.Origin = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *CreateKeyInput) SetPolicy(v string) *CreateKeyInput { - s.Policy = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *CreateKeyInput) SetTags(v []*Tag) *CreateKeyInput { - s.Tags = v - return s -} - -type CreateKeyOutput struct { - _ struct{} `type:"structure"` - - // Metadata associated with the KMS key. - KeyMetadata *KeyMetadata `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateKeyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CreateKeyOutput) GoString() string { - return s.String() -} - -// SetKeyMetadata sets the KeyMetadata field's value. -func (s *CreateKeyOutput) SetKeyMetadata(v *KeyMetadata) *CreateKeyOutput { - s.KeyMetadata = v - return s -} - -// The request was rejected because the custom key store contains KMS keys. -// After verifying that you do not need to use the KMS keys, use the ScheduleKeyDeletion -// operation to delete the KMS keys. After they are deleted, you can delete -// the custom key store. -type CustomKeyStoreHasCMKsException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreHasCMKsException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreHasCMKsException) GoString() string { - return s.String() -} - -func newErrorCustomKeyStoreHasCMKsException(v protocol.ResponseMetadata) error { - return &CustomKeyStoreHasCMKsException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CustomKeyStoreHasCMKsException) Code() string { - return "CustomKeyStoreHasCMKsException" -} - -// Message returns the exception's message. -func (s *CustomKeyStoreHasCMKsException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CustomKeyStoreHasCMKsException) OrigErr() error { - return nil -} - -func (s *CustomKeyStoreHasCMKsException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CustomKeyStoreHasCMKsException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CustomKeyStoreHasCMKsException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because of the ConnectionState of the custom key -// store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores -// operation. -// -// This exception is thrown under the following conditions: -// -// - You requested the CreateKey or GenerateRandom operation in a custom -// key store that is not connected. These operations are valid only when -// the custom key store ConnectionState is CONNECTED. -// -// - You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation -// on a custom key store that is not disconnected. This operation is valid -// only when the custom key store ConnectionState is DISCONNECTED. -// -// - You requested the ConnectCustomKeyStore operation on a custom key store -// with a ConnectionState of DISCONNECTING or FAILED. This operation is valid -// for all other ConnectionState values. -type CustomKeyStoreInvalidStateException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreInvalidStateException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreInvalidStateException) GoString() string { - return s.String() -} - -func newErrorCustomKeyStoreInvalidStateException(v protocol.ResponseMetadata) error { - return &CustomKeyStoreInvalidStateException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CustomKeyStoreInvalidStateException) Code() string { - return "CustomKeyStoreInvalidStateException" -} - -// Message returns the exception's message. -func (s *CustomKeyStoreInvalidStateException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CustomKeyStoreInvalidStateException) OrigErr() error { - return nil -} - -func (s *CustomKeyStoreInvalidStateException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CustomKeyStoreInvalidStateException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CustomKeyStoreInvalidStateException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the specified custom key store name is already -// assigned to another custom key store in the account. Try again with a custom -// key store name that is unique in the account. -type CustomKeyStoreNameInUseException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreNameInUseException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreNameInUseException) GoString() string { - return s.String() -} - -func newErrorCustomKeyStoreNameInUseException(v protocol.ResponseMetadata) error { - return &CustomKeyStoreNameInUseException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CustomKeyStoreNameInUseException) Code() string { - return "CustomKeyStoreNameInUseException" -} - -// Message returns the exception's message. -func (s *CustomKeyStoreNameInUseException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CustomKeyStoreNameInUseException) OrigErr() error { - return nil -} - -func (s *CustomKeyStoreNameInUseException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CustomKeyStoreNameInUseException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CustomKeyStoreNameInUseException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because KMS cannot find a custom key store with -// the specified key store name or ID. -type CustomKeyStoreNotFoundException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreNotFoundException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoreNotFoundException) GoString() string { - return s.String() -} - -func newErrorCustomKeyStoreNotFoundException(v protocol.ResponseMetadata) error { - return &CustomKeyStoreNotFoundException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *CustomKeyStoreNotFoundException) Code() string { - return "CustomKeyStoreNotFoundException" -} - -// Message returns the exception's message. -func (s *CustomKeyStoreNotFoundException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *CustomKeyStoreNotFoundException) OrigErr() error { - return nil -} - -func (s *CustomKeyStoreNotFoundException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *CustomKeyStoreNotFoundException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *CustomKeyStoreNotFoundException) RequestID() string { - return s.RespMetadata.RequestID -} - -// Contains information about each custom key store in the custom key store -// list. -type CustomKeyStoresListEntry struct { - _ struct{} `type:"structure"` - - // A unique identifier for the CloudHSM cluster that is associated with the - // custom key store. - CloudHsmClusterId *string `min:"19" type:"string"` - - // Describes the connection error. This field appears in the response only when - // the ConnectionState is FAILED. For help resolving these errors, see How to - // Fix a Connection Failure (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-failed) - // in Key Management Service Developer Guide. - // - // Valid values are: - // - // * CLUSTER_NOT_FOUND - KMS cannot find the CloudHSM cluster with the specified - // cluster ID. - // - // * INSUFFICIENT_CLOUDHSM_HSMS - The associated CloudHSM cluster does not - // contain any active HSMs. To connect a custom key store to its CloudHSM - // cluster, the cluster must contain at least one active HSM. - // - // * INTERNAL_ERROR - KMS could not complete the request due to an internal - // error. Retry the request. For ConnectCustomKeyStore requests, disconnect - // the custom key store before trying to connect again. - // - // * INVALID_CREDENTIALS - KMS does not have the correct password for the - // kmsuser crypto user in the CloudHSM cluster. Before you can connect your - // custom key store to its CloudHSM cluster, you must change the kmsuser - // account password and update the key store password value for the custom - // key store. - // - // * NETWORK_ERRORS - Network errors are preventing KMS from connecting to - // the custom key store. - // - // * SUBNET_NOT_FOUND - A subnet in the CloudHSM cluster configuration was - // deleted. If KMS cannot find all of the subnets in the cluster configuration, - // attempts to connect the custom key store to the CloudHSM cluster fail. - // To fix this error, create a cluster from a recent backup and associate - // it with your custom key store. (This process creates a new cluster configuration - // with a VPC and private subnets.) For details, see How to Fix a Connection - // Failure (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-failed) - // in the Key Management Service Developer Guide. - // - // * USER_LOCKED_OUT - The kmsuser CU account is locked out of the associated - // CloudHSM cluster due to too many failed password attempts. Before you - // can connect your custom key store to its CloudHSM cluster, you must change - // the kmsuser account password and update the key store password value for - // the custom key store. - // - // * USER_LOGGED_IN - The kmsuser CU account is logged into the the associated - // CloudHSM cluster. This prevents KMS from rotating the kmsuser account - // password and logging into the cluster. Before you can connect your custom - // key store to its CloudHSM cluster, you must log the kmsuser CU out of - // the cluster. If you changed the kmsuser password to log into the cluster, - // you must also and update the key store password value for the custom key - // store. For help, see How to Log Out and Reconnect (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#login-kmsuser-2) - // in the Key Management Service Developer Guide. - // - // * USER_NOT_FOUND - KMS cannot find a kmsuser CU account in the associated - // CloudHSM cluster. Before you can connect your custom key store to its - // CloudHSM cluster, you must create a kmsuser CU account in the cluster, - // and then update the key store password value for the custom key store. - ConnectionErrorCode *string `type:"string" enum:"ConnectionErrorCodeType"` - - // Indicates whether the custom key store is connected to its CloudHSM cluster. - // - // You can create and use KMS keys in your custom key stores only when its connection - // state is CONNECTED. - // - // The value is DISCONNECTED if the key store has never been connected or you - // use the DisconnectCustomKeyStore operation to disconnect it. If the value - // is CONNECTED but you are having trouble using the custom key store, make - // sure that its associated CloudHSM cluster is active and contains at least - // one active HSM. - // - // A value of FAILED indicates that an attempt to connect was unsuccessful. - // The ConnectionErrorCode field in the response indicates the cause of the - // failure. For help resolving a connection failure, see Troubleshooting a Custom - // Key Store (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html) - // in the Key Management Service Developer Guide. - ConnectionState *string `type:"string" enum:"ConnectionStateType"` - - // The date and time when the custom key store was created. - CreationDate *time.Time `type:"timestamp"` - - // A unique identifier for the custom key store. - CustomKeyStoreId *string `min:"1" type:"string"` - - // The user-specified friendly name for the custom key store. - CustomKeyStoreName *string `min:"1" type:"string"` - - // The trust anchor certificate of the associated CloudHSM cluster. When you - // initialize the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr), - // you create this certificate and save it in the customerCA.crt file. - TrustAnchorCertificate *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoresListEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s CustomKeyStoresListEntry) GoString() string { - return s.String() -} - -// SetCloudHsmClusterId sets the CloudHsmClusterId field's value. -func (s *CustomKeyStoresListEntry) SetCloudHsmClusterId(v string) *CustomKeyStoresListEntry { - s.CloudHsmClusterId = &v - return s -} - -// SetConnectionErrorCode sets the ConnectionErrorCode field's value. -func (s *CustomKeyStoresListEntry) SetConnectionErrorCode(v string) *CustomKeyStoresListEntry { - s.ConnectionErrorCode = &v - return s -} - -// SetConnectionState sets the ConnectionState field's value. -func (s *CustomKeyStoresListEntry) SetConnectionState(v string) *CustomKeyStoresListEntry { - s.ConnectionState = &v - return s -} - -// SetCreationDate sets the CreationDate field's value. -func (s *CustomKeyStoresListEntry) SetCreationDate(v time.Time) *CustomKeyStoresListEntry { - s.CreationDate = &v - return s -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *CustomKeyStoresListEntry) SetCustomKeyStoreId(v string) *CustomKeyStoresListEntry { - s.CustomKeyStoreId = &v - return s -} - -// SetCustomKeyStoreName sets the CustomKeyStoreName field's value. -func (s *CustomKeyStoresListEntry) SetCustomKeyStoreName(v string) *CustomKeyStoresListEntry { - s.CustomKeyStoreName = &v - return s -} - -// SetTrustAnchorCertificate sets the TrustAnchorCertificate field's value. -func (s *CustomKeyStoresListEntry) SetTrustAnchorCertificate(v string) *CustomKeyStoresListEntry { - s.TrustAnchorCertificate = &v - return s -} - -type DecryptInput struct { - _ struct{} `type:"structure"` - - // Ciphertext to be decrypted. The blob includes metadata. - // CiphertextBlob is automatically base64 encoded/decoded by the SDK. - // - // CiphertextBlob is a required field - CiphertextBlob []byte `min:"1" type:"blob" required:"true"` - - // Specifies the encryption algorithm that will be used to decrypt the ciphertext. - // Specify the same algorithm that was used to encrypt the data. If you specify - // a different algorithm, the Decrypt operation fails. - // - // This parameter is required only when the ciphertext was encrypted under an - // asymmetric KMS key. The default value, SYMMETRIC_DEFAULT, represents the - // only supported algorithm that is valid for symmetric encryption KMS keys. - EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // Specifies the encryption context to use when decrypting the data. An encryption - // context is valid only for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) - // with a symmetric encryption KMS key. The standard asymmetric encryption algorithms - // and HMAC algorithms that KMS uses do not support an encryption context. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - EncryptionContext map[string]*string `type:"map"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Specifies the KMS key that KMS uses to decrypt the ciphertext. - // - // Enter a key ID of the KMS key that was used to encrypt the ciphertext. If - // you identify a different KMS key, the Decrypt operation throws an IncorrectKeyException. - // - // This parameter is required only when the ciphertext was encrypted under an - // asymmetric KMS key. If you used a symmetric encryption KMS key, KMS can get - // the KMS key from metadata that it adds to the symmetric ciphertext blob. - // However, it is always recommended as a best practice. This practice ensures - // that you use the KMS key that you intend. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - KeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DecryptInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DecryptInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DecryptInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DecryptInput"} - if s.CiphertextBlob == nil { - invalidParams.Add(request.NewErrParamRequired("CiphertextBlob")) - } - if s.CiphertextBlob != nil && len(s.CiphertextBlob) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CiphertextBlob", 1)) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCiphertextBlob sets the CiphertextBlob field's value. -func (s *DecryptInput) SetCiphertextBlob(v []byte) *DecryptInput { - s.CiphertextBlob = v - return s -} - -// SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value. -func (s *DecryptInput) SetEncryptionAlgorithm(v string) *DecryptInput { - s.EncryptionAlgorithm = &v - return s -} - -// SetEncryptionContext sets the EncryptionContext field's value. -func (s *DecryptInput) SetEncryptionContext(v map[string]*string) *DecryptInput { - s.EncryptionContext = v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *DecryptInput) SetGrantTokens(v []*string) *DecryptInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *DecryptInput) SetKeyId(v string) *DecryptInput { - s.KeyId = &v - return s -} - -type DecryptOutput struct { - _ struct{} `type:"structure"` - - // The encryption algorithm that was used to decrypt the ciphertext. - EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key that was used to decrypt the ciphertext. - KeyId *string `min:"1" type:"string"` - - // Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services - // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // - // Plaintext is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by DecryptOutput's - // String and GoString methods. - // - // Plaintext is automatically base64 encoded/decoded by the SDK. - Plaintext []byte `min:"1" type:"blob" sensitive:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DecryptOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DecryptOutput) GoString() string { - return s.String() -} - -// SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value. -func (s *DecryptOutput) SetEncryptionAlgorithm(v string) *DecryptOutput { - s.EncryptionAlgorithm = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *DecryptOutput) SetKeyId(v string) *DecryptOutput { - s.KeyId = &v - return s -} - -// SetPlaintext sets the Plaintext field's value. -func (s *DecryptOutput) SetPlaintext(v []byte) *DecryptOutput { - s.Plaintext = v - return s -} - -type DeleteAliasInput struct { - _ struct{} `type:"structure"` - - // The alias to be deleted. The alias name must begin with alias/ followed by - // the alias name, such as alias/ExampleAlias. - // - // AliasName is a required field - AliasName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAliasInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAliasInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteAliasInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteAliasInput"} - if s.AliasName == nil { - invalidParams.Add(request.NewErrParamRequired("AliasName")) - } - if s.AliasName != nil && len(*s.AliasName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AliasName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAliasName sets the AliasName field's value. -func (s *DeleteAliasInput) SetAliasName(v string) *DeleteAliasInput { - s.AliasName = &v - return s -} - -type DeleteAliasOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAliasOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteAliasOutput) GoString() string { - return s.String() -} - -type DeleteCustomKeyStoreInput struct { - _ struct{} `type:"structure"` - - // Enter the ID of the custom key store you want to delete. To find the ID of - // a custom key store, use the DescribeCustomKeyStores operation. - // - // CustomKeyStoreId is a required field - CustomKeyStoreId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteCustomKeyStoreInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteCustomKeyStoreInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteCustomKeyStoreInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteCustomKeyStoreInput"} - if s.CustomKeyStoreId == nil { - invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId")) - } - if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *DeleteCustomKeyStoreInput) SetCustomKeyStoreId(v string) *DeleteCustomKeyStoreInput { - s.CustomKeyStoreId = &v - return s -} - -type DeleteCustomKeyStoreOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteCustomKeyStoreOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteCustomKeyStoreOutput) GoString() string { - return s.String() -} - -type DeleteImportedKeyMaterialInput struct { - _ struct{} `type:"structure"` - - // Identifies the KMS key from which you are deleting imported key material. - // The Origin of the KMS key must be EXTERNAL. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteImportedKeyMaterialInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteImportedKeyMaterialInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteImportedKeyMaterialInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteImportedKeyMaterialInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *DeleteImportedKeyMaterialInput) SetKeyId(v string) *DeleteImportedKeyMaterialInput { - s.KeyId = &v - return s -} - -type DeleteImportedKeyMaterialOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteImportedKeyMaterialOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DeleteImportedKeyMaterialOutput) GoString() string { - return s.String() -} - -// The system timed out while trying to fulfill the request. The request can -// be retried. -type DependencyTimeoutException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DependencyTimeoutException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DependencyTimeoutException) GoString() string { - return s.String() -} - -func newErrorDependencyTimeoutException(v protocol.ResponseMetadata) error { - return &DependencyTimeoutException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *DependencyTimeoutException) Code() string { - return "DependencyTimeoutException" -} - -// Message returns the exception's message. -func (s *DependencyTimeoutException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *DependencyTimeoutException) OrigErr() error { - return nil -} - -func (s *DependencyTimeoutException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *DependencyTimeoutException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *DependencyTimeoutException) RequestID() string { - return s.RespMetadata.RequestID -} - -type DescribeCustomKeyStoresInput struct { - _ struct{} `type:"structure"` - - // Gets only information about the specified custom key store. Enter the key - // store ID. - // - // By default, this operation gets information about all custom key stores in - // the account and Region. To limit the output to a particular custom key store, - // you can use either the CustomKeyStoreId or CustomKeyStoreName parameter, - // but not both. - CustomKeyStoreId *string `min:"1" type:"string"` - - // Gets only information about the specified custom key store. Enter the friendly - // name of the custom key store. - // - // By default, this operation gets information about all custom key stores in - // the account and Region. To limit the output to a particular custom key store, - // you can use either the CustomKeyStoreId or CustomKeyStoreName parameter, - // but not both. - CustomKeyStoreName *string `min:"1" type:"string"` - - // Use this parameter to specify the maximum number of items to return. When - // this value is present, KMS does not return more than the specified number - // of items, but it might return fewer. - Limit *int64 `min:"1" type:"integer"` - - // Use this parameter in a subsequent request after you receive a response with - // truncated results. Set it to the value of NextMarker from the truncated response - // you just received. - Marker *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeCustomKeyStoresInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeCustomKeyStoresInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeCustomKeyStoresInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeCustomKeyStoresInput"} - if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1)) - } - if s.CustomKeyStoreName != nil && len(*s.CustomKeyStoreName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreName", 1)) - } - if s.Limit != nil && *s.Limit < 1 { - invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) - } - if s.Marker != nil && len(*s.Marker) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Marker", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *DescribeCustomKeyStoresInput) SetCustomKeyStoreId(v string) *DescribeCustomKeyStoresInput { - s.CustomKeyStoreId = &v - return s -} - -// SetCustomKeyStoreName sets the CustomKeyStoreName field's value. -func (s *DescribeCustomKeyStoresInput) SetCustomKeyStoreName(v string) *DescribeCustomKeyStoresInput { - s.CustomKeyStoreName = &v - return s -} - -// SetLimit sets the Limit field's value. -func (s *DescribeCustomKeyStoresInput) SetLimit(v int64) *DescribeCustomKeyStoresInput { - s.Limit = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *DescribeCustomKeyStoresInput) SetMarker(v string) *DescribeCustomKeyStoresInput { - s.Marker = &v - return s -} - -type DescribeCustomKeyStoresOutput struct { - _ struct{} `type:"structure"` - - // Contains metadata about each custom key store. - CustomKeyStores []*CustomKeyStoresListEntry `type:"list"` - - // When Truncated is true, this element is present and contains the value to - // use for the Marker parameter in a subsequent request. - NextMarker *string `min:"1" type:"string"` - - // A flag that indicates whether there are more items in the list. When this - // value is true, the list in this response is truncated. To get more items, - // pass the value of the NextMarker element in thisresponse to the Marker parameter - // in a subsequent request. - Truncated *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeCustomKeyStoresOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeCustomKeyStoresOutput) GoString() string { - return s.String() -} - -// SetCustomKeyStores sets the CustomKeyStores field's value. -func (s *DescribeCustomKeyStoresOutput) SetCustomKeyStores(v []*CustomKeyStoresListEntry) *DescribeCustomKeyStoresOutput { - s.CustomKeyStores = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *DescribeCustomKeyStoresOutput) SetNextMarker(v string) *DescribeCustomKeyStoresOutput { - s.NextMarker = &v - return s -} - -// SetTruncated sets the Truncated field's value. -func (s *DescribeCustomKeyStoresOutput) SetTruncated(v bool) *DescribeCustomKeyStoresOutput { - s.Truncated = &v - return s -} - -type DescribeKeyInput struct { - _ struct{} `type:"structure"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Describes the specified KMS key. - // - // If you specify a predefined Amazon Web Services alias (an Amazon Web Services - // alias with no key ID), KMS associates the alias with an Amazon Web Services - // managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk) - // and returns its KeyId and Arn in the response. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeKeyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeKeyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeKeyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeKeyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *DescribeKeyInput) SetGrantTokens(v []*string) *DescribeKeyInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *DescribeKeyInput) SetKeyId(v string) *DescribeKeyInput { - s.KeyId = &v - return s -} - -type DescribeKeyOutput struct { - _ struct{} `type:"structure"` - - // Metadata associated with the key. - KeyMetadata *KeyMetadata `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeKeyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DescribeKeyOutput) GoString() string { - return s.String() -} - -// SetKeyMetadata sets the KeyMetadata field's value. -func (s *DescribeKeyOutput) SetKeyMetadata(v *KeyMetadata) *DescribeKeyOutput { - s.KeyMetadata = v - return s -} - -type DisableKeyInput struct { - _ struct{} `type:"structure"` - - // Identifies the KMS key to disable. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DisableKeyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DisableKeyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *DisableKeyInput) SetKeyId(v string) *DisableKeyInput { - s.KeyId = &v - return s -} - -type DisableKeyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyOutput) GoString() string { - return s.String() -} - -type DisableKeyRotationInput struct { - _ struct{} `type:"structure"` - - // Identifies a symmetric encryption KMS key. You cannot enable or disable automatic - // rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html#asymmetric-cmks), - // HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html), - // KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html), - // or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyRotationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyRotationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DisableKeyRotationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DisableKeyRotationInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *DisableKeyRotationInput) SetKeyId(v string) *DisableKeyRotationInput { - s.KeyId = &v - return s -} - -type DisableKeyRotationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyRotationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisableKeyRotationOutput) GoString() string { - return s.String() -} - -// The request was rejected because the specified KMS key is not enabled. -type DisabledException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisabledException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisabledException) GoString() string { - return s.String() -} - -func newErrorDisabledException(v protocol.ResponseMetadata) error { - return &DisabledException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *DisabledException) Code() string { - return "DisabledException" -} - -// Message returns the exception's message. -func (s *DisabledException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *DisabledException) OrigErr() error { - return nil -} - -func (s *DisabledException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *DisabledException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *DisabledException) RequestID() string { - return s.RespMetadata.RequestID -} - -type DisconnectCustomKeyStoreInput struct { - _ struct{} `type:"structure"` - - // Enter the ID of the custom key store you want to disconnect. To find the - // ID of a custom key store, use the DescribeCustomKeyStores operation. - // - // CustomKeyStoreId is a required field - CustomKeyStoreId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisconnectCustomKeyStoreInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisconnectCustomKeyStoreInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DisconnectCustomKeyStoreInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DisconnectCustomKeyStoreInput"} - if s.CustomKeyStoreId == nil { - invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId")) - } - if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *DisconnectCustomKeyStoreInput) SetCustomKeyStoreId(v string) *DisconnectCustomKeyStoreInput { - s.CustomKeyStoreId = &v - return s -} - -type DisconnectCustomKeyStoreOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisconnectCustomKeyStoreOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s DisconnectCustomKeyStoreOutput) GoString() string { - return s.String() -} - -type EnableKeyInput struct { - _ struct{} `type:"structure"` - - // Identifies the KMS key to enable. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *EnableKeyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EnableKeyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *EnableKeyInput) SetKeyId(v string) *EnableKeyInput { - s.KeyId = &v - return s -} - -type EnableKeyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyOutput) GoString() string { - return s.String() -} - -type EnableKeyRotationInput struct { - _ struct{} `type:"structure"` - - // Identifies a symmetric encryption KMS key. You cannot enable or disable automatic - // rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html), - // HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html), - // KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html), - // or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). - // The key rotation status of these KMS keys is always false. To enable or disable - // automatic rotation of a set of related multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate), - // set the property on the primary key. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyRotationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyRotationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *EnableKeyRotationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EnableKeyRotationInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *EnableKeyRotationInput) SetKeyId(v string) *EnableKeyRotationInput { - s.KeyId = &v - return s -} - -type EnableKeyRotationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyRotationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EnableKeyRotationOutput) GoString() string { - return s.String() -} - -type EncryptInput struct { - _ struct{} `type:"structure"` - - // Specifies the encryption algorithm that KMS will use to encrypt the plaintext - // message. The algorithm must be compatible with the KMS key that you specify. - // - // This parameter is required only for asymmetric KMS keys. The default value, - // SYMMETRIC_DEFAULT, is the algorithm used for symmetric encryption KMS keys. - // If you are using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256. - EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // Specifies the encryption context that will be used to encrypt the data. An - // encryption context is valid only for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) - // with a symmetric encryption KMS key. The standard asymmetric encryption algorithms - // and HMAC algorithms that KMS uses do not support an encryption context. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - EncryptionContext map[string]*string `type:"map"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Identifies the KMS key to use in the encryption operation. The KMS key must - // have a KeyUsage of ENCRYPT_DECRYPT. To find the KeyUsage of a KMS key, use - // the DescribeKey operation. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Data to be encrypted. - // - // Plaintext is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by EncryptInput's - // String and GoString methods. - // - // Plaintext is automatically base64 encoded/decoded by the SDK. - // - // Plaintext is a required field - Plaintext []byte `min:"1" type:"blob" required:"true" sensitive:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EncryptInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EncryptInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *EncryptInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EncryptInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Plaintext == nil { - invalidParams.Add(request.NewErrParamRequired("Plaintext")) - } - if s.Plaintext != nil && len(s.Plaintext) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Plaintext", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value. -func (s *EncryptInput) SetEncryptionAlgorithm(v string) *EncryptInput { - s.EncryptionAlgorithm = &v - return s -} - -// SetEncryptionContext sets the EncryptionContext field's value. -func (s *EncryptInput) SetEncryptionContext(v map[string]*string) *EncryptInput { - s.EncryptionContext = v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *EncryptInput) SetGrantTokens(v []*string) *EncryptInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *EncryptInput) SetKeyId(v string) *EncryptInput { - s.KeyId = &v - return s -} - -// SetPlaintext sets the Plaintext field's value. -func (s *EncryptInput) SetPlaintext(v []byte) *EncryptInput { - s.Plaintext = v - return s -} - -type EncryptOutput struct { - _ struct{} `type:"structure"` - - // The encrypted plaintext. When you use the HTTP API or the Amazon Web Services - // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // CiphertextBlob is automatically base64 encoded/decoded by the SDK. - CiphertextBlob []byte `min:"1" type:"blob"` - - // The encryption algorithm that was used to encrypt the plaintext. - EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key that was used to encrypt the plaintext. - KeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EncryptOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s EncryptOutput) GoString() string { - return s.String() -} - -// SetCiphertextBlob sets the CiphertextBlob field's value. -func (s *EncryptOutput) SetCiphertextBlob(v []byte) *EncryptOutput { - s.CiphertextBlob = v - return s -} - -// SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value. -func (s *EncryptOutput) SetEncryptionAlgorithm(v string) *EncryptOutput { - s.EncryptionAlgorithm = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *EncryptOutput) SetKeyId(v string) *EncryptOutput { - s.KeyId = &v - return s -} - -// The request was rejected because the specified import token is expired. Use -// GetParametersForImport to get a new import token and public key, use the -// new public key to encrypt the key material, and then try the request again. -type ExpiredImportTokenException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExpiredImportTokenException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ExpiredImportTokenException) GoString() string { - return s.String() -} - -func newErrorExpiredImportTokenException(v protocol.ResponseMetadata) error { - return &ExpiredImportTokenException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *ExpiredImportTokenException) Code() string { - return "ExpiredImportTokenException" -} - -// Message returns the exception's message. -func (s *ExpiredImportTokenException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *ExpiredImportTokenException) OrigErr() error { - return nil -} - -func (s *ExpiredImportTokenException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *ExpiredImportTokenException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *ExpiredImportTokenException) RequestID() string { - return s.RespMetadata.RequestID -} - -type GenerateDataKeyInput struct { - _ struct{} `type:"structure"` - - // Specifies the encryption context that will be used when encrypting the data - // key. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - EncryptionContext map[string]*string `type:"map"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Specifies the symmetric encryption KMS key that encrypts the data key. You - // cannot specify an asymmetric KMS key or a KMS key in a custom key store. - // To get the type and origin of your KMS key, use the DescribeKey operation. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Specifies the length of the data key. Use AES_128 to generate a 128-bit symmetric - // key, or AES_256 to generate a 256-bit symmetric key. - // - // You must specify either the KeySpec or the NumberOfBytes parameter (but not - // both) in every GenerateDataKey request. - KeySpec *string `type:"string" enum:"DataKeySpec"` - - // Specifies the length of the data key in bytes. For example, use the value - // 64 to generate a 512-bit data key (64 bytes is 512 bits). For 128-bit (16-byte) - // and 256-bit (32-byte) data keys, use the KeySpec parameter. - // - // You must specify either the KeySpec or the NumberOfBytes parameter (but not - // both) in every GenerateDataKey request. - NumberOfBytes *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GenerateDataKeyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GenerateDataKeyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.NumberOfBytes != nil && *s.NumberOfBytes < 1 { - invalidParams.Add(request.NewErrParamMinValue("NumberOfBytes", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptionContext sets the EncryptionContext field's value. -func (s *GenerateDataKeyInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyInput { - s.EncryptionContext = v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *GenerateDataKeyInput) SetGrantTokens(v []*string) *GenerateDataKeyInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyInput) SetKeyId(v string) *GenerateDataKeyInput { - s.KeyId = &v - return s -} - -// SetKeySpec sets the KeySpec field's value. -func (s *GenerateDataKeyInput) SetKeySpec(v string) *GenerateDataKeyInput { - s.KeySpec = &v - return s -} - -// SetNumberOfBytes sets the NumberOfBytes field's value. -func (s *GenerateDataKeyInput) SetNumberOfBytes(v int64) *GenerateDataKeyInput { - s.NumberOfBytes = &v - return s -} - -type GenerateDataKeyOutput struct { - _ struct{} `type:"structure"` - - // The encrypted copy of the data key. When you use the HTTP API or the Amazon - // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // CiphertextBlob is automatically base64 encoded/decoded by the SDK. - CiphertextBlob []byte `min:"1" type:"blob"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key that encrypted the data key. - KeyId *string `min:"1" type:"string"` - - // The plaintext data key. When you use the HTTP API or the Amazon Web Services - // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. Use - // this data key to encrypt your data outside of KMS. Then, remove it from memory - // as soon as possible. - // - // Plaintext is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by GenerateDataKeyOutput's - // String and GoString methods. - // - // Plaintext is automatically base64 encoded/decoded by the SDK. - Plaintext []byte `min:"1" type:"blob" sensitive:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyOutput) GoString() string { - return s.String() -} - -// SetCiphertextBlob sets the CiphertextBlob field's value. -func (s *GenerateDataKeyOutput) SetCiphertextBlob(v []byte) *GenerateDataKeyOutput { - s.CiphertextBlob = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyOutput) SetKeyId(v string) *GenerateDataKeyOutput { - s.KeyId = &v - return s -} - -// SetPlaintext sets the Plaintext field's value. -func (s *GenerateDataKeyOutput) SetPlaintext(v []byte) *GenerateDataKeyOutput { - s.Plaintext = v - return s -} - -type GenerateDataKeyPairInput struct { - _ struct{} `type:"structure"` - - // Specifies the encryption context that will be used when encrypting the private - // key in the data key pair. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - EncryptionContext map[string]*string `type:"map"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Specifies the symmetric encryption KMS key that encrypts the private key - // in the data key pair. You cannot specify an asymmetric KMS key or a KMS key - // in a custom key store. To get the type and origin of your KMS key, use the - // DescribeKey operation. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Determines the type of data key pair that is generated. - // - // The KMS rule that restricts the use of asymmetric RSA and SM2 KMS keys to - // encrypt and decrypt or to sign and verify (but not both), and the rule that - // permits you to use ECC KMS keys only to sign and verify, are not effective - // on data key pairs, which are used outside of KMS. The SM2 key spec is only - // available in China Regions. RSA and ECC asymmetric key pairs are also available - // in China Regions. - // - // KeyPairSpec is a required field - KeyPairSpec *string `type:"string" required:"true" enum:"DataKeyPairSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GenerateDataKeyPairInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GenerateDataKeyPairInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.KeyPairSpec == nil { - invalidParams.Add(request.NewErrParamRequired("KeyPairSpec")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptionContext sets the EncryptionContext field's value. -func (s *GenerateDataKeyPairInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyPairInput { - s.EncryptionContext = v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *GenerateDataKeyPairInput) SetGrantTokens(v []*string) *GenerateDataKeyPairInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyPairInput) SetKeyId(v string) *GenerateDataKeyPairInput { - s.KeyId = &v - return s -} - -// SetKeyPairSpec sets the KeyPairSpec field's value. -func (s *GenerateDataKeyPairInput) SetKeyPairSpec(v string) *GenerateDataKeyPairInput { - s.KeyPairSpec = &v - return s -} - -type GenerateDataKeyPairOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key that encrypted the private key. - KeyId *string `min:"1" type:"string"` - - // The type of data key pair that was generated. - KeyPairSpec *string `type:"string" enum:"DataKeyPairSpec"` - - // The encrypted copy of the private key. When you use the HTTP API or the Amazon - // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // PrivateKeyCiphertextBlob is automatically base64 encoded/decoded by the SDK. - PrivateKeyCiphertextBlob []byte `min:"1" type:"blob"` - - // The plaintext copy of the private key. When you use the HTTP API or the Amazon - // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // - // PrivateKeyPlaintext is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by GenerateDataKeyPairOutput's - // String and GoString methods. - // - // PrivateKeyPlaintext is automatically base64 encoded/decoded by the SDK. - PrivateKeyPlaintext []byte `min:"1" type:"blob" sensitive:"true"` - - // The public key (in plaintext). When you use the HTTP API or the Amazon Web - // Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // PublicKey is automatically base64 encoded/decoded by the SDK. - PublicKey []byte `min:"1" type:"blob"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairOutput) GoString() string { - return s.String() -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyPairOutput) SetKeyId(v string) *GenerateDataKeyPairOutput { - s.KeyId = &v - return s -} - -// SetKeyPairSpec sets the KeyPairSpec field's value. -func (s *GenerateDataKeyPairOutput) SetKeyPairSpec(v string) *GenerateDataKeyPairOutput { - s.KeyPairSpec = &v - return s -} - -// SetPrivateKeyCiphertextBlob sets the PrivateKeyCiphertextBlob field's value. -func (s *GenerateDataKeyPairOutput) SetPrivateKeyCiphertextBlob(v []byte) *GenerateDataKeyPairOutput { - s.PrivateKeyCiphertextBlob = v - return s -} - -// SetPrivateKeyPlaintext sets the PrivateKeyPlaintext field's value. -func (s *GenerateDataKeyPairOutput) SetPrivateKeyPlaintext(v []byte) *GenerateDataKeyPairOutput { - s.PrivateKeyPlaintext = v - return s -} - -// SetPublicKey sets the PublicKey field's value. -func (s *GenerateDataKeyPairOutput) SetPublicKey(v []byte) *GenerateDataKeyPairOutput { - s.PublicKey = v - return s -} - -type GenerateDataKeyPairWithoutPlaintextInput struct { - _ struct{} `type:"structure"` - - // Specifies the encryption context that will be used when encrypting the private - // key in the data key pair. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - EncryptionContext map[string]*string `type:"map"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Specifies the symmetric encryption KMS key that encrypts the private key - // in the data key pair. You cannot specify an asymmetric KMS key or a KMS key - // in a custom key store. To get the type and origin of your KMS key, use the - // DescribeKey operation. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Determines the type of data key pair that is generated. - // - // The KMS rule that restricts the use of asymmetric RSA and SM2 KMS keys to - // encrypt and decrypt or to sign and verify (but not both), and the rule that - // permits you to use ECC KMS keys only to sign and verify, are not effective - // on data key pairs, which are used outside of KMS. The SM2 key spec is only - // available in China Regions. RSA and ECC asymmetric key pairs are also available - // in China Regions. - // - // KeyPairSpec is a required field - KeyPairSpec *string `type:"string" required:"true" enum:"DataKeyPairSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairWithoutPlaintextInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairWithoutPlaintextInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GenerateDataKeyPairWithoutPlaintextInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GenerateDataKeyPairWithoutPlaintextInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.KeyPairSpec == nil { - invalidParams.Add(request.NewErrParamRequired("KeyPairSpec")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptionContext sets the EncryptionContext field's value. -func (s *GenerateDataKeyPairWithoutPlaintextInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyPairWithoutPlaintextInput { - s.EncryptionContext = v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *GenerateDataKeyPairWithoutPlaintextInput) SetGrantTokens(v []*string) *GenerateDataKeyPairWithoutPlaintextInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyPairWithoutPlaintextInput) SetKeyId(v string) *GenerateDataKeyPairWithoutPlaintextInput { - s.KeyId = &v - return s -} - -// SetKeyPairSpec sets the KeyPairSpec field's value. -func (s *GenerateDataKeyPairWithoutPlaintextInput) SetKeyPairSpec(v string) *GenerateDataKeyPairWithoutPlaintextInput { - s.KeyPairSpec = &v - return s -} - -type GenerateDataKeyPairWithoutPlaintextOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key that encrypted the private key. - KeyId *string `min:"1" type:"string"` - - // The type of data key pair that was generated. - KeyPairSpec *string `type:"string" enum:"DataKeyPairSpec"` - - // The encrypted copy of the private key. When you use the HTTP API or the Amazon - // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // PrivateKeyCiphertextBlob is automatically base64 encoded/decoded by the SDK. - PrivateKeyCiphertextBlob []byte `min:"1" type:"blob"` - - // The public key (in plaintext). When you use the HTTP API or the Amazon Web - // Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // PublicKey is automatically base64 encoded/decoded by the SDK. - PublicKey []byte `min:"1" type:"blob"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairWithoutPlaintextOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyPairWithoutPlaintextOutput) GoString() string { - return s.String() -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetKeyId(v string) *GenerateDataKeyPairWithoutPlaintextOutput { - s.KeyId = &v - return s -} - -// SetKeyPairSpec sets the KeyPairSpec field's value. -func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetKeyPairSpec(v string) *GenerateDataKeyPairWithoutPlaintextOutput { - s.KeyPairSpec = &v - return s -} - -// SetPrivateKeyCiphertextBlob sets the PrivateKeyCiphertextBlob field's value. -func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetPrivateKeyCiphertextBlob(v []byte) *GenerateDataKeyPairWithoutPlaintextOutput { - s.PrivateKeyCiphertextBlob = v - return s -} - -// SetPublicKey sets the PublicKey field's value. -func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetPublicKey(v []byte) *GenerateDataKeyPairWithoutPlaintextOutput { - s.PublicKey = v - return s -} - -type GenerateDataKeyWithoutPlaintextInput struct { - _ struct{} `type:"structure"` - - // Specifies the encryption context that will be used when encrypting the data - // key. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - EncryptionContext map[string]*string `type:"map"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Specifies the symmetric encryption KMS key that encrypts the data key. You - // cannot specify an asymmetric KMS key or a KMS key in a custom key store. - // To get the type and origin of your KMS key, use the DescribeKey operation. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The length of the data key. Use AES_128 to generate a 128-bit symmetric key, - // or AES_256 to generate a 256-bit symmetric key. - KeySpec *string `type:"string" enum:"DataKeySpec"` - - // The length of the data key in bytes. For example, use the value 64 to generate - // a 512-bit data key (64 bytes is 512 bits). For common key lengths (128-bit - // and 256-bit symmetric keys), we recommend that you use the KeySpec field - // instead of this one. - NumberOfBytes *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyWithoutPlaintextInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyWithoutPlaintextInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GenerateDataKeyWithoutPlaintextInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GenerateDataKeyWithoutPlaintextInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.NumberOfBytes != nil && *s.NumberOfBytes < 1 { - invalidParams.Add(request.NewErrParamMinValue("NumberOfBytes", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptionContext sets the EncryptionContext field's value. -func (s *GenerateDataKeyWithoutPlaintextInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyWithoutPlaintextInput { - s.EncryptionContext = v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *GenerateDataKeyWithoutPlaintextInput) SetGrantTokens(v []*string) *GenerateDataKeyWithoutPlaintextInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyWithoutPlaintextInput) SetKeyId(v string) *GenerateDataKeyWithoutPlaintextInput { - s.KeyId = &v - return s -} - -// SetKeySpec sets the KeySpec field's value. -func (s *GenerateDataKeyWithoutPlaintextInput) SetKeySpec(v string) *GenerateDataKeyWithoutPlaintextInput { - s.KeySpec = &v - return s -} - -// SetNumberOfBytes sets the NumberOfBytes field's value. -func (s *GenerateDataKeyWithoutPlaintextInput) SetNumberOfBytes(v int64) *GenerateDataKeyWithoutPlaintextInput { - s.NumberOfBytes = &v - return s -} - -type GenerateDataKeyWithoutPlaintextOutput struct { - _ struct{} `type:"structure"` - - // The encrypted data key. When you use the HTTP API or the Amazon Web Services - // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // CiphertextBlob is automatically base64 encoded/decoded by the SDK. - CiphertextBlob []byte `min:"1" type:"blob"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key that encrypted the data key. - KeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyWithoutPlaintextOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateDataKeyWithoutPlaintextOutput) GoString() string { - return s.String() -} - -// SetCiphertextBlob sets the CiphertextBlob field's value. -func (s *GenerateDataKeyWithoutPlaintextOutput) SetCiphertextBlob(v []byte) *GenerateDataKeyWithoutPlaintextOutput { - s.CiphertextBlob = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateDataKeyWithoutPlaintextOutput) SetKeyId(v string) *GenerateDataKeyWithoutPlaintextOutput { - s.KeyId = &v - return s -} - -type GenerateMacInput struct { - _ struct{} `type:"structure"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // The HMAC KMS key to use in the operation. The MAC algorithm computes the - // HMAC for the message and the key as described in RFC 2104 (https://datatracker.ietf.org/doc/html/rfc2104). - // - // To identify an HMAC KMS key, use the DescribeKey operation and see the KeySpec - // field in the response. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The MAC algorithm used in the operation. - // - // The algorithm must be compatible with the HMAC KMS key that you specify. - // To find the MAC algorithms that your HMAC KMS key supports, use the DescribeKey - // operation and see the MacAlgorithms field in the DescribeKey response. - // - // MacAlgorithm is a required field - MacAlgorithm *string `type:"string" required:"true" enum:"MacAlgorithmSpec"` - - // The message to be hashed. Specify a message of up to 4,096 bytes. - // - // GenerateMac and VerifyMac do not provide special handling for message digests. - // If you generate an HMAC for a hash digest of a message, you must verify the - // HMAC of the same hash digest. - // - // Message is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by GenerateMacInput's - // String and GoString methods. - // - // Message is automatically base64 encoded/decoded by the SDK. - // - // Message is a required field - Message []byte `min:"1" type:"blob" required:"true" sensitive:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateMacInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateMacInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GenerateMacInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GenerateMacInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.MacAlgorithm == nil { - invalidParams.Add(request.NewErrParamRequired("MacAlgorithm")) - } - if s.Message == nil { - invalidParams.Add(request.NewErrParamRequired("Message")) - } - if s.Message != nil && len(s.Message) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Message", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *GenerateMacInput) SetGrantTokens(v []*string) *GenerateMacInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateMacInput) SetKeyId(v string) *GenerateMacInput { - s.KeyId = &v - return s -} - -// SetMacAlgorithm sets the MacAlgorithm field's value. -func (s *GenerateMacInput) SetMacAlgorithm(v string) *GenerateMacInput { - s.MacAlgorithm = &v - return s -} - -// SetMessage sets the Message field's value. -func (s *GenerateMacInput) SetMessage(v []byte) *GenerateMacInput { - s.Message = v - return s -} - -type GenerateMacOutput struct { - _ struct{} `type:"structure"` - - // The HMAC KMS key used in the operation. - KeyId *string `min:"1" type:"string"` - - // The hash-based message authentication code (HMAC) for the given message, - // key, and MAC algorithm. - // Mac is automatically base64 encoded/decoded by the SDK. - Mac []byte `min:"1" type:"blob"` - - // The MAC algorithm that was used to generate the HMAC. - MacAlgorithm *string `type:"string" enum:"MacAlgorithmSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateMacOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateMacOutput) GoString() string { - return s.String() -} - -// SetKeyId sets the KeyId field's value. -func (s *GenerateMacOutput) SetKeyId(v string) *GenerateMacOutput { - s.KeyId = &v - return s -} - -// SetMac sets the Mac field's value. -func (s *GenerateMacOutput) SetMac(v []byte) *GenerateMacOutput { - s.Mac = v - return s -} - -// SetMacAlgorithm sets the MacAlgorithm field's value. -func (s *GenerateMacOutput) SetMacAlgorithm(v string) *GenerateMacOutput { - s.MacAlgorithm = &v - return s -} - -type GenerateRandomInput struct { - _ struct{} `type:"structure"` - - // Generates the random byte string in the CloudHSM cluster that is associated - // with the specified custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). - // To find the ID of a custom key store, use the DescribeCustomKeyStores operation. - CustomKeyStoreId *string `min:"1" type:"string"` - - // The length of the random byte string. This parameter is required. - NumberOfBytes *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateRandomInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateRandomInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GenerateRandomInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GenerateRandomInput"} - if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1)) - } - if s.NumberOfBytes != nil && *s.NumberOfBytes < 1 { - invalidParams.Add(request.NewErrParamMinValue("NumberOfBytes", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *GenerateRandomInput) SetCustomKeyStoreId(v string) *GenerateRandomInput { - s.CustomKeyStoreId = &v - return s -} - -// SetNumberOfBytes sets the NumberOfBytes field's value. -func (s *GenerateRandomInput) SetNumberOfBytes(v int64) *GenerateRandomInput { - s.NumberOfBytes = &v - return s -} - -type GenerateRandomOutput struct { - _ struct{} `type:"structure"` - - // The random byte string. When you use the HTTP API or the Amazon Web Services - // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // - // Plaintext is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by GenerateRandomOutput's - // String and GoString methods. - // - // Plaintext is automatically base64 encoded/decoded by the SDK. - Plaintext []byte `min:"1" type:"blob" sensitive:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateRandomOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GenerateRandomOutput) GoString() string { - return s.String() -} - -// SetPlaintext sets the Plaintext field's value. -func (s *GenerateRandomOutput) SetPlaintext(v []byte) *GenerateRandomOutput { - s.Plaintext = v - return s -} - -type GetKeyPolicyInput struct { - _ struct{} `type:"structure"` - - // Gets the key policy for the specified KMS key. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Specifies the name of the key policy. The only valid name is default. To - // get the names of key policies, use ListKeyPolicies. - // - // PolicyName is a required field - PolicyName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetKeyPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetKeyPolicyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - if s.PolicyName != nil && len(*s.PolicyName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *GetKeyPolicyInput) SetKeyId(v string) *GetKeyPolicyInput { - s.KeyId = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *GetKeyPolicyInput) SetPolicyName(v string) *GetKeyPolicyInput { - s.PolicyName = &v - return s -} - -type GetKeyPolicyOutput struct { - _ struct{} `type:"structure"` - - // A key policy document in JSON format. - Policy *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyPolicyOutput) GoString() string { - return s.String() -} - -// SetPolicy sets the Policy field's value. -func (s *GetKeyPolicyOutput) SetPolicy(v string) *GetKeyPolicyOutput { - s.Policy = &v - return s -} - -type GetKeyRotationStatusInput struct { - _ struct{} `type:"structure"` - - // Gets the rotation status for the specified KMS key. - // - // Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different - // Amazon Web Services account, you must use the key ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyRotationStatusInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyRotationStatusInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetKeyRotationStatusInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetKeyRotationStatusInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *GetKeyRotationStatusInput) SetKeyId(v string) *GetKeyRotationStatusInput { - s.KeyId = &v - return s -} - -type GetKeyRotationStatusOutput struct { - _ struct{} `type:"structure"` - - // A Boolean value that specifies whether key rotation is enabled. - KeyRotationEnabled *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyRotationStatusOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetKeyRotationStatusOutput) GoString() string { - return s.String() -} - -// SetKeyRotationEnabled sets the KeyRotationEnabled field's value. -func (s *GetKeyRotationStatusOutput) SetKeyRotationEnabled(v bool) *GetKeyRotationStatusOutput { - s.KeyRotationEnabled = &v - return s -} - -type GetParametersForImportInput struct { - _ struct{} `type:"structure"` - - // The identifier of the symmetric encryption KMS key into which you will import - // key material. The Origin of the KMS key must be EXTERNAL. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The algorithm you will use to encrypt the key material before importing it - // with ImportKeyMaterial. For more information, see Encrypt the Key Material - // (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-encrypt-key-material.html) - // in the Key Management Service Developer Guide. - // - // WrappingAlgorithm is a required field - WrappingAlgorithm *string `type:"string" required:"true" enum:"AlgorithmSpec"` - - // The type of wrapping key (public key) to return in the response. Only 2048-bit - // RSA public keys are supported. - // - // WrappingKeySpec is a required field - WrappingKeySpec *string `type:"string" required:"true" enum:"WrappingKeySpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetParametersForImportInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetParametersForImportInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetParametersForImportInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetParametersForImportInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.WrappingAlgorithm == nil { - invalidParams.Add(request.NewErrParamRequired("WrappingAlgorithm")) - } - if s.WrappingKeySpec == nil { - invalidParams.Add(request.NewErrParamRequired("WrappingKeySpec")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *GetParametersForImportInput) SetKeyId(v string) *GetParametersForImportInput { - s.KeyId = &v - return s -} - -// SetWrappingAlgorithm sets the WrappingAlgorithm field's value. -func (s *GetParametersForImportInput) SetWrappingAlgorithm(v string) *GetParametersForImportInput { - s.WrappingAlgorithm = &v - return s -} - -// SetWrappingKeySpec sets the WrappingKeySpec field's value. -func (s *GetParametersForImportInput) SetWrappingKeySpec(v string) *GetParametersForImportInput { - s.WrappingKeySpec = &v - return s -} - -type GetParametersForImportOutput struct { - _ struct{} `type:"structure"` - - // The import token to send in a subsequent ImportKeyMaterial request. - // ImportToken is automatically base64 encoded/decoded by the SDK. - ImportToken []byte `min:"1" type:"blob"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key to use in a subsequent ImportKeyMaterial request. This is - // the same KMS key specified in the GetParametersForImport request. - KeyId *string `min:"1" type:"string"` - - // The time at which the import token and public key are no longer valid. After - // this time, you cannot use them to make an ImportKeyMaterial request and you - // must send another GetParametersForImport request to get new ones. - ParametersValidTo *time.Time `type:"timestamp"` - - // The public key to use to encrypt the key material before importing it with - // ImportKeyMaterial. - // - // PublicKey is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by GetParametersForImportOutput's - // String and GoString methods. - // - // PublicKey is automatically base64 encoded/decoded by the SDK. - PublicKey []byte `min:"1" type:"blob" sensitive:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetParametersForImportOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetParametersForImportOutput) GoString() string { - return s.String() -} - -// SetImportToken sets the ImportToken field's value. -func (s *GetParametersForImportOutput) SetImportToken(v []byte) *GetParametersForImportOutput { - s.ImportToken = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GetParametersForImportOutput) SetKeyId(v string) *GetParametersForImportOutput { - s.KeyId = &v - return s -} - -// SetParametersValidTo sets the ParametersValidTo field's value. -func (s *GetParametersForImportOutput) SetParametersValidTo(v time.Time) *GetParametersForImportOutput { - s.ParametersValidTo = &v - return s -} - -// SetPublicKey sets the PublicKey field's value. -func (s *GetParametersForImportOutput) SetPublicKey(v []byte) *GetParametersForImportOutput { - s.PublicKey = v - return s -} - -type GetPublicKeyInput struct { - _ struct{} `type:"structure"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Identifies the asymmetric KMS key that includes the public key. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPublicKeyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPublicKeyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetPublicKeyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetPublicKeyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *GetPublicKeyInput) SetGrantTokens(v []*string) *GetPublicKeyInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GetPublicKeyInput) SetKeyId(v string) *GetPublicKeyInput { - s.KeyId = &v - return s -} - -type GetPublicKeyOutput struct { - _ struct{} `type:"structure"` - - // Instead, use the KeySpec field in the GetPublicKey response. - // - // The KeySpec and CustomerMasterKeySpec fields have the same value. We recommend - // that you use the KeySpec field in your code. However, to avoid breaking changes, - // KMS will support both fields. - // - // Deprecated: This field has been deprecated. Instead, use the KeySpec field. - CustomerMasterKeySpec *string `deprecated:"true" type:"string" enum:"CustomerMasterKeySpec"` - - // The encryption algorithms that KMS supports for this key. - // - // This information is critical. If a public key encrypts data outside of KMS - // by using an unsupported encryption algorithm, the ciphertext cannot be decrypted. - // - // This field appears in the response only when the KeyUsage of the public key - // is ENCRYPT_DECRYPT. - EncryptionAlgorithms []*string `type:"list" enum:"EncryptionAlgorithmSpec"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the asymmetric KMS key from which the public key was downloaded. - KeyId *string `min:"1" type:"string"` - - // The type of the of the public key that was downloaded. - KeySpec *string `type:"string" enum:"KeySpec"` - - // The permitted use of the public key. Valid values are ENCRYPT_DECRYPT or - // SIGN_VERIFY. - // - // This information is critical. If a public key with SIGN_VERIFY key usage - // encrypts data outside of KMS, the ciphertext cannot be decrypted. - KeyUsage *string `type:"string" enum:"KeyUsageType"` - - // The exported public key. - // - // The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo - // (SPKI), as defined in RFC 5280 (https://tools.ietf.org/html/rfc5280). When - // you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. - // Otherwise, it is not Base64-encoded. - // PublicKey is automatically base64 encoded/decoded by the SDK. - PublicKey []byte `min:"1" type:"blob"` - - // The signing algorithms that KMS supports for this key. - // - // This field appears in the response only when the KeyUsage of the public key - // is SIGN_VERIFY. - SigningAlgorithms []*string `type:"list" enum:"SigningAlgorithmSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPublicKeyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GetPublicKeyOutput) GoString() string { - return s.String() -} - -// SetCustomerMasterKeySpec sets the CustomerMasterKeySpec field's value. -func (s *GetPublicKeyOutput) SetCustomerMasterKeySpec(v string) *GetPublicKeyOutput { - s.CustomerMasterKeySpec = &v - return s -} - -// SetEncryptionAlgorithms sets the EncryptionAlgorithms field's value. -func (s *GetPublicKeyOutput) SetEncryptionAlgorithms(v []*string) *GetPublicKeyOutput { - s.EncryptionAlgorithms = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GetPublicKeyOutput) SetKeyId(v string) *GetPublicKeyOutput { - s.KeyId = &v - return s -} - -// SetKeySpec sets the KeySpec field's value. -func (s *GetPublicKeyOutput) SetKeySpec(v string) *GetPublicKeyOutput { - s.KeySpec = &v - return s -} - -// SetKeyUsage sets the KeyUsage field's value. -func (s *GetPublicKeyOutput) SetKeyUsage(v string) *GetPublicKeyOutput { - s.KeyUsage = &v - return s -} - -// SetPublicKey sets the PublicKey field's value. -func (s *GetPublicKeyOutput) SetPublicKey(v []byte) *GetPublicKeyOutput { - s.PublicKey = v - return s -} - -// SetSigningAlgorithms sets the SigningAlgorithms field's value. -func (s *GetPublicKeyOutput) SetSigningAlgorithms(v []*string) *GetPublicKeyOutput { - s.SigningAlgorithms = v - return s -} - -// Use this structure to allow cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) -// in the grant only when the operation request includes the specified encryption -// context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context). -// -// KMS applies the grant constraints only to cryptographic operations that support -// an encryption context, that is, all cryptographic operations with a symmetric -// encryption KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-concepts.html#symmetric-cmks). -// Grant constraints are not applied to operations that do not support an encryption -// context, such as cryptographic operations with HMAC KMS keys or asymmetric -// KMS keys, and management operations, such as DescribeKey or RetireGrant. -// -// In a cryptographic operation, the encryption context in the decryption operation -// must be an exact, case-sensitive match for the keys and values in the encryption -// context of the encryption operation. Only the order of the pairs can vary. -// -// However, in a grant constraint, the key in each key-value pair is not case -// sensitive, but the value is case sensitive. -// -// To avoid confusion, do not use multiple encryption context pairs that differ -// only by case. To require a fully case-sensitive encryption context, use the -// kms:EncryptionContext: and kms:EncryptionContextKeys conditions in an IAM -// or key policy. For details, see kms:EncryptionContext: (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-encryption-context) -// in the Key Management Service Developer Guide . -type GrantConstraints struct { - _ struct{} `type:"structure"` - - // A list of key-value pairs that must match the encryption context in the cryptographic - // operation (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) - // request. The grant allows the operation only when the encryption context - // in the request is the same as the encryption context specified in this constraint. - EncryptionContextEquals map[string]*string `type:"map"` - - // A list of key-value pairs that must be included in the encryption context - // of the cryptographic operation (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) - // request. The grant allows the cryptographic operation only when the encryption - // context in the request includes the key-value pairs specified in this constraint, - // although it can include additional key-value pairs. - EncryptionContextSubset map[string]*string `type:"map"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GrantConstraints) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GrantConstraints) GoString() string { - return s.String() -} - -// SetEncryptionContextEquals sets the EncryptionContextEquals field's value. -func (s *GrantConstraints) SetEncryptionContextEquals(v map[string]*string) *GrantConstraints { - s.EncryptionContextEquals = v - return s -} - -// SetEncryptionContextSubset sets the EncryptionContextSubset field's value. -func (s *GrantConstraints) SetEncryptionContextSubset(v map[string]*string) *GrantConstraints { - s.EncryptionContextSubset = v - return s -} - -// Contains information about a grant. -type GrantListEntry struct { - _ struct{} `type:"structure"` - - // A list of key-value pairs that must be present in the encryption context - // of certain subsequent operations that the grant allows. - Constraints *GrantConstraints `type:"structure"` - - // The date and time when the grant was created. - CreationDate *time.Time `type:"timestamp"` - - // The unique identifier for the grant. - GrantId *string `min:"1" type:"string"` - - // The identity that gets the permissions in the grant. - // - // The GranteePrincipal field in the ListGrants response usually contains the - // user or role designated as the grantee principal in the grant. However, when - // the grantee principal in the grant is an Amazon Web Services service, the - // GranteePrincipal field contains the service principal (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services), - // which might represent several different grantee principals. - GranteePrincipal *string `min:"1" type:"string"` - - // The Amazon Web Services account under which the grant was issued. - IssuingAccount *string `min:"1" type:"string"` - - // The unique identifier for the KMS key to which the grant applies. - KeyId *string `min:"1" type:"string"` - - // The friendly name that identifies the grant. If a name was provided in the - // CreateGrant request, that name is returned. Otherwise this value is null. - Name *string `min:"1" type:"string"` - - // The list of operations permitted by the grant. - Operations []*string `type:"list" enum:"GrantOperation"` - - // The principal that can retire the grant. - RetiringPrincipal *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GrantListEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s GrantListEntry) GoString() string { - return s.String() -} - -// SetConstraints sets the Constraints field's value. -func (s *GrantListEntry) SetConstraints(v *GrantConstraints) *GrantListEntry { - s.Constraints = v - return s -} - -// SetCreationDate sets the CreationDate field's value. -func (s *GrantListEntry) SetCreationDate(v time.Time) *GrantListEntry { - s.CreationDate = &v - return s -} - -// SetGrantId sets the GrantId field's value. -func (s *GrantListEntry) SetGrantId(v string) *GrantListEntry { - s.GrantId = &v - return s -} - -// SetGranteePrincipal sets the GranteePrincipal field's value. -func (s *GrantListEntry) SetGranteePrincipal(v string) *GrantListEntry { - s.GranteePrincipal = &v - return s -} - -// SetIssuingAccount sets the IssuingAccount field's value. -func (s *GrantListEntry) SetIssuingAccount(v string) *GrantListEntry { - s.IssuingAccount = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *GrantListEntry) SetKeyId(v string) *GrantListEntry { - s.KeyId = &v - return s -} - -// SetName sets the Name field's value. -func (s *GrantListEntry) SetName(v string) *GrantListEntry { - s.Name = &v - return s -} - -// SetOperations sets the Operations field's value. -func (s *GrantListEntry) SetOperations(v []*string) *GrantListEntry { - s.Operations = v - return s -} - -// SetRetiringPrincipal sets the RetiringPrincipal field's value. -func (s *GrantListEntry) SetRetiringPrincipal(v string) *GrantListEntry { - s.RetiringPrincipal = &v - return s -} - -type ImportKeyMaterialInput struct { - _ struct{} `type:"structure"` - - // The encrypted key material to import. The key material must be encrypted - // with the public wrapping key that GetParametersForImport returned, using - // the wrapping algorithm that you specified in the same GetParametersForImport - // request. - // EncryptedKeyMaterial is automatically base64 encoded/decoded by the SDK. - // - // EncryptedKeyMaterial is a required field - EncryptedKeyMaterial []byte `min:"1" type:"blob" required:"true"` - - // Specifies whether the key material expires. The default is KEY_MATERIAL_EXPIRES, - // in which case you must include the ValidTo parameter. When this parameter - // is set to KEY_MATERIAL_DOES_NOT_EXPIRE, you must omit the ValidTo parameter. - ExpirationModel *string `type:"string" enum:"ExpirationModelType"` - - // The import token that you received in the response to a previous GetParametersForImport - // request. It must be from the same response that contained the public key - // that you used to encrypt the key material. - // ImportToken is automatically base64 encoded/decoded by the SDK. - // - // ImportToken is a required field - ImportToken []byte `min:"1" type:"blob" required:"true"` - - // The identifier of the symmetric encryption KMS key that receives the imported - // key material. This must be the same KMS key specified in the KeyID parameter - // of the corresponding GetParametersForImport request. The Origin of the KMS - // key must be EXTERNAL. You cannot perform this operation on an asymmetric - // KMS key, an HMAC KMS key, a KMS key in a custom key store, or on a KMS key - // in a different Amazon Web Services account - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The time at which the imported key material expires. When the key material - // expires, KMS deletes the key material and the KMS key becomes unusable. You - // must omit this parameter when the ExpirationModel parameter is set to KEY_MATERIAL_DOES_NOT_EXPIRE. - // Otherwise it is required. - ValidTo *time.Time `type:"timestamp"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ImportKeyMaterialInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ImportKeyMaterialInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ImportKeyMaterialInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ImportKeyMaterialInput"} - if s.EncryptedKeyMaterial == nil { - invalidParams.Add(request.NewErrParamRequired("EncryptedKeyMaterial")) - } - if s.EncryptedKeyMaterial != nil && len(s.EncryptedKeyMaterial) < 1 { - invalidParams.Add(request.NewErrParamMinLen("EncryptedKeyMaterial", 1)) - } - if s.ImportToken == nil { - invalidParams.Add(request.NewErrParamRequired("ImportToken")) - } - if s.ImportToken != nil && len(s.ImportToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ImportToken", 1)) - } - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptedKeyMaterial sets the EncryptedKeyMaterial field's value. -func (s *ImportKeyMaterialInput) SetEncryptedKeyMaterial(v []byte) *ImportKeyMaterialInput { - s.EncryptedKeyMaterial = v - return s -} - -// SetExpirationModel sets the ExpirationModel field's value. -func (s *ImportKeyMaterialInput) SetExpirationModel(v string) *ImportKeyMaterialInput { - s.ExpirationModel = &v - return s -} - -// SetImportToken sets the ImportToken field's value. -func (s *ImportKeyMaterialInput) SetImportToken(v []byte) *ImportKeyMaterialInput { - s.ImportToken = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *ImportKeyMaterialInput) SetKeyId(v string) *ImportKeyMaterialInput { - s.KeyId = &v - return s -} - -// SetValidTo sets the ValidTo field's value. -func (s *ImportKeyMaterialInput) SetValidTo(v time.Time) *ImportKeyMaterialInput { - s.ValidTo = &v - return s -} - -type ImportKeyMaterialOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ImportKeyMaterialOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ImportKeyMaterialOutput) GoString() string { - return s.String() -} - -// The request was rejected because the specified KMS key cannot decrypt the -// data. The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request -// must identify the same KMS key that was used to encrypt the ciphertext. -type IncorrectKeyException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s IncorrectKeyException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s IncorrectKeyException) GoString() string { - return s.String() -} - -func newErrorIncorrectKeyException(v protocol.ResponseMetadata) error { - return &IncorrectKeyException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *IncorrectKeyException) Code() string { - return "IncorrectKeyException" -} - -// Message returns the exception's message. -func (s *IncorrectKeyException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *IncorrectKeyException) OrigErr() error { - return nil -} - -func (s *IncorrectKeyException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *IncorrectKeyException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *IncorrectKeyException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the key material in the request is, expired, -// invalid, or is not the same key material that was previously imported into -// this KMS key. -type IncorrectKeyMaterialException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s IncorrectKeyMaterialException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s IncorrectKeyMaterialException) GoString() string { - return s.String() -} - -func newErrorIncorrectKeyMaterialException(v protocol.ResponseMetadata) error { - return &IncorrectKeyMaterialException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *IncorrectKeyMaterialException) Code() string { - return "IncorrectKeyMaterialException" -} - -// Message returns the exception's message. -func (s *IncorrectKeyMaterialException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *IncorrectKeyMaterialException) OrigErr() error { - return nil -} - -func (s *IncorrectKeyMaterialException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *IncorrectKeyMaterialException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *IncorrectKeyMaterialException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the trust anchor certificate in the request -// is not the trust anchor certificate for the specified CloudHSM cluster. -// -// When you initialize the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr), -// you create the trust anchor certificate and save it in the customerCA.crt -// file. -type IncorrectTrustAnchorException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s IncorrectTrustAnchorException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s IncorrectTrustAnchorException) GoString() string { - return s.String() -} - -func newErrorIncorrectTrustAnchorException(v protocol.ResponseMetadata) error { - return &IncorrectTrustAnchorException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *IncorrectTrustAnchorException) Code() string { - return "IncorrectTrustAnchorException" -} - -// Message returns the exception's message. -func (s *IncorrectTrustAnchorException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *IncorrectTrustAnchorException) OrigErr() error { - return nil -} - -func (s *IncorrectTrustAnchorException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *IncorrectTrustAnchorException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *IncorrectTrustAnchorException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because an internal exception occurred. The request -// can be retried. -type InternalException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InternalException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InternalException) GoString() string { - return s.String() -} - -func newErrorInternalException(v protocol.ResponseMetadata) error { - return &InternalException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InternalException) Code() string { - return "KMSInternalException" -} - -// Message returns the exception's message. -func (s *InternalException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InternalException) OrigErr() error { - return nil -} - -func (s *InternalException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InternalException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InternalException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the specified alias name is not valid. -type InvalidAliasNameException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidAliasNameException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidAliasNameException) GoString() string { - return s.String() -} - -func newErrorInvalidAliasNameException(v protocol.ResponseMetadata) error { - return &InvalidAliasNameException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidAliasNameException) Code() string { - return "InvalidAliasNameException" -} - -// Message returns the exception's message. -func (s *InvalidAliasNameException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidAliasNameException) OrigErr() error { - return nil -} - -func (s *InvalidAliasNameException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidAliasNameException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidAliasNameException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because a specified ARN, or an ARN in a key policy, -// is not valid. -type InvalidArnException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidArnException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidArnException) GoString() string { - return s.String() -} - -func newErrorInvalidArnException(v protocol.ResponseMetadata) error { - return &InvalidArnException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidArnException) Code() string { - return "InvalidArnException" -} - -// Message returns the exception's message. -func (s *InvalidArnException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidArnException) OrigErr() error { - return nil -} - -func (s *InvalidArnException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidArnException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidArnException) RequestID() string { - return s.RespMetadata.RequestID -} - -// From the Decrypt or ReEncrypt operation, the request was rejected because -// the specified ciphertext, or additional authenticated data incorporated into -// the ciphertext, such as the encryption context, is corrupted, missing, or -// otherwise invalid. -// -// From the ImportKeyMaterial operation, the request was rejected because KMS -// could not decrypt the encrypted (wrapped) key material. -type InvalidCiphertextException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidCiphertextException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidCiphertextException) GoString() string { - return s.String() -} - -func newErrorInvalidCiphertextException(v protocol.ResponseMetadata) error { - return &InvalidCiphertextException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidCiphertextException) Code() string { - return "InvalidCiphertextException" -} - -// Message returns the exception's message. -func (s *InvalidCiphertextException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidCiphertextException) OrigErr() error { - return nil -} - -func (s *InvalidCiphertextException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidCiphertextException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidCiphertextException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the specified GrantId is not valid. -type InvalidGrantIdException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidGrantIdException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidGrantIdException) GoString() string { - return s.String() -} - -func newErrorInvalidGrantIdException(v protocol.ResponseMetadata) error { - return &InvalidGrantIdException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidGrantIdException) Code() string { - return "InvalidGrantIdException" -} - -// Message returns the exception's message. -func (s *InvalidGrantIdException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidGrantIdException) OrigErr() error { - return nil -} - -func (s *InvalidGrantIdException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidGrantIdException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidGrantIdException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the specified grant token is not valid. -type InvalidGrantTokenException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidGrantTokenException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidGrantTokenException) GoString() string { - return s.String() -} - -func newErrorInvalidGrantTokenException(v protocol.ResponseMetadata) error { - return &InvalidGrantTokenException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidGrantTokenException) Code() string { - return "InvalidGrantTokenException" -} - -// Message returns the exception's message. -func (s *InvalidGrantTokenException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidGrantTokenException) OrigErr() error { - return nil -} - -func (s *InvalidGrantTokenException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidGrantTokenException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidGrantTokenException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the provided import token is invalid or -// is associated with a different KMS key. -type InvalidImportTokenException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidImportTokenException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidImportTokenException) GoString() string { - return s.String() -} - -func newErrorInvalidImportTokenException(v protocol.ResponseMetadata) error { - return &InvalidImportTokenException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidImportTokenException) Code() string { - return "InvalidImportTokenException" -} - -// Message returns the exception's message. -func (s *InvalidImportTokenException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidImportTokenException) OrigErr() error { - return nil -} - -func (s *InvalidImportTokenException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidImportTokenException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidImportTokenException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected for one of the following reasons: -// -// - The KeyUsage value of the KMS key is incompatible with the API operation. -// -// - The encryption algorithm or signing algorithm specified for the operation -// is incompatible with the type of key material in the KMS key (KeySpec). -// -// For encrypting, decrypting, re-encrypting, and generating data keys, the -// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the -// KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication -// codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage -// of a KMS key, use the DescribeKey operation. -// -// To find the encryption or signing algorithms supported for a particular KMS -// key, use the DescribeKey operation. -type InvalidKeyUsageException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidKeyUsageException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidKeyUsageException) GoString() string { - return s.String() -} - -func newErrorInvalidKeyUsageException(v protocol.ResponseMetadata) error { - return &InvalidKeyUsageException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidKeyUsageException) Code() string { - return "InvalidKeyUsageException" -} - -// Message returns the exception's message. -func (s *InvalidKeyUsageException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidKeyUsageException) OrigErr() error { - return nil -} - -func (s *InvalidKeyUsageException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidKeyUsageException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidKeyUsageException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the marker that specifies where pagination -// should next begin is not valid. -type InvalidMarkerException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidMarkerException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidMarkerException) GoString() string { - return s.String() -} - -func newErrorInvalidMarkerException(v protocol.ResponseMetadata) error { - return &InvalidMarkerException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidMarkerException) Code() string { - return "InvalidMarkerException" -} - -// Message returns the exception's message. -func (s *InvalidMarkerException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidMarkerException) OrigErr() error { - return nil -} - -func (s *InvalidMarkerException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidMarkerException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidMarkerException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the state of the specified resource is not -// valid for this request. -// -// For more information about how key state affects the use of a KMS key, see -// Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) -// in the Key Management Service Developer Guide . -type InvalidStateException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidStateException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s InvalidStateException) GoString() string { - return s.String() -} - -func newErrorInvalidStateException(v protocol.ResponseMetadata) error { - return &InvalidStateException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *InvalidStateException) Code() string { - return "KMSInvalidStateException" -} - -// Message returns the exception's message. -func (s *InvalidStateException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *InvalidStateException) OrigErr() error { - return nil -} - -func (s *InvalidStateException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *InvalidStateException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *InvalidStateException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the HMAC verification failed. HMAC verification -// fails when the HMAC computed by using the specified message, HMAC KMS key, -// and MAC algorithm does not match the HMAC specified in the request. -type KMSInvalidMacException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KMSInvalidMacException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KMSInvalidMacException) GoString() string { - return s.String() -} - -func newErrorKMSInvalidMacException(v protocol.ResponseMetadata) error { - return &KMSInvalidMacException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *KMSInvalidMacException) Code() string { - return "KMSInvalidMacException" -} - -// Message returns the exception's message. -func (s *KMSInvalidMacException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *KMSInvalidMacException) OrigErr() error { - return nil -} - -func (s *KMSInvalidMacException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *KMSInvalidMacException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *KMSInvalidMacException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because the signature verification failed. Signature -// verification fails when it cannot confirm that signature was produced by -// signing the specified message with the specified KMS key and signing algorithm. -type KMSInvalidSignatureException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KMSInvalidSignatureException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KMSInvalidSignatureException) GoString() string { - return s.String() -} - -func newErrorKMSInvalidSignatureException(v protocol.ResponseMetadata) error { - return &KMSInvalidSignatureException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *KMSInvalidSignatureException) Code() string { - return "KMSInvalidSignatureException" -} - -// Message returns the exception's message. -func (s *KMSInvalidSignatureException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *KMSInvalidSignatureException) OrigErr() error { - return nil -} - -func (s *KMSInvalidSignatureException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *KMSInvalidSignatureException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *KMSInvalidSignatureException) RequestID() string { - return s.RespMetadata.RequestID -} - -// Contains information about each entry in the key list. -type KeyListEntry struct { - _ struct{} `type:"structure"` - - // ARN of the key. - KeyArn *string `min:"20" type:"string"` - - // Unique identifier of the key. - KeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KeyListEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KeyListEntry) GoString() string { - return s.String() -} - -// SetKeyArn sets the KeyArn field's value. -func (s *KeyListEntry) SetKeyArn(v string) *KeyListEntry { - s.KeyArn = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *KeyListEntry) SetKeyId(v string) *KeyListEntry { - s.KeyId = &v - return s -} - -// Contains metadata about a KMS key. -// -// This data type is used as a response element for the CreateKey and DescribeKey -// operations. -type KeyMetadata struct { - _ struct{} `type:"structure"` - - // The twelve-digit account ID of the Amazon Web Services account that owns - // the KMS key. - AWSAccountId *string `type:"string"` - - // The Amazon Resource Name (ARN) of the KMS key. For examples, see Key Management - // Service (KMS) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms) - // in the Example ARNs section of the Amazon Web Services General Reference. - Arn *string `min:"20" type:"string"` - - // The cluster ID of the CloudHSM cluster that contains the key material for - // the KMS key. When you create a KMS key in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html), - // KMS creates the key material for the KMS key in the associated CloudHSM cluster. - // This value is present only when the KMS key is created in a custom key store. - CloudHsmClusterId *string `min:"19" type:"string"` - - // The date and time when the KMS key was created. - CreationDate *time.Time `type:"timestamp"` - - // A unique identifier for the custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) - // that contains the KMS key. This value is present only when the KMS key is - // created in a custom key store. - CustomKeyStoreId *string `min:"1" type:"string"` - - // Instead, use the KeySpec field. - // - // The KeySpec and CustomerMasterKeySpec fields have the same value. We recommend - // that you use the KeySpec field in your code. However, to avoid breaking changes, - // KMS will support both fields. - // - // Deprecated: This field has been deprecated. Instead, use the KeySpec field. - CustomerMasterKeySpec *string `deprecated:"true" type:"string" enum:"CustomerMasterKeySpec"` - - // The date and time after which KMS deletes this KMS key. This value is present - // only when the KMS key is scheduled for deletion, that is, when its KeyState - // is PendingDeletion. - // - // When the primary key in a multi-Region key is scheduled for deletion but - // still has replica keys, its key state is PendingReplicaDeletion and the length - // of its waiting period is displayed in the PendingDeletionWindowInDays field. - DeletionDate *time.Time `type:"timestamp"` - - // The description of the KMS key. - Description *string `type:"string"` - - // Specifies whether the KMS key is enabled. When KeyState is Enabled this value - // is true, otherwise it is false. - Enabled *bool `type:"boolean"` - - // The encryption algorithms that the KMS key supports. You cannot use the KMS - // key with other encryption algorithms within KMS. - // - // This value is present only when the KeyUsage of the KMS key is ENCRYPT_DECRYPT. - EncryptionAlgorithms []*string `type:"list" enum:"EncryptionAlgorithmSpec"` - - // Specifies whether the KMS key's key material expires. This value is present - // only when Origin is EXTERNAL, otherwise this value is omitted. - ExpirationModel *string `type:"string" enum:"ExpirationModelType"` - - // The globally unique identifier for the KMS key. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The manager of the KMS key. KMS keys in your Amazon Web Services account - // are either customer managed or Amazon Web Services managed. For more information - // about the difference, see KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys) - // in the Key Management Service Developer Guide. - KeyManager *string `type:"string" enum:"KeyManagerType"` - - // Describes the type of key material in the KMS key. - KeySpec *string `type:"string" enum:"KeySpec"` - - // The current status of the KMS key. - // - // For more information about how key state affects the use of a KMS key, see - // Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) - // in the Key Management Service Developer Guide. - KeyState *string `type:"string" enum:"KeyState"` - - // The cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) - // for which you can use the KMS key. - KeyUsage *string `type:"string" enum:"KeyUsageType"` - - // The message authentication code (MAC) algorithm that the HMAC KMS key supports. - // - // This value is present only when the KeyUsage of the KMS key is GENERATE_VERIFY_MAC. - MacAlgorithms []*string `type:"list" enum:"MacAlgorithmSpec"` - - // Indicates whether the KMS key is a multi-Region (True) or regional (False) - // key. This value is True for multi-Region primary and replica keys and False - // for regional KMS keys. - // - // For more information about multi-Region keys, see Multi-Region keys in KMS - // (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) - // in the Key Management Service Developer Guide. - MultiRegion *bool `type:"boolean"` - - // Lists the primary and replica keys in same multi-Region key. This field is - // present only when the value of the MultiRegion field is True. - // - // For more information about any listed KMS key, use the DescribeKey operation. - // - // * MultiRegionKeyType indicates whether the KMS key is a PRIMARY or REPLICA - // key. - // - // * PrimaryKey displays the key ARN and Region of the primary key. This - // field displays the current KMS key if it is the primary key. - // - // * ReplicaKeys displays the key ARNs and Regions of all replica keys. This - // field includes the current KMS key if it is a replica key. - MultiRegionConfiguration *MultiRegionConfiguration `type:"structure"` - - // The source of the key material for the KMS key. When this value is AWS_KMS, - // KMS created the key material. When this value is EXTERNAL, the key material - // was imported or the KMS key doesn't have any key material. When this value - // is AWS_CLOUDHSM, the key material was created in the CloudHSM cluster associated - // with a custom key store. - Origin *string `type:"string" enum:"OriginType"` - - // The waiting period before the primary key in a multi-Region key is deleted. - // This waiting period begins when the last of its replica keys is deleted. - // This value is present only when the KeyState of the KMS key is PendingReplicaDeletion. - // That indicates that the KMS key is the primary key in a multi-Region key, - // it is scheduled for deletion, and it still has existing replica keys. - // - // When a single-Region KMS key or a multi-Region replica key is scheduled for - // deletion, its deletion date is displayed in the DeletionDate field. However, - // when the primary key in a multi-Region key is scheduled for deletion, its - // waiting period doesn't begin until all of its replica keys are deleted. This - // value displays that waiting period. When the last replica key in the multi-Region - // key is deleted, the KeyState of the scheduled primary key changes from PendingReplicaDeletion - // to PendingDeletion and the deletion date appears in the DeletionDate field. - PendingDeletionWindowInDays *int64 `min:"1" type:"integer"` - - // The signing algorithms that the KMS key supports. You cannot use the KMS - // key with other signing algorithms within KMS. - // - // This field appears only when the KeyUsage of the KMS key is SIGN_VERIFY. - SigningAlgorithms []*string `type:"list" enum:"SigningAlgorithmSpec"` - - // The time at which the imported key material expires. When the key material - // expires, KMS deletes the key material and the KMS key becomes unusable. This - // value is present only for KMS keys whose Origin is EXTERNAL and whose ExpirationModel - // is KEY_MATERIAL_EXPIRES, otherwise this value is omitted. - ValidTo *time.Time `type:"timestamp"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KeyMetadata) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KeyMetadata) GoString() string { - return s.String() -} - -// SetAWSAccountId sets the AWSAccountId field's value. -func (s *KeyMetadata) SetAWSAccountId(v string) *KeyMetadata { - s.AWSAccountId = &v - return s -} - -// SetArn sets the Arn field's value. -func (s *KeyMetadata) SetArn(v string) *KeyMetadata { - s.Arn = &v - return s -} - -// SetCloudHsmClusterId sets the CloudHsmClusterId field's value. -func (s *KeyMetadata) SetCloudHsmClusterId(v string) *KeyMetadata { - s.CloudHsmClusterId = &v - return s -} - -// SetCreationDate sets the CreationDate field's value. -func (s *KeyMetadata) SetCreationDate(v time.Time) *KeyMetadata { - s.CreationDate = &v - return s -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *KeyMetadata) SetCustomKeyStoreId(v string) *KeyMetadata { - s.CustomKeyStoreId = &v - return s -} - -// SetCustomerMasterKeySpec sets the CustomerMasterKeySpec field's value. -func (s *KeyMetadata) SetCustomerMasterKeySpec(v string) *KeyMetadata { - s.CustomerMasterKeySpec = &v - return s -} - -// SetDeletionDate sets the DeletionDate field's value. -func (s *KeyMetadata) SetDeletionDate(v time.Time) *KeyMetadata { - s.DeletionDate = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *KeyMetadata) SetDescription(v string) *KeyMetadata { - s.Description = &v - return s -} - -// SetEnabled sets the Enabled field's value. -func (s *KeyMetadata) SetEnabled(v bool) *KeyMetadata { - s.Enabled = &v - return s -} - -// SetEncryptionAlgorithms sets the EncryptionAlgorithms field's value. -func (s *KeyMetadata) SetEncryptionAlgorithms(v []*string) *KeyMetadata { - s.EncryptionAlgorithms = v - return s -} - -// SetExpirationModel sets the ExpirationModel field's value. -func (s *KeyMetadata) SetExpirationModel(v string) *KeyMetadata { - s.ExpirationModel = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *KeyMetadata) SetKeyId(v string) *KeyMetadata { - s.KeyId = &v - return s -} - -// SetKeyManager sets the KeyManager field's value. -func (s *KeyMetadata) SetKeyManager(v string) *KeyMetadata { - s.KeyManager = &v - return s -} - -// SetKeySpec sets the KeySpec field's value. -func (s *KeyMetadata) SetKeySpec(v string) *KeyMetadata { - s.KeySpec = &v - return s -} - -// SetKeyState sets the KeyState field's value. -func (s *KeyMetadata) SetKeyState(v string) *KeyMetadata { - s.KeyState = &v - return s -} - -// SetKeyUsage sets the KeyUsage field's value. -func (s *KeyMetadata) SetKeyUsage(v string) *KeyMetadata { - s.KeyUsage = &v - return s -} - -// SetMacAlgorithms sets the MacAlgorithms field's value. -func (s *KeyMetadata) SetMacAlgorithms(v []*string) *KeyMetadata { - s.MacAlgorithms = v - return s -} - -// SetMultiRegion sets the MultiRegion field's value. -func (s *KeyMetadata) SetMultiRegion(v bool) *KeyMetadata { - s.MultiRegion = &v - return s -} - -// SetMultiRegionConfiguration sets the MultiRegionConfiguration field's value. -func (s *KeyMetadata) SetMultiRegionConfiguration(v *MultiRegionConfiguration) *KeyMetadata { - s.MultiRegionConfiguration = v - return s -} - -// SetOrigin sets the Origin field's value. -func (s *KeyMetadata) SetOrigin(v string) *KeyMetadata { - s.Origin = &v - return s -} - -// SetPendingDeletionWindowInDays sets the PendingDeletionWindowInDays field's value. -func (s *KeyMetadata) SetPendingDeletionWindowInDays(v int64) *KeyMetadata { - s.PendingDeletionWindowInDays = &v - return s -} - -// SetSigningAlgorithms sets the SigningAlgorithms field's value. -func (s *KeyMetadata) SetSigningAlgorithms(v []*string) *KeyMetadata { - s.SigningAlgorithms = v - return s -} - -// SetValidTo sets the ValidTo field's value. -func (s *KeyMetadata) SetValidTo(v time.Time) *KeyMetadata { - s.ValidTo = &v - return s -} - -// The request was rejected because the specified KMS key was not available. -// You can retry the request. -type KeyUnavailableException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KeyUnavailableException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s KeyUnavailableException) GoString() string { - return s.String() -} - -func newErrorKeyUnavailableException(v protocol.ResponseMetadata) error { - return &KeyUnavailableException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *KeyUnavailableException) Code() string { - return "KeyUnavailableException" -} - -// Message returns the exception's message. -func (s *KeyUnavailableException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *KeyUnavailableException) OrigErr() error { - return nil -} - -func (s *KeyUnavailableException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *KeyUnavailableException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *KeyUnavailableException) RequestID() string { - return s.RespMetadata.RequestID -} - -// The request was rejected because a quota was exceeded. For more information, -// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) -// in the Key Management Service Developer Guide. -type LimitExceededException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LimitExceededException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s LimitExceededException) GoString() string { - return s.String() -} - -func newErrorLimitExceededException(v protocol.ResponseMetadata) error { - return &LimitExceededException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *LimitExceededException) Code() string { - return "LimitExceededException" -} - -// Message returns the exception's message. -func (s *LimitExceededException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *LimitExceededException) OrigErr() error { - return nil -} - -func (s *LimitExceededException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *LimitExceededException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *LimitExceededException) RequestID() string { - return s.RespMetadata.RequestID -} - -type ListAliasesInput struct { - _ struct{} `type:"structure"` - - // Lists only aliases that are associated with the specified KMS key. Enter - // a KMS key in your Amazon Web Services account. - // - // This parameter is optional. If you omit it, ListAliases returns all aliases - // in the account and Region. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - KeyId *string `min:"1" type:"string"` - - // Use this parameter to specify the maximum number of items to return. When - // this value is present, KMS does not return more than the specified number - // of items, but it might return fewer. - // - // This value is optional. If you include a value, it must be between 1 and - // 100, inclusive. If you do not include a value, it defaults to 50. - Limit *int64 `min:"1" type:"integer"` - - // Use this parameter in a subsequent request after you receive a response with - // truncated results. Set it to the value of NextMarker from the truncated response - // you just received. - Marker *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListAliasesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListAliasesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListAliasesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListAliasesInput"} - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Limit != nil && *s.Limit < 1 { - invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) - } - if s.Marker != nil && len(*s.Marker) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Marker", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *ListAliasesInput) SetKeyId(v string) *ListAliasesInput { - s.KeyId = &v - return s -} - -// SetLimit sets the Limit field's value. -func (s *ListAliasesInput) SetLimit(v int64) *ListAliasesInput { - s.Limit = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListAliasesInput) SetMarker(v string) *ListAliasesInput { - s.Marker = &v - return s -} - -type ListAliasesOutput struct { - _ struct{} `type:"structure"` - - // A list of aliases. - Aliases []*AliasListEntry `type:"list"` - - // When Truncated is true, this element is present and contains the value to - // use for the Marker parameter in a subsequent request. - NextMarker *string `min:"1" type:"string"` - - // A flag that indicates whether there are more items in the list. When this - // value is true, the list in this response is truncated. To get more items, - // pass the value of the NextMarker element in thisresponse to the Marker parameter - // in a subsequent request. - Truncated *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListAliasesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListAliasesOutput) GoString() string { - return s.String() -} - -// SetAliases sets the Aliases field's value. -func (s *ListAliasesOutput) SetAliases(v []*AliasListEntry) *ListAliasesOutput { - s.Aliases = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *ListAliasesOutput) SetNextMarker(v string) *ListAliasesOutput { - s.NextMarker = &v - return s -} - -// SetTruncated sets the Truncated field's value. -func (s *ListAliasesOutput) SetTruncated(v bool) *ListAliasesOutput { - s.Truncated = &v - return s -} - -type ListGrantsInput struct { - _ struct{} `type:"structure"` - - // Returns only the grant with the specified grant ID. The grant ID uniquely - // identifies the grant. - GrantId *string `min:"1" type:"string"` - - // Returns only grants where the specified principal is the grantee principal - // for the grant. - GranteePrincipal *string `min:"1" type:"string"` - - // Returns only grants for the specified KMS key. This parameter is required. - // - // Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different - // Amazon Web Services account, you must use the key ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Use this parameter to specify the maximum number of items to return. When - // this value is present, KMS does not return more than the specified number - // of items, but it might return fewer. - // - // This value is optional. If you include a value, it must be between 1 and - // 100, inclusive. If you do not include a value, it defaults to 50. - Limit *int64 `min:"1" type:"integer"` - - // Use this parameter in a subsequent request after you receive a response with - // truncated results. Set it to the value of NextMarker from the truncated response - // you just received. - Marker *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListGrantsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListGrantsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListGrantsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListGrantsInput"} - if s.GrantId != nil && len(*s.GrantId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("GrantId", 1)) - } - if s.GranteePrincipal != nil && len(*s.GranteePrincipal) < 1 { - invalidParams.Add(request.NewErrParamMinLen("GranteePrincipal", 1)) - } - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Limit != nil && *s.Limit < 1 { - invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) - } - if s.Marker != nil && len(*s.Marker) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Marker", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantId sets the GrantId field's value. -func (s *ListGrantsInput) SetGrantId(v string) *ListGrantsInput { - s.GrantId = &v - return s -} - -// SetGranteePrincipal sets the GranteePrincipal field's value. -func (s *ListGrantsInput) SetGranteePrincipal(v string) *ListGrantsInput { - s.GranteePrincipal = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *ListGrantsInput) SetKeyId(v string) *ListGrantsInput { - s.KeyId = &v - return s -} - -// SetLimit sets the Limit field's value. -func (s *ListGrantsInput) SetLimit(v int64) *ListGrantsInput { - s.Limit = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListGrantsInput) SetMarker(v string) *ListGrantsInput { - s.Marker = &v - return s -} - -type ListGrantsResponse struct { - _ struct{} `type:"structure"` - - // A list of grants. - Grants []*GrantListEntry `type:"list"` - - // When Truncated is true, this element is present and contains the value to - // use for the Marker parameter in a subsequent request. - NextMarker *string `min:"1" type:"string"` - - // A flag that indicates whether there are more items in the list. When this - // value is true, the list in this response is truncated. To get more items, - // pass the value of the NextMarker element in thisresponse to the Marker parameter - // in a subsequent request. - Truncated *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListGrantsResponse) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListGrantsResponse) GoString() string { - return s.String() -} - -// SetGrants sets the Grants field's value. -func (s *ListGrantsResponse) SetGrants(v []*GrantListEntry) *ListGrantsResponse { - s.Grants = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *ListGrantsResponse) SetNextMarker(v string) *ListGrantsResponse { - s.NextMarker = &v - return s -} - -// SetTruncated sets the Truncated field's value. -func (s *ListGrantsResponse) SetTruncated(v bool) *ListGrantsResponse { - s.Truncated = &v - return s -} - -type ListKeyPoliciesInput struct { - _ struct{} `type:"structure"` - - // Gets the names of key policies for the specified KMS key. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Use this parameter to specify the maximum number of items to return. When - // this value is present, KMS does not return more than the specified number - // of items, but it might return fewer. - // - // This value is optional. If you include a value, it must be between 1 and - // 1000, inclusive. If you do not include a value, it defaults to 100. - // - // Only one policy can be attached to a key. - Limit *int64 `min:"1" type:"integer"` - - // Use this parameter in a subsequent request after you receive a response with - // truncated results. Set it to the value of NextMarker from the truncated response - // you just received. - Marker *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeyPoliciesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeyPoliciesInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListKeyPoliciesInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListKeyPoliciesInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Limit != nil && *s.Limit < 1 { - invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) - } - if s.Marker != nil && len(*s.Marker) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Marker", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *ListKeyPoliciesInput) SetKeyId(v string) *ListKeyPoliciesInput { - s.KeyId = &v - return s -} - -// SetLimit sets the Limit field's value. -func (s *ListKeyPoliciesInput) SetLimit(v int64) *ListKeyPoliciesInput { - s.Limit = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListKeyPoliciesInput) SetMarker(v string) *ListKeyPoliciesInput { - s.Marker = &v - return s -} - -type ListKeyPoliciesOutput struct { - _ struct{} `type:"structure"` - - // When Truncated is true, this element is present and contains the value to - // use for the Marker parameter in a subsequent request. - NextMarker *string `min:"1" type:"string"` - - // A list of key policy names. The only valid value is default. - PolicyNames []*string `type:"list"` - - // A flag that indicates whether there are more items in the list. When this - // value is true, the list in this response is truncated. To get more items, - // pass the value of the NextMarker element in thisresponse to the Marker parameter - // in a subsequent request. - Truncated *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeyPoliciesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeyPoliciesOutput) GoString() string { - return s.String() -} - -// SetNextMarker sets the NextMarker field's value. -func (s *ListKeyPoliciesOutput) SetNextMarker(v string) *ListKeyPoliciesOutput { - s.NextMarker = &v - return s -} - -// SetPolicyNames sets the PolicyNames field's value. -func (s *ListKeyPoliciesOutput) SetPolicyNames(v []*string) *ListKeyPoliciesOutput { - s.PolicyNames = v - return s -} - -// SetTruncated sets the Truncated field's value. -func (s *ListKeyPoliciesOutput) SetTruncated(v bool) *ListKeyPoliciesOutput { - s.Truncated = &v - return s -} - -type ListKeysInput struct { - _ struct{} `type:"structure"` - - // Use this parameter to specify the maximum number of items to return. When - // this value is present, KMS does not return more than the specified number - // of items, but it might return fewer. - // - // This value is optional. If you include a value, it must be between 1 and - // 1000, inclusive. If you do not include a value, it defaults to 100. - Limit *int64 `min:"1" type:"integer"` - - // Use this parameter in a subsequent request after you receive a response with - // truncated results. Set it to the value of NextMarker from the truncated response - // you just received. - Marker *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeysInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeysInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListKeysInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListKeysInput"} - if s.Limit != nil && *s.Limit < 1 { - invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) - } - if s.Marker != nil && len(*s.Marker) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Marker", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLimit sets the Limit field's value. -func (s *ListKeysInput) SetLimit(v int64) *ListKeysInput { - s.Limit = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListKeysInput) SetMarker(v string) *ListKeysInput { - s.Marker = &v - return s -} - -type ListKeysOutput struct { - _ struct{} `type:"structure"` - - // A list of KMS keys. - Keys []*KeyListEntry `type:"list"` - - // When Truncated is true, this element is present and contains the value to - // use for the Marker parameter in a subsequent request. - NextMarker *string `min:"1" type:"string"` - - // A flag that indicates whether there are more items in the list. When this - // value is true, the list in this response is truncated. To get more items, - // pass the value of the NextMarker element in thisresponse to the Marker parameter - // in a subsequent request. - Truncated *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeysOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListKeysOutput) GoString() string { - return s.String() -} - -// SetKeys sets the Keys field's value. -func (s *ListKeysOutput) SetKeys(v []*KeyListEntry) *ListKeysOutput { - s.Keys = v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *ListKeysOutput) SetNextMarker(v string) *ListKeysOutput { - s.NextMarker = &v - return s -} - -// SetTruncated sets the Truncated field's value. -func (s *ListKeysOutput) SetTruncated(v bool) *ListKeysOutput { - s.Truncated = &v - return s -} - -type ListResourceTagsInput struct { - _ struct{} `type:"structure"` - - // Gets tags on the specified KMS key. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Use this parameter to specify the maximum number of items to return. When - // this value is present, KMS does not return more than the specified number - // of items, but it might return fewer. - // - // This value is optional. If you include a value, it must be between 1 and - // 50, inclusive. If you do not include a value, it defaults to 50. - Limit *int64 `min:"1" type:"integer"` - - // Use this parameter in a subsequent request after you receive a response with - // truncated results. Set it to the value of NextMarker from the truncated response - // you just received. - // - // Do not attempt to construct this value. Use only the value of NextMarker - // from the truncated response you just received. - Marker *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListResourceTagsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListResourceTagsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListResourceTagsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListResourceTagsInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Limit != nil && *s.Limit < 1 { - invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) - } - if s.Marker != nil && len(*s.Marker) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Marker", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *ListResourceTagsInput) SetKeyId(v string) *ListResourceTagsInput { - s.KeyId = &v - return s -} - -// SetLimit sets the Limit field's value. -func (s *ListResourceTagsInput) SetLimit(v int64) *ListResourceTagsInput { - s.Limit = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListResourceTagsInput) SetMarker(v string) *ListResourceTagsInput { - s.Marker = &v - return s -} - -type ListResourceTagsOutput struct { - _ struct{} `type:"structure"` - - // When Truncated is true, this element is present and contains the value to - // use for the Marker parameter in a subsequent request. - // - // Do not assume or infer any information from this value. - NextMarker *string `min:"1" type:"string"` - - // A list of tags. Each tag consists of a tag key and a tag value. - // - // Tagging or untagging a KMS key can allow or deny permission to the KMS key. - // For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) - // in the Key Management Service Developer Guide. - Tags []*Tag `type:"list"` - - // A flag that indicates whether there are more items in the list. When this - // value is true, the list in this response is truncated. To get more items, - // pass the value of the NextMarker element in thisresponse to the Marker parameter - // in a subsequent request. - Truncated *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListResourceTagsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListResourceTagsOutput) GoString() string { - return s.String() -} - -// SetNextMarker sets the NextMarker field's value. -func (s *ListResourceTagsOutput) SetNextMarker(v string) *ListResourceTagsOutput { - s.NextMarker = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *ListResourceTagsOutput) SetTags(v []*Tag) *ListResourceTagsOutput { - s.Tags = v - return s -} - -// SetTruncated sets the Truncated field's value. -func (s *ListResourceTagsOutput) SetTruncated(v bool) *ListResourceTagsOutput { - s.Truncated = &v - return s -} - -type ListRetirableGrantsInput struct { - _ struct{} `type:"structure"` - - // Use this parameter to specify the maximum number of items to return. When - // this value is present, KMS does not return more than the specified number - // of items, but it might return fewer. - // - // This value is optional. If you include a value, it must be between 1 and - // 100, inclusive. If you do not include a value, it defaults to 50. - Limit *int64 `min:"1" type:"integer"` - - // Use this parameter in a subsequent request after you receive a response with - // truncated results. Set it to the value of NextMarker from the truncated response - // you just received. - Marker *string `min:"1" type:"string"` - - // The retiring principal for which to list grants. Enter a principal in your - // Amazon Web Services account. - // - // To specify the retiring principal, use the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // of an Amazon Web Services principal. Valid Amazon Web Services principals - // include Amazon Web Services accounts (root), IAM users, federated users, - // and assumed role users. For examples of the ARN syntax for specifying a principal, - // see Amazon Web Services Identity and Access Management (IAM) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam) - // in the Example ARNs section of the Amazon Web Services General Reference. - // - // RetiringPrincipal is a required field - RetiringPrincipal *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListRetirableGrantsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ListRetirableGrantsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListRetirableGrantsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListRetirableGrantsInput"} - if s.Limit != nil && *s.Limit < 1 { - invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) - } - if s.Marker != nil && len(*s.Marker) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Marker", 1)) - } - if s.RetiringPrincipal == nil { - invalidParams.Add(request.NewErrParamRequired("RetiringPrincipal")) - } - if s.RetiringPrincipal != nil && len(*s.RetiringPrincipal) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RetiringPrincipal", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLimit sets the Limit field's value. -func (s *ListRetirableGrantsInput) SetLimit(v int64) *ListRetirableGrantsInput { - s.Limit = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListRetirableGrantsInput) SetMarker(v string) *ListRetirableGrantsInput { - s.Marker = &v - return s -} - -// SetRetiringPrincipal sets the RetiringPrincipal field's value. -func (s *ListRetirableGrantsInput) SetRetiringPrincipal(v string) *ListRetirableGrantsInput { - s.RetiringPrincipal = &v - return s -} - -// The request was rejected because the specified policy is not syntactically -// or semantically correct. -type MalformedPolicyDocumentException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MalformedPolicyDocumentException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MalformedPolicyDocumentException) GoString() string { - return s.String() -} - -func newErrorMalformedPolicyDocumentException(v protocol.ResponseMetadata) error { - return &MalformedPolicyDocumentException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *MalformedPolicyDocumentException) Code() string { - return "MalformedPolicyDocumentException" -} - -// Message returns the exception's message. -func (s *MalformedPolicyDocumentException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *MalformedPolicyDocumentException) OrigErr() error { - return nil -} - -func (s *MalformedPolicyDocumentException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *MalformedPolicyDocumentException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *MalformedPolicyDocumentException) RequestID() string { - return s.RespMetadata.RequestID -} - -// Describes the configuration of this multi-Region key. This field appears -// only when the KMS key is a primary or replica of a multi-Region key. -// -// For more information about any listed KMS key, use the DescribeKey operation. -type MultiRegionConfiguration struct { - _ struct{} `type:"structure"` - - // Indicates whether the KMS key is a PRIMARY or REPLICA key. - MultiRegionKeyType *string `type:"string" enum:"MultiRegionKeyType"` - - // Displays the key ARN and Region of the primary key. This field includes the - // current KMS key if it is the primary key. - PrimaryKey *MultiRegionKey `type:"structure"` - - // displays the key ARNs and Regions of all replica keys. This field includes - // the current KMS key if it is a replica key. - ReplicaKeys []*MultiRegionKey `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MultiRegionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MultiRegionConfiguration) GoString() string { - return s.String() -} - -// SetMultiRegionKeyType sets the MultiRegionKeyType field's value. -func (s *MultiRegionConfiguration) SetMultiRegionKeyType(v string) *MultiRegionConfiguration { - s.MultiRegionKeyType = &v - return s -} - -// SetPrimaryKey sets the PrimaryKey field's value. -func (s *MultiRegionConfiguration) SetPrimaryKey(v *MultiRegionKey) *MultiRegionConfiguration { - s.PrimaryKey = v - return s -} - -// SetReplicaKeys sets the ReplicaKeys field's value. -func (s *MultiRegionConfiguration) SetReplicaKeys(v []*MultiRegionKey) *MultiRegionConfiguration { - s.ReplicaKeys = v - return s -} - -// Describes the primary or replica key in a multi-Region key. -type MultiRegionKey struct { - _ struct{} `type:"structure"` - - // Displays the key ARN of a primary or replica key of a multi-Region key. - Arn *string `min:"20" type:"string"` - - // Displays the Amazon Web Services Region of a primary or replica key in a - // multi-Region key. - Region *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MultiRegionKey) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s MultiRegionKey) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *MultiRegionKey) SetArn(v string) *MultiRegionKey { - s.Arn = &v - return s -} - -// SetRegion sets the Region field's value. -func (s *MultiRegionKey) SetRegion(v string) *MultiRegionKey { - s.Region = &v - return s -} - -// The request was rejected because the specified entity or resource could not -// be found. -type NotFoundException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NotFoundException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s NotFoundException) GoString() string { - return s.String() -} - -func newErrorNotFoundException(v protocol.ResponseMetadata) error { - return &NotFoundException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *NotFoundException) Code() string { - return "NotFoundException" -} - -// Message returns the exception's message. -func (s *NotFoundException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *NotFoundException) OrigErr() error { - return nil -} - -func (s *NotFoundException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *NotFoundException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *NotFoundException) RequestID() string { - return s.RespMetadata.RequestID -} - -type PutKeyPolicyInput struct { - _ struct{} `type:"structure"` - - // A flag to indicate whether to bypass the key policy lockout safety check. - // - // Setting this value to true increases the risk that the KMS key becomes unmanageable. - // Do not set this value to true indiscriminately. - // - // For more information, refer to the scenario in the Default Key Policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) - // section in the Key Management Service Developer Guide. - // - // Use this parameter only when you intend to prevent the principal that is - // making the request from making a subsequent PutKeyPolicy request on the KMS - // key. - // - // The default value is false. - BypassPolicyLockoutSafetyCheck *bool `type:"boolean"` - - // Sets the key policy on the specified KMS key. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The key policy to attach to the KMS key. - // - // The key policy must meet the following criteria: - // - // * If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy - // must allow the principal that is making the PutKeyPolicy request to make - // a subsequent PutKeyPolicy request on the KMS key. This reduces the risk - // that the KMS key becomes unmanageable. For more information, refer to - // the scenario in the Default Key Policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) - // section of the Key Management Service Developer Guide. - // - // * Each statement in the key policy must contain one or more principals. - // The principals in the key policy must exist and be visible to KMS. When - // you create a new Amazon Web Services principal (for example, an IAM user - // or role), you might need to enforce a delay before including the new principal - // in a key policy because the new principal might not be immediately visible - // to KMS. For more information, see Changes that I make are not always immediately - // visible (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency) - // in the Amazon Web Services Identity and Access Management User Guide. - // - // A key policy document can include only the following characters: - // - // * Printable ASCII characters from the space character (\u0020) through - // the end of the ASCII character range. - // - // * Printable characters in the Basic Latin and Latin-1 Supplement character - // set (through \u00FF). - // - // * The tab (\u0009), line feed (\u000A), and carriage return (\u000D) special - // characters - // - // For information about key policies, see Key policies in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) - // in the Key Management Service Developer Guide. For help writing and formatting - // a JSON policy document, see the IAM JSON Policy Reference (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html) - // in the Identity and Access Management User Guide . - // - // Policy is a required field - Policy *string `min:"1" type:"string" required:"true"` - - // The name of the key policy. The only valid value is default. - // - // PolicyName is a required field - PolicyName *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutKeyPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutKeyPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutKeyPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutKeyPolicyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Policy == nil { - invalidParams.Add(request.NewErrParamRequired("Policy")) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.PolicyName == nil { - invalidParams.Add(request.NewErrParamRequired("PolicyName")) - } - if s.PolicyName != nil && len(*s.PolicyName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBypassPolicyLockoutSafetyCheck sets the BypassPolicyLockoutSafetyCheck field's value. -func (s *PutKeyPolicyInput) SetBypassPolicyLockoutSafetyCheck(v bool) *PutKeyPolicyInput { - s.BypassPolicyLockoutSafetyCheck = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *PutKeyPolicyInput) SetKeyId(v string) *PutKeyPolicyInput { - s.KeyId = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *PutKeyPolicyInput) SetPolicy(v string) *PutKeyPolicyInput { - s.Policy = &v - return s -} - -// SetPolicyName sets the PolicyName field's value. -func (s *PutKeyPolicyInput) SetPolicyName(v string) *PutKeyPolicyInput { - s.PolicyName = &v - return s -} - -type PutKeyPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutKeyPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s PutKeyPolicyOutput) GoString() string { - return s.String() -} - -type ReEncryptInput struct { - _ struct{} `type:"structure"` - - // Ciphertext of the data to reencrypt. - // CiphertextBlob is automatically base64 encoded/decoded by the SDK. - // - // CiphertextBlob is a required field - CiphertextBlob []byte `min:"1" type:"blob" required:"true"` - - // Specifies the encryption algorithm that KMS will use to reecrypt the data - // after it has decrypted it. The default value, SYMMETRIC_DEFAULT, represents - // the encryption algorithm used for symmetric encryption KMS keys. - // - // This parameter is required only when the destination KMS key is an asymmetric - // KMS key. - DestinationEncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // Specifies that encryption context to use when the reencrypting the data. - // - // A destination encryption context is valid only when the destination KMS key - // is a symmetric encryption KMS key. The standard ciphertext format for asymmetric - // KMS keys does not include fields for metadata. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - DestinationEncryptionContext map[string]*string `type:"map"` - - // A unique identifier for the KMS key that is used to reencrypt the data. Specify - // a symmetric encryption KMS key or an asymmetric KMS key with a KeyUsage value - // of ENCRYPT_DECRYPT. To find the KeyUsage value of a KMS key, use the DescribeKey - // operation. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // DestinationKeyId is a required field - DestinationKeyId *string `min:"1" type:"string" required:"true"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Specifies the encryption algorithm that KMS will use to decrypt the ciphertext - // before it is reencrypted. The default value, SYMMETRIC_DEFAULT, represents - // the algorithm used for symmetric encryption KMS keys. - // - // Specify the same algorithm that was used to encrypt the ciphertext. If you - // specify a different algorithm, the decrypt attempt fails. - // - // This parameter is required only when the ciphertext was encrypted under an - // asymmetric KMS key. - SourceEncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // Specifies the encryption context to use to decrypt the ciphertext. Enter - // the same encryption context that was used to encrypt the ciphertext. - // - // An encryption context is a collection of non-secret key-value pairs that - // represent additional authenticated data. When you use an encryption context - // to encrypt data, you must specify the same (an exact case-sensitive match) - // encryption context to decrypt the data. An encryption context is supported - // only on operations with symmetric encryption KMS keys. On operations with - // symmetric encryption KMS keys, an encryption context is optional, but it - // is strongly recommended. - // - // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) - // in the Key Management Service Developer Guide. - SourceEncryptionContext map[string]*string `type:"map"` - - // Specifies the KMS key that KMS will use to decrypt the ciphertext before - // it is re-encrypted. - // - // Enter a key ID of the KMS key that was used to encrypt the ciphertext. If - // you identify a different KMS key, the ReEncrypt operation throws an IncorrectKeyException. - // - // This parameter is required only when the ciphertext was encrypted under an - // asymmetric KMS key. If you used a symmetric encryption KMS key, KMS can get - // the KMS key from metadata that it adds to the symmetric ciphertext blob. - // However, it is always recommended as a best practice. This practice ensures - // that you use the KMS key that you intend. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - SourceKeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReEncryptInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReEncryptInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReEncryptInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReEncryptInput"} - if s.CiphertextBlob == nil { - invalidParams.Add(request.NewErrParamRequired("CiphertextBlob")) - } - if s.CiphertextBlob != nil && len(s.CiphertextBlob) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CiphertextBlob", 1)) - } - if s.DestinationKeyId == nil { - invalidParams.Add(request.NewErrParamRequired("DestinationKeyId")) - } - if s.DestinationKeyId != nil && len(*s.DestinationKeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("DestinationKeyId", 1)) - } - if s.SourceKeyId != nil && len(*s.SourceKeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("SourceKeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCiphertextBlob sets the CiphertextBlob field's value. -func (s *ReEncryptInput) SetCiphertextBlob(v []byte) *ReEncryptInput { - s.CiphertextBlob = v - return s -} - -// SetDestinationEncryptionAlgorithm sets the DestinationEncryptionAlgorithm field's value. -func (s *ReEncryptInput) SetDestinationEncryptionAlgorithm(v string) *ReEncryptInput { - s.DestinationEncryptionAlgorithm = &v - return s -} - -// SetDestinationEncryptionContext sets the DestinationEncryptionContext field's value. -func (s *ReEncryptInput) SetDestinationEncryptionContext(v map[string]*string) *ReEncryptInput { - s.DestinationEncryptionContext = v - return s -} - -// SetDestinationKeyId sets the DestinationKeyId field's value. -func (s *ReEncryptInput) SetDestinationKeyId(v string) *ReEncryptInput { - s.DestinationKeyId = &v - return s -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *ReEncryptInput) SetGrantTokens(v []*string) *ReEncryptInput { - s.GrantTokens = v - return s -} - -// SetSourceEncryptionAlgorithm sets the SourceEncryptionAlgorithm field's value. -func (s *ReEncryptInput) SetSourceEncryptionAlgorithm(v string) *ReEncryptInput { - s.SourceEncryptionAlgorithm = &v - return s -} - -// SetSourceEncryptionContext sets the SourceEncryptionContext field's value. -func (s *ReEncryptInput) SetSourceEncryptionContext(v map[string]*string) *ReEncryptInput { - s.SourceEncryptionContext = v - return s -} - -// SetSourceKeyId sets the SourceKeyId field's value. -func (s *ReEncryptInput) SetSourceKeyId(v string) *ReEncryptInput { - s.SourceKeyId = &v - return s -} - -type ReEncryptOutput struct { - _ struct{} `type:"structure"` - - // The reencrypted data. When you use the HTTP API or the Amazon Web Services - // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. - // CiphertextBlob is automatically base64 encoded/decoded by the SDK. - CiphertextBlob []byte `min:"1" type:"blob"` - - // The encryption algorithm that was used to reencrypt the data. - DestinationEncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key that was used to reencrypt the data. - KeyId *string `min:"1" type:"string"` - - // The encryption algorithm that was used to decrypt the ciphertext before it - // was reencrypted. - SourceEncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"` - - // Unique identifier of the KMS key used to originally encrypt the data. - SourceKeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReEncryptOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReEncryptOutput) GoString() string { - return s.String() -} - -// SetCiphertextBlob sets the CiphertextBlob field's value. -func (s *ReEncryptOutput) SetCiphertextBlob(v []byte) *ReEncryptOutput { - s.CiphertextBlob = v - return s -} - -// SetDestinationEncryptionAlgorithm sets the DestinationEncryptionAlgorithm field's value. -func (s *ReEncryptOutput) SetDestinationEncryptionAlgorithm(v string) *ReEncryptOutput { - s.DestinationEncryptionAlgorithm = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *ReEncryptOutput) SetKeyId(v string) *ReEncryptOutput { - s.KeyId = &v - return s -} - -// SetSourceEncryptionAlgorithm sets the SourceEncryptionAlgorithm field's value. -func (s *ReEncryptOutput) SetSourceEncryptionAlgorithm(v string) *ReEncryptOutput { - s.SourceEncryptionAlgorithm = &v - return s -} - -// SetSourceKeyId sets the SourceKeyId field's value. -func (s *ReEncryptOutput) SetSourceKeyId(v string) *ReEncryptOutput { - s.SourceKeyId = &v - return s -} - -type ReplicateKeyInput struct { - _ struct{} `type:"structure"` - - // A flag to indicate whether to bypass the key policy lockout safety check. - // - // Setting this value to true increases the risk that the KMS key becomes unmanageable. - // Do not set this value to true indiscriminately. - // - // For more information, refer to the scenario in the Default Key Policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) - // section in the Key Management Service Developer Guide. - // - // Use this parameter only when you intend to prevent the principal that is - // making the request from making a subsequent PutKeyPolicy request on the KMS - // key. - // - // The default value is false. - BypassPolicyLockoutSafetyCheck *bool `type:"boolean"` - - // A description of the KMS key. The default value is an empty string (no description). - // - // The description is not a shared property of multi-Region keys. You can specify - // the same description or a different description for each key in a set of - // related multi-Region keys. KMS does not synchronize this property. - Description *string `type:"string"` - - // Identifies the multi-Region primary key that is being replicated. To determine - // whether a KMS key is a multi-Region primary key, use the DescribeKey operation - // to check the value of the MultiRegionKeyType property. - // - // Specify the key ID or key ARN of a multi-Region primary key. - // - // For example: - // - // * Key ID: mrk-1234abcd12ab34cd56ef1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The key policy to attach to the KMS key. This parameter is optional. If you - // do not provide a key policy, KMS attaches the default key policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default) - // to the KMS key. - // - // The key policy is not a shared property of multi-Region keys. You can specify - // the same key policy or a different key policy for each key in a set of related - // multi-Region keys. KMS does not synchronize this property. - // - // If you provide a key policy, it must meet the following criteria: - // - // * If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy - // must give the caller kms:PutKeyPolicy permission on the replica key. This - // reduces the risk that the KMS key becomes unmanageable. For more information, - // refer to the scenario in the Default Key Policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) - // section of the Key Management Service Developer Guide . - // - // * Each statement in the key policy must contain one or more principals. - // The principals in the key policy must exist and be visible to KMS. When - // you create a new Amazon Web Services principal (for example, an IAM user - // or role), you might need to enforce a delay before including the new principal - // in a key policy because the new principal might not be immediately visible - // to KMS. For more information, see Changes that I make are not always immediately - // visible (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency) - // in the Identity and Access Management User Guide . - // - // A key policy document can include only the following characters: - // - // * Printable ASCII characters from the space character (\u0020) through - // the end of the ASCII character range. - // - // * Printable characters in the Basic Latin and Latin-1 Supplement character - // set (through \u00FF). - // - // * The tab (\u0009), line feed (\u000A), and carriage return (\u000D) special - // characters - // - // For information about key policies, see Key policies in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) - // in the Key Management Service Developer Guide. For help writing and formatting - // a JSON policy document, see the IAM JSON Policy Reference (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html) - // in the Identity and Access Management User Guide . - Policy *string `min:"1" type:"string"` - - // The Region ID of the Amazon Web Services Region for this replica key. - // - // Enter the Region ID, such as us-east-1 or ap-southeast-2. For a list of Amazon - // Web Services Regions in which KMS is supported, see KMS service endpoints - // (https://docs.aws.amazon.com/general/latest/gr/kms.html#kms_region) in the - // Amazon Web Services General Reference. - // - // HMAC KMS keys are not supported in all Amazon Web Services Regions. If you - // try to replicate an HMAC KMS key in an Amazon Web Services Region in which - // HMAC keys are not supported, the ReplicateKey operation returns an UnsupportedOperationException. - // For a list of Regions in which HMAC KMS keys are supported, see HMAC keys - // in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html) - // in the Key Management Service Developer Guide. - // - // The replica must be in a different Amazon Web Services Region than its primary - // key and other replicas of that primary key, but in the same Amazon Web Services - // partition. KMS must be available in the replica Region. If the Region is - // not enabled by default, the Amazon Web Services account must be enabled in - // the Region. For information about Amazon Web Services partitions, see Amazon - // Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the Amazon Web Services General Reference. For information about enabling - // and disabling Regions, see Enabling a Region (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html#rande-manage-enable) - // and Disabling a Region (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html#rande-manage-disable) - // in the Amazon Web Services General Reference. - // - // ReplicaRegion is a required field - ReplicaRegion *string `min:"1" type:"string" required:"true"` - - // Assigns one or more tags to the replica key. Use this parameter to tag the - // KMS key when it is created. To tag an existing KMS key, use the TagResource - // operation. - // - // Tagging or untagging a KMS key can allow or deny permission to the KMS key. - // For details, see ABAC in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) - // in the Key Management Service Developer Guide. - // - // To use this parameter, you must have kms:TagResource (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) - // permission in an IAM policy. - // - // Tags are not a shared property of multi-Region keys. You can specify the - // same tags or different tags for each key in a set of related multi-Region - // keys. KMS does not synchronize this property. - // - // Each tag consists of a tag key and a tag value. Both the tag key and the - // tag value are required, but the tag value can be an empty (null) string. - // You cannot have more than one tag on a KMS key with the same tag key. If - // you specify an existing tag key with a different tag value, KMS replaces - // the current tag value with the specified one. - // - // When you add tags to an Amazon Web Services resource, Amazon Web Services - // generates a cost allocation report with usage and costs aggregated by tags. - // Tags can also be used to control access to a KMS key. For details, see Tagging - // Keys (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html). - Tags []*Tag `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReplicateKeyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReplicateKeyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicateKeyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicateKeyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.ReplicaRegion == nil { - invalidParams.Add(request.NewErrParamRequired("ReplicaRegion")) - } - if s.ReplicaRegion != nil && len(*s.ReplicaRegion) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ReplicaRegion", 1)) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBypassPolicyLockoutSafetyCheck sets the BypassPolicyLockoutSafetyCheck field's value. -func (s *ReplicateKeyInput) SetBypassPolicyLockoutSafetyCheck(v bool) *ReplicateKeyInput { - s.BypassPolicyLockoutSafetyCheck = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *ReplicateKeyInput) SetDescription(v string) *ReplicateKeyInput { - s.Description = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *ReplicateKeyInput) SetKeyId(v string) *ReplicateKeyInput { - s.KeyId = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *ReplicateKeyInput) SetPolicy(v string) *ReplicateKeyInput { - s.Policy = &v - return s -} - -// SetReplicaRegion sets the ReplicaRegion field's value. -func (s *ReplicateKeyInput) SetReplicaRegion(v string) *ReplicateKeyInput { - s.ReplicaRegion = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *ReplicateKeyInput) SetTags(v []*Tag) *ReplicateKeyInput { - s.Tags = v - return s -} - -type ReplicateKeyOutput struct { - _ struct{} `type:"structure"` - - // Displays details about the new replica key, including its Amazon Resource - // Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // and Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html). - // It also includes the ARN and Amazon Web Services Region of its primary key - // and other replica keys. - ReplicaKeyMetadata *KeyMetadata `type:"structure"` - - // The key policy of the new replica key. The value is a key policy document - // in JSON format. - ReplicaPolicy *string `min:"1" type:"string"` - - // The tags on the new replica key. The value is a list of tag key and tag value - // pairs. - ReplicaTags []*Tag `type:"list"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReplicateKeyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ReplicateKeyOutput) GoString() string { - return s.String() -} - -// SetReplicaKeyMetadata sets the ReplicaKeyMetadata field's value. -func (s *ReplicateKeyOutput) SetReplicaKeyMetadata(v *KeyMetadata) *ReplicateKeyOutput { - s.ReplicaKeyMetadata = v - return s -} - -// SetReplicaPolicy sets the ReplicaPolicy field's value. -func (s *ReplicateKeyOutput) SetReplicaPolicy(v string) *ReplicateKeyOutput { - s.ReplicaPolicy = &v - return s -} - -// SetReplicaTags sets the ReplicaTags field's value. -func (s *ReplicateKeyOutput) SetReplicaTags(v []*Tag) *ReplicateKeyOutput { - s.ReplicaTags = v - return s -} - -type RetireGrantInput struct { - _ struct{} `type:"structure"` - - // Identifies the grant to retire. To get the grant ID, use CreateGrant, ListGrants, - // or ListRetirableGrants. - // - // * Grant ID Example - 0123456789012345678901234567890123456789012345678901234567890123 - GrantId *string `min:"1" type:"string"` - - // Identifies the grant to be retired. You can use a grant token to identify - // a new grant even before it has achieved eventual consistency. - // - // Only the CreateGrant operation returns a grant token. For details, see Grant - // token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-eventual-consistency) - // in the Key Management Service Developer Guide. - GrantToken *string `min:"1" type:"string"` - - // The key ARN KMS key associated with the grant. To find the key ARN, use the - // ListKeys operation. - // - // For example: arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab - KeyId *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RetireGrantInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RetireGrantInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RetireGrantInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RetireGrantInput"} - if s.GrantId != nil && len(*s.GrantId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("GrantId", 1)) - } - if s.GrantToken != nil && len(*s.GrantToken) < 1 { - invalidParams.Add(request.NewErrParamMinLen("GrantToken", 1)) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantId sets the GrantId field's value. -func (s *RetireGrantInput) SetGrantId(v string) *RetireGrantInput { - s.GrantId = &v - return s -} - -// SetGrantToken sets the GrantToken field's value. -func (s *RetireGrantInput) SetGrantToken(v string) *RetireGrantInput { - s.GrantToken = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *RetireGrantInput) SetKeyId(v string) *RetireGrantInput { - s.KeyId = &v - return s -} - -type RetireGrantOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RetireGrantOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RetireGrantOutput) GoString() string { - return s.String() -} - -type RevokeGrantInput struct { - _ struct{} `type:"structure"` - - // Identifies the grant to revoke. To get the grant ID, use CreateGrant, ListGrants, - // or ListRetirableGrants. - // - // GrantId is a required field - GrantId *string `min:"1" type:"string" required:"true"` - - // A unique identifier for the KMS key associated with the grant. To get the - // key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different - // Amazon Web Services account, you must use the key ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RevokeGrantInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RevokeGrantInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RevokeGrantInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RevokeGrantInput"} - if s.GrantId == nil { - invalidParams.Add(request.NewErrParamRequired("GrantId")) - } - if s.GrantId != nil && len(*s.GrantId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("GrantId", 1)) - } - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantId sets the GrantId field's value. -func (s *RevokeGrantInput) SetGrantId(v string) *RevokeGrantInput { - s.GrantId = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *RevokeGrantInput) SetKeyId(v string) *RevokeGrantInput { - s.KeyId = &v - return s -} - -type RevokeGrantOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RevokeGrantOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s RevokeGrantOutput) GoString() string { - return s.String() -} - -type ScheduleKeyDeletionInput struct { - _ struct{} `type:"structure"` - - // The unique identifier of the KMS key to delete. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The waiting period, specified in number of days. After the waiting period - // ends, KMS deletes the KMS key. - // - // If the KMS key is a multi-Region primary key with replica keys, the waiting - // period begins when the last of its replica keys is deleted. Otherwise, the - // waiting period begins immediately. - // - // This value is optional. If you include a value, it must be between 7 and - // 30, inclusive. If you do not include a value, it defaults to 30. - PendingWindowInDays *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduleKeyDeletionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduleKeyDeletionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ScheduleKeyDeletionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ScheduleKeyDeletionInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.PendingWindowInDays != nil && *s.PendingWindowInDays < 1 { - invalidParams.Add(request.NewErrParamMinValue("PendingWindowInDays", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *ScheduleKeyDeletionInput) SetKeyId(v string) *ScheduleKeyDeletionInput { - s.KeyId = &v - return s -} - -// SetPendingWindowInDays sets the PendingWindowInDays field's value. -func (s *ScheduleKeyDeletionInput) SetPendingWindowInDays(v int64) *ScheduleKeyDeletionInput { - s.PendingWindowInDays = &v - return s -} - -type ScheduleKeyDeletionOutput struct { - _ struct{} `type:"structure"` - - // The date and time after which KMS deletes the KMS key. - // - // If the KMS key is a multi-Region primary key with replica keys, this field - // does not appear. The deletion date for the primary key isn't known until - // its last replica key is deleted. - DeletionDate *time.Time `type:"timestamp"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the KMS key whose deletion is scheduled. - KeyId *string `min:"1" type:"string"` - - // The current status of the KMS key. - // - // For more information about how key state affects the use of a KMS key, see - // Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) - // in the Key Management Service Developer Guide. - KeyState *string `type:"string" enum:"KeyState"` - - // The waiting period before the KMS key is deleted. - // - // If the KMS key is a multi-Region primary key with replicas, the waiting period - // begins when the last of its replica keys is deleted. Otherwise, the waiting - // period begins immediately. - PendingWindowInDays *int64 `min:"1" type:"integer"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduleKeyDeletionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s ScheduleKeyDeletionOutput) GoString() string { - return s.String() -} - -// SetDeletionDate sets the DeletionDate field's value. -func (s *ScheduleKeyDeletionOutput) SetDeletionDate(v time.Time) *ScheduleKeyDeletionOutput { - s.DeletionDate = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *ScheduleKeyDeletionOutput) SetKeyId(v string) *ScheduleKeyDeletionOutput { - s.KeyId = &v - return s -} - -// SetKeyState sets the KeyState field's value. -func (s *ScheduleKeyDeletionOutput) SetKeyState(v string) *ScheduleKeyDeletionOutput { - s.KeyState = &v - return s -} - -// SetPendingWindowInDays sets the PendingWindowInDays field's value. -func (s *ScheduleKeyDeletionOutput) SetPendingWindowInDays(v int64) *ScheduleKeyDeletionOutput { - s.PendingWindowInDays = &v - return s -} - -type SignInput struct { - _ struct{} `type:"structure"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric - // KMS key to sign the message. The KeyUsage type of the KMS key must be SIGN_VERIFY. - // To find the KeyUsage of a KMS key, use the DescribeKey operation. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Specifies the message or message digest to sign. Messages can be 0-4096 bytes. - // To sign a larger message, provide the message digest. - // - // If you provide a message, KMS generates a hash digest of the message and - // then signs it. - // - // Message is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by SignInput's - // String and GoString methods. - // - // Message is automatically base64 encoded/decoded by the SDK. - // - // Message is a required field - Message []byte `min:"1" type:"blob" required:"true" sensitive:"true"` - - // Tells KMS whether the value of the Message parameter is a message or message - // digest. The default value, RAW, indicates a message. To indicate a message - // digest, enter DIGEST. - MessageType *string `type:"string" enum:"MessageType"` - - // Specifies the signing algorithm to use when signing the message. - // - // Choose an algorithm that is compatible with the type and size of the specified - // asymmetric KMS key. - // - // SigningAlgorithm is a required field - SigningAlgorithm *string `type:"string" required:"true" enum:"SigningAlgorithmSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SignInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SignInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SignInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SignInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Message == nil { - invalidParams.Add(request.NewErrParamRequired("Message")) - } - if s.Message != nil && len(s.Message) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Message", 1)) - } - if s.SigningAlgorithm == nil { - invalidParams.Add(request.NewErrParamRequired("SigningAlgorithm")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *SignInput) SetGrantTokens(v []*string) *SignInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *SignInput) SetKeyId(v string) *SignInput { - s.KeyId = &v - return s -} - -// SetMessage sets the Message field's value. -func (s *SignInput) SetMessage(v []byte) *SignInput { - s.Message = v - return s -} - -// SetMessageType sets the MessageType field's value. -func (s *SignInput) SetMessageType(v string) *SignInput { - s.MessageType = &v - return s -} - -// SetSigningAlgorithm sets the SigningAlgorithm field's value. -func (s *SignInput) SetSigningAlgorithm(v string) *SignInput { - s.SigningAlgorithm = &v - return s -} - -type SignOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the asymmetric KMS key that was used to sign the message. - KeyId *string `min:"1" type:"string"` - - // The cryptographic signature that was generated for the message. - // - // * When used with the supported RSA signing algorithms, the encoding of - // this value is defined by PKCS #1 in RFC 8017 (https://tools.ietf.org/html/rfc8017). - // - // * When used with the ECDSA_SHA_256, ECDSA_SHA_384, or ECDSA_SHA_512 signing - // algorithms, this value is a DER-encoded object as defined by ANS X9.62–2005 - // and RFC 3279 Section 2.2.3 (https://tools.ietf.org/html/rfc3279#section-2.2.3). - // This is the most commonly used signature format and is appropriate for - // most uses. - // - // When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. - // Otherwise, it is not Base64-encoded. - // Signature is automatically base64 encoded/decoded by the SDK. - Signature []byte `min:"1" type:"blob"` - - // The signing algorithm that was used to sign the message. - SigningAlgorithm *string `type:"string" enum:"SigningAlgorithmSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SignOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s SignOutput) GoString() string { - return s.String() -} - -// SetKeyId sets the KeyId field's value. -func (s *SignOutput) SetKeyId(v string) *SignOutput { - s.KeyId = &v - return s -} - -// SetSignature sets the Signature field's value. -func (s *SignOutput) SetSignature(v []byte) *SignOutput { - s.Signature = v - return s -} - -// SetSigningAlgorithm sets the SigningAlgorithm field's value. -func (s *SignOutput) SetSigningAlgorithm(v string) *SignOutput { - s.SigningAlgorithm = &v - return s -} - -// A key-value pair. A tag consists of a tag key and a tag value. Tag keys and -// tag values are both required, but tag values can be empty (null) strings. -// -// For information about the rules that apply to tag keys and tag values, see -// User-Defined Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html) -// in the Amazon Web Services Billing and Cost Management User Guide. -type Tag struct { - _ struct{} `type:"structure"` - - // The key of the tag. - // - // TagKey is a required field - TagKey *string `min:"1" type:"string" required:"true"` - - // The value of the tag. - // - // TagValue is a required field - TagValue *string `type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s Tag) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -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.TagKey == nil { - invalidParams.Add(request.NewErrParamRequired("TagKey")) - } - if s.TagKey != nil && len(*s.TagKey) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TagKey", 1)) - } - if s.TagValue == nil { - invalidParams.Add(request.NewErrParamRequired("TagValue")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTagKey sets the TagKey field's value. -func (s *Tag) SetTagKey(v string) *Tag { - s.TagKey = &v - return s -} - -// SetTagValue sets the TagValue field's value. -func (s *Tag) SetTagValue(v string) *Tag { - s.TagValue = &v - return s -} - -// The request was rejected because one or more tags are not valid. -type TagException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagException) GoString() string { - return s.String() -} - -func newErrorTagException(v protocol.ResponseMetadata) error { - return &TagException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *TagException) Code() string { - return "TagException" -} - -// Message returns the exception's message. -func (s *TagException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *TagException) OrigErr() error { - return nil -} - -func (s *TagException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *TagException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *TagException) RequestID() string { - return s.RespMetadata.RequestID -} - -type TagResourceInput struct { - _ struct{} `type:"structure"` - - // Identifies a customer managed key in the account and Region. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // One or more tags. - // - // Each tag consists of a tag key and a tag value. The tag value can be an empty - // (null) string. - // - // You cannot have more than one tag on a KMS key with the same tag key. If - // you specify an existing tag key with a different tag value, KMS replaces - // the current tag value with the specified one. - // - // Tags is a required field - Tags []*Tag `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagResourceInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagResourceInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TagResourceInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Tags == nil { - invalidParams.Add(request.NewErrParamRequired("Tags")) - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *TagResourceInput) SetKeyId(v string) *TagResourceInput { - s.KeyId = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *TagResourceInput) SetTags(v []*Tag) *TagResourceInput { - s.Tags = v - return s -} - -type TagResourceOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagResourceOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s TagResourceOutput) GoString() string { - return s.String() -} - -// The request was rejected because a specified parameter is not supported or -// a specified resource is not valid for this operation. -type UnsupportedOperationException struct { - _ struct{} `type:"structure"` - RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` - - Message_ *string `locationName:"message" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UnsupportedOperationException) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UnsupportedOperationException) GoString() string { - return s.String() -} - -func newErrorUnsupportedOperationException(v protocol.ResponseMetadata) error { - return &UnsupportedOperationException{ - RespMetadata: v, - } -} - -// Code returns the exception type name. -func (s *UnsupportedOperationException) Code() string { - return "UnsupportedOperationException" -} - -// Message returns the exception's message. -func (s *UnsupportedOperationException) Message() string { - if s.Message_ != nil { - return *s.Message_ - } - return "" -} - -// OrigErr always returns nil, satisfies awserr.Error interface. -func (s *UnsupportedOperationException) OrigErr() error { - return nil -} - -func (s *UnsupportedOperationException) Error() string { - return fmt.Sprintf("%s: %s", s.Code(), s.Message()) -} - -// Status code returns the HTTP status code for the request's response error. -func (s *UnsupportedOperationException) StatusCode() int { - return s.RespMetadata.StatusCode -} - -// RequestID returns the service's response RequestID for request. -func (s *UnsupportedOperationException) RequestID() string { - return s.RespMetadata.RequestID -} - -type UntagResourceInput struct { - _ struct{} `type:"structure"` - - // Identifies the KMS key from which you are removing tags. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // One or more tag keys. Specify only the tag keys, not the tag values. - // - // TagKeys is a required field - TagKeys []*string `type:"list" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UntagResourceInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UntagResourceInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UntagResourceInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.TagKeys == nil { - invalidParams.Add(request.NewErrParamRequired("TagKeys")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *UntagResourceInput) SetKeyId(v string) *UntagResourceInput { - s.KeyId = &v - return s -} - -// SetTagKeys sets the TagKeys field's value. -func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput { - s.TagKeys = v - return s -} - -type UntagResourceOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UntagResourceOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UntagResourceOutput) GoString() string { - return s.String() -} - -type UpdateAliasInput struct { - _ struct{} `type:"structure"` - - // Identifies the alias that is changing its KMS key. This value must begin - // with alias/ followed by the alias name, such as alias/ExampleAlias. You cannot - // use UpdateAlias to change the alias name. - // - // AliasName is a required field - AliasName *string `min:"1" type:"string" required:"true"` - - // Identifies the customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) - // to associate with the alias. You don't have permission to associate an alias - // with an Amazon Web Services managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk). - // - // The KMS key must be in the same Amazon Web Services account and Region as - // the alias. Also, the new target KMS key must be the same type as the current - // target KMS key (both symmetric or both asymmetric) and they must have the - // same key usage. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // To verify that the alias is mapped to the correct KMS key, use ListAliases. - // - // TargetKeyId is a required field - TargetKeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAliasInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAliasInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdateAliasInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdateAliasInput"} - if s.AliasName == nil { - invalidParams.Add(request.NewErrParamRequired("AliasName")) - } - if s.AliasName != nil && len(*s.AliasName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("AliasName", 1)) - } - if s.TargetKeyId == nil { - invalidParams.Add(request.NewErrParamRequired("TargetKeyId")) - } - if s.TargetKeyId != nil && len(*s.TargetKeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TargetKeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAliasName sets the AliasName field's value. -func (s *UpdateAliasInput) SetAliasName(v string) *UpdateAliasInput { - s.AliasName = &v - return s -} - -// SetTargetKeyId sets the TargetKeyId field's value. -func (s *UpdateAliasInput) SetTargetKeyId(v string) *UpdateAliasInput { - s.TargetKeyId = &v - return s -} - -type UpdateAliasOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAliasOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateAliasOutput) GoString() string { - return s.String() -} - -type UpdateCustomKeyStoreInput struct { - _ struct{} `type:"structure"` - - // Associates the custom key store with a related CloudHSM cluster. - // - // Enter the cluster ID of the cluster that you used to create the custom key - // store or a cluster that shares a backup history and has the same cluster - // certificate as the original cluster. You cannot use this parameter to associate - // a custom key store with an unrelated cluster. In addition, the replacement - // cluster must fulfill the requirements (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) - // for a cluster associated with a custom key store. To view the cluster certificate - // of a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) - // operation. - CloudHsmClusterId *string `min:"19" type:"string"` - - // Identifies the custom key store that you want to update. Enter the ID of - // the custom key store. To find the ID of a custom key store, use the DescribeCustomKeyStores - // operation. - // - // CustomKeyStoreId is a required field - CustomKeyStoreId *string `min:"1" type:"string" required:"true"` - - // Enter the current password of the kmsuser crypto user (CU) in the CloudHSM - // cluster that is associated with the custom key store. - // - // This parameter tells KMS the current password of the kmsuser crypto user - // (CU). It does not set or change the password of any users in the CloudHSM - // cluster. - // - // KeyStorePassword is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by UpdateCustomKeyStoreInput's - // String and GoString methods. - KeyStorePassword *string `min:"7" type:"string" sensitive:"true"` - - // Changes the friendly name of the custom key store to the value that you specify. - // The custom key store name must be unique in the Amazon Web Services account. - NewCustomKeyStoreName *string `min:"1" type:"string"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateCustomKeyStoreInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateCustomKeyStoreInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdateCustomKeyStoreInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdateCustomKeyStoreInput"} - if s.CloudHsmClusterId != nil && len(*s.CloudHsmClusterId) < 19 { - invalidParams.Add(request.NewErrParamMinLen("CloudHsmClusterId", 19)) - } - if s.CustomKeyStoreId == nil { - invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId")) - } - if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1)) - } - if s.KeyStorePassword != nil && len(*s.KeyStorePassword) < 7 { - invalidParams.Add(request.NewErrParamMinLen("KeyStorePassword", 7)) - } - if s.NewCustomKeyStoreName != nil && len(*s.NewCustomKeyStoreName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("NewCustomKeyStoreName", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCloudHsmClusterId sets the CloudHsmClusterId field's value. -func (s *UpdateCustomKeyStoreInput) SetCloudHsmClusterId(v string) *UpdateCustomKeyStoreInput { - s.CloudHsmClusterId = &v - return s -} - -// SetCustomKeyStoreId sets the CustomKeyStoreId field's value. -func (s *UpdateCustomKeyStoreInput) SetCustomKeyStoreId(v string) *UpdateCustomKeyStoreInput { - s.CustomKeyStoreId = &v - return s -} - -// SetKeyStorePassword sets the KeyStorePassword field's value. -func (s *UpdateCustomKeyStoreInput) SetKeyStorePassword(v string) *UpdateCustomKeyStoreInput { - s.KeyStorePassword = &v - return s -} - -// SetNewCustomKeyStoreName sets the NewCustomKeyStoreName field's value. -func (s *UpdateCustomKeyStoreInput) SetNewCustomKeyStoreName(v string) *UpdateCustomKeyStoreInput { - s.NewCustomKeyStoreName = &v - return s -} - -type UpdateCustomKeyStoreOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateCustomKeyStoreOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateCustomKeyStoreOutput) GoString() string { - return s.String() -} - -type UpdateKeyDescriptionInput struct { - _ struct{} `type:"structure"` - - // New description for the KMS key. - // - // Description is a required field - Description *string `type:"string" required:"true"` - - // Updates the description of the specified KMS key. - // - // Specify the key ID or key ARN of the KMS key. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateKeyDescriptionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateKeyDescriptionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdateKeyDescriptionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdateKeyDescriptionInput"} - if s.Description == nil { - invalidParams.Add(request.NewErrParamRequired("Description")) - } - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDescription sets the Description field's value. -func (s *UpdateKeyDescriptionInput) SetDescription(v string) *UpdateKeyDescriptionInput { - s.Description = &v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *UpdateKeyDescriptionInput) SetKeyId(v string) *UpdateKeyDescriptionInput { - s.KeyId = &v - return s -} - -type UpdateKeyDescriptionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateKeyDescriptionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdateKeyDescriptionOutput) GoString() string { - return s.String() -} - -type UpdatePrimaryRegionInput struct { - _ struct{} `type:"structure"` - - // Identifies the current primary key. When the operation completes, this KMS - // key will be a replica key. - // - // Specify the key ID or key ARN of a multi-Region primary key. - // - // For example: - // - // * Key ID: mrk-1234abcd12ab34cd56ef1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The Amazon Web Services Region of the new primary key. Enter the Region ID, - // such as us-east-1 or ap-southeast-2. There must be an existing replica key - // in this Region. - // - // When the operation completes, the multi-Region key in this Region will be - // the primary key. - // - // PrimaryRegion is a required field - PrimaryRegion *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdatePrimaryRegionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdatePrimaryRegionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UpdatePrimaryRegionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UpdatePrimaryRegionInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.PrimaryRegion == nil { - invalidParams.Add(request.NewErrParamRequired("PrimaryRegion")) - } - if s.PrimaryRegion != nil && len(*s.PrimaryRegion) < 1 { - invalidParams.Add(request.NewErrParamMinLen("PrimaryRegion", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *UpdatePrimaryRegionInput) SetKeyId(v string) *UpdatePrimaryRegionInput { - s.KeyId = &v - return s -} - -// SetPrimaryRegion sets the PrimaryRegion field's value. -func (s *UpdatePrimaryRegionInput) SetPrimaryRegion(v string) *UpdatePrimaryRegionInput { - s.PrimaryRegion = &v - return s -} - -type UpdatePrimaryRegionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdatePrimaryRegionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s UpdatePrimaryRegionOutput) GoString() string { - return s.String() -} - -type VerifyInput struct { - _ struct{} `type:"structure"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // Identifies the asymmetric KMS key that will be used to verify the signature. - // This must be the same KMS key that was used to generate the signature. If - // you specify a different KMS key, the signature verification fails. - // - // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. - // When using an alias name, prefix it with "alias/". To specify a KMS key in - // a different Amazon Web Services account, you must use the key ARN or alias - // ARN. - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Alias name: alias/ExampleAlias - // - // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias - // - // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. - // To get the alias name and alias ARN, use ListAliases. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // Specifies the message that was signed. You can submit a raw message of up - // to 4096 bytes, or a hash digest of the message. If you submit a digest, use - // the MessageType parameter with a value of DIGEST. - // - // If the message specified here is different from the message that was signed, - // the signature verification fails. A message and its hash digest are considered - // to be the same message. - // - // Message is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by VerifyInput's - // String and GoString methods. - // - // Message is automatically base64 encoded/decoded by the SDK. - // - // Message is a required field - Message []byte `min:"1" type:"blob" required:"true" sensitive:"true"` - - // Tells KMS whether the value of the Message parameter is a message or message - // digest. The default value, RAW, indicates a message. To indicate a message - // digest, enter DIGEST. - // - // Use the DIGEST value only when the value of the Message parameter is a message - // digest. If you use the DIGEST value with a raw message, the security of the - // verification operation can be compromised. - MessageType *string `type:"string" enum:"MessageType"` - - // The signature that the Sign operation generated. - // Signature is automatically base64 encoded/decoded by the SDK. - // - // Signature is a required field - Signature []byte `min:"1" type:"blob" required:"true"` - - // The signing algorithm that was used to sign the message. If you submit a - // different algorithm, the signature verification fails. - // - // SigningAlgorithm is a required field - SigningAlgorithm *string `type:"string" required:"true" enum:"SigningAlgorithmSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *VerifyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "VerifyInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Message == nil { - invalidParams.Add(request.NewErrParamRequired("Message")) - } - if s.Message != nil && len(s.Message) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Message", 1)) - } - if s.Signature == nil { - invalidParams.Add(request.NewErrParamRequired("Signature")) - } - if s.Signature != nil && len(s.Signature) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Signature", 1)) - } - if s.SigningAlgorithm == nil { - invalidParams.Add(request.NewErrParamRequired("SigningAlgorithm")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *VerifyInput) SetGrantTokens(v []*string) *VerifyInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *VerifyInput) SetKeyId(v string) *VerifyInput { - s.KeyId = &v - return s -} - -// SetMessage sets the Message field's value. -func (s *VerifyInput) SetMessage(v []byte) *VerifyInput { - s.Message = v - return s -} - -// SetMessageType sets the MessageType field's value. -func (s *VerifyInput) SetMessageType(v string) *VerifyInput { - s.MessageType = &v - return s -} - -// SetSignature sets the Signature field's value. -func (s *VerifyInput) SetSignature(v []byte) *VerifyInput { - s.Signature = v - return s -} - -// SetSigningAlgorithm sets the SigningAlgorithm field's value. -func (s *VerifyInput) SetSigningAlgorithm(v string) *VerifyInput { - s.SigningAlgorithm = &v - return s -} - -type VerifyMacInput struct { - _ struct{} `type:"structure"` - - // A list of grant tokens. - // - // Use a grant token when your permission to call this operation comes from - // a new grant that has not yet achieved eventual consistency. For more information, - // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token) - // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) - // in the Key Management Service Developer Guide. - GrantTokens []*string `type:"list"` - - // The KMS key that will be used in the verification. - // - // Enter a key ID of the KMS key that was used to generate the HMAC. If you - // identify a different KMS key, the VerifyMac operation fails. - // - // KeyId is a required field - KeyId *string `min:"1" type:"string" required:"true"` - - // The HMAC to verify. Enter the HMAC that was generated by the GenerateMac - // operation when you specified the same message, HMAC KMS key, and MAC algorithm - // as the values specified in this request. - // Mac is automatically base64 encoded/decoded by the SDK. - // - // Mac is a required field - Mac []byte `min:"1" type:"blob" required:"true"` - - // The MAC algorithm that will be used in the verification. Enter the same MAC - // algorithm that was used to compute the HMAC. This algorithm must be supported - // by the HMAC KMS key identified by the KeyId parameter. - // - // MacAlgorithm is a required field - MacAlgorithm *string `type:"string" required:"true" enum:"MacAlgorithmSpec"` - - // The message that will be used in the verification. Enter the same message - // that was used to generate the HMAC. - // - // GenerateMac and VerifyMac do not provide special handling for message digests. - // If you generated an HMAC for a hash digest of a message, you must verify - // the HMAC for the same hash digest. - // - // Message is a sensitive parameter and its value will be - // replaced with "sensitive" in string returned by VerifyMacInput's - // String and GoString methods. - // - // Message is automatically base64 encoded/decoded by the SDK. - // - // Message is a required field - Message []byte `min:"1" type:"blob" required:"true" sensitive:"true"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyMacInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyMacInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *VerifyMacInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "VerifyMacInput"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - if s.KeyId != nil && len(*s.KeyId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("KeyId", 1)) - } - if s.Mac == nil { - invalidParams.Add(request.NewErrParamRequired("Mac")) - } - if s.Mac != nil && len(s.Mac) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Mac", 1)) - } - if s.MacAlgorithm == nil { - invalidParams.Add(request.NewErrParamRequired("MacAlgorithm")) - } - if s.Message == nil { - invalidParams.Add(request.NewErrParamRequired("Message")) - } - if s.Message != nil && len(s.Message) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Message", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantTokens sets the GrantTokens field's value. -func (s *VerifyMacInput) SetGrantTokens(v []*string) *VerifyMacInput { - s.GrantTokens = v - return s -} - -// SetKeyId sets the KeyId field's value. -func (s *VerifyMacInput) SetKeyId(v string) *VerifyMacInput { - s.KeyId = &v - return s -} - -// SetMac sets the Mac field's value. -func (s *VerifyMacInput) SetMac(v []byte) *VerifyMacInput { - s.Mac = v - return s -} - -// SetMacAlgorithm sets the MacAlgorithm field's value. -func (s *VerifyMacInput) SetMacAlgorithm(v string) *VerifyMacInput { - s.MacAlgorithm = &v - return s -} - -// SetMessage sets the Message field's value. -func (s *VerifyMacInput) SetMessage(v []byte) *VerifyMacInput { - s.Message = v - return s -} - -type VerifyMacOutput struct { - _ struct{} `type:"structure"` - - // The HMAC KMS key used in the verification. - KeyId *string `min:"1" type:"string"` - - // The MAC algorithm used in the verification. - MacAlgorithm *string `type:"string" enum:"MacAlgorithmSpec"` - - // A Boolean value that indicates whether the HMAC was verified. A value of - // True indicates that the HMAC (Mac) was generated with the specified Message, - // HMAC KMS key (KeyID) and MacAlgorithm.. - // - // If the HMAC is not verified, the VerifyMac operation fails with a KMSInvalidMacException - // exception. This exception indicates that one or more of the inputs changed - // since the HMAC was computed. - MacValid *bool `type:"boolean"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyMacOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyMacOutput) GoString() string { - return s.String() -} - -// SetKeyId sets the KeyId field's value. -func (s *VerifyMacOutput) SetKeyId(v string) *VerifyMacOutput { - s.KeyId = &v - return s -} - -// SetMacAlgorithm sets the MacAlgorithm field's value. -func (s *VerifyMacOutput) SetMacAlgorithm(v string) *VerifyMacOutput { - s.MacAlgorithm = &v - return s -} - -// SetMacValid sets the MacValid field's value. -func (s *VerifyMacOutput) SetMacValid(v bool) *VerifyMacOutput { - s.MacValid = &v - return s -} - -type VerifyOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN)) - // of the asymmetric KMS key that was used to verify the signature. - KeyId *string `min:"1" type:"string"` - - // A Boolean value that indicates whether the signature was verified. A value - // of True indicates that the Signature was produced by signing the Message - // with the specified KeyID and SigningAlgorithm. If the signature is not verified, - // the Verify operation fails with a KMSInvalidSignatureException exception. - SignatureValid *bool `type:"boolean"` - - // The signing algorithm that was used to verify the signature. - SigningAlgorithm *string `type:"string" enum:"SigningAlgorithmSpec"` -} - -// String returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation. -// -// API parameter values that are decorated as "sensitive" in the API will not -// be included in the string output. The member name will be present, but the -// value will be replaced with "sensitive". -func (s VerifyOutput) GoString() string { - return s.String() -} - -// SetKeyId sets the KeyId field's value. -func (s *VerifyOutput) SetKeyId(v string) *VerifyOutput { - s.KeyId = &v - return s -} - -// SetSignatureValid sets the SignatureValid field's value. -func (s *VerifyOutput) SetSignatureValid(v bool) *VerifyOutput { - s.SignatureValid = &v - return s -} - -// SetSigningAlgorithm sets the SigningAlgorithm field's value. -func (s *VerifyOutput) SetSigningAlgorithm(v string) *VerifyOutput { - s.SigningAlgorithm = &v - return s -} - -const ( - // AlgorithmSpecRsaesPkcs1V15 is a AlgorithmSpec enum value - AlgorithmSpecRsaesPkcs1V15 = "RSAES_PKCS1_V1_5" - - // AlgorithmSpecRsaesOaepSha1 is a AlgorithmSpec enum value - AlgorithmSpecRsaesOaepSha1 = "RSAES_OAEP_SHA_1" - - // AlgorithmSpecRsaesOaepSha256 is a AlgorithmSpec enum value - AlgorithmSpecRsaesOaepSha256 = "RSAES_OAEP_SHA_256" -) - -// AlgorithmSpec_Values returns all elements of the AlgorithmSpec enum -func AlgorithmSpec_Values() []string { - return []string{ - AlgorithmSpecRsaesPkcs1V15, - AlgorithmSpecRsaesOaepSha1, - AlgorithmSpecRsaesOaepSha256, - } -} - -const ( - // ConnectionErrorCodeTypeInvalidCredentials is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeInvalidCredentials = "INVALID_CREDENTIALS" - - // ConnectionErrorCodeTypeClusterNotFound is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeClusterNotFound = "CLUSTER_NOT_FOUND" - - // ConnectionErrorCodeTypeNetworkErrors is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeNetworkErrors = "NETWORK_ERRORS" - - // ConnectionErrorCodeTypeInternalError is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeInternalError = "INTERNAL_ERROR" - - // ConnectionErrorCodeTypeInsufficientCloudhsmHsms is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeInsufficientCloudhsmHsms = "INSUFFICIENT_CLOUDHSM_HSMS" - - // ConnectionErrorCodeTypeUserLockedOut is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeUserLockedOut = "USER_LOCKED_OUT" - - // ConnectionErrorCodeTypeUserNotFound is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeUserNotFound = "USER_NOT_FOUND" - - // ConnectionErrorCodeTypeUserLoggedIn is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeUserLoggedIn = "USER_LOGGED_IN" - - // ConnectionErrorCodeTypeSubnetNotFound is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeSubnetNotFound = "SUBNET_NOT_FOUND" - - // ConnectionErrorCodeTypeInsufficientFreeAddressesInSubnet is a ConnectionErrorCodeType enum value - ConnectionErrorCodeTypeInsufficientFreeAddressesInSubnet = "INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET" -) - -// ConnectionErrorCodeType_Values returns all elements of the ConnectionErrorCodeType enum -func ConnectionErrorCodeType_Values() []string { - return []string{ - ConnectionErrorCodeTypeInvalidCredentials, - ConnectionErrorCodeTypeClusterNotFound, - ConnectionErrorCodeTypeNetworkErrors, - ConnectionErrorCodeTypeInternalError, - ConnectionErrorCodeTypeInsufficientCloudhsmHsms, - ConnectionErrorCodeTypeUserLockedOut, - ConnectionErrorCodeTypeUserNotFound, - ConnectionErrorCodeTypeUserLoggedIn, - ConnectionErrorCodeTypeSubnetNotFound, - ConnectionErrorCodeTypeInsufficientFreeAddressesInSubnet, - } -} - -const ( - // ConnectionStateTypeConnected is a ConnectionStateType enum value - ConnectionStateTypeConnected = "CONNECTED" - - // ConnectionStateTypeConnecting is a ConnectionStateType enum value - ConnectionStateTypeConnecting = "CONNECTING" - - // ConnectionStateTypeFailed is a ConnectionStateType enum value - ConnectionStateTypeFailed = "FAILED" - - // ConnectionStateTypeDisconnected is a ConnectionStateType enum value - ConnectionStateTypeDisconnected = "DISCONNECTED" - - // ConnectionStateTypeDisconnecting is a ConnectionStateType enum value - ConnectionStateTypeDisconnecting = "DISCONNECTING" -) - -// ConnectionStateType_Values returns all elements of the ConnectionStateType enum -func ConnectionStateType_Values() []string { - return []string{ - ConnectionStateTypeConnected, - ConnectionStateTypeConnecting, - ConnectionStateTypeFailed, - ConnectionStateTypeDisconnected, - ConnectionStateTypeDisconnecting, - } -} - -const ( - // CustomerMasterKeySpecRsa2048 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecRsa2048 = "RSA_2048" - - // CustomerMasterKeySpecRsa3072 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecRsa3072 = "RSA_3072" - - // CustomerMasterKeySpecRsa4096 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecRsa4096 = "RSA_4096" - - // CustomerMasterKeySpecEccNistP256 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecEccNistP256 = "ECC_NIST_P256" - - // CustomerMasterKeySpecEccNistP384 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecEccNistP384 = "ECC_NIST_P384" - - // CustomerMasterKeySpecEccNistP521 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecEccNistP521 = "ECC_NIST_P521" - - // CustomerMasterKeySpecEccSecgP256k1 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecEccSecgP256k1 = "ECC_SECG_P256K1" - - // CustomerMasterKeySpecSymmetricDefault is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecSymmetricDefault = "SYMMETRIC_DEFAULT" - - // CustomerMasterKeySpecHmac224 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecHmac224 = "HMAC_224" - - // CustomerMasterKeySpecHmac256 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecHmac256 = "HMAC_256" - - // CustomerMasterKeySpecHmac384 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecHmac384 = "HMAC_384" - - // CustomerMasterKeySpecHmac512 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecHmac512 = "HMAC_512" - - // CustomerMasterKeySpecSm2 is a CustomerMasterKeySpec enum value - CustomerMasterKeySpecSm2 = "SM2" -) - -// CustomerMasterKeySpec_Values returns all elements of the CustomerMasterKeySpec enum -func CustomerMasterKeySpec_Values() []string { - return []string{ - CustomerMasterKeySpecRsa2048, - CustomerMasterKeySpecRsa3072, - CustomerMasterKeySpecRsa4096, - CustomerMasterKeySpecEccNistP256, - CustomerMasterKeySpecEccNistP384, - CustomerMasterKeySpecEccNistP521, - CustomerMasterKeySpecEccSecgP256k1, - CustomerMasterKeySpecSymmetricDefault, - CustomerMasterKeySpecHmac224, - CustomerMasterKeySpecHmac256, - CustomerMasterKeySpecHmac384, - CustomerMasterKeySpecHmac512, - CustomerMasterKeySpecSm2, - } -} - -const ( - // DataKeyPairSpecRsa2048 is a DataKeyPairSpec enum value - DataKeyPairSpecRsa2048 = "RSA_2048" - - // DataKeyPairSpecRsa3072 is a DataKeyPairSpec enum value - DataKeyPairSpecRsa3072 = "RSA_3072" - - // DataKeyPairSpecRsa4096 is a DataKeyPairSpec enum value - DataKeyPairSpecRsa4096 = "RSA_4096" - - // DataKeyPairSpecEccNistP256 is a DataKeyPairSpec enum value - DataKeyPairSpecEccNistP256 = "ECC_NIST_P256" - - // DataKeyPairSpecEccNistP384 is a DataKeyPairSpec enum value - DataKeyPairSpecEccNistP384 = "ECC_NIST_P384" - - // DataKeyPairSpecEccNistP521 is a DataKeyPairSpec enum value - DataKeyPairSpecEccNistP521 = "ECC_NIST_P521" - - // DataKeyPairSpecEccSecgP256k1 is a DataKeyPairSpec enum value - DataKeyPairSpecEccSecgP256k1 = "ECC_SECG_P256K1" - - // DataKeyPairSpecSm2 is a DataKeyPairSpec enum value - DataKeyPairSpecSm2 = "SM2" -) - -// DataKeyPairSpec_Values returns all elements of the DataKeyPairSpec enum -func DataKeyPairSpec_Values() []string { - return []string{ - DataKeyPairSpecRsa2048, - DataKeyPairSpecRsa3072, - DataKeyPairSpecRsa4096, - DataKeyPairSpecEccNistP256, - DataKeyPairSpecEccNistP384, - DataKeyPairSpecEccNistP521, - DataKeyPairSpecEccSecgP256k1, - DataKeyPairSpecSm2, - } -} - -const ( - // DataKeySpecAes256 is a DataKeySpec enum value - DataKeySpecAes256 = "AES_256" - - // DataKeySpecAes128 is a DataKeySpec enum value - DataKeySpecAes128 = "AES_128" -) - -// DataKeySpec_Values returns all elements of the DataKeySpec enum -func DataKeySpec_Values() []string { - return []string{ - DataKeySpecAes256, - DataKeySpecAes128, - } -} - -const ( - // EncryptionAlgorithmSpecSymmetricDefault is a EncryptionAlgorithmSpec enum value - EncryptionAlgorithmSpecSymmetricDefault = "SYMMETRIC_DEFAULT" - - // EncryptionAlgorithmSpecRsaesOaepSha1 is a EncryptionAlgorithmSpec enum value - EncryptionAlgorithmSpecRsaesOaepSha1 = "RSAES_OAEP_SHA_1" - - // EncryptionAlgorithmSpecRsaesOaepSha256 is a EncryptionAlgorithmSpec enum value - EncryptionAlgorithmSpecRsaesOaepSha256 = "RSAES_OAEP_SHA_256" - - // EncryptionAlgorithmSpecSm2pke is a EncryptionAlgorithmSpec enum value - EncryptionAlgorithmSpecSm2pke = "SM2PKE" -) - -// EncryptionAlgorithmSpec_Values returns all elements of the EncryptionAlgorithmSpec enum -func EncryptionAlgorithmSpec_Values() []string { - return []string{ - EncryptionAlgorithmSpecSymmetricDefault, - EncryptionAlgorithmSpecRsaesOaepSha1, - EncryptionAlgorithmSpecRsaesOaepSha256, - EncryptionAlgorithmSpecSm2pke, - } -} - -const ( - // ExpirationModelTypeKeyMaterialExpires is a ExpirationModelType enum value - ExpirationModelTypeKeyMaterialExpires = "KEY_MATERIAL_EXPIRES" - - // ExpirationModelTypeKeyMaterialDoesNotExpire is a ExpirationModelType enum value - ExpirationModelTypeKeyMaterialDoesNotExpire = "KEY_MATERIAL_DOES_NOT_EXPIRE" -) - -// ExpirationModelType_Values returns all elements of the ExpirationModelType enum -func ExpirationModelType_Values() []string { - return []string{ - ExpirationModelTypeKeyMaterialExpires, - ExpirationModelTypeKeyMaterialDoesNotExpire, - } -} - -const ( - // GrantOperationDecrypt is a GrantOperation enum value - GrantOperationDecrypt = "Decrypt" - - // GrantOperationEncrypt is a GrantOperation enum value - GrantOperationEncrypt = "Encrypt" - - // GrantOperationGenerateDataKey is a GrantOperation enum value - GrantOperationGenerateDataKey = "GenerateDataKey" - - // GrantOperationGenerateDataKeyWithoutPlaintext is a GrantOperation enum value - GrantOperationGenerateDataKeyWithoutPlaintext = "GenerateDataKeyWithoutPlaintext" - - // GrantOperationReEncryptFrom is a GrantOperation enum value - GrantOperationReEncryptFrom = "ReEncryptFrom" - - // GrantOperationReEncryptTo is a GrantOperation enum value - GrantOperationReEncryptTo = "ReEncryptTo" - - // GrantOperationSign is a GrantOperation enum value - GrantOperationSign = "Sign" - - // GrantOperationVerify is a GrantOperation enum value - GrantOperationVerify = "Verify" - - // GrantOperationGetPublicKey is a GrantOperation enum value - GrantOperationGetPublicKey = "GetPublicKey" - - // GrantOperationCreateGrant is a GrantOperation enum value - GrantOperationCreateGrant = "CreateGrant" - - // GrantOperationRetireGrant is a GrantOperation enum value - GrantOperationRetireGrant = "RetireGrant" - - // GrantOperationDescribeKey is a GrantOperation enum value - GrantOperationDescribeKey = "DescribeKey" - - // GrantOperationGenerateDataKeyPair is a GrantOperation enum value - GrantOperationGenerateDataKeyPair = "GenerateDataKeyPair" - - // GrantOperationGenerateDataKeyPairWithoutPlaintext is a GrantOperation enum value - GrantOperationGenerateDataKeyPairWithoutPlaintext = "GenerateDataKeyPairWithoutPlaintext" - - // GrantOperationGenerateMac is a GrantOperation enum value - GrantOperationGenerateMac = "GenerateMac" - - // GrantOperationVerifyMac is a GrantOperation enum value - GrantOperationVerifyMac = "VerifyMac" -) - -// GrantOperation_Values returns all elements of the GrantOperation enum -func GrantOperation_Values() []string { - return []string{ - GrantOperationDecrypt, - GrantOperationEncrypt, - GrantOperationGenerateDataKey, - GrantOperationGenerateDataKeyWithoutPlaintext, - GrantOperationReEncryptFrom, - GrantOperationReEncryptTo, - GrantOperationSign, - GrantOperationVerify, - GrantOperationGetPublicKey, - GrantOperationCreateGrant, - GrantOperationRetireGrant, - GrantOperationDescribeKey, - GrantOperationGenerateDataKeyPair, - GrantOperationGenerateDataKeyPairWithoutPlaintext, - GrantOperationGenerateMac, - GrantOperationVerifyMac, - } -} - -const ( - // KeyManagerTypeAws is a KeyManagerType enum value - KeyManagerTypeAws = "AWS" - - // KeyManagerTypeCustomer is a KeyManagerType enum value - KeyManagerTypeCustomer = "CUSTOMER" -) - -// KeyManagerType_Values returns all elements of the KeyManagerType enum -func KeyManagerType_Values() []string { - return []string{ - KeyManagerTypeAws, - KeyManagerTypeCustomer, - } -} - -const ( - // KeySpecRsa2048 is a KeySpec enum value - KeySpecRsa2048 = "RSA_2048" - - // KeySpecRsa3072 is a KeySpec enum value - KeySpecRsa3072 = "RSA_3072" - - // KeySpecRsa4096 is a KeySpec enum value - KeySpecRsa4096 = "RSA_4096" - - // KeySpecEccNistP256 is a KeySpec enum value - KeySpecEccNistP256 = "ECC_NIST_P256" - - // KeySpecEccNistP384 is a KeySpec enum value - KeySpecEccNistP384 = "ECC_NIST_P384" - - // KeySpecEccNistP521 is a KeySpec enum value - KeySpecEccNistP521 = "ECC_NIST_P521" - - // KeySpecEccSecgP256k1 is a KeySpec enum value - KeySpecEccSecgP256k1 = "ECC_SECG_P256K1" - - // KeySpecSymmetricDefault is a KeySpec enum value - KeySpecSymmetricDefault = "SYMMETRIC_DEFAULT" - - // KeySpecHmac224 is a KeySpec enum value - KeySpecHmac224 = "HMAC_224" - - // KeySpecHmac256 is a KeySpec enum value - KeySpecHmac256 = "HMAC_256" - - // KeySpecHmac384 is a KeySpec enum value - KeySpecHmac384 = "HMAC_384" - - // KeySpecHmac512 is a KeySpec enum value - KeySpecHmac512 = "HMAC_512" - - // KeySpecSm2 is a KeySpec enum value - KeySpecSm2 = "SM2" -) - -// KeySpec_Values returns all elements of the KeySpec enum -func KeySpec_Values() []string { - return []string{ - KeySpecRsa2048, - KeySpecRsa3072, - KeySpecRsa4096, - KeySpecEccNistP256, - KeySpecEccNistP384, - KeySpecEccNistP521, - KeySpecEccSecgP256k1, - KeySpecSymmetricDefault, - KeySpecHmac224, - KeySpecHmac256, - KeySpecHmac384, - KeySpecHmac512, - KeySpecSm2, - } -} - -const ( - // KeyStateCreating is a KeyState enum value - KeyStateCreating = "Creating" - - // KeyStateEnabled is a KeyState enum value - KeyStateEnabled = "Enabled" - - // KeyStateDisabled is a KeyState enum value - KeyStateDisabled = "Disabled" - - // KeyStatePendingDeletion is a KeyState enum value - KeyStatePendingDeletion = "PendingDeletion" - - // KeyStatePendingImport is a KeyState enum value - KeyStatePendingImport = "PendingImport" - - // KeyStatePendingReplicaDeletion is a KeyState enum value - KeyStatePendingReplicaDeletion = "PendingReplicaDeletion" - - // KeyStateUnavailable is a KeyState enum value - KeyStateUnavailable = "Unavailable" - - // KeyStateUpdating is a KeyState enum value - KeyStateUpdating = "Updating" -) - -// KeyState_Values returns all elements of the KeyState enum -func KeyState_Values() []string { - return []string{ - KeyStateCreating, - KeyStateEnabled, - KeyStateDisabled, - KeyStatePendingDeletion, - KeyStatePendingImport, - KeyStatePendingReplicaDeletion, - KeyStateUnavailable, - KeyStateUpdating, - } -} - -const ( - // KeyUsageTypeSignVerify is a KeyUsageType enum value - KeyUsageTypeSignVerify = "SIGN_VERIFY" - - // KeyUsageTypeEncryptDecrypt is a KeyUsageType enum value - KeyUsageTypeEncryptDecrypt = "ENCRYPT_DECRYPT" - - // KeyUsageTypeGenerateVerifyMac is a KeyUsageType enum value - KeyUsageTypeGenerateVerifyMac = "GENERATE_VERIFY_MAC" -) - -// KeyUsageType_Values returns all elements of the KeyUsageType enum -func KeyUsageType_Values() []string { - return []string{ - KeyUsageTypeSignVerify, - KeyUsageTypeEncryptDecrypt, - KeyUsageTypeGenerateVerifyMac, - } -} - -const ( - // MacAlgorithmSpecHmacSha224 is a MacAlgorithmSpec enum value - MacAlgorithmSpecHmacSha224 = "HMAC_SHA_224" - - // MacAlgorithmSpecHmacSha256 is a MacAlgorithmSpec enum value - MacAlgorithmSpecHmacSha256 = "HMAC_SHA_256" - - // MacAlgorithmSpecHmacSha384 is a MacAlgorithmSpec enum value - MacAlgorithmSpecHmacSha384 = "HMAC_SHA_384" - - // MacAlgorithmSpecHmacSha512 is a MacAlgorithmSpec enum value - MacAlgorithmSpecHmacSha512 = "HMAC_SHA_512" -) - -// MacAlgorithmSpec_Values returns all elements of the MacAlgorithmSpec enum -func MacAlgorithmSpec_Values() []string { - return []string{ - MacAlgorithmSpecHmacSha224, - MacAlgorithmSpecHmacSha256, - MacAlgorithmSpecHmacSha384, - MacAlgorithmSpecHmacSha512, - } -} - -const ( - // MessageTypeRaw is a MessageType enum value - MessageTypeRaw = "RAW" - - // MessageTypeDigest is a MessageType enum value - MessageTypeDigest = "DIGEST" -) - -// MessageType_Values returns all elements of the MessageType enum -func MessageType_Values() []string { - return []string{ - MessageTypeRaw, - MessageTypeDigest, - } -} - -const ( - // MultiRegionKeyTypePrimary is a MultiRegionKeyType enum value - MultiRegionKeyTypePrimary = "PRIMARY" - - // MultiRegionKeyTypeReplica is a MultiRegionKeyType enum value - MultiRegionKeyTypeReplica = "REPLICA" -) - -// MultiRegionKeyType_Values returns all elements of the MultiRegionKeyType enum -func MultiRegionKeyType_Values() []string { - return []string{ - MultiRegionKeyTypePrimary, - MultiRegionKeyTypeReplica, - } -} - -const ( - // OriginTypeAwsKms is a OriginType enum value - OriginTypeAwsKms = "AWS_KMS" - - // OriginTypeExternal is a OriginType enum value - OriginTypeExternal = "EXTERNAL" - - // OriginTypeAwsCloudhsm is a OriginType enum value - OriginTypeAwsCloudhsm = "AWS_CLOUDHSM" -) - -// OriginType_Values returns all elements of the OriginType enum -func OriginType_Values() []string { - return []string{ - OriginTypeAwsKms, - OriginTypeExternal, - OriginTypeAwsCloudhsm, - } -} - -const ( - // SigningAlgorithmSpecRsassaPssSha256 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecRsassaPssSha256 = "RSASSA_PSS_SHA_256" - - // SigningAlgorithmSpecRsassaPssSha384 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecRsassaPssSha384 = "RSASSA_PSS_SHA_384" - - // SigningAlgorithmSpecRsassaPssSha512 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecRsassaPssSha512 = "RSASSA_PSS_SHA_512" - - // SigningAlgorithmSpecRsassaPkcs1V15Sha256 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecRsassaPkcs1V15Sha256 = "RSASSA_PKCS1_V1_5_SHA_256" - - // SigningAlgorithmSpecRsassaPkcs1V15Sha384 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecRsassaPkcs1V15Sha384 = "RSASSA_PKCS1_V1_5_SHA_384" - - // SigningAlgorithmSpecRsassaPkcs1V15Sha512 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecRsassaPkcs1V15Sha512 = "RSASSA_PKCS1_V1_5_SHA_512" - - // SigningAlgorithmSpecEcdsaSha256 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecEcdsaSha256 = "ECDSA_SHA_256" - - // SigningAlgorithmSpecEcdsaSha384 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecEcdsaSha384 = "ECDSA_SHA_384" - - // SigningAlgorithmSpecEcdsaSha512 is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecEcdsaSha512 = "ECDSA_SHA_512" - - // SigningAlgorithmSpecSm2dsa is a SigningAlgorithmSpec enum value - SigningAlgorithmSpecSm2dsa = "SM2DSA" -) - -// SigningAlgorithmSpec_Values returns all elements of the SigningAlgorithmSpec enum -func SigningAlgorithmSpec_Values() []string { - return []string{ - SigningAlgorithmSpecRsassaPssSha256, - SigningAlgorithmSpecRsassaPssSha384, - SigningAlgorithmSpecRsassaPssSha512, - SigningAlgorithmSpecRsassaPkcs1V15Sha256, - SigningAlgorithmSpecRsassaPkcs1V15Sha384, - SigningAlgorithmSpecRsassaPkcs1V15Sha512, - SigningAlgorithmSpecEcdsaSha256, - SigningAlgorithmSpecEcdsaSha384, - SigningAlgorithmSpecEcdsaSha512, - SigningAlgorithmSpecSm2dsa, - } -} - -const ( - // WrappingKeySpecRsa2048 is a WrappingKeySpec enum value - WrappingKeySpecRsa2048 = "RSA_2048" -) - -// WrappingKeySpec_Values returns all elements of the WrappingKeySpec enum -func WrappingKeySpec_Values() []string { - return []string{ - WrappingKeySpecRsa2048, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/doc.go b/vendor/github.com/aws/aws-sdk-go/service/kms/doc.go deleted file mode 100644 index d926e08e685..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/doc.go +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package kms provides the client and types for making API -// requests to AWS Key Management Service. -// -// Key Management Service (KMS) is an encryption and key management web service. -// This guide describes the KMS operations that you can call programmatically. -// For general information about KMS, see the Key Management Service Developer -// Guide (https://docs.aws.amazon.com/kms/latest/developerguide/). -// -// KMS is replacing the term customer master key (CMK) with KMS key and KMS -// key. The concept has not changed. To prevent breaking changes, KMS is keeping -// some variations of this term. -// -// Amazon Web Services provides SDKs that consist of libraries and sample code -// for various programming languages and platforms (Java, Ruby, .Net, macOS, -// Android, etc.). The SDKs provide a convenient way to create programmatic -// access to KMS and other Amazon Web Services services. For example, the SDKs -// take care of tasks such as signing requests (see below), managing errors, -// and retrying requests automatically. For more information about the Amazon -// Web Services SDKs, including how to download and install them, see Tools -// for Amazon Web Services (http://aws.amazon.com/tools/). -// -// We recommend that you use the Amazon Web Services SDKs to make programmatic -// API calls to KMS. -// -// If you need to use FIPS 140-2 validated cryptographic modules when communicating -// with Amazon Web Services, use the FIPS endpoint in your preferred Amazon -// Web Services Region. For more information about the available FIPS endpoints, -// see Service endpoints (https://docs.aws.amazon.com/general/latest/gr/kms.html#kms_region) -// in the Key Management Service topic of the Amazon Web Services General Reference. -// -// All KMS API calls must be signed and be transmitted using Transport Layer -// Security (TLS). KMS recommends you always use the latest supported TLS version. -// Clients must also support cipher suites with Perfect Forward Secrecy (PFS) -// such as Ephemeral Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman -// (ECDHE). Most modern systems such as Java 7 and later support these modes. -// -// # Signing Requests -// -// Requests must be signed by using an access key ID and a secret access key. -// We strongly recommend that you do not use your Amazon Web Services account -// (root) access key ID and secret key for everyday work with KMS. Instead, -// use the access key ID and secret access key for an IAM user. You can also -// use the Amazon Web Services Security Token Service to generate temporary -// security credentials that you can use to sign requests. -// -// All KMS operations require Signature Version 4 (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). -// -// # Logging API Requests -// -// KMS supports CloudTrail, a service that logs Amazon Web Services API calls -// and related events for your Amazon Web Services account and delivers them -// to an Amazon S3 bucket that you specify. By using the information collected -// by CloudTrail, you can determine what requests were made to KMS, who made -// the request, when it was made, and so on. To learn more about CloudTrail, -// including how to turn it on and find your log files, see the CloudTrail User -// Guide (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/). -// -// # Additional Resources -// -// For more information about credentials and request signing, see the following: -// -// - Amazon Web Services Security Credentials (https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html) -// -// - This topic provides general information about the types of credentials -// used to access Amazon Web Services. -// -// - Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) -// -// - This section of the IAM User Guide describes how to create and use temporary -// security credentials. -// -// - Signature Version 4 Signing Process (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) -// -// - This set of topics walks you through the process of signing a request -// using an access key ID and a secret access key. -// -// # Commonly Used API Operations -// -// Of the API operations discussed in this guide, the following will prove the -// most useful for most applications. You will likely perform operations other -// than these, such as creating keys and assigning policies, by using the console. -// -// - Encrypt -// -// - Decrypt -// -// - GenerateDataKey -// -// - GenerateDataKeyWithoutPlaintext -// -// See https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01 for more information on this service. -// -// See kms package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/kms/ -// -// # Using the Client -// -// To contact AWS Key Management Service with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the AWS Key Management Service client KMS for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/kms/#New -package kms diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/errors.go b/vendor/github.com/aws/aws-sdk-go/service/kms/errors.go deleted file mode 100644 index 4f8fc210490..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/errors.go +++ /dev/null @@ -1,376 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package kms - -import ( - "github.com/aws/aws-sdk-go/private/protocol" -) - -const ( - - // ErrCodeAlreadyExistsException for service response error code - // "AlreadyExistsException". - // - // The request was rejected because it attempted to create a resource that already - // exists. - ErrCodeAlreadyExistsException = "AlreadyExistsException" - - // ErrCodeCloudHsmClusterInUseException for service response error code - // "CloudHsmClusterInUseException". - // - // The request was rejected because the specified CloudHSM cluster is already - // associated with a custom key store or it shares a backup history with a cluster - // that is associated with a custom key store. Each custom key store must be - // associated with a different CloudHSM cluster. - // - // Clusters that share a backup history have the same cluster certificate. To - // view the cluster certificate of a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) - // operation. - ErrCodeCloudHsmClusterInUseException = "CloudHsmClusterInUseException" - - // ErrCodeCloudHsmClusterInvalidConfigurationException for service response error code - // "CloudHsmClusterInvalidConfigurationException". - // - // The request was rejected because the associated CloudHSM cluster did not - // meet the configuration requirements for a custom key store. - // - // * The cluster must be configured with private subnets in at least two - // different Availability Zones in the Region. - // - // * The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) - // (cloudhsm-cluster--sg) must include inbound rules and outbound - // rules that allow TCP traffic on ports 2223-2225. The Source in the inbound - // rules and the Destination in the outbound rules must match the security - // group ID. These rules are set by default when you create the cluster. - // Do not delete or change them. To get information about a particular security - // group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) - // operation. - // - // * The cluster must contain at least as many HSMs as the operation requires. - // To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) - // operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey - // operations, the CloudHSM cluster must have at least two active HSMs, each - // in a different Availability Zone. For the ConnectCustomKeyStore operation, - // the CloudHSM must contain at least one active HSM. - // - // For information about the requirements for an CloudHSM cluster that is associated - // with a custom key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) - // in the Key Management Service Developer Guide. For information about creating - // a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) - // in the CloudHSM User Guide. For information about cluster security groups, - // see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) - // in the CloudHSM User Guide . - ErrCodeCloudHsmClusterInvalidConfigurationException = "CloudHsmClusterInvalidConfigurationException" - - // ErrCodeCloudHsmClusterNotActiveException for service response error code - // "CloudHsmClusterNotActiveException". - // - // The request was rejected because the CloudHSM cluster that is associated - // with the custom key store is not active. Initialize and activate the cluster - // and try the command again. For detailed instructions, see Getting Started - // (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) - // in the CloudHSM User Guide. - ErrCodeCloudHsmClusterNotActiveException = "CloudHsmClusterNotActiveException" - - // ErrCodeCloudHsmClusterNotFoundException for service response error code - // "CloudHsmClusterNotFoundException". - // - // The request was rejected because KMS cannot find the CloudHSM cluster with - // the specified cluster ID. Retry the request with a different cluster ID. - ErrCodeCloudHsmClusterNotFoundException = "CloudHsmClusterNotFoundException" - - // ErrCodeCloudHsmClusterNotRelatedException for service response error code - // "CloudHsmClusterNotRelatedException". - // - // The request was rejected because the specified CloudHSM cluster has a different - // cluster certificate than the original cluster. You cannot use the operation - // to specify an unrelated cluster. - // - // Specify a cluster that shares a backup history with the original cluster. - // This includes clusters that were created from a backup of the current cluster, - // and clusters that were created from the same backup that produced the current - // cluster. - // - // Clusters that share a backup history have the same cluster certificate. To - // view the cluster certificate of a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) - // operation. - ErrCodeCloudHsmClusterNotRelatedException = "CloudHsmClusterNotRelatedException" - - // ErrCodeCustomKeyStoreHasCMKsException for service response error code - // "CustomKeyStoreHasCMKsException". - // - // The request was rejected because the custom key store contains KMS keys. - // After verifying that you do not need to use the KMS keys, use the ScheduleKeyDeletion - // operation to delete the KMS keys. After they are deleted, you can delete - // the custom key store. - ErrCodeCustomKeyStoreHasCMKsException = "CustomKeyStoreHasCMKsException" - - // ErrCodeCustomKeyStoreInvalidStateException for service response error code - // "CustomKeyStoreInvalidStateException". - // - // The request was rejected because of the ConnectionState of the custom key - // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores - // operation. - // - // This exception is thrown under the following conditions: - // - // * You requested the CreateKey or GenerateRandom operation in a custom - // key store that is not connected. These operations are valid only when - // the custom key store ConnectionState is CONNECTED. - // - // * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation - // on a custom key store that is not disconnected. This operation is valid - // only when the custom key store ConnectionState is DISCONNECTED. - // - // * You requested the ConnectCustomKeyStore operation on a custom key store - // with a ConnectionState of DISCONNECTING or FAILED. This operation is valid - // for all other ConnectionState values. - ErrCodeCustomKeyStoreInvalidStateException = "CustomKeyStoreInvalidStateException" - - // ErrCodeCustomKeyStoreNameInUseException for service response error code - // "CustomKeyStoreNameInUseException". - // - // The request was rejected because the specified custom key store name is already - // assigned to another custom key store in the account. Try again with a custom - // key store name that is unique in the account. - ErrCodeCustomKeyStoreNameInUseException = "CustomKeyStoreNameInUseException" - - // ErrCodeCustomKeyStoreNotFoundException for service response error code - // "CustomKeyStoreNotFoundException". - // - // The request was rejected because KMS cannot find a custom key store with - // the specified key store name or ID. - ErrCodeCustomKeyStoreNotFoundException = "CustomKeyStoreNotFoundException" - - // ErrCodeDependencyTimeoutException for service response error code - // "DependencyTimeoutException". - // - // The system timed out while trying to fulfill the request. The request can - // be retried. - ErrCodeDependencyTimeoutException = "DependencyTimeoutException" - - // ErrCodeDisabledException for service response error code - // "DisabledException". - // - // The request was rejected because the specified KMS key is not enabled. - ErrCodeDisabledException = "DisabledException" - - // ErrCodeExpiredImportTokenException for service response error code - // "ExpiredImportTokenException". - // - // The request was rejected because the specified import token is expired. Use - // GetParametersForImport to get a new import token and public key, use the - // new public key to encrypt the key material, and then try the request again. - ErrCodeExpiredImportTokenException = "ExpiredImportTokenException" - - // ErrCodeIncorrectKeyException for service response error code - // "IncorrectKeyException". - // - // The request was rejected because the specified KMS key cannot decrypt the - // data. The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request - // must identify the same KMS key that was used to encrypt the ciphertext. - ErrCodeIncorrectKeyException = "IncorrectKeyException" - - // ErrCodeIncorrectKeyMaterialException for service response error code - // "IncorrectKeyMaterialException". - // - // The request was rejected because the key material in the request is, expired, - // invalid, or is not the same key material that was previously imported into - // this KMS key. - ErrCodeIncorrectKeyMaterialException = "IncorrectKeyMaterialException" - - // ErrCodeIncorrectTrustAnchorException for service response error code - // "IncorrectTrustAnchorException". - // - // The request was rejected because the trust anchor certificate in the request - // is not the trust anchor certificate for the specified CloudHSM cluster. - // - // When you initialize the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr), - // you create the trust anchor certificate and save it in the customerCA.crt - // file. - ErrCodeIncorrectTrustAnchorException = "IncorrectTrustAnchorException" - - // ErrCodeInternalException for service response error code - // "KMSInternalException". - // - // The request was rejected because an internal exception occurred. The request - // can be retried. - ErrCodeInternalException = "KMSInternalException" - - // ErrCodeInvalidAliasNameException for service response error code - // "InvalidAliasNameException". - // - // The request was rejected because the specified alias name is not valid. - ErrCodeInvalidAliasNameException = "InvalidAliasNameException" - - // ErrCodeInvalidArnException for service response error code - // "InvalidArnException". - // - // The request was rejected because a specified ARN, or an ARN in a key policy, - // is not valid. - ErrCodeInvalidArnException = "InvalidArnException" - - // ErrCodeInvalidCiphertextException for service response error code - // "InvalidCiphertextException". - // - // From the Decrypt or ReEncrypt operation, the request was rejected because - // the specified ciphertext, or additional authenticated data incorporated into - // the ciphertext, such as the encryption context, is corrupted, missing, or - // otherwise invalid. - // - // From the ImportKeyMaterial operation, the request was rejected because KMS - // could not decrypt the encrypted (wrapped) key material. - ErrCodeInvalidCiphertextException = "InvalidCiphertextException" - - // ErrCodeInvalidGrantIdException for service response error code - // "InvalidGrantIdException". - // - // The request was rejected because the specified GrantId is not valid. - ErrCodeInvalidGrantIdException = "InvalidGrantIdException" - - // ErrCodeInvalidGrantTokenException for service response error code - // "InvalidGrantTokenException". - // - // The request was rejected because the specified grant token is not valid. - ErrCodeInvalidGrantTokenException = "InvalidGrantTokenException" - - // ErrCodeInvalidImportTokenException for service response error code - // "InvalidImportTokenException". - // - // The request was rejected because the provided import token is invalid or - // is associated with a different KMS key. - ErrCodeInvalidImportTokenException = "InvalidImportTokenException" - - // ErrCodeInvalidKeyUsageException for service response error code - // "InvalidKeyUsageException". - // - // The request was rejected for one of the following reasons: - // - // * The KeyUsage value of the KMS key is incompatible with the API operation. - // - // * The encryption algorithm or signing algorithm specified for the operation - // is incompatible with the type of key material in the KMS key (KeySpec). - // - // For encrypting, decrypting, re-encrypting, and generating data keys, the - // KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the - // KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication - // codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. To find the KeyUsage - // of a KMS key, use the DescribeKey operation. - // - // To find the encryption or signing algorithms supported for a particular KMS - // key, use the DescribeKey operation. - ErrCodeInvalidKeyUsageException = "InvalidKeyUsageException" - - // ErrCodeInvalidMarkerException for service response error code - // "InvalidMarkerException". - // - // The request was rejected because the marker that specifies where pagination - // should next begin is not valid. - ErrCodeInvalidMarkerException = "InvalidMarkerException" - - // ErrCodeInvalidStateException for service response error code - // "KMSInvalidStateException". - // - // The request was rejected because the state of the specified resource is not - // valid for this request. - // - // For more information about how key state affects the use of a KMS key, see - // Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) - // in the Key Management Service Developer Guide . - ErrCodeInvalidStateException = "KMSInvalidStateException" - - // ErrCodeKMSInvalidMacException for service response error code - // "KMSInvalidMacException". - // - // The request was rejected because the HMAC verification failed. HMAC verification - // fails when the HMAC computed by using the specified message, HMAC KMS key, - // and MAC algorithm does not match the HMAC specified in the request. - ErrCodeKMSInvalidMacException = "KMSInvalidMacException" - - // ErrCodeKMSInvalidSignatureException for service response error code - // "KMSInvalidSignatureException". - // - // The request was rejected because the signature verification failed. Signature - // verification fails when it cannot confirm that signature was produced by - // signing the specified message with the specified KMS key and signing algorithm. - ErrCodeKMSInvalidSignatureException = "KMSInvalidSignatureException" - - // ErrCodeKeyUnavailableException for service response error code - // "KeyUnavailableException". - // - // The request was rejected because the specified KMS key was not available. - // You can retry the request. - ErrCodeKeyUnavailableException = "KeyUnavailableException" - - // ErrCodeLimitExceededException for service response error code - // "LimitExceededException". - // - // The request was rejected because a quota was exceeded. For more information, - // see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) - // in the Key Management Service Developer Guide. - ErrCodeLimitExceededException = "LimitExceededException" - - // ErrCodeMalformedPolicyDocumentException for service response error code - // "MalformedPolicyDocumentException". - // - // The request was rejected because the specified policy is not syntactically - // or semantically correct. - ErrCodeMalformedPolicyDocumentException = "MalformedPolicyDocumentException" - - // ErrCodeNotFoundException for service response error code - // "NotFoundException". - // - // The request was rejected because the specified entity or resource could not - // be found. - ErrCodeNotFoundException = "NotFoundException" - - // ErrCodeTagException for service response error code - // "TagException". - // - // The request was rejected because one or more tags are not valid. - ErrCodeTagException = "TagException" - - // ErrCodeUnsupportedOperationException for service response error code - // "UnsupportedOperationException". - // - // The request was rejected because a specified parameter is not supported or - // a specified resource is not valid for this operation. - ErrCodeUnsupportedOperationException = "UnsupportedOperationException" -) - -var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{ - "AlreadyExistsException": newErrorAlreadyExistsException, - "CloudHsmClusterInUseException": newErrorCloudHsmClusterInUseException, - "CloudHsmClusterInvalidConfigurationException": newErrorCloudHsmClusterInvalidConfigurationException, - "CloudHsmClusterNotActiveException": newErrorCloudHsmClusterNotActiveException, - "CloudHsmClusterNotFoundException": newErrorCloudHsmClusterNotFoundException, - "CloudHsmClusterNotRelatedException": newErrorCloudHsmClusterNotRelatedException, - "CustomKeyStoreHasCMKsException": newErrorCustomKeyStoreHasCMKsException, - "CustomKeyStoreInvalidStateException": newErrorCustomKeyStoreInvalidStateException, - "CustomKeyStoreNameInUseException": newErrorCustomKeyStoreNameInUseException, - "CustomKeyStoreNotFoundException": newErrorCustomKeyStoreNotFoundException, - "DependencyTimeoutException": newErrorDependencyTimeoutException, - "DisabledException": newErrorDisabledException, - "ExpiredImportTokenException": newErrorExpiredImportTokenException, - "IncorrectKeyException": newErrorIncorrectKeyException, - "IncorrectKeyMaterialException": newErrorIncorrectKeyMaterialException, - "IncorrectTrustAnchorException": newErrorIncorrectTrustAnchorException, - "KMSInternalException": newErrorInternalException, - "InvalidAliasNameException": newErrorInvalidAliasNameException, - "InvalidArnException": newErrorInvalidArnException, - "InvalidCiphertextException": newErrorInvalidCiphertextException, - "InvalidGrantIdException": newErrorInvalidGrantIdException, - "InvalidGrantTokenException": newErrorInvalidGrantTokenException, - "InvalidImportTokenException": newErrorInvalidImportTokenException, - "InvalidKeyUsageException": newErrorInvalidKeyUsageException, - "InvalidMarkerException": newErrorInvalidMarkerException, - "KMSInvalidStateException": newErrorInvalidStateException, - "KMSInvalidMacException": newErrorKMSInvalidMacException, - "KMSInvalidSignatureException": newErrorKMSInvalidSignatureException, - "KeyUnavailableException": newErrorKeyUnavailableException, - "LimitExceededException": newErrorLimitExceededException, - "MalformedPolicyDocumentException": newErrorMalformedPolicyDocumentException, - "NotFoundException": newErrorNotFoundException, - "TagException": newErrorTagException, - "UnsupportedOperationException": newErrorUnsupportedOperationException, -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/service.go b/vendor/github.com/aws/aws-sdk-go/service/kms/service.go deleted file mode 100644 index c1717d0d81c..00000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/service.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package kms - -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" - "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" -) - -// KMS provides the API operation methods for making requests to -// AWS Key Management Service. See this package's package overview docs -// for details on the service. -// -// KMS methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type KMS 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) - -// Service information constants -const ( - ServiceName = "kms" // Name of service. - EndpointsID = ServiceName // ID to lookup a service endpoint with. - ServiceID = "KMS" // ServiceID is a unique identifier of a specific service. -) - -// New creates a new instance of the KMS 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: -// -// mySession := session.Must(session.NewSession()) -// -// // Create a KMS client from just a session. -// svc := kms.New(mySession) -// -// // Create a KMS client with additional configuration -// svc := kms.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *KMS { - c := p.ClientConfig(EndpointsID, cfgs...) - if c.SigningNameDerived || len(c.SigningName) == 0 { - c.SigningName = EndpointsID - // No Fallback - } - return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *KMS { - svc := &KMS{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - ServiceID: ServiceID, - SigningName: signingName, - SigningRegion: signingRegion, - PartitionID: partitionID, - Endpoint: endpoint, - APIVersion: "2014-11-01", - ResolvedRegion: resolvedRegion, - JSONVersion: "1.1", - TargetPrefix: "TrentService", - }, - 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( - protocol.NewUnmarshalErrorHandler(jsonrpc.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(), - ) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a KMS operation and runs any -// custom request initialization. -func (c *KMS) 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/google/cadvisor/utils/cloudinfo/aws/aws.go b/vendor/github.com/google/cadvisor/utils/cloudinfo/aws/aws.go deleted file mode 100644 index 01aee36dd49..00000000000 --- a/vendor/github.com/google/cadvisor/utils/cloudinfo/aws/aws.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package cloudinfo - -import ( - "io/ioutil" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" - - info "github.com/google/cadvisor/info/v1" - "github.com/google/cadvisor/utils/cloudinfo" -) - -const ( - productVerFileName = "/sys/class/dmi/id/product_version" - biosVerFileName = "/sys/class/dmi/id/bios_vendor" - systemdOSReleaseFileName = "/etc/os-release" - amazon = "amazon" -) - -func init() { - cloudinfo.RegisterCloudProvider(info.AWS, &provider{}) -} - -type provider struct{} - -var _ cloudinfo.CloudProvider = provider{} - -func (provider) IsActiveProvider() bool { - return fileContainsAmazonIdentifier(productVerFileName) || - fileContainsAmazonIdentifier(biosVerFileName) || - fileContainsAmazonIdentifier(systemdOSReleaseFileName) -} - -func fileContainsAmazonIdentifier(filename string) bool { - fileContent, err := ioutil.ReadFile(filename) - if err != nil { - return false - } - - return strings.Contains(string(fileContent), amazon) -} - -func getAwsMetadata(name string) string { - sess, err := session.NewSession(&aws.Config{}) - if err != nil { - return info.UnknownInstance - } - client := ec2metadata.New(sess) - data, err := client.GetMetadata(name) - if err != nil { - return info.UnknownInstance - } - return data -} - -func (provider) GetInstanceType() info.InstanceType { - return info.InstanceType(getAwsMetadata("instance-type")) -} - -func (provider) GetInstanceID() info.InstanceID { - return info.InstanceID(getAwsMetadata("instance-id")) -} diff --git a/vendor/github.com/stretchr/objx/.codeclimate.yml b/vendor/github.com/stretchr/objx/.codeclimate.yml deleted file mode 100644 index 559fa399c13..00000000000 --- a/vendor/github.com/stretchr/objx/.codeclimate.yml +++ /dev/null @@ -1,21 +0,0 @@ -engines: - gofmt: - enabled: true - golint: - enabled: true - govet: - enabled: true - -exclude_patterns: -- ".github/" -- "vendor/" -- "codegen/" -- "*.yml" -- ".*.yml" -- "*.md" -- "Gopkg.*" -- "doc.go" -- "type_specific_codegen_test.go" -- "type_specific_codegen.go" -- ".gitignore" -- "LICENSE" diff --git a/vendor/github.com/stretchr/objx/.gitignore b/vendor/github.com/stretchr/objx/.gitignore deleted file mode 100644 index ea58090bd21..00000000000 --- a/vendor/github.com/stretchr/objx/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out diff --git a/vendor/github.com/stretchr/objx/LICENSE b/vendor/github.com/stretchr/objx/LICENSE deleted file mode 100644 index 44d4d9d5a7c..00000000000 --- a/vendor/github.com/stretchr/objx/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License - -Copyright (c) 2014 Stretchr, Inc. -Copyright (c) 2017-2018 objx contributors - -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/objx/README.md b/vendor/github.com/stretchr/objx/README.md deleted file mode 100644 index 246660b21a9..00000000000 --- a/vendor/github.com/stretchr/objx/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# Objx -[![Build Status](https://travis-ci.org/stretchr/objx.svg?branch=master)](https://travis-ci.org/stretchr/objx) -[![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/objx)](https://goreportcard.com/report/github.com/stretchr/objx) -[![Maintainability](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/maintainability)](https://codeclimate.com/github/stretchr/objx/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/test_coverage)](https://codeclimate.com/github/stretchr/objx/test_coverage) -[![Sourcegraph](https://sourcegraph.com/github.com/stretchr/objx/-/badge.svg)](https://sourcegraph.com/github.com/stretchr/objx) -[![GoDoc](https://godoc.org/github.com/stretchr/objx?status.svg)](https://godoc.org/github.com/stretchr/objx) - -Objx - Go package for dealing with maps, slices, JSON and other data. - -Get started: - -- Install Objx with [one line of code](#installation), or [update it with another](#staying-up-to-date) -- Check out the API Documentation http://godoc.org/github.com/stretchr/objx - -## Overview -Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes a powerful `Get` method (among others) that allows you to easily and quickly get access to data within the map, without having to worry too much about type assertions, missing data, default values etc. - -### Pattern -Objx uses a preditable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going: - - m, err := objx.FromJSON(json) - -NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, the rest will be optimistic and try to figure things out without panicking. - -Use `Get` to access the value you're interested in. You can use dot and array -notation too: - - m.Get("places[0].latlng") - -Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type. - - if m.Get("code").IsStr() { // Your code... } - -Or you can just assume the type, and use one of the strong type methods to extract the real value: - - m.Get("code").Int() - -If there's no value there (or if it's the wrong type) then a default value will be returned, or you can be explicit about the default value. - - Get("code").Int(-1) - -If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, manipulating and selecting that data. You can find out more by exploring the index below. - -### Reading data -A simple example of how to use Objx: - - // Use MustFromJSON to make an objx.Map from some JSON - m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) - - // Get the details - name := m.Get("name").Str() - age := m.Get("age").Int() - - // Get their nickname (or use their name if they don't have one) - nickname := m.Get("nickname").Str(name) - -### Ranging -Since `objx.Map` is a `map[string]interface{}` you can treat it as such. For example, to `range` the data, do what you would expect: - - m := objx.MustFromJSON(json) - for key, value := range m { - // Your code... - } - -## Installation -To install Objx, use go get: - - go get github.com/stretchr/objx - -### Staying up to date -To update Objx to the latest version, run: - - go get -u github.com/stretchr/objx - -### Supported go versions -We support the lastest three major Go versions, which are 1.10, 1.11 and 1.12 at the moment. - -## Contributing -Please feel free to submit issues, fork the repository and send pull requests! diff --git a/vendor/github.com/stretchr/objx/Taskfile.yml b/vendor/github.com/stretchr/objx/Taskfile.yml deleted file mode 100644 index 7746f516da2..00000000000 --- a/vendor/github.com/stretchr/objx/Taskfile.yml +++ /dev/null @@ -1,30 +0,0 @@ -version: '2' - -env: - GOFLAGS: -mod=vendor - -tasks: - default: - deps: [test] - - lint: - desc: Checks code style - cmds: - - gofmt -d -s *.go - - go vet ./... - silent: true - - lint-fix: - desc: Fixes code style - cmds: - - gofmt -w -s *.go - - test: - desc: Runs go tests - cmds: - - go test -race ./... - - test-coverage: - desc: Runs go tests and calculates test coverage - cmds: - - go test -race -coverprofile=c.out ./... diff --git a/vendor/github.com/stretchr/objx/accessors.go b/vendor/github.com/stretchr/objx/accessors.go deleted file mode 100644 index 4c604558863..00000000000 --- a/vendor/github.com/stretchr/objx/accessors.go +++ /dev/null @@ -1,197 +0,0 @@ -package objx - -import ( - "reflect" - "regexp" - "strconv" - "strings" -) - -const ( - // PathSeparator is the character used to separate the elements - // of the keypath. - // - // For example, `location.address.city` - PathSeparator string = "." - - // arrayAccesRegexString is the regex used to extract the array number - // from the access path - arrayAccesRegexString = `^(.+)\[([0-9]+)\]$` - - // mapAccessRegexString is the regex used to extract the map key - // from the access path - mapAccessRegexString = `^([^\[]*)\[([^\]]+)\](.*)$` -) - -// arrayAccesRegex is the compiled arrayAccesRegexString -var arrayAccesRegex = regexp.MustCompile(arrayAccesRegexString) - -// mapAccessRegex is the compiled mapAccessRegexString -var mapAccessRegex = regexp.MustCompile(mapAccessRegexString) - -// Get gets the value using the specified selector and -// returns it inside a new Obj object. -// -// If it cannot find the value, Get will return a nil -// value inside an instance of Obj. -// -// Get can only operate directly on map[string]interface{} and []interface. -// -// Example -// -// To access the title of the third chapter of the second book, do: -// -// o.Get("books[1].chapters[2].title") -func (m Map) Get(selector string) *Value { - rawObj := access(m, selector, nil, false) - return &Value{data: rawObj} -} - -// Set sets the value using the specified selector and -// returns the object on which Set was called. -// -// Set can only operate directly on map[string]interface{} and []interface -// -// Example -// -// To set the title of the third chapter of the second book, do: -// -// o.Set("books[1].chapters[2].title","Time to Go") -func (m Map) Set(selector string, value interface{}) Map { - access(m, selector, value, true) - return m -} - -// getIndex returns the index, which is hold in s by two braches. -// It also returns s withour the index part, e.g. name[1] will return (1, name). -// If no index is found, -1 is returned -func getIndex(s string) (int, string) { - arrayMatches := arrayAccesRegex.FindStringSubmatch(s) - if len(arrayMatches) > 0 { - // Get the key into the map - selector := arrayMatches[1] - // Get the index into the array at the key - // We know this cannt fail because arrayMatches[2] is an int for sure - index, _ := strconv.Atoi(arrayMatches[2]) - return index, selector - } - return -1, s -} - -// getKey returns the key which is held in s by two brackets. -// It also returns the next selector. -func getKey(s string) (string, string) { - selSegs := strings.SplitN(s, PathSeparator, 2) - thisSel := selSegs[0] - nextSel := "" - - if len(selSegs) > 1 { - nextSel = selSegs[1] - } - - mapMatches := mapAccessRegex.FindStringSubmatch(s) - if len(mapMatches) > 0 { - if _, err := strconv.Atoi(mapMatches[2]); err != nil { - thisSel = mapMatches[1] - nextSel = "[" + mapMatches[2] + "]" + mapMatches[3] - - if thisSel == "" { - thisSel = mapMatches[2] - nextSel = mapMatches[3] - } - - if nextSel == "" { - selSegs = []string{"", ""} - } else if nextSel[0] == '.' { - nextSel = nextSel[1:] - } - } - } - - return thisSel, nextSel -} - -// access accesses the object using the selector and performs the -// appropriate action. -func access(current interface{}, selector string, value interface{}, isSet bool) interface{} { - thisSel, nextSel := getKey(selector) - - indexes := []int{} - for strings.Contains(thisSel, "[") { - prevSel := thisSel - index := -1 - index, thisSel = getIndex(thisSel) - indexes = append(indexes, index) - if prevSel == thisSel { - break - } - } - - if curMap, ok := current.(Map); ok { - current = map[string]interface{}(curMap) - } - // get the object in question - switch current.(type) { - case map[string]interface{}: - curMSI := current.(map[string]interface{}) - if nextSel == "" && isSet { - curMSI[thisSel] = value - return nil - } - - _, ok := curMSI[thisSel].(map[string]interface{}) - if !ok { - _, ok = curMSI[thisSel].(Map) - } - - if (curMSI[thisSel] == nil || !ok) && len(indexes) == 0 && isSet { - curMSI[thisSel] = map[string]interface{}{} - } - - current = curMSI[thisSel] - default: - current = nil - } - - // do we need to access the item of an array? - if len(indexes) > 0 { - num := len(indexes) - for num > 0 { - num-- - index := indexes[num] - indexes = indexes[:num] - if array, ok := interSlice(current); ok { - if index < len(array) { - current = array[index] - } else { - current = nil - break - } - } - } - } - - if nextSel != "" { - current = access(current, nextSel, value, isSet) - } - return current -} - -func interSlice(slice interface{}) ([]interface{}, bool) { - if array, ok := slice.([]interface{}); ok { - return array, ok - } - - s := reflect.ValueOf(slice) - if s.Kind() != reflect.Slice { - return nil, false - } - - ret := make([]interface{}, s.Len()) - - for i := 0; i < s.Len(); i++ { - ret[i] = s.Index(i).Interface() - } - - return ret, true -} diff --git a/vendor/github.com/stretchr/objx/conversions.go b/vendor/github.com/stretchr/objx/conversions.go deleted file mode 100644 index 080aa46e472..00000000000 --- a/vendor/github.com/stretchr/objx/conversions.go +++ /dev/null @@ -1,280 +0,0 @@ -package objx - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "net/url" - "strconv" -) - -// SignatureSeparator is the character that is used to -// separate the Base64 string from the security signature. -const SignatureSeparator = "_" - -// URLValuesSliceKeySuffix is the character that is used to -// specify a suffic for slices parsed by URLValues. -// If the suffix is set to "[i]", then the index of the slice -// is used in place of i -// Ex: Suffix "[]" would have the form a[]=b&a[]=c -// OR Suffix "[i]" would have the form a[0]=b&a[1]=c -// OR Suffix "" would have the form a=b&a=c -var urlValuesSliceKeySuffix = "[]" - -const ( - URLValuesSliceKeySuffixEmpty = "" - URLValuesSliceKeySuffixArray = "[]" - URLValuesSliceKeySuffixIndex = "[i]" -) - -// SetURLValuesSliceKeySuffix sets the character that is used to -// specify a suffic for slices parsed by URLValues. -// If the suffix is set to "[i]", then the index of the slice -// is used in place of i -// Ex: Suffix "[]" would have the form a[]=b&a[]=c -// OR Suffix "[i]" would have the form a[0]=b&a[1]=c -// OR Suffix "" would have the form a=b&a=c -func SetURLValuesSliceKeySuffix(s string) error { - if s == URLValuesSliceKeySuffixEmpty || s == URLValuesSliceKeySuffixArray || s == URLValuesSliceKeySuffixIndex { - urlValuesSliceKeySuffix = s - return nil - } - - return errors.New("objx: Invalid URLValuesSliceKeySuffix provided.") -} - -// JSON converts the contained object to a JSON string -// representation -func (m Map) JSON() (string, error) { - for k, v := range m { - m[k] = cleanUp(v) - } - - result, err := json.Marshal(m) - if err != nil { - err = errors.New("objx: JSON encode failed with: " + err.Error()) - } - return string(result), err -} - -func cleanUpInterfaceArray(in []interface{}) []interface{} { - result := make([]interface{}, len(in)) - for i, v := range in { - result[i] = cleanUp(v) - } - return result -} - -func cleanUpInterfaceMap(in map[interface{}]interface{}) Map { - result := Map{} - for k, v := range in { - result[fmt.Sprintf("%v", k)] = cleanUp(v) - } - return result -} - -func cleanUpStringMap(in map[string]interface{}) Map { - result := Map{} - for k, v := range in { - result[k] = cleanUp(v) - } - return result -} - -func cleanUpMSIArray(in []map[string]interface{}) []Map { - result := make([]Map, len(in)) - for i, v := range in { - result[i] = cleanUpStringMap(v) - } - return result -} - -func cleanUpMapArray(in []Map) []Map { - result := make([]Map, len(in)) - for i, v := range in { - result[i] = cleanUpStringMap(v) - } - return result -} - -func cleanUp(v interface{}) interface{} { - switch v := v.(type) { - case []interface{}: - return cleanUpInterfaceArray(v) - case []map[string]interface{}: - return cleanUpMSIArray(v) - case map[interface{}]interface{}: - return cleanUpInterfaceMap(v) - case Map: - return cleanUpStringMap(v) - case []Map: - return cleanUpMapArray(v) - default: - return v - } -} - -// MustJSON converts the contained object to a JSON string -// representation and panics if there is an error -func (m Map) MustJSON() string { - result, err := m.JSON() - if err != nil { - panic(err.Error()) - } - return result -} - -// Base64 converts the contained object to a Base64 string -// representation of the JSON string representation -func (m Map) Base64() (string, error) { - var buf bytes.Buffer - - jsonData, err := m.JSON() - if err != nil { - return "", err - } - - encoder := base64.NewEncoder(base64.StdEncoding, &buf) - _, _ = encoder.Write([]byte(jsonData)) - _ = encoder.Close() - - return buf.String(), nil -} - -// MustBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and panics -// if there is an error -func (m Map) MustBase64() string { - result, err := m.Base64() - if err != nil { - panic(err.Error()) - } - return result -} - -// SignedBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and signs it -// using the provided key. -func (m Map) SignedBase64(key string) (string, error) { - base64, err := m.Base64() - if err != nil { - return "", err - } - - sig := HashWithKey(base64, key) - return base64 + SignatureSeparator + sig, nil -} - -// MustSignedBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and signs it -// using the provided key and panics if there is an error -func (m Map) MustSignedBase64(key string) string { - result, err := m.SignedBase64(key) - if err != nil { - panic(err.Error()) - } - return result -} - -/* - URL Query - ------------------------------------------------ -*/ - -// URLValues creates a url.Values object from an Obj. This -// function requires that the wrapped object be a map[string]interface{} -func (m Map) URLValues() url.Values { - vals := make(url.Values) - - m.parseURLValues(m, vals, "") - - return vals -} - -func (m Map) parseURLValues(queryMap Map, vals url.Values, key string) { - useSliceIndex := false - if urlValuesSliceKeySuffix == "[i]" { - useSliceIndex = true - } - - for k, v := range queryMap { - val := &Value{data: v} - switch { - case val.IsObjxMap(): - if key == "" { - m.parseURLValues(val.ObjxMap(), vals, k) - } else { - m.parseURLValues(val.ObjxMap(), vals, key+"["+k+"]") - } - case val.IsObjxMapSlice(): - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.MustObjxMapSlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - m.parseURLValues(sv, vals, sk) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - for _, sv := range val.MustObjxMapSlice() { - m.parseURLValues(sv, vals, sliceKey) - } - } - case val.IsMSISlice(): - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.MustMSISlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - m.parseURLValues(New(sv), vals, sk) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - for _, sv := range val.MustMSISlice() { - m.parseURLValues(New(sv), vals, sliceKey) - } - } - case val.IsStrSlice(), val.IsBoolSlice(), - val.IsFloat32Slice(), val.IsFloat64Slice(), - val.IsIntSlice(), val.IsInt8Slice(), val.IsInt16Slice(), val.IsInt32Slice(), val.IsInt64Slice(), - val.IsUintSlice(), val.IsUint8Slice(), val.IsUint16Slice(), val.IsUint32Slice(), val.IsUint64Slice(): - - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.StringSlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - vals.Set(sk, sv) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - vals[sliceKey] = val.StringSlice() - } - - default: - if key == "" { - vals.Set(k, val.String()) - } else { - vals.Set(key+"["+k+"]", val.String()) - } - } - } -} - -// URLQuery gets an encoded URL query representing the given -// Obj. This function requires that the wrapped object be a -// map[string]interface{} -func (m Map) URLQuery() (string, error) { - return m.URLValues().Encode(), nil -} diff --git a/vendor/github.com/stretchr/objx/doc.go b/vendor/github.com/stretchr/objx/doc.go deleted file mode 100644 index 6d6af1a83ab..00000000000 --- a/vendor/github.com/stretchr/objx/doc.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Objx - Go package for dealing with maps, slices, JSON and other data. - -Overview - -Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes -a powerful `Get` method (among others) that allows you to easily and quickly get -access to data within the map, without having to worry too much about type assertions, -missing data, default values etc. - -Pattern - -Objx uses a preditable pattern to make access data from within `map[string]interface{}` easy. -Call one of the `objx.` functions to create your `objx.Map` to get going: - - m, err := objx.FromJSON(json) - -NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, -the rest will be optimistic and try to figure things out without panicking. - -Use `Get` to access the value you're interested in. You can use dot and array -notation too: - - m.Get("places[0].latlng") - -Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type. - - if m.Get("code").IsStr() { // Your code... } - -Or you can just assume the type, and use one of the strong type methods to extract the real value: - - m.Get("code").Int() - -If there's no value there (or if it's the wrong type) then a default value will be returned, -or you can be explicit about the default value. - - Get("code").Int(-1) - -If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, -manipulating and selecting that data. You can find out more by exploring the index below. - -Reading data - -A simple example of how to use Objx: - - // Use MustFromJSON to make an objx.Map from some JSON - m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) - - // Get the details - name := m.Get("name").Str() - age := m.Get("age").Int() - - // Get their nickname (or use their name if they don't have one) - nickname := m.Get("nickname").Str(name) - -Ranging - -Since `objx.Map` is a `map[string]interface{}` you can treat it as such. -For example, to `range` the data, do what you would expect: - - m := objx.MustFromJSON(json) - for key, value := range m { - // Your code... - } -*/ -package objx diff --git a/vendor/github.com/stretchr/objx/map.go b/vendor/github.com/stretchr/objx/map.go deleted file mode 100644 index a64712a08b5..00000000000 --- a/vendor/github.com/stretchr/objx/map.go +++ /dev/null @@ -1,215 +0,0 @@ -package objx - -import ( - "encoding/base64" - "encoding/json" - "errors" - "io/ioutil" - "net/url" - "strings" -) - -// MSIConvertable is an interface that defines methods for converting your -// custom types to a map[string]interface{} representation. -type MSIConvertable interface { - // MSI gets a map[string]interface{} (msi) representing the - // object. - MSI() map[string]interface{} -} - -// Map provides extended functionality for working with -// untyped data, in particular map[string]interface (msi). -type Map map[string]interface{} - -// Value returns the internal value instance -func (m Map) Value() *Value { - return &Value{data: m} -} - -// Nil represents a nil Map. -var Nil = New(nil) - -// New creates a new Map containing the map[string]interface{} in the data argument. -// If the data argument is not a map[string]interface, New attempts to call the -// MSI() method on the MSIConvertable interface to create one. -func New(data interface{}) Map { - if _, ok := data.(map[string]interface{}); !ok { - if converter, ok := data.(MSIConvertable); ok { - data = converter.MSI() - } else { - return nil - } - } - return Map(data.(map[string]interface{})) -} - -// MSI creates a map[string]interface{} and puts it inside a new Map. -// -// The arguments follow a key, value pattern. -// -// -// Returns nil if any key argument is non-string or if there are an odd number of arguments. -// -// Example -// -// To easily create Maps: -// -// m := objx.MSI("name", "Mat", "age", 29, "subobj", objx.MSI("active", true)) -// -// // creates an Map equivalent to -// m := objx.Map{"name": "Mat", "age": 29, "subobj": objx.Map{"active": true}} -func MSI(keyAndValuePairs ...interface{}) Map { - newMap := Map{} - keyAndValuePairsLen := len(keyAndValuePairs) - if keyAndValuePairsLen%2 != 0 { - return nil - } - for i := 0; i < keyAndValuePairsLen; i = i + 2 { - key := keyAndValuePairs[i] - value := keyAndValuePairs[i+1] - - // make sure the key is a string - keyString, keyStringOK := key.(string) - if !keyStringOK { - return nil - } - newMap[keyString] = value - } - return newMap -} - -// ****** Conversion Constructors - -// MustFromJSON creates a new Map containing the data specified in the -// jsonString. -// -// Panics if the JSON is invalid. -func MustFromJSON(jsonString string) Map { - o, err := FromJSON(jsonString) - if err != nil { - panic("objx: MustFromJSON failed with error: " + err.Error()) - } - return o -} - -// MustFromJSONSlice creates a new slice of Map containing the data specified in the -// jsonString. Works with jsons with a top level array -// -// Panics if the JSON is invalid. -func MustFromJSONSlice(jsonString string) []Map { - slice, err := FromJSONSlice(jsonString) - if err != nil { - panic("objx: MustFromJSONSlice failed with error: " + err.Error()) - } - return slice -} - -// FromJSON creates a new Map containing the data specified in the -// jsonString. -// -// Returns an error if the JSON is invalid. -func FromJSON(jsonString string) (Map, error) { - var m Map - err := json.Unmarshal([]byte(jsonString), &m) - if err != nil { - return Nil, err - } - return m, nil -} - -// FromJSONSlice creates a new slice of Map containing the data specified in the -// jsonString. Works with jsons with a top level array -// -// Returns an error if the JSON is invalid. -func FromJSONSlice(jsonString string) ([]Map, error) { - var slice []Map - err := json.Unmarshal([]byte(jsonString), &slice) - if err != nil { - return nil, err - } - return slice, nil -} - -// FromBase64 creates a new Obj containing the data specified -// in the Base64 string. -// -// The string is an encoded JSON string returned by Base64 -func FromBase64(base64String string) (Map, error) { - decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64String)) - decoded, err := ioutil.ReadAll(decoder) - if err != nil { - return nil, err - } - return FromJSON(string(decoded)) -} - -// MustFromBase64 creates a new Obj containing the data specified -// in the Base64 string and panics if there is an error. -// -// The string is an encoded JSON string returned by Base64 -func MustFromBase64(base64String string) Map { - result, err := FromBase64(base64String) - if err != nil { - panic("objx: MustFromBase64 failed with error: " + err.Error()) - } - return result -} - -// FromSignedBase64 creates a new Obj containing the data specified -// in the Base64 string. -// -// The string is an encoded JSON string returned by SignedBase64 -func FromSignedBase64(base64String, key string) (Map, error) { - parts := strings.Split(base64String, SignatureSeparator) - if len(parts) != 2 { - return nil, errors.New("objx: Signed base64 string is malformed") - } - - sig := HashWithKey(parts[0], key) - if parts[1] != sig { - return nil, errors.New("objx: Signature for base64 data does not match") - } - return FromBase64(parts[0]) -} - -// MustFromSignedBase64 creates a new Obj containing the data specified -// in the Base64 string and panics if there is an error. -// -// The string is an encoded JSON string returned by Base64 -func MustFromSignedBase64(base64String, key string) Map { - result, err := FromSignedBase64(base64String, key) - if err != nil { - panic("objx: MustFromSignedBase64 failed with error: " + err.Error()) - } - return result -} - -// FromURLQuery generates a new Obj by parsing the specified -// query. -// -// For queries with multiple values, the first value is selected. -func FromURLQuery(query string) (Map, error) { - vals, err := url.ParseQuery(query) - if err != nil { - return nil, err - } - m := Map{} - for k, vals := range vals { - m[k] = vals[0] - } - return m, nil -} - -// MustFromURLQuery generates a new Obj by parsing the specified -// query. -// -// For queries with multiple values, the first value is selected. -// -// Panics if it encounters an error -func MustFromURLQuery(query string) Map { - o, err := FromURLQuery(query) - if err != nil { - panic("objx: MustFromURLQuery failed with error: " + err.Error()) - } - return o -} diff --git a/vendor/github.com/stretchr/objx/mutations.go b/vendor/github.com/stretchr/objx/mutations.go deleted file mode 100644 index c3400a3f709..00000000000 --- a/vendor/github.com/stretchr/objx/mutations.go +++ /dev/null @@ -1,77 +0,0 @@ -package objx - -// Exclude returns a new Map with the keys in the specified []string -// excluded. -func (m Map) Exclude(exclude []string) Map { - excluded := make(Map) - for k, v := range m { - if !contains(exclude, k) { - excluded[k] = v - } - } - return excluded -} - -// Copy creates a shallow copy of the Obj. -func (m Map) Copy() Map { - copied := Map{} - for k, v := range m { - copied[k] = v - } - return copied -} - -// Merge blends the specified map with a copy of this map and returns the result. -// -// Keys that appear in both will be selected from the specified map. -// This method requires that the wrapped object be a map[string]interface{} -func (m Map) Merge(merge Map) Map { - return m.Copy().MergeHere(merge) -} - -// MergeHere blends the specified map with this map and returns the current map. -// -// Keys that appear in both will be selected from the specified map. The original map -// will be modified. This method requires that -// the wrapped object be a map[string]interface{} -func (m Map) MergeHere(merge Map) Map { - for k, v := range merge { - m[k] = v - } - return m -} - -// Transform builds a new Obj giving the transformer a chance -// to change the keys and values as it goes. This method requires that -// the wrapped object be a map[string]interface{} -func (m Map) Transform(transformer func(key string, value interface{}) (string, interface{})) Map { - newMap := Map{} - for k, v := range m { - modifiedKey, modifiedVal := transformer(k, v) - newMap[modifiedKey] = modifiedVal - } - return newMap -} - -// TransformKeys builds a new map using the specified key mapping. -// -// Unspecified keys will be unaltered. -// This method requires that the wrapped object be a map[string]interface{} -func (m Map) TransformKeys(mapping map[string]string) Map { - return m.Transform(func(key string, value interface{}) (string, interface{}) { - if newKey, ok := mapping[key]; ok { - return newKey, value - } - return key, value - }) -} - -// Checks if a string slice contains a string -func contains(s []string, e string) bool { - for _, a := range s { - if a == e { - return true - } - } - return false -} diff --git a/vendor/github.com/stretchr/objx/security.go b/vendor/github.com/stretchr/objx/security.go deleted file mode 100644 index 692be8e2a9f..00000000000 --- a/vendor/github.com/stretchr/objx/security.go +++ /dev/null @@ -1,12 +0,0 @@ -package objx - -import ( - "crypto/sha1" - "encoding/hex" -) - -// HashWithKey hashes the specified string using the security key -func HashWithKey(data, key string) string { - d := sha1.Sum([]byte(data + ":" + key)) - return hex.EncodeToString(d[:]) -} diff --git a/vendor/github.com/stretchr/objx/tests.go b/vendor/github.com/stretchr/objx/tests.go deleted file mode 100644 index d9e0b479a4c..00000000000 --- a/vendor/github.com/stretchr/objx/tests.go +++ /dev/null @@ -1,17 +0,0 @@ -package objx - -// Has gets whether there is something at the specified selector -// or not. -// -// If m is nil, Has will always return false. -func (m Map) Has(selector string) bool { - if m == nil { - return false - } - return !m.Get(selector).IsNil() -} - -// IsNil gets whether the data is nil or not. -func (v *Value) IsNil() bool { - return v == nil || v.data == nil -} diff --git a/vendor/github.com/stretchr/objx/type_specific.go b/vendor/github.com/stretchr/objx/type_specific.go deleted file mode 100644 index 80f88d9fa29..00000000000 --- a/vendor/github.com/stretchr/objx/type_specific.go +++ /dev/null @@ -1,346 +0,0 @@ -package objx - -/* - MSI (map[string]interface{} and []map[string]interface{}) -*/ - -// MSI gets the value as a map[string]interface{}, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} { - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - if s, ok := v.data.(Map); ok { - return map[string]interface{}(s) - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustMSI gets the value as a map[string]interface{}. -// -// Panics if the object is not a map[string]interface{}. -func (v *Value) MustMSI() map[string]interface{} { - if s, ok := v.data.(Map); ok { - return map[string]interface{}(s) - } - return v.data.(map[string]interface{}) -} - -// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault -// value or nil if the value is not a []map[string]interface{}. -func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} { - if s, ok := v.data.([]map[string]interface{}); ok { - return s - } - - s := v.ObjxMapSlice() - if s == nil { - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil - } - - result := make([]map[string]interface{}, len(s)) - for i := range s { - result[i] = s[i].Value().MSI() - } - return result -} - -// MustMSISlice gets the value as a []map[string]interface{}. -// -// Panics if the object is not a []map[string]interface{}. -func (v *Value) MustMSISlice() []map[string]interface{} { - if s := v.MSISlice(); s != nil { - return s - } - - return v.data.([]map[string]interface{}) -} - -// IsMSI gets whether the object contained is a map[string]interface{} or not. -func (v *Value) IsMSI() bool { - _, ok := v.data.(map[string]interface{}) - if !ok { - _, ok = v.data.(Map) - } - return ok -} - -// IsMSISlice gets whether the object contained is a []map[string]interface{} or not. -func (v *Value) IsMSISlice() bool { - _, ok := v.data.([]map[string]interface{}) - if !ok { - _, ok = v.data.([]Map) - if !ok { - s, ok := v.data.([]interface{}) - if ok { - for i := range s { - switch s[i].(type) { - case Map: - case map[string]interface{}: - default: - return false - } - } - return true - } - } - } - return ok -} - -// EachMSI calls the specified callback for each object -// in the []map[string]interface{}. -// -// Panics if the object is the wrong type. -func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value { - for index, val := range v.MustMSISlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereMSI uses the specified decider function to select items -// from the []map[string]interface{}. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value { - var selected []map[string]interface{} - v.EachMSI(func(index int, val map[string]interface{}) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupMSI uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]map[string]interface{}. -func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value { - groups := make(map[string][]map[string]interface{}) - v.EachMSI(func(index int, val map[string]interface{}) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]map[string]interface{}, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceMSI uses the specified function to replace each map[string]interface{}s -// by iterating each item. The data in the returned result will be a -// []map[string]interface{} containing the replaced items. -func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value { - arr := v.MustMSISlice() - replaced := make([]map[string]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectMSI uses the specified collector function to collect a value -// for each of the map[string]interface{}s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value { - arr := v.MustMSISlice() - collected := make([]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - ObjxMap ((Map) and [](Map)) -*/ - -// ObjxMap gets the value as a (Map), returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) ObjxMap(optionalDefault ...(Map)) Map { - if s, ok := v.data.((Map)); ok { - return s - } - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return New(nil) -} - -// MustObjxMap gets the value as a (Map). -// -// Panics if the object is not a (Map). -func (v *Value) MustObjxMap() Map { - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - return v.data.((Map)) -} - -// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault -// value or nil if the value is not a [](Map). -func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) { - if s, ok := v.data.([]Map); ok { - return s - } - - if s, ok := v.data.([]map[string]interface{}); ok { - result := make([]Map, len(s)) - for i := range s { - result[i] = s[i] - } - return result - } - - s, ok := v.data.([]interface{}) - if !ok { - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil - } - - result := make([]Map, len(s)) - for i := range s { - switch s[i].(type) { - case Map: - result[i] = s[i].(Map) - case map[string]interface{}: - result[i] = New(s[i]) - default: - return nil - } - } - return result -} - -// MustObjxMapSlice gets the value as a [](Map). -// -// Panics if the object is not a [](Map). -func (v *Value) MustObjxMapSlice() [](Map) { - if s := v.ObjxMapSlice(); s != nil { - return s - } - return v.data.([](Map)) -} - -// IsObjxMap gets whether the object contained is a (Map) or not. -func (v *Value) IsObjxMap() bool { - _, ok := v.data.((Map)) - if !ok { - _, ok = v.data.(map[string]interface{}) - } - return ok -} - -// IsObjxMapSlice gets whether the object contained is a [](Map) or not. -func (v *Value) IsObjxMapSlice() bool { - _, ok := v.data.([](Map)) - if !ok { - _, ok = v.data.([]map[string]interface{}) - if !ok { - s, ok := v.data.([]interface{}) - if ok { - for i := range s { - switch s[i].(type) { - case Map: - case map[string]interface{}: - default: - return false - } - } - return true - } - } - } - - return ok -} - -// EachObjxMap calls the specified callback for each object -// in the [](Map). -// -// Panics if the object is the wrong type. -func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value { - for index, val := range v.MustObjxMapSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereObjxMap uses the specified decider function to select items -// from the [](Map). The object contained in the result will contain -// only the selected items. -func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value { - var selected [](Map) - v.EachObjxMap(func(index int, val Map) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupObjxMap uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][](Map). -func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value { - groups := make(map[string][](Map)) - v.EachObjxMap(func(index int, val Map) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([](Map), 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceObjxMap uses the specified function to replace each (Map)s -// by iterating each item. The data in the returned result will be a -// [](Map) containing the replaced items. -func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value { - arr := v.MustObjxMapSlice() - replaced := make([](Map), len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectObjxMap uses the specified collector function to collect a value -// for each of the (Map)s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value { - arr := v.MustObjxMapSlice() - collected := make([]interface{}, len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} diff --git a/vendor/github.com/stretchr/objx/type_specific_codegen.go b/vendor/github.com/stretchr/objx/type_specific_codegen.go deleted file mode 100644 index 45850456e17..00000000000 --- a/vendor/github.com/stretchr/objx/type_specific_codegen.go +++ /dev/null @@ -1,2261 +0,0 @@ -package objx - -/* - Inter (interface{} and []interface{}) -*/ - -// Inter gets the value as a interface{}, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Inter(optionalDefault ...interface{}) interface{} { - if s, ok := v.data.(interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInter gets the value as a interface{}. -// -// Panics if the object is not a interface{}. -func (v *Value) MustInter() interface{} { - return v.data.(interface{}) -} - -// InterSlice gets the value as a []interface{}, returns the optionalDefault -// value or nil if the value is not a []interface{}. -func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} { - if s, ok := v.data.([]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInterSlice gets the value as a []interface{}. -// -// Panics if the object is not a []interface{}. -func (v *Value) MustInterSlice() []interface{} { - return v.data.([]interface{}) -} - -// IsInter gets whether the object contained is a interface{} or not. -func (v *Value) IsInter() bool { - _, ok := v.data.(interface{}) - return ok -} - -// IsInterSlice gets whether the object contained is a []interface{} or not. -func (v *Value) IsInterSlice() bool { - _, ok := v.data.([]interface{}) - return ok -} - -// EachInter calls the specified callback for each object -// in the []interface{}. -// -// Panics if the object is the wrong type. -func (v *Value) EachInter(callback func(int, interface{}) bool) *Value { - for index, val := range v.MustInterSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInter uses the specified decider function to select items -// from the []interface{}. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value { - var selected []interface{} - v.EachInter(func(index int, val interface{}) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInter uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]interface{}. -func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value { - groups := make(map[string][]interface{}) - v.EachInter(func(index int, val interface{}) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]interface{}, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInter uses the specified function to replace each interface{}s -// by iterating each item. The data in the returned result will be a -// []interface{} containing the replaced items. -func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value { - arr := v.MustInterSlice() - replaced := make([]interface{}, len(arr)) - v.EachInter(func(index int, val interface{}) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInter uses the specified collector function to collect a value -// for each of the interface{}s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value { - arr := v.MustInterSlice() - collected := make([]interface{}, len(arr)) - v.EachInter(func(index int, val interface{}) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Bool (bool and []bool) -*/ - -// Bool gets the value as a bool, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Bool(optionalDefault ...bool) bool { - if s, ok := v.data.(bool); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return false -} - -// MustBool gets the value as a bool. -// -// Panics if the object is not a bool. -func (v *Value) MustBool() bool { - return v.data.(bool) -} - -// BoolSlice gets the value as a []bool, returns the optionalDefault -// value or nil if the value is not a []bool. -func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool { - if s, ok := v.data.([]bool); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustBoolSlice gets the value as a []bool. -// -// Panics if the object is not a []bool. -func (v *Value) MustBoolSlice() []bool { - return v.data.([]bool) -} - -// IsBool gets whether the object contained is a bool or not. -func (v *Value) IsBool() bool { - _, ok := v.data.(bool) - return ok -} - -// IsBoolSlice gets whether the object contained is a []bool or not. -func (v *Value) IsBoolSlice() bool { - _, ok := v.data.([]bool) - return ok -} - -// EachBool calls the specified callback for each object -// in the []bool. -// -// Panics if the object is the wrong type. -func (v *Value) EachBool(callback func(int, bool) bool) *Value { - for index, val := range v.MustBoolSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereBool uses the specified decider function to select items -// from the []bool. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereBool(decider func(int, bool) bool) *Value { - var selected []bool - v.EachBool(func(index int, val bool) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupBool uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]bool. -func (v *Value) GroupBool(grouper func(int, bool) string) *Value { - groups := make(map[string][]bool) - v.EachBool(func(index int, val bool) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]bool, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceBool uses the specified function to replace each bools -// by iterating each item. The data in the returned result will be a -// []bool containing the replaced items. -func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value { - arr := v.MustBoolSlice() - replaced := make([]bool, len(arr)) - v.EachBool(func(index int, val bool) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectBool uses the specified collector function to collect a value -// for each of the bools in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value { - arr := v.MustBoolSlice() - collected := make([]interface{}, len(arr)) - v.EachBool(func(index int, val bool) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Str (string and []string) -*/ - -// Str gets the value as a string, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Str(optionalDefault ...string) string { - if s, ok := v.data.(string); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return "" -} - -// MustStr gets the value as a string. -// -// Panics if the object is not a string. -func (v *Value) MustStr() string { - return v.data.(string) -} - -// StrSlice gets the value as a []string, returns the optionalDefault -// value or nil if the value is not a []string. -func (v *Value) StrSlice(optionalDefault ...[]string) []string { - if s, ok := v.data.([]string); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustStrSlice gets the value as a []string. -// -// Panics if the object is not a []string. -func (v *Value) MustStrSlice() []string { - return v.data.([]string) -} - -// IsStr gets whether the object contained is a string or not. -func (v *Value) IsStr() bool { - _, ok := v.data.(string) - return ok -} - -// IsStrSlice gets whether the object contained is a []string or not. -func (v *Value) IsStrSlice() bool { - _, ok := v.data.([]string) - return ok -} - -// EachStr calls the specified callback for each object -// in the []string. -// -// Panics if the object is the wrong type. -func (v *Value) EachStr(callback func(int, string) bool) *Value { - for index, val := range v.MustStrSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereStr uses the specified decider function to select items -// from the []string. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereStr(decider func(int, string) bool) *Value { - var selected []string - v.EachStr(func(index int, val string) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupStr uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]string. -func (v *Value) GroupStr(grouper func(int, string) string) *Value { - groups := make(map[string][]string) - v.EachStr(func(index int, val string) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]string, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceStr uses the specified function to replace each strings -// by iterating each item. The data in the returned result will be a -// []string containing the replaced items. -func (v *Value) ReplaceStr(replacer func(int, string) string) *Value { - arr := v.MustStrSlice() - replaced := make([]string, len(arr)) - v.EachStr(func(index int, val string) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectStr uses the specified collector function to collect a value -// for each of the strings in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectStr(collector func(int, string) interface{}) *Value { - arr := v.MustStrSlice() - collected := make([]interface{}, len(arr)) - v.EachStr(func(index int, val string) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int (int and []int) -*/ - -// Int gets the value as a int, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int(optionalDefault ...int) int { - if s, ok := v.data.(int); ok { - return s - } - if s, ok := v.data.(float64); ok { - if float64(int(s)) == s { - return int(s) - } - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt gets the value as a int. -// -// Panics if the object is not a int. -func (v *Value) MustInt() int { - if s, ok := v.data.(float64); ok { - if float64(int(s)) == s { - return int(s) - } - } - return v.data.(int) -} - -// IntSlice gets the value as a []int, returns the optionalDefault -// value or nil if the value is not a []int. -func (v *Value) IntSlice(optionalDefault ...[]int) []int { - if s, ok := v.data.([]int); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustIntSlice gets the value as a []int. -// -// Panics if the object is not a []int. -func (v *Value) MustIntSlice() []int { - return v.data.([]int) -} - -// IsInt gets whether the object contained is a int or not. -func (v *Value) IsInt() bool { - _, ok := v.data.(int) - return ok -} - -// IsIntSlice gets whether the object contained is a []int or not. -func (v *Value) IsIntSlice() bool { - _, ok := v.data.([]int) - return ok -} - -// EachInt calls the specified callback for each object -// in the []int. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt(callback func(int, int) bool) *Value { - for index, val := range v.MustIntSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt uses the specified decider function to select items -// from the []int. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt(decider func(int, int) bool) *Value { - var selected []int - v.EachInt(func(index int, val int) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int. -func (v *Value) GroupInt(grouper func(int, int) string) *Value { - groups := make(map[string][]int) - v.EachInt(func(index int, val int) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt uses the specified function to replace each ints -// by iterating each item. The data in the returned result will be a -// []int containing the replaced items. -func (v *Value) ReplaceInt(replacer func(int, int) int) *Value { - arr := v.MustIntSlice() - replaced := make([]int, len(arr)) - v.EachInt(func(index int, val int) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt uses the specified collector function to collect a value -// for each of the ints in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt(collector func(int, int) interface{}) *Value { - arr := v.MustIntSlice() - collected := make([]interface{}, len(arr)) - v.EachInt(func(index int, val int) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int8 (int8 and []int8) -*/ - -// Int8 gets the value as a int8, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int8(optionalDefault ...int8) int8 { - if s, ok := v.data.(int8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt8 gets the value as a int8. -// -// Panics if the object is not a int8. -func (v *Value) MustInt8() int8 { - return v.data.(int8) -} - -// Int8Slice gets the value as a []int8, returns the optionalDefault -// value or nil if the value is not a []int8. -func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 { - if s, ok := v.data.([]int8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt8Slice gets the value as a []int8. -// -// Panics if the object is not a []int8. -func (v *Value) MustInt8Slice() []int8 { - return v.data.([]int8) -} - -// IsInt8 gets whether the object contained is a int8 or not. -func (v *Value) IsInt8() bool { - _, ok := v.data.(int8) - return ok -} - -// IsInt8Slice gets whether the object contained is a []int8 or not. -func (v *Value) IsInt8Slice() bool { - _, ok := v.data.([]int8) - return ok -} - -// EachInt8 calls the specified callback for each object -// in the []int8. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt8(callback func(int, int8) bool) *Value { - for index, val := range v.MustInt8Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt8 uses the specified decider function to select items -// from the []int8. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt8(decider func(int, int8) bool) *Value { - var selected []int8 - v.EachInt8(func(index int, val int8) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt8 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int8. -func (v *Value) GroupInt8(grouper func(int, int8) string) *Value { - groups := make(map[string][]int8) - v.EachInt8(func(index int, val int8) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int8, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt8 uses the specified function to replace each int8s -// by iterating each item. The data in the returned result will be a -// []int8 containing the replaced items. -func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value { - arr := v.MustInt8Slice() - replaced := make([]int8, len(arr)) - v.EachInt8(func(index int, val int8) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt8 uses the specified collector function to collect a value -// for each of the int8s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value { - arr := v.MustInt8Slice() - collected := make([]interface{}, len(arr)) - v.EachInt8(func(index int, val int8) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int16 (int16 and []int16) -*/ - -// Int16 gets the value as a int16, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int16(optionalDefault ...int16) int16 { - if s, ok := v.data.(int16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt16 gets the value as a int16. -// -// Panics if the object is not a int16. -func (v *Value) MustInt16() int16 { - return v.data.(int16) -} - -// Int16Slice gets the value as a []int16, returns the optionalDefault -// value or nil if the value is not a []int16. -func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 { - if s, ok := v.data.([]int16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt16Slice gets the value as a []int16. -// -// Panics if the object is not a []int16. -func (v *Value) MustInt16Slice() []int16 { - return v.data.([]int16) -} - -// IsInt16 gets whether the object contained is a int16 or not. -func (v *Value) IsInt16() bool { - _, ok := v.data.(int16) - return ok -} - -// IsInt16Slice gets whether the object contained is a []int16 or not. -func (v *Value) IsInt16Slice() bool { - _, ok := v.data.([]int16) - return ok -} - -// EachInt16 calls the specified callback for each object -// in the []int16. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt16(callback func(int, int16) bool) *Value { - for index, val := range v.MustInt16Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt16 uses the specified decider function to select items -// from the []int16. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt16(decider func(int, int16) bool) *Value { - var selected []int16 - v.EachInt16(func(index int, val int16) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt16 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int16. -func (v *Value) GroupInt16(grouper func(int, int16) string) *Value { - groups := make(map[string][]int16) - v.EachInt16(func(index int, val int16) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int16, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt16 uses the specified function to replace each int16s -// by iterating each item. The data in the returned result will be a -// []int16 containing the replaced items. -func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value { - arr := v.MustInt16Slice() - replaced := make([]int16, len(arr)) - v.EachInt16(func(index int, val int16) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt16 uses the specified collector function to collect a value -// for each of the int16s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value { - arr := v.MustInt16Slice() - collected := make([]interface{}, len(arr)) - v.EachInt16(func(index int, val int16) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int32 (int32 and []int32) -*/ - -// Int32 gets the value as a int32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int32(optionalDefault ...int32) int32 { - if s, ok := v.data.(int32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt32 gets the value as a int32. -// -// Panics if the object is not a int32. -func (v *Value) MustInt32() int32 { - return v.data.(int32) -} - -// Int32Slice gets the value as a []int32, returns the optionalDefault -// value or nil if the value is not a []int32. -func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 { - if s, ok := v.data.([]int32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt32Slice gets the value as a []int32. -// -// Panics if the object is not a []int32. -func (v *Value) MustInt32Slice() []int32 { - return v.data.([]int32) -} - -// IsInt32 gets whether the object contained is a int32 or not. -func (v *Value) IsInt32() bool { - _, ok := v.data.(int32) - return ok -} - -// IsInt32Slice gets whether the object contained is a []int32 or not. -func (v *Value) IsInt32Slice() bool { - _, ok := v.data.([]int32) - return ok -} - -// EachInt32 calls the specified callback for each object -// in the []int32. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt32(callback func(int, int32) bool) *Value { - for index, val := range v.MustInt32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt32 uses the specified decider function to select items -// from the []int32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt32(decider func(int, int32) bool) *Value { - var selected []int32 - v.EachInt32(func(index int, val int32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int32. -func (v *Value) GroupInt32(grouper func(int, int32) string) *Value { - groups := make(map[string][]int32) - v.EachInt32(func(index int, val int32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt32 uses the specified function to replace each int32s -// by iterating each item. The data in the returned result will be a -// []int32 containing the replaced items. -func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value { - arr := v.MustInt32Slice() - replaced := make([]int32, len(arr)) - v.EachInt32(func(index int, val int32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt32 uses the specified collector function to collect a value -// for each of the int32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value { - arr := v.MustInt32Slice() - collected := make([]interface{}, len(arr)) - v.EachInt32(func(index int, val int32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int64 (int64 and []int64) -*/ - -// Int64 gets the value as a int64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int64(optionalDefault ...int64) int64 { - if s, ok := v.data.(int64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt64 gets the value as a int64. -// -// Panics if the object is not a int64. -func (v *Value) MustInt64() int64 { - return v.data.(int64) -} - -// Int64Slice gets the value as a []int64, returns the optionalDefault -// value or nil if the value is not a []int64. -func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 { - if s, ok := v.data.([]int64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt64Slice gets the value as a []int64. -// -// Panics if the object is not a []int64. -func (v *Value) MustInt64Slice() []int64 { - return v.data.([]int64) -} - -// IsInt64 gets whether the object contained is a int64 or not. -func (v *Value) IsInt64() bool { - _, ok := v.data.(int64) - return ok -} - -// IsInt64Slice gets whether the object contained is a []int64 or not. -func (v *Value) IsInt64Slice() bool { - _, ok := v.data.([]int64) - return ok -} - -// EachInt64 calls the specified callback for each object -// in the []int64. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt64(callback func(int, int64) bool) *Value { - for index, val := range v.MustInt64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt64 uses the specified decider function to select items -// from the []int64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt64(decider func(int, int64) bool) *Value { - var selected []int64 - v.EachInt64(func(index int, val int64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int64. -func (v *Value) GroupInt64(grouper func(int, int64) string) *Value { - groups := make(map[string][]int64) - v.EachInt64(func(index int, val int64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt64 uses the specified function to replace each int64s -// by iterating each item. The data in the returned result will be a -// []int64 containing the replaced items. -func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value { - arr := v.MustInt64Slice() - replaced := make([]int64, len(arr)) - v.EachInt64(func(index int, val int64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt64 uses the specified collector function to collect a value -// for each of the int64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value { - arr := v.MustInt64Slice() - collected := make([]interface{}, len(arr)) - v.EachInt64(func(index int, val int64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint (uint and []uint) -*/ - -// Uint gets the value as a uint, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint(optionalDefault ...uint) uint { - if s, ok := v.data.(uint); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint gets the value as a uint. -// -// Panics if the object is not a uint. -func (v *Value) MustUint() uint { - return v.data.(uint) -} - -// UintSlice gets the value as a []uint, returns the optionalDefault -// value or nil if the value is not a []uint. -func (v *Value) UintSlice(optionalDefault ...[]uint) []uint { - if s, ok := v.data.([]uint); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUintSlice gets the value as a []uint. -// -// Panics if the object is not a []uint. -func (v *Value) MustUintSlice() []uint { - return v.data.([]uint) -} - -// IsUint gets whether the object contained is a uint or not. -func (v *Value) IsUint() bool { - _, ok := v.data.(uint) - return ok -} - -// IsUintSlice gets whether the object contained is a []uint or not. -func (v *Value) IsUintSlice() bool { - _, ok := v.data.([]uint) - return ok -} - -// EachUint calls the specified callback for each object -// in the []uint. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint(callback func(int, uint) bool) *Value { - for index, val := range v.MustUintSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint uses the specified decider function to select items -// from the []uint. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint(decider func(int, uint) bool) *Value { - var selected []uint - v.EachUint(func(index int, val uint) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint. -func (v *Value) GroupUint(grouper func(int, uint) string) *Value { - groups := make(map[string][]uint) - v.EachUint(func(index int, val uint) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint uses the specified function to replace each uints -// by iterating each item. The data in the returned result will be a -// []uint containing the replaced items. -func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value { - arr := v.MustUintSlice() - replaced := make([]uint, len(arr)) - v.EachUint(func(index int, val uint) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint uses the specified collector function to collect a value -// for each of the uints in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value { - arr := v.MustUintSlice() - collected := make([]interface{}, len(arr)) - v.EachUint(func(index int, val uint) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint8 (uint8 and []uint8) -*/ - -// Uint8 gets the value as a uint8, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint8(optionalDefault ...uint8) uint8 { - if s, ok := v.data.(uint8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint8 gets the value as a uint8. -// -// Panics if the object is not a uint8. -func (v *Value) MustUint8() uint8 { - return v.data.(uint8) -} - -// Uint8Slice gets the value as a []uint8, returns the optionalDefault -// value or nil if the value is not a []uint8. -func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 { - if s, ok := v.data.([]uint8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint8Slice gets the value as a []uint8. -// -// Panics if the object is not a []uint8. -func (v *Value) MustUint8Slice() []uint8 { - return v.data.([]uint8) -} - -// IsUint8 gets whether the object contained is a uint8 or not. -func (v *Value) IsUint8() bool { - _, ok := v.data.(uint8) - return ok -} - -// IsUint8Slice gets whether the object contained is a []uint8 or not. -func (v *Value) IsUint8Slice() bool { - _, ok := v.data.([]uint8) - return ok -} - -// EachUint8 calls the specified callback for each object -// in the []uint8. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint8(callback func(int, uint8) bool) *Value { - for index, val := range v.MustUint8Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint8 uses the specified decider function to select items -// from the []uint8. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value { - var selected []uint8 - v.EachUint8(func(index int, val uint8) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint8 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint8. -func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value { - groups := make(map[string][]uint8) - v.EachUint8(func(index int, val uint8) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint8, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint8 uses the specified function to replace each uint8s -// by iterating each item. The data in the returned result will be a -// []uint8 containing the replaced items. -func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value { - arr := v.MustUint8Slice() - replaced := make([]uint8, len(arr)) - v.EachUint8(func(index int, val uint8) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint8 uses the specified collector function to collect a value -// for each of the uint8s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value { - arr := v.MustUint8Slice() - collected := make([]interface{}, len(arr)) - v.EachUint8(func(index int, val uint8) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint16 (uint16 and []uint16) -*/ - -// Uint16 gets the value as a uint16, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint16(optionalDefault ...uint16) uint16 { - if s, ok := v.data.(uint16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint16 gets the value as a uint16. -// -// Panics if the object is not a uint16. -func (v *Value) MustUint16() uint16 { - return v.data.(uint16) -} - -// Uint16Slice gets the value as a []uint16, returns the optionalDefault -// value or nil if the value is not a []uint16. -func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 { - if s, ok := v.data.([]uint16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint16Slice gets the value as a []uint16. -// -// Panics if the object is not a []uint16. -func (v *Value) MustUint16Slice() []uint16 { - return v.data.([]uint16) -} - -// IsUint16 gets whether the object contained is a uint16 or not. -func (v *Value) IsUint16() bool { - _, ok := v.data.(uint16) - return ok -} - -// IsUint16Slice gets whether the object contained is a []uint16 or not. -func (v *Value) IsUint16Slice() bool { - _, ok := v.data.([]uint16) - return ok -} - -// EachUint16 calls the specified callback for each object -// in the []uint16. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint16(callback func(int, uint16) bool) *Value { - for index, val := range v.MustUint16Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint16 uses the specified decider function to select items -// from the []uint16. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value { - var selected []uint16 - v.EachUint16(func(index int, val uint16) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint16 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint16. -func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value { - groups := make(map[string][]uint16) - v.EachUint16(func(index int, val uint16) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint16, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint16 uses the specified function to replace each uint16s -// by iterating each item. The data in the returned result will be a -// []uint16 containing the replaced items. -func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value { - arr := v.MustUint16Slice() - replaced := make([]uint16, len(arr)) - v.EachUint16(func(index int, val uint16) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint16 uses the specified collector function to collect a value -// for each of the uint16s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value { - arr := v.MustUint16Slice() - collected := make([]interface{}, len(arr)) - v.EachUint16(func(index int, val uint16) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint32 (uint32 and []uint32) -*/ - -// Uint32 gets the value as a uint32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint32(optionalDefault ...uint32) uint32 { - if s, ok := v.data.(uint32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint32 gets the value as a uint32. -// -// Panics if the object is not a uint32. -func (v *Value) MustUint32() uint32 { - return v.data.(uint32) -} - -// Uint32Slice gets the value as a []uint32, returns the optionalDefault -// value or nil if the value is not a []uint32. -func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 { - if s, ok := v.data.([]uint32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint32Slice gets the value as a []uint32. -// -// Panics if the object is not a []uint32. -func (v *Value) MustUint32Slice() []uint32 { - return v.data.([]uint32) -} - -// IsUint32 gets whether the object contained is a uint32 or not. -func (v *Value) IsUint32() bool { - _, ok := v.data.(uint32) - return ok -} - -// IsUint32Slice gets whether the object contained is a []uint32 or not. -func (v *Value) IsUint32Slice() bool { - _, ok := v.data.([]uint32) - return ok -} - -// EachUint32 calls the specified callback for each object -// in the []uint32. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint32(callback func(int, uint32) bool) *Value { - for index, val := range v.MustUint32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint32 uses the specified decider function to select items -// from the []uint32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value { - var selected []uint32 - v.EachUint32(func(index int, val uint32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint32. -func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value { - groups := make(map[string][]uint32) - v.EachUint32(func(index int, val uint32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint32 uses the specified function to replace each uint32s -// by iterating each item. The data in the returned result will be a -// []uint32 containing the replaced items. -func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value { - arr := v.MustUint32Slice() - replaced := make([]uint32, len(arr)) - v.EachUint32(func(index int, val uint32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint32 uses the specified collector function to collect a value -// for each of the uint32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value { - arr := v.MustUint32Slice() - collected := make([]interface{}, len(arr)) - v.EachUint32(func(index int, val uint32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint64 (uint64 and []uint64) -*/ - -// Uint64 gets the value as a uint64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint64(optionalDefault ...uint64) uint64 { - if s, ok := v.data.(uint64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint64 gets the value as a uint64. -// -// Panics if the object is not a uint64. -func (v *Value) MustUint64() uint64 { - return v.data.(uint64) -} - -// Uint64Slice gets the value as a []uint64, returns the optionalDefault -// value or nil if the value is not a []uint64. -func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 { - if s, ok := v.data.([]uint64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint64Slice gets the value as a []uint64. -// -// Panics if the object is not a []uint64. -func (v *Value) MustUint64Slice() []uint64 { - return v.data.([]uint64) -} - -// IsUint64 gets whether the object contained is a uint64 or not. -func (v *Value) IsUint64() bool { - _, ok := v.data.(uint64) - return ok -} - -// IsUint64Slice gets whether the object contained is a []uint64 or not. -func (v *Value) IsUint64Slice() bool { - _, ok := v.data.([]uint64) - return ok -} - -// EachUint64 calls the specified callback for each object -// in the []uint64. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint64(callback func(int, uint64) bool) *Value { - for index, val := range v.MustUint64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint64 uses the specified decider function to select items -// from the []uint64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value { - var selected []uint64 - v.EachUint64(func(index int, val uint64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint64. -func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value { - groups := make(map[string][]uint64) - v.EachUint64(func(index int, val uint64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint64 uses the specified function to replace each uint64s -// by iterating each item. The data in the returned result will be a -// []uint64 containing the replaced items. -func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value { - arr := v.MustUint64Slice() - replaced := make([]uint64, len(arr)) - v.EachUint64(func(index int, val uint64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint64 uses the specified collector function to collect a value -// for each of the uint64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value { - arr := v.MustUint64Slice() - collected := make([]interface{}, len(arr)) - v.EachUint64(func(index int, val uint64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uintptr (uintptr and []uintptr) -*/ - -// Uintptr gets the value as a uintptr, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr { - if s, ok := v.data.(uintptr); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUintptr gets the value as a uintptr. -// -// Panics if the object is not a uintptr. -func (v *Value) MustUintptr() uintptr { - return v.data.(uintptr) -} - -// UintptrSlice gets the value as a []uintptr, returns the optionalDefault -// value or nil if the value is not a []uintptr. -func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr { - if s, ok := v.data.([]uintptr); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUintptrSlice gets the value as a []uintptr. -// -// Panics if the object is not a []uintptr. -func (v *Value) MustUintptrSlice() []uintptr { - return v.data.([]uintptr) -} - -// IsUintptr gets whether the object contained is a uintptr or not. -func (v *Value) IsUintptr() bool { - _, ok := v.data.(uintptr) - return ok -} - -// IsUintptrSlice gets whether the object contained is a []uintptr or not. -func (v *Value) IsUintptrSlice() bool { - _, ok := v.data.([]uintptr) - return ok -} - -// EachUintptr calls the specified callback for each object -// in the []uintptr. -// -// Panics if the object is the wrong type. -func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value { - for index, val := range v.MustUintptrSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUintptr uses the specified decider function to select items -// from the []uintptr. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value { - var selected []uintptr - v.EachUintptr(func(index int, val uintptr) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUintptr uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uintptr. -func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value { - groups := make(map[string][]uintptr) - v.EachUintptr(func(index int, val uintptr) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uintptr, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUintptr uses the specified function to replace each uintptrs -// by iterating each item. The data in the returned result will be a -// []uintptr containing the replaced items. -func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value { - arr := v.MustUintptrSlice() - replaced := make([]uintptr, len(arr)) - v.EachUintptr(func(index int, val uintptr) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUintptr uses the specified collector function to collect a value -// for each of the uintptrs in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value { - arr := v.MustUintptrSlice() - collected := make([]interface{}, len(arr)) - v.EachUintptr(func(index int, val uintptr) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Float32 (float32 and []float32) -*/ - -// Float32 gets the value as a float32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Float32(optionalDefault ...float32) float32 { - if s, ok := v.data.(float32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustFloat32 gets the value as a float32. -// -// Panics if the object is not a float32. -func (v *Value) MustFloat32() float32 { - return v.data.(float32) -} - -// Float32Slice gets the value as a []float32, returns the optionalDefault -// value or nil if the value is not a []float32. -func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 { - if s, ok := v.data.([]float32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustFloat32Slice gets the value as a []float32. -// -// Panics if the object is not a []float32. -func (v *Value) MustFloat32Slice() []float32 { - return v.data.([]float32) -} - -// IsFloat32 gets whether the object contained is a float32 or not. -func (v *Value) IsFloat32() bool { - _, ok := v.data.(float32) - return ok -} - -// IsFloat32Slice gets whether the object contained is a []float32 or not. -func (v *Value) IsFloat32Slice() bool { - _, ok := v.data.([]float32) - return ok -} - -// EachFloat32 calls the specified callback for each object -// in the []float32. -// -// Panics if the object is the wrong type. -func (v *Value) EachFloat32(callback func(int, float32) bool) *Value { - for index, val := range v.MustFloat32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereFloat32 uses the specified decider function to select items -// from the []float32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value { - var selected []float32 - v.EachFloat32(func(index int, val float32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupFloat32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]float32. -func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value { - groups := make(map[string][]float32) - v.EachFloat32(func(index int, val float32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]float32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceFloat32 uses the specified function to replace each float32s -// by iterating each item. The data in the returned result will be a -// []float32 containing the replaced items. -func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value { - arr := v.MustFloat32Slice() - replaced := make([]float32, len(arr)) - v.EachFloat32(func(index int, val float32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectFloat32 uses the specified collector function to collect a value -// for each of the float32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value { - arr := v.MustFloat32Slice() - collected := make([]interface{}, len(arr)) - v.EachFloat32(func(index int, val float32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Float64 (float64 and []float64) -*/ - -// Float64 gets the value as a float64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Float64(optionalDefault ...float64) float64 { - if s, ok := v.data.(float64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustFloat64 gets the value as a float64. -// -// Panics if the object is not a float64. -func (v *Value) MustFloat64() float64 { - return v.data.(float64) -} - -// Float64Slice gets the value as a []float64, returns the optionalDefault -// value or nil if the value is not a []float64. -func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 { - if s, ok := v.data.([]float64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustFloat64Slice gets the value as a []float64. -// -// Panics if the object is not a []float64. -func (v *Value) MustFloat64Slice() []float64 { - return v.data.([]float64) -} - -// IsFloat64 gets whether the object contained is a float64 or not. -func (v *Value) IsFloat64() bool { - _, ok := v.data.(float64) - return ok -} - -// IsFloat64Slice gets whether the object contained is a []float64 or not. -func (v *Value) IsFloat64Slice() bool { - _, ok := v.data.([]float64) - return ok -} - -// EachFloat64 calls the specified callback for each object -// in the []float64. -// -// Panics if the object is the wrong type. -func (v *Value) EachFloat64(callback func(int, float64) bool) *Value { - for index, val := range v.MustFloat64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereFloat64 uses the specified decider function to select items -// from the []float64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value { - var selected []float64 - v.EachFloat64(func(index int, val float64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupFloat64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]float64. -func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value { - groups := make(map[string][]float64) - v.EachFloat64(func(index int, val float64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]float64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceFloat64 uses the specified function to replace each float64s -// by iterating each item. The data in the returned result will be a -// []float64 containing the replaced items. -func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value { - arr := v.MustFloat64Slice() - replaced := make([]float64, len(arr)) - v.EachFloat64(func(index int, val float64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectFloat64 uses the specified collector function to collect a value -// for each of the float64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value { - arr := v.MustFloat64Slice() - collected := make([]interface{}, len(arr)) - v.EachFloat64(func(index int, val float64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Complex64 (complex64 and []complex64) -*/ - -// Complex64 gets the value as a complex64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Complex64(optionalDefault ...complex64) complex64 { - if s, ok := v.data.(complex64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustComplex64 gets the value as a complex64. -// -// Panics if the object is not a complex64. -func (v *Value) MustComplex64() complex64 { - return v.data.(complex64) -} - -// Complex64Slice gets the value as a []complex64, returns the optionalDefault -// value or nil if the value is not a []complex64. -func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 { - if s, ok := v.data.([]complex64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustComplex64Slice gets the value as a []complex64. -// -// Panics if the object is not a []complex64. -func (v *Value) MustComplex64Slice() []complex64 { - return v.data.([]complex64) -} - -// IsComplex64 gets whether the object contained is a complex64 or not. -func (v *Value) IsComplex64() bool { - _, ok := v.data.(complex64) - return ok -} - -// IsComplex64Slice gets whether the object contained is a []complex64 or not. -func (v *Value) IsComplex64Slice() bool { - _, ok := v.data.([]complex64) - return ok -} - -// EachComplex64 calls the specified callback for each object -// in the []complex64. -// -// Panics if the object is the wrong type. -func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value { - for index, val := range v.MustComplex64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereComplex64 uses the specified decider function to select items -// from the []complex64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value { - var selected []complex64 - v.EachComplex64(func(index int, val complex64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupComplex64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]complex64. -func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value { - groups := make(map[string][]complex64) - v.EachComplex64(func(index int, val complex64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]complex64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceComplex64 uses the specified function to replace each complex64s -// by iterating each item. The data in the returned result will be a -// []complex64 containing the replaced items. -func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value { - arr := v.MustComplex64Slice() - replaced := make([]complex64, len(arr)) - v.EachComplex64(func(index int, val complex64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectComplex64 uses the specified collector function to collect a value -// for each of the complex64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value { - arr := v.MustComplex64Slice() - collected := make([]interface{}, len(arr)) - v.EachComplex64(func(index int, val complex64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Complex128 (complex128 and []complex128) -*/ - -// Complex128 gets the value as a complex128, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Complex128(optionalDefault ...complex128) complex128 { - if s, ok := v.data.(complex128); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustComplex128 gets the value as a complex128. -// -// Panics if the object is not a complex128. -func (v *Value) MustComplex128() complex128 { - return v.data.(complex128) -} - -// Complex128Slice gets the value as a []complex128, returns the optionalDefault -// value or nil if the value is not a []complex128. -func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 { - if s, ok := v.data.([]complex128); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustComplex128Slice gets the value as a []complex128. -// -// Panics if the object is not a []complex128. -func (v *Value) MustComplex128Slice() []complex128 { - return v.data.([]complex128) -} - -// IsComplex128 gets whether the object contained is a complex128 or not. -func (v *Value) IsComplex128() bool { - _, ok := v.data.(complex128) - return ok -} - -// IsComplex128Slice gets whether the object contained is a []complex128 or not. -func (v *Value) IsComplex128Slice() bool { - _, ok := v.data.([]complex128) - return ok -} - -// EachComplex128 calls the specified callback for each object -// in the []complex128. -// -// Panics if the object is the wrong type. -func (v *Value) EachComplex128(callback func(int, complex128) bool) *Value { - for index, val := range v.MustComplex128Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereComplex128 uses the specified decider function to select items -// from the []complex128. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value { - var selected []complex128 - v.EachComplex128(func(index int, val complex128) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupComplex128 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]complex128. -func (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value { - groups := make(map[string][]complex128) - v.EachComplex128(func(index int, val complex128) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]complex128, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceComplex128 uses the specified function to replace each complex128s -// by iterating each item. The data in the returned result will be a -// []complex128 containing the replaced items. -func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value { - arr := v.MustComplex128Slice() - replaced := make([]complex128, len(arr)) - v.EachComplex128(func(index int, val complex128) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectComplex128 uses the specified collector function to collect a value -// for each of the complex128s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value { - arr := v.MustComplex128Slice() - collected := make([]interface{}, len(arr)) - v.EachComplex128(func(index int, val complex128) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} diff --git a/vendor/github.com/stretchr/objx/value.go b/vendor/github.com/stretchr/objx/value.go deleted file mode 100644 index 4e5f9b77e69..00000000000 --- a/vendor/github.com/stretchr/objx/value.go +++ /dev/null @@ -1,159 +0,0 @@ -package objx - -import ( - "fmt" - "strconv" -) - -// Value provides methods for extracting interface{} data in various -// types. -type Value struct { - // data contains the raw data being managed by this Value - data interface{} -} - -// Data returns the raw data contained by this Value -func (v *Value) Data() interface{} { - return v.data -} - -// String returns the value always as a string -func (v *Value) String() string { - switch { - case v.IsNil(): - return "" - case v.IsStr(): - return v.Str() - case v.IsBool(): - return strconv.FormatBool(v.Bool()) - case v.IsFloat32(): - return strconv.FormatFloat(float64(v.Float32()), 'f', -1, 32) - case v.IsFloat64(): - return strconv.FormatFloat(v.Float64(), 'f', -1, 64) - case v.IsInt(): - return strconv.FormatInt(int64(v.Int()), 10) - case v.IsInt8(): - return strconv.FormatInt(int64(v.Int8()), 10) - case v.IsInt16(): - return strconv.FormatInt(int64(v.Int16()), 10) - case v.IsInt32(): - return strconv.FormatInt(int64(v.Int32()), 10) - case v.IsInt64(): - return strconv.FormatInt(v.Int64(), 10) - case v.IsUint(): - return strconv.FormatUint(uint64(v.Uint()), 10) - case v.IsUint8(): - return strconv.FormatUint(uint64(v.Uint8()), 10) - case v.IsUint16(): - return strconv.FormatUint(uint64(v.Uint16()), 10) - case v.IsUint32(): - return strconv.FormatUint(uint64(v.Uint32()), 10) - case v.IsUint64(): - return strconv.FormatUint(v.Uint64(), 10) - } - return fmt.Sprintf("%#v", v.Data()) -} - -// StringSlice returns the value always as a []string -func (v *Value) StringSlice(optionalDefault ...[]string) []string { - switch { - case v.IsStrSlice(): - return v.MustStrSlice() - case v.IsBoolSlice(): - slice := v.MustBoolSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatBool(iv) - } - return vals - case v.IsFloat32Slice(): - slice := v.MustFloat32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatFloat(float64(iv), 'f', -1, 32) - } - return vals - case v.IsFloat64Slice(): - slice := v.MustFloat64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatFloat(iv, 'f', -1, 64) - } - return vals - case v.IsIntSlice(): - slice := v.MustIntSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt8Slice(): - slice := v.MustInt8Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt16Slice(): - slice := v.MustInt16Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt32Slice(): - slice := v.MustInt32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt64Slice(): - slice := v.MustInt64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(iv, 10) - } - return vals - case v.IsUintSlice(): - slice := v.MustUintSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint8Slice(): - slice := v.MustUint8Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint16Slice(): - slice := v.MustUint16Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint32Slice(): - slice := v.MustUint32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint64Slice(): - slice := v.MustUint64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(iv, 10) - } - return vals - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - - return []string{} -} diff --git a/vendor/github.com/stretchr/testify/mock/doc.go b/vendor/github.com/stretchr/testify/mock/doc.go deleted file mode 100644 index 7324128ef19..00000000000 --- a/vendor/github.com/stretchr/testify/mock/doc.go +++ /dev/null @@ -1,44 +0,0 @@ -// 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 deleted file mode 100644 index f0af8246cfc..00000000000 --- a/vendor/github.com/stretchr/testify/mock/mock.go +++ /dev/null @@ -1,1098 +0,0 @@ -package mock - -import ( - "errors" - "fmt" - "reflect" - "regexp" - "runtime" - "strings" - "sync" - "time" - - "github.com/davecgh/go-spew/spew" - "github.com/pmezard/go-difflib/difflib" - "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 - - // Holds the caller info for the On() call - callerInfo []string - - // 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 - - // Call to this method can be optional - optional bool - - // Holds a channel that will be used to block the Return until it either - // receives a message or is closed. nil means it returns immediately. - WaitFor <-chan time.Time - - waitTime time.Duration - - // 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) - - // PanicMsg holds msg to be used to mock panic on the function call - // if the PanicMsg is set to a non nil string the function call will panic - // irrespective of other settings - PanicMsg *string - - // Calls which must be satisfied before this call can be - requires []*Call -} - -func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments ...interface{}) *Call { - return &Call{ - Parent: parent, - Method: methodName, - Arguments: methodArguments, - ReturnArguments: make([]interface{}, 0), - callerInfo: callerInfo, - Repeatability: 0, - WaitFor: nil, - RunFn: nil, - PanicMsg: 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 -} - -// Panic specifies if the functon call should fail and the panic message -// -// Mock.On("DoSomething").Panic("test panic") -func (c *Call) Panic(msg string) *Call { - c.lock() - defer c.unlock() - - c.PanicMsg = &msg - - 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 { - c.lock() - defer c.unlock() - c.waitTime = d - return c -} - -// Run sets a handler to be called before returning. It can be used when -// mocking a method (such as an unmarshaler) 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(args Arguments)) *Call { - c.lock() - defer c.unlock() - c.RunFn = fn - return c -} - -// Maybe allows the method call to be optional. Not calling an optional method -// will not cause an error while asserting expectations -func (c *Call) Maybe() *Call { - c.lock() - defer c.unlock() - c.optional = true - 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")) -//go:noinline -func (c *Call) On(methodName string, arguments ...interface{}) *Call { - return c.Parent.On(methodName, arguments...) -} - -// Unset removes a mock handler from being called. -// test.On("func", mock.Anything).Unset() -func (c *Call) Unset() *Call { - var unlockOnce sync.Once - - for _, arg := range c.Arguments { - if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { - panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) - } - } - - c.lock() - defer unlockOnce.Do(c.unlock) - - foundMatchingCall := false - - for i, call := range c.Parent.ExpectedCalls { - if call.Method == c.Method { - _, diffCount := call.Arguments.Diff(c.Arguments) - if diffCount == 0 { - foundMatchingCall = true - // Remove from ExpectedCalls - c.Parent.ExpectedCalls = append(c.Parent.ExpectedCalls[:i], c.Parent.ExpectedCalls[i+1:]...) - } - } - } - - if !foundMatchingCall { - unlockOnce.Do(c.unlock) - c.Parent.fail("\n\nmock: Could not find expected call\n-----------------------------\n\n%s\n\n", - callString(c.Method, c.Arguments, true), - ) - } - - return c -} - -// NotBefore indicates that the mock should only be called after the referenced -// calls have been called as expected. The referenced calls may be from the -// same mock instance and/or other mock instances. -// -// Mock.On("Do").Return(nil).Notbefore( -// Mock.On("Init").Return(nil) -// ) -func (c *Call) NotBefore(calls ...*Call) *Call { - c.lock() - defer c.unlock() - - for _, call := range calls { - if call.Parent == nil { - panic("not before calls must be created with Mock.On()") - } - } - - c.requires = append(c.requires, calls...) - return c -} - -// 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 - - // test is An optional variable that holds the test struct, to be used when an - // invalid mock call was made. - test TestingT - - // 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 -} - -// String provides a %v format string for Mock. -// Note: this is used implicitly by Arguments.Diff if a Mock is passed. -// It exists because go's default %v formatting traverses the struct -// without acquiring the mutex, which is detected by go test -race. -func (m *Mock) String() string { - return fmt.Sprintf("%[1]T<%[1]p>", m) -} - -// 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 -*/ - -// Test sets the test struct variable of the mock object -func (m *Mock) Test(t TestingT) { - m.mutex.Lock() - defer m.mutex.Unlock() - m.test = t -} - -// fail fails the current test with the given formatted format and args. -// In case that a test was defined, it uses the test APIs for failing a test, -// otherwise it uses panic. -func (m *Mock) fail(format string, args ...interface{}) { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.test == nil { - panic(fmt.Sprintf(format, args...)) - } - m.test.Errorf(format, args...) - m.test.FailNow() -} - -// 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, assert.CallerInfo(), arguments...) - m.ExpectedCalls = append(m.ExpectedCalls, c) - return c -} - -// /* -// Recording and responding to activity -// */ - -func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) { - var expectedCall *Call - - for i, call := range m.ExpectedCalls { - if call.Method == method { - _, diffCount := call.Arguments.Diff(arguments) - if diffCount == 0 { - expectedCall = call - if call.Repeatability > -1 { - return i, call - } - } - } - } - - return -1, expectedCall -} - -type matchCandidate struct { - call *Call - mismatch string - diffCount int -} - -func (c matchCandidate) isBetterMatchThan(other matchCandidate) bool { - if c.call == nil { - return false - } - if other.call == nil { - return true - } - - if c.diffCount > other.diffCount { - return false - } - if c.diffCount < other.diffCount { - return true - } - - if c.call.Repeatability > 0 && other.call.Repeatability <= 0 { - return true - } - return false -} - -func (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) { - var bestMatch matchCandidate - - for _, call := range m.expectedCalls() { - if call.Method == method { - - errInfo, tempDiffCount := call.Arguments.Diff(arguments) - tempCandidate := matchCandidate{ - call: call, - mismatch: errInfo, - diffCount: tempDiffCount, - } - if tempCandidate.isBetterMatchThan(bestMatch) { - bestMatch = tempCandidate - } - } - } - - return bestMatch.call, bestMatch.mismatch -} - -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 interface 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] - return m.MethodCalled(functionName, arguments...) -} - -// MethodCalled tells the mock object that the given 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) MethodCalled(methodName string, arguments ...interface{}) Arguments { - m.mutex.Lock() - // TODO: could combine expected and closes in single loop - found, call := m.findExpectedCall(methodName, arguments...) - - if found < 0 { - // expected call found but it has already been called with repeatable times - if call != nil { - m.mutex.Unlock() - m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(\"%s\").Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo()) - } - // 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. - closestCall, mismatch := m.findClosestCall(methodName, arguments...) - m.mutex.Unlock() - - if closestCall != nil { - m.fail("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\nDiff: %s", - callString(methodName, arguments, true), - callString(methodName, closestCall.Arguments, true), - diffArguments(closestCall.Arguments, arguments), - strings.TrimSpace(mismatch), - ) - } else { - m.fail("\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", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) - } - } - - for _, requirement := range call.requires { - if satisfied, _ := requirement.Parent.checkExpectation(requirement); !satisfied { - m.mutex.Unlock() - m.fail("mock: Unexpected Method Call\n-----------------------------\n\n%s\n\nMust not be called before%s:\n\n%s", - callString(call.Method, call.Arguments, true), - func() (s string) { - if requirement.totalCalls > 0 { - s = " another call of" - } - if call.Parent != requirement.Parent { - s += " method from another mock instance" - } - return - }(), - callString(requirement.Method, requirement.Arguments, true), - ) - } - } - - if call.Repeatability == 1 { - call.Repeatability = -1 - } else if call.Repeatability > 1 { - call.Repeatability-- - } - call.totalCalls++ - - // add the call - m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments...)) - m.mutex.Unlock() - - // block if specified - if call.WaitFor != nil { - <-call.WaitFor - } else { - time.Sleep(call.waitTime) - } - - m.mutex.Lock() - panicMsg := call.PanicMsg - m.mutex.Unlock() - if panicMsg != nil { - panic(*panicMsg) - } - - m.mutex.Lock() - runFn := call.RunFn - m.mutex.Unlock() - - if runFn != nil { - runFn(arguments) - } - - m.mutex.Lock() - returnArgs := call.ReturnArguments - m.mutex.Unlock() - - return returnArgs -} - -/* - Assertions -*/ - -type assertExpectationser interface { - AssertExpectations(TestingT) bool -} - -// 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 { - if h, ok := t.(tHelper); ok { - h.Helper() - } - for _, obj := range testObjects { - if m, ok := obj.(*Mock); ok { - t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") - obj = m - } - m := obj.(assertExpectationser) - if !m.AssertExpectations(t) { - t.Logf("Expectations didn't match for Mock: %+v", reflect.TypeOf(m)) - return false - } - } - return true -} - -// 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 { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - m.mutex.Lock() - defer m.mutex.Unlock() - var failedExpectations int - - // iterate through each expectation - expectedCalls := m.expectedCalls() - for _, expectedCall := range expectedCalls { - satisfied, reason := m.checkExpectation(expectedCall) - if !satisfied { - failedExpectations++ - } - t.Logf(reason) - } - - if failedExpectations != 0 { - 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 failedExpectations == 0 -} - -func (m *Mock) checkExpectation(call *Call) (bool, string) { - if !call.optional && !m.methodWasCalled(call.Method, call.Arguments) && call.totalCalls == 0 { - return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo) - } - if call.Repeatability > 0 { - return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo) - } - return true, fmt.Sprintf("PASS:\t%s(%s)", call.Method, call.Arguments.String()) -} - -// AssertNumberOfCalls asserts that the method was called expectedCalls times. -func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - 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 h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - if !m.methodWasCalled(methodName, arguments) { - var calledWithArgs []string - for _, call := range m.calls() { - calledWithArgs = append(calledWithArgs, fmt.Sprintf("%v", call.Arguments)) - } - if len(calledWithArgs) == 0 { - return assert.Fail(t, "Should have called with given arguments", - fmt.Sprintf("Expected %q to have been called with:\n%v\nbut no actual calls happened", methodName, arguments)) - } - return assert.Fail(t, "Should have called with given arguments", - fmt.Sprintf("Expected %q to have been called with:\n%v\nbut actual calls were:\n %v", methodName, arguments, strings.Join(calledWithArgs, "\n"))) - } - 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 h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - if m.methodWasCalled(methodName, arguments) { - return assert.Fail(t, "Should not have called with given arguments", - fmt.Sprintf("Expected %q to not have been called with:\n%v\nbut actually it was.", methodName, arguments)) - } - return true -} - -// IsMethodCallable checking that the method can be called -// If the method was called more than `Repeatability` return false -func (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - - for _, v := range m.ExpectedCalls { - if v.Method != methodName { - continue - } - if len(arguments) != len(v.Arguments) { - continue - } - if v.Repeatability < v.totalCalls { - continue - } - if isArgsEqual(v.Arguments, arguments) { - return true - } - } - return false -} - -// isArgsEqual compares arguments -func isArgsEqual(expected Arguments, args []interface{}) bool { - if len(expected) != len(args) { - return false - } - for i, v := range args { - if !reflect.DeepEqual(expected[i], v) { - 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 { - return append([]*Call{}, m.ExpectedCalls...) -} - -func (m *Mock) calls() []Call { - 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 = "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) -} - -// IsTypeArgument is a struct that contains the type of an argument -// for use when type checking. This is an alternative to AnythingOfType. -// Used in Diff and Assert. -type IsTypeArgument struct { - t interface{} -} - -// IsType returns an IsTypeArgument object containing the type to check for. -// You can provide a zero-value of the type to check. This is an -// alternative to AnythingOfType. Used in Diff and Assert. -// -// For example: -// Assert(t, IsType(""), IsType(0)) -func IsType(t interface{}) *IsTypeArgument { - return &IsTypeArgument{t: 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) - expectTypeNilSupported := false - switch expectType.Kind() { - case reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Ptr: - expectTypeNilSupported = true - } - - argType := reflect.TypeOf(argument) - var arg reflect.Value - if argType == nil { - arg = reflect.New(expectType).Elem() - } else { - arg = reflect.ValueOf(argument) - } - - if argType == nil && !expectTypeNilSupported { - panic(errors.New("attempting to call matcher with nil for non-nil expected type")) - } - if argType == nil || argType.AssignableTo(expectType) { - result := f.fn.Call([]reflect.Value{arg}) - return result[0].Bool() - } - return false -} - -func (f argumentMatcher) String() string { - return fmt.Sprintf("func(%s) bool", f.fn.Type().In(0).String()) -} - -// 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, -// MatchedBy() 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) { - // TODO: could return string as error and nil for No difference - - output := "\n" - var differences int - - maxArgCount := len(args) - if len(objects) > maxArgCount { - maxArgCount = len(objects) - } - - for i := 0; i < maxArgCount; i++ { - var actual, expected interface{} - var actualFmt, expectedFmt string - - if len(objects) <= i { - actual = "(Missing)" - actualFmt = "(Missing)" - } else { - actual = objects[i] - actualFmt = fmt.Sprintf("(%[1]T=%[1]v)", actual) - } - - if len(args) <= i { - expected = "(Missing)" - expectedFmt = "(Missing)" - } else { - expected = args[i] - expectedFmt = fmt.Sprintf("(%[1]T=%[1]v)", expected) - } - - if matcher, ok := expected.(argumentMatcher); ok { - var matches bool - func() { - defer func() { - if r := recover(); r != nil { - actualFmt = fmt.Sprintf("panic in argument matcher: %v", r) - } - }() - matches = matcher.Matches(actual) - }() - if matches { - output = fmt.Sprintf("%s\t%d: PASS: %s matched by %s\n", output, i, actualFmt, matcher) - } else { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s not matched by %s\n", output, i, actualFmt, 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: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt) - } - } else if reflect.TypeOf(expected) == reflect.TypeOf((*IsTypeArgument)(nil)) { - t := expected.(*IsTypeArgument).t - if reflect.TypeOf(t) != reflect.TypeOf(actual) { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, reflect.TypeOf(t).Name(), reflect.TypeOf(actual).Name(), actualFmt) - } - } else { - // normal checking - - if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { - // match - output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, actualFmt, expectedFmt) - } else { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, actualFmt, expectedFmt) - } - } - - } - - 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 { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - // 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("%T", arg)) // handles nil nicely - } - return strings.Join(argsStr, ",") - } else if len(indexOrNil) == 1 { - // Index has been specified - get the argument at that index - 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 -} - -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 -} - -func diffArguments(expected Arguments, actual Arguments) string { - if len(expected) != len(actual) { - return fmt.Sprintf("Provided %v arguments, mocked for %v arguments", len(expected), len(actual)) - } - - for x := range expected { - if diffString := diff(expected[x], actual[x]); diffString != "" { - return fmt.Sprintf("Difference found in argument %v:\n\n%s", x, diffString) - } - } - - return "" -} - -// 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 "" - } - - e := spewConfig.Sdump(expected) - a := spewConfig.Sdump(actual) - - diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(e), - B: difflib.SplitLines(a), - FromFile: "Expected", - FromDate: "", - ToFile: "Actual", - ToDate: "", - Context: 1, - }) - - return diff -} - -var spewConfig = spew.ConfigState{ - Indent: " ", - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, -} - -type tHelper interface { - Helper() -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 7604e8c1cbb..4c1c913ed14 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -144,12 +144,8 @@ github.com/aws/aws-sdk-go/private/protocol/query/queryutil github.com/aws/aws-sdk-go/private/protocol/rest github.com/aws/aws-sdk-go/private/protocol/restjson github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil -github.com/aws/aws-sdk-go/service/autoscaling github.com/aws/aws-sdk-go/service/ec2 github.com/aws/aws-sdk-go/service/ecr -github.com/aws/aws-sdk-go/service/elb -github.com/aws/aws-sdk-go/service/elbv2 -github.com/aws/aws-sdk-go/service/kms github.com/aws/aws-sdk-go/service/sso github.com/aws/aws-sdk-go/service/sso/ssoiface github.com/aws/aws-sdk-go/service/sts @@ -388,7 +384,6 @@ github.com/google/cadvisor/third_party/containerd/api/types github.com/google/cadvisor/third_party/containerd/api/types/task github.com/google/cadvisor/utils github.com/google/cadvisor/utils/cloudinfo -github.com/google/cadvisor/utils/cloudinfo/aws github.com/google/cadvisor/utils/cloudinfo/azure github.com/google/cadvisor/utils/cloudinfo/gce github.com/google/cadvisor/utils/cpuload @@ -703,13 +698,9 @@ github.com/spf13/pflag # github.com/stoewer/go-strcase v1.2.0 ## explicit; go 1.11 github.com/stoewer/go-strcase -# github.com/stretchr/objx v0.5.0 -## explicit; go 1.12 -github.com/stretchr/objx # github.com/stretchr/testify v1.8.1 ## explicit; go 1.13 github.com/stretchr/testify/assert -github.com/stretchr/testify/mock github.com/stretchr/testify/require # github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 ## explicit @@ -2285,7 +2276,6 @@ k8s.io/kubelet/pkg/apis/podresources/v1alpha1 k8s.io/kubelet/pkg/apis/stats/v1alpha1 # k8s.io/legacy-cloud-providers v0.0.0 => ./staging/src/k8s.io/legacy-cloud-providers ## explicit; go 1.19 -k8s.io/legacy-cloud-providers/aws k8s.io/legacy-cloud-providers/azure k8s.io/legacy-cloud-providers/azure/auth k8s.io/legacy-cloud-providers/azure/cache