From a18113ba25d85a22c6adbd48ad2e3bdb7ef322e1 Mon Sep 17 00:00:00 2001 From: Alex Somesan Date: Tue, 11 Apr 2017 19:11:01 +0200 Subject: [PATCH 1/7] modules/*: convert ignition resources to data sources --- modules/aws/etcd/ignition.tf | 14 +++---- modules/aws/etcd/nodes.tf | 2 +- modules/aws/ignition/ignition.tf | 42 ++++++++++----------- modules/aws/ignition/outputs.tf | 2 +- modules/aws/master-asg/master.tf | 4 +- modules/aws/worker-asg/worker.tf | 4 +- modules/azure/etcd/etcd.tf | 2 +- modules/azure/etcd/ignition.tf | 14 +++---- modules/azure/master/ignition-master.tf | 42 ++++++++++----------- modules/azure/master/master.tf | 2 +- modules/azure/worker/ignition-worker.tf | 36 +++++++++--------- modules/azure/worker/workers.tf | 2 +- modules/openstack/etcd/ignition.tf | 18 ++++----- modules/openstack/etcd/output.tf | 2 +- modules/openstack/nodes/ignition.tf | 50 ++++++++++++------------- modules/openstack/nodes/output.tf | 2 +- modules/openstack/secrets/secrets.tf | 2 +- 17 files changed, 120 insertions(+), 120 deletions(-) diff --git a/modules/aws/etcd/ignition.tf b/modules/aws/etcd/ignition.tf index e9b4c6a827..b8bc6d248c 100644 --- a/modules/aws/etcd/ignition.tf +++ b/modules/aws/etcd/ignition.tf @@ -1,17 +1,17 @@ -resource "ignition_config" "etcd" { +data "ignition_config" "etcd" { count = "${length(var.external_endpoints) == 0 ? var.instance_count : 0}" systemd = [ - "${ignition_systemd_unit.locksmithd.id}", - "${ignition_systemd_unit.etcd3.*.id[count.index]}", + "${data.ignition_systemd_unit.locksmithd.id}", + "${data.ignition_systemd_unit.etcd3.*.id[count.index]}", ] files = [ - "${ignition_file.node_hostname.*.id[count.index]}", + "${data.ignition_file.node_hostname.*.id[count.index]}", ] } -resource "ignition_file" "node_hostname" { +data "ignition_file" "node_hostname" { count = "${length(var.external_endpoints) == 0 ? var.instance_count : 0}" path = "/etc/hostname" mode = 0644 @@ -22,7 +22,7 @@ resource "ignition_file" "node_hostname" { } } -resource "ignition_systemd_unit" "locksmithd" { +data "ignition_systemd_unit" "locksmithd" { count = "${length(var.external_endpoints) == 0 ? 1 : 0}" name = "locksmithd.service" @@ -36,7 +36,7 @@ resource "ignition_systemd_unit" "locksmithd" { ] } -resource "ignition_systemd_unit" "etcd3" { +data "ignition_systemd_unit" "etcd3" { count = "${length(var.external_endpoints) == 0 ? var.instance_count : 0}" name = "etcd-member.service" enable = true diff --git a/modules/aws/etcd/nodes.tf b/modules/aws/etcd/nodes.tf index 0dc4c44238..16cbd57786 100644 --- a/modules/aws/etcd/nodes.tf +++ b/modules/aws/etcd/nodes.tf @@ -29,7 +29,7 @@ resource "aws_instance" "etcd_node" { instance_type = "${var.ec2_type}" subnet_id = "${var.subnets[count.index % var.az_count]}" key_name = "${var.ssh_key}" - user_data = "${ignition_config.etcd.*.rendered[count.index]}" + user_data = "${data.ignition_config.etcd.*.rendered[count.index]}" vpc_security_group_ids = ["${var.sg_ids}"] tags = "${merge(map( diff --git a/modules/aws/ignition/ignition.tf b/modules/aws/ignition/ignition.tf index 195b46e59d..c25b52c5e6 100644 --- a/modules/aws/ignition/ignition.tf +++ b/modules/aws/ignition/ignition.tf @@ -1,22 +1,22 @@ -resource "ignition_config" "main" { +data "ignition_config" "main" { files = [ - "${ignition_file.max-user-watches.id}", - "${ignition_file.s3-puller.id}", - "${ignition_file.init-assets.id}", + "${data.ignition_file.max-user-watches.id}", + "${data.ignition_file.s3-puller.id}", + "${data.ignition_file.init-assets.id}", ] systemd = [ - "${ignition_systemd_unit.etcd-member.id}", - "${ignition_systemd_unit.docker.id}", - "${ignition_systemd_unit.locksmithd.id}", - "${ignition_systemd_unit.kubelet.id}", - "${ignition_systemd_unit.init-assets.id}", - "${ignition_systemd_unit.bootkube.id}", - "${ignition_systemd_unit.tectonic.id}", + "${data.ignition_systemd_unit.etcd-member.id}", + "${data.ignition_systemd_unit.docker.id}", + "${data.ignition_systemd_unit.locksmithd.id}", + "${data.ignition_systemd_unit.kubelet.id}", + "${data.ignition_systemd_unit.init-assets.id}", + "${data.ignition_systemd_unit.bootkube.id}", + "${data.ignition_systemd_unit.tectonic.id}", ] } -resource "ignition_systemd_unit" "docker" { +data "ignition_systemd_unit" "docker" { name = "docker.service" enable = true @@ -28,7 +28,7 @@ resource "ignition_systemd_unit" "docker" { ] } -resource "ignition_systemd_unit" "locksmithd" { +data "ignition_systemd_unit" "locksmithd" { name = "locksmithd.service" dropin = [ @@ -52,7 +52,7 @@ data "template_file" "kubelet" { } } -resource "ignition_systemd_unit" "kubelet" { +data "ignition_systemd_unit" "kubelet" { name = "kubelet.service" enable = true content = "${data.template_file.kubelet.rendered}" @@ -67,7 +67,7 @@ data "template_file" "etcd-member" { } } -resource "ignition_systemd_unit" "etcd-member" { +data "ignition_systemd_unit" "etcd-member" { name = "etcd-member.service" enable = "${var.etcd_gateway_enabled == 1 ? true : false}" @@ -79,7 +79,7 @@ resource "ignition_systemd_unit" "etcd-member" { ] } -resource "ignition_file" "max-user-watches" { +data "ignition_file" "max-user-watches" { filesystem = "root" path = "/etc/sysctl.d/max-user-watches.conf" mode = "420" @@ -89,7 +89,7 @@ resource "ignition_file" "max-user-watches" { } } -resource "ignition_file" "s3-puller" { +data "ignition_file" "s3-puller" { filesystem = "root" path = "/opt/s3-puller.sh" mode = "555" @@ -108,7 +108,7 @@ data "template_file" "init-assets" { } } -resource "ignition_file" "init-assets" { +data "ignition_file" "init-assets" { filesystem = "root" path = "/opt/tectonic/init-assets.sh" mode = "555" @@ -118,18 +118,18 @@ resource "ignition_file" "init-assets" { } } -resource "ignition_systemd_unit" "init-assets" { +data "ignition_systemd_unit" "init-assets" { name = "init-assets.service" enable = "${var.assets_s3_location != "" ? true : false}" content = "${file("${path.module}/resources/services/init-assets.service")}" } -resource "ignition_systemd_unit" "bootkube" { +data "ignition_systemd_unit" "bootkube" { name = "bootkube.service" content = "${var.bootkube_service}" } -resource "ignition_systemd_unit" "tectonic" { +data "ignition_systemd_unit" "tectonic" { name = "tectonic.service" enable = "${var.tectonic_service_disabled == 0 ? true : false}" content = "${var.tectonic_service}" diff --git a/modules/aws/ignition/outputs.tf b/modules/aws/ignition/outputs.tf index 91fd6e625c..808eca355c 100644 --- a/modules/aws/ignition/outputs.tf +++ b/modules/aws/ignition/outputs.tf @@ -1,3 +1,3 @@ output "ignition" { - value = "${ignition_config.main.rendered}" + value = "${data.ignition_config.main.rendered}" } diff --git a/modules/aws/master-asg/master.tf b/modules/aws/master-asg/master.tf index 651feee8bc..85e103a500 100644 --- a/modules/aws/master-asg/master.tf +++ b/modules/aws/master-asg/master.tf @@ -73,8 +73,8 @@ resource "aws_launch_configuration" "master_conf" { } resource "aws_iam_instance_profile" "master_profile" { - name = "${var.cluster_name}-master-profile" - roles = ["${aws_iam_role.master_role.name}"] + name = "${var.cluster_name}-master-profile" + role = "${aws_iam_role.master_role.name}" } resource "aws_iam_role" "master_role" { diff --git a/modules/aws/worker-asg/worker.tf b/modules/aws/worker-asg/worker.tf index 23bdbbd5a2..6e74f2992a 100644 --- a/modules/aws/worker-asg/worker.tf +++ b/modules/aws/worker-asg/worker.tf @@ -70,8 +70,8 @@ resource "aws_autoscaling_group" "workers" { } resource "aws_iam_instance_profile" "worker_profile" { - name = "${var.cluster_name}-worker-profile" - roles = ["${aws_iam_role.worker_role.name}"] + name = "${var.cluster_name}-worker-profile" + role = "${aws_iam_role.worker_role.name}" } resource "aws_iam_role" "worker_role" { diff --git a/modules/azure/etcd/etcd.tf b/modules/azure/etcd/etcd.tf index c7a0c97274..8e7648850b 100644 --- a/modules/azure/etcd/etcd.tf +++ b/modules/azure/etcd/etcd.tf @@ -31,7 +31,7 @@ resource "azurerm_virtual_machine" "etcd_node" { computer_name = "etcd" admin_username = "core" admin_password = "Microsoft123!" - custom_data = "${base64encode("${ignition_config.etcd.*.rendered[count.index]}")}" + custom_data = "${base64encode("${data.ignition_config.etcd.*.rendered[count.index]}")}" } os_profile_linux_config { diff --git a/modules/azure/etcd/ignition.tf b/modules/azure/etcd/ignition.tf index bf866752a8..ab57d53083 100644 --- a/modules/azure/etcd/ignition.tf +++ b/modules/azure/etcd/ignition.tf @@ -1,17 +1,17 @@ -resource "ignition_config" "etcd" { +data "ignition_config" "etcd" { count = "${var.etcd_count}" systemd = [ - "${ignition_systemd_unit.locksmithd.id}", - "${ignition_systemd_unit.etcd3.*.id[count.index]}", + "${data.ignition_systemd_unit.locksmithd.id}", + "${data.ignition_systemd_unit.etcd3.*.id[count.index]}", ] users = [ - "${ignition_user.core.id}", + "${data.ignition_user.core.id}", ] } -resource "ignition_user" "core" { +data "ignition_user" "core" { name = "core" ssh_authorized_keys = [ @@ -19,7 +19,7 @@ resource "ignition_user" "core" { ] } -resource "ignition_systemd_unit" "locksmithd" { +data "ignition_systemd_unit" "locksmithd" { name = "locksmithd.service" enable = true @@ -31,7 +31,7 @@ resource "ignition_systemd_unit" "locksmithd" { ] } -resource "ignition_systemd_unit" "etcd3" { +data "ignition_systemd_unit" "etcd3" { count = "${var.etcd_count}" name = "etcd-member.service" enable = true diff --git a/modules/azure/master/ignition-master.tf b/modules/azure/master/ignition-master.tf index 592744c87d..64408f2855 100644 --- a/modules/azure/master/ignition-master.tf +++ b/modules/azure/master/ignition-master.tf @@ -1,25 +1,25 @@ -resource "ignition_config" "master" { +data "ignition_config" "master" { files = [ - "${ignition_file.kubeconfig.id}", - "${ignition_file.kubelet-env.id}", - "${ignition_file.max-user-watches.id}", + "${data.ignition_file.kubeconfig.id}", + "${data.ignition_file.kubelet-env.id}", + "${data.ignition_file.max-user-watches.id}", ] systemd = [ - "${ignition_systemd_unit.etcd-member.id}", - "${ignition_systemd_unit.docker.id}", - "${ignition_systemd_unit.locksmithd.id}", - "${ignition_systemd_unit.kubelet-master.id}", - "${ignition_systemd_unit.tectonic.id}", - "${ignition_systemd_unit.bootkube.id}", + "${data.ignition_systemd_unit.etcd-member.id}", + "${data.ignition_systemd_unit.docker.id}", + "${data.ignition_systemd_unit.locksmithd.id}", + "${data.ignition_systemd_unit.kubelet-master.id}", + "${data.ignition_systemd_unit.tectonic.id}", + "${data.ignition_systemd_unit.bootkube.id}", ] users = [ - "${ignition_user.core.id}", + "${data.ignition_user.core.id}", ] } -resource "ignition_user" "core" { +data "ignition_user" "core" { name = "core" ssh_authorized_keys = [ @@ -27,7 +27,7 @@ resource "ignition_user" "core" { ] } -resource "ignition_systemd_unit" "docker" { +data "ignition_systemd_unit" "docker" { name = "docker.service" enable = true @@ -39,7 +39,7 @@ resource "ignition_systemd_unit" "docker" { ] } -resource "ignition_systemd_unit" "locksmithd" { +data "ignition_systemd_unit" "locksmithd" { name = "locksmithd.service" dropin = [ @@ -61,7 +61,7 @@ data "template_file" "kubelet-master" { } } -resource "ignition_systemd_unit" "kubelet-master" { +data "ignition_systemd_unit" "kubelet-master" { name = "kubelet.service" enable = true content = "${data.template_file.kubelet-master.rendered}" @@ -76,7 +76,7 @@ data "template_file" "etcd-member" { } } -resource "ignition_systemd_unit" "etcd-member" { +data "ignition_systemd_unit" "etcd-member" { name = "etcd-member.service" enable = true @@ -88,7 +88,7 @@ resource "ignition_systemd_unit" "etcd-member" { ] } -resource "ignition_file" "kubeconfig" { +data "ignition_file" "kubeconfig" { filesystem = "root" path = "/etc/kubernetes/kubeconfig" mode = "420" @@ -98,7 +98,7 @@ resource "ignition_file" "kubeconfig" { } } -resource "ignition_file" "kubelet-env" { +data "ignition_file" "kubelet-env" { filesystem = "root" path = "/etc/kubernetes/kubelet.env" mode = "420" @@ -111,7 +111,7 @@ EOF } } -resource "ignition_file" "max-user-watches" { +data "ignition_file" "max-user-watches" { filesystem = "root" path = "/etc/sysctl.d/max-user-watches.conf" mode = "420" @@ -121,12 +121,12 @@ resource "ignition_file" "max-user-watches" { } } -resource "ignition_systemd_unit" "bootkube" { +data "ignition_systemd_unit" "bootkube" { name = "bootkube.service" content = "${var.bootkube_service}" } -resource "ignition_systemd_unit" "tectonic" { +data "ignition_systemd_unit" "tectonic" { name = "tectonic.service" enable = "${var.tectonic_service_disabled == 0 ? true : false}" content = "${var.tectonic_service}" diff --git a/modules/azure/master/master.tf b/modules/azure/master/master.tf index 3a4484ffca..fc2cacbd51 100644 --- a/modules/azure/master/master.tf +++ b/modules/azure/master/master.tf @@ -71,7 +71,7 @@ resource "azurerm_virtual_machine_scale_set" "tectonic_masters" { admin_username = "core" admin_password = "" - custom_data = "${base64encode("${ignition_config.master.*.rendered[count.index]}")}" + custom_data = "${base64encode("${data.ignition_config.master.*.rendered[count.index]}")}" } os_profile_linux_config { diff --git a/modules/azure/worker/ignition-worker.tf b/modules/azure/worker/ignition-worker.tf index 051edc564c..7a95bd29f8 100644 --- a/modules/azure/worker/ignition-worker.tf +++ b/modules/azure/worker/ignition-worker.tf @@ -1,23 +1,23 @@ -resource "ignition_config" "worker" { +data "ignition_config" "worker" { files = [ - "${ignition_file.kubeconfig.id}", - "${ignition_file.kubelet-env.id}", - "${ignition_file.max-user-watches.id}", + "${data.ignition_file.kubeconfig.id}", + "${data.ignition_file.kubelet-env.id}", + "${data.ignition_file.max-user-watches.id}", ] systemd = [ - "${ignition_systemd_unit.etcd-member.id}", - "${ignition_systemd_unit.docker.id}", - "${ignition_systemd_unit.locksmithd.id}", - "${ignition_systemd_unit.kubelet-worker.id}", + "${data.ignition_systemd_unit.etcd-member.id}", + "${data.ignition_systemd_unit.docker.id}", + "${data.ignition_systemd_unit.locksmithd.id}", + "${data.ignition_systemd_unit.kubelet-worker.id}", ] users = [ - "${ignition_user.core.id}", + "${data.ignition_user.core.id}", ] } -resource "ignition_systemd_unit" "docker" { +data "ignition_systemd_unit" "docker" { name = "docker.service" enable = true @@ -29,7 +29,7 @@ resource "ignition_systemd_unit" "docker" { ] } -resource "ignition_systemd_unit" "locksmithd" { +data "ignition_systemd_unit" "locksmithd" { name = "locksmithd.service" dropin = [ @@ -50,7 +50,7 @@ data "template_file" "kubelet-worker" { } } -resource "ignition_systemd_unit" "kubelet-worker" { +data "ignition_systemd_unit" "kubelet-worker" { name = "kubelet.service" enable = true content = "${data.template_file.kubelet-worker.rendered}" @@ -65,7 +65,7 @@ data "template_file" "etcd-member" { } } -resource "ignition_systemd_unit" "etcd-member" { +data "ignition_systemd_unit" "etcd-member" { name = "etcd-member.service" enable = true @@ -77,7 +77,7 @@ resource "ignition_systemd_unit" "etcd-member" { ] } -resource "ignition_file" "kubeconfig" { +data "ignition_file" "kubeconfig" { filesystem = "root" path = "/etc/kubernetes/kubeconfig" mode = "420" @@ -87,7 +87,7 @@ resource "ignition_file" "kubeconfig" { } } -resource "ignition_file" "kubelet-env" { +data "ignition_file" "kubelet-env" { filesystem = "root" path = "/etc/kubernetes/kubelet.env" mode = "420" @@ -100,7 +100,7 @@ EOF } } -resource "ignition_file" "max-user-watches" { +data "ignition_file" "max-user-watches" { filesystem = "root" path = "/etc/sysctl.d/max-user-watches.conf" mode = "420" @@ -110,7 +110,7 @@ resource "ignition_file" "max-user-watches" { } } -resource "ignition_systemd_unit" "tectonic" { +data "ignition_systemd_unit" "tectonic" { name = "tectonic.service" enable = true @@ -125,7 +125,7 @@ ExecStart=/usr/bin/bash /opt/tectonic/tectonic.sh kubeconfig tectonic EOF } -resource "ignition_user" "core" { +data "ignition_user" "core" { name = "core" ssh_authorized_keys = [ diff --git a/modules/azure/worker/workers.tf b/modules/azure/worker/workers.tf index 4322733c3d..963ef92801 100644 --- a/modules/azure/worker/workers.tf +++ b/modules/azure/worker/workers.tf @@ -73,7 +73,7 @@ resource "azurerm_virtual_machine_scale_set" "tectonic_workers" { computer_name_prefix = "tectonic-worker-" admin_username = "core" admin_password = "" - custom_data = "${base64encode("${ignition_config.worker.rendered}")}" + custom_data = "${base64encode("${data.ignition_config.worker.rendered}")}" } os_profile_linux_config { diff --git a/modules/openstack/etcd/ignition.tf b/modules/openstack/etcd/ignition.tf index 436bc2b5de..42f0cd3266 100644 --- a/modules/openstack/etcd/ignition.tf +++ b/modules/openstack/etcd/ignition.tf @@ -1,19 +1,19 @@ -resource "ignition_config" "etcd" { +data "ignition_config" "etcd" { users = [ - "${ignition_user.core.id}", + "${data.ignition_user.core.id}", ] files = [ - "${ignition_file.resolv_conf.id}", + "${data.ignition_file.resolv_conf.id}", ] systemd = [ - "${ignition_systemd_unit.locksmithd.id}", - "${ignition_systemd_unit.etcd3.id}", + "${data.ignition_systemd_unit.locksmithd.id}", + "${data.ignition_systemd_unit.etcd3.id}", ] } -resource "ignition_file" "resolv_conf" { +data "ignition_file" "resolv_conf" { path = "/etc/resolv.conf" mode = 0644 uid = 0 @@ -24,7 +24,7 @@ resource "ignition_file" "resolv_conf" { } } -resource "ignition_systemd_unit" "etcd3" { +data "ignition_systemd_unit" "etcd3" { name = "etcd-member.service" enable = true @@ -48,7 +48,7 @@ EOF ] } -resource "ignition_systemd_unit" "locksmithd" { +data "ignition_systemd_unit" "locksmithd" { name = "locksmithd.service" enable = true @@ -60,7 +60,7 @@ resource "ignition_systemd_unit" "locksmithd" { ] } -resource "ignition_user" "core" { +data "ignition_user" "core" { name = "core" ssh_authorized_keys = ["${var.core_public_keys}"] } diff --git a/modules/openstack/etcd/output.tf b/modules/openstack/etcd/output.tf index 6e11f42568..a18c49f138 100644 --- a/modules/openstack/etcd/output.tf +++ b/modules/openstack/etcd/output.tf @@ -1,5 +1,5 @@ output "user_data" { - value = ["${ignition_config.etcd.*.rendered}"] + value = ["${data.ignition_config.etcd.*.rendered}"] } output "secgroup_name" { diff --git a/modules/openstack/nodes/ignition.tf b/modules/openstack/nodes/ignition.tf index 8f609b5c7f..e251d6a133 100644 --- a/modules/openstack/nodes/ignition.tf +++ b/modules/openstack/nodes/ignition.tf @@ -1,29 +1,29 @@ -resource "ignition_config" "node" { +data "ignition_config" "node" { count = "${var.instance_count}" users = [ - "${ignition_user.core.id}", + "${data.ignition_user.core.id}", ] files = [ - "${ignition_file.kubeconfig.id}", - "${ignition_file.kubelet-env.id}", - "${ignition_file.max-user-watches.id}", - "${ignition_file.resolv_conf.id}", - "${ignition_file.hostname.*.id[count.index]}", + "${data.ignition_file.kubeconfig.id}", + "${data.ignition_file.kubelet-env.id}", + "${data.ignition_file.max-user-watches.id}", + "${data.ignition_file.resolv_conf.id}", + "${data.ignition_file.hostname.*.id[count.index]}", ] systemd = [ - "${ignition_systemd_unit.etcd-member.id}", - "${ignition_systemd_unit.docker.id}", - "${ignition_systemd_unit.locksmithd.id}", - "${ignition_systemd_unit.kubelet.id}", - "${ignition_systemd_unit.bootkube.id}", - "${ignition_systemd_unit.tectonic.id}", + "${data.ignition_systemd_unit.etcd-member.id}", + "${data.ignition_systemd_unit.docker.id}", + "${data.ignition_systemd_unit.locksmithd.id}", + "${data.ignition_systemd_unit.kubelet.id}", + "${data.ignition_systemd_unit.bootkube.id}", + "${data.ignition_systemd_unit.tectonic.id}", ] } -resource "ignition_file" "resolv_conf" { +data "ignition_file" "resolv_conf" { path = "/etc/resolv.conf" mode = 0644 uid = 0 @@ -34,12 +34,12 @@ resource "ignition_file" "resolv_conf" { } } -resource "ignition_user" "core" { +data "ignition_user" "core" { name = "core" ssh_authorized_keys = ["${var.core_public_keys}"] } -resource "ignition_file" "hostname" { +data "ignition_file" "hostname" { count = "${var.instance_count}" path = "/etc/hostname" mode = 0644 @@ -51,7 +51,7 @@ resource "ignition_file" "hostname" { } } -resource "ignition_systemd_unit" "docker" { +data "ignition_systemd_unit" "docker" { name = "docker.service" enable = true @@ -63,7 +63,7 @@ resource "ignition_systemd_unit" "docker" { ] } -resource "ignition_systemd_unit" "locksmithd" { +data "ignition_systemd_unit" "locksmithd" { name = "locksmithd.service" dropin = [ @@ -84,7 +84,7 @@ data "template_file" "kubelet" { } } -resource "ignition_systemd_unit" "kubelet" { +data "ignition_systemd_unit" "kubelet" { name = "kubelet.service" enable = true content = "${data.template_file.kubelet.rendered}" @@ -99,7 +99,7 @@ data "template_file" "etcd-member" { } } -resource "ignition_systemd_unit" "etcd-member" { +data "ignition_systemd_unit" "etcd-member" { name = "etcd-member.service" enable = true @@ -111,7 +111,7 @@ resource "ignition_systemd_unit" "etcd-member" { ] } -resource "ignition_file" "kubeconfig" { +data "ignition_file" "kubeconfig" { filesystem = "root" path = "/etc/kubernetes/kubeconfig" mode = "420" @@ -121,7 +121,7 @@ resource "ignition_file" "kubeconfig" { } } -resource "ignition_file" "kubelet-env" { +data "ignition_file" "kubelet-env" { filesystem = "root" path = "/etc/kubernetes/kubelet.env" mode = "420" @@ -134,7 +134,7 @@ EOF } } -resource "ignition_file" "max-user-watches" { +data "ignition_file" "max-user-watches" { filesystem = "root" path = "/etc/sysctl.d/max-user-watches.conf" mode = "420" @@ -144,12 +144,12 @@ resource "ignition_file" "max-user-watches" { } } -resource "ignition_systemd_unit" "bootkube" { +data "ignition_systemd_unit" "bootkube" { name = "bootkube.service" content = "${var.bootkube_service}" } -resource "ignition_systemd_unit" "tectonic" { +data "ignition_systemd_unit" "tectonic" { name = "tectonic.service" content = "${var.tectonic_service}" } diff --git a/modules/openstack/nodes/output.tf b/modules/openstack/nodes/output.tf index 9d910077c8..60e6762b29 100644 --- a/modules/openstack/nodes/output.tf +++ b/modules/openstack/nodes/output.tf @@ -1,5 +1,5 @@ output "user_data" { - value = ["${ignition_config.node.*.rendered}"] + value = ["${data.ignition_config.node.*.rendered}"] } output "secgroup_name" { diff --git a/modules/openstack/secrets/secrets.tf b/modules/openstack/secrets/secrets.tf index 461102a923..42818dc76d 100644 --- a/modules/openstack/secrets/secrets.tf +++ b/modules/openstack/secrets/secrets.tf @@ -17,7 +17,7 @@ resource "null_resource" "export" { } } -resource "ignition_user" "core" { +data "ignition_user" "core" { name = "core" ssh_authorized_keys = [ From c40b6bb696d6aff6f56c94622bf04d47c2c75bee Mon Sep 17 00:00:00 2001 From: Alex Somesan Date: Tue, 25 Apr 2017 00:21:58 +0200 Subject: [PATCH 2/7] config.tf: bump required TerraForm version to v0.9.4 --- config.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.tf b/config.tf index 82b3be366a..d82bc6b8d1 100644 --- a/config.tf +++ b/config.tf @@ -8,7 +8,7 @@ EOF } terraform { - required_version = "= 0.8.8" + required_version = ">= 0.9.4" } variable "tectonic_container_images" { From 05b3158f89eb495d2f2c5af2af94d03a5198ccdb Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Wed, 26 Apr 2017 17:37:43 -0700 Subject: [PATCH 3/7] installer/server/terraform/plugins/aws: bump AWS provider to v0.9.4 --- installer/server/terraform/plugin.go | 2 +- .../terraform/plugins/aws/auth_helpers.go | 4 +- .../plugins/aws/auth_helpers_test.go | 231 +++--- .../terraform/plugins/aws/autoscaling_tags.go | 24 +- ...nt_distribution_configuration_structure.go | 8 +- ...stribution_configuration_structure_test.go | 12 +- .../server/terraform/plugins/aws/config.go | 62 +- .../terraform/plugins/aws/config_test.go | 118 ++++ .../plugins/aws/data_source_aws_ami.go | 16 +- .../plugins/aws/data_source_aws_ami_ids.go | 111 +++ .../aws/data_source_aws_ami_ids_test.go | 128 ++++ .../aws/data_source_aws_availability_zones.go | 6 +- ...data_source_aws_availability_zones_test.go | 13 +- .../aws/data_source_aws_caller_identity.go | 30 +- .../data_source_aws_caller_identity_test.go | 8 + .../data_source_aws_cloudformation_stack.go | 5 + .../aws/data_source_aws_db_instance.go | 30 + .../aws/data_source_aws_db_instance_test.go | 19 + .../aws/data_source_aws_ebs_snapshot.go | 15 +- .../aws/data_source_aws_ebs_snapshot_ids.go | 77 ++ .../data_source_aws_ebs_snapshot_ids_test.go | 131 ++++ .../aws/data_source_aws_ebs_snapshot_test.go | 2 +- .../data_source_aws_ecs_task_definition.go | 2 +- ...ata_source_aws_ecs_task_definition_test.go | 4 +- .../plugins/aws/data_source_aws_iam_role.go | 67 ++ .../aws/data_source_aws_iam_role_test.go | 59 ++ ..._source_aws_iam_server_certificate_test.go | 22 +- .../aws/data_source_aws_instance_test.go | 28 +- .../aws/data_source_aws_kinesis_stream.go | 95 +++ .../data_source_aws_kinesis_stream_test.go | 94 +++ .../plugins/aws/data_source_aws_kms_alias.go | 62 ++ .../aws/data_source_aws_kms_alias_test.go | 77 ++ .../aws/data_source_aws_route53_zone.go | 2 +- .../aws/data_source_aws_route53_zone_test.go | 141 ++-- .../aws/data_source_aws_route_table.go | 16 + .../aws/data_source_aws_route_table_test.go | 4 +- .../plugins/aws/data_source_aws_subnet.go | 67 +- .../plugins/aws/data_source_aws_subnet_ids.go | 68 ++ .../aws/data_source_aws_subnet_ids_test.go | 132 ++++ .../aws/data_source_aws_subnet_test.go | 196 +++++- .../plugins/aws/data_source_aws_vpc.go | 27 +- .../plugins/aws/data_source_aws_vpc_test.go | 78 ++- .../plugins/aws/diff_suppress_funcs.go | 33 + .../plugins/aws/diff_suppress_funcs_test.go | 31 + .../terraform/plugins/aws/ec2_filters.go | 4 +- .../import_aws_api_gateway_usage_plan_test.go | 30 + .../aws/import_aws_cloudfront_distribution.go | 4 + ...import_aws_cloudfront_distribution_test.go | 7 +- ...import_aws_cloudwatch_metric_alarm_test.go | 8 +- .../import_aws_codecommit_repository_test.go | 29 + .../import_aws_cognito_identity_pool_test.go | 30 + .../aws/import_aws_customer_gateway_test.go | 5 +- .../aws/import_aws_dynamodb_table_test.go | 4 +- .../aws/import_aws_efs_file_system_test.go | 4 +- ...rt_aws_elasticache_parameter_group_test.go | 5 +- .../aws/import_aws_glacier_vault_test.go | 4 +- .../aws/import_aws_iam_account_alias_test.go | 31 + .../plugins/aws/import_aws_iam_group_test.go | 8 +- .../import_aws_iam_server_certificate_test.go | 34 + .../aws/import_aws_network_acl_test.go | 4 +- ...mport_aws_redshift_parameter_group_test.go | 8 +- ...import_aws_redshift_security_group_test.go | 8 +- .../plugins/aws/import_aws_route_table.go | 1 + .../aws/import_aws_route_table_test.go | 8 +- .../plugins/aws/import_aws_security_group.go | 62 +- .../aws/import_aws_security_group_test.go | 96 ++- ...ort_aws_spot_datafeed_subscription_test.go | 6 +- .../aws/import_aws_vpn_connection_test.go | 4 +- .../plugins/aws/network_acl_entry.go | 35 +- .../server/terraform/plugins/aws/provider.go | 54 +- .../terraform/plugins/aws/resource_aws_alb.go | 74 +- .../aws/resource_aws_alb_listener_rule.go | 84 ++- .../resource_aws_alb_listener_rule_test.go | 431 ++++++++++++ .../aws/resource_aws_alb_target_group.go | 64 +- ...esource_aws_alb_target_group_attachment.go | 52 +- ...ce_aws_alb_target_group_attachment_test.go | 115 ++- .../aws/resource_aws_alb_target_group_test.go | 67 ++ .../plugins/aws/resource_aws_alb_test.go | 351 +++++++++- .../terraform/plugins/aws/resource_aws_ami.go | 100 ++- .../resource_aws_ami_from_instance_test.go | 53 +- .../aws/resource_aws_ami_launch_permission.go | 10 + ...resource_aws_ami_launch_permission_test.go | 76 +- .../aws/resource_aws_api_gateway_api_key.go | 19 +- .../resource_aws_api_gateway_api_key_test.go | 13 + .../resource_aws_api_gateway_deployment.go | 25 +- .../resource_aws_api_gateway_domain_name.go | 78 ++- .../resource_aws_api_gateway_integration.go | 154 +++- ...source_aws_api_gateway_integration_test.go | 180 +++-- ...esource_aws_api_gateway_method_settings.go | 248 +++++++ ...ce_aws_api_gateway_method_settings_test.go | 265 +++++++ .../resource_aws_api_gateway_method_test.go | 50 +- .../aws/resource_aws_api_gateway_rest_api.go | 2 +- .../aws/resource_aws_api_gateway_stage.go | 342 +++++++++ .../resource_aws_api_gateway_stage_test.go | 196 ++++++ .../resource_aws_api_gateway_usage_plan.go | 499 +++++++++++++ ...resource_aws_api_gateway_usage_plan_key.go | 112 +++ ...rce_aws_api_gateway_usage_plan_key_test.go | 232 ++++++ ...esource_aws_api_gateway_usage_plan_test.go | 557 +++++++++++++++ .../aws/resource_aws_appautoscaling_target.go | 18 +- ...resource_aws_appautoscaling_target_test.go | 338 ++++++++- .../resource_aws_autoscaling_attachment.go | 103 ++- ...esource_aws_autoscaling_attachment_test.go | 239 ++++++- .../aws/resource_aws_autoscaling_group.go | 87 ++- .../resource_aws_autoscaling_group_test.go | 103 ++- ...rce_aws_autoscaling_lifecycle_hook_test.go | 8 +- .../aws/resource_aws_autoscaling_schedule.go | 18 +- .../resource_aws_autoscaling_schedule_test.go | 43 +- .../aws/resource_aws_cloudformation_stack.go | 38 +- .../resource_aws_cloudformation_stack_test.go | 20 +- .../resource_aws_cloudfront_distribution.go | 4 +- .../aws/resource_aws_cloudwatch_log_group.go | 30 +- .../resource_aws_cloudwatch_log_group_test.go | 50 +- ...e_aws_cloudwatch_log_metric_filter_test.go | 42 +- .../aws/resource_aws_cloudwatch_log_stream.go | 4 +- ...cloudwatch_log_subscription_filter_test.go | 5 +- .../resource_aws_cloudwatch_metric_alarm.go | 31 +- ...rce_aws_cloudwatch_metric_alarm_migrate.go | 33 + ...ws_cloudwatch_metric_alarm_migrate_test.go | 41 ++ ...source_aws_cloudwatch_metric_alarm_test.go | 166 ++++- .../aws/resource_aws_codebuild_project.go | 23 +- .../resource_aws_codebuild_project_migrate.go | 36 + ...urce_aws_codebuild_project_migrate_test.go | 53 ++ .../resource_aws_codebuild_project_test.go | 141 +++- .../aws/resource_aws_codecommit_repository.go | 19 +- ...resource_aws_codecommit_repository_test.go | 12 +- .../aws/resource_aws_cognito_identity_pool.go | 238 +++++++ ...resource_aws_cognito_identity_pool_test.go | 371 ++++++++++ .../resource_aws_config_config_rule_test.go | 10 +- ...nfig_configuration_recorder_status_test.go | 6 +- ..._aws_config_configuration_recorder_test.go | 6 +- ...source_aws_config_delivery_channel_test.go | 6 +- .../plugins/aws/resource_aws_config_test.go | 44 ++ .../aws/resource_aws_customer_gateway.go | 56 +- .../aws/resource_aws_customer_gateway_test.go | 129 +++- .../plugins/aws/resource_aws_db_instance.go | 53 +- .../aws/resource_aws_db_instance_test.go | 307 +++++--- .../aws/resource_aws_db_option_group.go | 55 +- .../aws/resource_aws_db_option_group_test.go | 125 +++- .../aws/resource_aws_db_parameter_group.go | 25 +- .../resource_aws_db_parameter_group_test.go | 62 ++ .../aws/resource_aws_db_subnet_group.go | 42 +- .../aws/resource_aws_db_subnet_group_test.go | 116 ++- .../aws/resource_aws_default_network_acl.go | 12 +- .../resource_aws_default_network_acl_test.go | 74 +- .../aws/resource_aws_default_route_table.go | 67 +- .../resource_aws_default_route_table_test.go | 8 +- ...esource_aws_directory_service_directory.go | 7 +- .../plugins/aws/resource_aws_dms_endpoint.go | 40 +- .../aws/resource_aws_dms_endpoint_test.go | 39 +- .../resource_aws_dms_replication_instance.go | 133 ++-- ...ource_aws_dms_replication_instance_test.go | 63 +- ...e_aws_dms_replication_subnet_group_test.go | 22 - .../aws/resource_aws_dms_replication_task.go | 202 +++--- .../resource_aws_dms_replication_task_test.go | 85 +-- .../aws/resource_aws_dynamodb_table.go | 19 +- .../resource_aws_dynamodb_table_migrate.go | 70 ++ .../aws/resource_aws_dynamodb_table_test.go | 519 ++++++++++---- .../plugins/aws/resource_aws_ecs_service.go | 21 +- .../aws/resource_aws_ecs_service_test.go | 182 +++-- .../aws/resource_aws_ecs_task_definition.go | 12 + .../resource_aws_ecs_task_definition_test.go | 344 ++++++--- .../aws/resource_aws_efs_file_system_test.go | 56 +- .../aws/resource_aws_eip_association_test.go | 7 +- ...stic_beanstalk_application_version_test.go | 6 +- ...ource_aws_elastic_beanstalk_environment.go | 83 ++- ..._aws_elastic_beanstalk_environment_test.go | 296 ++++---- ...ce_aws_elastic_transcoder_pipeline_test.go | 60 +- .../resource_aws_elastic_transcoder_preset.go | 1 + .../aws/resource_aws_elasticache_cluster.go | 4 +- ...ce_aws_elasticache_parameter_group_test.go | 46 +- ..._aws_elasticache_replication_group_test.go | 11 +- .../aws/resource_aws_elasticsearch_domain.go | 1 + ...ce_aws_elasticsearch_domain_policy_test.go | 7 + .../resource_aws_elasticsearch_domain_test.go | 15 +- .../terraform/plugins/aws/resource_aws_elb.go | 27 +- .../plugins/aws/resource_aws_elb_test.go | 100 ++- .../plugins/aws/resource_aws_emr_cluster.go | 41 +- .../aws/resource_aws_emr_cluster_test.go | 534 +++++++++++++- .../plugins/aws/resource_aws_flow_log_test.go | 4 +- .../aws/resource_aws_glacier_vault_test.go | 40 +- .../aws/resource_aws_iam_account_alias.go | 94 +++ .../resource_aws_iam_account_alias_test.go | 91 +++ .../aws/resource_aws_iam_group_policy.go | 21 +- .../aws/resource_aws_iam_group_policy_test.go | 157 ++++- .../aws/resource_aws_iam_group_test.go | 48 +- .../aws/resource_aws_iam_instance_profile.go | 62 +- .../resource_aws_iam_instance_profile_test.go | 58 ++ ...esource_aws_iam_openid_connect_provider.go | 141 ++++ ...ce_aws_iam_openid_connect_provider_test.go | 187 +++++ ...resource_aws_iam_policy_attachment_test.go | 46 +- .../aws/resource_aws_iam_role_policy.go | 43 +- ...rce_aws_iam_role_policy_attachment_test.go | 227 +++--- .../aws/resource_aws_iam_role_policy_test.go | 121 ++++ .../plugins/aws/resource_aws_iam_role_test.go | 2 +- .../aws/resource_aws_iam_saml_provider.go | 7 + .../resource_aws_iam_server_certificate.go | 27 +- ...esource_aws_iam_server_certificate_test.go | 21 +- ...esource_aws_iam_user_login_profile_test.go | 3 +- .../aws/resource_aws_iam_user_policy.go | 21 +- .../aws/resource_aws_iam_user_policy_test.go | 130 +++- ..._aws_inspector_assessment_template_test.go | 31 +- .../plugins/aws/resource_aws_instance.go | 347 +++++++-- .../aws/resource_aws_instance_migrate.go | 4 +- .../plugins/aws/resource_aws_instance_test.go | 376 +++++++++- ...ce_aws_kinesis_firehose_delivery_stream.go | 5 +- ...s_kinesis_firehose_delivery_stream_test.go | 8 +- .../aws/resource_aws_kinesis_stream.go | 45 +- .../plugins/aws/resource_aws_kms_alias.go | 9 +- .../aws/resource_aws_kms_alias_test.go | 57 +- .../plugins/aws/resource_aws_kms_key.go | 42 ++ .../plugins/aws/resource_aws_kms_key_test.go | 78 +++ .../aws/resource_aws_lambda_alias_test.go | 15 +- .../aws/resource_aws_lambda_function.go | 74 +- .../aws/resource_aws_lambda_function_test.go | 235 ++++++- .../aws/resource_aws_lambda_permission.go | 7 +- .../resource_aws_lambda_permission_test.go | 60 ++ .../aws/resource_aws_launch_configuration.go | 2 +- .../resource_aws_lb_ssl_negotiation_policy.go | 4 + ...urce_aws_lb_ssl_negotiation_policy_test.go | 66 +- .../aws/resource_aws_lightsail_static_ip.go | 98 +++ ...urce_aws_lightsail_static_ip_attachment.go | 96 +++ ...aws_lightsail_static_ip_attachment_test.go | 163 +++++ .../resource_aws_lightsail_static_ip_test.go | 138 ++++ .../resource_aws_load_balancer_policy_test.go | 200 +++--- .../plugins/aws/resource_aws_network_acl.go | 109 +-- .../aws/resource_aws_network_acl_rule.go | 67 +- .../aws/resource_aws_network_acl_rule_test.go | 190 ++++- .../aws/resource_aws_network_acl_test.go | 207 ++++-- .../aws/resource_aws_network_interface.go | 61 ++ ...source_aws_network_interface_attachment.go | 166 +++++ ...ce_aws_network_interface_attacment_test.go | 92 +++ .../aws/resource_aws_opsworks_application.go | 70 +- .../resource_aws_opsworks_application_test.go | 61 +- ...resource_aws_opsworks_custom_layer_test.go | 14 +- .../resource_aws_opsworks_ganglia_layer.go | 6 +- .../resource_aws_opsworks_haproxy_layer.go | 12 +- .../aws/resource_aws_opsworks_instance.go | 10 +- .../resource_aws_opsworks_instance_test.go | 93 ++- .../resource_aws_opsworks_java_app_layer.go | 10 +- .../resource_aws_opsworks_memcached_layer.go | 2 +- .../aws/resource_aws_opsworks_mysql_layer.go | 4 +- .../resource_aws_opsworks_nodejs_app_layer.go | 2 +- .../aws/resource_aws_opsworks_permission.go | 12 +- .../resource_aws_opsworks_permission_test.go | 8 +- .../resource_aws_opsworks_rails_app_layer.go | 12 +- ...ource_aws_opsworks_rails_app_layer_test.go | 4 +- .../resource_aws_opsworks_rds_db_instance.go | 10 +- ...ource_aws_opsworks_rds_db_instance_test.go | 10 +- .../aws/resource_aws_opsworks_stack.go | 184 +++-- .../aws/resource_aws_opsworks_stack_test.go | 327 ++++++++- .../aws/resource_aws_opsworks_user_profile.go | 11 +- ...resource_aws_opsworks_user_profile_test.go | 45 +- .../plugins/aws/resource_aws_rds_cluster.go | 92 ++- .../aws/resource_aws_rds_cluster_instance.go | 65 +- .../resource_aws_rds_cluster_instance_test.go | 160 ++++- ...esource_aws_rds_cluster_parameter_group.go | 24 +- ...ce_aws_rds_cluster_parameter_group_test.go | 65 +- .../aws/resource_aws_rds_cluster_test.go | 205 ++++++ .../aws/resource_aws_redshift_cluster.go | 2 +- .../aws/resource_aws_redshift_cluster_test.go | 108 +++ ...ource_aws_redshift_parameter_group_test.go | 66 +- ...source_aws_redshift_security_group_test.go | 343 ++++----- .../plugins/aws/resource_aws_route.go | 142 +++- .../aws/resource_aws_route53_record.go | 58 +- .../plugins/aws/resource_aws_route53_zone.go | 2 +- ...ource_aws_route53_zone_association_test.go | 1 + .../aws/resource_aws_route53_zone_test.go | 12 +- .../plugins/aws/resource_aws_route_table.go | 117 +++- .../aws/resource_aws_route_table_test.go | 94 ++- .../plugins/aws/resource_aws_route_test.go | 74 +- .../plugins/aws/resource_aws_s3_bucket.go | 27 +- .../aws/resource_aws_s3_bucket_object.go | 4 +- .../aws/resource_aws_s3_bucket_test.go | 46 ++ .../aws/resource_aws_security_group.go | 262 ++++--- .../aws/resource_aws_security_group_rule.go | 65 +- .../resource_aws_security_group_rule_test.go | 133 +++- .../aws/resource_aws_security_group_test.go | 310 ++++++-- ...resource_aws_ses_configuration_set_test.go | 12 +- .../aws/resource_aws_ses_domain_identity.go | 99 +++ .../resource_aws_ses_domain_identity_test.go | 100 +++ ...resource_aws_ses_event_destination_test.go | 12 +- .../aws/resource_aws_ses_receipt_rule.go | 14 +- .../aws/resource_aws_ses_receipt_rule_test.go | 46 +- ...esource_aws_sns_topic_subscription_test.go | 142 ++++ ...rce_aws_spot_datafeed_subscription_test.go | 22 +- .../aws/resource_aws_spot_fleet_request.go | 161 ++--- .../resource_aws_spot_fleet_request_test.go | 439 +++++++++--- .../aws/resource_aws_spot_instance_request.go | 23 + .../plugins/aws/resource_aws_ssm_document.go | 82 ++- .../aws/resource_aws_ssm_document_test.go | 93 +++ .../plugins/aws/resource_aws_subnet.go | 120 +++- .../aws/resource_aws_subnet_migrate.go | 33 + .../aws/resource_aws_subnet_migrate_test.go | 41 ++ .../plugins/aws/resource_aws_subnet_test.go | 95 ++- .../aws/resource_aws_volume_attachment.go | 19 + .../terraform/plugins/aws/resource_aws_vpc.go | 125 +++- .../aws/resource_aws_vpc_dhcp_options.go | 13 +- .../aws/resource_aws_vpc_dhcp_options_test.go | 40 ++ .../plugins/aws/resource_aws_vpc_migrate.go | 33 + .../aws/resource_aws_vpc_migrate_test.go | 49 ++ .../plugins/aws/resource_aws_vpc_test.go | 36 +- .../aws/resource_aws_vpn_connection.go | 5 + .../aws/resource_aws_vpn_connection_test.go | 172 +++-- .../plugins/aws/resource_aws_vpn_gateway.go | 4 +- .../aws/resource_aws_waf_byte_match_set.go | 89 +-- .../resource_aws_waf_byte_match_set_test.go | 60 +- .../plugins/aws/resource_aws_waf_ipset.go | 147 ++-- .../aws/resource_aws_waf_ipset_test.go | 227 +++++- .../plugins/aws/resource_aws_waf_rule.go | 96 ++- .../plugins/aws/resource_aws_waf_rule_test.go | 59 +- .../resource_aws_waf_size_constraint_set.go | 88 +-- ...source_aws_waf_size_constraint_set_test.go | 58 +- ...esource_aws_waf_sql_injection_match_set.go | 84 +-- ...ce_aws_waf_sql_injection_match_set_test.go | 56 +- .../plugins/aws/resource_aws_waf_web_acl.go | 105 ++- .../aws/resource_aws_waf_web_acl_test.go | 59 +- .../aws/resource_aws_waf_xss_match_set.go | 83 +-- .../resource_aws_waf_xss_match_set_test.go | 56 +- .../aws/resource_vpn_connection_route_test.go | 90 +-- .../server/terraform/plugins/aws/sort.go | 53 ++ .../server/terraform/plugins/aws/structure.go | 184 +++++ .../server/terraform/plugins/aws/tags.go | 57 ++ .../terraform/plugins/aws/tagsGeneric.go | 69 ++ .../terraform/plugins/aws/tagsGeneric_test.go | 73 ++ .../server/terraform/plugins/aws/tagsKMS.go | 115 +++ .../terraform/plugins/aws/tagsKMS_test.go | 105 +++ .../terraform/plugins/aws/tagsLambda.go | 50 ++ .../aws/test-fixtures/lambda_confirm_sns.zip | Bin 0 -> 565 bytes .../server/terraform/plugins/aws/utils.go | 16 + .../terraform/plugins/aws/utils_test.go | 38 + .../terraform/plugins/aws/validators.go | 395 ++++++++++- .../terraform/plugins/aws/validators_test.go | 663 +++++++++++++++++- .../plugins/aws/waf_token_handlers.go | 49 ++ 333 files changed, 22410 insertions(+), 4700 deletions(-) create mode 100644 installer/server/terraform/plugins/aws/config_test.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_ami_ids.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_ami_ids_test.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids_test.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_iam_role.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_iam_role_test.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_kinesis_stream.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_kinesis_stream_test.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_kms_alias.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_kms_alias_test.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_subnet_ids.go create mode 100644 installer/server/terraform/plugins/aws/data_source_aws_subnet_ids_test.go create mode 100644 installer/server/terraform/plugins/aws/diff_suppress_funcs_test.go create mode 100644 installer/server/terraform/plugins/aws/import_aws_api_gateway_usage_plan_test.go create mode 100644 installer/server/terraform/plugins/aws/import_aws_codecommit_repository_test.go create mode 100644 installer/server/terraform/plugins/aws/import_aws_cognito_identity_pool_test.go create mode 100644 installer/server/terraform/plugins/aws/import_aws_iam_account_alias_test.go create mode 100644 installer/server/terraform/plugins/aws/import_aws_iam_server_certificate_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_stage.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_stage_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_cloudwatch_metric_alarm_migrate.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_cloudwatch_metric_alarm_migrate_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_codebuild_project_migrate.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_codebuild_project_migrate_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_cognito_identity_pool.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_cognito_identity_pool_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_config_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_iam_account_alias.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_iam_account_alias_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_lightsail_static_ip.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_lightsail_static_ip_attachment.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_lightsail_static_ip_attachment_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_lightsail_static_ip_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_network_interface_attachment.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_network_interface_attacment_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_subnet_migrate.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_subnet_migrate_test.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_vpc_migrate.go create mode 100644 installer/server/terraform/plugins/aws/resource_aws_vpc_migrate_test.go create mode 100644 installer/server/terraform/plugins/aws/sort.go create mode 100644 installer/server/terraform/plugins/aws/tagsGeneric.go create mode 100644 installer/server/terraform/plugins/aws/tagsGeneric_test.go create mode 100644 installer/server/terraform/plugins/aws/tagsKMS.go create mode 100644 installer/server/terraform/plugins/aws/tagsKMS_test.go create mode 100644 installer/server/terraform/plugins/aws/tagsLambda.go create mode 100644 installer/server/terraform/plugins/aws/test-fixtures/lambda_confirm_sns.zip create mode 100644 installer/server/terraform/plugins/aws/waf_token_handlers.go diff --git a/installer/server/terraform/plugin.go b/installer/server/terraform/plugin.go index ded9056169..e12a55978a 100644 --- a/installer/server/terraform/plugin.go +++ b/installer/server/terraform/plugin.go @@ -21,7 +21,7 @@ var plugins = map[string]*plugin.ServeOpts{ // https://github.com/hashicorp/terraform/pull/13652 (7a6759e) "template": {ProviderFunc: template.Provider}, - // https://github.com/hashicorp/terraform/pull/13574 (9245819) + // https://github.com/hashicorp/terraform/pull/13574 (82bda74) "aws": {ProviderFunc: aws.Provider}, // https://github.com/coreos/terraform-provider-matchbox (glide) diff --git a/installer/server/terraform/plugins/aws/auth_helpers.go b/installer/server/terraform/plugins/aws/auth_helpers.go index 8b1a42f14f..1a73c6e8b5 100644 --- a/installer/server/terraform/plugins/aws/auth_helpers.go +++ b/installer/server/terraform/plugins/aws/auth_helpers.go @@ -30,7 +30,7 @@ func GetAccountInfo(iamconn *iam.IAM, stsconn *sts.STS, authProviderName string) setOptionalEndpoint(cfg) sess, err := session.NewSession(cfg) if err != nil { - return "", "", errwrap.Wrapf("Error creating AWS session: %s", err) + return "", "", errwrap.Wrapf("Error creating AWS session: {{err}}", err) } metadataClient := ec2metadata.New(sess) @@ -134,7 +134,7 @@ func GetCredentials(c *Config) (*awsCredentials.Credentials, error) { if usedEndpoint == "" { usedEndpoint = "default location" } - log.Printf("[WARN] Ignoring AWS metadata API endpoint at %s "+ + log.Printf("[INFO] Ignoring AWS metadata API endpoint at %s "+ "as it doesn't return any instance-id", usedEndpoint) } } diff --git a/installer/server/terraform/plugins/aws/auth_helpers_test.go b/installer/server/terraform/plugins/aws/auth_helpers_test.go index fb7dd68849..25120c43bd 100644 --- a/installer/server/terraform/plugins/aws/auth_helpers_test.go +++ b/installer/server/terraform/plugins/aws/auth_helpers_test.go @@ -1,7 +1,6 @@ package aws import ( - "bytes" "encoding/json" "fmt" "io/ioutil" @@ -10,13 +9,9 @@ import ( "net/http/httptest" "os" "testing" - "time" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - awsCredentials "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/sts" ) @@ -28,9 +23,14 @@ func TestAWSGetAccountInfo_shouldBeValid_fromEC2Role(t *testing.T) { awsTs := awsEnv(t) defer awsTs() - iamEndpoints := []*iamEndpoint{} - ts, iamConn, stsConn := getMockedAwsIamStsApi(iamEndpoints) - defer ts() + closeEmpty, emptySess, err := getMockedAwsApiSession("zero", []*awsMockEndpoint{}) + defer closeEmpty() + if err != nil { + t.Fatal(err) + } + + iamConn := iam.New(emptySess) + stsConn := sts.New(emptySess) part, id, err := GetAccountInfo(iamConn, stsConn, ec2rolecreds.ProviderName) if err != nil { @@ -55,14 +55,24 @@ func TestAWSGetAccountInfo_shouldBeValid_EC2RoleHasPriority(t *testing.T) { awsTs := awsEnv(t) defer awsTs() - iamEndpoints := []*iamEndpoint{ + iamEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, - Response: &iamResponse{200, iamResponse_GetUser_valid, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, + Response: &awsMockResponse{200, iamResponse_GetUser_valid, "text/xml"}, }, } - ts, iamConn, stsConn := getMockedAwsIamStsApi(iamEndpoints) - defer ts() + closeIam, iamSess, err := getMockedAwsApiSession("IAM", iamEndpoints) + defer closeIam() + if err != nil { + t.Fatal(err) + } + iamConn := iam.New(iamSess) + closeSts, stsSess, err := getMockedAwsApiSession("STS", []*awsMockEndpoint{}) + defer closeSts() + if err != nil { + t.Fatal(err) + } + stsConn := sts.New(stsSess) part, id, err := GetAccountInfo(iamConn, stsConn, ec2rolecreds.ProviderName) if err != nil { @@ -81,15 +91,26 @@ func TestAWSGetAccountInfo_shouldBeValid_EC2RoleHasPriority(t *testing.T) { } func TestAWSGetAccountInfo_shouldBeValid_fromIamUser(t *testing.T) { - iamEndpoints := []*iamEndpoint{ + iamEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, - Response: &iamResponse{200, iamResponse_GetUser_valid, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, + Response: &awsMockResponse{200, iamResponse_GetUser_valid, "text/xml"}, }, } - ts, iamConn, stsConn := getMockedAwsIamStsApi(iamEndpoints) - defer ts() + closeIam, iamSess, err := getMockedAwsApiSession("IAM", iamEndpoints) + defer closeIam() + if err != nil { + t.Fatal(err) + } + closeSts, stsSess, err := getMockedAwsApiSession("STS", []*awsMockEndpoint{}) + defer closeSts() + if err != nil { + t.Fatal(err) + } + + iamConn := iam.New(iamSess) + stsConn := sts.New(stsSess) part, id, err := GetAccountInfo(iamConn, stsConn, "") if err != nil { @@ -108,18 +129,32 @@ func TestAWSGetAccountInfo_shouldBeValid_fromIamUser(t *testing.T) { } func TestAWSGetAccountInfo_shouldBeValid_fromGetCallerIdentity(t *testing.T) { - iamEndpoints := []*iamEndpoint{ + iamEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, - Response: &iamResponse{403, iamResponse_GetUser_unauthorized, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, + Response: &awsMockResponse{403, iamResponse_GetUser_unauthorized, "text/xml"}, }, + } + closeIam, iamSess, err := getMockedAwsApiSession("IAM", iamEndpoints) + defer closeIam() + if err != nil { + t.Fatal(err) + } + + stsEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=GetCallerIdentity&Version=2011-06-15"}, - Response: &iamResponse{200, stsResponse_GetCallerIdentity_valid, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetCallerIdentity&Version=2011-06-15"}, + Response: &awsMockResponse{200, stsResponse_GetCallerIdentity_valid, "text/xml"}, }, } - ts, iamConn, stsConn := getMockedAwsIamStsApi(iamEndpoints) - defer ts() + closeSts, stsSess, err := getMockedAwsApiSession("STS", stsEndpoints) + defer closeSts() + if err != nil { + t.Fatal(err) + } + + iamConn := iam.New(iamSess) + stsConn := sts.New(stsSess) part, id, err := GetAccountInfo(iamConn, stsConn, "") if err != nil { @@ -138,22 +173,36 @@ func TestAWSGetAccountInfo_shouldBeValid_fromGetCallerIdentity(t *testing.T) { } func TestAWSGetAccountInfo_shouldBeValid_fromIamListRoles(t *testing.T) { - iamEndpoints := []*iamEndpoint{ + iamEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, - Response: &iamResponse{403, iamResponse_GetUser_unauthorized, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, + Response: &awsMockResponse{403, iamResponse_GetUser_unauthorized, "text/xml"}, }, { - Request: &iamRequest{"POST", "/", "Action=GetCallerIdentity&Version=2011-06-15"}, - Response: &iamResponse{403, stsResponse_GetCallerIdentity_unauthorized, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=ListRoles&MaxItems=1&Version=2010-05-08"}, + Response: &awsMockResponse{200, iamResponse_ListRoles_valid, "text/xml"}, }, + } + closeIam, iamSess, err := getMockedAwsApiSession("IAM", iamEndpoints) + defer closeIam() + if err != nil { + t.Fatal(err) + } + + stsEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=ListRoles&MaxItems=1&Version=2010-05-08"}, - Response: &iamResponse{200, iamResponse_ListRoles_valid, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetCallerIdentity&Version=2011-06-15"}, + Response: &awsMockResponse{403, stsResponse_GetCallerIdentity_unauthorized, "text/xml"}, }, } - ts, iamConn, stsConn := getMockedAwsIamStsApi(iamEndpoints) - defer ts() + closeSts, stsSess, err := getMockedAwsApiSession("STS", stsEndpoints) + defer closeSts() + if err != nil { + t.Fatal(err) + } + + iamConn := iam.New(iamSess) + stsConn := sts.New(stsSess) part, id, err := GetAccountInfo(iamConn, stsConn, "") if err != nil { @@ -172,18 +221,30 @@ func TestAWSGetAccountInfo_shouldBeValid_fromIamListRoles(t *testing.T) { } func TestAWSGetAccountInfo_shouldBeValid_federatedRole(t *testing.T) { - iamEndpoints := []*iamEndpoint{ + iamEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, - Response: &iamResponse{400, iamResponse_GetUser_federatedFailure, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, + Response: &awsMockResponse{400, iamResponse_GetUser_federatedFailure, "text/xml"}, }, { - Request: &iamRequest{"POST", "/", "Action=ListRoles&MaxItems=1&Version=2010-05-08"}, - Response: &iamResponse{200, iamResponse_ListRoles_valid, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=ListRoles&MaxItems=1&Version=2010-05-08"}, + Response: &awsMockResponse{200, iamResponse_ListRoles_valid, "text/xml"}, }, } - ts, iamConn, stsConn := getMockedAwsIamStsApi(iamEndpoints) - defer ts() + closeIam, iamSess, err := getMockedAwsApiSession("IAM", iamEndpoints) + defer closeIam() + if err != nil { + t.Fatal(err) + } + + closeSts, stsSess, err := getMockedAwsApiSession("STS", []*awsMockEndpoint{}) + defer closeSts() + if err != nil { + t.Fatal(err) + } + + iamConn := iam.New(iamSess) + stsConn := sts.New(stsSess) part, id, err := GetAccountInfo(iamConn, stsConn, "") if err != nil { @@ -202,18 +263,30 @@ func TestAWSGetAccountInfo_shouldBeValid_federatedRole(t *testing.T) { } func TestAWSGetAccountInfo_shouldError_unauthorizedFromIam(t *testing.T) { - iamEndpoints := []*iamEndpoint{ + iamEndpoints := []*awsMockEndpoint{ { - Request: &iamRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, - Response: &iamResponse{403, iamResponse_GetUser_unauthorized, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=GetUser&Version=2010-05-08"}, + Response: &awsMockResponse{403, iamResponse_GetUser_unauthorized, "text/xml"}, }, { - Request: &iamRequest{"POST", "/", "Action=ListRoles&MaxItems=1&Version=2010-05-08"}, - Response: &iamResponse{403, iamResponse_ListRoles_unauthorized, "text/xml"}, + Request: &awsMockRequest{"POST", "/", "Action=ListRoles&MaxItems=1&Version=2010-05-08"}, + Response: &awsMockResponse{403, iamResponse_ListRoles_unauthorized, "text/xml"}, }, } - ts, iamConn, stsConn := getMockedAwsIamStsApi(iamEndpoints) - defer ts() + closeIam, iamSess, err := getMockedAwsApiSession("IAM", iamEndpoints) + defer closeIam() + if err != nil { + t.Fatal(err) + } + + closeSts, stsSess, err := getMockedAwsApiSession("STS", []*awsMockEndpoint{}) + defer closeSts() + if err != nil { + t.Fatal(err) + } + + iamConn := iam.New(iamSess) + stsConn := sts.New(stsSess) part, id, err := GetAccountInfo(iamConn, stsConn, "") if err == nil { @@ -697,51 +770,6 @@ func invalidAwsEnv(t *testing.T) func() { return ts.Close } -// getMockedAwsIamStsApi establishes a httptest server to simulate behaviour -// of a real AWS' IAM & STS server -func getMockedAwsIamStsApi(endpoints []*iamEndpoint) (func(), *iam.IAM, *sts.STS) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - buf := new(bytes.Buffer) - buf.ReadFrom(r.Body) - requestBody := buf.String() - - log.Printf("[DEBUG] Received API %q request to %q: %s", - r.Method, r.RequestURI, requestBody) - - for _, e := range endpoints { - if r.Method == e.Request.Method && r.RequestURI == e.Request.Uri && requestBody == e.Request.Body { - log.Printf("[DEBUG] Mock API responding with %d: %s", e.Response.StatusCode, e.Response.Body) - - w.WriteHeader(e.Response.StatusCode) - w.Header().Set("Content-Type", e.Response.ContentType) - w.Header().Set("X-Amzn-Requestid", "1b206dd1-f9a8-11e5-becf-051c60f11c4a") - w.Header().Set("Date", time.Now().Format(time.RFC1123)) - - fmt.Fprintln(w, e.Response.Body) - return - } - } - - w.WriteHeader(400) - return - })) - - sc := awsCredentials.NewStaticCredentials("accessKey", "secretKey", "") - - sess, err := session.NewSession(&aws.Config{ - Credentials: sc, - Region: aws.String("us-east-1"), - Endpoint: aws.String(ts.URL), - CredentialsChainVerboseErrors: aws.Bool(true), - }) - if err != nil { - panic(fmt.Sprintf("Error creating AWS Session: %s", err)) - } - iamConn := iam.New(sess) - stsConn := sts.New(sess) - return ts.Close, iamConn, stsConn -} - func getEnv() *currentEnv { // Grab any existing AWS keys and preserve. In some tests we'll unset these, so // we need to have them and restore them after @@ -790,23 +818,6 @@ const metadataApiRoutes = ` } ` -type iamEndpoint struct { - Request *iamRequest - Response *iamResponse -} - -type iamRequest struct { - Method string - Uri string - Body string -} - -type iamResponse struct { - StatusCode int - Body string - ContentType string -} - const iamResponse_GetUser_valid = ` diff --git a/installer/server/terraform/plugins/aws/autoscaling_tags.go b/installer/server/terraform/plugins/aws/autoscaling_tags.go index a86327c72d..fd9ab57638 100644 --- a/installer/server/terraform/plugins/aws/autoscaling_tags.go +++ b/installer/server/terraform/plugins/aws/autoscaling_tags.go @@ -140,7 +140,11 @@ func diffAutoscalingTags(oldTags, newTags []*autoscaling.Tag, resourceID string) func autoscalingTagsFromList(vs []interface{}, resourceID string) []*autoscaling.Tag { result := make([]*autoscaling.Tag, 0, len(vs)) for _, tag := range vs { - attr := tag.(map[string]interface{}) + attr, ok := tag.(map[string]interface{}) + if !ok { + continue + } + if t := autoscalingTagFromMap(attr, resourceID); t != nil { result = append(result, t) } @@ -152,7 +156,11 @@ func autoscalingTagsFromList(vs []interface{}, resourceID string) []*autoscaling func autoscalingTagsFromMap(m map[string]interface{}, resourceID string) []*autoscaling.Tag { result := make([]*autoscaling.Tag, 0, len(m)) for _, v := range m { - attr := v.(map[string]interface{}) + attr, ok := v.(map[string]interface{}) + if !ok { + continue + } + t := autoscalingTagFromMap(attr, resourceID) if t != nil { result = append(result, t) @@ -163,6 +171,18 @@ func autoscalingTagsFromMap(m map[string]interface{}, resourceID string) []*auto } func autoscalingTagFromMap(attr map[string]interface{}, resourceID string) *autoscaling.Tag { + if _, ok := attr["key"]; !ok { + return nil + } + + if _, ok := attr["value"]; !ok { + return nil + } + + if _, ok := attr["propagate_at_launch"]; !ok { + return nil + } + var propagate_at_launch bool if v, ok := attr["propagate_at_launch"].(bool); ok { diff --git a/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure.go b/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure.go index ccac0d9c50..489e9883c1 100644 --- a/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure.go +++ b/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure.go @@ -443,10 +443,10 @@ func expandLambdaFunctionAssociation(lf map[string]interface{}) *cloudfront.Lamb return &lfa } -func flattenLambdaFunctionAssociations(lfa *cloudfront.LambdaFunctionAssociations) []interface{} { - s := make([]interface{}, len(lfa.Items)) - for i, v := range lfa.Items { - s[i] = flattenLambdaFunctionAssociation(v) +func flattenLambdaFunctionAssociations(lfa *cloudfront.LambdaFunctionAssociations) *schema.Set { + s := schema.NewSet(lambdaFunctionAssociationHash, []interface{}{}) + for _, v := range lfa.Items { + s.Add(flattenLambdaFunctionAssociation(v)) } return s } diff --git a/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure_test.go b/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure_test.go index 14cdad322d..0092cb8d27 100644 --- a/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure_test.go +++ b/installer/server/terraform/plugins/aws/cloudfront_distribution_configuration_structure_test.go @@ -364,14 +364,8 @@ func TestCloudFrontStructure_flattenCacheBehavior(t *testing.T) { t.Fatalf("Expected out[target_origin_id] to be myS3Origin, got %v", out["target_origin_id"]) } - // the flattened lambda function associations are a slice of maps, - // where as the default cache behavior LFAs are a set. Here we double check - // that and conver the slice to a set, and use Set's Equal() method to check - // equality - var outSet *schema.Set - if outSlice, ok := out["lambda_function_association"].([]interface{}); ok { - outSet = schema.NewSet(lambdaFunctionAssociationHash, outSlice) - } else { + var outSet, ok = out["lambda_function_association"].(*schema.Set) + if !ok { t.Fatalf("out['lambda_function_association'] is not a slice as expected: %#v", out["lambda_function_association"]) } @@ -496,7 +490,7 @@ func TestCloudFrontStructure_flattenlambdaFunctionAssociations(t *testing.T) { lfa := expandLambdaFunctionAssociations(in.List()) out := flattenLambdaFunctionAssociations(lfa) - if reflect.DeepEqual(in.List(), out) != true { + if reflect.DeepEqual(in.List(), out.List()) != true { t.Fatalf("Expected out to be %v, got %v", in, out) } } diff --git a/installer/server/terraform/plugins/aws/config.go b/installer/server/terraform/plugins/aws/config.go index e3608f53c6..78fa93deb6 100644 --- a/installer/server/terraform/plugins/aws/config.go +++ b/installer/server/terraform/plugins/aws/config.go @@ -28,6 +28,7 @@ import ( "github.com/aws/aws-sdk-go/service/codecommit" "github.com/aws/aws-sdk-go/service/codedeploy" "github.com/aws/aws-sdk-go/service/codepipeline" + "github.com/aws/aws-sdk-go/service/cognitoidentity" "github.com/aws/aws-sdk-go/service/configservice" "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/aws/aws-sdk-go/service/directoryservice" @@ -97,6 +98,7 @@ type Config struct { Insecure bool SkipCredsValidation bool + SkipGetEC2Platforms bool SkipRegionValidation bool SkipRequestingAccountId bool SkipMetadataApiCheck bool @@ -110,6 +112,7 @@ type AWSClient struct { cloudwatchconn *cloudwatch.CloudWatch cloudwatchlogsconn *cloudwatchlogs.CloudWatchLogs cloudwatcheventsconn *cloudwatchevents.CloudWatchEvents + cognitoconn *cognitoidentity.CognitoIdentity configconn *configservice.ConfigService dmsconn *databasemigrationservice.DatabaseMigrationService dsconn *directoryservice.DirectoryService @@ -136,6 +139,7 @@ type AWSClient struct { r53conn *route53.Route53 partition string accountid string + supportedplatforms []string region string rdsconn *rds.RDS iamconn *iam.IAM @@ -159,6 +163,14 @@ type AWSClient struct { wafconn *waf.WAF } +func (c *AWSClient) S3() *s3.S3 { + return c.s3conn +} + +func (c *AWSClient) DynamoDB() *dynamodb.DynamoDB { + return c.dynamodbconn +} + // Client configures and returns a fully initialized AWSClient func (c *Config) Client() (interface{}, error) { // Get the auth and region. This can fail if keys/regions were not @@ -224,10 +236,7 @@ func (c *Config) Client() (interface{}, error) { return nil, errwrap.Wrapf("Error creating AWS session: {{err}}", err) } - // Removes the SDK Version handler, so we only have the provider User-Agent - // Ex: "User-Agent: APN/1.0 HashiCorp/1.0 Terraform/0.7.9-dev" - sess.Handlers.Build.Remove(request.NamedHandler{Name: "core.SDKVersionUserAgentHandler"}) - sess.Handlers.Build.PushFrontNamed(addTerraformVersionToUserAgent) + sess.Handlers.Build.PushBackNamed(addTerraformVersionToUserAgent) if extraDebug := os.Getenv("TERRAFORM_AWS_AUTHFAILURE_DEBUG"); extraDebug != "" { sess.Handlers.UnmarshalError.PushFrontNamed(debugAuthFailure) @@ -272,6 +281,19 @@ func (c *Config) Client() (interface{}, error) { return nil, authErr } + client.ec2conn = ec2.New(awsEc2Sess) + + if !c.SkipGetEC2Platforms { + supportedPlatforms, err := GetSupportedEC2Platforms(client.ec2conn) + if err != nil { + // We intentionally fail *silently* because there's a chance + // user just doesn't have ec2:DescribeAccountAttributes permissions + log.Printf("[WARN] Unable to get supported EC2 platforms: %s", err) + } else { + client.supportedplatforms = supportedPlatforms + } + } + client.acmconn = acm.New(sess) client.apigateway = apigateway.New(sess) client.appautoscalingconn = applicationautoscaling.New(sess) @@ -286,11 +308,11 @@ func (c *Config) Client() (interface{}, error) { client.codebuildconn = codebuild.New(sess) client.codedeployconn = codedeploy.New(sess) client.configconn = configservice.New(sess) + client.cognitoconn = cognitoidentity.New(sess) client.dmsconn = databasemigrationservice.New(sess) client.codepipelineconn = codepipeline.New(sess) client.dsconn = directoryservice.New(sess) client.dynamodbconn = dynamodb.New(dynamoSess) - client.ec2conn = ec2.New(awsEc2Sess) client.ecrconn = ecr.New(sess) client.ecsconn = ecs.New(sess) client.efsconn = efs.New(sess) @@ -308,7 +330,7 @@ func (c *Config) Client() (interface{}, error) { client.kmsconn = kms.New(sess) client.lambdaconn = lambda.New(sess) client.lightsailconn = lightsail.New(usEast1Sess) - client.opsworksconn = opsworks.New(usEast1Sess) + client.opsworksconn = opsworks.New(sess) client.r53conn = route53.New(usEast1Sess) client.rdsconn = rds.New(sess) client.redshiftconn = redshift.New(sess) @@ -389,6 +411,34 @@ func (c *Config) ValidateAccountId(accountId string) error { return nil } +func GetSupportedEC2Platforms(conn *ec2.EC2) ([]string, error) { + attrName := "supported-platforms" + + input := ec2.DescribeAccountAttributesInput{ + AttributeNames: []*string{aws.String(attrName)}, + } + attributes, err := conn.DescribeAccountAttributes(&input) + if err != nil { + return nil, err + } + + var platforms []string + for _, attr := range attributes.AccountAttributes { + if *attr.AttributeName == attrName { + for _, v := range attr.AttributeValues { + platforms = append(platforms, *v.AttributeValue) + } + break + } + } + + if len(platforms) == 0 { + return nil, fmt.Errorf("No EC2 platforms detected") + } + + return platforms, nil +} + // addTerraformVersionToUserAgent is a named handler that will add Terraform's // version information to requests made by the AWS SDK. var addTerraformVersionToUserAgent = request.NamedHandler{ diff --git a/installer/server/terraform/plugins/aws/config_test.go b/installer/server/terraform/plugins/aws/config_test.go new file mode 100644 index 0000000000..50b175c1ed --- /dev/null +++ b/installer/server/terraform/plugins/aws/config_test.go @@ -0,0 +1,118 @@ +package aws + +import ( + "bytes" + "fmt" + "log" + "net/http" + "net/http/httptest" + "reflect" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + awsCredentials "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/ec2" +) + +func TestGetSupportedEC2Platforms(t *testing.T) { + ec2Endpoints := []*awsMockEndpoint{ + &awsMockEndpoint{ + Request: &awsMockRequest{"POST", "/", "Action=DescribeAccountAttributes&" + + "AttributeName.1=supported-platforms&Version=2016-11-15"}, + Response: &awsMockResponse{200, test_ec2_describeAccountAttributes_response, "text/xml"}, + }, + } + closeFunc, sess, err := getMockedAwsApiSession("EC2", ec2Endpoints) + if err != nil { + t.Fatal(err) + } + defer closeFunc() + conn := ec2.New(sess) + + platforms, err := GetSupportedEC2Platforms(conn) + if err != nil { + t.Fatalf("Expected no error, received: %s", err) + } + expectedPlatforms := []string{"VPC", "EC2"} + if !reflect.DeepEqual(platforms, expectedPlatforms) { + t.Fatalf("Received platforms: %q\nExpected: %q\n", platforms, expectedPlatforms) + } +} + +// getMockedAwsApiSession establishes a httptest server to simulate behaviour +// of a real AWS API server +func getMockedAwsApiSession(svcName string, endpoints []*awsMockEndpoint) (func(), *session.Session, error) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + buf := new(bytes.Buffer) + buf.ReadFrom(r.Body) + requestBody := buf.String() + + log.Printf("[DEBUG] Received %s API %q request to %q: %s", + svcName, r.Method, r.RequestURI, requestBody) + + for _, e := range endpoints { + if r.Method == e.Request.Method && r.RequestURI == e.Request.Uri && requestBody == e.Request.Body { + log.Printf("[DEBUG] Mocked %s API responding with %d: %s", + svcName, e.Response.StatusCode, e.Response.Body) + + w.WriteHeader(e.Response.StatusCode) + w.Header().Set("Content-Type", e.Response.ContentType) + w.Header().Set("X-Amzn-Requestid", "1b206dd1-f9a8-11e5-becf-051c60f11c4a") + w.Header().Set("Date", time.Now().Format(time.RFC1123)) + + fmt.Fprintln(w, e.Response.Body) + return + } + } + + w.WriteHeader(400) + return + })) + + sc := awsCredentials.NewStaticCredentials("accessKey", "secretKey", "") + + sess, err := session.NewSession(&aws.Config{ + Credentials: sc, + Region: aws.String("us-east-1"), + Endpoint: aws.String(ts.URL), + CredentialsChainVerboseErrors: aws.Bool(true), + }) + + return ts.Close, sess, err +} + +type awsMockEndpoint struct { + Request *awsMockRequest + Response *awsMockResponse +} + +type awsMockRequest struct { + Method string + Uri string + Body string +} + +type awsMockResponse struct { + StatusCode int + Body string + ContentType string +} + +var test_ec2_describeAccountAttributes_response = ` + 7a62c49f-347e-4fc4-9331-6e8eEXAMPLE + + + supported-platforms + + + VPC + + + EC2 + + + + +` diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ami.go b/installer/server/terraform/plugins/aws/data_source_aws_ami.go index 877069a221..05513c32e1 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_ami.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_ami.go @@ -5,8 +5,6 @@ import ( "fmt" "log" "regexp" - "sort" - "time" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform/helper/hashcode" @@ -249,21 +247,9 @@ func dataSourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error { return amiDescriptionAttributes(d, image) } -type imageSort []*ec2.Image - -func (a imageSort) Len() int { return len(a) } -func (a imageSort) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a imageSort) Less(i, j int) bool { - itime, _ := time.Parse(time.RFC3339, *a[i].CreationDate) - jtime, _ := time.Parse(time.RFC3339, *a[j].CreationDate) - return itime.Unix() < jtime.Unix() -} - // Returns the most recent AMI out of a slice of images. func mostRecentAmi(images []*ec2.Image) *ec2.Image { - sortedImages := images - sort.Sort(imageSort(sortedImages)) - return sortedImages[len(sortedImages)-1] + return sortImages(images)[0] } // populate the numerous fields that the image description returns. diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ami_ids.go b/installer/server/terraform/plugins/aws/data_source_aws_ami_ids.go new file mode 100644 index 0000000000..20df34ac3c --- /dev/null +++ b/installer/server/terraform/plugins/aws/data_source_aws_ami_ids.go @@ -0,0 +1,111 @@ +package aws + +import ( + "fmt" + "log" + "regexp" + + "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsAmiIds() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsAmiIdsRead, + + Schema: map[string]*schema.Schema{ + "filter": dataSourceFiltersSchema(), + "executable_users": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "name_regex": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validateNameRegex, + }, + "owners": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "tags": dataSourceTagsSchema(), + "ids": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func dataSourceAwsAmiIdsRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).ec2conn + + executableUsers, executableUsersOk := d.GetOk("executable_users") + filters, filtersOk := d.GetOk("filter") + nameRegex, nameRegexOk := d.GetOk("name_regex") + owners, ownersOk := d.GetOk("owners") + + if executableUsersOk == false && filtersOk == false && nameRegexOk == false && ownersOk == false { + return fmt.Errorf("One of executable_users, filters, name_regex, or owners must be assigned") + } + + params := &ec2.DescribeImagesInput{} + + if executableUsersOk { + params.ExecutableUsers = expandStringList(executableUsers.([]interface{})) + } + if filtersOk { + params.Filters = buildAwsDataSourceFilters(filters.(*schema.Set)) + } + if ownersOk { + o := expandStringList(owners.([]interface{})) + + if len(o) > 0 { + params.Owners = o + } + } + + resp, err := conn.DescribeImages(params) + if err != nil { + return err + } + + var filteredImages []*ec2.Image + imageIds := make([]string, 0) + + if nameRegexOk { + r := regexp.MustCompile(nameRegex.(string)) + for _, image := range resp.Images { + // Check for a very rare case where the response would include no + // image name. No name means nothing to attempt a match against, + // therefore we are skipping such image. + if image.Name == nil || *image.Name == "" { + log.Printf("[WARN] Unable to find AMI name to match against "+ + "for image ID %q owned by %q, nothing to do.", + *image.ImageId, *image.OwnerId) + continue + } + if r.MatchString(*image.Name) { + filteredImages = append(filteredImages, image) + } + } + } else { + filteredImages = resp.Images[:] + } + + for _, image := range sortImages(filteredImages) { + imageIds = append(imageIds, *image.ImageId) + } + + d.SetId(fmt.Sprintf("%d", hashcode.String(params.String()))) + d.Set("ids", imageIds) + + return nil +} diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ami_ids_test.go b/installer/server/terraform/plugins/aws/data_source_aws_ami_ids_test.go new file mode 100644 index 0000000000..52582eaba1 --- /dev/null +++ b/installer/server/terraform/plugins/aws/data_source_aws_ami_ids_test.go @@ -0,0 +1,128 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/resource" + "github.com/satori/uuid" +) + +func TestAccDataSourceAwsAmiIds_basic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsAmiIdsConfig_basic, + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAmiDataSourceID("data.aws_ami_ids.ubuntu"), + ), + }, + }, + }) +} + +func TestAccDataSourceAwsAmiIds_sorted(t *testing.T) { + uuid := uuid.NewV4().String() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsAmiIdsConfig_sorted1(uuid), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("aws_ami_from_instance.a", "id"), + resource.TestCheckResourceAttrSet("aws_ami_from_instance.b", "id"), + ), + }, + { + Config: testAccDataSourceAwsAmiIdsConfig_sorted2(uuid), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsEbsSnapshotDataSourceID("data.aws_ami_ids.test"), + resource.TestCheckResourceAttr("data.aws_ami_ids.test", "ids.#", "2"), + resource.TestCheckResourceAttrPair( + "data.aws_ami_ids.test", "ids.0", + "aws_ami_from_instance.b", "id"), + resource.TestCheckResourceAttrPair( + "data.aws_ami_ids.test", "ids.1", + "aws_ami_from_instance.a", "id"), + ), + }, + }, + }) +} + +func TestAccDataSourceAwsAmiIds_empty(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsAmiIdsConfig_empty, + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAmiDataSourceID("data.aws_ami_ids.empty"), + resource.TestCheckResourceAttr("data.aws_ami_ids.empty", "ids.#", "0"), + ), + }, + }, + }) +} + +const testAccDataSourceAwsAmiIdsConfig_basic = ` +data "aws_ami_ids" "ubuntu" { + owners = ["099720109477"] + + filter { + name = "name" + values = ["ubuntu/images/ubuntu-*-*-amd64-server-*"] + } +} +` + +func testAccDataSourceAwsAmiIdsConfig_sorted1(uuid string) string { + return fmt.Sprintf(` +resource "aws_instance" "test" { + ami = "ami-efd0428f" + instance_type = "m3.medium" + + count = 2 +} + +resource "aws_ami_from_instance" "a" { + name = "tf-test-%s-a" + source_instance_id = "${aws_instance.test.*.id[0]}" + snapshot_without_reboot = true +} + +resource "aws_ami_from_instance" "b" { + name = "tf-test-%s-b" + source_instance_id = "${aws_instance.test.*.id[1]}" + snapshot_without_reboot = true + + // We want to ensure that 'aws_ami_from_instance.a.creation_date' is less + // than 'aws_ami_from_instance.b.creation_date' so that we can ensure that + // the images are being sorted correctly. + depends_on = ["aws_ami_from_instance.a"] +} +`, uuid, uuid) +} + +func testAccDataSourceAwsAmiIdsConfig_sorted2(uuid string) string { + return testAccDataSourceAwsAmiIdsConfig_sorted1(uuid) + fmt.Sprintf(` +data "aws_ami_ids" "test" { + owners = ["self"] + name_regex = "^tf-test-%s-" +} +`, uuid) +} + +const testAccDataSourceAwsAmiIdsConfig_empty = ` +data "aws_ami_ids" "empty" { + filter { + name = "name" + values = [] + } +} +` diff --git a/installer/server/terraform/plugins/aws/data_source_aws_availability_zones.go b/installer/server/terraform/plugins/aws/data_source_aws_availability_zones.go index a9a9d501f8..dcc09438fd 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_availability_zones.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_availability_zones.go @@ -16,12 +16,12 @@ func dataSourceAwsAvailabilityZones() *schema.Resource { Read: dataSourceAwsAvailabilityZonesRead, Schema: map[string]*schema.Schema{ - "names": &schema.Schema{ + "names": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "state": &schema.Schema{ + "state": { Type: schema.TypeString, Optional: true, ValidateFunc: validateStateType, @@ -40,7 +40,7 @@ func dataSourceAwsAvailabilityZonesRead(d *schema.ResourceData, meta interface{} if v, ok := d.GetOk("state"); ok { request.Filters = []*ec2.Filter{ - &ec2.Filter{ + { Name: aws.String("state"), Values: []*string{aws.String(v.(string))}, }, diff --git a/installer/server/terraform/plugins/aws/data_source_aws_availability_zones_test.go b/installer/server/terraform/plugins/aws/data_source_aws_availability_zones_test.go index 4d2df5acb1..a65ec511ff 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_availability_zones_test.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_availability_zones_test.go @@ -16,13 +16,22 @@ func TestAccAWSAvailabilityZones_basic(t *testing.T) { PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccCheckAwsAvailabilityZonesConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAwsAvailabilityZonesMeta("data.aws_availability_zones.availability_zones"), ), }, - resource.TestStep{ + }, + }) +} + +func TestAccAWSAvailabilityZones_stateFilter(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { Config: testAccCheckAwsAvailabilityZonesStateConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAwsAvailabilityZoneState("data.aws_availability_zones.state_filter"), diff --git a/installer/server/terraform/plugins/aws/data_source_aws_caller_identity.go b/installer/server/terraform/plugins/aws/data_source_aws_caller_identity.go index 05c03864df..a2adcef341 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_caller_identity.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_caller_identity.go @@ -5,6 +5,7 @@ import ( "log" "time" + "github.com/aws/aws-sdk-go/service/sts" "github.com/hashicorp/terraform/helper/schema" ) @@ -17,24 +18,33 @@ func dataSourceAwsCallerIdentity() *schema.Resource { Type: schema.TypeString, Computed: true, }, + + "arn": { + Type: schema.TypeString, + Computed: true, + }, + + "user_id": { + Type: schema.TypeString, + Computed: true, + }, }, } } func dataSourceAwsCallerIdentityRead(d *schema.ResourceData, meta interface{}) error { - client := meta.(*AWSClient) + client := meta.(*AWSClient).stsconn - log.Printf("[DEBUG] Reading Caller Identity.") - d.SetId(time.Now().UTC().String()) - - if client.accountid == "" { - log.Println("[DEBUG] No Account ID available, failing") - return fmt.Errorf("No AWS Account ID is available to the provider. Please ensure that\n" + - "skip_requesting_account_id is not set on the AWS provider.") + res, err := client.GetCallerIdentity(&sts.GetCallerIdentityInput{}) + if err != nil { + return fmt.Errorf("Error getting Caller Identity: %v", err) } - log.Printf("[DEBUG] Setting AWS Account ID to %s.", client.accountid) - d.Set("account_id", meta.(*AWSClient).accountid) + log.Printf("[DEBUG] Received Caller Identity: %s", res) + d.SetId(time.Now().UTC().String()) + d.Set("account_id", res.Account) + d.Set("arn", res.Arn) + d.Set("user_id", res.UserId) return nil } diff --git a/installer/server/terraform/plugins/aws/data_source_aws_caller_identity_test.go b/installer/server/terraform/plugins/aws/data_source_aws_caller_identity_test.go index f874d7da94..100bb4db83 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_caller_identity_test.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_caller_identity_test.go @@ -39,6 +39,14 @@ func testAccCheckAwsCallerIdentityAccountId(n string) resource.TestCheckFunc { return fmt.Errorf("Incorrect Account ID: expected %q, got %q", expected, rs.Primary.Attributes["account_id"]) } + if rs.Primary.Attributes["user_id"] == "" { + return fmt.Errorf("UserID expected to not be nil") + } + + if rs.Primary.Attributes["arn"] == "" { + return fmt.Errorf("ARN expected to not be nil") + } + return nil } } diff --git a/installer/server/terraform/plugins/aws/data_source_aws_cloudformation_stack.go b/installer/server/terraform/plugins/aws/data_source_aws_cloudformation_stack.go index 0966ddb548..b834e0a29b 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_cloudformation_stack.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_cloudformation_stack.go @@ -58,6 +58,10 @@ func dataSourceAwsCloudFormationStack() *schema.Resource { Type: schema.TypeInt, Computed: true, }, + "iam_role_arn": { + Type: schema.TypeString, + Computed: true, + }, "tags": { Type: schema.TypeMap, Computed: true, @@ -86,6 +90,7 @@ func dataSourceAwsCloudFormationStackRead(d *schema.ResourceData, meta interface d.Set("description", stack.Description) d.Set("disable_rollback", stack.DisableRollback) d.Set("timeout_in_minutes", stack.TimeoutInMinutes) + d.Set("iam_role_arn", stack.RoleARN) if len(stack.NotificationARNs) > 0 { d.Set("notification_arns", schema.NewSet(schema.HashString, flattenStringList(stack.NotificationARNs))) diff --git a/installer/server/terraform/plugins/aws/data_source_aws_db_instance.go b/installer/server/terraform/plugins/aws/data_source_aws_db_instance.go index 719c399b3b..753319a847 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_db_instance.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_db_instance.go @@ -20,6 +20,11 @@ func dataSourceAwsDbInstance() *schema.Resource { ForceNew: true, }, + "address": { + Type: schema.TypeString, + Computed: true, + }, + "allocated_storage": { Type: schema.TypeInt, Computed: true, @@ -82,6 +87,11 @@ func dataSourceAwsDbInstance() *schema.Resource { Computed: true, }, + "endpoint": { + Type: schema.TypeString, + Computed: true, + }, + "engine": { Type: schema.TypeString, Computed: true, @@ -92,6 +102,11 @@ func dataSourceAwsDbInstance() *schema.Resource { Computed: true, }, + "hosted_zone_id": { + Type: schema.TypeString, + Computed: true, + }, + "iops": { Type: schema.TypeInt, Computed: true, @@ -133,6 +148,11 @@ func dataSourceAwsDbInstance() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, }, + "port": { + Type: schema.TypeInt, + Computed: true, + }, + "preferred_backup_window": { Type: schema.TypeString, Computed: true, @@ -168,6 +188,11 @@ func dataSourceAwsDbInstance() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, + + "replicate_source_db": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -232,6 +257,10 @@ func dataSourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error d.Set("master_username", dbInstance.MasterUsername) d.Set("monitoring_interval", dbInstance.MonitoringInterval) d.Set("monitoring_role_arn", dbInstance.MonitoringRoleArn) + d.Set("address", dbInstance.Endpoint.Address) + d.Set("port", dbInstance.Endpoint.Port) + d.Set("hosted_zone_id", dbInstance.Endpoint.HostedZoneId) + d.Set("endpoint", fmt.Sprintf("%s:%d", *dbInstance.Endpoint.Address, *dbInstance.Endpoint.Port)) var optionGroups []string for _, v := range dbInstance.OptionGroupMemberships { @@ -247,6 +276,7 @@ func dataSourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error d.Set("storage_encrypted", dbInstance.StorageEncrypted) d.Set("storage_type", dbInstance.StorageType) d.Set("timezone", dbInstance.Timezone) + d.Set("replicate_source_db", dbInstance.ReadReplicaSourceDBInstanceIdentifier) var vpcSecurityGroups []string for _, v := range dbInstance.VpcSecurityGroups { diff --git a/installer/server/terraform/plugins/aws/data_source_aws_db_instance_test.go b/installer/server/terraform/plugins/aws/data_source_aws_db_instance_test.go index 4e37c372da..5d3a200ec2 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_db_instance_test.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_db_instance_test.go @@ -28,6 +28,25 @@ func TestAccAWSDataDbInstance_basic(t *testing.T) { }) } +func TestAccAWSDataDbInstance_endpoint(t *testing.T) { + rInt := acctest.RandInt() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccAWSDBInstanceConfigWithDataSource(rInt), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet("data.aws_db_instance.bar", "address"), + resource.TestCheckResourceAttrSet("data.aws_db_instance.bar", "port"), + resource.TestCheckResourceAttrSet("data.aws_db_instance.bar", "hosted_zone_id"), + resource.TestCheckResourceAttrSet("data.aws_db_instance.bar", "endpoint"), + ), + }, + }, + }) +} + func testAccAWSDBInstanceConfigWithDataSource(rInt int) string { return fmt.Sprintf(` resource "aws_db_instance" "bar" { diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot.go b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot.go index b16f61f229..a363347238 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "sort" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform/helper/schema" @@ -138,20 +137,8 @@ func dataSourceAwsEbsSnapshotRead(d *schema.ResourceData, meta interface{}) erro return snapshotDescriptionAttributes(d, snapshot) } -type snapshotSort []*ec2.Snapshot - -func (a snapshotSort) Len() int { return len(a) } -func (a snapshotSort) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a snapshotSort) Less(i, j int) bool { - itime := *a[i].StartTime - jtime := *a[j].StartTime - return itime.Unix() < jtime.Unix() -} - func mostRecentSnapshot(snapshots []*ec2.Snapshot) *ec2.Snapshot { - sortedSnapshots := snapshots - sort.Sort(snapshotSort(sortedSnapshots)) - return sortedSnapshots[len(sortedSnapshots)-1] + return sortSnapshots(snapshots)[0] } func snapshotDescriptionAttributes(d *schema.ResourceData, snapshot *ec2.Snapshot) error { diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids.go b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids.go new file mode 100644 index 0000000000..bd4f2ad8be --- /dev/null +++ b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids.go @@ -0,0 +1,77 @@ +package aws + +import ( + "fmt" + + "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsEbsSnapshotIds() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsEbsSnapshotIdsRead, + + Schema: map[string]*schema.Schema{ + "filter": dataSourceFiltersSchema(), + "owners": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "restorable_by_user_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "tags": dataSourceTagsSchema(), + "ids": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func dataSourceAwsEbsSnapshotIdsRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).ec2conn + + restorableUsers, restorableUsersOk := d.GetOk("restorable_by_user_ids") + filters, filtersOk := d.GetOk("filter") + owners, ownersOk := d.GetOk("owners") + + if restorableUsers == false && filtersOk == false && ownersOk == false { + return fmt.Errorf("One of filters, restorable_by_user_ids, or owners must be assigned") + } + + params := &ec2.DescribeSnapshotsInput{} + + if restorableUsersOk { + params.RestorableByUserIds = expandStringList(restorableUsers.([]interface{})) + } + if filtersOk { + params.Filters = buildAwsDataSourceFilters(filters.(*schema.Set)) + } + if ownersOk { + params.OwnerIds = expandStringList(owners.([]interface{})) + } + + resp, err := conn.DescribeSnapshots(params) + if err != nil { + return err + } + + snapshotIds := make([]string, 0) + + for _, snapshot := range sortSnapshots(resp.Snapshots) { + snapshotIds = append(snapshotIds, *snapshot.SnapshotId) + } + + d.SetId(fmt.Sprintf("%d", hashcode.String(params.String()))) + d.Set("ids", snapshotIds) + + return nil +} diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids_test.go b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids_test.go new file mode 100644 index 0000000000..0c5f3ec4d4 --- /dev/null +++ b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_ids_test.go @@ -0,0 +1,131 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/resource" + "github.com/satori/uuid" +) + +func TestAccDataSourceAwsEbsSnapshotIds_basic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsEbsSnapshotIdsConfig_basic, + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsEbsSnapshotDataSourceID("data.aws_ebs_snapshot_ids.test"), + ), + }, + }, + }) +} + +func TestAccDataSourceAwsEbsSnapshotIds_sorted(t *testing.T) { + uuid := uuid.NewV4().String() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsEbsSnapshotIdsConfig_sorted1(uuid), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("aws_ebs_snapshot.a", "id"), + resource.TestCheckResourceAttrSet("aws_ebs_snapshot.b", "id"), + ), + }, + { + Config: testAccDataSourceAwsEbsSnapshotIdsConfig_sorted2(uuid), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsEbsSnapshotDataSourceID("data.aws_ebs_snapshot_ids.test"), + resource.TestCheckResourceAttr("data.aws_ebs_snapshot_ids.test", "ids.#", "2"), + resource.TestCheckResourceAttrPair( + "data.aws_ebs_snapshot_ids.test", "ids.0", + "aws_ebs_snapshot.b", "id"), + resource.TestCheckResourceAttrPair( + "data.aws_ebs_snapshot_ids.test", "ids.1", + "aws_ebs_snapshot.a", "id"), + ), + }, + }, + }) +} + +func TestAccDataSourceAwsEbsSnapshotIds_empty(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsEbsSnapshotIdsConfig_empty, + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsEbsSnapshotDataSourceID("data.aws_ebs_snapshot_ids.empty"), + resource.TestCheckResourceAttr("data.aws_ebs_snapshot_ids.empty", "ids.#", "0"), + ), + }, + }, + }) +} + +const testAccDataSourceAwsEbsSnapshotIdsConfig_basic = ` +resource "aws_ebs_volume" "test" { + availability_zone = "us-west-2a" + size = 1 +} + +resource "aws_ebs_snapshot" "test" { + volume_id = "${aws_ebs_volume.test.id}" +} + +data "aws_ebs_snapshot_ids" "test" { + owners = ["self"] +} +` + +func testAccDataSourceAwsEbsSnapshotIdsConfig_sorted1(uuid string) string { + return fmt.Sprintf(` +resource "aws_ebs_volume" "test" { + availability_zone = "us-west-2a" + size = 1 + + count = 2 +} + +resource "aws_ebs_snapshot" "a" { + volume_id = "${aws_ebs_volume.test.*.id[0]}" + description = "tf-test-%s" +} + +resource "aws_ebs_snapshot" "b" { + volume_id = "${aws_ebs_volume.test.*.id[1]}" + description = "tf-test-%s" + + // We want to ensure that 'aws_ebs_snapshot.a.creation_date' is less than + // 'aws_ebs_snapshot.b.creation_date'/ so that we can ensure that the + // snapshots are being sorted correctly. + depends_on = ["aws_ebs_snapshot.a"] +} +`, uuid, uuid) +} + +func testAccDataSourceAwsEbsSnapshotIdsConfig_sorted2(uuid string) string { + return testAccDataSourceAwsEbsSnapshotIdsConfig_sorted1(uuid) + fmt.Sprintf(` +data "aws_ebs_snapshot_ids" "test" { + owners = ["self"] + + filter { + name = "description" + values = ["tf-test-%s"] + } +} +`, uuid) +} + +const testAccDataSourceAwsEbsSnapshotIdsConfig_empty = ` +data "aws_ebs_snapshot_ids" "empty" { + owners = ["000000000000"] +} +` diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_test.go b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_test.go index 682e758cc1..58a20165ab 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_test.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_ebs_snapshot_test.go @@ -44,7 +44,7 @@ func testAccCheckAwsEbsSnapshotDataSourceID(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { - return fmt.Errorf("Can't find Volume data source: %s", n) + return fmt.Errorf("Can't find snapshot data source: %s", n) } if rs.Primary.ID == "" { diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition.go b/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition.go index 4abdc021d7..3a5096a3b9 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition.go @@ -51,7 +51,7 @@ func dataSourceAwsEcsTaskDefinitionRead(d *schema.ResourceData, meta interface{} }) if err != nil { - return err + return fmt.Errorf("Failed getting task definition %s %q", err, d.Get("task_definition").(string)) } taskDefinition := *desc.TaskDefinition diff --git a/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition_test.go b/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition_test.go index 545da07143..6d6ffa35a5 100644 --- a/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition_test.go +++ b/installer/server/terraform/plugins/aws/data_source_aws_ecs_task_definition_test.go @@ -15,10 +15,10 @@ func TestAccAWSEcsDataSource_ecsTaskDefinition(t *testing.T) { resource.TestStep{ Config: testAccCheckAwsEcsTaskDefinitionDataSourceConfig, Check: resource.ComposeTestCheckFunc( - resource.TestMatchResourceAttr("data.aws_ecs_task_definition.mongo", "id", regexp.MustCompile("^arn:aws:ecs:us-west-2:[0-9]{12}:task-definition/mongodb:[1-9]*[0-9]$")), + resource.TestMatchResourceAttr("data.aws_ecs_task_definition.mongo", "id", regexp.MustCompile("^arn:aws:ecs:us-west-2:[0-9]{12}:task-definition/mongodb:[1-9][0-9]*$")), resource.TestCheckResourceAttr("data.aws_ecs_task_definition.mongo", "family", "mongodb"), resource.TestCheckResourceAttr("data.aws_ecs_task_definition.mongo", "network_mode", "bridge"), - resource.TestMatchResourceAttr("data.aws_ecs_task_definition.mongo", "revision", regexp.MustCompile("^[1-9]*[0-9]$")), + resource.TestMatchResourceAttr("data.aws_ecs_task_definition.mongo", "revision", regexp.MustCompile("^[1-9][0-9]*$")), resource.TestCheckResourceAttr("data.aws_ecs_task_definition.mongo", "status", "ACTIVE"), resource.TestMatchResourceAttr("data.aws_ecs_task_definition.mongo", "task_role_arn", regexp.MustCompile("^arn:aws:iam::[0-9]{12}:role/mongo_role$")), ), diff --git a/installer/server/terraform/plugins/aws/data_source_aws_iam_role.go b/installer/server/terraform/plugins/aws/data_source_aws_iam_role.go new file mode 100644 index 0000000000..f681268b96 --- /dev/null +++ b/installer/server/terraform/plugins/aws/data_source_aws_iam_role.go @@ -0,0 +1,67 @@ +package aws + +import ( + "fmt" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + "github.com/hashicorp/errwrap" + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsIAMRole() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsIAMRoleRead, + + Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "assume_role_policy_document": { + Type: schema.TypeString, + Computed: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + "role_id": { + Type: schema.TypeString, + Computed: true, + }, + "role_name": { + Type: schema.TypeString, + Required: true, + }, + }, + } +} + +func dataSourceAwsIAMRoleRead(d *schema.ResourceData, meta interface{}) error { + iamconn := meta.(*AWSClient).iamconn + + roleName := d.Get("role_name").(string) + + req := &iam.GetRoleInput{ + RoleName: aws.String(roleName), + } + + resp, err := iamconn.GetRole(req) + if err != nil { + return errwrap.Wrapf("Error getting roles: {{err}}", err) + } + if resp == nil { + return fmt.Errorf("no IAM role found") + } + + role := resp.Role + + d.SetId(*role.RoleId) + d.Set("arn", role.Arn) + d.Set("assume_role_policy_document", role.AssumeRolePolicyDocument) + d.Set("path", role.Path) + d.Set("role_id", role.RoleId) + + return nil +} diff --git a/installer/server/terraform/plugins/aws/data_source_aws_iam_role_test.go b/installer/server/terraform/plugins/aws/data_source_aws_iam_role_test.go new file mode 100644 index 0000000000..160e5d49be --- /dev/null +++ b/installer/server/terraform/plugins/aws/data_source_aws_iam_role_test.go @@ -0,0 +1,59 @@ +package aws + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSDataSourceIAMRole_basic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccAwsIAMRoleConfig, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.aws_iam_role.test", "role_id"), + resource.TestCheckResourceAttr("data.aws_iam_role.test", "assume_role_policy_document", "%7B%22Version%22%3A%222012-10-17%22%2C%22Statement%22%3A%5B%7B%22Sid%22%3A%22%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Service%22%3A%22ec2.amazonaws.com%22%7D%2C%22Action%22%3A%22sts%3AAssumeRole%22%7D%5D%7D"), + resource.TestCheckResourceAttr("data.aws_iam_role.test", "path", "/testpath/"), + resource.TestCheckResourceAttr("data.aws_iam_role.test", "role_name", "TestRole"), + resource.TestMatchResourceAttr("data.aws_iam_role.test", "arn", regexp.MustCompile("^arn:aws:iam::[0-9]{12}:role/testpath/TestRole$")), + ), + }, + }, + }) +} + +const testAccAwsIAMRoleConfig = ` +provider "aws" { + region = "us-east-1" +} + +resource "aws_iam_role" "test_role" { + name = "TestRole" + + assume_role_policy = < 0 { for _, pair := range perm.UserIdGroupPairs { p := &ec2.IpPermission{ - FromPort: perm.FromPort, - IpProtocol: perm.IpProtocol, - IpRanges: perm.IpRanges, - PrefixListIds: perm.PrefixListIds, - ToPort: perm.ToPort, - + FromPort: perm.FromPort, + IpProtocol: perm.IpProtocol, + PrefixListIds: perm.PrefixListIds, + ToPort: perm.ToPort, UserIdGroupPairs: []*ec2.UserIdGroupPair{pair}, } diff --git a/installer/server/terraform/plugins/aws/import_aws_security_group_test.go b/installer/server/terraform/plugins/aws/import_aws_security_group_test.go index d2bf912057..d91b1027a5 100644 --- a/installer/server/terraform/plugins/aws/import_aws_security_group_test.go +++ b/installer/server/terraform/plugins/aws/import_aws_security_group_test.go @@ -23,11 +23,39 @@ func TestAccAWSSecurityGroup_importBasic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig, }, - resource.TestStep{ + { + ResourceName: "aws_security_group.web", + ImportState: true, + ImportStateCheck: checkFn, + }, + }, + }) +} + +func TestAccAWSSecurityGroup_importIpv6(t *testing.T) { + checkFn := func(s []*terraform.InstanceState) error { + // Expect 3: group, 2 rules + if len(s) != 3 { + return fmt.Errorf("expected 3 states: %#v", s) + } + + return nil + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityGroupConfigIpv6, + }, + + { ResourceName: "aws_security_group.web", ImportState: true, ImportStateCheck: checkFn, @@ -42,11 +70,11 @@ func TestAccAWSSecurityGroup_importSelf(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_importSelf, }, - resource.TestStep{ + { ResourceName: "aws_security_group.allow_all", ImportState: true, ImportStateVerify: true, @@ -61,11 +89,11 @@ func TestAccAWSSecurityGroup_importSourceSecurityGroup(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_importSourceSecurityGroup, }, - resource.TestStep{ + { ResourceName: "aws_security_group.test_group_1", ImportState: true, ImportStateVerify: true, @@ -73,3 +101,59 @@ func TestAccAWSSecurityGroup_importSourceSecurityGroup(t *testing.T) { }, }) } + +func TestAccAWSSecurityGroup_importIPRangeAndSecurityGroupWithSameRules(t *testing.T) { + checkFn := func(s []*terraform.InstanceState) error { + // Expect 4: group, 3 rules + if len(s) != 4 { + return fmt.Errorf("expected 4 states: %#v", s) + } + + return nil + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityGroupConfig_importIPRangeAndSecurityGroupWithSameRules, + }, + + { + ResourceName: "aws_security_group.test_group_1", + ImportState: true, + ImportStateCheck: checkFn, + }, + }, + }) +} + +func TestAccAWSSecurityGroup_importIPRangesWithSameRules(t *testing.T) { + checkFn := func(s []*terraform.InstanceState) error { + // Expect 4: group, 2 rules + if len(s) != 3 { + return fmt.Errorf("expected 3 states: %#v", s) + } + + return nil + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityGroupConfig_importIPRangesWithSameRules, + }, + + { + ResourceName: "aws_security_group.test_group_1", + ImportState: true, + ImportStateCheck: checkFn, + }, + }, + }) +} diff --git a/installer/server/terraform/plugins/aws/import_aws_spot_datafeed_subscription_test.go b/installer/server/terraform/plugins/aws/import_aws_spot_datafeed_subscription_test.go index 8d60f39945..24c7acc59f 100644 --- a/installer/server/terraform/plugins/aws/import_aws_spot_datafeed_subscription_test.go +++ b/installer/server/terraform/plugins/aws/import_aws_spot_datafeed_subscription_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" ) -func TestAccAWSSpotDatafeedSubscription_importBasic(t *testing.T) { +func testAccAWSSpotDatafeedSubscription_importBasic(t *testing.T) { resourceName := "aws_spot_datafeed_subscription.default" ri := acctest.RandInt() @@ -16,11 +16,11 @@ func TestAccAWSSpotDatafeedSubscription_importBasic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotDatafeedSubscriptionDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSpotDatafeedSubscription(ri), }, - resource.TestStep{ + { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, diff --git a/installer/server/terraform/plugins/aws/import_aws_vpn_connection_test.go b/installer/server/terraform/plugins/aws/import_aws_vpn_connection_test.go index a9dd41b583..a7297a2207 100644 --- a/installer/server/terraform/plugins/aws/import_aws_vpn_connection_test.go +++ b/installer/server/terraform/plugins/aws/import_aws_vpn_connection_test.go @@ -3,11 +3,13 @@ package aws import ( "testing" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSVpnConnection_importBasic(t *testing.T) { resourceName := "aws_vpn_connection.foo" + rBgpAsn := acctest.RandIntRange(64512, 65534) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -15,7 +17,7 @@ func TestAccAWSVpnConnection_importBasic(t *testing.T) { CheckDestroy: testAccAwsVpnConnectionDestroy, Steps: []resource.TestStep{ { - Config: testAccAwsVpnConnectionConfig, + Config: testAccAwsVpnConnectionConfig(rBgpAsn), }, { ResourceName: resourceName, diff --git a/installer/server/terraform/plugins/aws/network_acl_entry.go b/installer/server/terraform/plugins/aws/network_acl_entry.go index a8450ef520..c57f82222c 100644 --- a/installer/server/terraform/plugins/aws/network_acl_entry.go +++ b/installer/server/terraform/plugins/aws/network_acl_entry.go @@ -32,7 +32,14 @@ func expandNetworkAclEntries(configured []interface{}, entryType string) ([]*ec2 Egress: aws.Bool(entryType == "egress"), RuleAction: aws.String(data["action"].(string)), RuleNumber: aws.Int64(int64(data["rule_no"].(int))), - CidrBlock: aws.String(data["cidr_block"].(string)), + } + + if v, ok := data["ipv6_cidr_block"]; ok { + e.Ipv6CidrBlock = aws.String(v.(string)) + } + + if v, ok := data["cidr_block"]; ok { + e.CidrBlock = aws.String(v.(string)) } // Specify additional required fields for ICMP @@ -55,14 +62,24 @@ func flattenNetworkAclEntries(list []*ec2.NetworkAclEntry) []map[string]interfac entries := make([]map[string]interface{}, 0, len(list)) for _, entry := range list { - entries = append(entries, map[string]interface{}{ - "from_port": *entry.PortRange.From, - "to_port": *entry.PortRange.To, - "action": *entry.RuleAction, - "rule_no": *entry.RuleNumber, - "protocol": *entry.Protocol, - "cidr_block": *entry.CidrBlock, - }) + + newEntry := map[string]interface{}{ + "from_port": *entry.PortRange.From, + "to_port": *entry.PortRange.To, + "action": *entry.RuleAction, + "rule_no": *entry.RuleNumber, + "protocol": *entry.Protocol, + } + + if entry.CidrBlock != nil { + newEntry["cidr_block"] = *entry.CidrBlock + } + + if entry.Ipv6CidrBlock != nil { + newEntry["ipv6_cidr_block"] = *entry.Ipv6CidrBlock + } + + entries = append(entries, newEntry) } return entries diff --git a/installer/server/terraform/plugins/aws/provider.go b/installer/server/terraform/plugins/aws/provider.go index a296c722da..6f847fb263 100644 --- a/installer/server/terraform/plugins/aws/provider.go +++ b/installer/server/terraform/plugins/aws/provider.go @@ -70,7 +70,7 @@ func Provider() terraform.ResourceProvider { "max_retries": { Type: schema.TypeInt, Optional: true, - Default: 11, + Default: 25, Description: descriptions["max_retries"], }, @@ -91,21 +91,19 @@ func Provider() terraform.ResourceProvider { }, "dynamodb_endpoint": { - Type: schema.TypeString, - Optional: true, - Default: "", - Description: descriptions["dynamodb_endpoint"], - Deprecated: "Use `dynamodb` inside `endpoints` block instead", - ConflictsWith: []string{"endpoints.0.dynamodb"}, + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["dynamodb_endpoint"], + Removed: "Use `dynamodb` inside `endpoints` block instead", }, "kinesis_endpoint": { - Type: schema.TypeString, - Optional: true, - Default: "", - Description: descriptions["kinesis_endpoint"], - Deprecated: "Use `kinesis` inside `endpoints` block instead", - ConflictsWith: []string{"endpoints.0.kinesis"}, + Type: schema.TypeString, + Optional: true, + Default: "", + Description: descriptions["kinesis_endpoint"], + Removed: "Use `kinesis` inside `endpoints` block instead", }, "endpoints": endpointsSchema(), @@ -124,6 +122,13 @@ func Provider() terraform.ResourceProvider { Description: descriptions["skip_credentials_validation"], }, + "skip_get_ec2_platforms": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: descriptions["skip_get_ec2_platforms"], + }, + "skip_region_validation": { Type: schema.TypeBool, Optional: true, @@ -158,6 +163,7 @@ func Provider() terraform.ResourceProvider { "aws_alb": dataSourceAwsAlb(), "aws_alb_listener": dataSourceAwsAlbListener(), "aws_ami": dataSourceAwsAmi(), + "aws_ami_ids": dataSourceAwsAmiIds(), "aws_autoscaling_groups": dataSourceAwsAutoscalingGroups(), "aws_availability_zone": dataSourceAwsAvailabilityZone(), "aws_availability_zones": dataSourceAwsAvailabilityZones(), @@ -167,6 +173,7 @@ func Provider() terraform.ResourceProvider { "aws_cloudformation_stack": dataSourceAwsCloudFormationStack(), "aws_db_instance": dataSourceAwsDbInstance(), "aws_ebs_snapshot": dataSourceAwsEbsSnapshot(), + "aws_ebs_snapshot_ids": dataSourceAwsEbsSnapshotIds(), "aws_ebs_volume": dataSourceAwsEbsVolume(), "aws_ecs_cluster": dataSourceAwsEcsCluster(), "aws_ecs_container_definition": dataSourceAwsEcsContainerDefinition(), @@ -174,11 +181,14 @@ func Provider() terraform.ResourceProvider { "aws_eip": dataSourceAwsEip(), "aws_elb_hosted_zone_id": dataSourceAwsElbHostedZoneId(), "aws_elb_service_account": dataSourceAwsElbServiceAccount(), + "aws_kinesis_stream": dataSourceAwsKinesisStream(), "aws_iam_account_alias": dataSourceAwsIamAccountAlias(), "aws_iam_policy_document": dataSourceAwsIamPolicyDocument(), + "aws_iam_role": dataSourceAwsIAMRole(), "aws_iam_server_certificate": dataSourceAwsIAMServerCertificate(), "aws_instance": dataSourceAwsInstance(), "aws_ip_ranges": dataSourceAwsIPRanges(), + "aws_kms_alias": dataSourceAwsKmsAlias(), "aws_kms_secret": dataSourceAwsKmsSecret(), "aws_partition": dataSourceAwsPartition(), "aws_prefix_list": dataSourceAwsPrefixList(), @@ -189,6 +199,7 @@ func Provider() terraform.ResourceProvider { "aws_s3_bucket_object": dataSourceAwsS3BucketObject(), "aws_sns_topic": dataSourceAwsSnsTopic(), "aws_subnet": dataSourceAwsSubnet(), + "aws_subnet_ids": dataSourceAwsSubnetIDs(), "aws_security_group": dataSourceAwsSecurityGroup(), "aws_vpc": dataSourceAwsVpc(), "aws_vpc_endpoint": dataSourceAwsVpcEndpoint(), @@ -218,9 +229,13 @@ func Provider() terraform.ResourceProvider { "aws_api_gateway_integration_response": resourceAwsApiGatewayIntegrationResponse(), "aws_api_gateway_method": resourceAwsApiGatewayMethod(), "aws_api_gateway_method_response": resourceAwsApiGatewayMethodResponse(), + "aws_api_gateway_method_settings": resourceAwsApiGatewayMethodSettings(), "aws_api_gateway_model": resourceAwsApiGatewayModel(), "aws_api_gateway_resource": resourceAwsApiGatewayResource(), "aws_api_gateway_rest_api": resourceAwsApiGatewayRestApi(), + "aws_api_gateway_stage": resourceAwsApiGatewayStage(), + "aws_api_gateway_usage_plan": resourceAwsApiGatewayUsagePlan(), + "aws_api_gateway_usage_plan_key": resourceAwsApiGatewayUsagePlanKey(), "aws_app_cookie_stickiness_policy": resourceAwsAppCookieStickinessPolicy(), "aws_appautoscaling_target": resourceAwsAppautoscalingTarget(), "aws_appautoscaling_policy": resourceAwsAppautoscalingPolicy(), @@ -245,6 +260,7 @@ func Provider() terraform.ResourceProvider { "aws_config_configuration_recorder": resourceAwsConfigConfigurationRecorder(), "aws_config_configuration_recorder_status": resourceAwsConfigConfigurationRecorderStatus(), "aws_config_delivery_channel": resourceAwsConfigDeliveryChannel(), + "aws_cognito_identity_pool": resourceAwsCognitoIdentityPool(), "aws_autoscaling_lifecycle_hook": resourceAwsAutoscalingLifecycleHook(), "aws_cloudwatch_metric_alarm": resourceAwsCloudWatchMetricAlarm(), "aws_codedeploy_app": resourceAwsCodeDeployApp(), @@ -300,12 +316,14 @@ func Provider() terraform.ResourceProvider { "aws_flow_log": resourceAwsFlowLog(), "aws_glacier_vault": resourceAwsGlacierVault(), "aws_iam_access_key": resourceAwsIamAccessKey(), + "aws_iam_account_alias": resourceAwsIamAccountAlias(), "aws_iam_account_password_policy": resourceAwsIamAccountPasswordPolicy(), "aws_iam_group_policy": resourceAwsIamGroupPolicy(), "aws_iam_group": resourceAwsIamGroup(), "aws_iam_group_membership": resourceAwsIamGroupMembership(), "aws_iam_group_policy_attachment": resourceAwsIamGroupPolicyAttachment(), "aws_iam_instance_profile": resourceAwsIamInstanceProfile(), + "aws_iam_openid_connect_provider": resourceAwsIamOpenIDConnectProvider(), "aws_iam_policy": resourceAwsIamPolicy(), "aws_iam_policy_attachment": resourceAwsIamPolicyAttachment(), "aws_iam_role_policy_attachment": resourceAwsIamRolePolicyAttachment(), @@ -336,6 +354,8 @@ func Provider() terraform.ResourceProvider { "aws_lightsail_domain": resourceAwsLightsailDomain(), "aws_lightsail_instance": resourceAwsLightsailInstance(), "aws_lightsail_key_pair": resourceAwsLightsailKeyPair(), + "aws_lightsail_static_ip": resourceAwsLightsailStaticIp(), + "aws_lightsail_static_ip_attachment": resourceAwsLightsailStaticIpAttachment(), "aws_lb_cookie_stickiness_policy": resourceAwsLBCookieStickinessPolicy(), "aws_load_balancer_policy": resourceAwsLoadBalancerPolicy(), "aws_load_balancer_backend_server_policy": resourceAwsLoadBalancerBackendServerPolicies(), @@ -348,6 +368,7 @@ func Provider() terraform.ResourceProvider { "aws_default_route_table": resourceAwsDefaultRouteTable(), "aws_network_acl_rule": resourceAwsNetworkAclRule(), "aws_network_interface": resourceAwsNetworkInterface(), + "aws_network_interface_attachment": resourceAwsNetworkInterfaceAttachment(), "aws_opsworks_application": resourceAwsOpsworksApplication(), "aws_opsworks_stack": resourceAwsOpsworksStack(), "aws_opsworks_java_app_layer": resourceAwsOpsworksJavaAppLayer(), @@ -382,6 +403,7 @@ func Provider() terraform.ResourceProvider { "aws_route_table": resourceAwsRouteTable(), "aws_route_table_association": resourceAwsRouteTableAssociation(), "aws_ses_active_receipt_rule_set": resourceAwsSesActiveReceiptRuleSet(), + "aws_ses_domain_identity": resourceAwsSesDomainIdentity(), "aws_ses_receipt_filter": resourceAwsSesReceiptFilter(), "aws_ses_receipt_rule": resourceAwsSesReceiptRule(), "aws_ses_receipt_rule_set": resourceAwsSesReceiptRuleSet(), @@ -480,6 +502,9 @@ func init() { "skip_credentials_validation": "Skip the credentials validation via STS API. " + "Used for AWS API implementations that do not have STS available/implemented.", + "skip_get_ec2_platforms": "Skip getting the supported EC2 platforms. " + + "Used by users that don't have ec2:DescribeAccountAttributes permissions.", + "skip_region_validation": "Skip static validation of region name. " + "Used by users of alternative AWS-like APIs or users w/ access to regions that are not public (yet).", @@ -517,10 +542,9 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { Token: d.Get("token").(string), Region: d.Get("region").(string), MaxRetries: d.Get("max_retries").(int), - DynamoDBEndpoint: d.Get("dynamodb_endpoint").(string), - KinesisEndpoint: d.Get("kinesis_endpoint").(string), Insecure: d.Get("insecure").(bool), SkipCredsValidation: d.Get("skip_credentials_validation").(bool), + SkipGetEC2Platforms: d.Get("skip_get_ec2_platforms").(bool), SkipRegionValidation: d.Get("skip_region_validation").(bool), SkipRequestingAccountId: d.Get("skip_requesting_account_id").(bool), SkipMetadataApiCheck: d.Get("skip_metadata_api_check").(bool), diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb.go b/installer/server/terraform/plugins/aws/resource_aws_alb.go index 0efe4566a5..fe94dd0fa1 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb.go @@ -48,7 +48,7 @@ func resourceAwsAlb() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validateElbName, + ValidateFunc: validateElbNamePrefix, }, "internal": { @@ -69,7 +69,6 @@ func resourceAwsAlb() *schema.Resource { "subnets": { Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, - ForceNew: true, Required: true, Set: schema.HashString, }, @@ -109,6 +108,12 @@ func resourceAwsAlb() *schema.Resource { Default: 60, }, + "ip_address_type": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "vpc_id": { Type: schema.TypeString, Computed: true, @@ -159,6 +164,10 @@ func resourceAwsAlbCreate(d *schema.ResourceData, meta interface{}) error { elbOpts.Subnets = expandStringList(v.(*schema.Set).List()) } + if v, ok := d.GetOk("ip_address_type"); ok { + elbOpts.IpAddressType = aws.String(v.(string)) + } + log.Printf("[DEBUG] ALB create configuration: %#v", elbOpts) resp, err := elbconn.CreateLoadBalancer(elbOpts) @@ -175,7 +184,7 @@ func resourceAwsAlbCreate(d *schema.ResourceData, meta interface{}) error { log.Printf("[INFO] ALB ID: %s", d.Id()) stateConf := &resource.StateChangeConf{ - Pending: []string{"active", "provisioning", "failed"}, + Pending: []string{"provisioning", "failed"}, Target: []string{"active"}, Refresh: func() (interface{}, string, error) { describeResp, err := elbconn.DescribeLoadBalancers(&elbv2.DescribeLoadBalancersInput{ @@ -194,7 +203,7 @@ func resourceAwsAlbCreate(d *schema.ResourceData, meta interface{}) error { return describeResp, *dLb.State.Code, nil }, - Timeout: 5 * time.Minute, + Timeout: 10 * time.Minute, MinTimeout: 3 * time.Second, } _, err = stateConf.WaitForState() @@ -312,6 +321,62 @@ func resourceAwsAlbUpdate(d *schema.ResourceData, meta interface{}) error { } + if d.HasChange("subnets") { + subnets := expandStringList(d.Get("subnets").(*schema.Set).List()) + + params := &elbv2.SetSubnetsInput{ + LoadBalancerArn: aws.String(d.Id()), + Subnets: subnets, + } + + _, err := elbconn.SetSubnets(params) + if err != nil { + return fmt.Errorf("Failure Setting ALB Subnets: %s", err) + } + } + + if d.HasChange("ip_address_type") { + + params := &elbv2.SetIpAddressTypeInput{ + LoadBalancerArn: aws.String(d.Id()), + IpAddressType: aws.String(d.Get("ip_address_type").(string)), + } + + _, err := elbconn.SetIpAddressType(params) + if err != nil { + return fmt.Errorf("Failure Setting ALB IP Address Type: %s", err) + } + + } + + stateConf := &resource.StateChangeConf{ + Pending: []string{"active", "provisioning", "failed"}, + Target: []string{"active"}, + Refresh: func() (interface{}, string, error) { + describeResp, err := elbconn.DescribeLoadBalancers(&elbv2.DescribeLoadBalancersInput{ + LoadBalancerArns: []*string{aws.String(d.Id())}, + }) + if err != nil { + return nil, "", err + } + + if len(describeResp.LoadBalancers) != 1 { + return nil, "", fmt.Errorf("No load balancers returned for %s", d.Id()) + } + dLb := describeResp.LoadBalancers[0] + + log.Printf("[INFO] ALB state: %s", *dLb.State.Code) + + return describeResp, *dLb.State.Code, nil + }, + Timeout: 10 * time.Minute, + MinTimeout: 3 * time.Second, + } + _, err := stateConf.WaitForState() + if err != nil { + return err + } + return resourceAwsAlbRead(d, meta) } @@ -368,6 +433,7 @@ func flattenAwsAlbResource(d *schema.ResourceData, meta interface{}, alb *elbv2. d.Set("vpc_id", alb.VpcId) d.Set("zone_id", alb.CanonicalHostedZoneId) d.Set("dns_name", alb.DNSName) + d.Set("ip_address_type", alb.IpAddressType) respTags, err := elbconn.DescribeTags(&elbv2.DescribeTagsInput{ ResourceArns: []*string{alb.LoadBalancerArn}, diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule.go b/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule.go index 1d5ba163f6..21292753cc 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule.go @@ -31,10 +31,12 @@ func resourceAwsAlbListenerRule() *schema.Resource { "listener_arn": { Type: schema.TypeString, Required: true, + ForceNew: true, }, "priority": { Type: schema.TypeInt, Required: true, + ForceNew: true, ValidateFunc: validateAwsAlbListenerRulePriority, }, "action": { @@ -66,6 +68,7 @@ func resourceAwsAlbListenerRule() *schema.Resource { }, "values": { Type: schema.TypeList, + MaxItems: 1, Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, }, @@ -183,43 +186,76 @@ func resourceAwsAlbListenerRuleRead(d *schema.ResourceData, meta interface{}) er func resourceAwsAlbListenerRuleUpdate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbv2conn + d.Partial(true) + + if d.HasChange("priority") { + params := &elbv2.SetRulePrioritiesInput{ + RulePriorities: []*elbv2.RulePriorityPair{ + { + RuleArn: aws.String(d.Id()), + Priority: aws.Int64(int64(d.Get("priority").(int))), + }, + }, + } + + _, err := elbconn.SetRulePriorities(params) + if err != nil { + return err + } + + d.SetPartial("priority") + } + + requestUpdate := false params := &elbv2.ModifyRuleInput{ RuleArn: aws.String(d.Id()), } - actions := d.Get("action").([]interface{}) - params.Actions = make([]*elbv2.Action, len(actions)) - for i, action := range actions { - actionMap := action.(map[string]interface{}) - params.Actions[i] = &elbv2.Action{ - TargetGroupArn: aws.String(actionMap["target_group_arn"].(string)), - Type: aws.String(actionMap["type"].(string)), + if d.HasChange("action") { + actions := d.Get("action").([]interface{}) + params.Actions = make([]*elbv2.Action, len(actions)) + for i, action := range actions { + actionMap := action.(map[string]interface{}) + params.Actions[i] = &elbv2.Action{ + TargetGroupArn: aws.String(actionMap["target_group_arn"].(string)), + Type: aws.String(actionMap["type"].(string)), + } } + requestUpdate = true + d.SetPartial("action") } - conditions := d.Get("condition").([]interface{}) - params.Conditions = make([]*elbv2.RuleCondition, len(conditions)) - for i, condition := range conditions { - conditionMap := condition.(map[string]interface{}) - values := conditionMap["values"].([]interface{}) - params.Conditions[i] = &elbv2.RuleCondition{ - Field: aws.String(conditionMap["field"].(string)), - Values: make([]*string, len(values)), - } - for j, value := range values { - params.Conditions[i].Values[j] = aws.String(value.(string)) + if d.HasChange("condition") { + conditions := d.Get("condition").([]interface{}) + params.Conditions = make([]*elbv2.RuleCondition, len(conditions)) + for i, condition := range conditions { + conditionMap := condition.(map[string]interface{}) + values := conditionMap["values"].([]interface{}) + params.Conditions[i] = &elbv2.RuleCondition{ + Field: aws.String(conditionMap["field"].(string)), + Values: make([]*string, len(values)), + } + for j, value := range values { + params.Conditions[i].Values[j] = aws.String(value.(string)) + } } + requestUpdate = true + d.SetPartial("condition") } - resp, err := elbconn.ModifyRule(params) - if err != nil { - return errwrap.Wrapf("Error modifying ALB Listener Rule: {{err}}", err) - } + if requestUpdate { + resp, err := elbconn.ModifyRule(params) + if err != nil { + return errwrap.Wrapf("Error modifying ALB Listener Rule: {{err}}", err) + } - if len(resp.Rules) == 0 { - return errors.New("Error modifying creating ALB Listener Rule: no rules returned in response") + if len(resp.Rules) == 0 { + return errors.New("Error modifying creating ALB Listener Rule: no rules returned in response") + } } + d.Partial(false) + return resourceAwsAlbListenerRuleRead(d, meta) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule_test.go b/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule_test.go index e27a0a57db..8ddc0ef9ee 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb_listener_rule_test.go @@ -3,6 +3,7 @@ package aws import ( "errors" "fmt" + "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -43,6 +44,90 @@ func TestAccAWSALBListenerRule_basic(t *testing.T) { }) } +func TestAccAWSALBListenerRule_updateRulePriority(t *testing.T) { + var rule elbv2.Rule + albName := fmt.Sprintf("testrule-basic-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) + targetGroupName := fmt.Sprintf("testtargetgroup-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_alb_listener_rule.static", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBListenerRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBListenerRuleConfig_basic(albName, targetGroupName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSALBListenerRuleExists("aws_alb_listener_rule.static", &rule), + resource.TestCheckResourceAttr("aws_alb_listener_rule.static", "priority", "100"), + ), + }, + { + Config: testAccAWSALBListenerRuleConfig_updateRulePriority(albName, targetGroupName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSALBListenerRuleExists("aws_alb_listener_rule.static", &rule), + resource.TestCheckResourceAttr("aws_alb_listener_rule.static", "priority", "101"), + ), + }, + }, + }) +} + +func TestAccAWSALBListenerRule_changeListenerRuleArnForcesNew(t *testing.T) { + var before, after elbv2.Rule + albName := fmt.Sprintf("testrule-basic-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) + targetGroupName := fmt.Sprintf("testtargetgroup-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_alb_listener_rule.static", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBListenerRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBListenerRuleConfig_basic(albName, targetGroupName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSALBListenerRuleExists("aws_alb_listener_rule.static", &before), + ), + }, + { + Config: testAccAWSALBListenerRuleConfig_changeRuleArn(albName, targetGroupName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSALBListenerRuleExists("aws_alb_listener_rule.static", &after), + testAccCheckAWSAlbListenerRuleRecreated(t, &before, &after), + ), + }, + }, + }) +} + +func TestAccAWSALBListenerRule_multipleConditionThrowsError(t *testing.T) { + albName := fmt.Sprintf("testrule-basic-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) + targetGroupName := fmt.Sprintf("testtargetgroup-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBListenerRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBListenerRuleConfig_multipleConditions(albName, targetGroupName), + ExpectError: regexp.MustCompile(`attribute supports 1 item maximum`), + }, + }, + }) +} + +func testAccCheckAWSAlbListenerRuleRecreated(t *testing.T, + before, after *elbv2.Rule) resource.TestCheckFunc { + return func(s *terraform.State) error { + if *before.RuleArn == *after.RuleArn { + t.Fatalf("Expected change of Listener Rule ARNs, but both were %v", before.RuleArn) + } + return nil + } +} + func testAccCheckAWSALBListenerRuleExists(n string, res *elbv2.Rule) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -104,6 +189,117 @@ func testAccCheckAWSALBListenerRuleDestroy(s *terraform.State) error { return nil } +func testAccAWSALBListenerRuleConfig_multipleConditions(albName, targetGroupName string) string { + return fmt.Sprintf(`resource "aws_alb_listener_rule" "static" { + listener_arn = "${aws_alb_listener.front_end.arn}" + priority = 100 + + action { + type = "forward" + target_group_arn = "${aws_alb_target_group.test.arn}" + } + + condition { + field = "path-pattern" + values = ["/static/*", "static"] + } +} + +resource "aws_alb_listener" "front_end" { + load_balancer_arn = "${aws_alb.alb_test.id}" + protocol = "HTTP" + port = "80" + + default_action { + target_group_arn = "${aws_alb_target_group.test.id}" + type = "forward" + } +} + +resource "aws_alb" "alb_test" { + name = "%s" + internal = true + security_groups = ["${aws_security_group.alb_test.id}"] + subnets = ["${aws_subnet.alb_test.*.id}"] + + idle_timeout = 30 + enable_deletion_protection = false + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_alb_target_group" "test" { + name = "%s" + port = 8080 + protocol = "HTTP" + vpc_id = "${aws_vpc.alb_test.id}" + + health_check { + path = "/health" + interval = 60 + port = 8081 + protocol = "HTTP" + timeout = 3 + healthy_threshold = 3 + unhealthy_threshold = 3 + matcher = "200-299" + } +} + +variable "subnets" { + default = ["10.0.1.0/24", "10.0.2.0/24"] + type = "list" +} + +data "aws_availability_zones" "available" {} + +resource "aws_vpc" "alb_test" { + cidr_block = "10.0.0.0/16" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_subnet" "alb_test" { + count = 2 + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "${element(var.subnets, count.index)}" + map_public_ip_on_launch = true + availability_zone = "${element(data.aws_availability_zones.available.names, count.index)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_security_group" "alb_test" { + name = "allow_all_alb_test" + description = "Used for ALB Testing" + vpc_id = "${aws_vpc.alb_test.id}" + + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags { + TestName = "TestAccAWSALB_basic" + } +}`, albName, targetGroupName) +} + func testAccAWSALBListenerRuleConfig_basic(albName, targetGroupName string) string { return fmt.Sprintf(`resource "aws_alb_listener_rule" "static" { listener_arn = "${aws_alb_listener.front_end.arn}" @@ -214,3 +410,238 @@ resource "aws_security_group" "alb_test" { } }`, albName, targetGroupName) } + +func testAccAWSALBListenerRuleConfig_updateRulePriority(albName, targetGroupName string) string { + return fmt.Sprintf(` +resource "aws_alb_listener_rule" "static" { + listener_arn = "${aws_alb_listener.front_end.arn}" + priority = 101 + + action { + type = "forward" + target_group_arn = "${aws_alb_target_group.test.arn}" + } + + condition { + field = "path-pattern" + values = ["/static/*"] + } +} + +resource "aws_alb_listener" "front_end" { + load_balancer_arn = "${aws_alb.alb_test.id}" + protocol = "HTTP" + port = "80" + + default_action { + target_group_arn = "${aws_alb_target_group.test.id}" + type = "forward" + } +} + +resource "aws_alb" "alb_test" { + name = "%s" + internal = true + security_groups = ["${aws_security_group.alb_test.id}"] + subnets = ["${aws_subnet.alb_test.*.id}"] + + idle_timeout = 30 + enable_deletion_protection = false + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_alb_target_group" "test" { + name = "%s" + port = 8080 + protocol = "HTTP" + vpc_id = "${aws_vpc.alb_test.id}" + + health_check { + path = "/health" + interval = 60 + port = 8081 + protocol = "HTTP" + timeout = 3 + healthy_threshold = 3 + unhealthy_threshold = 3 + matcher = "200-299" + } +} + +variable "subnets" { + default = ["10.0.1.0/24", "10.0.2.0/24"] + type = "list" +} + +data "aws_availability_zones" "available" {} + +resource "aws_vpc" "alb_test" { + cidr_block = "10.0.0.0/16" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_subnet" "alb_test" { + count = 2 + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "${element(var.subnets, count.index)}" + map_public_ip_on_launch = true + availability_zone = "${element(data.aws_availability_zones.available.names, count.index)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_security_group" "alb_test" { + name = "allow_all_alb_test" + description = "Used for ALB Testing" + vpc_id = "${aws_vpc.alb_test.id}" + + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags { + TestName = "TestAccAWSALB_basic" + } +}`, albName, targetGroupName) +} + +func testAccAWSALBListenerRuleConfig_changeRuleArn(albName, targetGroupName string) string { + return fmt.Sprintf(` +resource "aws_alb_listener_rule" "static" { + listener_arn = "${aws_alb_listener.front_end_ruleupdate.arn}" + priority = 101 + + action { + type = "forward" + target_group_arn = "${aws_alb_target_group.test.arn}" + } + + condition { + field = "path-pattern" + values = ["/static/*"] + } +} + +resource "aws_alb_listener" "front_end" { + load_balancer_arn = "${aws_alb.alb_test.id}" + protocol = "HTTP" + port = "80" + + default_action { + target_group_arn = "${aws_alb_target_group.test.id}" + type = "forward" + } +} + +resource "aws_alb_listener" "front_end_ruleupdate" { + load_balancer_arn = "${aws_alb.alb_test.id}" + protocol = "HTTP" + port = "8080" + + default_action { + target_group_arn = "${aws_alb_target_group.test.id}" + type = "forward" + } +} + +resource "aws_alb" "alb_test" { + name = "%s" + internal = true + security_groups = ["${aws_security_group.alb_test.id}"] + subnets = ["${aws_subnet.alb_test.*.id}"] + + idle_timeout = 30 + enable_deletion_protection = false + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_alb_target_group" "test" { + name = "%s" + port = 8080 + protocol = "HTTP" + vpc_id = "${aws_vpc.alb_test.id}" + + health_check { + path = "/health" + interval = 60 + port = 8081 + protocol = "HTTP" + timeout = 3 + healthy_threshold = 3 + unhealthy_threshold = 3 + matcher = "200-299" + } +} + +variable "subnets" { + default = ["10.0.1.0/24", "10.0.2.0/24"] + type = "list" +} + +data "aws_availability_zones" "available" {} + +resource "aws_vpc" "alb_test" { + cidr_block = "10.0.0.0/16" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_subnet" "alb_test" { + count = 2 + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "${element(var.subnets, count.index)}" + map_public_ip_on_launch = true + availability_zone = "${element(data.aws_availability_zones.available.names, count.index)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_security_group" "alb_test" { + name = "allow_all_alb_test" + description = "Used for ALB Testing" + vpc_id = "${aws_vpc.alb_test.id}" + + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags { + TestName = "TestAccAWSALB_basic" + } +}`, albName, targetGroupName) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group.go b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group.go index 96ecd0d429..cd42568395 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/elbv2" "github.com/hashicorp/errwrap" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" ) @@ -37,10 +38,18 @@ func resourceAwsAlbTargetGroup() *schema.Resource { }, "name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"name_prefix"}, + ValidateFunc: validateAwsAlbTargetGroupName, + }, + "name_prefix": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, - ValidateFunc: validateAwsAlbTargetGroupName, + ValidateFunc: validateAwsAlbTargetGroupNamePrefix, }, "port": { @@ -73,6 +82,7 @@ func resourceAwsAlbTargetGroup() *schema.Resource { "stickiness": { Type: schema.TypeList, Optional: true, + Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -171,8 +181,17 @@ func resourceAwsAlbTargetGroup() *schema.Resource { func resourceAwsAlbTargetGroupCreate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbv2conn + var groupName string + if v, ok := d.GetOk("name"); ok { + groupName = v.(string) + } else if v, ok := d.GetOk("name_prefix"); ok { + groupName = resource.PrefixedUniqueId(v.(string)) + } else { + groupName = resource.PrefixedUniqueId("tf-") + } + params := &elbv2.CreateTargetGroupInput{ - Name: aws.String(d.Get("name").(string)), + Name: aws.String(groupName), Port: aws.Int64(int64(d.Get("port").(int))), Protocol: aws.String(d.Get("protocol").(string)), VpcId: aws.String(d.Get("vpc_id").(string)), @@ -258,11 +277,19 @@ func resourceAwsAlbTargetGroupRead(d *schema.ResourceData, meta interface{}) err for _, attr := range attrResp.Attributes { switch *attr.Key { case "stickiness.enabled": - stickinessMap["enabled"] = *attr.Value + enabled, err := strconv.ParseBool(*attr.Value) + if err != nil { + return fmt.Errorf("Error converting stickiness.enabled to bool: %s", *attr.Value) + } + stickinessMap["enabled"] = enabled case "stickiness.type": stickinessMap["type"] = *attr.Value case "stickiness.lb_cookie.duration_seconds": - stickinessMap["cookie_duration"] = *attr.Value + duration, err := strconv.Atoi(*attr.Value) + if err != nil { + return fmt.Errorf("Error converting stickiness.lb_cookie.duration_seconds to int: %s", *attr.Value) + } + stickinessMap["cookie_duration"] = duration case "deregistration_delay.timeout_seconds": timeout, err := strconv.Atoi(*attr.Value) if err != nil { @@ -271,7 +298,24 @@ func resourceAwsAlbTargetGroupRead(d *schema.ResourceData, meta interface{}) err d.Set("deregistration_delay", timeout) } } - d.Set("stickiness", []interface{}{stickinessMap}) + + if err := d.Set("stickiness", []interface{}{stickinessMap}); err != nil { + return err + } + + tagsResp, err := elbconn.DescribeTags(&elbv2.DescribeTagsInput{ + ResourceArns: []*string{aws.String(d.Id())}, + }) + if err != nil { + return errwrap.Wrapf("Error retrieving Target Group Tags: {{err}}", err) + } + for _, t := range tagsResp.TagDescriptions { + if *t.ResourceArn == d.Id() { + if err := d.Set("tags", tagsToMapELBv2(t.Tags)); err != nil { + return err + } + } + } return nil } @@ -437,14 +481,6 @@ func validateAwsAlbTargetGroupHealthCheckProtocol(v interface{}, k string) (ws [ return } -func validateAwsAlbTargetGroupName(v interface{}, k string) (ws []string, errors []error) { - name := v.(string) - if len(name) > 32 { - errors = append(errors, fmt.Errorf("%q (%q) cannot be longer than '32' characters", k, name)) - } - return -} - func validateAwsAlbTargetGroupPort(v interface{}, k string) (ws []string, errors []error) { port := v.(int) if port < 1 || port > 65536 { diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment.go b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment.go index e6ba35b94c..55a3b73923 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment.go @@ -34,7 +34,7 @@ func resourceAwsAlbTargetGroupAttachment() *schema.Resource { "port": { Type: schema.TypeInt, ForceNew: true, - Required: true, + Optional: true, }, }, } @@ -43,18 +43,21 @@ func resourceAwsAlbTargetGroupAttachment() *schema.Resource { func resourceAwsAlbAttachmentCreate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbv2conn + target := &elbv2.TargetDescription{ + Id: aws.String(d.Get("target_id").(string)), + } + + if v, ok := d.GetOk("port"); ok { + target.Port = aws.Int64(int64(v.(int))) + } + params := &elbv2.RegisterTargetsInput{ TargetGroupArn: aws.String(d.Get("target_group_arn").(string)), - Targets: []*elbv2.TargetDescription{ - { - Id: aws.String(d.Get("target_id").(string)), - Port: aws.Int64(int64(d.Get("port").(int))), - }, - }, + Targets: []*elbv2.TargetDescription{target}, } - log.Printf("[INFO] Registering Target %s (%d) with Target Group %s", d.Get("target_id").(string), - d.Get("port").(int), d.Get("target_group_arn").(string)) + log.Printf("[INFO] Registering Target %s with Target Group %s", d.Get("target_id").(string), + d.Get("target_group_arn").(string)) _, err := elbconn.RegisterTargets(params) if err != nil { @@ -69,14 +72,17 @@ func resourceAwsAlbAttachmentCreate(d *schema.ResourceData, meta interface{}) er func resourceAwsAlbAttachmentDelete(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbv2conn + target := &elbv2.TargetDescription{ + Id: aws.String(d.Get("target_id").(string)), + } + + if v, ok := d.GetOk("port"); ok { + target.Port = aws.Int64(int64(v.(int))) + } + params := &elbv2.DeregisterTargetsInput{ TargetGroupArn: aws.String(d.Get("target_group_arn").(string)), - Targets: []*elbv2.TargetDescription{ - { - Id: aws.String(d.Get("target_id").(string)), - Port: aws.Int64(int64(d.Get("port").(int))), - }, - }, + Targets: []*elbv2.TargetDescription{target}, } _, err := elbconn.DeregisterTargets(params) @@ -93,14 +99,18 @@ func resourceAwsAlbAttachmentDelete(d *schema.ResourceData, meta interface{}) er // target, so there is no work to do beyond ensuring that the target and group still exist. func resourceAwsAlbAttachmentRead(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbv2conn + + target := &elbv2.TargetDescription{ + Id: aws.String(d.Get("target_id").(string)), + } + + if v, ok := d.GetOk("port"); ok { + target.Port = aws.Int64(int64(v.(int))) + } + resp, err := elbconn.DescribeTargetHealth(&elbv2.DescribeTargetHealthInput{ TargetGroupArn: aws.String(d.Get("target_group_arn").(string)), - Targets: []*elbv2.TargetDescription{ - { - Id: aws.String(d.Get("target_id").(string)), - Port: aws.Int64(int64(d.Get("port").(int))), - }, - }, + Targets: []*elbv2.TargetDescription{target}, }) if err != nil { if isTargetGroupNotFound(err) { diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment_test.go b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment_test.go index bd063516db..32369d5d52 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_attachment_test.go @@ -3,14 +3,15 @@ package aws import ( "errors" "fmt" + "strconv" + "testing" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/elbv2" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" - "strconv" - "testing" ) func TestAccAWSALBTargetGroupAttachment_basic(t *testing.T) { @@ -32,6 +33,25 @@ func TestAccAWSALBTargetGroupAttachment_basic(t *testing.T) { }) } +func TestAccAWSALBTargetGroupAttachment_withoutPort(t *testing.T) { + targetGroupName := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_alb_target_group.test", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBTargetGroupAttachmentDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBTargetGroupAttachmentConfigWithoutPort(targetGroupName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSALBTargetGroupAttachmentExists("aws_alb_target_group_attachment.test"), + ), + }, + }, + }) +} + func testAccCheckAWSALBTargetGroupAttachmentExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -45,15 +65,20 @@ func testAccCheckAWSALBTargetGroupAttachmentExists(n string) resource.TestCheckF conn := testAccProvider.Meta().(*AWSClient).elbv2conn - port, _ := strconv.Atoi(rs.Primary.Attributes["port"]) + _, hasPort := rs.Primary.Attributes["port"] + targetGroupArn, _ := rs.Primary.Attributes["target_group_arn"] + + target := &elbv2.TargetDescription{ + Id: aws.String(rs.Primary.Attributes["target_id"]), + } + if hasPort == true { + port, _ := strconv.Atoi(rs.Primary.Attributes["port"]) + target.Port = aws.Int64(int64(port)) + } + describe, err := conn.DescribeTargetHealth(&elbv2.DescribeTargetHealthInput{ - TargetGroupArn: aws.String(rs.Primary.Attributes["target_group_arn"]), - Targets: []*elbv2.TargetDescription{ - { - Id: aws.String(rs.Primary.Attributes["target_id"]), - Port: aws.Int64(int64(port)), - }, - }, + TargetGroupArn: aws.String(targetGroupArn), + Targets: []*elbv2.TargetDescription{target}, }) if err != nil { @@ -76,15 +101,20 @@ func testAccCheckAWSALBTargetGroupAttachmentDestroy(s *terraform.State) error { continue } - port, _ := strconv.Atoi(rs.Primary.Attributes["port"]) + _, hasPort := rs.Primary.Attributes["port"] + targetGroupArn, _ := rs.Primary.Attributes["target_group_arn"] + + target := &elbv2.TargetDescription{ + Id: aws.String(rs.Primary.Attributes["target_id"]), + } + if hasPort == true { + port, _ := strconv.Atoi(rs.Primary.Attributes["port"]) + target.Port = aws.Int64(int64(port)) + } + describe, err := conn.DescribeTargetHealth(&elbv2.DescribeTargetHealthInput{ - TargetGroupArn: aws.String(rs.Primary.Attributes["target_group_arn"]), - Targets: []*elbv2.TargetDescription{ - { - Id: aws.String(rs.Primary.Attributes["target_id"]), - Port: aws.Int64(int64(port)), - }, - }, + TargetGroupArn: aws.String(targetGroupArn), + Targets: []*elbv2.TargetDescription{target}, }) if err == nil { if len(describe.TargetHealthDescriptions) != 0 { @@ -103,6 +133,55 @@ func testAccCheckAWSALBTargetGroupAttachmentDestroy(s *terraform.State) error { return nil } +func testAccAWSALBTargetGroupAttachmentConfigWithoutPort(targetGroupName string) string { + return fmt.Sprintf(` +resource "aws_alb_target_group_attachment" "test" { + target_group_arn = "${aws_alb_target_group.test.arn}" + target_id = "${aws_instance.test.id}" +} + +resource "aws_instance" "test" { + ami = "ami-f701cb97" + instance_type = "t2.micro" + subnet_id = "${aws_subnet.subnet.id}" +} + +resource "aws_alb_target_group" "test" { + name = "%s" + port = 443 + protocol = "HTTPS" + vpc_id = "${aws_vpc.test.id}" + + deregistration_delay = 200 + + stickiness { + type = "lb_cookie" + cookie_duration = 10000 + } + + health_check { + path = "/health" + interval = 60 + port = 8081 + protocol = "HTTP" + timeout = 3 + healthy_threshold = 3 + unhealthy_threshold = 3 + matcher = "200-299" + } +} + +resource "aws_subnet" "subnet" { + cidr_block = "10.0.1.0/24" + vpc_id = "${aws_vpc.test.id}" + +} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" +}`, targetGroupName) +} + func testAccAWSALBTargetGroupAttachmentConfig_basic(targetGroupName string) string { return fmt.Sprintf(` resource "aws_alb_target_group_attachment" "test" { diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_test.go index 67d453e6cb..2045ffeb79 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb_target_group_test.go @@ -3,6 +3,7 @@ package aws import ( "errors" "fmt" + "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -77,6 +78,47 @@ func TestAccAWSALBTargetGroup_basic(t *testing.T) { resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.healthy_threshold", "3"), resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.unhealthy_threshold", "3"), resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.matcher", "200-299"), + resource.TestCheckResourceAttr("aws_alb_target_group.test", "tags.%", "1"), + resource.TestCheckResourceAttr("aws_alb_target_group.test", "tags.TestName", "TestAccAWSALBTargetGroup_basic"), + ), + }, + }, + }) +} + +func TestAccAWSALBTargetGroup_namePrefix(t *testing.T) { + var conf elbv2.TargetGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_alb_target_group.test", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBTargetGroupConfig_namePrefix, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &conf), + resource.TestMatchResourceAttr("aws_alb_target_group.test", "name", regexp.MustCompile("^tf-")), + ), + }, + }, + }) +} + +func TestAccAWSALBTargetGroup_generatedName(t *testing.T) { + var conf elbv2.TargetGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_alb_target_group.test", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBTargetGroupConfig_generatedName, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &conf), ), }, }, @@ -713,3 +755,28 @@ resource "aws_vpc" "test" { } }`, targetGroupName, stickinessBlock) } + +const testAccAWSALBTargetGroupConfig_namePrefix = ` +resource "aws_alb_target_group" "test" { + name_prefix = "tf-" + port = 80 + protocol = "HTTP" + vpc_id = "${aws_vpc.test.id}" +} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" +} +` + +const testAccAWSALBTargetGroupConfig_generatedName = ` +resource "aws_alb_target_group" "test" { + port = 80 + protocol = "HTTP" + vpc_id = "${aws_vpc.test.id}" +} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_alb_test.go b/installer/server/terraform/plugins/aws/resource_aws_alb_test.go index 3e50be3a08..807d1f4e5f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_alb_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_alb_test.go @@ -67,6 +67,7 @@ func TestAccAWSALB_basic(t *testing.T) { resource.TestCheckResourceAttr("aws_alb.alb_test", "tags.TestName", "TestAccAWSALB_basic"), resource.TestCheckResourceAttr("aws_alb.alb_test", "enable_deletion_protection", "false"), resource.TestCheckResourceAttr("aws_alb.alb_test", "idle_timeout", "30"), + resource.TestCheckResourceAttr("aws_alb.alb_test", "ip_address_type", "ipv4"), resource.TestCheckResourceAttrSet("aws_alb.alb_test", "vpc_id"), resource.TestCheckResourceAttrSet("aws_alb.alb_test", "zone_id"), resource.TestCheckResourceAttrSet("aws_alb.alb_test", "dns_name"), @@ -112,7 +113,7 @@ func TestAccAWSALB_namePrefix(t *testing.T) { testAccCheckAWSALBExists("aws_alb.alb_test", &conf), resource.TestCheckResourceAttrSet("aws_alb.alb_test", "name"), resource.TestMatchResourceAttr("aws_alb.alb_test", "name", - regexp.MustCompile("^tf-lb")), + regexp.MustCompile("^tf-lb-")), ), }, }, @@ -179,6 +180,63 @@ func TestAccAWSALB_updatedSecurityGroups(t *testing.T) { }) } +func TestAccAWSALB_updatedSubnets(t *testing.T) { + var pre, post elbv2.LoadBalancer + albName := fmt.Sprintf("testaccawsalb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_alb.alb_test", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBConfig_basic(albName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSALBExists("aws_alb.alb_test", &pre), + resource.TestCheckResourceAttr("aws_alb.alb_test", "subnets.#", "2"), + ), + }, + { + Config: testAccAWSALBConfig_updateSubnets(albName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSALBExists("aws_alb.alb_test", &post), + resource.TestCheckResourceAttr("aws_alb.alb_test", "subnets.#", "3"), + testAccCheckAWSAlbARNs(&pre, &post), + ), + }, + }, + }) +} + +func TestAccAWSALB_updatedIpAddressType(t *testing.T) { + var pre, post elbv2.LoadBalancer + albName := fmt.Sprintf("testaccawsalb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_alb.alb_test", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSALBDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSALBConfigWithIpAddressType(albName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSALBExists("aws_alb.alb_test", &pre), + resource.TestCheckResourceAttr("aws_alb.alb_test", "ip_address_type", "ipv4"), + ), + }, + { + Config: testAccAWSALBConfigWithIpAddressTypeUpdated(albName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSALBExists("aws_alb.alb_test", &post), + resource.TestCheckResourceAttr("aws_alb.alb_test", "ip_address_type", "dualstack"), + ), + }, + }, + }) +} + // TestAccAWSALB_noSecurityGroup regression tests the issue in #8264, // where if an ALB is created without a security group, a default one // is assigned. @@ -359,6 +417,228 @@ func testAccCheckAWSALBDestroy(s *terraform.State) error { return nil } +func testAccAWSALBConfigWithIpAddressTypeUpdated(albName string) string { + return fmt.Sprintf(`resource "aws_alb" "alb_test" { + name = "%s" + security_groups = ["${aws_security_group.alb_test.id}"] + subnets = ["${aws_subnet.alb_test_1.id}", "${aws_subnet.alb_test_2.id}"] + + ip_address_type = "dualstack" + + idle_timeout = 30 + enable_deletion_protection = false + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_alb_listener" "test" { + load_balancer_arn = "${aws_alb.alb_test.id}" + protocol = "HTTP" + port = "80" + + default_action { + target_group_arn = "${aws_alb_target_group.test.id}" + type = "forward" + } +} + +resource "aws_alb_target_group" "test" { + name = "%s" + port = 80 + protocol = "HTTP" + vpc_id = "${aws_vpc.alb_test.id}" + + deregistration_delay = 200 + + stickiness { + type = "lb_cookie" + cookie_duration = 10000 + } + + health_check { + path = "/health2" + interval = 30 + port = 8082 + protocol = "HTTPS" + timeout = 4 + healthy_threshold = 4 + unhealthy_threshold = 4 + matcher = "200" + } +} + +resource "aws_egress_only_internet_gateway" "igw" { + vpc_id = "${aws_vpc.alb_test.id}" +} + +resource "aws_vpc" "alb_test" { + cidr_block = "10.0.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_internet_gateway" "foo" { + vpc_id = "${aws_vpc.alb_test.id}" +} + +resource "aws_subnet" "alb_test_1" { + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "10.0.1.0/24" + map_public_ip_on_launch = true + availability_zone = "us-west-2a" + ipv6_cidr_block = "${cidrsubnet(aws_vpc.alb_test.ipv6_cidr_block, 8, 1)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_subnet" "alb_test_2" { + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "10.0.2.0/24" + map_public_ip_on_launch = true + availability_zone = "us-west-2b" + ipv6_cidr_block = "${cidrsubnet(aws_vpc.alb_test.ipv6_cidr_block, 8, 2)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_security_group" "alb_test" { + name = "allow_all_alb_test" + description = "Used for ALB Testing" + vpc_id = "${aws_vpc.alb_test.id}" + + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags { + TestName = "TestAccAWSALB_basic" + } +}`, albName, albName) +} + +func testAccAWSALBConfigWithIpAddressType(albName string) string { + return fmt.Sprintf(`resource "aws_alb" "alb_test" { + name = "%s" + security_groups = ["${aws_security_group.alb_test.id}"] + subnets = ["${aws_subnet.alb_test_1.id}", "${aws_subnet.alb_test_2.id}"] + + ip_address_type = "ipv4" + + idle_timeout = 30 + enable_deletion_protection = false + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_alb_listener" "test" { + load_balancer_arn = "${aws_alb.alb_test.id}" + protocol = "HTTP" + port = "80" + + default_action { + target_group_arn = "${aws_alb_target_group.test.id}" + type = "forward" + } +} + +resource "aws_alb_target_group" "test" { + name = "%s" + port = 80 + protocol = "HTTP" + vpc_id = "${aws_vpc.alb_test.id}" + + deregistration_delay = 200 + + stickiness { + type = "lb_cookie" + cookie_duration = 10000 + } + + health_check { + path = "/health2" + interval = 30 + port = 8082 + protocol = "HTTPS" + timeout = 4 + healthy_threshold = 4 + unhealthy_threshold = 4 + matcher = "200" + } +} + +resource "aws_egress_only_internet_gateway" "igw" { + vpc_id = "${aws_vpc.alb_test.id}" +} + +resource "aws_vpc" "alb_test" { + cidr_block = "10.0.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_internet_gateway" "foo" { + vpc_id = "${aws_vpc.alb_test.id}" +} + +resource "aws_subnet" "alb_test_1" { + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "10.0.1.0/24" + map_public_ip_on_launch = true + availability_zone = "us-west-2a" + ipv6_cidr_block = "${cidrsubnet(aws_vpc.alb_test.ipv6_cidr_block, 8, 1)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_subnet" "alb_test_2" { + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "10.0.2.0/24" + map_public_ip_on_launch = true + availability_zone = "us-west-2b" + ipv6_cidr_block = "${cidrsubnet(aws_vpc.alb_test.ipv6_cidr_block, 8, 2)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_security_group" "alb_test" { + name = "allow_all_alb_test" + description = "Used for ALB Testing" + vpc_id = "${aws_vpc.alb_test.id}" + + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags { + TestName = "TestAccAWSALB_basic" + } +}`, albName, albName) +} + func testAccAWSALBConfig_basic(albName string) string { return fmt.Sprintf(`resource "aws_alb" "alb_test" { name = "%s" @@ -426,6 +706,73 @@ resource "aws_security_group" "alb_test" { }`, albName) } +func testAccAWSALBConfig_updateSubnets(albName string) string { + return fmt.Sprintf(`resource "aws_alb" "alb_test" { + name = "%s" + internal = true + security_groups = ["${aws_security_group.alb_test.id}"] + subnets = ["${aws_subnet.alb_test.*.id}"] + + idle_timeout = 30 + enable_deletion_protection = false + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +variable "subnets" { + default = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] + type = "list" +} + +data "aws_availability_zones" "available" {} + +resource "aws_vpc" "alb_test" { + cidr_block = "10.0.0.0/16" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_subnet" "alb_test" { + count = 3 + vpc_id = "${aws_vpc.alb_test.id}" + cidr_block = "${element(var.subnets, count.index)}" + map_public_ip_on_launch = true + availability_zone = "${element(data.aws_availability_zones.available.names, count.index)}" + + tags { + TestName = "TestAccAWSALB_basic" + } +} + +resource "aws_security_group" "alb_test" { + name = "allow_all_alb_test" + description = "Used for ALB Testing" + vpc_id = "${aws_vpc.alb_test.id}" + + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags { + TestName = "TestAccAWSALB_basic" + } +}`, albName) +} + func testAccAWSALBConfig_generatedName() string { return fmt.Sprintf(` resource "aws_alb" "alb_test" { @@ -504,7 +851,7 @@ resource "aws_security_group" "alb_test" { func testAccAWSALBConfig_namePrefix() string { return fmt.Sprintf(` resource "aws_alb" "alb_test" { - name_prefix = "tf-lb" + name_prefix = "tf-lb-" internal = true security_groups = ["${aws_security_group.alb_test.id}"] subnets = ["${aws_subnet.alb_test.*.id}"] diff --git a/installer/server/terraform/plugins/aws/resource_aws_ami.go b/installer/server/terraform/plugins/aws/resource_aws_ami.go index 2a5c2b3a40..d01c402edd 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ami.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ami.go @@ -13,9 +13,17 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" ) +const ( + AWSAMIRetryTimeout = 40 * time.Minute + AWSAMIDeleteRetryTimeout = 90 * time.Minute + AWSAMIRetryDelay = 5 * time.Second + AWSAMIRetryMinTimeout = 3 * time.Second +) + func resourceAwsAmi() *schema.Resource { // Our schema is shared also with aws_ami_copy and aws_ami_from_instance resourceSchema := resourceAwsAmiCommonSchema(false) @@ -281,59 +289,77 @@ func resourceAwsAmiDelete(d *schema.ResourceData, meta interface{}) error { } } - d.SetId("") + // Verify that the image is actually removed, if not we need to wait for it to be removed + if err := resourceAwsAmiWaitForDestroy(d.Id(), client); err != nil { + return err + } + // No error, ami was deleted successfully + d.SetId("") return nil } -func resourceAwsAmiWaitForAvailable(id string, client *ec2.EC2) (*ec2.Image, error) { - log.Printf("Waiting for AMI %s to become available...", id) +func AMIStateRefreshFunc(client *ec2.EC2, id string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + emptyResp := &ec2.DescribeImagesOutput{} - req := &ec2.DescribeImagesInput{ - ImageIds: []*string{aws.String(id)}, - } - pollsWhereNotFound := 0 - for { - res, err := client.DescribeImages(req) + resp, err := client.DescribeImages(&ec2.DescribeImagesInput{ImageIds: []*string{aws.String(id)}}) if err != nil { - // When using RegisterImage (for aws_ami) the AMI sometimes isn't available at all - // right after the API responds, so we need to tolerate a couple Not Found errors - // before an available AMI shows up. if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidAMIID.NotFound" { - pollsWhereNotFound++ - // We arbitrarily stop polling after getting a "not found" error five times, - // assuming that the AMI has been deleted by something other than Terraform. - if pollsWhereNotFound > 5 { - return nil, fmt.Errorf("gave up waiting for AMI to be created: %s", err) - } - time.Sleep(4 * time.Second) - continue + return emptyResp, "destroyed", nil + } else if resp != nil && len(resp.Images) == 0 { + return emptyResp, "destroyed", nil + } else { + return emptyResp, "", fmt.Errorf("Error on refresh: %+v", err) } - return nil, fmt.Errorf("error reading AMI: %s", err) } - if len(res.Images) != 1 { - return nil, fmt.Errorf("new AMI vanished while pending") + if resp == nil || resp.Images == nil || len(resp.Images) == 0 { + return emptyResp, "destroyed", nil } - state := *res.Images[0].State + // AMI is valid, so return it's state + return resp.Images[0], *resp.Images[0].State, nil + } +} - if state == "pending" { - // Give it a few seconds before we poll again. - time.Sleep(4 * time.Second) - continue - } +func resourceAwsAmiWaitForDestroy(id string, client *ec2.EC2) error { + log.Printf("Waiting for AMI %s to be deleted...", id) - if state == "available" { - // We're done! - return res.Images[0], nil - } + stateConf := &resource.StateChangeConf{ + Pending: []string{"available", "pending", "failed"}, + Target: []string{"destroyed"}, + Refresh: AMIStateRefreshFunc(client, id), + Timeout: AWSAMIDeleteRetryTimeout, + Delay: AWSAMIRetryDelay, + MinTimeout: AWSAMIRetryTimeout, + } + + _, err := stateConf.WaitForState() + if err != nil { + return fmt.Errorf("Error waiting for AMI (%s) to be deleted: %v", id, err) + } + + return nil +} + +func resourceAwsAmiWaitForAvailable(id string, client *ec2.EC2) (*ec2.Image, error) { + log.Printf("Waiting for AMI %s to become available...", id) - // If we're not pending or available then we're in one of the invalid/error - // states, so stop polling and bail out. - stateReason := *res.Images[0].StateReason - return nil, fmt.Errorf("new AMI became %s while pending: %s", state, stateReason) + stateConf := &resource.StateChangeConf{ + Pending: []string{"pending"}, + Target: []string{"available"}, + Refresh: AMIStateRefreshFunc(client, id), + Timeout: AWSAMIRetryTimeout, + Delay: AWSAMIRetryDelay, + MinTimeout: AWSAMIRetryMinTimeout, + } + + info, err := stateConf.WaitForState() + if err != nil { + return nil, fmt.Errorf("Error waiting for AMI (%s) to be ready: %v", id, err) } + return info.(*ec2.Image), nil } func resourceAwsAmiCommonSchema(computed bool) map[string]*schema.Schema { diff --git a/installer/server/terraform/plugins/aws/resource_aws_ami_from_instance_test.go b/installer/server/terraform/plugins/aws/resource_aws_ami_from_instance_test.go index e7ead234f6..e130a6cbc5 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ami_from_instance_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ami_from_instance_test.go @@ -9,6 +9,7 @@ import ( "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/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -16,13 +17,14 @@ import ( func TestAccAWSAMIFromInstance(t *testing.T) { var amiId string snapshots := []string{} + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSAMIFromInstanceConfig, + { + Config: testAccAWSAMIFromInstanceConfig(rInt), Check: func(state *terraform.State) error { rs, ok := state.RootModule().Resources["aws_ami_from_instance.test"] if !ok { @@ -51,13 +53,13 @@ func TestAccAWSAMIFromInstance(t *testing.T) { image := describe.Images[0] if expected := "available"; *image.State != expected { - return fmt.Errorf("invalid image state; expected %v, got %v", expected, image.State) + return fmt.Errorf("invalid image state; expected %v, got %v", expected, *image.State) } if expected := "machine"; *image.ImageType != expected { - return fmt.Errorf("wrong image type; expected %v, got %v", expected, image.ImageType) + return fmt.Errorf("wrong image type; expected %v, got %v", expected, *image.ImageType) } - if expected := "terraform-acc-ami-from-instance"; *image.Name != expected { - return fmt.Errorf("wrong name; expected %v, got %v", expected, image.Name) + if expected := fmt.Sprintf("terraform-acc-ami-from-instance-%d", rInt); *image.Name != expected { + return fmt.Errorf("wrong name; expected %v, got %v", expected, *image.Name) } for _, bdm := range image.BlockDeviceMappings { @@ -137,24 +139,25 @@ func TestAccAWSAMIFromInstance(t *testing.T) { }) } -var testAccAWSAMIFromInstanceConfig = ` -provider "aws" { - region = "us-east-1" -} - -resource "aws_instance" "test" { - // This AMI has one block device mapping, so we expect to have - // one snapshot in our created AMI. - ami = "ami-408c7f28" - instance_type = "t1.micro" - tags { - Name = "testAccAWSAMIFromInstanceConfig_TestAMI" - } -} +func testAccAWSAMIFromInstanceConfig(rInt int) string { + return fmt.Sprintf(` + provider "aws" { + region = "us-east-1" + } + + resource "aws_instance" "test" { + // This AMI has one block device mapping, so we expect to have + // one snapshot in our created AMI. + ami = "ami-408c7f28" + instance_type = "t1.micro" + tags { + Name = "testAccAWSAMIFromInstanceConfig_TestAMI" + } + } -resource "aws_ami_from_instance" "test" { - name = "terraform-acc-ami-from-instance" - description = "Testing Terraform aws_ami_from_instance resource" - source_instance_id = "${aws_instance.test.id}" + resource "aws_ami_from_instance" "test" { + name = "terraform-acc-ami-from-instance-%d" + description = "Testing Terraform aws_ami_from_instance resource" + source_instance_id = "${aws_instance.test.id}" + }`, rInt) } -` diff --git a/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission.go b/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission.go index d1c738d393..278e9d9abf 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission.go @@ -2,7 +2,11 @@ package aws import ( "fmt" + "log" + "strings" + "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/hashicorp/terraform/helper/schema" ) @@ -92,6 +96,12 @@ func hasLaunchPermission(conn *ec2.EC2, image_id string, account_id string) (boo Attribute: aws.String("launchPermission"), }) if err != nil { + // When an AMI disappears out from under a launch permission resource, we will + // see either InvalidAMIID.NotFound or InvalidAMIID.Unavailable. + if ec2err, ok := err.(awserr.Error); ok && strings.HasPrefix(ec2err.Code(), "InvalidAMIID") { + log.Printf("[DEBUG] %s no longer exists, so we'll drop launch permission for %s from the state", image_id, account_id) + return false, nil + } return false, err } diff --git a/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission_test.go b/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission_test.go index 0affa91610..4ccb35c7cb 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ami_launch_permission_test.go @@ -2,15 +2,18 @@ package aws import ( "fmt" - r "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" "os" "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ec2" + r "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" ) func TestAccAWSAMILaunchPermission_Basic(t *testing.T) { - image_id := "" - account_id := os.Getenv("AWS_ACCOUNT_ID") + imageID := "" + accountID := os.Getenv("AWS_ACCOUNT_ID") r.Test(t, r.TestCase{ PreCheck: func() { @@ -23,18 +26,35 @@ func TestAccAWSAMILaunchPermission_Basic(t *testing.T) { Steps: []r.TestStep{ // Scaffold everything r.TestStep{ - Config: testAccAWSAMILaunchPermissionConfig(account_id, true), + Config: testAccAWSAMILaunchPermissionConfig(accountID, true), Check: r.ComposeTestCheckFunc( - testCheckResourceGetAttr("aws_ami_copy.test", "id", &image_id), - testAccAWSAMILaunchPermissionExists(account_id, &image_id), + testCheckResourceGetAttr("aws_ami_copy.test", "id", &imageID), + testAccAWSAMILaunchPermissionExists(accountID, &imageID), ), }, // Drop just launch permission to test destruction r.TestStep{ - Config: testAccAWSAMILaunchPermissionConfig(account_id, false), + Config: testAccAWSAMILaunchPermissionConfig(accountID, false), + Check: r.ComposeTestCheckFunc( + testAccAWSAMILaunchPermissionDestroyed(accountID, &imageID), + ), + }, + // Re-add everything so we can test when AMI disappears + r.TestStep{ + Config: testAccAWSAMILaunchPermissionConfig(accountID, true), + Check: r.ComposeTestCheckFunc( + testCheckResourceGetAttr("aws_ami_copy.test", "id", &imageID), + testAccAWSAMILaunchPermissionExists(accountID, &imageID), + ), + }, + // Here we delete the AMI to verify the follow-on refresh after this step + // should not error. + r.TestStep{ + Config: testAccAWSAMILaunchPermissionConfig(accountID, true), Check: r.ComposeTestCheckFunc( - testAccAWSAMILaunchPermissionDestroyed(account_id, &image_id), + testAccAWSAMIDisappears(&imageID), ), + ExpectNonEmptyPlan: true, }, }, }) @@ -58,31 +78,53 @@ func testCheckResourceGetAttr(name, key string, value *string) r.TestCheckFunc { } } -func testAccAWSAMILaunchPermissionExists(account_id string, image_id *string) r.TestCheckFunc { +func testAccAWSAMILaunchPermissionExists(accountID string, imageID *string) r.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ec2conn - if has, err := hasLaunchPermission(conn, *image_id, account_id); err != nil { + if has, err := hasLaunchPermission(conn, *imageID, accountID); err != nil { return err } else if !has { - return fmt.Errorf("launch permission does not exist for '%s' on '%s'", account_id, *image_id) + return fmt.Errorf("launch permission does not exist for '%s' on '%s'", accountID, *imageID) } return nil } } -func testAccAWSAMILaunchPermissionDestroyed(account_id string, image_id *string) r.TestCheckFunc { +func testAccAWSAMILaunchPermissionDestroyed(accountID string, imageID *string) r.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ec2conn - if has, err := hasLaunchPermission(conn, *image_id, account_id); err != nil { + if has, err := hasLaunchPermission(conn, *imageID, accountID); err != nil { return err } else if has { - return fmt.Errorf("launch permission still exists for '%s' on '%s'", account_id, *image_id) + return fmt.Errorf("launch permission still exists for '%s' on '%s'", accountID, *imageID) + } + return nil + } +} + +// testAccAWSAMIDisappears is technically a "test check function" but really it +// exists to perform a side effect of deleting an AMI out from under a resource +// so we can test that Terraform will react properly +func testAccAWSAMIDisappears(imageID *string) r.TestCheckFunc { + return func(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).ec2conn + req := &ec2.DeregisterImageInput{ + ImageId: aws.String(*imageID), + } + + _, err := conn.DeregisterImage(req) + if err != nil { + return err + } + + if err := resourceAwsAmiWaitForDestroy(*imageID, conn); err != nil { + return err } return nil } } -func testAccAWSAMILaunchPermissionConfig(account_id string, includeLaunchPermission bool) string { +func testAccAWSAMILaunchPermissionConfig(accountID string, includeLaunchPermission bool) string { base := ` resource "aws_ami_copy" "test" { name = "launch-permission-test" @@ -101,5 +143,5 @@ resource "aws_ami_launch_permission" "self-test" { image_id = "${aws_ami_copy.test.id}" account_id = "%s" } -`, account_id) +`, accountID) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key.go index fe606a5e0b..66a7154de8 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key.go +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key.go @@ -42,8 +42,9 @@ func resourceAwsApiGatewayApiKey() *schema.Resource { }, "stage_key": { - Type: schema.TypeSet, - Optional: true, + Type: schema.TypeSet, + Optional: true, + Deprecated: "Since the API Gateway usage plans feature was launched on August 11, 2016, usage plans are now required to associate an API key with an API stage", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "rest_api_id": { @@ -68,6 +69,15 @@ func resourceAwsApiGatewayApiKey() *schema.Resource { Type: schema.TypeString, Computed: true, }, + + "value": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Sensitive: true, + ValidateFunc: validateApiGatewayApiKeyValue, + }, }, } } @@ -80,6 +90,7 @@ func resourceAwsApiGatewayApiKeyCreate(d *schema.ResourceData, meta interface{}) Name: aws.String(d.Get("name").(string)), Description: aws.String(d.Get("description").(string)), Enabled: aws.Bool(d.Get("enabled").(bool)), + Value: aws.String(d.Get("value").(string)), StageKeys: expandApiGatewayStageKeys(d), }) if err != nil { @@ -96,7 +107,8 @@ func resourceAwsApiGatewayApiKeyRead(d *schema.ResourceData, meta interface{}) e log.Printf("[DEBUG] Reading API Gateway API Key: %s", d.Id()) apiKey, err := conn.GetApiKey(&apigateway.GetApiKeyInput{ - ApiKey: aws.String(d.Id()), + ApiKey: aws.String(d.Id()), + IncludeValue: aws.Bool(true), }) if err != nil { if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NotFoundException" { @@ -111,6 +123,7 @@ func resourceAwsApiGatewayApiKeyRead(d *schema.ResourceData, meta interface{}) e d.Set("description", apiKey.Description) d.Set("enabled", apiKey.Enabled) d.Set("stage_key", flattenApiGatewayStageKeys(apiKey.StageKeys)) + d.Set("value", apiKey.Value) if err := d.Set("created_date", apiKey.CreatedDate.Format(time.RFC3339)); err != nil { log.Printf("[DEBUG] Error setting created_date: %s", err) diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key_test.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key_test.go index cafb890ea4..a7d519ae68 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_api_key_test.go @@ -33,6 +33,8 @@ func TestAccAWSAPIGatewayApiKey_basic(t *testing.T) { "aws_api_gateway_api_key.test", "created_date"), resource.TestCheckResourceAttrSet( "aws_api_gateway_api_key.test", "last_updated_date"), + resource.TestCheckResourceAttr( + "aws_api_gateway_api_key.custom", "value", "MyCustomToken#@&\"'(§!ç)-_*$€¨^£%ù+=/:.;?,|"), ), }, }, @@ -176,4 +178,15 @@ resource "aws_api_gateway_api_key" "test" { stage_name = "${aws_api_gateway_deployment.test.stage_name}" } } + +resource "aws_api_gateway_api_key" "custom" { + name = "bar" + enabled = true + value = "MyCustomToken#@&\"'(§!ç)-_*$€¨^£%ù+=/:.;?,|" + + stage_key { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + stage_name = "${aws_api_gateway_deployment.test.stage_name}" + } +} ` diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_deployment.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_deployment.go index 494776288b..f4c1daf20a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_deployment.go +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_deployment.go @@ -54,6 +54,16 @@ func resourceAwsApiGatewayDeployment() *schema.Resource { Type: schema.TypeString, Computed: true, }, + + "invoke_url": { + Type: schema.TypeString, + Computed: true, + }, + + "execution_arn": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -90,8 +100,9 @@ func resourceAwsApiGatewayDeploymentRead(d *schema.ResourceData, meta interface{ conn := meta.(*AWSClient).apigateway log.Printf("[DEBUG] Reading API Gateway Deployment %s", d.Id()) + restApiId := d.Get("rest_api_id").(string) out, err := conn.GetDeployment(&apigateway.GetDeploymentInput{ - RestApiId: aws.String(d.Get("rest_api_id").(string)), + RestApiId: aws.String(restApiId), DeploymentId: aws.String(d.Id()), }) if err != nil { @@ -104,6 +115,18 @@ func resourceAwsApiGatewayDeploymentRead(d *schema.ResourceData, meta interface{ log.Printf("[DEBUG] Received API Gateway Deployment: %s", out) d.Set("description", out.Description) + region := meta.(*AWSClient).region + stageName := d.Get("stage_name").(string) + + d.Set("invoke_url", buildApiGatewayInvokeURL(restApiId, region, stageName)) + + accountId := meta.(*AWSClient).accountid + arn, err := buildApiGatewayExecutionARN(restApiId, region, accountId) + if err != nil { + return err + } + d.Set("execution_arn", arn+"/"+stageName) + if err := d.Set("created_date", out.CreatedDate.Format(time.RFC3339)); err != nil { log.Printf("[DEBUG] Error setting created_date: %s", err) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_domain_name.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_domain_name.go index 69f50fa8b0..be90c40ec5 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_domain_name.go +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_domain_name.go @@ -21,27 +21,35 @@ func resourceAwsApiGatewayDomainName() *schema.Resource { Schema: map[string]*schema.Schema{ + //According to AWS Documentation, ACM will be the only way to add certificates + //to ApiGateway DomainNames. When this happens, we will be deprecating all certificate methods + //except certificate_arn. We are not quite sure when this will happen. "certificate_body": { - Type: schema.TypeString, - ForceNew: true, - Required: true, + Type: schema.TypeString, + ForceNew: true, + Optional: true, + ConflictsWith: []string{"certificate_arn"}, }, "certificate_chain": { - Type: schema.TypeString, - ForceNew: true, - Required: true, + Type: schema.TypeString, + ForceNew: true, + Optional: true, + ConflictsWith: []string{"certificate_arn"}, }, "certificate_name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"certificate_arn"}, }, "certificate_private_key": { - Type: schema.TypeString, - ForceNew: true, - Required: true, + Type: schema.TypeString, + ForceNew: true, + Optional: true, + Sensitive: true, + ConflictsWith: []string{"certificate_arn"}, }, "domain_name": { @@ -50,6 +58,12 @@ func resourceAwsApiGatewayDomainName() *schema.Resource { ForceNew: true, }, + "certificate_arn": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"certificate_body", "certificate_chain", "certificate_name", "certificate_private_key"}, + }, + "cloudfront_domain_name": { Type: schema.TypeString, Computed: true, @@ -72,13 +86,31 @@ func resourceAwsApiGatewayDomainNameCreate(d *schema.ResourceData, meta interfac conn := meta.(*AWSClient).apigateway log.Printf("[DEBUG] Creating API Gateway Domain Name") - domainName, err := conn.CreateDomainName(&apigateway.CreateDomainNameInput{ - CertificateBody: aws.String(d.Get("certificate_body").(string)), - CertificateChain: aws.String(d.Get("certificate_chain").(string)), - CertificateName: aws.String(d.Get("certificate_name").(string)), - CertificatePrivateKey: aws.String(d.Get("certificate_private_key").(string)), - DomainName: aws.String(d.Get("domain_name").(string)), - }) + params := &apigateway.CreateDomainNameInput{ + DomainName: aws.String(d.Get("domain_name").(string)), + } + + if v, ok := d.GetOk("certificate_arn"); ok { + params.CertificateArn = aws.String(v.(string)) + } + + if v, ok := d.GetOk("certificate_name"); ok { + params.CertificateName = aws.String(v.(string)) + } + + if v, ok := d.GetOk("certificate_body"); ok { + params.CertificateBody = aws.String(v.(string)) + } + + if v, ok := d.GetOk("certificate_chain"); ok { + params.CertificateChain = aws.String(v.(string)) + } + + if v, ok := d.GetOk("certificate_private_key"); ok { + params.CertificatePrivateKey = aws.String(v.(string)) + } + + domainName, err := conn.CreateDomainName(params) if err != nil { return fmt.Errorf("Error creating API Gateway Domain Name: %s", err) } @@ -113,6 +145,7 @@ func resourceAwsApiGatewayDomainNameRead(d *schema.ResourceData, meta interface{ } d.Set("cloudfront_domain_name", domainName.DistributionDomainName) d.Set("domain_name", domainName.DomainName) + d.Set("certificate_arn", domainName.CertificateArn) return nil } @@ -128,6 +161,14 @@ func resourceAwsApiGatewayDomainNameUpdateOperations(d *schema.ResourceData) []* }) } + if d.HasChange("certificate_arn") { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/certificateArn"), + Value: aws.String(d.Get("certificate_arn").(string)), + }) + } + return operations } @@ -139,6 +180,7 @@ func resourceAwsApiGatewayDomainNameUpdate(d *schema.ResourceData, meta interfac DomainName: aws.String(d.Id()), PatchOperations: resourceAwsApiGatewayDomainNameUpdateOperations(d), }) + if err != nil { return err } diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration.go index b069828809..f782e11ea6 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration.go +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration.go @@ -11,87 +11,94 @@ import ( "github.com/aws/aws-sdk-go/service/apigateway" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" + "strings" ) func resourceAwsApiGatewayIntegration() *schema.Resource { return &schema.Resource{ Create: resourceAwsApiGatewayIntegrationCreate, Read: resourceAwsApiGatewayIntegrationRead, - Update: resourceAwsApiGatewayIntegrationCreate, + Update: resourceAwsApiGatewayIntegrationUpdate, Delete: resourceAwsApiGatewayIntegrationDelete, Schema: map[string]*schema.Schema{ - "rest_api_id": &schema.Schema{ + "rest_api_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "resource_id": &schema.Schema{ + "resource_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "http_method": &schema.Schema{ + "http_method": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateHTTPMethod, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateFunc: validateApiGatewayIntegrationType, }, - "uri": &schema.Schema{ + "uri": { Type: schema.TypeString, Optional: true, + ForceNew: true, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Optional: true, + ForceNew: true, }, - "integration_http_method": &schema.Schema{ + "integration_http_method": { Type: schema.TypeString, Optional: true, + ForceNew: true, ValidateFunc: validateHTTPMethod, }, - "request_templates": &schema.Schema{ + "request_templates": { Type: schema.TypeMap, Optional: true, Elem: schema.TypeString, }, - "request_parameters": &schema.Schema{ + "request_parameters": { Type: schema.TypeMap, Elem: schema.TypeString, Optional: true, ConflictsWith: []string{"request_parameters_in_json"}, }, - "request_parameters_in_json": &schema.Schema{ + "request_parameters_in_json": { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"request_parameters"}, Deprecated: "Use field request_parameters instead", }, - "content_handling": &schema.Schema{ + "content_handling": { Type: schema.TypeString, Optional: true, + ForceNew: true, ValidateFunc: validateApiGatewayIntegrationContentHandling, }, - "passthrough_behavior": &schema.Schema{ + "passthrough_behavior": { Type: schema.TypeString, Optional: true, Computed: true, + ForceNew: true, ValidateFunc: validateApiGatewayIntegrationPassthroughBehavior, }, }, @@ -101,6 +108,7 @@ func resourceAwsApiGatewayIntegration() *schema.Resource { func resourceAwsApiGatewayIntegrationCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).apigateway + log.Print("[DEBUG] Creating API Gateway Integration") var integrationHttpMethod *string if v, ok := d.GetOk("integration_http_method"); ok { integrationHttpMethod = aws.String(v.(string)) @@ -163,13 +171,13 @@ func resourceAwsApiGatewayIntegrationCreate(d *schema.ResourceData, meta interfa d.SetId(fmt.Sprintf("agi-%s-%s-%s", d.Get("rest_api_id").(string), d.Get("resource_id").(string), d.Get("http_method").(string))) - return nil + return resourceAwsApiGatewayIntegrationRead(d, meta) } func resourceAwsApiGatewayIntegrationRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).apigateway - log.Printf("[DEBUG] Reading API Gateway Integration %s", d.Id()) + log.Printf("[DEBUG] Reading API Gateway Integration: %s", d.Id()) integration, err := conn.GetIntegration(&apigateway.GetIntegrationInput{ HttpMethod: aws.String(d.Get("http_method").(string)), ResourceId: aws.String(d.Get("resource_id").(string)), @@ -191,17 +199,127 @@ func resourceAwsApiGatewayIntegrationRead(d *schema.ResourceData, meta interface } d.Set("request_templates", aws.StringValueMap(integration.RequestTemplates)) - d.Set("credentials", integration.Credentials) d.Set("type", integration.Type) - d.Set("uri", integration.Uri) d.Set("request_parameters", aws.StringValueMap(integration.RequestParameters)) d.Set("request_parameters_in_json", aws.StringValueMap(integration.RequestParameters)) d.Set("passthrough_behavior", integration.PassthroughBehavior) - d.Set("content_handling", integration.ContentHandling) + + if integration.Uri != nil { + d.Set("uri", integration.Uri) + } + + if integration.Credentials != nil { + d.Set("credentials", integration.Credentials) + } + + if integration.ContentHandling != nil { + d.Set("content_handling", integration.ContentHandling) + } return nil } +func resourceAwsApiGatewayIntegrationUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + + log.Printf("[DEBUG] Updating API Gateway Integration: %s", d.Id()) + operations := make([]*apigateway.PatchOperation, 0) + + // https://docs.aws.amazon.com/apigateway/api-reference/link-relation/integration-update/#remarks + // According to the above documentation, only a few parts are addable / removable. + if d.HasChange("request_templates") { + o, n := d.GetChange("request_templates") + prefix := "requestTemplates" + + os := o.(map[string]interface{}) + ns := n.(map[string]interface{}) + + // Handle Removal + for k := range os { + if _, ok := ns[k]; !ok { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("remove"), + Path: aws.String(fmt.Sprintf("/%s/%s", prefix, strings.Replace(k, "/", "~1", -1))), + }) + } + } + + for k, v := range ns { + // Handle replaces + if _, ok := os[k]; ok { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(fmt.Sprintf("/%s/%s", prefix, strings.Replace(k, "/", "~1", -1))), + Value: aws.String(v.(string)), + }) + } + + // Handle additions + if _, ok := os[k]; !ok { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String(fmt.Sprintf("/%s/%s", prefix, strings.Replace(k, "/", "~1", -1))), + Value: aws.String(v.(string)), + }) + } + } + } + + if d.HasChange("request_parameters") { + o, n := d.GetChange("request_parameters") + prefix := "requestParameters" + + os := o.(map[string]interface{}) + ns := n.(map[string]interface{}) + + // Handle Removal + for k := range os { + if _, ok := ns[k]; !ok { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("remove"), + Path: aws.String(fmt.Sprintf("/%s/%s", prefix, strings.Replace(k, "/", "~1", -1))), + }) + } + } + + for k, v := range ns { + // Handle replaces + if _, ok := os[k]; ok { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(fmt.Sprintf("/%s/%s", prefix, strings.Replace(k, "/", "~1", -1))), + Value: aws.String(v.(string)), + }) + } + + // Handle additions + if _, ok := os[k]; !ok { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String(fmt.Sprintf("/%s/%s", prefix, strings.Replace(k, "/", "~1", -1))), + Value: aws.String(v.(string)), + }) + } + } + } + + params := &apigateway.UpdateIntegrationInput{ + HttpMethod: aws.String(d.Get("http_method").(string)), + ResourceId: aws.String(d.Get("resource_id").(string)), + RestApiId: aws.String(d.Get("rest_api_id").(string)), + PatchOperations: operations, + } + + _, err := conn.UpdateIntegration(params) + if err != nil { + return fmt.Errorf("Error updating API Gateway Integration: %s", err) + } + + d.SetId(fmt.Sprintf("agi-%s-%s-%s", d.Get("rest_api_id").(string), d.Get("resource_id").(string), d.Get("http_method").(string))) + + return resourceAwsApiGatewayIntegrationRead(d, meta) +} + func resourceAwsApiGatewayIntegrationDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).apigateway log.Printf("[DEBUG] Deleting API Gateway Integration: %s", d.Id()) diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration_test.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration_test.go index 153ed13b41..ff9c233871 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_integration_test.go @@ -19,86 +19,78 @@ func TestAccAWSAPIGatewayIntegration_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSAPIGatewayIntegrationConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSAPIGatewayIntegrationExists("aws_api_gateway_integration.test", &conf), - testAccCheckAWSAPIGatewayIntegrationAttributes(&conf), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "type", "HTTP"), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "integration_http_method", "GET"), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "uri", "https://www.google.de"), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "request_templates.application/json", ""), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "request_templates.application/xml", "#set($inputRoot = $input.path('$'))\n{ }"), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "passthrough_behavior", "WHEN_NO_MATCH"), - resource.TestCheckNoResourceAttr( - "aws_api_gateway_integration.test", "content_handling"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "type", "HTTP"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "integration_http_method", "GET"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "uri", "https://www.google.de"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "passthrough_behavior", "WHEN_NO_MATCH"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "content_handling", "CONVERT_TO_TEXT"), + resource.TestCheckNoResourceAttr("aws_api_gateway_integration.test", "credentials"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.%", "2"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.integration.request.header.X-Authorization", "'static'"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.integration.request.header.X-Foo", "'Bar'"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.%", "2"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.application/json", ""), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.application/xml", "#set($inputRoot = $input.path('$'))\n{ }"), ), }, - resource.TestStep{ + { Config: testAccAWSAPIGatewayIntegrationConfigUpdate, Check: resource.ComposeTestCheckFunc( testAccCheckAWSAPIGatewayIntegrationExists("aws_api_gateway_integration.test", &conf), - testAccCheckAWSAPIGatewayMockIntegrationAttributes(&conf), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "type", "MOCK"), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "integration_http_method", ""), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "uri", ""), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "passthrough_behavior", "NEVER"), - resource.TestCheckResourceAttr( - "aws_api_gateway_integration.test", "content_handling", "CONVERT_TO_BINARY"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "type", "HTTP"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "integration_http_method", "GET"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "uri", "https://www.google.de"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "passthrough_behavior", "WHEN_NO_MATCH"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "content_handling", "CONVERT_TO_TEXT"), + resource.TestCheckNoResourceAttr("aws_api_gateway_integration.test", "credentials"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.%", "2"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.integration.request.header.X-Authorization", "'updated'"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.integration.request.header.X-FooBar", "'Baz'"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.%", "2"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.application/json", "{'foobar': 'bar}"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.text/html", "Foo"), ), }, - }, - }) -} -func testAccCheckAWSAPIGatewayMockIntegrationAttributes(conf *apigateway.Integration) resource.TestCheckFunc { - return func(s *terraform.State) error { - if *conf.Type != "MOCK" { - return fmt.Errorf("Wrong Type: %q", *conf.Type) - } - if *conf.RequestParameters["integration.request.header.X-Authorization"] != "'updated'" { - return fmt.Errorf("wrong updated RequestParameters for header.X-Authorization") - } - if *conf.ContentHandling != "CONVERT_TO_BINARY" { - return fmt.Errorf("wrong ContentHandling: %q", *conf.ContentHandling) - } - return nil - } -} + { + Config: testAccAWSAPIGatewayIntegrationConfigUpdateNoTemplates, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayIntegrationExists("aws_api_gateway_integration.test", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "type", "HTTP"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "integration_http_method", "GET"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "uri", "https://www.google.de"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "passthrough_behavior", "WHEN_NO_MATCH"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "content_handling", "CONVERT_TO_TEXT"), + resource.TestCheckNoResourceAttr("aws_api_gateway_integration.test", "credentials"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.%", "0"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.%", "0"), + ), + }, -func testAccCheckAWSAPIGatewayIntegrationAttributes(conf *apigateway.Integration) resource.TestCheckFunc { - return func(s *terraform.State) error { - if *conf.HttpMethod == "" { - return fmt.Errorf("empty HttpMethod") - } - if *conf.Uri != "https://www.google.de" { - return fmt.Errorf("wrong Uri") - } - if *conf.Type != "HTTP" { - return fmt.Errorf("wrong Type") - } - if conf.RequestTemplates["application/json"] != nil { - return fmt.Errorf("wrong RequestTemplate for application/json") - } - if *conf.RequestTemplates["application/xml"] != "#set($inputRoot = $input.path('$'))\n{ }" { - return fmt.Errorf("wrong RequestTemplate for application/xml") - } - if *conf.RequestParameters["integration.request.header.X-Authorization"] != "'static'" { - return fmt.Errorf("wrong RequestParameters for header.X-Authorization") - } - return nil - } + { + Config: testAccAWSAPIGatewayIntegrationConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayIntegrationExists("aws_api_gateway_integration.test", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "type", "HTTP"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "integration_http_method", "GET"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "uri", "https://www.google.de"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "passthrough_behavior", "WHEN_NO_MATCH"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "content_handling", "CONVERT_TO_TEXT"), + resource.TestCheckNoResourceAttr("aws_api_gateway_integration.test", "credentials"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.%", "2"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_parameters.integration.request.header.X-Authorization", "'static'"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.%", "2"), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.application/json", ""), + resource.TestCheckResourceAttr("aws_api_gateway_integration.test", "request_templates.application/xml", "#set($inputRoot = $input.path('$'))\n{ }"), + ), + }, + }, + }) } func testAccCheckAWSAPIGatewayIntegrationExists(n string, res *apigateway.Integration) resource.TestCheckFunc { @@ -196,13 +188,15 @@ resource "aws_api_gateway_integration" "test" { } request_parameters = { - "integration.request.header.X-Authorization" = "'static'" + "integration.request.header.X-Authorization" = "'static'" + "integration.request.header.X-Foo" = "'Bar'" } type = "HTTP" uri = "https://www.google.de" integration_http_method = "GET" passthrough_behavior = "WHEN_NO_MATCH" + content_handling = "CONVERT_TO_TEXT" } ` @@ -233,13 +227,55 @@ resource "aws_api_gateway_integration" "test" { resource_id = "${aws_api_gateway_resource.test.id}" http_method = "${aws_api_gateway_method.test.http_method}" + request_templates = { + "application/json" = "{'foobar': 'bar}" + "text/html" = "Foo" + } + request_parameters = { - "integration.request.header.X-Authorization" = "'updated'" + "integration.request.header.X-Authorization" = "'updated'" + "integration.request.header.X-FooBar" = "'Baz'" } - type = "MOCK" - passthrough_behavior = "NEVER" - content_handling = "CONVERT_TO_BINARY" + type = "HTTP" + uri = "https://www.google.de" + integration_http_method = "GET" + passthrough_behavior = "WHEN_NO_MATCH" + content_handling = "CONVERT_TO_TEXT" +} +` + +const testAccAWSAPIGatewayIntegrationConfigUpdateNoTemplates = ` +resource "aws_api_gateway_rest_api" "test" { + name = "test" +} + +resource "aws_api_gateway_resource" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + parent_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + path_part = "test" +} + +resource "aws_api_gateway_method" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "GET" + authorization = "NONE" + request_models = { + "application/json" = "Error" + } +} + +resource "aws_api_gateway_integration" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_method.test.http_method}" + + type = "HTTP" + uri = "https://www.google.de" + integration_http_method = "GET" + passthrough_behavior = "WHEN_NO_MATCH" + content_handling = "CONVERT_TO_TEXT" } ` diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings.go new file mode 100644 index 0000000000..06d5efd014 --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings.go @@ -0,0 +1,248 @@ +package aws + +import ( + "fmt" + "log" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/apigateway" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsApiGatewayMethodSettings() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsApiGatewayMethodSettingsUpdate, + Read: resourceAwsApiGatewayMethodSettingsRead, + Update: resourceAwsApiGatewayMethodSettingsUpdate, + Delete: resourceAwsApiGatewayMethodSettingsDelete, + + Schema: map[string]*schema.Schema{ + "rest_api_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "stage_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "method_path": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "settings": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "metrics_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + "logging_level": { + Type: schema.TypeString, + Optional: true, + }, + "data_trace_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + "throttling_burst_limit": { + Type: schema.TypeInt, + Optional: true, + }, + "throttling_rate_limit": { + Type: schema.TypeFloat, + Optional: true, + }, + "caching_enabled": { + Type: schema.TypeBool, + Optional: true, + }, + "cache_ttl_in_seconds": { + Type: schema.TypeInt, + Optional: true, + }, + "cache_data_encrypted": { + Type: schema.TypeBool, + Optional: true, + }, + "require_authorization_for_cache_control": { + Type: schema.TypeBool, + Optional: true, + }, + "unauthorized_cache_control_header_strategy": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + } +} + +func resourceAwsApiGatewayMethodSettingsRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + + log.Printf("[DEBUG] Reading API Gateway Method Settings %s", d.Id()) + input := apigateway.GetStageInput{ + RestApiId: aws.String(d.Get("rest_api_id").(string)), + StageName: aws.String(d.Get("stage_name").(string)), + } + stage, err := conn.GetStage(&input) + if err != nil { + if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NotFoundException" { + log.Printf("[WARN] API Gateway Stage %s not found, removing method settings", d.Id()) + d.SetId("") + return nil + } + return err + } + log.Printf("[DEBUG] Received API Gateway Stage: %s", stage) + + methodPath := d.Get("method_path").(string) + settings, ok := stage.MethodSettings[methodPath] + if !ok { + log.Printf("[WARN] API Gateway Method Settings for %q not found, removing", methodPath) + d.SetId("") + return nil + } + + d.Set("settings.0.metrics_enabled", settings.MetricsEnabled) + d.Set("settings.0.logging_level", settings.LoggingLevel) + d.Set("settings.0.data_trace_enabled", settings.DataTraceEnabled) + d.Set("settings.0.throttling_burst_limit", settings.ThrottlingBurstLimit) + d.Set("settings.0.throttling_rate_limit", settings.ThrottlingRateLimit) + d.Set("settings.0.caching_enabled", settings.CachingEnabled) + d.Set("settings.0.cache_ttl_in_seconds", settings.CacheTtlInSeconds) + d.Set("settings.0.cache_data_encrypted", settings.CacheDataEncrypted) + d.Set("settings.0.require_authorization_for_cache_control", settings.RequireAuthorizationForCacheControl) + d.Set("settings.0.unauthorized_cache_control_header_strategy", settings.UnauthorizedCacheControlHeaderStrategy) + + return nil +} + +func resourceAwsApiGatewayMethodSettingsUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + + methodPath := d.Get("method_path").(string) + prefix := fmt.Sprintf("/%s/", methodPath) + + ops := make([]*apigateway.PatchOperation, 0) + if d.HasChange("settings.0.metrics_enabled") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "metrics/enabled"), + Value: aws.String(fmt.Sprintf("%t", d.Get("settings.0.metrics_enabled").(bool))), + }) + } + if d.HasChange("settings.0.logging_level") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "logging/loglevel"), + Value: aws.String(d.Get("settings.0.logging_level").(string)), + }) + } + if d.HasChange("settings.0.data_trace_enabled") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "logging/dataTrace"), + Value: aws.String(fmt.Sprintf("%t", d.Get("settings.0.data_trace_enabled").(bool))), + }) + } + + if d.HasChange("settings.0.throttling_burst_limit") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "throttling/burstLimit"), + Value: aws.String(fmt.Sprintf("%d", d.Get("settings.0.throttling_burst_limit").(int))), + }) + } + if d.HasChange("settings.0.throttling_rate_limit") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "throttling/rateLimit"), + Value: aws.String(fmt.Sprintf("%f", d.Get("settings.0.throttling_rate_limit").(float64))), + }) + } + if d.HasChange("settings.0.caching_enabled") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "caching/enabled"), + Value: aws.String(fmt.Sprintf("%t", d.Get("settings.0.caching_enabled").(bool))), + }) + } + if d.HasChange("settings.0.cache_ttl_in_seconds") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "caching/ttlInSeconds"), + Value: aws.String(fmt.Sprintf("%d", d.Get("settings.0.cache_ttl_in_seconds").(int))), + }) + } + if d.HasChange("settings.0.cache_data_encrypted") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "caching/dataEncrypted"), + Value: aws.String(fmt.Sprintf("%d", d.Get("settings.0.cache_data_encrypted").(int))), + }) + } + if d.HasChange("settings.0.require_authorization_for_cache_control") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "caching/requireAuthorizationForCacheControl"), + Value: aws.String(fmt.Sprintf("%t", d.Get("settings.0.require_authorization_for_cache_control").(bool))), + }) + } + if d.HasChange("settings.0.unauthorized_cache_control_header_strategy") { + ops = append(ops, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String(prefix + "caching/unauthorizedCacheControlHeaderStrategy"), + Value: aws.String(d.Get("settings.0.unauthorized_cache_control_header_strategy").(string)), + }) + } + + restApiId := d.Get("rest_api_id").(string) + stageName := d.Get("stage_name").(string) + input := apigateway.UpdateStageInput{ + RestApiId: aws.String(restApiId), + StageName: aws.String(stageName), + PatchOperations: ops, + } + log.Printf("[DEBUG] Updating API Gateway Stage: %s", input) + _, err := conn.UpdateStage(&input) + if err != nil { + return fmt.Errorf("Updating API Gateway Stage failed: %s", err) + } + + d.SetId(restApiId + "-" + stageName + "-" + methodPath) + + return resourceAwsApiGatewayMethodSettingsRead(d, meta) +} + +func resourceAwsApiGatewayMethodSettingsDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + log.Printf("[DEBUG] Deleting API Gateway Method Settings: %s", d.Id()) + + input := apigateway.UpdateStageInput{ + RestApiId: aws.String(d.Get("rest_api_id").(string)), + StageName: aws.String(d.Get("stage_name").(string)), + PatchOperations: []*apigateway.PatchOperation{ + { + Op: aws.String("remove"), + Path: aws.String(fmt.Sprintf("/%s", d.Get("method_path").(string))), + }, + }, + } + log.Printf("[DEBUG] Updating API Gateway Stage: %s", input) + _, err := conn.UpdateStage(&input) + if err != nil { + return fmt.Errorf("Updating API Gateway Stage failed: %s", err) + } + + return nil +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings_test.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings_test.go new file mode 100644 index 0000000000..9372a6748c --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_method_settings_test.go @@ -0,0 +1,265 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/apigateway" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAWSAPIGatewayMethodSettings_basic(t *testing.T) { + var stage apigateway.Stage + rInt := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSAPIGatewayMethodSettingsConfig(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayMethodSettingsExists("aws_api_gateway_method_settings.test", &stage), + testAccCheckAWSAPIGatewayMethodSettings_metricsEnabled(&stage, "test/GET", true), + testAccCheckAWSAPIGatewayMethodSettings_loggingLevel(&stage, "test/GET", "INFO"), + resource.TestCheckResourceAttr("aws_api_gateway_method_settings.test", "settings.#", "1"), + resource.TestCheckResourceAttr("aws_api_gateway_method_settings.test", "settings.0.metrics_enabled", "true"), + resource.TestCheckResourceAttr("aws_api_gateway_method_settings.test", "settings.0.logging_level", "INFO"), + ), + }, + + { + Config: testAccAWSAPIGatewayMethodSettingsConfigUpdate(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayMethodSettingsExists("aws_api_gateway_method_settings.test", &stage), + testAccCheckAWSAPIGatewayMethodSettings_metricsEnabled(&stage, "test/GET", false), + testAccCheckAWSAPIGatewayMethodSettings_loggingLevel(&stage, "test/GET", "OFF"), + resource.TestCheckResourceAttr("aws_api_gateway_method_settings.test", "settings.#", "1"), + resource.TestCheckResourceAttr("aws_api_gateway_method_settings.test", "settings.0.metrics_enabled", "false"), + resource.TestCheckResourceAttr("aws_api_gateway_method_settings.test", "settings.0.logging_level", "OFF"), + ), + }, + }, + }) +} + +func testAccCheckAWSAPIGatewayMethodSettings_metricsEnabled(conf *apigateway.Stage, path string, expected bool) resource.TestCheckFunc { + return func(s *terraform.State) error { + settings, ok := conf.MethodSettings[path] + if !ok { + return fmt.Errorf("Expected to find method settings for %q", path) + } + + if expected && *settings.MetricsEnabled != expected { + return fmt.Errorf("Expected metrics to be enabled, got %t", *settings.MetricsEnabled) + } + if !expected && *settings.MetricsEnabled != expected { + return fmt.Errorf("Expected metrics to be disabled, got %t", *settings.MetricsEnabled) + } + + return nil + } +} + +func testAccCheckAWSAPIGatewayMethodSettings_loggingLevel(conf *apigateway.Stage, path string, expectedLevel string) resource.TestCheckFunc { + return func(s *terraform.State) error { + settings, ok := conf.MethodSettings[path] + if !ok { + return fmt.Errorf("Expected to find method settings for %q", path) + } + + if *settings.LoggingLevel != expectedLevel { + return fmt.Errorf("Expected logging level to match %q, got %q", expectedLevel, *settings.LoggingLevel) + } + + return nil + } +} + +func testAccCheckAWSAPIGatewayMethodSettingsExists(n string, res *apigateway.Stage) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No API Gateway Stage ID is set") + } + + conn := testAccProvider.Meta().(*AWSClient).apigateway + + req := &apigateway.GetStageInput{ + StageName: aws.String(s.RootModule().Resources["aws_api_gateway_deployment.test"].Primary.Attributes["stage_name"]), + RestApiId: aws.String(s.RootModule().Resources["aws_api_gateway_rest_api.test"].Primary.ID), + } + out, err := conn.GetStage(req) + if err != nil { + return err + } + + *res = *out + + return nil + } +} + +func testAccCheckAWSAPIGatewayMethodSettingsDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).apigateway + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_api_gateway_method_settings" { + continue + } + + req := &apigateway.GetStageInput{ + StageName: aws.String(s.RootModule().Resources["aws_api_gateway_deployment.test"].Primary.Attributes["stage_name"]), + RestApiId: aws.String(s.RootModule().Resources["aws_api_gateway_rest_api.test"].Primary.ID), + } + out, err := conn.GetStage(req) + if err == nil { + return fmt.Errorf("API Gateway Stage still exists: %s", out) + } + + awsErr, ok := err.(awserr.Error) + if !ok { + return err + } + if awsErr.Code() != "NotFoundException" { + return err + } + + return nil + } + + return nil +} + +func testAccAWSAPIGatewayMethodSettingsConfig(rInt int) string { + return fmt.Sprintf(` +resource "aws_api_gateway_rest_api" "test" { + name = "tf-acc-test-apig-method-%d" +} + +resource "aws_api_gateway_resource" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + parent_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + path_part = "test" +} + +resource "aws_api_gateway_method" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "GET" + authorization = "NONE" + + request_models = { + "application/json" = "Error" + } + + request_parameters = { + "method.request.header.Content-Type" = false, + "method.request.querystring.page" = true + } +} + +resource "aws_api_gateway_integration" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_method.test.http_method}" + type = "MOCK" + + request_templates { + "application/xml" = < 0 { + params.ApiStages = as + } + } + + if v, ok := d.GetOk("quota_settings"); ok { + settings := v.(*schema.Set).List() + q, ok := settings[0].(map[string]interface{}) + + if errors := validateApiGatewayUsagePlanQuotaSettings(q); len(errors) > 0 { + return fmt.Errorf("Error validating the quota settings: %v", errors) + } + + if !ok { + return errors.New("At least one field is expected inside quota_settings") + } + + qs := &apigateway.QuotaSettings{} + + if sv, ok := q["limit"].(int); ok { + qs.Limit = aws.Int64(int64(sv)) + } + + if sv, ok := q["offset"].(int); ok { + qs.Offset = aws.Int64(int64(sv)) + } + + if sv, ok := q["period"].(string); ok && sv != "" { + qs.Period = aws.String(sv) + } + + params.Quota = qs + } + + if v, ok := d.GetOk("throttle_settings"); ok { + settings := v.(*schema.Set).List() + q, ok := settings[0].(map[string]interface{}) + + if !ok { + return errors.New("At least one field is expected inside throttle_settings") + } + + ts := &apigateway.ThrottleSettings{} + + if sv, ok := q["burst_limit"].(int); ok { + ts.BurstLimit = aws.Int64(int64(sv)) + } + + if sv, ok := q["rate_limit"].(float64); ok { + ts.RateLimit = aws.Float64(float64(sv)) + } + + params.Throttle = ts + } + + up, err := conn.CreateUsagePlan(params) + if err != nil { + return fmt.Errorf("Error creating API Gateway Usage Plan: %s", err) + } + + d.SetId(*up.Id) + + // Handle case of adding the product code since not addable when + // creating the Usage Plan initially. + if v, ok := d.GetOk("product_code"); ok { + updateParameters := &apigateway.UpdateUsagePlanInput{ + UsagePlanId: aws.String(d.Id()), + PatchOperations: []*apigateway.PatchOperation{ + { + Op: aws.String("add"), + Path: aws.String("/productCode"), + Value: aws.String(v.(string)), + }, + }, + } + + up, err = conn.UpdateUsagePlan(updateParameters) + if err != nil { + return fmt.Errorf("Error creating the API Gateway Usage Plan product code: %s", err) + } + } + + return resourceAwsApiGatewayUsagePlanRead(d, meta) +} + +func resourceAwsApiGatewayUsagePlanRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + log.Printf("[DEBUG] Reading API Gateway Usage Plan: %s", d.Id()) + + up, err := conn.GetUsagePlan(&apigateway.GetUsagePlanInput{ + UsagePlanId: aws.String(d.Id()), + }) + if err != nil { + if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NotFoundException" { + d.SetId("") + return nil + } + return err + } + + d.Set("name", up.Name) + d.Set("description", up.Description) + d.Set("product_code", up.ProductCode) + + if up.ApiStages != nil { + if err := d.Set("api_stages", flattenApiGatewayUsageApiStages(up.ApiStages)); err != nil { + return fmt.Errorf("[DEBUG] Error setting api_stages error: %#v", err) + } + } + + if up.Throttle != nil { + if err := d.Set("throttle_settings", flattenApiGatewayUsagePlanThrottling(up.Throttle)); err != nil { + return fmt.Errorf("[DEBUG] Error setting throttle_settings error: %#v", err) + } + } + + if up.Quota != nil { + if err := d.Set("quota_settings", flattenApiGatewayUsagePlanQuota(up.Quota)); err != nil { + return fmt.Errorf("[DEBUG] Error setting quota_settings error: %#v", err) + } + } + + return nil +} + +func resourceAwsApiGatewayUsagePlanUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + log.Print("[DEBUG] Updating API Gateway Usage Plan") + + operations := make([]*apigateway.PatchOperation, 0) + + if d.HasChange("name") { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/name"), + Value: aws.String(d.Get("name").(string)), + }) + } + + if d.HasChange("description") { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/description"), + Value: aws.String(d.Get("description").(string)), + }) + } + + if d.HasChange("product_code") { + v, ok := d.GetOk("product_code") + + if ok { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/productCode"), + Value: aws.String(v.(string)), + }) + } else { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("remove"), + Path: aws.String("/productCode"), + }) + } + } + + if d.HasChange("api_stages") { + o, n := d.GetChange("api_stages") + old := o.([]interface{}) + new := n.([]interface{}) + + // Remove every stages associated. Simpler to remove and add new ones, + // since there are no replacings. + for _, v := range old { + m := v.(map[string]interface{}) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("remove"), + Path: aws.String("/apiStages"), + Value: aws.String(fmt.Sprintf("%s:%s", m["api_id"].(string), m["stage"].(string))), + }) + } + + // Handle additions + if len(new) > 0 { + for _, v := range new { + m := v.(map[string]interface{}) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String("/apiStages"), + Value: aws.String(fmt.Sprintf("%s:%s", m["api_id"].(string), m["stage"].(string))), + }) + } + } + } + + if d.HasChange("throttle_settings") { + o, n := d.GetChange("throttle_settings") + + os := o.(*schema.Set) + ns := n.(*schema.Set) + diff := ns.Difference(os).List() + + // Handle Removal + if len(diff) == 0 { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("remove"), + Path: aws.String("/throttle"), + }) + } + + if len(diff) > 0 { + d := diff[0].(map[string]interface{}) + + // Handle Replaces + if o != nil && n != nil { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/throttle/rateLimit"), + Value: aws.String(strconv.Itoa(d["rate_limit"].(int))), + }) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/throttle/burstLimit"), + Value: aws.String(strconv.Itoa(d["burst_limit"].(int))), + }) + } + + // Handle Additions + if o == nil && n != nil { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String("/throttle/rateLimit"), + Value: aws.String(strconv.Itoa(d["rate_limit"].(int))), + }) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String("/throttle/burstLimit"), + Value: aws.String(strconv.Itoa(d["burst_limit"].(int))), + }) + } + } + } + + if d.HasChange("quota_settings") { + o, n := d.GetChange("quota_settings") + + os := o.(*schema.Set) + ns := n.(*schema.Set) + diff := ns.Difference(os).List() + + // Handle Removal + if len(diff) == 0 { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("remove"), + Path: aws.String("/quota"), + }) + } + + if len(diff) > 0 { + d := diff[0].(map[string]interface{}) + + if errors := validateApiGatewayUsagePlanQuotaSettings(d); len(errors) > 0 { + return fmt.Errorf("Error validating the quota settings: %v", errors) + } + + // Handle Replaces + if o != nil && n != nil { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/quota/limit"), + Value: aws.String(strconv.Itoa(d["limit"].(int))), + }) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/quota/offset"), + Value: aws.String(strconv.Itoa(d["offset"].(int))), + }) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("replace"), + Path: aws.String("/quota/period"), + Value: aws.String(d["period"].(string)), + }) + } + + // Handle Additions + if o == nil && n != nil { + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String("/quota/limit"), + Value: aws.String(strconv.Itoa(d["limit"].(int))), + }) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String("/quota/offset"), + Value: aws.String(strconv.Itoa(d["offset"].(int))), + }) + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("add"), + Path: aws.String("/quota/period"), + Value: aws.String(d["period"].(string)), + }) + } + } + } + + params := &apigateway.UpdateUsagePlanInput{ + UsagePlanId: aws.String(d.Id()), + PatchOperations: operations, + } + + _, err := conn.UpdateUsagePlan(params) + if err != nil { + return fmt.Errorf("Error updating API Gateway Usage Plan: %s", err) + } + + return resourceAwsApiGatewayUsagePlanRead(d, meta) +} + +func resourceAwsApiGatewayUsagePlanDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + + // Removing existing api stages associated + if apistages, ok := d.GetOk("api_stages"); ok { + log.Printf("[DEBUG] Deleting API Stages associated with Usage Plan: %s", d.Id()) + stages := apistages.([]interface{}) + operations := []*apigateway.PatchOperation{} + + for _, v := range stages { + sv := v.(map[string]interface{}) + + operations = append(operations, &apigateway.PatchOperation{ + Op: aws.String("remove"), + Path: aws.String("/apiStages"), + Value: aws.String(fmt.Sprintf("%s:%s", sv["api_id"].(string), sv["stage"].(string))), + }) + } + + _, err := conn.UpdateUsagePlan(&apigateway.UpdateUsagePlanInput{ + UsagePlanId: aws.String(d.Id()), + PatchOperations: operations, + }) + if err != nil { + return fmt.Errorf("Error removing API Stages associated with Usage Plan: %s", err) + } + } + + log.Printf("[DEBUG] Deleting API Gateway Usage Plan: %s", d.Id()) + + return resource.Retry(5*time.Minute, func() *resource.RetryError { + _, err := conn.DeleteUsagePlan(&apigateway.DeleteUsagePlanInput{ + UsagePlanId: aws.String(d.Id()), + }) + + if err == nil { + return nil + } + + return resource.NonRetryableError(err) + }) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key.go new file mode 100644 index 0000000000..75e7bbefde --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key.go @@ -0,0 +1,112 @@ +package aws + +import ( + "fmt" + "log" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/apigateway" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsApiGatewayUsagePlanKey() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsApiGatewayUsagePlanKeyCreate, + Read: resourceAwsApiGatewayUsagePlanKeyRead, + Delete: resourceAwsApiGatewayUsagePlanKeyDelete, + + Schema: map[string]*schema.Schema{ + "key_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "key_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "usage_plan_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "name": { + Type: schema.TypeString, + Computed: true, + }, + + "value": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAwsApiGatewayUsagePlanKeyCreate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + log.Print("[DEBUG] Creating API Gateway Usage Plan Key") + + params := &apigateway.CreateUsagePlanKeyInput{ + KeyId: aws.String(d.Get("key_id").(string)), + KeyType: aws.String(d.Get("key_type").(string)), + UsagePlanId: aws.String(d.Get("usage_plan_id").(string)), + } + + up, err := conn.CreateUsagePlanKey(params) + if err != nil { + return fmt.Errorf("Error creating API Gateway Usage Plan Key: %s", err) + } + + d.SetId(*up.Id) + + return resourceAwsApiGatewayUsagePlanKeyRead(d, meta) +} + +func resourceAwsApiGatewayUsagePlanKeyRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + log.Printf("[DEBUG] Reading API Gateway Usage Plan Key: %s", d.Id()) + + up, err := conn.GetUsagePlanKey(&apigateway.GetUsagePlanKeyInput{ + UsagePlanId: aws.String(d.Get("usage_plan_id").(string)), + KeyId: aws.String(d.Get("key_id").(string)), + }) + if err != nil { + if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NotFoundException" { + d.SetId("") + return nil + } + return err + } + + d.Set("name", up.Name) + d.Set("value", up.Value) + + return nil +} + +func resourceAwsApiGatewayUsagePlanKeyDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).apigateway + + log.Printf("[DEBUG] Deleting API Gateway Usage Plan Key: %s", d.Id()) + + return resource.Retry(5*time.Minute, func() *resource.RetryError { + _, err := conn.DeleteUsagePlanKey(&apigateway.DeleteUsagePlanKeyInput{ + UsagePlanId: aws.String(d.Get("usage_plan_id").(string)), + KeyId: aws.String(d.Get("key_id").(string)), + }) + + if err == nil { + return nil + } + + return resource.NonRetryableError(err) + }) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key_test.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key_test.go new file mode 100644 index 0000000000..608a88fd2a --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_key_test.go @@ -0,0 +1,232 @@ +package aws + +import ( + "fmt" + "log" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/apigateway" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAWSAPIGatewayUsagePlanKey_basic(t *testing.T) { + var conf apigateway.UsagePlanKey + name := acctest.RandString(10) + updatedName := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanKeyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSApiGatewayUsagePlanKeyBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanKeyExists("aws_api_gateway_usage_plan_key.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan_key.main", "key_type", "API_KEY"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "key_id"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "key_type"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "usage_plan_id"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "name"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan_key.main", "value", ""), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanKeyBasicUpdatedConfig(updatedName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanKeyExists("aws_api_gateway_usage_plan_key.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan_key.main", "key_type", "API_KEY"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "key_id"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "key_type"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "usage_plan_id"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "name"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan_key.main", "value", ""), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanKeyBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanKeyExists("aws_api_gateway_usage_plan_key.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan_key.main", "key_type", "API_KEY"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "key_id"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "key_type"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "usage_plan_id"), + resource.TestCheckResourceAttrSet("aws_api_gateway_usage_plan_key.main", "name"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan_key.main", "value", ""), + ), + }, + }, + }) +} + +func testAccCheckAWSAPIGatewayUsagePlanKeyExists(n string, res *apigateway.UsagePlanKey) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No API Gateway Usage Plan Key ID is set") + } + + conn := testAccProvider.Meta().(*AWSClient).apigateway + + req := &apigateway.GetUsagePlanKeyInput{ + UsagePlanId: aws.String(rs.Primary.Attributes["usage_plan_id"]), + KeyId: aws.String(rs.Primary.Attributes["key_id"]), + } + up, err := conn.GetUsagePlanKey(req) + if err != nil { + return err + } + + log.Printf("[DEBUG] Reading API Gateway Usage Plan Key: %#v", up) + + if *up.Id != rs.Primary.ID { + return fmt.Errorf("API Gateway Usage Plan Key not found") + } + + *res = *up + + return nil + } +} + +func testAccCheckAWSAPIGatewayUsagePlanKeyDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).apigateway + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_api_gateway_usage_plan_key" { + continue + } + + req := &apigateway.GetUsagePlanKeyInput{ + UsagePlanId: aws.String(rs.Primary.ID), + KeyId: aws.String(rs.Primary.Attributes["key_id"]), + } + describe, err := conn.GetUsagePlanKey(req) + + if err == nil { + if describe.Id != nil && *describe.Id == rs.Primary.ID { + return fmt.Errorf("API Gateway Usage Plan Key still exists") + } + } + + aws2err, ok := err.(awserr.Error) + if !ok { + return err + } + if aws2err.Code() != "NotFoundException" { + return err + } + + return nil + } + + return nil +} + +const testAccAWSAPIGatewayUsagePlanKeyConfig = ` +resource "aws_api_gateway_rest_api" "test" { + name = "test" +} + +resource "aws_api_gateway_resource" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + parent_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + path_part = "test" +} + +resource "aws_api_gateway_method" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "GET" + authorization = "NONE" +} + +resource "aws_api_gateway_method_response" "error" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_method.test.http_method}" + status_code = "400" +} + +resource "aws_api_gateway_integration" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_method.test.http_method}" + + type = "HTTP" + uri = "https://www.google.de" + integration_http_method = "GET" +} + +resource "aws_api_gateway_integration_response" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_integration.test.http_method}" + status_code = "${aws_api_gateway_method_response.error.status_code}" +} + +resource "aws_api_gateway_deployment" "test" { + depends_on = ["aws_api_gateway_integration.test"] + + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + stage_name = "test" + description = "This is a test" + + variables = { + "a" = "2" + } +} + +resource "aws_api_gateway_deployment" "foo" { + depends_on = ["aws_api_gateway_integration.test"] + + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + stage_name = "foo" + description = "This is a prod stage" +} + +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" +} + +resource "aws_api_gateway_usage_plan" "secondary" { + name = "secondary-%s" +} + +resource "aws_api_gateway_api_key" "mykey" { + name = "demo-%s" + + stage_key { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + stage_name = "${aws_api_gateway_deployment.foo.stage_name}" + } +} +` + +func testAccAWSApiGatewayUsagePlanKeyBasicConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanKeyConfig+` +resource "aws_api_gateway_usage_plan_key" "main" { + key_id = "${aws_api_gateway_api_key.mykey.id}" + key_type = "API_KEY" + usage_plan_id = "${aws_api_gateway_usage_plan.main.id}" +} +`, rName, rName, rName) +} + +func testAccAWSApiGatewayUsagePlanKeyBasicUpdatedConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanKeyConfig+` +resource "aws_api_gateway_usage_plan_key" "main" { + key_id = "${aws_api_gateway_api_key.mykey.id}" + key_type = "API_KEY" + usage_plan_id = "${aws_api_gateway_usage_plan.secondary.id}" +} +`, rName, rName, rName) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_test.go b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_test.go new file mode 100644 index 0000000000..13d7afc2db --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_api_gateway_usage_plan_test.go @@ -0,0 +1,557 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/apigateway" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAWSAPIGatewayUsagePlan_basic(t *testing.T) { + var conf apigateway.UsagePlan + name := acctest.RandString(10) + updatedName := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanBasicUpdatedConfig(updatedName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", updatedName), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""), + ), + }, + }, + }) +} + +func TestAccAWSAPIGatewayUsagePlan_description(t *testing.T) { + var conf apigateway.UsagePlan + name := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanDescriptionConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", "This is a description"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanDescriptionUpdatedConfig(name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", "This is a new description"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanDescriptionConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", "This is a description"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "description", ""), + ), + }, + }, + }) +} + +func TestAccAWSAPIGatewayUsagePlan_productCode(t *testing.T) { + var conf apigateway.UsagePlan + name := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", ""), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanProductCodeConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", "MYCODE"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanProductCodeUpdatedConfig(name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", "MYCODE2"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanProductCodeConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", "MYCODE"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "product_code", ""), + ), + }, + }, + }) +} + +func TestAccAWSAPIGatewayUsagePlan_throttling(t *testing.T) { + var conf apigateway.UsagePlan + name := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanThrottlingConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.4173790118.burst_limit", "2"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.4173790118.rate_limit", "5"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanThrottlingModifiedConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.1779463053.burst_limit", "3"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings.1779463053.rate_limit", "6"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "throttle_settings"), + ), + }, + }, + }) +} + +func TestAccAWSAPIGatewayUsagePlan_quota(t *testing.T) { + var conf apigateway.UsagePlan + name := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanQuotaConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.1956747625.limit", "100"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.1956747625.offset", "6"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.1956747625.period", "WEEK"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanQuotaModifiedConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.3909168194.limit", "200"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.3909168194.offset", "20"), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings.3909168194.period", "MONTH"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "quota_settings"), + ), + }, + }, + }) +} + +func TestAccAWSAPIGatewayUsagePlan_apiStages(t *testing.T) { + var conf apigateway.UsagePlan + name := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, + Steps: []resource.TestStep{ + // Create UsagePlan WITH Stages as the API calls are different + // when creating or updating. + { + Config: testAccAWSApiGatewayUsagePlanApiStagesConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "api_stages.0.stage", "test"), + ), + }, + // Handle api stages removal + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "api_stages"), + ), + }, + // Handle api stages additions + { + Config: testAccAWSApiGatewayUsagePlanApiStagesConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "api_stages.0.stage", "test"), + ), + }, + // Handle api stages updates + { + Config: testAccAWSApiGatewayUsagePlanApiStagesModifiedConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "api_stages.0.stage", "foo"), + ), + }, + { + Config: testAccAWSApiGatewayUsagePlanBasicConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayUsagePlanExists("aws_api_gateway_usage_plan.main", &conf), + resource.TestCheckResourceAttr("aws_api_gateway_usage_plan.main", "name", name), + resource.TestCheckNoResourceAttr("aws_api_gateway_usage_plan.main", "api_stages"), + ), + }, + }, + }) +} + +func testAccCheckAWSAPIGatewayUsagePlanExists(n string, res *apigateway.UsagePlan) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No API Gateway Usage Plan ID is set") + } + + conn := testAccProvider.Meta().(*AWSClient).apigateway + + req := &apigateway.GetUsagePlanInput{ + UsagePlanId: aws.String(rs.Primary.ID), + } + up, err := conn.GetUsagePlan(req) + if err != nil { + return err + } + + if *up.Id != rs.Primary.ID { + return fmt.Errorf("APIGateway Usage Plan not found") + } + + *res = *up + + return nil + } +} + +func testAccCheckAWSAPIGatewayUsagePlanDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).apigateway + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_api_gateway_usage_plan" { + continue + } + + req := &apigateway.GetUsagePlanInput{ + UsagePlanId: aws.String(s.RootModule().Resources["aws_api_gateway_rest_api.test"].Primary.ID), + } + describe, err := conn.GetUsagePlan(req) + + if err == nil { + if describe.Id != nil && *describe.Id == rs.Primary.ID { + return fmt.Errorf("API Gateway Usage Plan still exists") + } + } + + aws2err, ok := err.(awserr.Error) + if !ok { + return err + } + if aws2err.Code() != "NotFoundException" { + return err + } + + return nil + } + + return nil +} + +const testAccAWSAPIGatewayUsagePlanConfig = ` +resource "aws_api_gateway_rest_api" "test" { + name = "test" +} + +resource "aws_api_gateway_resource" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + parent_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + path_part = "test" +} + +resource "aws_api_gateway_method" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "GET" + authorization = "NONE" +} + +resource "aws_api_gateway_method_response" "error" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_method.test.http_method}" + status_code = "400" +} + +resource "aws_api_gateway_integration" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_method.test.http_method}" + + type = "HTTP" + uri = "https://www.google.de" + integration_http_method = "GET" +} + +resource "aws_api_gateway_integration_response" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_resource.test.id}" + http_method = "${aws_api_gateway_integration.test.http_method}" + status_code = "${aws_api_gateway_method_response.error.status_code}" +} + +resource "aws_api_gateway_deployment" "test" { + depends_on = ["aws_api_gateway_integration.test"] + + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + stage_name = "test" + description = "This is a test" + + variables = { + "a" = "2" + } +} + +resource "aws_api_gateway_deployment" "foo" { + depends_on = ["aws_api_gateway_integration.test"] + + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + stage_name = "foo" + description = "This is a prod stage" +} +` + +func testAccAWSApiGatewayUsagePlanBasicConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanDescriptionConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + description = "This is a description" +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanDescriptionUpdatedConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + description = "This is a new description" +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanProductCodeConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + product_code = "MYCODE" +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanProductCodeUpdatedConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + product_code = "MYCODE2" +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanBasicUpdatedConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanThrottlingConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + + throttle_settings { + burst_limit = 2 + rate_limit = 5 + } +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanThrottlingModifiedConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + + throttle_settings { + burst_limit = 3 + rate_limit = 6 + } +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanQuotaConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + + quota_settings { + limit = 100 + offset = 6 + period = "WEEK" + } +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanQuotaModifiedConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + + quota_settings { + limit = 200 + offset = 20 + period = "MONTH" + } +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanApiStagesConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + + api_stages { + api_id = "${aws_api_gateway_rest_api.test.id}" + stage = "${aws_api_gateway_deployment.test.stage_name}" + } +} +`, rName) +} + +func testAccAWSApiGatewayUsagePlanApiStagesModifiedConfig(rName string) string { + return fmt.Sprintf(testAccAWSAPIGatewayUsagePlanConfig+` +resource "aws_api_gateway_usage_plan" "main" { + name = "%s" + + api_stages { + api_id = "${aws_api_gateway_rest_api.test.id}" + stage = "${aws_api_gateway_deployment.foo.stage_name}" + } +} +`, rName) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target.go b/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target.go index 90ef0c93d0..2490f4d2de 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target.go +++ b/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target.go @@ -20,33 +20,33 @@ func resourceAwsAppautoscalingTarget() *schema.Resource { Delete: resourceAwsAppautoscalingTargetDelete, Schema: map[string]*schema.Schema{ - "max_capacity": &schema.Schema{ + "max_capacity": { Type: schema.TypeInt, Required: true, ForceNew: true, }, - "min_capacity": &schema.Schema{ + "min_capacity": { Type: schema.TypeInt, Required: true, ForceNew: true, }, - "resource_id": &schema.Schema{ + "resource_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "role_arn": &schema.Schema{ + "role_arn": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "scalable_dimension": &schema.Schema{ + "scalable_dimension": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validateAppautoscalingScalableDimension, }, - "service_namespace": &schema.Schema{ + "service_namespace": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -116,12 +116,6 @@ func resourceAwsAppautoscalingTargetRead(d *schema.ResourceData, meta interface{ return nil } -// Updating Target is not supported -// func getAwsAppautoscalingTargetUpdate(d *schema.ResourceData, meta interface{}) error { -// conn := meta.(*AWSClient).appautoscalingconn - -// } - func resourceAwsAppautoscalingTargetDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).appautoscalingconn diff --git a/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target_test.go b/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target_test.go index 313534fce1..f61484d19b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_appautoscaling_target_test.go @@ -23,7 +23,7 @@ func TestAccAWSAppautoScalingTarget_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSAppautoscalingTargetConfig(randClusterName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAppautoscalingTargetExists("aws_appautoscaling_target.bar", &target), @@ -34,7 +34,7 @@ func TestAccAWSAppautoScalingTarget_basic(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccAWSAppautoscalingTargetConfigUpdate(randClusterName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAppautoscalingTargetExists("aws_appautoscaling_target.bar", &target), @@ -55,7 +55,7 @@ func TestAccAWSAppautoScalingTarget_spotFleetRequest(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSAppautoscalingTargetSpotFleetRequestConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSAppautoscalingTargetExists("aws_appautoscaling_target.test", &target), @@ -67,6 +67,27 @@ func TestAccAWSAppautoScalingTarget_spotFleetRequest(t *testing.T) { }) } +func TestAccAWSAppautoScalingTarget_emrCluster(t *testing.T) { + var target applicationautoscaling.ScalableTarget + rInt := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSAppautoscalingTargetEmrClusterConfig(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAppautoscalingTargetExists("aws_appautoscaling_target.bar", &target), + resource.TestCheckResourceAttr("aws_appautoscaling_target.bar", "service_namespace", "elasticmapreduce"), + resource.TestCheckResourceAttr("aws_appautoscaling_target.bar", "scalable_dimension", "elasticmapreduce:instancegroup:InstanceCount"), + ), + }, + }, + }) +} + func testAccCheckAWSAppautoscalingTargetDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appautoscalingconn @@ -327,6 +348,317 @@ resource "aws_appautoscaling_target" "bar" { `, randClusterName, randClusterName, randClusterName) } +func testAccAWSAppautoscalingTargetEmrClusterConfig(rInt int) string { + return fmt.Sprintf(` +resource "aws_emr_cluster" "tf-test-cluster" { + name = "emr-test-%d" + release_label = "emr-4.6.0" + applications = ["Spark"] + + ec2_attributes { + subnet_id = "${aws_subnet.main.id}" + emr_managed_master_security_group = "${aws_security_group.allow_all.id}" + emr_managed_slave_security_group = "${aws_security_group.allow_all.id}" + instance_profile = "${aws_iam_instance_profile.emr_profile.arn}" + } + + master_instance_type = "m3.xlarge" + core_instance_type = "m3.xlarge" + core_instance_count = 2 + + tags { + role = "rolename" + dns_zone = "env_zone" + env = "env" + name = "name-env" + } + + keep_job_flow_alive_when_no_steps = true + + bootstrap_action { + path = "s3://elasticmapreduce/bootstrap-actions/run-if" + name = "runif" + args = ["instance.isMaster=true", "echo running on master node"] + } + + configurations = "test-fixtures/emr_configurations.json" + + depends_on = ["aws_main_route_table_association.a"] + + service_role = "${aws_iam_role.iam_emr_default_role.arn}" + autoscaling_role = "${aws_iam_role.emr-autoscaling-role.arn}" +} + +resource "aws_emr_instance_group" "task" { + cluster_id = "${aws_emr_cluster.tf-test-cluster.id}" + instance_count = 1 + instance_type = "m3.xlarge" +} + +resource "aws_security_group" "allow_all" { + name = "allow_all_%d" + description = "Allow all inbound traffic" + vpc_id = "${aws_vpc.main.id}" + + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + depends_on = ["aws_subnet.main"] + + lifecycle { + ignore_changes = ["ingress", "egress"] + } + + tags { + name = "emr_test" + } +} + +resource "aws_vpc" "main" { + cidr_block = "168.31.0.0/16" + enable_dns_hostnames = true + + tags { + name = "emr_test_%d" + } +} + +resource "aws_subnet" "main" { + vpc_id = "${aws_vpc.main.id}" + cidr_block = "168.31.0.0/20" + + tags { + name = "emr_test_%d" + } +} + +resource "aws_internet_gateway" "gw" { + vpc_id = "${aws_vpc.main.id}" +} + +resource "aws_route_table" "r" { + vpc_id = "${aws_vpc.main.id}" + + route { + cidr_block = "0.0.0.0/0" + gateway_id = "${aws_internet_gateway.gw.id}" + } +} + +resource "aws_main_route_table_association" "a" { + vpc_id = "${aws_vpc.main.id}" + route_table_id = "${aws_route_table.r.id}" +} + +resource "aws_iam_role" "iam_emr_default_role" { + name = "iam_emr_default_role_%d" + + assume_role_policy = < 229 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 229 characters, name is limited to 255", k)) + } + return + }, + }, - "launch_configuration": &schema.Schema{ + "launch_configuration": { Type: schema.TypeString, Required: true, }, - "desired_capacity": &schema.Schema{ + "desired_capacity": { Type: schema.TypeInt, Optional: true, Computed: true, }, - "min_elb_capacity": &schema.Schema{ + "min_elb_capacity": { Type: schema.TypeInt, Optional: true, }, - "min_size": &schema.Schema{ + "min_size": { Type: schema.TypeInt, Required: true, }, - "max_size": &schema.Schema{ + "max_size": { Type: schema.TypeInt, Required: true, }, - "default_cooldown": &schema.Schema{ + "default_cooldown": { Type: schema.TypeInt, Optional: true, Computed: true, }, - "force_delete": &schema.Schema{ + "force_delete": { Type: schema.TypeBool, Optional: true, Default: false, }, - "health_check_grace_period": &schema.Schema{ + "health_check_grace_period": { Type: schema.TypeInt, Optional: true, Default: 300, }, - "health_check_type": &schema.Schema{ + "health_check_type": { Type: schema.TypeString, Optional: true, Computed: true, }, - "availability_zones": &schema.Schema{ + "availability_zones": { Type: schema.TypeSet, Optional: true, Computed: true, @@ -102,12 +116,12 @@ func resourceAwsAutoscalingGroup() *schema.Resource { Set: schema.HashString, }, - "placement_group": &schema.Schema{ + "placement_group": { Type: schema.TypeString, Optional: true, }, - "load_balancers": &schema.Schema{ + "load_balancers": { Type: schema.TypeSet, Optional: true, Computed: true, @@ -115,7 +129,7 @@ func resourceAwsAutoscalingGroup() *schema.Resource { Set: schema.HashString, }, - "vpc_zone_identifier": &schema.Schema{ + "vpc_zone_identifier": { Type: schema.TypeSet, Optional: true, Computed: true, @@ -123,13 +137,13 @@ func resourceAwsAutoscalingGroup() *schema.Resource { Set: schema.HashString, }, - "termination_policies": &schema.Schema{ + "termination_policies": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "wait_for_capacity_timeout": &schema.Schema{ + "wait_for_capacity_timeout": { Type: schema.TypeString, Optional: true, Default: "10m", @@ -148,12 +162,12 @@ func resourceAwsAutoscalingGroup() *schema.Resource { }, }, - "wait_for_elb_capacity": &schema.Schema{ + "wait_for_elb_capacity": { Type: schema.TypeInt, Optional: true, }, - "enabled_metrics": &schema.Schema{ + "enabled_metrics": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -167,31 +181,32 @@ func resourceAwsAutoscalingGroup() *schema.Resource { Set: schema.HashString, }, - "metrics_granularity": &schema.Schema{ + "metrics_granularity": { Type: schema.TypeString, Optional: true, Default: "1Minute", }, - "protect_from_scale_in": &schema.Schema{ + "protect_from_scale_in": { Type: schema.TypeBool, Optional: true, Default: false, }, - "target_group_arns": &schema.Schema{ + "target_group_arns": { Type: schema.TypeSet, Optional: true, + Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "arn": &schema.Schema{ + "arn": { Type: schema.TypeString, Computed: true, }, - "initial_lifecycle_hook": &schema.Schema{ + "initial_lifecycle_hook": { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -288,7 +303,11 @@ func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{}) if v, ok := d.GetOk("name"); ok { asgName = v.(string) } else { - asgName = resource.PrefixedUniqueId("tf-asg-") + if v, ok := d.GetOk("name_prefix"); ok { + asgName = resource.PrefixedUniqueId(v.(string)) + } else { + asgName = resource.PrefixedUniqueId("tf-asg-") + } d.Set("name", asgName) } @@ -439,6 +458,7 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e d.Set("health_check_type", g.HealthCheckType) d.Set("launch_configuration", g.LaunchConfigurationName) d.Set("load_balancers", flattenStringList(g.LoadBalancerNames)) + if err := d.Set("suspended_processes", flattenAsgSuspendedProcesses(g.SuspendedProcesses)); err != nil { log.Printf("[WARN] Error setting suspended_processes for %q: %s", d.Id(), err) } @@ -464,8 +484,17 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e if v, ok := d.GetOk("tags"); ok { tags := map[string]struct{}{} for _, tag := range v.([]interface{}) { - attr := tag.(map[string]interface{}) - tags[attr["key"].(string)] = struct{}{} + attr, ok := tag.(map[string]interface{}) + if !ok { + continue + } + + key, ok := attr["key"].(string) + if !ok { + continue + } + + tags[key] = struct{}{} } for _, t := range g.Tags { diff --git a/installer/server/terraform/plugins/aws/resource_aws_autoscaling_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_autoscaling_group_test.go index ae380858cf..a8c8eafb69 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_autoscaling_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_autoscaling_group_test.go @@ -88,6 +88,27 @@ func TestAccAWSAutoScalingGroup_basic(t *testing.T) { }) } +func TestAccAWSAutoScalingGroup_namePrefix(t *testing.T) { + nameRegexp := regexp.MustCompile("^test-") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSAutoScalingGroupConfig_namePrefix, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "aws_autoscaling_group.test", "name", nameRegexp), + resource.TestCheckResourceAttrSet( + "aws_autoscaling_group.test", "arn"), + ), + }, + }, + }) +} + func TestAccAWSAutoScalingGroup_autoGeneratedName(t *testing.T) { asgNameRegexp := regexp.MustCompile("^tf-asg-") @@ -440,15 +461,6 @@ func TestAccAWSAutoScalingGroup_ALB_TargetGroups(t *testing.T) { "aws_autoscaling_group.bar", "target_group_arns.#", "1"), ), }, - - resource.TestStep{ - Config: testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_pre, - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSAutoScalingGroupExists("aws_autoscaling_group.bar", &group), - resource.TestCheckResourceAttr( - "aws_autoscaling_group.bar", "target_group_arns.#", "0"), - ), - }, }, }) } @@ -488,13 +500,15 @@ func TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity(t *testing.T) { var group autoscaling.Group var tg elbv2.TargetGroup + rInt := acctest.RandInt() + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_ELBCapacity, + Config: testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_ELBCapacity(rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSAutoScalingGroupExists("aws_autoscaling_group.bar", &group), testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &tg), @@ -574,8 +588,8 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.Group, name st } t := &autoscaling.TagDescription{ - Key: aws.String("Foo"), - Value: aws.String("foo-bar"), + Key: aws.String("FromTag"), + Value: aws.String("value1"), PropagateAtLaunch: aws.Bool(true), ResourceType: aws.String("auto-scaling-group"), ResourceId: group.AutoScalingGroupName, @@ -762,6 +776,22 @@ resource "aws_autoscaling_group" "bar" { } ` +const testAccAWSAutoScalingGroupConfig_namePrefix = ` +resource "aws_launch_configuration" "test" { + image_id = "ami-21f78e11" + instance_type = "t1.micro" +} + +resource "aws_autoscaling_group" "test" { + availability_zones = ["us-west-2a"] + desired_capacity = 0 + max_size = 0 + min_size = 0 + name_prefix = "test-" + launch_configuration = "${aws_launch_configuration.test.name}" +} +` + const testAccAWSAutoScalingGroupConfig_terminationPoliciesEmpty = ` resource "aws_launch_configuration" "foobar" { image_id = "ami-21f78e11" @@ -853,6 +883,25 @@ resource "aws_autoscaling_group" "bar" { value = "value3" propagate_at_launch = true }, + { + key = "invalid1" + propagate_at_launch = true + }, + { + value = "invalid2" + propagate_at_launch = true + }, + { + value = "invalid3" + }, + { + key = "invalid4" + }, + { + propagate_at_launch = true + }, + { + }, ] } `, name, name) @@ -896,6 +945,25 @@ resource "aws_autoscaling_group" "bar" { value = "value2" propagate_at_launch = true }, + { + key = "invalid1" + propagate_at_launch = true + }, + { + value = "invalid2" + propagate_at_launch = true + }, + { + value = "invalid3" + }, + { + key = "invalid4" + }, + { + propagate_at_launch = true + }, + { + }, ] } `, name) @@ -1423,7 +1491,8 @@ resource "aws_autoscaling_group" "bar" { `, name) } -const testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_ELBCapacity = ` +func testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_ELBCapacity(rInt int) string { + return fmt.Sprintf(` provider "aws" { region = "us-west-2" } @@ -1457,7 +1526,7 @@ resource "aws_alb_listener" "test_listener" { } resource "aws_alb_target_group" "test" { - name = "tf-example-alb-tg" + name = "tf-alb-test-%d" port = 80 protocol = "HTTP" vpc_id = "${aws_vpc.default.id}" @@ -1468,6 +1537,10 @@ resource "aws_alb_target_group" "test" { timeout = "2" interval = "5" } + + tags { + Name = "testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_ELBCapacity" + } } resource "aws_subnet" "main" { @@ -1559,8 +1632,8 @@ resource "aws_autoscaling_group" "bar" { force_delete = true termination_policies = ["OldestInstance"] launch_configuration = "${aws_launch_configuration.foobar.name}" +}`, rInt) } -` func testAccAWSAutoScalingGroupConfigWithSuspendedProcesses(name string) string { return fmt.Sprintf(` diff --git a/installer/server/terraform/plugins/aws/resource_aws_autoscaling_lifecycle_hook_test.go b/installer/server/terraform/plugins/aws/resource_aws_autoscaling_lifecycle_hook_test.go index 7fece49a23..580c2ed55f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_autoscaling_lifecycle_hook_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_autoscaling_lifecycle_hook_test.go @@ -202,7 +202,7 @@ resource "aws_launch_configuration" "foobar" { } resource "aws_sqs_queue" "foobar" { - name = "foobar" + name = "foobar-%d" delay_seconds = 90 max_message_size = 2048 message_retention_seconds = 86400 @@ -225,7 +225,7 @@ EOF } resource "aws_iam_role_policy" "foobar" { - name = "foobar" + name = "foobar-%d" role = "${aws_iam_role.foobar.id}" policy = < 0 && *resp.CustomerGateways[0].State != "deleted" { + return true, nil + } + + return false, nil +} + func resourceAwsCustomerGatewayRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn diff --git a/installer/server/terraform/plugins/aws/resource_aws_customer_gateway_test.go b/installer/server/terraform/plugins/aws/resource_aws_customer_gateway_test.go index 311fe746db..9606a45571 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_customer_gateway_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_customer_gateway_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "regexp" "testing" "time" @@ -9,32 +10,35 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccAWSCustomerGateway_basic(t *testing.T) { var gateway ec2.CustomerGateway + rBgpAsn := acctest.RandIntRange(64512, 65534) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, IDRefreshName: "aws_customer_gateway.foo", Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCustomerGatewayConfig, + { + Config: testAccCustomerGatewayConfig(rInt, rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway), ), }, - resource.TestStep{ - Config: testAccCustomerGatewayConfigUpdateTags, + { + Config: testAccCustomerGatewayConfigUpdateTags(rInt, rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway), ), }, - resource.TestStep{ - Config: testAccCustomerGatewayConfigForceReplace, + { + Config: testAccCustomerGatewayConfigForceReplace(rInt, rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway), ), @@ -43,15 +47,41 @@ func TestAccAWSCustomerGateway_basic(t *testing.T) { }) } +func TestAccAWSCustomerGateway_similarAlreadyExists(t *testing.T) { + var gateway ec2.CustomerGateway + rInt := acctest.RandInt() + rBgpAsn := acctest.RandIntRange(64512, 65534) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_customer_gateway.foo", + Providers: testAccProviders, + CheckDestroy: testAccCheckCustomerGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCustomerGatewayConfig(rInt, rBgpAsn), + Check: resource.ComposeTestCheckFunc( + testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway), + ), + }, + { + Config: testAccCustomerGatewayConfigIdentical(rInt, rBgpAsn), + ExpectError: regexp.MustCompile("An existing customer gateway"), + }, + }, + }) +} + func TestAccAWSCustomerGateway_disappears(t *testing.T) { + rInt := acctest.RandInt() + rBgpAsn := acctest.RandIntRange(64512, 65534) var gateway ec2.CustomerGateway resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCustomerGatewayConfig, + { + Config: testAccCustomerGatewayConfig(rInt, rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccCheckCustomerGateway("aws_customer_gateway.foo", &gateway), testAccAWSCustomerGatewayDisappears(&gateway), @@ -167,39 +197,66 @@ func testAccCheckCustomerGateway(gatewayResource string, cgw *ec2.CustomerGatewa } } -const testAccCustomerGatewayConfig = ` -resource "aws_customer_gateway" "foo" { - bgp_asn = 65000 - ip_address = "172.0.0.1" - type = "ipsec.1" - tags { - Name = "foo-gateway" - } +func testAccCustomerGatewayConfig(rInt, rBgpAsn int) string { + return fmt.Sprintf(` + resource "aws_customer_gateway" "foo" { + bgp_asn = %d + ip_address = "172.0.0.1" + type = "ipsec.1" + tags { + Name = "foo-gateway-%d" + } + } + `, rBgpAsn, rInt) +} + +func testAccCustomerGatewayConfigIdentical(randInt, rBgpAsn int) string { + return fmt.Sprintf(` + resource "aws_customer_gateway" "foo" { + bgp_asn = %d + ip_address = "172.0.0.1" + type = "ipsec.1" + tags { + Name = "foo-gateway-%d" + } + } + resource "aws_customer_gateway" "identical" { + bgp_asn = %d + ip_address = "172.0.0.1" + type = "ipsec.1" + tags { + Name = "foo-gateway-identical-%d" + } + } + `, rBgpAsn, randInt, rBgpAsn, randInt) } -` // Add the Another: "tag" tag. -const testAccCustomerGatewayConfigUpdateTags = ` -resource "aws_customer_gateway" "foo" { - bgp_asn = 65000 - ip_address = "172.0.0.1" - type = "ipsec.1" - tags { - Name = "foo-gateway" - Another = "tag" +func testAccCustomerGatewayConfigUpdateTags(rInt, rBgpAsn int) string { + return fmt.Sprintf(` + resource "aws_customer_gateway" "foo" { + bgp_asn = %d + ip_address = "172.0.0.1" + type = "ipsec.1" + tags { + Name = "foo-gateway-%d" + Another = "tag" + } } + `, rBgpAsn, rInt) } -` // Change the ip_address. -const testAccCustomerGatewayConfigForceReplace = ` -resource "aws_customer_gateway" "foo" { - bgp_asn = 65000 - ip_address = "172.10.10.1" - type = "ipsec.1" - tags { - Name = "foo-gateway" - Another = "tag" - } +func testAccCustomerGatewayConfigForceReplace(rInt, rBgpAsn int) string { + return fmt.Sprintf(` + resource "aws_customer_gateway" "foo" { + bgp_asn = %d + ip_address = "172.10.10.1" + type = "ipsec.1" + tags { + Name = "foo-gateway-%d" + Another = "tag" + } + } + `, rBgpAsn, rInt) } -` diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_instance.go b/installer/server/terraform/plugins/aws/resource_aws_db_instance.go index b1635f540d..00409230db 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_instance.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_instance.go @@ -25,6 +25,12 @@ func resourceAwsDbInstance() *schema.Resource { State: resourceAwsDbInstanceImport, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(40 * time.Minute), + Update: schema.DefaultTimeout(80 * time.Minute), + Delete: schema.DefaultTimeout(40 * time.Minute), + }, + Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, @@ -95,11 +101,19 @@ func resourceAwsDbInstance() *schema.Resource { }, "identifier": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"identifier_prefix"}, + ValidateFunc: validateRdsIdentifier, + }, + "identifier_prefix": { Type: schema.TypeString, Optional: true, Computed: true, ForceNew: true, - ValidateFunc: validateRdsId, + ValidateFunc: validateRdsIdentifierPrefix, }, "instance_class": { @@ -207,7 +221,7 @@ func resourceAwsDbInstance() *schema.Resource { "skip_final_snapshot": { Type: schema.TypeBool, Optional: true, - Default: true, + Default: false, }, "copy_tags_to_snapshot": { @@ -330,10 +344,16 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error conn := meta.(*AWSClient).rdsconn tags := tagsFromMapRDS(d.Get("tags").(map[string]interface{})) - identifier := d.Get("identifier").(string) - // Generate a unique ID for the user - if identifier == "" { - identifier = resource.PrefixedUniqueId("tf-") + var identifier string + if v, ok := d.GetOk("identifier"); ok { + identifier = v.(string) + } else { + if v, ok := d.GetOk("identifier_prefix"); ok { + identifier = resource.PrefixedUniqueId(v.(string)) + } else { + identifier = resource.UniqueId() + } + // SQL Server identifier size is max 15 chars, so truncate if engine := d.Get("engine").(string); engine != "" { if strings.Contains(strings.ToLower(engine), "sqlserver") { @@ -401,7 +421,14 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error } if attr, ok := d.GetOk("name"); ok { - opts.DBName = aws.String(attr.(string)) + // "Note: This parameter [DBName] doesn't apply to the MySQL, PostgreSQL, or MariaDB engines." + // https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromDBSnapshot.html + switch strings.ToLower(d.Get("engine").(string)) { + case "mysql", "postgres", "mariadb": + // skip + default: + opts.DBName = aws.String(attr.(string)) + } } if attr, ok := d.GetOk("availability_zone"); ok { @@ -480,7 +507,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error "maintenance", "renaming", "rebooting", "upgrading"}, Target: []string{"available"}, Refresh: resourceAwsDbInstanceStateRefreshFunc(d, meta), - Timeout: 40 * time.Minute, + Timeout: d.Timeout(schema.TimeoutCreate), MinTimeout: 10 * time.Second, Delay: 30 * time.Second, // Wait 30 secs before starting } @@ -638,7 +665,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error "maintenance", "renaming", "rebooting", "upgrading", "configuring-enhanced-monitoring"}, Target: []string{"available"}, Refresh: resourceAwsDbInstanceStateRefreshFunc(d, meta), - Timeout: 40 * time.Minute, + Timeout: d.Timeout(schema.TimeoutCreate), MinTimeout: 10 * time.Second, Delay: 30 * time.Second, // Wait 30 secs before starting } @@ -811,7 +838,7 @@ func resourceAwsDbInstanceDelete(d *schema.ResourceData, meta interface{}) error "modifying", "deleting", "available"}, Target: []string{}, Refresh: resourceAwsDbInstanceStateRefreshFunc(d, meta), - Timeout: 40 * time.Minute, + Timeout: d.Timeout(schema.TimeoutDelete), MinTimeout: 10 * time.Second, Delay: 30 * time.Second, // Wait 30 secs before starting } @@ -833,6 +860,10 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error } d.SetPartial("apply_immediately") + if !d.Get("apply_immediately").(bool) { + log.Println("[INFO] Only settings updating, instance changes will be applied in next maintenance window") + } + requestUpdate := false if d.HasChange("allocated_storage") || d.HasChange("iops") { d.SetPartial("allocated_storage") @@ -978,7 +1009,7 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error "maintenance", "renaming", "rebooting", "upgrading", "configuring-enhanced-monitoring", "moving-to-vpc"}, Target: []string{"available"}, Refresh: resourceAwsDbInstanceStateRefreshFunc(d, meta), - Timeout: 80 * time.Minute, + Timeout: d.Timeout(schema.TimeoutUpdate), MinTimeout: 10 * time.Second, Delay: 30 * time.Second, // Wait 30 secs before starting } diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_instance_test.go b/installer/server/terraform/plugins/aws/resource_aws_db_instance_test.go index 87ce3cce45..17d3bf6b88 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_instance_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_instance_test.go @@ -53,6 +53,46 @@ func TestAccAWSDBInstance_basic(t *testing.T) { }) } +func TestAccAWSDBInstance_namePrefix(t *testing.T) { + var v rds.DBInstance + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDBInstanceConfig_namePrefix, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBInstanceExists("aws_db_instance.test", &v), + testAccCheckAWSDBInstanceAttributes(&v), + resource.TestMatchResourceAttr( + "aws_db_instance.test", "identifier", regexp.MustCompile("^tf-test-")), + ), + }, + }, + }) +} + +func TestAccAWSDBInstance_generatedName(t *testing.T) { + var v rds.DBInstance + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDBInstanceConfig_generatedName, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBInstanceExists("aws_db_instance.test", &v), + testAccCheckAWSDBInstanceAttributes(&v), + ), + }, + }, + }) +} + func TestAccAWSDBInstance_kmsKey(t *testing.T) { var v rds.DBInstance keyRegex := regexp.MustCompile("^arn:aws:kms:") @@ -92,7 +132,7 @@ func TestAccAWSDBInstance_subnetGroup(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBInstanceExists("aws_db_instance.bar", &v), resource.TestCheckResourceAttr( - "aws_db_instance.bar", "db_subnet_group_name", "foo"), + "aws_db_instance.bar", "db_subnet_group_name", "foo-"+rName), ), }, { @@ -100,7 +140,7 @@ func TestAccAWSDBInstance_subnetGroup(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBInstanceExists("aws_db_instance.bar", &v), resource.TestCheckResourceAttr( - "aws_db_instance.bar", "db_subnet_group_name", "bar"), + "aws_db_instance.bar", "db_subnet_group_name", "bar-"+rName), ), }, }, @@ -150,15 +190,13 @@ func TestAccAWSDBInstanceReplica(t *testing.T) { }) } -func TestAccAWSDBInstanceSnapshot(t *testing.T) { +func TestAccAWSDBInstanceNoSnapshot(t *testing.T) { var snap rds.DBInstance resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - // testAccCheckAWSDBInstanceSnapshot verifies a database snapshot is - // created, and subequently deletes it - CheckDestroy: testAccCheckAWSDBInstanceSnapshot, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBInstanceNoSnapshot, Steps: []resource.TestStep{ { Config: testAccSnapshotInstanceConfig(), @@ -170,18 +208,21 @@ func TestAccAWSDBInstanceSnapshot(t *testing.T) { }) } -func TestAccAWSDBInstanceNoSnapshot(t *testing.T) { - var nosnap rds.DBInstance +func TestAccAWSDBInstanceSnapshot(t *testing.T) { + var snap rds.DBInstance + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSDBInstanceNoSnapshot, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + // testAccCheckAWSDBInstanceSnapshot verifies a database snapshot is + // created, and subequently deletes it + CheckDestroy: testAccCheckAWSDBInstanceSnapshot(rInt), Steps: []resource.TestStep{ { - Config: testAccNoSnapshotInstanceConfig(), + Config: testAccSnapshotInstanceConfigWithSnapshot(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSDBInstanceExists("aws_db_instance.no_snapshot", &nosnap), + testAccCheckAWSDBInstanceExists("aws_db_instance.snapshot", &snap), ), }, }, @@ -434,87 +475,90 @@ func testAccCheckAWSDBInstanceReplicaAttributes(source, replica *rds.DBInstance) } } -func testAccCheckAWSDBInstanceSnapshot(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).rdsconn +func testAccCheckAWSDBInstanceSnapshot(rInt int) resource.TestCheckFunc { + return func(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_db_instance" { + continue + } - for _, rs := range s.RootModule().Resources { - if rs.Type != "aws_db_instance" { - continue - } + awsClient := testAccProvider.Meta().(*AWSClient) + conn := awsClient.rdsconn - var err error - resp, err := conn.DescribeDBInstances( - &rds.DescribeDBInstancesInput{ - DBInstanceIdentifier: aws.String(rs.Primary.ID), - }) + var err error + log.Printf("[INFO] Trying to locate the DBInstance Final Snapshot") + snapshot_identifier := fmt.Sprintf("foobarbaz-test-terraform-final-snapshot-%d", rInt) + _, snapErr := conn.DescribeDBSnapshots( + &rds.DescribeDBSnapshotsInput{ + DBSnapshotIdentifier: aws.String(snapshot_identifier), + }) - if err != nil { - newerr, _ := err.(awserr.Error) - if newerr.Code() != "DBInstanceNotFound" { - return err - } + if snapErr != nil { + newerr, _ := snapErr.(awserr.Error) + if newerr.Code() == "DBSnapshotNotFound" { + return fmt.Errorf("Snapshot %s not found", snapshot_identifier) + } + } else { // snapshot was found, + // verify we have the tags copied to the snapshot + instanceARN, err := buildRDSARN(snapshot_identifier, testAccProvider.Meta().(*AWSClient).partition, testAccProvider.Meta().(*AWSClient).accountid, testAccProvider.Meta().(*AWSClient).region) + // tags have a different ARN, just swapping :db: for :snapshot: + tagsARN := strings.Replace(instanceARN, ":db:", ":snapshot:", 1) + if err != nil { + return fmt.Errorf("Error building ARN for tags check with ARN (%s): %s", tagsARN, err) + } + resp, err := conn.ListTagsForResource(&rds.ListTagsForResourceInput{ + ResourceName: aws.String(tagsARN), + }) + if err != nil { + return fmt.Errorf("Error retrieving tags for ARN (%s): %s", tagsARN, err) + } - } else { - if len(resp.DBInstances) != 0 && - *resp.DBInstances[0].DBInstanceIdentifier == rs.Primary.ID { - return fmt.Errorf("DB Instance still exists") - } - } + if resp.TagList == nil || len(resp.TagList) == 0 { + return fmt.Errorf("Tag list is nil or zero: %s", resp.TagList) + } - log.Printf("[INFO] Trying to locate the DBInstance Final Snapshot") - snapshot_identifier := "foobarbaz-test-terraform-final-snapshot-1" - _, snapErr := conn.DescribeDBSnapshots( - &rds.DescribeDBSnapshotsInput{ - DBSnapshotIdentifier: aws.String(snapshot_identifier), - }) + var found bool + for _, t := range resp.TagList { + if *t.Key == "Name" && *t.Value == "tf-tags-db" { + found = true + } + } + if !found { + return fmt.Errorf("Expected to find tag Name (%s), but wasn't found. Tags: %s", "tf-tags-db", resp.TagList) + } + // end tag search + + log.Printf("[INFO] Deleting the Snapshot %s", snapshot_identifier) + _, snapDeleteErr := conn.DeleteDBSnapshot( + &rds.DeleteDBSnapshotInput{ + DBSnapshotIdentifier: aws.String(snapshot_identifier), + }) + if snapDeleteErr != nil { + return err + } + } // end snapshot was found - if snapErr != nil { - newerr, _ := snapErr.(awserr.Error) - if newerr.Code() == "DBSnapshotNotFound" { - return fmt.Errorf("Snapshot %s not found", snapshot_identifier) - } - } else { // snapshot was found, - // verify we have the tags copied to the snapshot - instanceARN, err := buildRDSARN(snapshot_identifier, testAccProvider.Meta().(*AWSClient).partition, testAccProvider.Meta().(*AWSClient).accountid, testAccProvider.Meta().(*AWSClient).region) - // tags have a different ARN, just swapping :db: for :snapshot: - tagsARN := strings.Replace(instanceARN, ":db:", ":snapshot:", 1) - if err != nil { - return fmt.Errorf("Error building ARN for tags check with ARN (%s): %s", tagsARN, err) - } - resp, err := conn.ListTagsForResource(&rds.ListTagsForResourceInput{ - ResourceName: aws.String(tagsARN), - }) - if err != nil { - return fmt.Errorf("Error retrieving tags for ARN (%s): %s", tagsARN, err) - } + resp, err := conn.DescribeDBInstances( + &rds.DescribeDBInstancesInput{ + DBInstanceIdentifier: aws.String(rs.Primary.ID), + }) - if resp.TagList == nil || len(resp.TagList) == 0 { - return fmt.Errorf("Tag list is nil or zero: %s", resp.TagList) - } + if err != nil { + newerr, _ := err.(awserr.Error) + if newerr.Code() != "DBInstanceNotFound" { + return err + } - var found bool - for _, t := range resp.TagList { - if *t.Key == "Name" && *t.Value == "tf-tags-db" { - found = true + } else { + if len(resp.DBInstances) != 0 && + *resp.DBInstances[0].DBInstanceIdentifier == rs.Primary.ID { + return fmt.Errorf("DB Instance still exists") } } - if !found { - return fmt.Errorf("Expected to find tag Name (%s), but wasn't found. Tags: %s", "tf-tags-db", resp.TagList) - } - // end tag search + } - log.Printf("[INFO] Deleting the Snapshot %s", snapshot_identifier) - _, snapDeleteErr := conn.DeleteDBSnapshot( - &rds.DeleteDBSnapshotInput{ - DBSnapshotIdentifier: aws.String(snapshot_identifier), - }) - if snapDeleteErr != nil { - return err - } - } // end snapshot was found + return nil } - - return nil } func testAccCheckAWSDBInstanceNoSnapshot(s *terraform.State) error { @@ -609,14 +653,50 @@ resource "aws_db_instance" "bar" { username = "foo" - # Maintenance Window is stored in lower case in the API, though not strictly - # documented. Terraform will downcase this to match (as opposed to throw a + # Maintenance Window is stored in lower case in the API, though not strictly + # documented. Terraform will downcase this to match (as opposed to throw a # validation error). maintenance_window = "Fri:09:00-Fri:09:30" + skip_final_snapshot = true backup_retention_period = 0 parameter_group_name = "default.mysql5.6" + + timeouts { + create = "30m" + } +}` + +const testAccAWSDBInstanceConfig_namePrefix = ` +resource "aws_db_instance" "test" { + allocated_storage = 10 + engine = "MySQL" + identifier_prefix = "tf-test-" + instance_class = "db.t1.micro" + password = "password" + username = "root" + publicly_accessible = true + skip_final_snapshot = true + + timeouts { + create = "30m" + } +}` + +const testAccAWSDBInstanceConfig_generatedName = ` +resource "aws_db_instance" "test" { + allocated_storage = 10 + engine = "MySQL" + instance_class = "db.t1.micro" + password = "password" + username = "root" + publicly_accessible = true + skip_final_snapshot = true + + timeouts { + create = "30m" + } }` var testAccAWSDBInstanceConfigKmsKeyId = ` @@ -660,6 +740,8 @@ resource "aws_db_instance" "bar" { storage_encrypted = true kms_key_id = "${aws_kms_key.foo.arn}" + skip_final_snapshot = true + parameter_group_name = "default.mysql5.6" } ` @@ -684,6 +766,7 @@ resource "aws_db_instance" "bar" { username = "foo" backup_retention_period = 0 + skip_final_snapshot = true parameter_group_name = "default.mysql5.6" option_group_name = "${aws_db_option_group.bar.name}" @@ -704,10 +787,11 @@ func testAccReplicaInstanceConfig(val int) string { username = "foo" backup_retention_period = 1 + skip_final_snapshot = true parameter_group_name = "default.mysql5.6" } - + resource "aws_db_instance" "replica" { identifier = "tf-replica-db-%d" backup_retention_period = 0 @@ -718,6 +802,7 @@ func testAccReplicaInstanceConfig(val int) string { instance_class = "${aws_db_instance.bar.instance_class}" password = "${aws_db_instance.bar.password}" username = "${aws_db_instance.bar.username}" + skip_final_snapshot = true tags { Name = "tf-replica-db" } @@ -731,7 +816,7 @@ provider "aws" { region = "us-east-1" } resource "aws_db_instance" "snapshot" { - identifier = "tf-snapshot-%d" + identifier = "tf-test-%d" allocated_storage = 5 engine = "mysql" @@ -747,22 +832,18 @@ resource "aws_db_instance" "snapshot" { parameter_group_name = "default.mysql5.6" - skip_final_snapshot = false - copy_tags_to_snapshot = true + skip_final_snapshot = true final_snapshot_identifier = "foobarbaz-test-terraform-final-snapshot-1" - tags { - Name = "tf-tags-db" - } }`, acctest.RandInt()) } -func testAccNoSnapshotInstanceConfig() string { +func testAccSnapshotInstanceConfigWithSnapshot(rInt int) string { return fmt.Sprintf(` provider "aws" { region = "us-east-1" } -resource "aws_db_instance" "no_snapshot" { - identifier = "tf-test-%s" +resource "aws_db_instance" "snapshot" { + identifier = "tf-snapshot-%d" allocated_storage = 5 engine = "mysql" @@ -772,15 +853,18 @@ resource "aws_db_instance" "no_snapshot" { password = "barbarbarbar" publicly_accessible = true username = "foo" - security_group_names = ["default"] + security_group_names = ["default"] backup_retention_period = 1 parameter_group_name = "default.mysql5.6" - skip_final_snapshot = true - final_snapshot_identifier = "foobarbaz-test-terraform-final-snapshot-2" + copy_tags_to_snapshot = true + final_snapshot_identifier = "foobarbaz-test-terraform-final-snapshot-%d" + tags { + Name = "tf-tags-db" + } } -`, acctest.RandString(5)) +`, rInt, rInt) } func testAccSnapshotInstanceConfig_enhancedMonitoring(rName string) string { @@ -847,6 +931,7 @@ resource "aws_db_instance" "bar" { username = "foo" password = "barbarbar" parameter_group_name = "default.mysql5.6" + skip_final_snapshot = true apply_immediately = true @@ -869,6 +954,7 @@ resource "aws_db_instance" "bar" { parameter_group_name = "default.mysql5.6" port = 3306 allocated_storage = 10 + skip_final_snapshot = true apply_immediately = true }`, rName) @@ -887,6 +973,7 @@ resource "aws_db_instance" "bar" { parameter_group_name = "default.mysql5.6" port = 3305 allocated_storage = 10 + skip_final_snapshot = true apply_immediately = true }`, rName) @@ -917,7 +1004,7 @@ resource "aws_subnet" "bar" { } resource "aws_db_subnet_group" "foo" { - name = "foo" + name = "foo-%s" subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"] tags { Name = "tf-dbsubnet-group-test" @@ -936,9 +1023,11 @@ resource "aws_db_instance" "bar" { db_subnet_group_name = "${aws_db_subnet_group.foo.name}" port = 3305 allocated_storage = 10 + skip_final_snapshot = true + backup_retention_period = 0 apply_immediately = true -}`, rName) +}`, rName, rName) } func testAccAWSDBInstanceConfigWithSubnetGroupUpdated(rName string) string { @@ -971,7 +1060,7 @@ resource "aws_subnet" "bar" { resource "aws_subnet" "test" { cidr_block = "10.10.3.0/24" - availability_zone = "us-west-2c" + availability_zone = "us-west-2b" vpc_id = "${aws_vpc.bar.id}" tags { Name = "tf-dbsubnet-test-3" @@ -988,7 +1077,7 @@ resource "aws_subnet" "another_test" { } resource "aws_db_subnet_group" "foo" { - name = "foo" + name = "foo-%s" subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"] tags { Name = "tf-dbsubnet-group-test" @@ -996,7 +1085,7 @@ resource "aws_db_subnet_group" "foo" { } resource "aws_db_subnet_group" "bar" { - name = "bar" + name = "bar-%s" subnet_ids = ["${aws_subnet.test.id}", "${aws_subnet.another_test.id}"] tags { Name = "tf-dbsubnet-group-test-updated" @@ -1015,9 +1104,12 @@ resource "aws_db_instance" "bar" { db_subnet_group_name = "${aws_db_subnet_group.bar.name}" port = 3305 allocated_storage = 10 + skip_final_snapshot = true + + backup_retention_period = 0 apply_immediately = true -}`, rName) +}`, rName, rName, rName) } const testAccAWSDBMSSQL_timezone = ` @@ -1063,6 +1155,7 @@ resource "aws_db_instance" "mssql" { password = "somecrazypassword" engine = "sqlserver-ex" backup_retention_period = 0 + skip_final_snapshot = true #publicly_accessible = true @@ -1130,6 +1223,7 @@ resource "aws_db_instance" "mssql" { password = "somecrazypassword" engine = "sqlserver-ex" backup_retention_period = 0 + skip_final_snapshot = true #publicly_accessible = true @@ -1165,6 +1259,7 @@ resource "aws_db_instance" "bar" { name = "baz" password = "barbarbarbar" username = "foo" + skip_final_snapshot = true } `, acctest.RandInt()) diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_option_group.go b/installer/server/terraform/plugins/aws/resource_aws_db_option_group.go index 5c68e7bd38..e8ad1ac99f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_option_group.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_option_group.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "log" - "regexp" "time" "github.com/aws/aws-sdk-go/aws" @@ -31,10 +30,19 @@ func resourceAwsDbOptionGroup() *schema.Resource { Computed: true, }, "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"name_prefix"}, + ValidateFunc: validateDbOptionGroupName, + }, + "name_prefix": &schema.Schema{ Type: schema.TypeString, + Optional: true, + Computed: true, ForceNew: true, - Required: true, - ValidateFunc: validateDbOptionGroupName, + ValidateFunc: validateDbOptionGroupNamePrefix, }, "engine_name": &schema.Schema{ Type: schema.TypeString, @@ -48,8 +56,9 @@ func resourceAwsDbOptionGroup() *schema.Resource { }, "option_group_description": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, + Default: "Managed by Terraform", }, "option": &schema.Schema{ @@ -107,11 +116,20 @@ func resourceAwsDbOptionGroupCreate(d *schema.ResourceData, meta interface{}) er rdsconn := meta.(*AWSClient).rdsconn tags := tagsFromMapRDS(d.Get("tags").(map[string]interface{})) + var groupName string + if v, ok := d.GetOk("name"); ok { + groupName = v.(string) + } else if v, ok := d.GetOk("name_prefix"); ok { + groupName = resource.PrefixedUniqueId(v.(string)) + } else { + groupName = resource.UniqueId() + } + createOpts := &rds.CreateOptionGroupInput{ EngineName: aws.String(d.Get("engine_name").(string)), MajorEngineVersion: aws.String(d.Get("major_engine_version").(string)), OptionGroupDescription: aws.String(d.Get("option_group_description").(string)), - OptionGroupName: aws.String(d.Get("name").(string)), + OptionGroupName: aws.String(groupName), Tags: tags, } @@ -121,7 +139,7 @@ func resourceAwsDbOptionGroupCreate(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Error creating DB Option Group: %s", err) } - d.SetId(d.Get("name").(string)) + d.SetId(groupName) log.Printf("[INFO] DB Option Group ID: %s", d.Id()) return resourceAwsDbOptionGroupUpdate(d, meta) @@ -343,28 +361,3 @@ func buildRDSOptionGroupARN(identifier, partition, accountid, region string) (st arn := fmt.Sprintf("arn:%s:rds:%s:%s:og:%s", partition, region, accountid, identifier) return arn, nil } - -func validateDbOptionGroupName(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if !regexp.MustCompile(`^[a-z]`).MatchString(value) { - errors = append(errors, fmt.Errorf( - "first character of %q must be a letter", k)) - } - if !regexp.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) { - errors = append(errors, fmt.Errorf( - "only alphanumeric characters and hyphens allowed in %q", k)) - } - if regexp.MustCompile(`--`).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q cannot contain two consecutive hyphens", k)) - } - if regexp.MustCompile(`-$`).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q cannot end with a hyphen", k)) - } - if len(value) > 255 { - errors = append(errors, fmt.Errorf( - "%q cannot be greater than 255 characters", k)) - } - return -} diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_option_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_db_option_group_test.go index 5a3215b042..8e9b22e1bb 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_option_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_option_group_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -34,6 +35,66 @@ func TestAccAWSDBOptionGroup_basic(t *testing.T) { }) } +func TestAccAWSDBOptionGroup_namePrefix(t *testing.T) { + var v rds.OptionGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSDBOptionGroup_namePrefix, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBOptionGroupExists("aws_db_option_group.test", &v), + testAccCheckAWSDBOptionGroupAttributes(&v), + resource.TestMatchResourceAttr( + "aws_db_option_group.test", "name", regexp.MustCompile("^tf-test-")), + ), + }, + }, + }) +} + +func TestAccAWSDBOptionGroup_generatedName(t *testing.T) { + var v rds.OptionGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSDBOptionGroup_generatedName, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBOptionGroupExists("aws_db_option_group.test", &v), + testAccCheckAWSDBOptionGroupAttributes(&v), + ), + }, + }, + }) +} + +func TestAccAWSDBOptionGroup_defaultDescription(t *testing.T) { + var v rds.OptionGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSDBOptionGroup_defaultDescription(acctest.RandInt()), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBOptionGroupExists("aws_db_option_group.test", &v), + resource.TestCheckResourceAttr( + "aws_db_option_group.test", "option_group_description", "Managed by Terraform"), + ), + }, + }, + }) +} + func TestAccAWSDBOptionGroup_basicDestroyWithInstance(t *testing.T) { rName := fmt.Sprintf("option-group-test-terraform-%s", acctest.RandString(5)) @@ -160,42 +221,6 @@ func testAccCheckAWSDBOptionGroupAttributes(v *rds.OptionGroup) resource.TestChe } } -func TestResourceAWSDBOptionGroupName_validation(t *testing.T) { - cases := []struct { - Value string - ErrCount int - }{ - { - Value: "testing123!", - ErrCount: 1, - }, - { - Value: "1testing123", - ErrCount: 1, - }, - { - Value: "testing--123", - ErrCount: 1, - }, - { - Value: "testing123-", - ErrCount: 1, - }, - { - Value: randomString(256), - ErrCount: 1, - }, - } - - for _, tc := range cases { - _, errors := validateDbOptionGroupName(tc.Value, "aws_db_option_group_name") - - if len(errors) != tc.ErrCount { - t.Fatalf("Expected the DB Option Group Name to trigger a validation error") - } - } -} - func testAccCheckAWSDBOptionGroupExists(n string, v *rds.OptionGroup) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -292,6 +317,7 @@ resource "aws_db_instance" "bar" { maintenance_window = "Fri:09:00-Fri:09:30" backup_retention_period = 0 + skip_final_snapshot = true option_group_name = "${aws_db_option_group.bar.name}" } @@ -387,3 +413,30 @@ resource "aws_db_option_group" "bar" { } `, r) } + +const testAccAWSDBOptionGroup_namePrefix = ` +resource "aws_db_option_group" "test" { + name_prefix = "tf-test-" + option_group_description = "Test option group for terraform" + engine_name = "mysql" + major_engine_version = "5.6" +} +` + +const testAccAWSDBOptionGroup_generatedName = ` +resource "aws_db_option_group" "test" { + option_group_description = "Test option group for terraform" + engine_name = "mysql" + major_engine_version = "5.6" +} +` + +func testAccAWSDBOptionGroup_defaultDescription(n int) string { + return fmt.Sprintf(` +resource "aws_db_option_group" "test" { + name = "tf-test-%d" + engine_name = "mysql" + major_engine_version = "5.6" +} +`, n) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group.go b/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group.go index b182827128..4e2611ff73 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group.go @@ -32,10 +32,19 @@ func resourceAwsDbParameterGroup() *schema.Resource { Computed: true, }, "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"name_prefix"}, + ValidateFunc: validateDbParamGroupName, + }, + "name_prefix": &schema.Schema{ Type: schema.TypeString, + Optional: true, + Computed: true, ForceNew: true, - Required: true, - ValidateFunc: validateDbParamGroupName, + ValidateFunc: validateDbParamGroupNamePrefix, }, "family": &schema.Schema{ Type: schema.TypeString, @@ -81,8 +90,18 @@ func resourceAwsDbParameterGroupCreate(d *schema.ResourceData, meta interface{}) rdsconn := meta.(*AWSClient).rdsconn tags := tagsFromMapRDS(d.Get("tags").(map[string]interface{})) + var groupName string + if v, ok := d.GetOk("name"); ok { + groupName = v.(string) + } else if v, ok := d.GetOk("name_prefix"); ok { + groupName = resource.PrefixedUniqueId(v.(string)) + } else { + groupName = resource.UniqueId() + } + d.Set("name", groupName) + createOpts := rds.CreateDBParameterGroupInput{ - DBParameterGroupName: aws.String(d.Get("name").(string)), + DBParameterGroupName: aws.String(groupName), DBParameterGroupFamily: aws.String(d.Get("family").(string)), Description: aws.String(d.Get("description").(string)), Tags: tags, diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group_test.go index 75db4f77da..1d330bfc7c 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_parameter_group_test.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "math/rand" + "regexp" "testing" "time" @@ -290,6 +291,44 @@ func TestAccAWSDBParameterGroup_basic(t *testing.T) { }) } +func TestAccAWSDBParameterGroup_namePrefix(t *testing.T) { + var v rds.DBParameterGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccDBParameterGroupConfig_namePrefix, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBParameterGroupExists("aws_db_parameter_group.test", &v), + resource.TestMatchResourceAttr( + "aws_db_parameter_group.test", "name", regexp.MustCompile("^tf-test-")), + ), + }, + }, + }) +} + +func TestAccAWSDBParameterGroup_generatedName(t *testing.T) { + var v rds.DBParameterGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccDBParameterGroupConfig_generatedName, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBParameterGroupExists("aws_db_parameter_group.test", &v), + ), + }, + }, + }) +} + func TestAccAWSDBParameterGroup_withApplyMethod(t *testing.T) { var v rds.DBParameterGroup @@ -671,3 +710,26 @@ resource "aws_db_parameter_group" "large" { parameter { name = "tx_isolation" value = "REPEATABLE-READ" } }`, n) } + +const testAccDBParameterGroupConfig_namePrefix = ` +resource "aws_db_parameter_group" "test" { + name_prefix = "tf-test-" + family = "mysql5.6" + + parameter { + name = "sync_binlog" + value = 0 + } +} +` + +const testAccDBParameterGroupConfig_generatedName = ` +resource "aws_db_parameter_group" "test" { + family = "mysql5.6" + + parameter { + name = "sync_binlog" + value = 0 + } +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group.go b/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group.go index 9c1c56199f..c4e437beeb 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "regexp" "strings" "time" @@ -31,10 +30,19 @@ func resourceAwsDbSubnetGroup() *schema.Resource { }, "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"name_prefix"}, + ValidateFunc: validateDbSubnetGroupName, + }, + "name_prefix": &schema.Schema{ Type: schema.TypeString, + Optional: true, + Computed: true, ForceNew: true, - Required: true, - ValidateFunc: validateSubnetGroupName, + ValidateFunc: validateDbSubnetGroupNamePrefix, }, "description": &schema.Schema{ @@ -65,8 +73,17 @@ func resourceAwsDbSubnetGroupCreate(d *schema.ResourceData, meta interface{}) er subnetIds[i] = aws.String(subnetId.(string)) } + var groupName string + if v, ok := d.GetOk("name"); ok { + groupName = v.(string) + } else if v, ok := d.GetOk("name_prefix"); ok { + groupName = resource.PrefixedUniqueId(v.(string)) + } else { + groupName = resource.UniqueId() + } + createOpts := rds.CreateDBSubnetGroupInput{ - DBSubnetGroupName: aws.String(d.Get("name").(string)), + DBSubnetGroupName: aws.String(groupName), DBSubnetGroupDescription: aws.String(d.Get("description").(string)), SubnetIds: subnetIds, Tags: tags, @@ -238,20 +255,3 @@ func buildRDSsubgrpARN(identifier, partition, accountid, region string) (string, return arn, nil } - -func validateSubnetGroupName(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if !regexp.MustCompile(`^[ .0-9a-z-_]+$`).MatchString(value) { - errors = append(errors, fmt.Errorf( - "only lowercase alphanumeric characters, hyphens, underscores, periods, and spaces allowed in %q", k)) - } - if len(value) > 255 { - errors = append(errors, fmt.Errorf( - "%q cannot be longer than 255 characters", k)) - } - if regexp.MustCompile(`(?i)^default$`).MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q is not allowed as %q", "Default", k)) - } - return -} diff --git a/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group_test.go index 434ae1728e..70d27c5dbb 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_db_subnet_group_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "regexp" "testing" "github.com/hashicorp/terraform/helper/acctest" @@ -43,6 +44,46 @@ func TestAccAWSDBSubnetGroup_basic(t *testing.T) { }) } +func TestAccAWSDBSubnetGroup_namePrefix(t *testing.T) { + var v rds.DBSubnetGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckDBSubnetGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccDBSubnetGroupConfig_namePrefix, + Check: resource.ComposeTestCheckFunc( + testAccCheckDBSubnetGroupExists( + "aws_db_subnet_group.test", &v), + resource.TestMatchResourceAttr( + "aws_db_subnet_group.test", "name", regexp.MustCompile("^tf_test-")), + ), + }, + }, + }) +} + +func TestAccAWSDBSubnetGroup_generatedName(t *testing.T) { + var v rds.DBSubnetGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckDBSubnetGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccDBSubnetGroupConfig_generatedName, + Check: resource.ComposeTestCheckFunc( + testAccCheckDBSubnetGroupExists( + "aws_db_subnet_group.test", &v), + ), + }, + }, + }) +} + // Regression test for https://github.com/hashicorp/terraform/issues/2603 and // https://github.com/hashicorp/terraform/issues/2664 func TestAccAWSDBSubnetGroup_withUndocumentedCharacters(t *testing.T) { @@ -105,38 +146,6 @@ func TestAccAWSDBSubnetGroup_updateDescription(t *testing.T) { }) } -func TestResourceAWSDBSubnetGroupNameValidation(t *testing.T) { - cases := []struct { - Value string - ErrCount int - }{ - { - Value: "tEsting", - ErrCount: 1, - }, - { - Value: "testing?", - ErrCount: 1, - }, - { - Value: "default", - ErrCount: 1, - }, - { - Value: randomString(300), - ErrCount: 1, - }, - } - - for _, tc := range cases { - _, errors := validateSubnetGroupName(tc.Value, "aws_db_subnet_group") - - if len(errors) != tc.ErrCount { - t.Fatalf("Expected the DB Subnet Group name to trigger a validation error") - } - } -} - func testAccCheckDBSubnetGroupDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).rdsconn @@ -263,6 +272,49 @@ resource "aws_db_subnet_group" "foo" { }`, rName) } +const testAccDBSubnetGroupConfig_namePrefix = ` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_subnet" "a" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.1.1.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_subnet" "b" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.1.2.0/24" + availability_zone = "us-west-2b" +} + +resource "aws_db_subnet_group" "test" { + name_prefix = "tf_test-" + subnet_ids = ["${aws_subnet.a.id}", "${aws_subnet.b.id}"] +}` + +const testAccDBSubnetGroupConfig_generatedName = ` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_subnet" "a" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.1.1.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_subnet" "b" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.1.2.0/24" + availability_zone = "us-west-2b" +} + +resource "aws_db_subnet_group" "test" { + subnet_ids = ["${aws_subnet.a.id}", "${aws_subnet.b.id}"] +}` + const testAccDBSubnetGroupConfig_withUnderscoresAndPeriodsAndSpaces = ` resource "aws_vpc" "main" { cidr_block = "192.168.0.0/16" diff --git a/installer/server/terraform/plugins/aws/resource_aws_default_network_acl.go b/installer/server/terraform/plugins/aws/resource_aws_default_network_acl.go index 44443e9242..419972b18a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_default_network_acl.go +++ b/installer/server/terraform/plugins/aws/resource_aws_default_network_acl.go @@ -9,11 +9,14 @@ import ( "github.com/hashicorp/terraform/helper/schema" ) -// ACL Network ACLs all contain an explicit deny-all rule that cannot be -// destroyed or changed by users. This rule is numbered very high to be a +// ACL Network ACLs all contain explicit deny-all rules that cannot be +// destroyed or changed by users. This rules are numbered very high to be a // catch-all. // See http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html#default-network-acl -const awsDefaultAclRuleNumber = 32767 +const ( + awsDefaultAclRuleNumberIpv4 = 32767 + awsDefaultAclRuleNumberIpv6 = 32768 +) func resourceAwsDefaultNetworkAcl() *schema.Resource { return &schema.Resource{ @@ -258,7 +261,8 @@ func revokeAllNetworkACLEntries(netaclId string, meta interface{}) error { for _, e := range networkAcl.Entries { // Skip the default rules added by AWS. They can be neither // configured or deleted by users. See http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html#default-network-acl - if *e.RuleNumber == awsDefaultAclRuleNumber { + if *e.RuleNumber == awsDefaultAclRuleNumberIpv4 || + *e.RuleNumber == awsDefaultAclRuleNumberIpv6 { continue } diff --git a/installer/server/terraform/plugins/aws/resource_aws_default_network_acl_test.go b/installer/server/terraform/plugins/aws/resource_aws_default_network_acl_test.go index 628943634b..c5f9e02d1a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_default_network_acl_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_default_network_acl_test.go @@ -36,8 +36,27 @@ func TestAccAWSDefaultNetworkAcl_basic(t *testing.T) { resource.TestStep{ Config: testAccAWSDefaultNetworkConfig_basic, Check: resource.ComposeTestCheckFunc( - testAccGetWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), - testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 0), + testAccGetAWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), + testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 0, 2), + ), + }, + }, + }) +} + +func TestAccAWSDefaultNetworkAcl_basicIpv6Vpc(t *testing.T) { + var networkAcl ec2.NetworkAcl + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDefaultNetworkAclDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSDefaultNetworkConfig_basicIpv6Vpc, + Check: resource.ComposeTestCheckFunc( + testAccGetAWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), + testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 0, 4), ), }, }, @@ -58,8 +77,8 @@ func TestAccAWSDefaultNetworkAcl_deny_ingress(t *testing.T) { resource.TestStep{ Config: testAccAWSDefaultNetworkConfig_deny_ingress, Check: resource.ComposeTestCheckFunc( - testAccGetWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), - testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{defaultEgressAcl}, 0), + testAccGetAWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), + testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{defaultEgressAcl}, 0, 2), ), }, }, @@ -77,8 +96,8 @@ func TestAccAWSDefaultNetworkAcl_SubnetRemoval(t *testing.T) { resource.TestStep{ Config: testAccAWSDefaultNetworkConfig_Subnets, Check: resource.ComposeTestCheckFunc( - testAccGetWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), - testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 2), + testAccGetAWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), + testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 2, 2), ), }, @@ -88,8 +107,8 @@ func TestAccAWSDefaultNetworkAcl_SubnetRemoval(t *testing.T) { resource.TestStep{ Config: testAccAWSDefaultNetworkConfig_Subnets_remove, Check: resource.ComposeTestCheckFunc( - testAccGetWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), - testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 2), + testAccGetAWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), + testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 2, 2), ), ExpectNonEmptyPlan: true, }, @@ -108,8 +127,8 @@ func TestAccAWSDefaultNetworkAcl_SubnetReassign(t *testing.T) { resource.TestStep{ Config: testAccAWSDefaultNetworkConfig_Subnets, Check: resource.ComposeTestCheckFunc( - testAccGetWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), - testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 2), + testAccGetAWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), + testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 2, 2), ), }, @@ -128,8 +147,8 @@ func TestAccAWSDefaultNetworkAcl_SubnetReassign(t *testing.T) { resource.TestStep{ Config: testAccAWSDefaultNetworkConfig_Subnets_move, Check: resource.ComposeTestCheckFunc( - testAccGetWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), - testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 0), + testAccGetAWSDefaultNetworkAcl("aws_default_network_acl.default", &networkAcl), + testAccCheckAWSDefaultACLAttributes(&networkAcl, []*ec2.NetworkAclEntry{}, 0, 2), ), }, }, @@ -141,14 +160,14 @@ func testAccCheckAWSDefaultNetworkAclDestroy(s *terraform.State) error { return nil } -func testAccCheckAWSDefaultACLAttributes(acl *ec2.NetworkAcl, rules []*ec2.NetworkAclEntry, subnetCount int) resource.TestCheckFunc { +func testAccCheckAWSDefaultACLAttributes(acl *ec2.NetworkAcl, rules []*ec2.NetworkAclEntry, subnetCount int, hiddenRuleCount int) resource.TestCheckFunc { return func(s *terraform.State) error { aclEntriesCount := len(acl.Entries) ruleCount := len(rules) - // Default ACL has 2 hidden rules we can't do anything about - ruleCount = ruleCount + 2 + // Default ACL has hidden rules we can't do anything about + ruleCount = ruleCount + hiddenRuleCount if ruleCount != aclEntriesCount { return fmt.Errorf("Expected (%d) Rules, got (%d)", ruleCount, aclEntriesCount) @@ -162,7 +181,7 @@ func testAccCheckAWSDefaultACLAttributes(acl *ec2.NetworkAcl, rules []*ec2.Netwo } } -func testAccGetWSDefaultNetworkAcl(n string, networkAcl *ec2.NetworkAcl) resource.TestCheckFunc { +func testAccGetAWSDefaultNetworkAcl(n string, networkAcl *ec2.NetworkAcl) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -426,3 +445,26 @@ resource "aws_default_network_acl" "default" { } } ` + +const testAccAWSDefaultNetworkConfig_basicIpv6Vpc = ` +provider "aws" { + region = "us-east-2" +} + +resource "aws_vpc" "tftestvpc" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags { + Name = "TestAccAWSDefaultNetworkAcl_basicIpv6Vpc" + } +} + +resource "aws_default_network_acl" "default" { + default_network_acl_id = "${aws_vpc.tftestvpc.default_network_acl_id}" + + tags { + Name = "TestAccAWSDefaultNetworkAcl_basicIpv6Vpc" + } +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_default_route_table.go b/installer/server/terraform/plugins/aws/resource_aws_default_route_table.go index 78296cb1a8..987dd4a7df 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_default_route_table.go +++ b/installer/server/terraform/plugins/aws/resource_aws_default_route_table.go @@ -17,56 +17,66 @@ func resourceAwsDefaultRouteTable() *schema.Resource { Delete: resourceAwsDefaultRouteTableDelete, Schema: map[string]*schema.Schema{ - "default_route_table_id": &schema.Schema{ + "default_route_table_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "vpc_id": &schema.Schema{ + "vpc_id": { Type: schema.TypeString, Computed: true, }, - "propagating_vgws": &schema.Schema{ + "propagating_vgws": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "route": &schema.Schema{ + "route": { Type: schema.TypeSet, Computed: true, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "cidr_block": &schema.Schema{ + "cidr_block": { Type: schema.TypeString, - Required: true, + Optional: true, + }, + + "ipv6_cidr_block": { + Type: schema.TypeString, + Optional: true, + }, + + "egress_only_gateway_id": { + Type: schema.TypeString, + Optional: true, }, - "gateway_id": &schema.Schema{ + "gateway_id": { Type: schema.TypeString, Optional: true, }, - "instance_id": &schema.Schema{ + "instance_id": { Type: schema.TypeString, Optional: true, }, - "nat_gateway_id": &schema.Schema{ + "nat_gateway_id": { Type: schema.TypeString, Optional: true, }, - "vpc_peering_connection_id": &schema.Schema{ + "vpc_peering_connection_id": { Type: schema.TypeString, Optional: true, }, - "network_interface_id": &schema.Schema{ + "network_interface_id": { Type: schema.TypeString, Optional: true, }, @@ -193,16 +203,33 @@ func revokeAllRouteTableRules(defaultRouteTableId string, meta interface{}) erro // See aws_vpc_endpoint continue } - log.Printf( - "[INFO] Deleting route from %s: %s", - defaultRouteTableId, *r.DestinationCidrBlock) - _, err := conn.DeleteRoute(&ec2.DeleteRouteInput{ - RouteTableId: aws.String(defaultRouteTableId), - DestinationCidrBlock: r.DestinationCidrBlock, - }) - if err != nil { - return err + + if r.DestinationCidrBlock != nil { + log.Printf( + "[INFO] Deleting route from %s: %s", + defaultRouteTableId, *r.DestinationCidrBlock) + _, err := conn.DeleteRoute(&ec2.DeleteRouteInput{ + RouteTableId: aws.String(defaultRouteTableId), + DestinationCidrBlock: r.DestinationCidrBlock, + }) + if err != nil { + return err + } + } + + if r.DestinationIpv6CidrBlock != nil { + log.Printf( + "[INFO] Deleting route from %s: %s", + defaultRouteTableId, *r.DestinationIpv6CidrBlock) + _, err := conn.DeleteRoute(&ec2.DeleteRouteInput{ + RouteTableId: aws.String(defaultRouteTableId), + DestinationIpv6CidrBlock: r.DestinationIpv6CidrBlock, + }) + if err != nil { + return err + } } + } return nil diff --git a/installer/server/terraform/plugins/aws/resource_aws_default_route_table_test.go b/installer/server/terraform/plugins/aws/resource_aws_default_route_table_test.go index c3feabf9f9..dd67db0ff6 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_default_route_table_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_default_route_table_test.go @@ -20,7 +20,7 @@ func TestAccAWSDefaultRouteTable_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDefaultRouteTableDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDefaultRouteTableConfig, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -40,7 +40,7 @@ func TestAccAWSDefaultRouteTable_swap(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDefaultRouteTableDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDefaultRouteTable_change, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -53,7 +53,7 @@ func TestAccAWSDefaultRouteTable_swap(t *testing.T) { // behavior that may happen, in which case a follow up plan will show (in // this case) a diff as the table now needs to be updated to match the // config - resource.TestStep{ + { Config: testAccDefaultRouteTable_change_mod, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -74,7 +74,7 @@ func TestAccAWSDefaultRouteTable_vpc_endpoint(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckDefaultRouteTableDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDefaultRouteTable_vpc_endpoint, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( diff --git a/installer/server/terraform/plugins/aws/resource_aws_directory_service_directory.go b/installer/server/terraform/plugins/aws/resource_aws_directory_service_directory.go index 773a5afd88..a9bd952dd2 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_directory_service_directory.go +++ b/installer/server/terraform/plugins/aws/resource_aws_directory_service_directory.go @@ -33,9 +33,10 @@ func resourceAwsDirectoryServiceDirectory() *schema.Resource { ForceNew: true, }, "password": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, }, "size": &schema.Schema{ Type: schema.TypeString, diff --git a/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint.go b/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint.go index 07cd7a2722..586ed9f7c5 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint.go @@ -6,7 +6,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/private/waiter" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -168,6 +167,7 @@ func resourceAwsDmsEndpointRead(d *schema.ResourceData, meta interface{}) error }) if err != nil { if dmserr, ok := err.(awserr.Error); ok && dmserr.Code() == "ResourceNotFoundFault" { + log.Printf("[DEBUG] DMS Replication Endpoint %q Not Found", d.Id()) d.SetId("") return nil } @@ -283,11 +283,6 @@ func resourceAwsDmsEndpointDelete(d *schema.ResourceData, meta interface{}) erro return err } - waitErr := waitForEndpointDelete(conn, d.Get("endpoint_id").(string), 30, 20) - if waitErr != nil { - return waitErr - } - return nil } @@ -310,36 +305,3 @@ func resourceAwsDmsEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoi return nil } - -func waitForEndpointDelete(client *dms.DatabaseMigrationService, endpointId string, delay int, maxAttempts int) error { - input := &dms.DescribeEndpointsInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("endpoint-id"), - Values: []*string{aws.String(endpointId)}, - }, - }, - } - - config := waiter.Config{ - Operation: "DescribeEndpoints", - Delay: delay, - MaxAttempts: maxAttempts, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "path", - Argument: "length(Endpoints[]) > `0`", - Expected: false, - }, - }, - } - - w := waiter.Waiter{ - Client: client, - Input: input, - Config: config, - } - - return w.Wait() -} diff --git a/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint_test.go b/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint_test.go index 6f86622831..59c3d87c77 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dms_endpoint_test.go @@ -8,7 +8,6 @@ import ( dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) @@ -67,11 +66,6 @@ func dmsEndpointDestroy(s *terraform.State) error { } func checkDmsEndpointExists(n string) resource.TestCheckFunc { - providers := []*schema.Provider{testAccProvider} - return checkDmsEndpointExistsWithProviders(n, &providers) -} - -func checkDmsEndpointExistsWithProviders(n string, providers *[]*schema.Provider) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -81,29 +75,26 @@ func checkDmsEndpointExistsWithProviders(n string, providers *[]*schema.Provider if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - for _, provider := range *providers { - // Ignore if Meta is empty, this can happen for validation providers - if provider.Meta() == nil { - continue - } - conn := provider.Meta().(*AWSClient).dmsconn - _, err := conn.DescribeEndpoints(&dms.DescribeEndpointsInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("endpoint-id"), - Values: []*string{aws.String(rs.Primary.ID)}, - }, + conn := testAccProvider.Meta().(*AWSClient).dmsconn + resp, err := conn.DescribeEndpoints(&dms.DescribeEndpointsInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("endpoint-id"), + Values: []*string{aws.String(rs.Primary.ID)}, }, - }) + }, + }) + + if err != nil { + return fmt.Errorf("DMS endpoint error: %v", err) + } - if err != nil { - return fmt.Errorf("DMS endpoint error: %v", err) - } - return nil + if resp.Endpoints == nil { + return fmt.Errorf("DMS endpoint not found") } - return fmt.Errorf("DMS endpoint not found") + return nil } } diff --git a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance.go b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance.go index 63552d28ee..2b6948936c 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance.go @@ -3,11 +3,12 @@ package aws import ( "fmt" "log" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/private/waiter" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" ) @@ -174,12 +175,23 @@ func resourceAwsDmsReplicationInstanceCreate(d *schema.ResourceData, meta interf return err } - err = waitForInstanceCreated(conn, d.Get("replication_instance_id").(string), 30, 20) + d.SetId(d.Get("replication_instance_id").(string)) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"creating"}, + Target: []string{"available"}, + Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta), + Timeout: d.Timeout(schema.TimeoutCreate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting + } + + // Wait, catching any errors + _, err = stateConf.WaitForState() if err != nil { return err } - d.SetId(d.Get("replication_instance_id").(string)) return resourceAwsDmsReplicationInstanceRead(d, meta) } @@ -196,6 +208,7 @@ func resourceAwsDmsReplicationInstanceRead(d *schema.ResourceData, meta interfac }) if err != nil { if dmserr, ok := err.(awserr.Error); ok && dmserr.Code() == "ResourceNotFoundFault" { + log.Printf("[DEBUG] DMS Replication Instance %q Not Found", d.Id()) d.SetId("") return nil } @@ -287,6 +300,21 @@ func resourceAwsDmsReplicationInstanceUpdate(d *schema.ResourceData, meta interf return err } + stateConf := &resource.StateChangeConf{ + Pending: []string{"modifying"}, + Target: []string{"available"}, + Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta), + Timeout: d.Timeout(schema.TimeoutCreate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting + } + + // Wait, catching any errors + _, err = stateConf.WaitForState() + if err != nil { + return err + } + return resourceAwsDmsReplicationInstanceRead(d, meta) } @@ -307,9 +335,19 @@ func resourceAwsDmsReplicationInstanceDelete(d *schema.ResourceData, meta interf return err } - waitErr := waitForInstanceDeleted(conn, d.Get("replication_instance_id").(string), 30, 20) - if waitErr != nil { - return waitErr + stateConf := &resource.StateChangeConf{ + Pending: []string{"deleting"}, + Target: []string{}, + Refresh: resourceAwsDmsReplicationInstanceStateRefreshFunc(d, meta), + Timeout: d.Timeout(schema.TimeoutCreate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting + } + + // Wait, catching any errors + _, err = stateConf.WaitForState() + if err != nil { + return err } return nil @@ -355,68 +393,35 @@ func resourceAwsDmsReplicationInstanceSetState(d *schema.ResourceData, instance return nil } -func waitForInstanceCreated(client *dms.DatabaseMigrationService, id string, delay int, maxAttempts int) error { - input := &dms.DescribeReplicationInstancesInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("replication-instance-id"), - Values: []*string{aws.String(id)}, - }, - }, - } +func resourceAwsDmsReplicationInstanceStateRefreshFunc( + d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + conn := meta.(*AWSClient).dmsconn - config := waiter.Config{ - Operation: "DescribeReplicationInstances", - Delay: delay, - MaxAttempts: maxAttempts, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "pathAll", - Argument: "ReplicationInstances[].ReplicationInstanceStatus", - Expected: "available", + v, err := conn.DescribeReplicationInstances(&dms.DescribeReplicationInstancesInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("replication-instance-id"), + Values: []*string{aws.String(d.Id())}, // Must use d.Id() to work with import. + }, }, - }, - } - - w := waiter.Waiter{ - Client: client, - Input: input, - Config: config, - } - - return w.Wait() -} + }) + if err != nil { + if dmserr, ok := err.(awserr.Error); ok && dmserr.Code() == "ResourceNotFoundFault" { + return nil, "", nil + } + log.Printf("Error on retrieving DMS Replication Instance when waiting: %s", err) + return nil, "", err + } -func waitForInstanceDeleted(client *dms.DatabaseMigrationService, id string, delay int, maxAttempts int) error { - input := &dms.DescribeReplicationInstancesInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("replication-instance-id"), - Values: []*string{aws.String(id)}, - }, - }, - } + if v == nil { + return nil, "", nil + } - config := waiter.Config{ - Operation: "DescribeReplicationInstances", - Delay: delay, - MaxAttempts: maxAttempts, - Acceptors: []waiter.WaitAcceptor{ - { - State: "success", - Matcher: "path", - Argument: "length(ReplicationInstances[]) > `0`", - Expected: false, - }, - }, - } + if v.ReplicationInstances == nil { + return nil, "", fmt.Errorf("Error on retrieving DMS Replication Instance when waiting for State") + } - w := waiter.Waiter{ - Client: client, - Input: input, - Config: config, + return v, *v.ReplicationInstances[0].ReplicationInstanceStatus, nil } - - return w.Wait() } diff --git a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance_test.go b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance_test.go index 17e7f85c8d..0cb8a37d5a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_instance_test.go @@ -8,7 +8,6 @@ import ( dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) @@ -47,11 +46,6 @@ func TestAccAwsDmsReplicationInstanceBasic(t *testing.T) { } func checkDmsReplicationInstanceExists(n string) resource.TestCheckFunc { - providers := []*schema.Provider{testAccProvider} - return checkDmsReplicationInstanceExistsWithProviders(n, &providers) -} - -func checkDmsReplicationInstanceExistsWithProviders(n string, providers *[]*schema.Provider) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -61,29 +55,24 @@ func checkDmsReplicationInstanceExistsWithProviders(n string, providers *[]*sche if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - for _, provider := range *providers { - // Ignore if Meta is empty, this can happen for validation providers - if provider.Meta() == nil { - continue - } - - conn := provider.Meta().(*AWSClient).dmsconn - _, err := conn.DescribeReplicationInstances(&dms.DescribeReplicationInstancesInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("replication-instance-id"), - Values: []*string{aws.String(rs.Primary.ID)}, - }, + conn := testAccProvider.Meta().(*AWSClient).dmsconn + resp, err := conn.DescribeReplicationInstances(&dms.DescribeReplicationInstancesInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("replication-instance-id"), + Values: []*string{aws.String(rs.Primary.ID)}, }, - }) + }, + }) - if err != nil { - return fmt.Errorf("DMS replication instance error: %v", err) - } - return nil + if err != nil { + return fmt.Errorf("DMS replication instance error: %v", err) + } + if resp.ReplicationInstances == nil { + return fmt.Errorf("DMS replication instance not found") } - return fmt.Errorf("DMS replication instance not found") + return nil } } @@ -104,22 +93,11 @@ func dmsReplicationInstanceDestroy(s *terraform.State) error { func dmsReplicationInstanceConfig(randId string) string { return fmt.Sprintf(` -resource "aws_iam_role" "dms_iam_role" { - name = "dms-vpc-role" - assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}" -} - -resource "aws_iam_role_policy_attachment" "dms_iam_role_policy" { - role = "${aws_iam_role.dms_iam_role.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole" -} - resource "aws_vpc" "dms_vpc" { cidr_block = "10.1.0.0/16" tags { Name = "tf-test-dms-vpc-%[1]s" } - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_subnet" "dms_subnet_1" { @@ -146,7 +124,6 @@ resource "aws_dms_replication_subnet_group" "dms_replication_subnet_group" { replication_subnet_group_id = "tf-test-dms-replication-subnet-group-%[1]s" replication_subnet_group_description = "terraform test for replication subnet group" subnet_ids = ["${aws_subnet.dms_subnet_1.id}", "${aws_subnet.dms_subnet_2.id}"] - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_replication_instance" "dms_replication_instance" { @@ -168,22 +145,11 @@ resource "aws_dms_replication_instance" "dms_replication_instance" { func dmsReplicationInstanceConfigUpdate(randId string) string { return fmt.Sprintf(` -resource "aws_iam_role" "dms_iam_role" { - name = "dms-vpc-role" - assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}" -} - -resource "aws_iam_role_policy_attachment" "dms_iam_role_policy" { - role = "${aws_iam_role.dms_iam_role.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole" -} - resource "aws_vpc" "dms_vpc" { cidr_block = "10.1.0.0/16" tags { Name = "tf-test-dms-vpc-%[1]s" } - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_subnet" "dms_subnet_1" { @@ -210,7 +176,6 @@ resource "aws_dms_replication_subnet_group" "dms_replication_subnet_group" { replication_subnet_group_id = "tf-test-dms-replication-subnet-group-%[1]s" replication_subnet_group_description = "terraform test for replication subnet group" subnet_ids = ["${aws_subnet.dms_subnet_1.id}", "${aws_subnet.dms_subnet_2.id}"] - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_replication_instance" "dms_replication_instance" { diff --git a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_subnet_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_subnet_group_test.go index 574745f9e2..608382ccc3 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_subnet_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_subnet_group_test.go @@ -101,22 +101,11 @@ func dmsReplicationSubnetGroupDestroy(s *terraform.State) error { func dmsReplicationSubnetGroupConfig(randId string) string { return fmt.Sprintf(` -resource "aws_iam_role" "dms_iam_role" { - name = "dms-vpc-role" - assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}" -} - -resource "aws_iam_role_policy_attachment" "dms_iam_role_policy" { - role = "${aws_iam_role.dms_iam_role.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole" -} - resource "aws_vpc" "dms_vpc" { cidr_block = "10.1.0.0/16" tags { Name = "tf-test-dms-vpc-%[1]s" } - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_subnet" "dms_subnet_1" { @@ -164,22 +153,11 @@ resource "aws_dms_replication_subnet_group" "dms_replication_subnet_group" { func dmsReplicationSubnetGroupConfigUpdate(randId string) string { return fmt.Sprintf(` -resource "aws_iam_role" "dms_iam_role" { - name = "dms-vpc-role" - assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}" -} - -resource "aws_iam_role_policy_attachment" "dms_iam_role_policy" { - role = "${aws_iam_role.dms_iam_role.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole" -} - resource "aws_vpc" "dms_vpc" { cidr_block = "10.1.0.0/16" tags { Name = "tf-test-dms-vpc-%[1]s" } - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_subnet" "dms_subnet_1" { diff --git a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task.go b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task.go index c797b82c5f..ab10eedbc5 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task.go @@ -8,8 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/private/waiter" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" ) @@ -27,7 +27,7 @@ func resourceAwsDmsReplicationTask() *schema.Resource { Schema: map[string]*schema.Schema{ "cdc_start_time": { - Type: schema.TypeInt, + Type: schema.TypeString, Optional: true, // Requires a Unix timestamp in seconds. Example 1484346880 }, @@ -57,9 +57,10 @@ func resourceAwsDmsReplicationTask() *schema.Resource { ValidateFunc: validateDmsReplicationTaskId, }, "replication_task_settings": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validateJsonString, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateJsonString, + DiffSuppressFunc: suppressEquivalentJsonDiffs, }, "source_endpoint_arn": { Type: schema.TypeString, @@ -68,9 +69,10 @@ func resourceAwsDmsReplicationTask() *schema.Resource { ValidateFunc: validateArn, }, "table_mappings": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validateJsonString, + Type: schema.TypeString, + Required: true, + ValidateFunc: validateJsonString, + DiffSuppressFunc: suppressEquivalentJsonDiffs, }, "tags": { Type: schema.TypeMap, @@ -119,13 +121,23 @@ func resourceAwsDmsReplicationTaskCreate(d *schema.ResourceData, meta interface{ } taskId := d.Get("replication_task_id").(string) + d.SetId(taskId) - err = waitForTaskCreated(conn, taskId, 30, 10) + stateConf := &resource.StateChangeConf{ + Pending: []string{"creating"}, + Target: []string{"ready"}, + Refresh: resourceAwsDmsReplicationTaskStateRefreshFunc(d, meta), + Timeout: d.Timeout(schema.TimeoutCreate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting + } + + // Wait, catching any errors + _, err = stateConf.WaitForState() if err != nil { return err } - d.SetId(taskId) return resourceAwsDmsReplicationTaskRead(d, meta) } @@ -142,6 +154,7 @@ func resourceAwsDmsReplicationTaskRead(d *schema.ResourceData, meta interface{}) }) if err != nil { if dmserr, ok := err.(awserr.Error); ok && dmserr.Code() == "ResourceNotFoundFault" { + log.Printf("[DEBUG] DMS Replication Task %q Not Found", d.Id()) d.SetId("") return nil } @@ -211,7 +224,17 @@ func resourceAwsDmsReplicationTaskUpdate(d *schema.ResourceData, meta interface{ return err } - err = waitForTaskUpdated(conn, d.Get("replication_task_id").(string), 30, 10) + stateConf := &resource.StateChangeConf{ + Pending: []string{"modifying"}, + Target: []string{"ready", "stopped", "failed"}, + Refresh: resourceAwsDmsReplicationTaskStateRefreshFunc(d, meta), + Timeout: d.Timeout(schema.TimeoutCreate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting + } + + // Wait, catching any errors + _, err = stateConf.WaitForState() if err != nil { return err } @@ -233,12 +256,27 @@ func resourceAwsDmsReplicationTaskDelete(d *schema.ResourceData, meta interface{ _, err := conn.DeleteReplicationTask(request) if err != nil { + if dmserr, ok := err.(awserr.Error); ok && dmserr.Code() == "ResourceNotFoundFault" { + log.Printf("[DEBUG] DMS Replication Task %q Not Found", d.Id()) + d.SetId("") + return nil + } return err } - waitErr := waitForTaskDeleted(conn, d.Get("replication_task_id").(string), 30, 10) - if waitErr != nil { - return waitErr + stateConf := &resource.StateChangeConf{ + Pending: []string{"deleting"}, + Target: []string{}, + Refresh: resourceAwsDmsReplicationTaskStateRefreshFunc(d, meta), + Timeout: d.Timeout(schema.TimeoutCreate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting + } + + // Wait, catching any errors + _, err = stateConf.WaitForState() + if err != nil { + return err } return nil @@ -259,119 +297,35 @@ func resourceAwsDmsReplicationTaskSetState(d *schema.ResourceData, task *dms.Rep return nil } -func waitForTaskCreated(client *dms.DatabaseMigrationService, id string, delay int, maxAttempts int) error { - input := &dms.DescribeReplicationTasksInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("replication-task-id"), - Values: []*string{aws.String(id)}, +func resourceAwsDmsReplicationTaskStateRefreshFunc( + d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + conn := meta.(*AWSClient).dmsconn + + v, err := conn.DescribeReplicationTasks(&dms.DescribeReplicationTasksInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("replication-task-id"), + Values: []*string{aws.String(d.Id())}, // Must use d.Id() to work with import. + }, }, - }, - } - - config := waiter.Config{ - Operation: "DescribeReplicationTasks", - Delay: delay, - MaxAttempts: maxAttempts, - Acceptors: []waiter.WaitAcceptor{ - { - State: "retry", - Matcher: "pathAll", - Argument: "ReplicationTasks[].Status", - Expected: "creating", - }, - { - State: "success", - Matcher: "pathAll", - Argument: "ReplicationTasks[].Status", - Expected: "ready", - }, - }, - } - - w := waiter.Waiter{ - Client: client, - Input: input, - Config: config, - } - - return w.Wait() -} - -func waitForTaskUpdated(client *dms.DatabaseMigrationService, id string, delay int, maxAttempts int) error { - input := &dms.DescribeReplicationTasksInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("replication-task-id"), - Values: []*string{aws.String(id)}, - }, - }, - } - - config := waiter.Config{ - Operation: "DescribeReplicationTasks", - Delay: delay, - MaxAttempts: maxAttempts, - Acceptors: []waiter.WaitAcceptor{ - { - State: "retry", - Matcher: "pathAll", - Argument: "ReplicationTasks[].Status", - Expected: "modifying", - }, - { - State: "success", - Matcher: "pathAll", - Argument: "ReplicationTasks[].Status", - Expected: "ready", - }, - }, - } - - w := waiter.Waiter{ - Client: client, - Input: input, - Config: config, - } - - return w.Wait() -} + }) + if err != nil { + if dmserr, ok := err.(awserr.Error); ok && dmserr.Code() == "ResourceNotFoundFault" { + return nil, "", nil + } + log.Printf("Error on retrieving DMS Replication Task when waiting: %s", err) + return nil, "", err + } -func waitForTaskDeleted(client *dms.DatabaseMigrationService, id string, delay int, maxAttempts int) error { - input := &dms.DescribeReplicationTasksInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("replication-task-id"), - Values: []*string{aws.String(id)}, - }, - }, - } + if v == nil { + return nil, "", nil + } - config := waiter.Config{ - Operation: "DescribeReplicationTasks", - Delay: delay, - MaxAttempts: maxAttempts, - Acceptors: []waiter.WaitAcceptor{ - { - State: "retry", - Matcher: "pathAll", - Argument: "ReplicationTasks[].Status", - Expected: "deleting", - }, - { - State: "success", - Matcher: "path", - Argument: "length(ReplicationTasks[]) > `0`", - Expected: false, - }, - }, - } + if v.ReplicationTasks != nil { + log.Printf("[DEBUG] DMS Replication Task status for instance %s: %s", d.Id(), *v.ReplicationTasks[0].Status) + } - w := waiter.Waiter{ - Client: client, - Input: input, - Config: config, + return v, *v.ReplicationTasks[0].Status, nil } - - return w.Wait() } diff --git a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task_test.go b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task_test.go index 07ac7f58f3..9105a31091 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dms_replication_task_test.go @@ -8,7 +8,6 @@ import ( dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) @@ -44,11 +43,6 @@ func TestAccAwsDmsReplicationTaskBasic(t *testing.T) { } func checkDmsReplicationTaskExists(n string) resource.TestCheckFunc { - providers := []*schema.Provider{testAccProvider} - return checkDmsReplicationTaskExistsWithProviders(n, &providers) -} - -func checkDmsReplicationTaskExistsWithProviders(n string, providers *[]*schema.Provider) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -58,29 +52,25 @@ func checkDmsReplicationTaskExistsWithProviders(n string, providers *[]*schema.P if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - for _, provider := range *providers { - // Ignore if Meta is empty, this can happen for validation providers - if provider.Meta() == nil { - continue - } - conn := provider.Meta().(*AWSClient).dmsconn - _, err := conn.DescribeReplicationTasks(&dms.DescribeReplicationTasksInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("replication-task-id"), - Values: []*string{aws.String(rs.Primary.ID)}, - }, + conn := testAccProvider.Meta().(*AWSClient).dmsconn + resp, err := conn.DescribeReplicationTasks(&dms.DescribeReplicationTasksInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("replication-task-id"), + Values: []*string{aws.String(rs.Primary.ID)}, }, - }) + }, + }) - if err != nil { - return fmt.Errorf("DMS replication subnet group error: %v", err) - } - return nil + if err != nil { + return err } - return fmt.Errorf("DMS replication subnet group not found") + if resp.ReplicationTasks == nil { + return fmt.Errorf("DMS replication task error: %v", err) + } + return nil } } @@ -90,9 +80,22 @@ func dmsReplicationTaskDestroy(s *terraform.State) error { continue } - err := checkDmsReplicationTaskExists(rs.Primary.ID) - if err == nil { - return fmt.Errorf("Found replication subnet group that was not destroyed: %s", rs.Primary.ID) + conn := testAccProvider.Meta().(*AWSClient).dmsconn + resp, err := conn.DescribeReplicationTasks(&dms.DescribeReplicationTasksInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("replication-task-id"), + Values: []*string{aws.String(rs.Primary.ID)}, + }, + }, + }) + + if err != nil { + return nil + } + + if resp != nil && len(resp.ReplicationTasks) > 0 { + return fmt.Errorf("DMS replication task still exists: %v", err) } } @@ -101,22 +104,11 @@ func dmsReplicationTaskDestroy(s *terraform.State) error { func dmsReplicationTaskConfig(randId string) string { return fmt.Sprintf(` -resource "aws_iam_role" "dms_iam_role" { - name = "dms-vpc-role" - assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}" -} - -resource "aws_iam_role_policy_attachment" "dms_iam_role_policy" { - role = "${aws_iam_role.dms_iam_role.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole" -} - resource "aws_vpc" "dms_vpc" { cidr_block = "10.1.0.0/16" tags { Name = "tf-test-dms-vpc-%[1]s" } - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_subnet" "dms_subnet_1" { @@ -148,7 +140,6 @@ resource "aws_dms_endpoint" "dms_endpoint_source" { port = 3306 username = "tftest" password = "tftest" - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_endpoint" "dms_endpoint_target" { @@ -160,14 +151,12 @@ resource "aws_dms_endpoint" "dms_endpoint_target" { port = 3306 username = "tftest" password = "tftest" - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_replication_subnet_group" "dms_replication_subnet_group" { replication_subnet_group_id = "tf-test-dms-replication-subnet-group-%[1]s" replication_subnet_group_description = "terraform test for replication subnet group" subnet_ids = ["${aws_subnet.dms_subnet_1.id}", "${aws_subnet.dms_subnet_2.id}"] - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_replication_instance" "dms_replication_instance" { @@ -199,22 +188,11 @@ resource "aws_dms_replication_task" "dms_replication_task" { func dmsReplicationTaskConfigUpdate(randId string) string { return fmt.Sprintf(` -resource "aws_iam_role" "dms_iam_role" { - name = "dms-vpc-role" - assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"dms.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}" -} - -resource "aws_iam_role_policy_attachment" "dms_iam_role_policy" { - role = "${aws_iam_role.dms_iam_role.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole" -} - resource "aws_vpc" "dms_vpc" { cidr_block = "10.1.0.0/16" tags { Name = "tf-test-dms-vpc-%[1]s" } - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_subnet" "dms_subnet_1" { @@ -246,7 +224,6 @@ resource "aws_dms_endpoint" "dms_endpoint_source" { port = 3306 username = "tftest" password = "tftest" - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_endpoint" "dms_endpoint_target" { @@ -258,14 +235,12 @@ resource "aws_dms_endpoint" "dms_endpoint_target" { port = 3306 username = "tftest" password = "tftest" - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_replication_subnet_group" "dms_replication_subnet_group" { replication_subnet_group_id = "tf-test-dms-replication-subnet-group-%[1]s" replication_subnet_group_description = "terraform test for replication subnet group" subnet_ids = ["${aws_subnet.dms_subnet_1.id}", "${aws_subnet.dms_subnet_2.id}"] - depends_on = ["aws_iam_role_policy_attachment.dms_iam_role_policy"] } resource "aws_dms_replication_instance" "dms_replication_instance" { diff --git a/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table.go b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table.go index e0c63760d5..fff6775c16 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table.go @@ -39,6 +39,9 @@ func resourceAwsDynamoDbTable() *schema.Resource { State: schema.ImportStatePassthrough, }, + SchemaVersion: 1, + MigrateState: resourceAwsDynamoDbTableMigrateState, + Schema: map[string]*schema.Schema{ "arn": { Type: schema.TypeString, @@ -157,15 +160,6 @@ func resourceAwsDynamoDbTable() *schema.Resource { }, }, }, - // GSI names are the uniqueness constraint - Set: func(v interface{}) int { - var buf bytes.Buffer - m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["name"].(string))) - buf.WriteString(fmt.Sprintf("%d-", m["write_capacity"].(int))) - buf.WriteString(fmt.Sprintf("%d-", m["read_capacity"].(int))) - return hashcode.String(buf.String()) - }, }, "stream_enabled": { Type: schema.TypeBool, @@ -533,9 +527,8 @@ func resourceAwsDynamoDbTableUpdate(d *schema.ResourceData, meta interface{}) er table := tableDescription.Table - updates := []*dynamodb.GlobalSecondaryIndexUpdate{} - for _, updatedgsidata := range gsiSet.List() { + updates := []*dynamodb.GlobalSecondaryIndexUpdate{} gsidata := updatedgsidata.(map[string]interface{}) gsiName := gsidata["name"].(string) gsiWriteCapacity := gsidata["write_capacity"].(int) @@ -584,6 +577,10 @@ func resourceAwsDynamoDbTableUpdate(d *schema.ResourceData, meta interface{}) er log.Printf("[DEBUG] Error updating table: %s", err) return err } + + if err := waitForGSIToBeActive(d.Id(), gsiName, meta); err != nil { + return errwrap.Wrapf("Error waiting for Dynamo DB GSI to be active: {{err}}", err) + } } } } diff --git a/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go new file mode 100644 index 0000000000..59865effc8 --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go @@ -0,0 +1,70 @@ +package aws + +import ( + "fmt" + "log" + + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/terraform" + "strings" +) + +func resourceAwsDynamoDbTableMigrateState( + v int, is *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) { + switch v { + case 0: + log.Println("[INFO] Found AWS DynamoDB Table State v0; migrating to v1") + return migrateDynamoDBStateV0toV1(is) + default: + return is, fmt.Errorf("Unexpected schema version: %d", v) + } +} + +func migrateDynamoDBStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) { + if is.Empty() { + log.Println("[DEBUG] Empty InstanceState; nothing to migrate.") + return is, nil + } + + log.Printf("[DEBUG] DynamoDB Table Attributes before Migration: %#v", is.Attributes) + + prefix := "global_secondary_index" + entity := resourceAwsDynamoDbTable() + + // Read old keys + reader := &schema.MapFieldReader{ + Schema: entity.Schema, + Map: schema.BasicMapReader(is.Attributes), + } + result, err := reader.ReadField([]string{prefix}) + if err != nil { + return nil, err + } + + oldKeys, ok := result.Value.(*schema.Set) + if !ok { + return nil, fmt.Errorf("Got unexpected value from state: %#v", result.Value) + } + + // Delete old keys + for k := range is.Attributes { + if strings.HasPrefix(k, fmt.Sprintf("%s.", prefix)) { + delete(is.Attributes, k) + } + } + + // Write new keys + writer := schema.MapFieldWriter{ + Schema: entity.Schema, + } + if err := writer.WriteField([]string{prefix}, oldKeys); err != nil { + return is, err + } + for k, v := range writer.Map() { + is.Attributes[k] = v + } + + log.Printf("[DEBUG] DynamoDB Table Attributes after State Migration: %#v", is.Attributes) + + return is, nil +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_test.go b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_test.go index 4d5437f170..fe2ce175f9 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_test.go @@ -14,19 +14,24 @@ import ( ) func TestAccAWSDynamoDbTable_basic(t *testing.T) { + var conf dynamodb.DescribeTableOutput + + rName := acctest.RandomWithPrefix("TerraformTestTable-") + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSDynamoDbConfigInitialState(), + Config: testAccAWSDynamoDbConfigInitialState(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.basic-dynamodb-table"), + testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.basic-dynamodb-table", &conf), + testAccCheckInitialAWSDynamoDbTableConf("aws_dynamodb_table.basic-dynamodb-table"), ), }, { - Config: testAccAWSDynamoDbConfigAddSecondaryGSI, + Config: testAccAWSDynamoDbConfigAddSecondaryGSI(rName), Check: resource.ComposeTestCheckFunc( testAccCheckDynamoDbTableWasUpdated("aws_dynamodb_table.basic-dynamodb-table"), ), @@ -36,6 +41,8 @@ func TestAccAWSDynamoDbTable_basic(t *testing.T) { } func TestAccAWSDynamoDbTable_streamSpecification(t *testing.T) { + var conf dynamodb.DescribeTableOutput + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -44,7 +51,8 @@ func TestAccAWSDynamoDbTable_streamSpecification(t *testing.T) { { Config: testAccAWSDynamoDbConfigStreamSpecification(), Check: resource.ComposeTestCheckFunc( - testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.basic-dynamodb-table"), + testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.basic-dynamodb-table", &conf), + testAccCheckInitialAWSDynamoDbTableConf("aws_dynamodb_table.basic-dynamodb-table"), resource.TestCheckResourceAttr( "aws_dynamodb_table.basic-dynamodb-table", "stream_enabled", "true"), resource.TestCheckResourceAttr( @@ -56,6 +64,8 @@ func TestAccAWSDynamoDbTable_streamSpecification(t *testing.T) { } func TestAccAWSDynamoDbTable_tags(t *testing.T) { + var conf dynamodb.DescribeTableOutput + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -64,7 +74,8 @@ func TestAccAWSDynamoDbTable_tags(t *testing.T) { { Config: testAccAWSDynamoDbConfigTags(), Check: resource.ComposeTestCheckFunc( - testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.basic-dynamodb-table"), + testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.basic-dynamodb-table", &conf), + testAccCheckInitialAWSDynamoDbTableConf("aws_dynamodb_table.basic-dynamodb-table"), resource.TestCheckResourceAttr( "aws_dynamodb_table.basic-dynamodb-table", "tags.%", "3"), ), @@ -73,6 +84,32 @@ func TestAccAWSDynamoDbTable_tags(t *testing.T) { }) } +// https://github.com/hashicorp/terraform/issues/13243 +func TestAccAWSDynamoDbTable_gsiUpdate(t *testing.T) { + var conf dynamodb.DescribeTableOutput + name := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDynamoDbConfigGsiUpdate(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.test", &conf), + ), + }, + { + Config: testAccAWSDynamoDbConfigGsiUpdated(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckInitialAWSDynamoDbTableExists("aws_dynamodb_table.test", &conf), + ), + }, + }, + }) +} + func TestResourceAWSDynamoDbTableStreamViewType_validation(t *testing.T) { cases := []struct { Value string @@ -143,7 +180,37 @@ func testAccCheckAWSDynamoDbTableDestroy(s *terraform.State) error { return nil } -func testAccCheckInitialAWSDynamoDbTableExists(n string) resource.TestCheckFunc { +func testAccCheckInitialAWSDynamoDbTableExists(n string, table *dynamodb.DescribeTableOutput) resource.TestCheckFunc { + return func(s *terraform.State) error { + log.Printf("[DEBUG] Trying to create initial table state!") + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No DynamoDB table name specified!") + } + + conn := testAccProvider.Meta().(*AWSClient).dynamodbconn + + params := &dynamodb.DescribeTableInput{ + TableName: aws.String(rs.Primary.ID), + } + + resp, err := conn.DescribeTable(params) + + if err != nil { + return fmt.Errorf("[ERROR] Problem describing table '%s': %s", rs.Primary.ID, err) + } + + *table = *resp + + return nil + } +} + +func testAccCheckInitialAWSDynamoDbTableConf(n string) resource.TestCheckFunc { return func(s *terraform.State) error { log.Printf("[DEBUG] Trying to create initial table state!") rs, ok := s.RootModule().Resources[n] @@ -298,126 +365,145 @@ func dynamoDbAttributesToMap(attributes *[]*dynamodb.AttributeDefinition) map[st return attrmap } -func testAccAWSDynamoDbConfigInitialState() string { +func testAccAWSDynamoDbConfigInitialState(rName string) string { return fmt.Sprintf(` resource "aws_dynamodb_table" "basic-dynamodb-table" { - name = "TerraformTestTable-%d" - read_capacity = 10 - write_capacity = 20 - hash_key = "TestTableHashKey" - range_key = "TestTableRangeKey" - attribute { - name = "TestTableHashKey" - type = "S" - } - attribute { - name = "TestTableRangeKey" - type = "S" - } - attribute { - name = "TestLSIRangeKey" - type = "N" - } - attribute { - name = "TestGSIRangeKey" - type = "S" - } - local_secondary_index { - name = "TestTableLSI" - range_key = "TestLSIRangeKey" - projection_type = "ALL" - } - global_secondary_index { - name = "InitialTestTableGSI" - hash_key = "TestTableHashKey" - range_key = "TestGSIRangeKey" - write_capacity = 10 - read_capacity = 10 - projection_type = "KEYS_ONLY" - } + name = "%s" + read_capacity = 10 + write_capacity = 20 + hash_key = "TestTableHashKey" + range_key = "TestTableRangeKey" + + attribute { + name = "TestTableHashKey" + type = "S" + } + + attribute { + name = "TestTableRangeKey" + type = "S" + } + + attribute { + name = "TestLSIRangeKey" + type = "N" + } + + attribute { + name = "TestGSIRangeKey" + type = "S" + } + + local_secondary_index { + name = "TestTableLSI" + range_key = "TestLSIRangeKey" + projection_type = "ALL" + } + + global_secondary_index { + name = "InitialTestTableGSI" + hash_key = "TestTableHashKey" + range_key = "TestGSIRangeKey" + write_capacity = 10 + read_capacity = 10 + projection_type = "KEYS_ONLY" + } } -`, acctest.RandInt()) +`, rName) } -const testAccAWSDynamoDbConfigAddSecondaryGSI = ` +func testAccAWSDynamoDbConfigAddSecondaryGSI(rName string) string { + return fmt.Sprintf(` resource "aws_dynamodb_table" "basic-dynamodb-table" { - name = "TerraformTestTable" - read_capacity = 20 - write_capacity = 20 - hash_key = "TestTableHashKey" - range_key = "TestTableRangeKey" - attribute { - name = "TestTableHashKey" - type = "S" - } - attribute { - name = "TestTableRangeKey" - type = "S" - } - attribute { - name = "TestLSIRangeKey" - type = "N" - } - attribute { - name = "ReplacementGSIRangeKey" - type = "N" - } - local_secondary_index { - name = "TestTableLSI" - range_key = "TestLSIRangeKey" - projection_type = "ALL" - } - global_secondary_index { - name = "ReplacementTestTableGSI" - hash_key = "TestTableHashKey" - range_key = "ReplacementGSIRangeKey" - write_capacity = 5 - read_capacity = 5 - projection_type = "INCLUDE" - non_key_attributes = ["TestNonKeyAttribute"] - } + name = "%s" + read_capacity = 20 + write_capacity = 20 + hash_key = "TestTableHashKey" + range_key = "TestTableRangeKey" + + attribute { + name = "TestTableHashKey" + type = "S" + } + + attribute { + name = "TestTableRangeKey" + type = "S" + } + + attribute { + name = "TestLSIRangeKey" + type = "N" + } + + attribute { + name = "ReplacementGSIRangeKey" + type = "N" + } + + local_secondary_index { + name = "TestTableLSI" + range_key = "TestLSIRangeKey" + projection_type = "ALL" + } + + global_secondary_index { + name = "ReplacementTestTableGSI" + hash_key = "TestTableHashKey" + range_key = "ReplacementGSIRangeKey" + write_capacity = 5 + read_capacity = 5 + projection_type = "INCLUDE" + non_key_attributes = ["TestNonKeyAttribute"] + } +}`, rName) } -` func testAccAWSDynamoDbConfigStreamSpecification() string { return fmt.Sprintf(` resource "aws_dynamodb_table" "basic-dynamodb-table" { - name = "TerraformTestStreamTable-%d" - read_capacity = 10 - write_capacity = 20 - hash_key = "TestTableHashKey" - range_key = "TestTableRangeKey" - attribute { - name = "TestTableHashKey" - type = "S" - } - attribute { - name = "TestTableRangeKey" - type = "S" - } - attribute { - name = "TestLSIRangeKey" - type = "N" - } - attribute { - name = "TestGSIRangeKey" - type = "S" - } - local_secondary_index { - name = "TestTableLSI" - range_key = "TestLSIRangeKey" - projection_type = "ALL" - } - global_secondary_index { - name = "InitialTestTableGSI" - hash_key = "TestTableHashKey" - range_key = "TestGSIRangeKey" - write_capacity = 10 - read_capacity = 10 - projection_type = "KEYS_ONLY" - } - stream_enabled = true - stream_view_type = "KEYS_ONLY" + name = "TerraformTestStreamTable-%d" + read_capacity = 10 + write_capacity = 20 + hash_key = "TestTableHashKey" + range_key = "TestTableRangeKey" + + attribute { + name = "TestTableHashKey" + type = "S" + } + + attribute { + name = "TestTableRangeKey" + type = "S" + } + + attribute { + name = "TestLSIRangeKey" + type = "N" + } + + attribute { + name = "TestGSIRangeKey" + type = "S" + } + + local_secondary_index { + name = "TestTableLSI" + range_key = "TestLSIRangeKey" + projection_type = "ALL" + } + + global_secondary_index { + name = "InitialTestTableGSI" + hash_key = "TestTableHashKey" + range_key = "TestGSIRangeKey" + write_capacity = 10 + read_capacity = 10 + projection_type = "KEYS_ONLY" + } + stream_enabled = true + stream_view_type = "KEYS_ONLY" } `, acctest.RandInt()) } @@ -425,45 +511,170 @@ resource "aws_dynamodb_table" "basic-dynamodb-table" { func testAccAWSDynamoDbConfigTags() string { return fmt.Sprintf(` resource "aws_dynamodb_table" "basic-dynamodb-table" { - name = "TerraformTestTable-%d" - read_capacity = 10 - write_capacity = 20 - hash_key = "TestTableHashKey" - range_key = "TestTableRangeKey" - attribute { - name = "TestTableHashKey" - type = "S" - } - attribute { - name = "TestTableRangeKey" - type = "S" - } - attribute { - name = "TestLSIRangeKey" - type = "N" - } - attribute { - name = "TestGSIRangeKey" - type = "S" - } - local_secondary_index { - name = "TestTableLSI" - range_key = "TestLSIRangeKey" - projection_type = "ALL" - } - global_secondary_index { - name = "InitialTestTableGSI" - hash_key = "TestTableHashKey" - range_key = "TestGSIRangeKey" - write_capacity = 10 - read_capacity = 10 - projection_type = "KEYS_ONLY" - } - tags { - Name = "terraform-test-table-%d" - AccTest = "yes" - Testing = "absolutely" - } + name = "TerraformTestTable-%d" + read_capacity = 10 + write_capacity = 20 + hash_key = "TestTableHashKey" + range_key = "TestTableRangeKey" + + attribute { + name = "TestTableHashKey" + type = "S" + } + + attribute { + name = "TestTableRangeKey" + type = "S" + } + + attribute { + name = "TestLSIRangeKey" + type = "N" + } + + attribute { + name = "TestGSIRangeKey" + type = "S" + } + + local_secondary_index { + name = "TestTableLSI" + range_key = "TestLSIRangeKey" + projection_type = "ALL" + } + + global_secondary_index { + name = "InitialTestTableGSI" + hash_key = "TestTableHashKey" + range_key = "TestGSIRangeKey" + write_capacity = 10 + read_capacity = 10 + projection_type = "KEYS_ONLY" + } + + tags { + Name = "terraform-test-table-%d" + AccTest = "yes" + Testing = "absolutely" + } } `, acctest.RandInt(), acctest.RandInt()) } + +func testAccAWSDynamoDbConfigGsiUpdate(name string) string { + return fmt.Sprintf(` +variable "capacity" { + default = 10 +} + +resource "aws_dynamodb_table" "test" { + name = "tf-acc-test-%s" + read_capacity = "${var.capacity}" + write_capacity = "${var.capacity}" + hash_key = "id" + + attribute { + name = "id" + type = "S" + } + + attribute { + name = "att1" + type = "S" + } + + attribute { + name = "att2" + type = "S" + } + + attribute { + name = "att3" + type = "S" + } + + global_secondary_index { + name = "att1-index" + hash_key = "att1" + write_capacity = "${var.capacity}" + read_capacity = "${var.capacity}" + projection_type = "ALL" + } + + global_secondary_index { + name = "att2-index" + hash_key = "att2" + write_capacity = "${var.capacity}" + read_capacity = "${var.capacity}" + projection_type = "ALL" + } + + global_secondary_index { + name = "att3-index" + hash_key = "att3" + write_capacity = "${var.capacity}" + read_capacity = "${var.capacity}" + projection_type = "ALL" + } +} +`, name) +} + +func testAccAWSDynamoDbConfigGsiUpdated(name string) string { + return fmt.Sprintf(` +variable "capacity" { + default = 20 +} + +resource "aws_dynamodb_table" "test" { + name = "tf-acc-test-%s" + read_capacity = "${var.capacity}" + write_capacity = "${var.capacity}" + hash_key = "id" + + attribute { + name = "id" + type = "S" + } + + attribute { + name = "att1" + type = "S" + } + + attribute { + name = "att2" + type = "S" + } + + attribute { + name = "att3" + type = "S" + } + + global_secondary_index { + name = "att1-index" + hash_key = "att1" + write_capacity = "${var.capacity}" + read_capacity = "${var.capacity}" + projection_type = "ALL" + } + + global_secondary_index { + name = "att2-index" + hash_key = "att2" + write_capacity = "${var.capacity}" + read_capacity = "${var.capacity}" + projection_type = "ALL" + } + + global_secondary_index { + name = "att3-index" + hash_key = "att3" + write_capacity = "${var.capacity}" + read_capacity = "${var.capacity}" + projection_type = "ALL" + } +} +`, name) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_ecs_service.go b/installer/server/terraform/plugins/aws/resource_aws_ecs_service.go index b539852dcb..9874effd53 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ecs_service.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ecs_service.go @@ -118,6 +118,12 @@ func resourceAwsEcsService() *schema.Resource { Type: schema.TypeString, ForceNew: true, Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if strings.ToLower(old) == strings.ToLower(new) { + return true + } + return false + }, }, }, }, @@ -357,7 +363,13 @@ func flattenPlacementStrategy(pss []*ecs.PlacementStrategy) []map[string]interfa for _, ps := range pss { c := make(map[string]interface{}) c["type"] = *ps.Type - c["field"] = strings.ToLower(*ps.Field) + c["field"] = *ps.Field + + // for some fields the API requires lowercase for creation but will return uppercase on query + if *ps.Field == "MEMORY" || *ps.Field == "CPU" { + c["field"] = strings.ToLower(*ps.Field) + } + results = append(results, c) } return results @@ -467,7 +479,7 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error // Wait until it's deleted wait := resource.StateChangeConf{ - Pending: []string{"DRAINING"}, + Pending: []string{"ACTIVE", "DRAINING"}, Target: []string{"INACTIVE"}, Timeout: 10 * time.Minute, MinTimeout: 1 * time.Second, @@ -498,10 +510,15 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error func resourceAwsEcsLoadBalancerHash(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) + buf.WriteString(fmt.Sprintf("%s-", m["elb_name"].(string))) buf.WriteString(fmt.Sprintf("%s-", m["container_name"].(string))) buf.WriteString(fmt.Sprintf("%d-", m["container_port"].(int))) + if s := m["target_group_arn"].(string); s != "" { + buf.WriteString(fmt.Sprintf("%s-", s)) + } + return hashcode.String(buf.String()) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_ecs_service_test.go b/installer/server/terraform/plugins/aws/resource_aws_ecs_service_test.go index dab45018ad..c3a6035475 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ecs_service_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ecs_service_test.go @@ -7,6 +7,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ecs" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -84,20 +85,21 @@ func TestParseTaskDefinition(t *testing.T) { } func TestAccAWSEcsServiceWithARN(t *testing.T) { + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService, + Config: testAccAWSEcsService(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo"), ), }, { - Config: testAccAWSEcsServiceModified, + Config: testAccAWSEcsServiceModified(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo"), ), @@ -107,20 +109,21 @@ func TestAccAWSEcsServiceWithARN(t *testing.T) { } func TestAccAWSEcsServiceWithFamilyAndRevision(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-test") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithFamilyAndRevision, + Config: testAccAWSEcsServiceWithFamilyAndRevision(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.jenkins"), ), }, { - Config: testAccAWSEcsServiceWithFamilyAndRevisionModified, + Config: testAccAWSEcsServiceWithFamilyAndRevisionModified(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.jenkins"), ), @@ -179,13 +182,14 @@ func TestAccAWSEcsService_withIamRole(t *testing.T) { } func TestAccAWSEcsService_withDeploymentValues(t *testing.T) { + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithDeploymentValues, + Config: testAccAWSEcsServiceWithDeploymentValues(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo"), resource.TestCheckResourceAttr( @@ -242,13 +246,15 @@ func TestAccAWSEcsService_withEcsClusterName(t *testing.T) { } func TestAccAWSEcsService_withAlb(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc") + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithAlb, + Config: testAccAWSEcsServiceWithAlb(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.with_alb"), ), @@ -258,20 +264,21 @@ func TestAccAWSEcsService_withAlb(t *testing.T) { } func TestAccAWSEcsServiceWithPlacementStrategy(t *testing.T) { + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService, + Config: testAccAWSEcsService(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo"), resource.TestCheckResourceAttr("aws_ecs_service.mongo", "placement_strategy.#", "0"), ), }, { - Config: testAccAWSEcsServiceWithPlacementStrategy, + Config: testAccAWSEcsServiceWithPlacementStrategy(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo"), resource.TestCheckResourceAttr("aws_ecs_service.mongo", "placement_strategy.#", "1"), @@ -282,13 +289,14 @@ func TestAccAWSEcsServiceWithPlacementStrategy(t *testing.T) { } func TestAccAWSEcsServiceWithPlacementConstraints(t *testing.T) { + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithPlacementConstraint, + Config: testAccAWSEcsServiceWithPlacementConstraint(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo"), resource.TestCheckResourceAttr("aws_ecs_service.mongo", "placement_constraints.#", "1"), @@ -299,13 +307,14 @@ func TestAccAWSEcsServiceWithPlacementConstraints(t *testing.T) { } func TestAccAWSEcsServiceWithPlacementConstraints_emptyExpression(t *testing.T) { + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithPlacementConstraintEmptyExpression, + Config: testAccAWSEcsServiceWithPlacementConstraintEmptyExpression(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo"), resource.TestCheckResourceAttr("aws_ecs_service.mongo", "placement_constraints.#", "1"), @@ -362,9 +371,10 @@ func testAccCheckAWSEcsServiceExists(name string) resource.TestCheckFunc { } } -var testAccAWSEcsService = ` +func testAccAWSEcsService(rInt int) string { + return fmt.Sprintf(` resource "aws_ecs_cluster" "default" { - name = "terraformecstest1" + name = "terraformecstest%d" } resource "aws_ecs_task_definition" "mongo" { @@ -383,16 +393,18 @@ DEFINITION } resource "aws_ecs_service" "mongo" { - name = "mongodb" + name = "mongodb-%d" cluster = "${aws_ecs_cluster.default.id}" task_definition = "${aws_ecs_task_definition.mongo.arn}" desired_count = 1 } -` +`, rInt, rInt) +} -var testAccAWSEcsServiceModified = ` +func testAccAWSEcsServiceModified(rInt int) string { + return fmt.Sprintf(` resource "aws_ecs_cluster" "default" { - name = "terraformecstest1" + name = "terraformecstest%d" } resource "aws_ecs_task_definition" "mongo" { @@ -411,16 +423,18 @@ DEFINITION } resource "aws_ecs_service" "mongo" { - name = "mongodb" + name = "mongodb-%d" cluster = "${aws_ecs_cluster.default.id}" task_definition = "${aws_ecs_task_definition.mongo.arn}" desired_count = 2 } -` +`, rInt, rInt) +} -var testAccAWSEcsServiceWithPlacementStrategy = ` +func testAccAWSEcsServiceWithPlacementStrategy(rInt int) string { + return fmt.Sprintf(` resource "aws_ecs_cluster" "default" { - name = "terraformecstest1" + name = "terraformecstest%d" } resource "aws_ecs_task_definition" "mongo" { @@ -439,7 +453,7 @@ DEFINITION } resource "aws_ecs_service" "mongo" { - name = "mongodb" + name = "mongodb-%d" cluster = "${aws_ecs_cluster.default.id}" task_definition = "${aws_ecs_task_definition.mongo.arn}" desired_count = 1 @@ -448,43 +462,47 @@ resource "aws_ecs_service" "mongo" { field = "memory" } } -` - -var testAccAWSEcsServiceWithPlacementConstraint = ` -resource "aws_ecs_cluster" "default" { - name = "terraformecstest21" +`, rInt, rInt) } -resource "aws_ecs_task_definition" "mongo" { - family = "mongodb" - container_definitions = < 0 { + return fmt.Errorf("Bad: Account alias still exists: %q", rs.Primary.ID) + } + } + + return nil + +} + +func testAccCheckAWSIAMAccountAliasExists(n string, a *string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + conn := testAccProvider.Meta().(*AWSClient).iamconn + params := &iam.ListAccountAliasesInput{} + + resp, err := conn.ListAccountAliases(params) + + if err != nil || resp == nil { + return nil + } + + if len(resp.AccountAliases) == 0 { + return fmt.Errorf("Bad: Account alias %q does not exist", rs.Primary.ID) + } + + *a = aws.StringValue(resp.AccountAliases[0]) + + return nil + } +} + +func testAccAWSIAMAccountAliasConfig(rstring string) string { + return fmt.Sprintf(` +resource "aws_iam_account_alias" "test" { + account_alias = "terraform-%s-alias" +} +`, rstring) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy.go b/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy.go index 2c16fe1c60..1bdf725451 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy.go +++ b/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/iam" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" ) @@ -27,8 +28,15 @@ func resourceAwsIamGroupPolicy() *schema.Resource { Required: true, }, "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"name_prefix"}, + }, + "name_prefix": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, "group": &schema.Schema{ @@ -45,10 +53,19 @@ func resourceAwsIamGroupPolicyPut(d *schema.ResourceData, meta interface{}) erro request := &iam.PutGroupPolicyInput{ GroupName: aws.String(d.Get("group").(string)), - PolicyName: aws.String(d.Get("name").(string)), PolicyDocument: aws.String(d.Get("policy").(string)), } + var policyName string + if v, ok := d.GetOk("name"); ok { + policyName = v.(string) + } else if v, ok := d.GetOk("name_prefix"); ok { + policyName = resource.PrefixedUniqueId(v.(string)) + } else { + policyName = resource.UniqueId() + } + request.PolicyName = aws.String(policyName) + if _, err := iamconn.PutGroupPolicy(request); err != nil { return fmt.Errorf("Error putting IAM group policy %s: %s", *request.PolicyName, err) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy_test.go b/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy_test.go index 8ca167b8ab..6e33cd4844 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_iam_group_policy_test.go @@ -7,18 +7,20 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/iam" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccAWSIAMGroupPolicy_basic(t *testing.T) { + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckIAMGroupPolicyDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccIAMGroupPolicyConfig, + { + Config: testAccIAMGroupPolicyConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckIAMGroupPolicy( "aws_iam_group.group", @@ -26,8 +28,8 @@ func TestAccAWSIAMGroupPolicy_basic(t *testing.T) { ), ), }, - resource.TestStep{ - Config: testAccIAMGroupPolicyConfigUpdate, + { + Config: testAccIAMGroupPolicyConfigUpdate(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckIAMGroupPolicy( "aws_iam_group.group", @@ -39,6 +41,48 @@ func TestAccAWSIAMGroupPolicy_basic(t *testing.T) { }) } +func TestAccAWSIAMGroupPolicy_namePrefix(t *testing.T) { + rInt := acctest.RandInt() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_iam_group_policy.test", + Providers: testAccProviders, + CheckDestroy: testAccCheckIAMGroupPolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccIAMGroupPolicyConfig_namePrefix(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckIAMGroupPolicy( + "aws_iam_group.test", + "aws_iam_group_policy.test", + ), + ), + }, + }, + }) +} + +func TestAccAWSIAMGroupPolicy_generatedName(t *testing.T) { + rInt := acctest.RandInt() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_iam_group_policy.test", + Providers: testAccProviders, + CheckDestroy: testAccCheckIAMGroupPolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccIAMGroupPolicyConfig_generatedName(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckIAMGroupPolicy( + "aws_iam_group.test", + "aws_iam_group_policy.test", + ), + ), + }, + }, + }) +} + func testAccCheckIAMGroupPolicyDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).iamconn @@ -102,43 +146,90 @@ func testAccCheckIAMGroupPolicy( } } -const testAccIAMGroupPolicyConfig = ` -resource "aws_iam_group" "group" { - name = "test_group" - path = "/" -} +func testAccIAMGroupPolicyConfig(rInt int) string { + return fmt.Sprintf(` + resource "aws_iam_group" "group" { + name = "test_group_%d" + path = "/" + } -resource "aws_iam_group_policy" "foo" { - name = "foo_policy" - group = "${aws_iam_group.group.name}" - policy = < 0 { + d.Set("role", result.Roles[0].RoleName) //there will only be 1 role returned + } roles := &schema.Set{F: schema.HashString} for _, role := range result.Roles { diff --git a/installer/server/terraform/plugins/aws/resource_aws_iam_instance_profile_test.go b/installer/server/terraform/plugins/aws/resource_aws_iam_instance_profile_test.go index 0bd3d5ffb1..f60c4584fb 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_iam_instance_profile_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_iam_instance_profile_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "regexp" "strings" "testing" @@ -37,6 +38,8 @@ func TestAccAWSIAMInstanceProfile_importBasic(t *testing.T) { } func TestAccAWSIAMInstanceProfile_basic(t *testing.T) { + var conf iam.GetInstanceProfileOutput + rName := acctest.RandString(5) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -44,6 +47,41 @@ func TestAccAWSIAMInstanceProfile_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccAwsIamInstanceProfileConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSInstanceProfileExists("aws_iam_instance_profile.test", &conf), + ), + }, + }, + }) +} + +func TestAccAWSIAMInstanceProfile_withRoleNotRoles(t *testing.T) { + var conf iam.GetInstanceProfileOutput + + rName := acctest.RandString(5) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccAWSInstanceProfileWithRoleSpecified(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSInstanceProfileExists("aws_iam_instance_profile.test", &conf), + ), + }, + }, + }) +} + +func TestAccAWSIAMInstanceProfile_missingRoleThrowsError(t *testing.T) { + rName := acctest.RandString(5) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccAwsIamInstanceProfileConfigMissingRole(rName), + ExpectError: regexp.MustCompile(regexp.QuoteMeta("Either `role` or `roles` (deprecated) must be specified when creating an IAM Instance Profile")), }, }, }) @@ -157,6 +195,13 @@ resource "aws_iam_instance_profile" "test" { }`, rName) } +func testAccAwsIamInstanceProfileConfigMissingRole(rName string) string { + return fmt.Sprintf(` +resource "aws_iam_instance_profile" "test" { + name = "test-%s" +}`, rName) +} + func testAccAWSInstanceProfilePrefixNameConfig(rName string) string { return fmt.Sprintf(` resource "aws_iam_role" "test" { @@ -169,3 +214,16 @@ resource "aws_iam_instance_profile" "test" { roles = ["${aws_iam_role.test.name}"] }`, rName) } + +func testAccAWSInstanceProfileWithRoleSpecified(rName string) string { + return fmt.Sprintf(` +resource "aws_iam_role" "test" { + name = "test-%s" + assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]},\"Action\":[\"sts:AssumeRole\"]}]}" +} + +resource "aws_iam_instance_profile" "test" { + name_prefix = "test-" + role = "${aws_iam_role.test.name}" +}`, rName) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider.go b/installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider.go new file mode 100644 index 0000000000..1791da4ecb --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider.go @@ -0,0 +1,141 @@ +package aws + +import ( + "fmt" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsIamOpenIDConnectProvider() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsIamOpenIDConnectProviderCreate, + Read: resourceAwsIamOpenIDConnectProviderRead, + Update: resourceAwsIamOpenIDConnectProviderUpdate, + Delete: resourceAwsIamOpenIDConnectProviderDelete, + Exists: resourceAwsIamOpenIDConnectProviderExists, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "arn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "url": &schema.Schema{ + Type: schema.TypeString, + Computed: false, + Required: true, + ForceNew: true, + ValidateFunc: validateOpenIdURL, + DiffSuppressFunc: suppressOpenIdURL, + }, + "client_id_list": &schema.Schema{ + Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Required: true, + ForceNew: true, + }, + "thumbprint_list": &schema.Schema{ + Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Required: true, + }, + }, + } +} + +func resourceAwsIamOpenIDConnectProviderCreate(d *schema.ResourceData, meta interface{}) error { + iamconn := meta.(*AWSClient).iamconn + + input := &iam.CreateOpenIDConnectProviderInput{ + Url: aws.String(d.Get("url").(string)), + ClientIDList: expandStringList(d.Get("client_id_list").([]interface{})), + ThumbprintList: expandStringList(d.Get("thumbprint_list").([]interface{})), + } + + out, err := iamconn.CreateOpenIDConnectProvider(input) + if err != nil { + return err + } + + d.SetId(*out.OpenIDConnectProviderArn) + + return resourceAwsIamOpenIDConnectProviderRead(d, meta) +} + +func resourceAwsIamOpenIDConnectProviderRead(d *schema.ResourceData, meta interface{}) error { + iamconn := meta.(*AWSClient).iamconn + + input := &iam.GetOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(d.Id()), + } + out, err := iamconn.GetOpenIDConnectProvider(input) + if err != nil { + return err + } + + d.Set("arn", d.Id()) + d.Set("url", out.Url) + d.Set("client_id_list", flattenStringList(out.ClientIDList)) + d.Set("thumbprint_list", flattenStringList(out.ThumbprintList)) + + return nil +} + +func resourceAwsIamOpenIDConnectProviderUpdate(d *schema.ResourceData, meta interface{}) error { + iamconn := meta.(*AWSClient).iamconn + + if d.HasChange("thumbprint_list") { + input := &iam.UpdateOpenIDConnectProviderThumbprintInput{ + OpenIDConnectProviderArn: aws.String(d.Id()), + ThumbprintList: expandStringList(d.Get("thumbprint_list").([]interface{})), + } + + _, err := iamconn.UpdateOpenIDConnectProviderThumbprint(input) + if err != nil { + return err + } + } + + return resourceAwsIamOpenIDConnectProviderRead(d, meta) +} + +func resourceAwsIamOpenIDConnectProviderDelete(d *schema.ResourceData, meta interface{}) error { + iamconn := meta.(*AWSClient).iamconn + + input := &iam.DeleteOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(d.Id()), + } + _, err := iamconn.DeleteOpenIDConnectProvider(input) + + if err != nil { + if err, ok := err.(awserr.Error); ok && err.Code() == "NoSuchEntity" { + return nil + } + return fmt.Errorf("Error deleting platform application %s", err) + } + + return nil +} + +func resourceAwsIamOpenIDConnectProviderExists(d *schema.ResourceData, meta interface{}) (bool, error) { + iamconn := meta.(*AWSClient).iamconn + + input := &iam.GetOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(d.Id()), + } + _, err := iamconn.GetOpenIDConnectProvider(input) + if err != nil { + if err, ok := err.(awserr.Error); ok && err.Code() == "NoSuchEntity" { + return false, nil + } + return true, err + } + + return true, nil +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider_test.go b/installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider_test.go new file mode 100644 index 0000000000..6cf10d8b80 --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_iam_openid_connect_provider_test.go @@ -0,0 +1,187 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/iam" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAWSIAMOpenIDConnectProvider_basic(t *testing.T) { + rString := acctest.RandString(5) + url := "accounts.google.com/" + rString + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckIAMOpenIDConnectProviderDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccIAMOpenIDConnectProviderConfig(rString), + Check: resource.ComposeTestCheckFunc( + testAccCheckIAMOpenIDConnectProvider("aws_iam_openid_connect_provider.goog"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "url", url), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "client_id_list.#", "1"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "client_id_list.0", + "266362248691-re108qaeld573ia0l6clj2i5ac7r7291.apps.googleusercontent.com"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "thumbprint_list.#", "0"), + ), + }, + resource.TestStep{ + Config: testAccIAMOpenIDConnectProviderConfig_modified(rString), + Check: resource.ComposeTestCheckFunc( + testAccCheckIAMOpenIDConnectProvider("aws_iam_openid_connect_provider.goog"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "url", url), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "client_id_list.#", "1"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "client_id_list.0", + "266362248691-re108qaeld573ia0l6clj2i5ac7r7291.apps.googleusercontent.com"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "thumbprint_list.#", "2"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "thumbprint_list.0", "cf23df2207d99a74fbe169e3eba035e633b65d94"), + resource.TestCheckResourceAttr("aws_iam_openid_connect_provider.goog", "thumbprint_list.1", "c784713d6f9cb67b55dd84f4e4af7832d42b8f55"), + ), + }, + }, + }) +} + +func TestAccAWSIAMOpenIDConnectProvider_importBasic(t *testing.T) { + resourceName := "aws_iam_openid_connect_provider.goog" + rString := acctest.RandString(5) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckIAMOpenIDConnectProviderDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccIAMOpenIDConnectProviderConfig_modified(rString), + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSIAMOpenIDConnectProvider_disappears(t *testing.T) { + rString := acctest.RandString(5) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckIAMOpenIDConnectProviderDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccIAMOpenIDConnectProviderConfig(rString), + Check: resource.ComposeTestCheckFunc( + testAccCheckIAMOpenIDConnectProvider("aws_iam_openid_connect_provider.goog"), + testAccCheckIAMOpenIDConnectProviderDisappears("aws_iam_openid_connect_provider.goog"), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func testAccCheckIAMOpenIDConnectProviderDestroy(s *terraform.State) error { + iamconn := testAccProvider.Meta().(*AWSClient).iamconn + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_iam_openid_connect_provider" { + continue + } + + input := &iam.GetOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(rs.Primary.ID), + } + out, err := iamconn.GetOpenIDConnectProvider(input) + if err != nil { + if iamerr, ok := err.(awserr.Error); ok && iamerr.Code() == "NoSuchEntity" { + // none found, that's good + return nil + } + return fmt.Errorf("Error reading IAM OpenID Connect Provider, out: %s, err: %s", out, err) + } + + if out != nil { + return fmt.Errorf("Found IAM OpenID Connect Provider, expected none: %s", out) + } + } + + return nil +} + +func testAccCheckIAMOpenIDConnectProviderDisappears(id string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[id] + if !ok { + return fmt.Errorf("Not Found: %s", id) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No ID is set") + } + + iamconn := testAccProvider.Meta().(*AWSClient).iamconn + _, err := iamconn.DeleteOpenIDConnectProvider(&iam.DeleteOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(rs.Primary.ID), + }) + return err + } +} + +func testAccCheckIAMOpenIDConnectProvider(id string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[id] + if !ok { + return fmt.Errorf("Not Found: %s", id) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No ID is set") + } + + iamconn := testAccProvider.Meta().(*AWSClient).iamconn + _, err := iamconn.GetOpenIDConnectProvider(&iam.GetOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(rs.Primary.ID), + }) + + if err != nil { + return err + } + + return nil + } +} + +func testAccIAMOpenIDConnectProviderConfig(rString string) string { + return fmt.Sprintf(` +resource "aws_iam_openid_connect_provider" "goog" { + url="https://accounts.google.com/%s" + client_id_list = [ + "266362248691-re108qaeld573ia0l6clj2i5ac7r7291.apps.googleusercontent.com" + ] + thumbprint_list = [] +} +`, rString) +} + +func testAccIAMOpenIDConnectProviderConfig_modified(rString string) string { + return fmt.Sprintf(` +resource "aws_iam_openid_connect_provider" "goog" { + url="https://accounts.google.com/%s" + client_id_list = [ + "266362248691-re108qaeld573ia0l6clj2i5ac7r7291.apps.googleusercontent.com" + ] + thumbprint_list = ["cf23df2207d99a74fbe169e3eba035e633b65d94", "c784713d6f9cb67b55dd84f4e4af7832d42b8f55"] +} +`, rString) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_iam_policy_attachment_test.go b/installer/server/terraform/plugins/aws/resource_aws_iam_policy_attachment_test.go index 58738f4bdc..6ae57b1d52 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_iam_policy_attachment_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_iam_policy_attachment_test.go @@ -43,6 +43,7 @@ func TestAccAWSPolicyAttachment_basic(t *testing.T) { func TestAccAWSPolicyAttachment_paginatedEntities(t *testing.T) { var out iam.ListEntitiesForPolicyOutput + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -50,7 +51,7 @@ func TestAccAWSPolicyAttachment_paginatedEntities(t *testing.T) { CheckDestroy: testAccCheckAWSPolicyAttachmentDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAWSPolicyPaginatedAttachConfig, + Config: testAccAWSPolicyPaginatedAttachConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSPolicyAttachmentExists("aws_iam_policy_attachment.test-paginated-attach", 101, &out), ), @@ -302,34 +303,33 @@ resource "aws_iam_policy_attachment" "test-attach" { }`, u1, u2, u3) } -const testAccAWSPolicyPaginatedAttachConfig = ` +func testAccAWSPolicyPaginatedAttachConfig(rInt int) string { + return fmt.Sprintf(` resource "aws_iam_user" "user" { - count = 101 - name = "${format("paged-test-user-%d", count.index + 1)}" + count = 101 + name = "${format("paged-test-user-%d-%%d", count.index + 1)}" } - resource "aws_iam_policy" "policy" { - name = "test-policy" - description = "A test policy" - policy = < 128 { - errors = append(errors, fmt.Errorf( - "%q cannot be longer than 128 characters", k)) - } - if !regexp.MustCompile("^[\\w+=,.@-]+$").MatchString(value) { - errors = append(errors, fmt.Errorf( - "%q must match [\\w+=,.@-]", k)) - } - return - }, + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"name_prefix"}, + ValidateFunc: validateIamRolePolicyName, + }, + "name_prefix": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validateIamRolePolicyNamePrefix, }, "role": &schema.Schema{ Type: schema.TypeString, @@ -62,10 +58,19 @@ func resourceAwsIamRolePolicyPut(d *schema.ResourceData, meta interface{}) error request := &iam.PutRolePolicyInput{ RoleName: aws.String(d.Get("role").(string)), - PolicyName: aws.String(d.Get("name").(string)), PolicyDocument: aws.String(d.Get("policy").(string)), } + var policyName string + if v, ok := d.GetOk("name"); ok { + policyName = v.(string) + } else if v, ok := d.GetOk("name_prefix"); ok { + policyName = resource.PrefixedUniqueId(v.(string)) + } else { + policyName = resource.UniqueId() + } + request.PolicyName = aws.String(policyName) + if _, err := iamconn.PutRolePolicy(request); err != nil { return fmt.Errorf("Error putting IAM role policy %s: %s", *request.PolicyName, err) } @@ -135,7 +140,7 @@ func resourceAwsIamRolePolicyDelete(d *schema.ResourceData, meta interface{}) er func resourceAwsIamRolePolicyParseId(id string) (roleName, policyName string, err error) { parts := strings.SplitN(id, ":", 2) if len(parts) != 2 { - err = fmt.Errorf("role_policy id must be of the for :") + err = fmt.Errorf("role_policy id must be of the form :") return } diff --git a/installer/server/terraform/plugins/aws/resource_aws_iam_role_policy_attachment_test.go b/installer/server/terraform/plugins/aws/resource_aws_iam_role_policy_attachment_test.go index d1b4ef6e18..7a723bc077 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_iam_role_policy_attachment_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_iam_role_policy_attachment_test.go @@ -7,30 +7,35 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccAWSRolePolicyAttachment_basic(t *testing.T) { var out iam.ListAttachedRolePoliciesOutput + rInt := acctest.RandInt() + testPolicy := fmt.Sprintf("tf-acctest-%d", rInt) + testPolicy2 := fmt.Sprintf("tf-acctest2-%d", rInt) + testPolicy3 := fmt.Sprintf("tf-acctest3-%d", rInt) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSRolePolicyAttachmentDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSRolePolicyAttachConfig, + { + Config: testAccAWSRolePolicyAttachConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRolePolicyAttachmentExists("aws_iam_role_policy_attachment.test-attach", 1, &out), - testAccCheckAWSRolePolicyAttachmentAttributes([]string{"test-policy"}, &out), + testAccCheckAWSRolePolicyAttachmentAttributes([]string{testPolicy}, &out), ), }, - resource.TestStep{ - Config: testAccAWSRolePolicyAttachConfigUpdate, + { + Config: testAccAWSRolePolicyAttachConfigUpdate(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRolePolicyAttachmentExists("aws_iam_role_policy_attachment.test-attach", 2, &out), - testAccCheckAWSRolePolicyAttachmentAttributes([]string{"test-policy2", "test-policy3"}, &out), + testAccCheckAWSRolePolicyAttachmentAttributes([]string{testPolicy2, testPolicy3}, &out), ), }, }, @@ -88,135 +93,137 @@ func testAccCheckAWSRolePolicyAttachmentAttributes(policies []string, out *iam.L } } -const testAccAWSRolePolicyAttachConfig = ` -resource "aws_iam_role" "role" { - name = "test-role" - assume_role_policy = < 0 { + runOpts.TagSpecifications = tagsSpec + } + // Create the instance log.Printf("[DEBUG] Run configuration: %s", runOpts) @@ -528,25 +592,68 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error { d.Set("private_ip", instance.PrivateIpAddress) d.Set("iam_instance_profile", iamInstanceProfileArnToName(instance.IamInstanceProfile)) + // Set configured Network Interface Device Index Slice + // We only want to read, and populate state for the configured network_interface attachments. Otherwise, other + // resources have the potential to attach network interfaces to the instance, and cause a perpetual create/destroy + // diff. We should only read on changes configured for this specific resource because of this. + var configuredDeviceIndexes []int + if v, ok := d.GetOk("network_interface"); ok { + vL := v.(*schema.Set).List() + for _, vi := range vL { + mVi := vi.(map[string]interface{}) + configuredDeviceIndexes = append(configuredDeviceIndexes, mVi["device_index"].(int)) + } + } + + var ipv6Addresses []string if len(instance.NetworkInterfaces) > 0 { - for _, ni := range instance.NetworkInterfaces { - if *ni.Attachment.DeviceIndex == 0 { - d.Set("subnet_id", ni.SubnetId) - d.Set("network_interface_id", ni.NetworkInterfaceId) - d.Set("associate_public_ip_address", ni.Association != nil) - d.Set("ipv6_address_count", len(ni.Ipv6Addresses)) - - var ipv6Addresses []string - for _, address := range ni.Ipv6Addresses { - ipv6Addresses = append(ipv6Addresses, *address.Ipv6Address) + var primaryNetworkInterface ec2.InstanceNetworkInterface + var networkInterfaces []map[string]interface{} + for _, iNi := range instance.NetworkInterfaces { + ni := make(map[string]interface{}) + if *iNi.Attachment.DeviceIndex == 0 { + primaryNetworkInterface = *iNi + } + // If the attached network device is inside our configuration, refresh state with values found. + // Otherwise, assume the network device was attached via an outside resource. + for _, index := range configuredDeviceIndexes { + if index == int(*iNi.Attachment.DeviceIndex) { + ni["device_index"] = *iNi.Attachment.DeviceIndex + ni["network_interface_id"] = *iNi.NetworkInterfaceId + ni["delete_on_termination"] = *iNi.Attachment.DeleteOnTermination } - d.Set("ipv6_addresses", ipv6Addresses) } + // Don't add empty network interfaces to schema + if len(ni) == 0 { + continue + } + networkInterfaces = append(networkInterfaces, ni) + } + if err := d.Set("network_interface", networkInterfaces); err != nil { + return fmt.Errorf("Error setting network_interfaces: %v", err) } + + // Set primary network interface details + d.Set("subnet_id", primaryNetworkInterface.SubnetId) + d.Set("network_interface_id", primaryNetworkInterface.NetworkInterfaceId) // TODO: Deprecate me v0.10.0 + d.Set("primary_network_interface_id", primaryNetworkInterface.NetworkInterfaceId) + d.Set("associate_public_ip_address", primaryNetworkInterface.Association != nil) + d.Set("ipv6_address_count", len(primaryNetworkInterface.Ipv6Addresses)) + + for _, address := range primaryNetworkInterface.Ipv6Addresses { + ipv6Addresses = append(ipv6Addresses, *address.Ipv6Address) + } + } else { d.Set("subnet_id", instance.SubnetId) - d.Set("network_interface_id", "") + d.Set("network_interface_id", "") // TODO: Deprecate me v0.10.0 + d.Set("primary_network_interface_id", "") + } + + if err := d.Set("ipv6_addresses", ipv6Addresses); err != nil { + log.Printf("[WARN] Error setting ipv6_addresses for AWS Instance (%s): %s", d.Id(), err) } + d.Set("ebs_optimized", instance.EbsOptimized) if instance.SubnetId != nil && *instance.SubnetId != "" { d.Set("source_dest_check", instance.SourceDestCheck) @@ -559,6 +666,10 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error { d.Set("tags", tagsToMap(instance.Tags)) + if err := readVolumeTags(conn, d); err != nil { + return err + } + if err := readSecurityGroups(d, instance); err != nil { return err } @@ -601,16 +712,27 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn d.Partial(true) - if err := setTags(conn, d); err != nil { - return err - } else { - d.SetPartial("tags") + + if d.HasChange("tags") && !d.IsNewResource() { + if err := setTags(conn, d); err != nil { + return err + } else { + d.SetPartial("tags") + } + } + + if d.HasChange("volume_tags") && !d.IsNewResource() { + if err := setVolumeTags(conn, d); err != nil { + return err + } else { + d.SetPartial("volume_tags") + } } - if d.HasChange("iam_instance_profile") { + if d.HasChange("iam_instance_profile") && !d.IsNewResource() { request := &ec2.DescribeIamInstanceProfileAssociationsInput{ Filters: []*ec2.Filter{ - &ec2.Filter{ + { Name: aws.String("instance-id"), Values: []*string{aws.String(d.Id())}, }, @@ -667,24 +789,28 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { } } - if d.HasChange("source_dest_check") || d.IsNewResource() { - // SourceDestCheck can only be set on VPC instances // AWS will return an error of InvalidParameterCombination if we attempt - // to modify the source_dest_check of an instance in EC2 Classic - log.Printf("[INFO] Modifying `source_dest_check` on Instance %s", d.Id()) - _, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{ - InstanceId: aws.String(d.Id()), - SourceDestCheck: &ec2.AttributeBooleanValue{ - Value: aws.Bool(d.Get("source_dest_check").(bool)), - }, - }) - if err != nil { - if ec2err, ok := err.(awserr.Error); ok { - // Toloerate InvalidParameterCombination error in Classic, otherwise - // return the error - if "InvalidParameterCombination" != ec2err.Code() { - return err + // SourceDestCheck can only be modified on an instance without manually specified network interfaces. + // SourceDestCheck, in that case, is configured at the network interface level + if _, ok := d.GetOk("network_interface"); !ok { + if d.HasChange("source_dest_check") || d.IsNewResource() { + // SourceDestCheck can only be set on VPC instances // AWS will return an error of InvalidParameterCombination if we attempt + // to modify the source_dest_check of an instance in EC2 Classic + log.Printf("[INFO] Modifying `source_dest_check` on Instance %s", d.Id()) + _, err := conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{ + InstanceId: aws.String(d.Id()), + SourceDestCheck: &ec2.AttributeBooleanValue{ + Value: aws.Bool(d.Get("source_dest_check").(bool)), + }, + }) + if err != nil { + if ec2err, ok := err.(awserr.Error); ok { + // Tolerate InvalidParameterCombination error in Classic, otherwise + // return the error + if "InvalidParameterCombination" != ec2err.Code() { + return err + } + log.Printf("[WARN] Attempted to modify SourceDestCheck on non VPC instance: %s", ec2err.Message()) } - log.Printf("[WARN] Attempted to modify SourceDestCheck on non VPC instance: %s", ec2err.Message()) } } } @@ -1004,6 +1130,55 @@ func fetchRootDeviceName(ami string, conn *ec2.EC2) (*string, error) { return rootDeviceName, nil } +func buildNetworkInterfaceOpts(d *schema.ResourceData, groups []*string, nInterfaces interface{}) []*ec2.InstanceNetworkInterfaceSpecification { + networkInterfaces := []*ec2.InstanceNetworkInterfaceSpecification{} + // Get necessary items + associatePublicIPAddress := d.Get("associate_public_ip_address").(bool) + subnet, hasSubnet := d.GetOk("subnet_id") + + if hasSubnet && associatePublicIPAddress { + // If we have a non-default VPC / Subnet specified, we can flag + // AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided. + // You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise + // you get: Network interfaces and an instance-level subnet ID may not be specified on the same request + // You also need to attach Security Groups to the NetworkInterface instead of the instance, + // to avoid: Network interfaces and an instance-level security groups may not be specified on + // the same request + ni := &ec2.InstanceNetworkInterfaceSpecification{ + AssociatePublicIpAddress: aws.Bool(associatePublicIPAddress), + DeviceIndex: aws.Int64(int64(0)), + SubnetId: aws.String(subnet.(string)), + Groups: groups, + } + + if v, ok := d.GetOk("private_ip"); ok { + ni.PrivateIpAddress = aws.String(v.(string)) + } + + if v := d.Get("vpc_security_group_ids").(*schema.Set); v.Len() > 0 { + for _, v := range v.List() { + ni.Groups = append(ni.Groups, aws.String(v.(string))) + } + } + + networkInterfaces = append(networkInterfaces, ni) + } else { + // If we have manually specified network interfaces, build and attach those here. + vL := nInterfaces.(*schema.Set).List() + for _, v := range vL { + ini := v.(map[string]interface{}) + ni := &ec2.InstanceNetworkInterfaceSpecification{ + DeviceIndex: aws.Int64(int64(ini["device_index"].(int))), + NetworkInterfaceId: aws.String(ini["network_interface_id"].(string)), + DeleteOnTermination: aws.Bool(ini["delete_on_termination"].(bool)), + } + networkInterfaces = append(networkInterfaces, ni) + } + } + + return networkInterfaces +} + func readBlockDeviceMappingsFromConfig( d *schema.ResourceData, conn *ec2.EC2) ([]*ec2.BlockDeviceMapping, error) { blockDevices := make([]*ec2.BlockDeviceMapping, 0) @@ -1030,10 +1205,15 @@ func readBlockDeviceMappingsFromConfig( if v, ok := bd["volume_type"].(string); ok && v != "" { ebs.VolumeType = aws.String(v) - } - - if v, ok := bd["iops"].(int); ok && v > 0 { - ebs.Iops = aws.Int64(int64(v)) + if "io1" == strings.ToLower(v) { + // Condition: This parameter is required for requests to create io1 + // volumes; it is not used in requests to create gp2, st1, sc1, or + // standard volumes. + // See: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EbsBlockDevice.html + if v, ok := bd["iops"].(int); ok && v > 0 { + ebs.Iops = aws.Int64(int64(v)) + } + } } blockDevices = append(blockDevices, &ec2.BlockDeviceMapping{ @@ -1116,6 +1296,39 @@ func readBlockDeviceMappingsFromConfig( return blockDevices, nil } +func readVolumeTags(conn *ec2.EC2, d *schema.ResourceData) error { + volumeIds, err := getAwsInstanceVolumeIds(conn, d) + if err != nil { + return err + } + + tagsResp, err := conn.DescribeTags(&ec2.DescribeTagsInput{ + Filters: []*ec2.Filter{ + { + Name: aws.String("resource-id"), + Values: volumeIds, + }, + }, + }) + if err != nil { + return err + } + + var tags []*ec2.Tag + + for _, t := range tagsResp.Tags { + tag := &ec2.Tag{ + Key: t.Key, + Value: t.Value, + } + tags = append(tags, tag) + } + + d.Set("volume_tags", tagsToMap(tags)) + + return nil +} + // Determine whether we're referring to security groups with // IDs or names. We use a heuristic to figure this out. By default, // we use IDs if we're in a VPC. However, if we previously had an @@ -1251,33 +1464,14 @@ func buildAwsInstanceOpts( } } - if hasSubnet && associatePublicIPAddress { - // If we have a non-default VPC / Subnet specified, we can flag - // AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided. - // You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise - // you get: Network interfaces and an instance-level subnet ID may not be specified on the same request - // You also need to attach Security Groups to the NetworkInterface instead of the instance, - // to avoid: Network interfaces and an instance-level security groups may not be specified on - // the same request - ni := &ec2.InstanceNetworkInterfaceSpecification{ - AssociatePublicIpAddress: aws.Bool(associatePublicIPAddress), - DeviceIndex: aws.Int64(int64(0)), - SubnetId: aws.String(subnetID), - Groups: groups, - } - - if v, ok := d.GetOk("private_ip"); ok { - ni.PrivateIpAddress = aws.String(v.(string)) - } - - if v := d.Get("vpc_security_group_ids").(*schema.Set); v.Len() > 0 { - for _, v := range v.List() { - ni.Groups = append(ni.Groups, aws.String(v.(string))) - } - } + networkInterfaces, interfacesOk := d.GetOk("network_interface") - opts.NetworkInterfaces = []*ec2.InstanceNetworkInterfaceSpecification{ni} + // If setting subnet and public address, OR manual network interfaces, populate those now. + if hasSubnet && associatePublicIPAddress || interfacesOk { + // Otherwise we're attaching (a) network interface(s) + opts.NetworkInterfaces = buildNetworkInterfaceOpts(d, groups, networkInterfaces) } else { + // If simply specifying a subnetID, privateIP, Security Groups, or VPC Security Groups, build these now if subnetID != "" { opts.SubnetID = aws.String(subnetID) } @@ -1310,7 +1504,6 @@ func buildAwsInstanceOpts( if len(blockDevices) > 0 { opts.BlockDeviceMappings = blockDevices } - return opts, nil } @@ -1363,3 +1556,27 @@ func userDataHashSum(user_data string) string { hash := sha1.Sum(v) return hex.EncodeToString(hash[:]) } + +func getAwsInstanceVolumeIds(conn *ec2.EC2, d *schema.ResourceData) ([]*string, error) { + volumeIds := make([]*string, 0) + + opts := &ec2.DescribeVolumesInput{ + Filters: []*ec2.Filter{ + { + Name: aws.String("attachment.instance-id"), + Values: []*string{aws.String(d.Id())}, + }, + }, + } + + resp, err := conn.DescribeVolumes(opts) + if err != nil { + return nil, err + } + + for _, v := range resp.Volumes { + volumeIds = append(volumeIds, v.VolumeId) + } + + return volumeIds, nil +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_instance_migrate.go b/installer/server/terraform/plugins/aws/resource_aws_instance_migrate.go index 28a256b7b4..31f28b39f8 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_instance_migrate.go +++ b/installer/server/terraform/plugins/aws/resource_aws_instance_migrate.go @@ -15,13 +15,13 @@ func resourceAwsInstanceMigrateState( switch v { case 0: log.Println("[INFO] Found AWS Instance State v0; migrating to v1") - return migrateStateV0toV1(is) + return migrateAwsInstanceStateV0toV1(is) default: return is, fmt.Errorf("Unexpected schema version: %d", v) } } -func migrateStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) { +func migrateAwsInstanceStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) { if is.Empty() || is.Attributes == nil { log.Println("[DEBUG] Empty InstanceState; nothing to migrate.") return is, nil diff --git a/installer/server/terraform/plugins/aws/resource_aws_instance_test.go b/installer/server/terraform/plugins/aws/resource_aws_instance_test.go index aae53ecbde..7c70f1cbde 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_instance_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_instance_test.go @@ -616,7 +616,6 @@ func TestAccAWSInstance_tags(t *testing.T) { testAccCheckTags(&v.Tags, "#", ""), ), }, - { Config: testAccCheckInstanceConfigTagsUpdate, Check: resource.ComposeTestCheckFunc( @@ -629,6 +628,56 @@ func TestAccAWSInstance_tags(t *testing.T) { }) } +func TestAccAWSInstance_volumeTags(t *testing.T) { + var v ec2.Instance + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckInstanceConfigNoVolumeTags, + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &v), + resource.TestCheckNoResourceAttr( + "aws_instance.foo", "volume_tags"), + ), + }, + { + Config: testAccCheckInstanceConfigWithVolumeTags, + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &v), + resource.TestCheckResourceAttr( + "aws_instance.foo", "volume_tags.%", "1"), + resource.TestCheckResourceAttr( + "aws_instance.foo", "volume_tags.Name", "acceptance-test-volume-tag"), + ), + }, + { + Config: testAccCheckInstanceConfigWithVolumeTagsUpdate, + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &v), + resource.TestCheckResourceAttr( + "aws_instance.foo", "volume_tags.%", "2"), + resource.TestCheckResourceAttr( + "aws_instance.foo", "volume_tags.Name", "acceptance-test-volume-tag"), + resource.TestCheckResourceAttr( + "aws_instance.foo", "volume_tags.Environment", "dev"), + ), + }, + { + Config: testAccCheckInstanceConfigNoVolumeTags, + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &v), + resource.TestCheckNoResourceAttr( + "aws_instance.foo", "volume_tags"), + ), + }, + }, + }) +} + func TestAccAWSInstance_instanceProfileChange(t *testing.T) { var v ec2.Instance rName := acctest.RandString(5) @@ -656,7 +705,38 @@ func TestAccAWSInstance_instanceProfileChange(t *testing.T) { ), }, { - Config: testAccInstanceConfigAttachInstanceProfile(rName), + Config: testAccInstanceConfigWithInstanceProfile(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &v), + testCheckInstanceProfile(), + ), + }, + }, + }) +} + +func TestAccAWSInstance_withIamInstanceProfile(t *testing.T) { + var v ec2.Instance + rName := acctest.RandString(5) + + testCheckInstanceProfile := func() resource.TestCheckFunc { + return func(*terraform.State) error { + if v.IamInstanceProfile == nil { + return fmt.Errorf("Instance Profile is nil - we expected an InstanceProfile associated with the Instance") + } + + return nil + } + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_instance.foo", + Providers: testAccProviders, + CheckDestroy: testAccCheckInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccInstanceConfigWithInstanceProfile(rName), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceExists("aws_instance.foo", &v), testCheckInstanceProfile(), @@ -846,6 +926,58 @@ func TestAccAWSInstance_changeInstanceType(t *testing.T) { }) } +func TestAccAWSInstance_primaryNetworkInterface(t *testing.T) { + var instance ec2.Instance + var ini ec2.NetworkInterface + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccInstanceConfigPrimaryNetworkInterface, + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &instance), + testAccCheckAWSENIExists("aws_network_interface.bar", &ini), + resource.TestCheckResourceAttr("aws_instance.foo", "network_interface.#", "1"), + ), + }, + }, + }) +} + +func TestAccAWSInstance_addSecondaryInterface(t *testing.T) { + var before ec2.Instance + var after ec2.Instance + var iniPrimary ec2.NetworkInterface + var iniSecondary ec2.NetworkInterface + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccInstanceConfigAddSecondaryNetworkInterfaceBefore, + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &before), + testAccCheckAWSENIExists("aws_network_interface.primary", &iniPrimary), + resource.TestCheckResourceAttr("aws_instance.foo", "network_interface.#", "1"), + ), + }, + { + Config: testAccInstanceConfigAddSecondaryNetworkInterfaceAfter, + Check: resource.ComposeTestCheckFunc( + testAccCheckInstanceExists("aws_instance.foo", &after), + testAccCheckAWSENIExists("aws_network_interface.secondary", &iniSecondary), + resource.TestCheckResourceAttr("aws_instance.foo", "network_interface.#", "1"), + ), + }, + }, + }) +} + func testAccCheckInstanceNotRecreated(t *testing.T, before, after *ec2.Instance) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -1060,7 +1192,6 @@ resource "aws_instance" "foo" { root_block_device { volume_type = "gp2" volume_size = 11 - iops = 330 } } ` @@ -1251,6 +1382,117 @@ resource "aws_instance" "foo" { } ` +const testAccCheckInstanceConfigNoVolumeTags = ` +resource "aws_instance" "foo" { + ami = "ami-55a7ea65" + + instance_type = "m3.medium" + + root_block_device { + volume_type = "gp2" + volume_size = 11 + } + ebs_block_device { + device_name = "/dev/sdb" + volume_size = 9 + } + ebs_block_device { + device_name = "/dev/sdc" + volume_size = 10 + volume_type = "io1" + iops = 100 + } + + ebs_block_device { + device_name = "/dev/sdd" + volume_size = 12 + encrypted = true + } + + ephemeral_block_device { + device_name = "/dev/sde" + virtual_name = "ephemeral0" + } +} +` + +const testAccCheckInstanceConfigWithVolumeTags = ` +resource "aws_instance" "foo" { + ami = "ami-55a7ea65" + + instance_type = "m3.medium" + + root_block_device { + volume_type = "gp2" + volume_size = 11 + } + ebs_block_device { + device_name = "/dev/sdb" + volume_size = 9 + } + ebs_block_device { + device_name = "/dev/sdc" + volume_size = 10 + volume_type = "io1" + iops = 100 + } + + ebs_block_device { + device_name = "/dev/sdd" + volume_size = 12 + encrypted = true + } + + ephemeral_block_device { + device_name = "/dev/sde" + virtual_name = "ephemeral0" + } + + volume_tags { + Name = "acceptance-test-volume-tag" + } +} +` + +const testAccCheckInstanceConfigWithVolumeTagsUpdate = ` +resource "aws_instance" "foo" { + ami = "ami-55a7ea65" + + instance_type = "m3.medium" + + root_block_device { + volume_type = "gp2" + volume_size = 11 + } + ebs_block_device { + device_name = "/dev/sdb" + volume_size = 9 + } + ebs_block_device { + device_name = "/dev/sdc" + volume_size = 10 + volume_type = "io1" + iops = 100 + } + + ebs_block_device { + device_name = "/dev/sdd" + volume_size = 12 + encrypted = true + } + + ephemeral_block_device { + device_name = "/dev/sde" + virtual_name = "ephemeral0" + } + + volume_tags { + Name = "acceptance-test-volume-tag" + Environment = "dev" + } +} +` + const testAccCheckInstanceConfigTagsUpdate = ` resource "aws_instance" "foo" { ami = "ami-4fccb37f" @@ -1282,7 +1524,7 @@ resource "aws_instance" "foo" { }`, rName, rName) } -func testAccInstanceConfigAttachInstanceProfile(rName string) string { +func testAccInstanceConfigWithInstanceProfile(rName string) string { return fmt.Sprintf(` resource "aws_iam_role" "test" { name = "test-%s" @@ -1506,3 +1748,129 @@ resource "aws_instance" "foo" { subnet_id = "${aws_subnet.foo.id}" } ` + +const testAccInstanceConfigPrimaryNetworkInterface = ` +resource "aws_vpc" "foo" { + cidr_block = "172.16.0.0/16" + tags { + Name = "tf-instance-test" + } +} + +resource "aws_subnet" "foo" { + vpc_id = "${aws_vpc.foo.id}" + cidr_block = "172.16.10.0/24" + availability_zone = "us-west-2a" + tags { + Name = "tf-instance-test" + } +} + +resource "aws_network_interface" "bar" { + subnet_id = "${aws_subnet.foo.id}" + private_ips = ["172.16.10.100"] + tags { + Name = "primary_network_interface" + } +} + +resource "aws_instance" "foo" { + ami = "ami-22b9a343" + instance_type = "t2.micro" + network_interface { + network_interface_id = "${aws_network_interface.bar.id}" + device_index = 0 + } +} +` + +const testAccInstanceConfigAddSecondaryNetworkInterfaceBefore = ` +resource "aws_vpc" "foo" { + cidr_block = "172.16.0.0/16" + tags { + Name = "tf-instance-test" + } +} + +resource "aws_subnet" "foo" { + vpc_id = "${aws_vpc.foo.id}" + cidr_block = "172.16.10.0/24" + availability_zone = "us-west-2a" + tags { + Name = "tf-instance-test" + } +} + +resource "aws_network_interface" "primary" { + subnet_id = "${aws_subnet.foo.id}" + private_ips = ["172.16.10.100"] + tags { + Name = "primary_network_interface" + } +} + +resource "aws_network_interface" "secondary" { + subnet_id = "${aws_subnet.foo.id}" + private_ips = ["172.16.10.101"] + tags { + Name = "secondary_network_interface" + } +} + +resource "aws_instance" "foo" { + ami = "ami-22b9a343" + instance_type = "t2.micro" + network_interface { + network_interface_id = "${aws_network_interface.primary.id}" + device_index = 0 + } +} +` + +const testAccInstanceConfigAddSecondaryNetworkInterfaceAfter = ` +resource "aws_vpc" "foo" { + cidr_block = "172.16.0.0/16" + tags { + Name = "tf-instance-test" + } +} + +resource "aws_subnet" "foo" { + vpc_id = "${aws_vpc.foo.id}" + cidr_block = "172.16.10.0/24" + availability_zone = "us-west-2a" + tags { + Name = "tf-instance-test" + } +} + +resource "aws_network_interface" "primary" { + subnet_id = "${aws_subnet.foo.id}" + private_ips = ["172.16.10.100"] + tags { + Name = "primary_network_interface" + } +} + +// Attach previously created network interface, observe no state diff on instance resource +resource "aws_network_interface" "secondary" { + subnet_id = "${aws_subnet.foo.id}" + private_ips = ["172.16.10.101"] + tags { + Name = "secondary_network_interface" + } + attachment { + instance = "${aws_instance.foo.id}" + device_index = 1 + } +} + +resource "aws_instance" "foo" { + ami = "ami-22b9a343" + instance_type = "t2.micro" + network_interface { + network_interface_id = "${aws_network_interface.primary.id}" + device_index = 0 + } +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream.go b/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream.go index b82ec56bb3..3cd476be9b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream.go +++ b/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream.go @@ -150,8 +150,9 @@ func resourceAwsKinesisFirehoseDeliveryStream() *schema.Resource { }, "password": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Sensitive: true, }, "role_arn": { diff --git a/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream_test.go b/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream_test.go index 040040e67d..27f227883b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_kinesis_firehose_delivery_stream_test.go @@ -439,7 +439,7 @@ resource "aws_cloudwatch_log_stream" "test" { resource "aws_kinesis_firehose_delivery_stream" "test_stream" { depends_on = ["aws_iam_role_policy.firehose"] - name = "terraform-kinesis-firehose-basictest-cloudwatch" + name = "terraform-kinesis-firehose-cloudwatch-%d" destination = "s3" s3_configuration { role_arn = "${aws_iam_role.firehose.arn}" @@ -451,7 +451,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" { } } } -`, rInt, accountId, rInt, rInt, rInt, rInt) +`, rInt, accountId, rInt, rInt, rInt, rInt, rInt) } var testAccKinesisFirehoseDeliveryStreamConfig_s3basic = testAccKinesisFirehoseDeliveryStreamBaseConfig + ` @@ -487,6 +487,7 @@ resource "aws_redshift_cluster" "test_cluster" { master_password = "T3stPass" node_type = "dc1.large" cluster_type = "single-node" + skip_final_snapshot = true }` var testAccKinesisFirehoseDeliveryStreamConfig_RedshiftBasic = testAccKinesisFirehoseDeliveryStreamBaseRedshiftConfig + ` @@ -533,6 +534,9 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" { var testAccKinesisFirehoseDeliveryStreamBaseElasticsearchConfig = testAccKinesisFirehoseDeliveryStreamBaseConfig + ` resource "aws_elasticsearch_domain" "test_cluster" { domain_name = "es-test-%d" + cluster_config { + instance_type = "r3.large.elasticsearch" + } access_policies = < 0 { @@ -290,23 +290,27 @@ func updateKinesisShardLevelMetrics(conn *kinesis.Kinesis, d *schema.ResourceDat type kinesisStreamState struct { arn string + creationTimestamp int64 status string - shardCount int retentionPeriod int64 + openShards []string + closedShards []string shardLevelMetrics []string } -func readKinesisStreamState(conn *kinesis.Kinesis, sn string) (kinesisStreamState, error) { +func readKinesisStreamState(conn *kinesis.Kinesis, sn string) (*kinesisStreamState, error) { describeOpts := &kinesis.DescribeStreamInput{ StreamName: aws.String(sn), } - var state kinesisStreamState + state := &kinesisStreamState{} err := conn.DescribeStreamPages(describeOpts, func(page *kinesis.DescribeStreamOutput, last bool) (shouldContinue bool) { state.arn = aws.StringValue(page.StreamDescription.StreamARN) + state.creationTimestamp = aws.TimeValue(page.StreamDescription.StreamCreationTimestamp).Unix() state.status = aws.StringValue(page.StreamDescription.StreamStatus) - state.shardCount += len(openShards(page.StreamDescription.Shards)) state.retentionPeriod = aws.Int64Value(page.StreamDescription.RetentionPeriodHours) + state.openShards = append(state.openShards, flattenShards(openShards(page.StreamDescription.Shards))...) + state.closedShards = append(state.closedShards, flattenShards(closedShards(page.StreamDescription.Shards))...) state.shardLevelMetrics = flattenKinesisShardLevelMetrics(page.StreamDescription.EnhancedMonitoring) return !last }) @@ -349,14 +353,31 @@ func waitForKinesisToBeActive(conn *kinesis.Kinesis, sn string) error { return nil } -// See http://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-resharding-merge.html func openShards(shards []*kinesis.Shard) []*kinesis.Shard { - var open []*kinesis.Shard + return filterShards(shards, true) +} + +func closedShards(shards []*kinesis.Shard) []*kinesis.Shard { + return filterShards(shards, false) +} + +// See http://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-resharding-merge.html +func filterShards(shards []*kinesis.Shard, open bool) []*kinesis.Shard { + res := make([]*kinesis.Shard, 0, len(shards)) for _, s := range shards { - if s.SequenceNumberRange.EndingSequenceNumber == nil { - open = append(open, s) + if open && s.SequenceNumberRange.EndingSequenceNumber == nil { + res = append(res, s) + } else if !open && s.SequenceNumberRange.EndingSequenceNumber != nil { + res = append(res, s) } } + return res +} - return open +func flattenShards(shards []*kinesis.Shard) []string { + res := make([]string, len(shards)) + for i, s := range shards { + res[i] = aws.StringValue(s.ShardId) + } + return res } diff --git a/installer/server/terraform/plugins/aws/resource_aws_kms_alias.go b/installer/server/terraform/plugins/aws/resource_aws_kms_alias.go index 64eec56a66..b02ffefba3 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_kms_alias.go +++ b/installer/server/terraform/plugins/aws/resource_aws_kms_alias.go @@ -29,14 +29,7 @@ func resourceAwsKmsAlias() *schema.Resource { Optional: true, ForceNew: true, ConflictsWith: []string{"name_prefix"}, - ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { - value := v.(string) - if !regexp.MustCompile(`^(alias\/)[a-zA-Z0-9:/_-]+$`).MatchString(value) { - es = append(es, fmt.Errorf( - "%q must begin with 'alias/' and be comprised of only [a-zA-Z0-9:/_-]", k)) - } - return - }, + ValidateFunc: validateAwsKmsName, }, "name_prefix": &schema.Schema{ Type: schema.TypeString, diff --git a/installer/server/terraform/plugins/aws/resource_aws_kms_alias_test.go b/installer/server/terraform/plugins/aws/resource_aws_kms_alias_test.go index c858885ebf..ef10b2f965 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_kms_alias_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_kms_alias_test.go @@ -11,19 +11,21 @@ import ( ) func TestAccAWSKmsAlias_basic(t *testing.T) { + rInt := acctest.RandInt() + kmsAliasTimestamp := time.Now().Format(time.RFC1123) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSKmsAliasDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSKmsSingleAlias, + { + Config: testAccAWSKmsSingleAlias(rInt, kmsAliasTimestamp), Check: resource.ComposeTestCheckFunc( testAccCheckAWSKmsAliasExists("aws_kms_alias.single"), ), }, - resource.TestStep{ - Config: testAccAWSKmsSingleAlias_modified, + { + Config: testAccAWSKmsSingleAlias_modified(rInt, kmsAliasTimestamp), Check: resource.ComposeTestCheckFunc( testAccCheckAWSKmsAliasExists("aws_kms_alias.single"), ), @@ -33,13 +35,15 @@ func TestAccAWSKmsAlias_basic(t *testing.T) { } func TestAccAWSKmsAlias_name_prefix(t *testing.T) { + rInt := acctest.RandInt() + kmsAliasTimestamp := time.Now().Format(time.RFC1123) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSKmsAliasDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSKmsSingleAlias, + { + Config: testAccAWSKmsSingleAlias(rInt, kmsAliasTimestamp), Check: resource.ComposeTestCheckFunc( testAccCheckAWSKmsAliasExists("aws_kms_alias.name_prefix"), ), @@ -49,13 +53,15 @@ func TestAccAWSKmsAlias_name_prefix(t *testing.T) { } func TestAccAWSKmsAlias_no_name(t *testing.T) { + rInt := acctest.RandInt() + kmsAliasTimestamp := time.Now().Format(time.RFC1123) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSKmsAliasDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSKmsSingleAlias, + { + Config: testAccAWSKmsSingleAlias(rInt, kmsAliasTimestamp), Check: resource.ComposeTestCheckFunc( testAccCheckAWSKmsAliasExists("aws_kms_alias.nothing"), ), @@ -65,13 +71,15 @@ func TestAccAWSKmsAlias_no_name(t *testing.T) { } func TestAccAWSKmsAlias_multiple(t *testing.T) { + rInt := acctest.RandInt() + kmsAliasTimestamp := time.Now().Format(time.RFC1123) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSKmsAliasDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSKmsMultipleAliases, + { + Config: testAccAWSKmsMultipleAliases(rInt, kmsAliasTimestamp), Check: resource.ComposeTestCheckFunc( testAccCheckAWSKmsAliasExists("aws_kms_alias.one"), testAccCheckAWSKmsAliasExists("aws_kms_alias.two"), @@ -114,8 +122,8 @@ func testAccCheckAWSKmsAliasExists(name string) resource.TestCheckFunc { } } -var kmsAliasTimestamp = time.Now().Format(time.RFC1123) -var testAccAWSKmsSingleAlias = fmt.Sprintf(` +func testAccAWSKmsSingleAlias(rInt int, timestamp string) string { + return fmt.Sprintf(` resource "aws_kms_key" "one" { description = "Terraform acc test One %s" deletion_window_in_days = 7 @@ -126,7 +134,7 @@ resource "aws_kms_key" "two" { } resource "aws_kms_alias" "name_prefix" { - name_prefix = "alias/tf-acc-key-alias" + name_prefix = "alias/tf-acc-key-alias-%d" target_key_id = "${aws_kms_key.one.key_id}" } @@ -135,11 +143,13 @@ resource "aws_kms_alias" "nothing" { } resource "aws_kms_alias" "single" { - name = "alias/tf-acc-key-alias" + name = "alias/tf-acc-key-alias-%d" target_key_id = "${aws_kms_key.one.key_id}" -}`, kmsAliasTimestamp, kmsAliasTimestamp) +}`, timestamp, timestamp, rInt, rInt) +} -var testAccAWSKmsSingleAlias_modified = fmt.Sprintf(` +func testAccAWSKmsSingleAlias_modified(rInt int, timestamp string) string { + return fmt.Sprintf(` resource "aws_kms_key" "one" { description = "Terraform acc test One %s" deletion_window_in_days = 7 @@ -150,21 +160,24 @@ resource "aws_kms_key" "two" { } resource "aws_kms_alias" "single" { - name = "alias/tf-acc-key-alias" + name = "alias/tf-acc-key-alias-%d" target_key_id = "${aws_kms_key.two.key_id}" -}`, kmsAliasTimestamp, kmsAliasTimestamp) +}`, timestamp, timestamp, rInt) +} -var testAccAWSKmsMultipleAliases = fmt.Sprintf(` +func testAccAWSKmsMultipleAliases(rInt int, timestamp string) string { + return fmt.Sprintf(` resource "aws_kms_key" "single" { description = "Terraform acc test One %s" deletion_window_in_days = 7 } resource "aws_kms_alias" "one" { - name = "alias/tf-acc-key-alias-%s" + name = "alias/tf-acc-alias-one-%d" target_key_id = "${aws_kms_key.single.key_id}" } resource "aws_kms_alias" "two" { - name = "alias/tf-acc-key-alias-%s" + name = "alias/tf-acc-alias-two-%d" target_key_id = "${aws_kms_key.single.key_id}" -}`, kmsAliasTimestamp, acctest.RandString(5), acctest.RandString(5)) +}`, timestamp, rInt, rInt) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_kms_key.go b/installer/server/terraform/plugins/aws/resource_aws_kms_key.go index 0ccd72e758..2fa8e3287c 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_kms_key.go +++ b/installer/server/terraform/plugins/aws/resource_aws_kms_key.go @@ -6,6 +6,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/kms" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" @@ -18,6 +19,7 @@ func resourceAwsKmsKey() *schema.Resource { Read: resourceAwsKmsKeyRead, Update: resourceAwsKmsKeyUpdate, Delete: resourceAwsKmsKeyDelete, + Exists: resourceAwsKmsKeyExists, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -80,6 +82,7 @@ func resourceAwsKmsKey() *schema.Resource { return }, }, + "tags": tagsSchema(), }, } } @@ -98,6 +101,9 @@ func resourceAwsKmsKeyCreate(d *schema.ResourceData, meta interface{}) error { if v, exists := d.GetOk("policy"); exists { req.Policy = aws.String(v.(string)) } + if v, exists := d.GetOk("tags"); exists { + req.Tags = tagsFromMapKMS(v.(map[string]interface{})) + } var resp *kms.CreateKeyOutput // AWS requires any principal in the policy to exist before the key is created. @@ -170,6 +176,14 @@ func resourceAwsKmsKeyRead(d *schema.ResourceData, meta interface{}) error { } d.Set("enable_key_rotation", krs.KeyRotationEnabled) + tagList, err := conn.ListResourceTags(&kms.ListResourceTagsInput{ + KeyId: metadata.KeyId, + }) + if err != nil { + return fmt.Errorf("Failed to get KMS key tags (key: %s): %s", d.Get("key_id").(string), err) + } + d.Set("tags", tagsToMapKMS(tagList.Tags)) + return nil } @@ -215,6 +229,10 @@ func _resourceAwsKmsKeyUpdate(d *schema.ResourceData, meta interface{}, isFresh } } + if err := setTagsKMS(conn, d, d.Id()); err != nil { + return err + } + return resourceAwsKmsKeyRead(d, meta) } @@ -352,6 +370,30 @@ func updateKmsKeyRotationStatus(conn *kms.KMS, d *schema.ResourceData) error { return nil } +func resourceAwsKmsKeyExists(d *schema.ResourceData, meta interface{}) (bool, error) { + conn := meta.(*AWSClient).kmsconn + + req := &kms.DescribeKeyInput{ + KeyId: aws.String(d.Id()), + } + resp, err := conn.DescribeKey(req) + if err != nil { + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "NotFoundException" { + return false, nil + } + } + return false, err + } + metadata := resp.KeyMetadata + + if *metadata.KeyState == "PendingDeletion" { + return false, nil + } + + return true, nil +} + func resourceAwsKmsKeyDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).kmsconn keyId := d.Get("key_id").(string) diff --git a/installer/server/terraform/plugins/aws/resource_aws_kms_key_test.go b/installer/server/terraform/plugins/aws/resource_aws_kms_key_test.go index cd686c7e3d..b184fa30c2 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_kms_key_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_kms_key_test.go @@ -1,3 +1,4 @@ +// make testacc TEST=./builtin/providers/aws/ TESTARGS='-run=TestAccAWSKmsKey_' package aws import ( @@ -36,6 +37,29 @@ func TestAccAWSKmsKey_basic(t *testing.T) { }) } +func TestAccAWSKmsKey_disappears(t *testing.T) { + var key kms.KeyMetadata + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSKmsKeyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSKmsKey, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSKmsKeyExists("aws_kms_key.foo", &key), + ), + }, + { + Config: testAccAWSKmsKey_other_region, + PlanOnly: true, + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func TestAccAWSKmsKey_policy(t *testing.T) { var key kms.KeyMetadata expectedPolicyText := `{"Version":"2012-10-17","Id":"kms-tf-1","Statement":[{"Sid":"Enable IAM User Permissions","Effect":"Allow","Principal":{"AWS":"*"},"Action":"kms:*","Resource":"*"}]}` @@ -95,6 +119,25 @@ func TestAccAWSKmsKey_isEnabled(t *testing.T) { }) } +func TestAccAWSKmsKey_tags(t *testing.T) { + var keyBefore kms.KeyMetadata + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSKmsKeyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSKmsKey_tags, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSKmsKeyExists("aws_kms_key.foo", &keyBefore), + resource.TestCheckResourceAttr("aws_kms_key.foo", "tags.%", "2"), + ), + }, + }, + }) +} + func testAccCheckAWSKmsKeyHasPolicy(name string, expectedPolicyText string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -218,6 +261,32 @@ resource "aws_kms_key" "foo" { POLICY }`, kmsTimestamp) +var testAccAWSKmsKey_other_region = fmt.Sprintf(` +provider "aws" { + region = "us-east-1" +} +resource "aws_kms_key" "foo" { + description = "Terraform acc test %s" + deletion_window_in_days = 7 + policy = < 1 { return nil, fmt.Errorf( "Expected to find one Network ACL, got: %#v", resp.NetworkAcls) diff --git a/installer/server/terraform/plugins/aws/resource_aws_network_acl_rule_test.go b/installer/server/terraform/plugins/aws/resource_aws_network_acl_rule_test.go index 728b80208e..19b34cef7a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_network_acl_rule_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_network_acl_rule_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "regexp" "strconv" "testing" @@ -20,7 +21,7 @@ func TestAccAWSNetworkAclRule_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclRuleBasicConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSNetworkAclRuleExists("aws_network_acl_rule.baz", &networkAcl), @@ -32,6 +33,58 @@ func TestAccAWSNetworkAclRule_basic(t *testing.T) { }) } +func TestAccAWSNetworkAclRule_missingParam(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSNetworkAclRuleMissingParam, + ExpectError: regexp.MustCompile("Either `cidr_block` or `ipv6_cidr_block` must be defined"), + }, + }, + }) +} + +func TestAccAWSNetworkAclRule_ipv6(t *testing.T) { + var networkAcl ec2.NetworkAcl + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSNetworkAclRuleIpv6Config, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSNetworkAclRuleExists("aws_network_acl_rule.baz", &networkAcl), + ), + }, + }, + }) +} + +func TestAccAWSNetworkAclRule_allProtocol(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSNetworkAclRuleAllProtocolConfig, + ExpectNonEmptyPlan: false, + }, + { + Config: testAccAWSNetworkAclRuleAllProtocolConfigNoRealUpdate, + ExpectNonEmptyPlan: false, + }, + }, + }) +} + func TestResourceAWSNetworkAclRule_validateICMPArgumentValue(t *testing.T) { type testCases struct { Value string @@ -84,6 +137,26 @@ func TestResourceAWSNetworkAclRule_validateICMPArgumentValue(t *testing.T) { } +func TestAccAWSNetworkAclRule_deleteRule(t *testing.T) { + var networkAcl ec2.NetworkAcl + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSNetworkAclRuleBasicConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSNetworkAclRuleExists("aws_network_acl_rule.baz", &networkAcl), + testAccCheckAWSNetworkAclRuleDelete("aws_network_acl_rule.baz"), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func testAccCheckAWSNetworkAclRuleDestroy(s *terraform.State) error { for _, rs := range s.RootModule().Resources { @@ -126,7 +199,7 @@ func testAccCheckAWSNetworkAclRuleExists(n string, networkAcl *ec2.NetworkAcl) r } if rs.Primary.ID == "" { - return fmt.Errorf("No Network ACL Id is set") + return fmt.Errorf("No Network ACL Rule Id is set") } req := &ec2.DescribeNetworkAclsInput{ @@ -156,6 +229,40 @@ func testAccCheckAWSNetworkAclRuleExists(n string, networkAcl *ec2.NetworkAcl) r } } +func testAccCheckAWSNetworkAclRuleDelete(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No Network ACL Rule Id is set") + } + + egress, err := strconv.ParseBool(rs.Primary.Attributes["egress"]) + if err != nil { + return err + } + ruleNo, err := strconv.ParseInt(rs.Primary.Attributes["rule_number"], 10, 64) + if err != nil { + return err + } + + conn := testAccProvider.Meta().(*AWSClient).ec2conn + _, err = conn.DeleteNetworkAclEntry(&ec2.DeleteNetworkAclEntryInput{ + NetworkAclId: aws.String(rs.Primary.Attributes["network_acl_id"]), + RuleNumber: aws.Int64(ruleNo), + Egress: aws.Bool(egress), + }) + if err != nil { + return fmt.Errorf("Error deleting Network ACL Rule (%s) in testAccCheckAWSNetworkAclRuleDelete: %s", rs.Primary.ID, err) + } + + return nil + } +} + const testAccAWSNetworkAclRuleBasicConfig = ` provider "aws" { region = "us-east-1" @@ -195,3 +302,82 @@ resource "aws_network_acl_rule" "wibble" { icmp_code = -1 } ` + +const testAccAWSNetworkAclRuleMissingParam = ` +provider "aws" { + region = "us-east-1" +} +resource "aws_vpc" "foo" { + cidr_block = "10.3.0.0/16" +} +resource "aws_network_acl" "bar" { + vpc_id = "${aws_vpc.foo.id}" +} +resource "aws_network_acl_rule" "baz" { + network_acl_id = "${aws_network_acl.bar.id}" + rule_number = 200 + egress = false + protocol = "tcp" + rule_action = "allow" + from_port = 22 + to_port = 22 +} +` + +const testAccAWSNetworkAclRuleAllProtocolConfigNoRealUpdate = ` +resource "aws_vpc" "foo" { + cidr_block = "10.3.0.0/16" +} +resource "aws_network_acl" "bar" { + vpc_id = "${aws_vpc.foo.id}" +} +resource "aws_network_acl_rule" "baz" { + network_acl_id = "${aws_network_acl.bar.id}" + rule_number = 150 + egress = false + protocol = "all" + rule_action = "allow" + cidr_block = "0.0.0.0/0" + from_port = 22 + to_port = 22 +} +` + +const testAccAWSNetworkAclRuleAllProtocolConfig = ` +resource "aws_vpc" "foo" { + cidr_block = "10.3.0.0/16" +} +resource "aws_network_acl" "bar" { + vpc_id = "${aws_vpc.foo.id}" +} +resource "aws_network_acl_rule" "baz" { + network_acl_id = "${aws_network_acl.bar.id}" + rule_number = 150 + egress = false + protocol = "-1" + rule_action = "allow" + cidr_block = "0.0.0.0/0" + from_port = 22 + to_port = 22 +} +` + +const testAccAWSNetworkAclRuleIpv6Config = ` +resource "aws_vpc" "foo" { + cidr_block = "10.3.0.0/16" +} +resource "aws_network_acl" "bar" { + vpc_id = "${aws_vpc.foo.id}" +} +resource "aws_network_acl_rule" "baz" { + network_acl_id = "${aws_network_acl.bar.id}" + rule_number = 150 + egress = false + protocol = "tcp" + rule_action = "allow" + ipv6_cidr_block = "::/0" + from_port = 22 + to_port = 22 +} + +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_network_acl_test.go b/installer/server/terraform/plugins/aws/resource_aws_network_acl_test.go index c63f5c0087..b97568b658 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_network_acl_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_network_acl_test.go @@ -20,34 +20,34 @@ func TestAccAWSNetworkAcl_EgressAndIngressRules(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclEgressNIngressConfig, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "ingress.109047673.protocol", "6"), + "aws_network_acl.bar", "ingress.1871939009.protocol", "6"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "ingress.109047673.rule_no", "1"), + "aws_network_acl.bar", "ingress.1871939009.rule_no", "1"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "ingress.109047673.from_port", "80"), + "aws_network_acl.bar", "ingress.1871939009.from_port", "80"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "ingress.109047673.to_port", "80"), + "aws_network_acl.bar", "ingress.1871939009.to_port", "80"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "ingress.109047673.action", "allow"), + "aws_network_acl.bar", "ingress.1871939009.action", "allow"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "ingress.109047673.cidr_block", "10.3.0.0/18"), + "aws_network_acl.bar", "ingress.1871939009.cidr_block", "10.3.0.0/18"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "egress.868403673.protocol", "6"), + "aws_network_acl.bar", "egress.3111164687.protocol", "6"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "egress.868403673.rule_no", "2"), + "aws_network_acl.bar", "egress.3111164687.rule_no", "2"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "egress.868403673.from_port", "443"), + "aws_network_acl.bar", "egress.3111164687.from_port", "443"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "egress.868403673.to_port", "443"), + "aws_network_acl.bar", "egress.3111164687.to_port", "443"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "egress.868403673.cidr_block", "10.3.0.0/18"), + "aws_network_acl.bar", "egress.3111164687.cidr_block", "10.3.0.0/18"), resource.TestCheckResourceAttr( - "aws_network_acl.bar", "egress.868403673.action", "allow"), + "aws_network_acl.bar", "egress.3111164687.action", "allow"), ), }, }, @@ -63,23 +63,22 @@ func TestAccAWSNetworkAcl_OnlyIngressRules_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclIngressConfig, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl), - // testAccCheckSubnetAssociation("aws_network_acl.foos", "aws_subnet.blob"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.protocol", "6"), + "aws_network_acl.foos", "ingress.4245812720.protocol", "6"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.rule_no", "2"), + "aws_network_acl.foos", "ingress.4245812720.rule_no", "2"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.from_port", "443"), + "aws_network_acl.foos", "ingress.4245812720.from_port", "443"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.to_port", "443"), + "aws_network_acl.foos", "ingress.4245812720.to_port", "443"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.action", "deny"), + "aws_network_acl.foos", "ingress.4245812720.action", "deny"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.cidr_block", "10.2.0.0/18"), + "aws_network_acl.foos", "ingress.4245812720.cidr_block", "10.2.0.0/18"), ), }, }, @@ -95,46 +94,46 @@ func TestAccAWSNetworkAcl_OnlyIngressRules_update(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclIngressConfig, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl), testIngressRuleLength(&networkAcl, 2), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.protocol", "6"), + "aws_network_acl.foos", "ingress.401088754.protocol", "6"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.rule_no", "1"), + "aws_network_acl.foos", "ingress.401088754.rule_no", "1"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.from_port", "0"), + "aws_network_acl.foos", "ingress.401088754.from_port", "0"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.to_port", "22"), + "aws_network_acl.foos", "ingress.401088754.to_port", "22"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.action", "deny"), + "aws_network_acl.foos", "ingress.401088754.action", "deny"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.cidr_block", "10.2.0.0/18"), + "aws_network_acl.foos", "ingress.4245812720.cidr_block", "10.2.0.0/18"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.from_port", "443"), + "aws_network_acl.foos", "ingress.4245812720.from_port", "443"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.1451312565.rule_no", "2"), + "aws_network_acl.foos", "ingress.4245812720.rule_no", "2"), ), }, - resource.TestStep{ + { Config: testAccAWSNetworkAclIngressConfigChange, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl), testIngressRuleLength(&networkAcl, 1), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.protocol", "6"), + "aws_network_acl.foos", "ingress.401088754.protocol", "6"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.rule_no", "1"), + "aws_network_acl.foos", "ingress.401088754.rule_no", "1"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.from_port", "0"), + "aws_network_acl.foos", "ingress.401088754.from_port", "0"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.to_port", "22"), + "aws_network_acl.foos", "ingress.401088754.to_port", "22"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.action", "deny"), + "aws_network_acl.foos", "ingress.401088754.action", "deny"), resource.TestCheckResourceAttr( - "aws_network_acl.foos", "ingress.2048097841.cidr_block", "10.2.0.0/18"), + "aws_network_acl.foos", "ingress.401088754.cidr_block", "10.2.0.0/18"), ), }, }, @@ -150,7 +149,7 @@ func TestAccAWSNetworkAcl_OnlyEgressRules(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclEgressConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.bond", &networkAcl), @@ -169,13 +168,13 @@ func TestAccAWSNetworkAcl_SubnetChange(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclSubnetConfig, Check: resource.ComposeTestCheckFunc( testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.old"), ), }, - resource.TestStep{ + { Config: testAccAWSNetworkAclSubnetConfigChange, Check: resource.ComposeTestCheckFunc( testAccCheckSubnetIsNotAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.old"), @@ -206,7 +205,7 @@ func TestAccAWSNetworkAcl_Subnets(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclSubnet_SubnetIds, Check: resource.ComposeTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl), @@ -216,7 +215,7 @@ func TestAccAWSNetworkAcl_Subnets(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccAWSNetworkAclSubnet_SubnetIdsUpdate, Check: resource.ComposeTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl), @@ -230,6 +229,62 @@ func TestAccAWSNetworkAcl_Subnets(t *testing.T) { }) } +func TestAccAWSNetworkAcl_ipv6Rules(t *testing.T) { + var networkAcl ec2.NetworkAcl + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_network_acl.foos", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSNetworkAclDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSNetworkAclIpv6Config, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.#", "1"), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.1976110835.protocol", "6"), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.1976110835.rule_no", "1"), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.1976110835.from_port", "0"), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.1976110835.to_port", "22"), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.1976110835.action", "allow"), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.1976110835.ipv6_cidr_block", "::/0"), + ), + }, + }, + }) +} + +func TestAccAWSNetworkAcl_ipv6VpcRules(t *testing.T) { + var networkAcl ec2.NetworkAcl + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_network_acl.foos", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSNetworkAclDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSNetworkAclIpv6VpcConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.#", "1"), + resource.TestCheckResourceAttr( + "aws_network_acl.foos", "ingress.1296304962.ipv6_cidr_block", "2600:1f16:d1e:9a00::/56"), + ), + }, + }, + }) +} + func TestAccAWSNetworkAcl_espProtocol(t *testing.T) { var networkAcl ec2.NetworkAcl @@ -239,7 +294,7 @@ func TestAccAWSNetworkAcl_espProtocol(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSNetworkAclEsp, Check: resource.ComposeTestCheckFunc( testAccCheckAWSNetworkAclExists("aws_network_acl.testesp", &networkAcl), @@ -336,7 +391,7 @@ func testAccCheckSubnetIsAssociatedWithAcl(acl string, sub string) resource.Test resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{ NetworkAclIds: []*string{aws.String(networkAcl.Primary.ID)}, Filters: []*ec2.Filter{ - &ec2.Filter{ + { Name: aws.String("association.subnet-id"), Values: []*string{aws.String(subnet.Primary.ID)}, }, @@ -362,7 +417,7 @@ func testAccCheckSubnetIsNotAssociatedWithAcl(acl string, subnet string) resourc resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{ NetworkAclIds: []*string{aws.String(networkAcl.Primary.ID)}, Filters: []*ec2.Filter{ - &ec2.Filter{ + { Name: aws.String("association.subnet-id"), Values: []*string{aws.String(subnet.Primary.ID)}, }, @@ -379,6 +434,60 @@ func testAccCheckSubnetIsNotAssociatedWithAcl(acl string, subnet string) resourc } } +const testAccAWSNetworkAclIpv6Config = ` +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" + tags { + Name = "TestAccAWSNetworkAcl_ipv6Rules" + } +} +resource "aws_subnet" "blob" { + cidr_block = "10.1.1.0/24" + vpc_id = "${aws_vpc.foo.id}" + map_public_ip_on_launch = true +} +resource "aws_network_acl" "foos" { + vpc_id = "${aws_vpc.foo.id}" + ingress = { + protocol = "tcp" + rule_no = 1 + action = "allow" + ipv6_cidr_block = "::/0" + from_port = 0 + to_port = 22 + } + + subnet_ids = ["${aws_subnet.blob.id}"] +} +` + +const testAccAWSNetworkAclIpv6VpcConfig = ` +provider "aws" { + region = "us-east-2" +} + +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags { + Name = "TestAccAWSNetworkAcl_ipv6VpcRules" + } +} + +resource "aws_network_acl" "foos" { + vpc_id = "${aws_vpc.foo.id}" + ingress = { + protocol = "tcp" + rule_no = 1 + action = "allow" + ipv6_cidr_block = "2600:1f16:d1e:9a00::/56" + from_port = 0 + to_port = 22 + } +} +` + const testAccAWSNetworkAclIngressConfig = ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" diff --git a/installer/server/terraform/plugins/aws/resource_aws_network_interface.go b/installer/server/terraform/plugins/aws/resource_aws_network_interface.go index 5c9f8263e2..8572371419 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_network_interface.go +++ b/installer/server/terraform/plugins/aws/resource_aws_network_interface.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "log" + "math" "strconv" "time" @@ -33,6 +34,12 @@ func resourceAwsNetworkInterface() *schema.Resource { ForceNew: true, }, + "private_ip": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "private_ips": &schema.Schema{ Type: schema.TypeSet, Optional: true, @@ -41,6 +48,12 @@ func resourceAwsNetworkInterface() *schema.Resource { Set: schema.HashString, }, + "private_ips_count": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, + "security_groups": &schema.Schema{ Type: schema.TypeSet, Optional: true, @@ -110,6 +123,10 @@ func resourceAwsNetworkInterfaceCreate(d *schema.ResourceData, meta interface{}) request.Description = aws.String(v.(string)) } + if v, ok := d.GetOk("private_ips_count"); ok { + request.SecondaryPrivateIpAddressCount = aws.Int64(int64(v.(int))) + } + log.Printf("[DEBUG] Creating network interface") resp, err := conn.CreateNetworkInterface(request) if err != nil { @@ -144,6 +161,7 @@ func resourceAwsNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e eni := describeResp.NetworkInterfaces[0] d.Set("subnet_id", eni.SubnetId) + d.Set("private_ip", eni.PrivateIpAddress) d.Set("private_ips", flattenNetworkInterfacesPrivateIPAddresses(eni.PrivateIpAddresses)) d.Set("security_groups", flattenGroupIdentifiers(eni.Groups)) d.Set("source_dest_check", eni.SourceDestCheck) @@ -300,6 +318,49 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{}) d.SetPartial("source_dest_check") + if d.HasChange("private_ips_count") { + o, n := d.GetChange("private_ips_count") + private_ips := d.Get("private_ips").(*schema.Set).List() + private_ips_filtered := private_ips[:0] + primary_ip := d.Get("private_ip") + + for _, ip := range private_ips { + if ip != primary_ip { + private_ips_filtered = append(private_ips_filtered, ip) + } + } + + if o != nil && o != 0 && n != nil && n != len(private_ips_filtered) { + + diff := n.(int) - o.(int) + + // Surplus of IPs, add the diff + if diff > 0 { + input := &ec2.AssignPrivateIpAddressesInput{ + NetworkInterfaceId: aws.String(d.Id()), + SecondaryPrivateIpAddressCount: aws.Int64(int64(diff)), + } + _, err := conn.AssignPrivateIpAddresses(input) + if err != nil { + return fmt.Errorf("Failure to assign Private IPs: %s", err) + } + } + + if diff < 0 { + input := &ec2.UnassignPrivateIpAddressesInput{ + NetworkInterfaceId: aws.String(d.Id()), + PrivateIpAddresses: expandStringList(private_ips_filtered[0:int(math.Abs(float64(diff)))]), + } + _, err := conn.UnassignPrivateIpAddresses(input) + if err != nil { + return fmt.Errorf("Failure to unassign Private IPs: %s", err) + } + } + + d.SetPartial("private_ips_count") + } + } + if d.HasChange("security_groups") { request := &ec2.ModifyNetworkInterfaceAttributeInput{ NetworkInterfaceId: aws.String(d.Id()), diff --git a/installer/server/terraform/plugins/aws/resource_aws_network_interface_attachment.go b/installer/server/terraform/plugins/aws/resource_aws_network_interface_attachment.go new file mode 100644 index 0000000000..c37b0d18fe --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_network_interface_attachment.go @@ -0,0 +1,166 @@ +package aws + +import ( + "fmt" + "log" + "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/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsNetworkInterfaceAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsNetworkInterfaceAttachmentCreate, + Read: resourceAwsNetworkInterfaceAttachmentRead, + Delete: resourceAwsNetworkInterfaceAttachmentDelete, + + Schema: map[string]*schema.Schema{ + "device_index": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + }, + + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "network_interface_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "attachment_id": { + Type: schema.TypeString, + Computed: true, + }, + + "status": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAwsNetworkInterfaceAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).ec2conn + + device_index := d.Get("device_index").(int) + instance_id := d.Get("instance_id").(string) + network_interface_id := d.Get("network_interface_id").(string) + + opts := &ec2.AttachNetworkInterfaceInput{ + DeviceIndex: aws.Int64(int64(device_index)), + InstanceId: aws.String(instance_id), + NetworkInterfaceId: aws.String(network_interface_id), + } + + log.Printf("[DEBUG] Attaching network interface (%s) to instance (%s)", network_interface_id, instance_id) + resp, err := conn.AttachNetworkInterface(opts) + if err != nil { + if awsErr, ok := err.(awserr.Error); ok { + return fmt.Errorf("Error attaching network interface (%s) to instance (%s), message: \"%s\", code: \"%s\"", + network_interface_id, instance_id, awsErr.Message(), awsErr.Code()) + } + return err + } + + stateConf := &resource.StateChangeConf{ + Pending: []string{"false"}, + Target: []string{"true"}, + Refresh: networkInterfaceAttachmentRefreshFunc(conn, network_interface_id), + Timeout: 5 * time.Minute, + Delay: 10 * time.Second, + MinTimeout: 3 * time.Second, + } + + _, err = stateConf.WaitForState() + if err != nil { + return fmt.Errorf( + "Error waiting for Volume (%s) to attach to Instance: %s, error: %s", network_interface_id, instance_id, err) + } + + d.SetId(*resp.AttachmentId) + return resourceAwsNetworkInterfaceAttachmentRead(d, meta) +} + +func resourceAwsNetworkInterfaceAttachmentRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).ec2conn + + interfaceId := d.Get("network_interface_id").(string) + + req := &ec2.DescribeNetworkInterfacesInput{ + NetworkInterfaceIds: []*string{aws.String(interfaceId)}, + } + + resp, err := conn.DescribeNetworkInterfaces(req) + if err != nil { + if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidNetworkInterfaceID.NotFound" { + // The ENI is gone now, so just remove the attachment from the state + d.SetId("") + return nil + } + + return fmt.Errorf("Error retrieving ENI: %s", err) + } + if len(resp.NetworkInterfaces) != 1 { + return fmt.Errorf("Unable to find ENI (%s): %#v", interfaceId, resp.NetworkInterfaces) + } + + eni := resp.NetworkInterfaces[0] + + if eni.Attachment == nil { + // Interface is no longer attached, remove from state + d.SetId("") + return nil + } + + d.Set("attachment_id", eni.Attachment.AttachmentId) + d.Set("device_index", eni.Attachment.DeviceIndex) + d.Set("instance_id", eni.Attachment.InstanceId) + d.Set("network_interface_id", eni.NetworkInterfaceId) + d.Set("status", eni.Attachment.Status) + + return nil +} + +func resourceAwsNetworkInterfaceAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).ec2conn + + interfaceId := d.Get("network_interface_id").(string) + + detach_request := &ec2.DetachNetworkInterfaceInput{ + AttachmentId: aws.String(d.Id()), + Force: aws.Bool(true), + } + + _, detach_err := conn.DetachNetworkInterface(detach_request) + if detach_err != nil { + if awsErr, _ := detach_err.(awserr.Error); awsErr.Code() != "InvalidAttachmentID.NotFound" { + return fmt.Errorf("Error detaching ENI: %s", detach_err) + } + } + + log.Printf("[DEBUG] Waiting for ENI (%s) to become dettached", interfaceId) + stateConf := &resource.StateChangeConf{ + Pending: []string{"true"}, + Target: []string{"false"}, + Refresh: networkInterfaceAttachmentRefreshFunc(conn, interfaceId), + Timeout: 10 * time.Minute, + } + + if _, err := stateConf.WaitForState(); err != nil { + return fmt.Errorf( + "Error waiting for ENI (%s) to become dettached: %s", interfaceId, err) + } + + return nil +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_network_interface_attacment_test.go b/installer/server/terraform/plugins/aws/resource_aws_network_interface_attacment_test.go new file mode 100644 index 0000000000..b6b1aa0eb4 --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_network_interface_attacment_test.go @@ -0,0 +1,92 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSNetworkInterfaceAttachment_basic(t *testing.T) { + var conf ec2.NetworkInterface + rInt := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_network_interface.bar", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSENIDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSNetworkInterfaceAttachmentConfig_basic(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSENIExists("aws_network_interface.bar", &conf), + resource.TestCheckResourceAttr( + "aws_network_interface_attachment.test", "device_index", "1"), + resource.TestCheckResourceAttrSet( + "aws_network_interface_attachment.test", "instance_id"), + resource.TestCheckResourceAttrSet( + "aws_network_interface_attachment.test", "network_interface_id"), + resource.TestCheckResourceAttrSet( + "aws_network_interface_attachment.test", "attachment_id"), + resource.TestCheckResourceAttrSet( + "aws_network_interface_attachment.test", "status"), + ), + }, + }, + }) +} + +func testAccAWSNetworkInterfaceAttachmentConfig_basic(rInt int) string { + return fmt.Sprintf(` +resource "aws_vpc" "foo" { + cidr_block = "172.16.0.0/16" +} + +resource "aws_subnet" "foo" { + vpc_id = "${aws_vpc.foo.id}" + cidr_block = "172.16.10.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_security_group" "foo" { + vpc_id = "${aws_vpc.foo.id}" + description = "foo" + name = "foo-%d" + + egress { + from_port = 0 + to_port = 0 + protocol = "tcp" + cidr_blocks = ["10.0.0.0/16"] + } +} + +resource "aws_network_interface" "bar" { + subnet_id = "${aws_subnet.foo.id}" + private_ips = ["172.16.10.100"] + security_groups = ["${aws_security_group.foo.id}"] + description = "Managed by Terraform" + tags { + Name = "bar_interface" + } +} + +resource "aws_instance" "foo" { + ami = "ami-c5eabbf5" + instance_type = "t2.micro" + subnet_id = "${aws_subnet.foo.id}" + tags { + Name = "foo-%d" + } +} + +resource "aws_network_interface_attachment" "test" { + device_index = 1 + instance_id = "${aws_instance.foo.id}" + network_interface_id = "${aws_network_interface.bar.id}" +} +`, rInt, rInt) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_application.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_application.go index 4422e7f09f..7333018e5f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_application.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_application.go @@ -21,21 +21,21 @@ func resourceAwsOpsworksApplication() *schema.Resource { Update: resourceAwsOpsworksApplicationUpdate, Delete: resourceAwsOpsworksApplicationDelete, Schema: map[string]*schema.Schema{ - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "short_name": &schema.Schema{ + "short_name": { Type: schema.TypeString, Computed: true, Optional: true, }, // aws-flow-ruby | java | rails | php | nodejs | static | other - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { @@ -56,62 +56,63 @@ func resourceAwsOpsworksApplication() *schema.Resource { return }, }, - "stack_id": &schema.Schema{ + "stack_id": { Type: schema.TypeString, Required: true, }, // TODO: the following 4 vals are really part of the Attributes array. We should validate that only ones relevant to the chosen type are set, perhaps. (what is the default type? how do they map?) - "document_root": &schema.Schema{ + "document_root": { Type: schema.TypeString, Optional: true, //Default: "public", }, - "rails_env": &schema.Schema{ + "rails_env": { Type: schema.TypeString, Optional: true, //Default: "production", }, - "auto_bundle_on_deploy": &schema.Schema{ + "auto_bundle_on_deploy": { Type: schema.TypeString, Optional: true, //Default: true, }, - "aws_flow_ruby_settings": &schema.Schema{ + "aws_flow_ruby_settings": { Type: schema.TypeString, Optional: true, }, - "app_source": &schema.Schema{ + "app_source": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, }, - "url": &schema.Schema{ + "url": { Type: schema.TypeString, Optional: true, }, - "username": &schema.Schema{ + "username": { Type: schema.TypeString, Optional: true, }, - "password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, }, - "revision": &schema.Schema{ + "revision": { Type: schema.TypeString, Optional: true, }, - "ssh_key": &schema.Schema{ + "ssh_key": { Type: schema.TypeString, Optional: true, }, @@ -121,41 +122,41 @@ func resourceAwsOpsworksApplication() *schema.Resource { // AutoSelectOpsworksMysqlInstance, OpsworksMysqlInstance, or RdsDbInstance. // anything beside auto select will lead into failure in case the instance doesn't exist // XXX: validation? - "data_source_type": &schema.Schema{ + "data_source_type": { Type: schema.TypeString, Optional: true, }, - "data_source_database_name": &schema.Schema{ + "data_source_database_name": { Type: schema.TypeString, Optional: true, }, - "data_source_arn": &schema.Schema{ + "data_source_arn": { Type: schema.TypeString, Optional: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "domains": &schema.Schema{ + "domains": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "environment": &schema.Schema{ + "environment": { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "key": &schema.Schema{ + "key": { Type: schema.TypeString, Required: true, }, - "value": &schema.Schema{ + "value": { Type: schema.TypeString, Required: true, }, - "secure": &schema.Schema{ + "secure": { Type: schema.TypeBool, Optional: true, Default: true, @@ -163,18 +164,18 @@ func resourceAwsOpsworksApplication() *schema.Resource { }, }, }, - "enable_ssl": &schema.Schema{ + "enable_ssl": { Type: schema.TypeBool, Optional: true, Default: false, }, - "ssl_configuration": &schema.Schema{ + "ssl_configuration": { Type: schema.TypeList, Optional: true, //Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": &schema.Schema{ + "certificate": { Type: schema.TypeString, Required: true, StateFunc: func(v interface{}) string { @@ -186,9 +187,10 @@ func resourceAwsOpsworksApplication() *schema.Resource { } }, }, - "private_key": &schema.Schema{ - Type: schema.TypeString, - Required: true, + "private_key": { + Type: schema.TypeString, + Required: true, + Sensitive: true, StateFunc: func(v interface{}) string { switch v.(type) { case string: @@ -198,7 +200,7 @@ func resourceAwsOpsworksApplication() *schema.Resource { } }, }, - "chain": &schema.Schema{ + "chain": { Type: schema.TypeString, Optional: true, StateFunc: func(v interface{}) string { diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_application_test.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_application_test.go index f1388d080b..37d2df0b32 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_application_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_application_test.go @@ -8,25 +8,30 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/opsworks" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccAWSOpsworksApplication(t *testing.T) { var opsapp opsworks.App + + rInt := acctest.RandInt() + name := fmt.Sprintf("tf-ops-acc-application-%d", rInt) + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksApplicationDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAwsOpsworksApplicationCreate, + { + Config: testAccAwsOpsworksApplicationCreate(name), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksApplicationExists( "aws_opsworks_application.tf-acc-app", &opsapp), testAccCheckAWSOpsworksCreateAppAttributes(&opsapp), resource.TestCheckResourceAttr( - "aws_opsworks_application.tf-acc-app", "name", "tf-ops-acc-application", + "aws_opsworks_application.tf-acc-app", "name", name, ), resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "type", "other", @@ -34,14 +39,14 @@ func TestAccAWSOpsworksApplication(t *testing.T) { resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "enable_ssl", "false", ), - resource.TestCheckResourceAttr( - "aws_opsworks_application.tf-acc-app", "ssl_configuration", "", + resource.TestCheckNoResourceAttr( + "aws_opsworks_application.tf-acc-app", "ssl_configuration", ), - resource.TestCheckResourceAttr( - "aws_opsworks_application.tf-acc-app", "domains", "", + resource.TestCheckNoResourceAttr( + "aws_opsworks_application.tf-acc-app", "domains", ), - resource.TestCheckResourceAttr( - "aws_opsworks_application.tf-acc-app", "app_source", "", + resource.TestCheckNoResourceAttr( + "aws_opsworks_application.tf-acc-app", "app_source", ), resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "environment.3077298702.key", "key1", @@ -49,22 +54,22 @@ func TestAccAWSOpsworksApplication(t *testing.T) { resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "environment.3077298702.value", "value1", ), - resource.TestCheckResourceAttr( - "aws_opsworks_application.tf-acc-app", "environment.3077298702.secret", "", + resource.TestCheckNoResourceAttr( + "aws_opsworks_application.tf-acc-app", "environment.3077298702.secret", ), resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "document_root", "foo", ), ), }, - resource.TestStep{ - Config: testAccAwsOpsworksApplicationUpdate, + { + Config: testAccAwsOpsworksApplicationUpdate(name), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksApplicationExists( "aws_opsworks_application.tf-acc-app", &opsapp), testAccCheckAWSOpsworksUpdateAppAttributes(&opsapp), resource.TestCheckResourceAttr( - "aws_opsworks_application.tf-acc-app", "name", "tf-ops-acc-application", + "aws_opsworks_application.tf-acc-app", "name", name, ), resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "type", "rails", @@ -117,8 +122,8 @@ func TestAccAWSOpsworksApplication(t *testing.T) { resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "environment.3077298702.value", "value1", ), - resource.TestCheckResourceAttr( - "aws_opsworks_application.tf-acc-app", "environment.3077298702.secret", "", + resource.TestCheckNoResourceAttr( + "aws_opsworks_application.tf-acc-app", "environment.3077298702.secret", ), resource.TestCheckResourceAttr( "aws_opsworks_application.tf-acc-app", "document_root", "root", @@ -188,7 +193,7 @@ func testAccCheckAWSOpsworksCreateAppAttributes( } expectedEnv := []*opsworks.EnvironmentVariable{ - &opsworks.EnvironmentVariable{ + { Key: aws.String("key1"), Value: aws.String("value1"), Secure: aws.Bool(false), @@ -248,12 +253,12 @@ func testAccCheckAWSOpsworksUpdateAppAttributes( } expectedEnv := []*opsworks.EnvironmentVariable{ - &opsworks.EnvironmentVariable{ + { Key: aws.String("key2"), Value: aws.String("*****FILTERED*****"), Secure: aws.Bool(true), }, - &opsworks.EnvironmentVariable{ + { Key: aws.String("key1"), Value: aws.String("value1"), Secure: aws.Bool(false), @@ -308,10 +313,12 @@ func testAccCheckAwsOpsworksApplicationDestroy(s *terraform.State) error { return nil } -var testAccAwsOpsworksApplicationCreate = testAccAwsOpsworksStackConfigVpcCreate("tf-ops-acc-application") + ` +func testAccAwsOpsworksApplicationCreate(name string) string { + return testAccAwsOpsworksStackConfigVpcCreate(name) + + fmt.Sprintf(` resource "aws_opsworks_application" "tf-acc-app" { stack_id = "${aws_opsworks_stack.tf-acc.id}" - name = "tf-ops-acc-application" + name = "%s" type = "other" enable_ssl = false app_source ={ @@ -320,12 +327,15 @@ resource "aws_opsworks_application" "tf-acc-app" { environment = { key = "key1" value = "value1" secure = false} document_root = "foo" } -` +`, name) +} -var testAccAwsOpsworksApplicationUpdate = testAccAwsOpsworksStackConfigVpcCreate("tf-ops-acc-application") + ` +func testAccAwsOpsworksApplicationUpdate(name string) string { + return testAccAwsOpsworksStackConfigVpcCreate(name) + + fmt.Sprintf(` resource "aws_opsworks_application" "tf-acc-app" { stack_id = "${aws_opsworks_stack.tf-acc.id}" - name = "tf-ops-acc-application" + name = "%s" type = "rails" domains = ["example.com", "sub.example.com"] enable_ssl = true @@ -372,4 +382,5 @@ EOS auto_bundle_on_deploy = "true" rails_env = "staging" } -` +`, name) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_custom_layer_test.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_custom_layer_test.go index 1767b609ff..fc0c160877 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_custom_layer_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_custom_layer_test.go @@ -24,7 +24,7 @@ func TestAccAWSOpsworksCustomLayer(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksCustomLayerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAwsOpsworksCustomLayerConfigNoVpcCreate(stackName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksCustomLayerExists( @@ -74,7 +74,7 @@ func TestAccAWSOpsworksCustomLayer(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksCustomLayerConfigUpdate(stackName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( @@ -219,7 +219,7 @@ func testAccCheckAWSOpsworksCreateLayerAttributes( } expectedEbsVolumes := []*opsworks.VolumeConfiguration{ - &opsworks.VolumeConfiguration{ + { VolumeType: aws.String("gp2"), NumberOfDisks: aws.Int64(2), MountPoint: aws.String("/home"), @@ -287,10 +287,6 @@ resource "aws_security_group" "tf-ops-acc-layer2" { func testAccAwsOpsworksCustomLayerConfigNoVpcCreate(name string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" -} - resource "aws_opsworks_custom_layer" "tf-acc" { stack_id = "${aws_opsworks_stack.tf-acc.id}" name = "%s" @@ -361,10 +357,6 @@ resource "aws_opsworks_custom_layer" "tf-acc" { func testAccAwsOpsworksCustomLayerConfigUpdate(name string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" -} - resource "aws_security_group" "tf-ops-acc-layer3" { name = "tf-ops-acc-layer3" ingress { diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_ganglia_layer.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_ganglia_layer.go index 24778501c4..1aadefe5dd 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_ganglia_layer.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_ganglia_layer.go @@ -10,17 +10,17 @@ func resourceAwsOpsworksGangliaLayer() *schema.Resource { DefaultLayerName: "Ganglia", Attributes: map[string]*opsworksLayerTypeAttribute{ - "url": &opsworksLayerTypeAttribute{ + "url": { AttrName: "GangliaUrl", Type: schema.TypeString, Default: "/ganglia", }, - "username": &opsworksLayerTypeAttribute{ + "username": { AttrName: "GangliaUser", Type: schema.TypeString, Default: "opsworks", }, - "password": &opsworksLayerTypeAttribute{ + "password": { AttrName: "GangliaPassword", Type: schema.TypeString, Required: true, diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_haproxy_layer.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_haproxy_layer.go index 2b05dce05b..91e843257c 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_haproxy_layer.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_haproxy_layer.go @@ -10,33 +10,33 @@ func resourceAwsOpsworksHaproxyLayer() *schema.Resource { DefaultLayerName: "HAProxy", Attributes: map[string]*opsworksLayerTypeAttribute{ - "stats_enabled": &opsworksLayerTypeAttribute{ + "stats_enabled": { AttrName: "EnableHaproxyStats", Type: schema.TypeBool, Default: true, }, - "stats_url": &opsworksLayerTypeAttribute{ + "stats_url": { AttrName: "HaproxyStatsUrl", Type: schema.TypeString, Default: "/haproxy?stats", }, - "stats_user": &opsworksLayerTypeAttribute{ + "stats_user": { AttrName: "HaproxyStatsUser", Type: schema.TypeString, Default: "opsworks", }, - "stats_password": &opsworksLayerTypeAttribute{ + "stats_password": { AttrName: "HaproxyStatsPassword", Type: schema.TypeString, WriteOnly: true, Required: true, }, - "healthcheck_url": &opsworksLayerTypeAttribute{ + "healthcheck_url": { AttrName: "HaproxyHealthCheckUrl", Type: schema.TypeString, Default: "/", }, - "healthcheck_method": &opsworksLayerTypeAttribute{ + "healthcheck_method": { AttrName: "HaproxyHealthCheckMethod", Type: schema.TypeString, Default: "OPTIONS", diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance.go index 0e42e30f07..ab7a7f471b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance.go @@ -111,6 +111,7 @@ func resourceAwsOpsworksInstance() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, + ForceNew: true, }, "infrastructure_class": { @@ -565,6 +566,10 @@ func resourceAwsOpsworksInstanceRead(d *schema.ResourceData, meta interface{}) e for _, v := range instance.LayerIds { layerIds = append(layerIds, *v) } + layerIds, err = sortListBasedonTFFile(layerIds, d, "layer_ids") + if err != nil { + return fmt.Errorf("[DEBUG] Error sorting layer_ids attribute: %#v", err) + } if err := d.Set("layer_ids", layerIds); err != nil { return fmt.Errorf("[DEBUG] Error setting layer_ids attribute: %#v, error: %#v", layerIds, err) } @@ -777,7 +782,7 @@ func resourceAwsOpsworksInstanceCreate(d *schema.ResourceData, meta interface{}) d.Set("id", instanceId) if v, ok := d.GetOk("state"); ok && v.(string) == "running" { - err := startOpsworksInstance(d, meta, false) + err := startOpsworksInstance(d, meta, true) if err != nil { return err } @@ -820,7 +825,6 @@ func resourceAwsOpsworksInstanceUpdate(d *schema.ResourceData, meta interface{}) if v, ok := d.GetOk("layer_ids"); ok { req.LayerIds = expandStringList(v.([]interface{})) - } if v, ok := d.GetOk("os"); ok { @@ -857,7 +861,7 @@ func resourceAwsOpsworksInstanceUpdate(d *schema.ResourceData, meta interface{}) } } else { if status != "stopped" && status != "stopping" && status != "shutting_down" { - err := stopOpsworksInstance(d, meta, false) + err := stopOpsworksInstance(d, meta, true) if err != nil { return err } diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance_test.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance_test.go index 5b54a98220..1a2bbe0f63 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_instance_test.go @@ -71,7 +71,7 @@ func TestAccAWSOpsworksInstance(t *testing.T) { "aws_opsworks_instance.tf-acc", "tenancy", "default", ), resource.TestCheckResourceAttr( - "aws_opsworks_instance.tf-acc", "os", "Amazon Linux 2014.09", // inherited from opsworks_stack_test + "aws_opsworks_instance.tf-acc", "os", "Amazon Linux 2016.09", // inherited from opsworks_stack_test ), resource.TestCheckResourceAttr( "aws_opsworks_instance.tf-acc", "root_device_type", "ebs", // inherited from opsworks_stack_test @@ -108,6 +108,44 @@ func TestAccAWSOpsworksInstance(t *testing.T) { }) } +func TestAccAWSOpsworksInstance_UpdateHostNameForceNew(t *testing.T) { + stackName := fmt.Sprintf("tf-%d", acctest.RandInt()) + + var before, after opsworks.Instance + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsOpsworksInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsOpsworksInstanceConfigCreate(stackName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSOpsworksInstanceExists("aws_opsworks_instance.tf-acc", &before), + resource.TestCheckResourceAttr("aws_opsworks_instance.tf-acc", "hostname", "tf-acc1"), + ), + }, + { + Config: testAccAwsOpsworksInstanceConfigUpdateHostName(stackName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSOpsworksInstanceExists("aws_opsworks_instance.tf-acc", &after), + resource.TestCheckResourceAttr("aws_opsworks_instance.tf-acc", "hostname", "tf-acc2"), + testAccCheckAwsOpsworksInstanceRecreated(t, &before, &after), + ), + }, + }, + }) +} + +func testAccCheckAwsOpsworksInstanceRecreated(t *testing.T, + before, after *opsworks.Instance) resource.TestCheckFunc { + return func(s *terraform.State) error { + if *before.InstanceId == *after.InstanceId { + t.Fatalf("Expected change of OpsWorks Instance IDs, but both were %s", *before.InstanceId) + } + return nil + } +} + func testAccCheckAWSOpsworksInstanceExists( n string, opsinst *opsworks.Instance) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -197,6 +235,59 @@ func testAccCheckAwsOpsworksInstanceDestroy(s *terraform.State) error { return fmt.Errorf("Fall through error on OpsWorks instance test") } +func testAccAwsOpsworksInstanceConfigUpdateHostName(name string) string { + return fmt.Sprintf(` +resource "aws_security_group" "tf-ops-acc-web" { + name = "%s-web" + ingress { + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } +} + +resource "aws_security_group" "tf-ops-acc-php" { + name = "%s-php" + ingress { + from_port = 8080 + to_port = 8080 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } +} + +resource "aws_opsworks_static_web_layer" "tf-acc" { + stack_id = "${aws_opsworks_stack.tf-acc.id}" + + custom_security_group_ids = [ + "${aws_security_group.tf-ops-acc-web.id}", + ] +} + +resource "aws_opsworks_php_app_layer" "tf-acc" { + stack_id = "${aws_opsworks_stack.tf-acc.id}" + + custom_security_group_ids = [ + "${aws_security_group.tf-ops-acc-php.id}", + ] +} + +resource "aws_opsworks_instance" "tf-acc" { + stack_id = "${aws_opsworks_stack.tf-acc.id}" + layer_ids = [ + "${aws_opsworks_static_web_layer.tf-acc.id}", + ] + instance_type = "t2.micro" + state = "stopped" + hostname = "tf-acc2" +} + +%s + +`, name, name, testAccAwsOpsworksStackConfigVpcCreate(name)) +} + func testAccAwsOpsworksInstanceConfigCreate(name string) string { return fmt.Sprintf(` resource "aws_security_group" "tf-ops-acc-web" { diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_java_app_layer.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_java_app_layer.go index 2b79fcfad3..14679658f3 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_java_app_layer.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_java_app_layer.go @@ -10,27 +10,27 @@ func resourceAwsOpsworksJavaAppLayer() *schema.Resource { DefaultLayerName: "Java App Server", Attributes: map[string]*opsworksLayerTypeAttribute{ - "jvm_type": &opsworksLayerTypeAttribute{ + "jvm_type": { AttrName: "Jvm", Type: schema.TypeString, Default: "openjdk", }, - "jvm_version": &opsworksLayerTypeAttribute{ + "jvm_version": { AttrName: "JvmVersion", Type: schema.TypeString, Default: "7", }, - "jvm_options": &opsworksLayerTypeAttribute{ + "jvm_options": { AttrName: "JvmOptions", Type: schema.TypeString, Default: "", }, - "app_server": &opsworksLayerTypeAttribute{ + "app_server": { AttrName: "JavaAppServer", Type: schema.TypeString, Default: "tomcat", }, - "app_server_version": &opsworksLayerTypeAttribute{ + "app_server_version": { AttrName: "JavaAppServerVersion", Type: schema.TypeString, Default: "7", diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_memcached_layer.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_memcached_layer.go index 626b428bb5..301d739240 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_memcached_layer.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_memcached_layer.go @@ -10,7 +10,7 @@ func resourceAwsOpsworksMemcachedLayer() *schema.Resource { DefaultLayerName: "Memcached", Attributes: map[string]*opsworksLayerTypeAttribute{ - "allocated_memory": &opsworksLayerTypeAttribute{ + "allocated_memory": { AttrName: "MemcachedMemory", Type: schema.TypeInt, Default: 512, diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_mysql_layer.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_mysql_layer.go index 6ab4476a3d..560641a4e3 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_mysql_layer.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_mysql_layer.go @@ -10,12 +10,12 @@ func resourceAwsOpsworksMysqlLayer() *schema.Resource { DefaultLayerName: "MySQL", Attributes: map[string]*opsworksLayerTypeAttribute{ - "root_password": &opsworksLayerTypeAttribute{ + "root_password": { AttrName: "MysqlRootPassword", Type: schema.TypeString, WriteOnly: true, }, - "root_password_on_all_instances": &opsworksLayerTypeAttribute{ + "root_password_on_all_instances": { AttrName: "MysqlRootPasswordUbiquitous", Type: schema.TypeBool, Default: true, diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_nodejs_app_layer.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_nodejs_app_layer.go index 24f3d0f3eb..d11261b633 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_nodejs_app_layer.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_nodejs_app_layer.go @@ -10,7 +10,7 @@ func resourceAwsOpsworksNodejsAppLayer() *schema.Resource { DefaultLayerName: "Node.js App Server", Attributes: map[string]*opsworksLayerTypeAttribute{ - "nodejs_version": &opsworksLayerTypeAttribute{ + "nodejs_version": { AttrName: "NodejsVersion", Type: schema.TypeString, Default: "0.10.38", diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission.go index 457441f0bc..6e4d5f2d11 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission.go @@ -20,26 +20,26 @@ func resourceAwsOpsworksPermission() *schema.Resource { Read: resourceAwsOpsworksPermissionRead, Schema: map[string]*schema.Schema{ - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, }, - "allow_ssh": &schema.Schema{ + "allow_ssh": { Type: schema.TypeBool, Computed: true, Optional: true, }, - "allow_sudo": &schema.Schema{ + "allow_sudo": { Type: schema.TypeBool, Computed: true, Optional: true, }, - "user_arn": &schema.Schema{ + "user_arn": { Type: schema.TypeString, Required: true, }, // one of deny, show, deploy, manage, iam_only - "level": &schema.Schema{ + "level": { Type: schema.TypeString, Computed: true, Optional: true, @@ -61,7 +61,7 @@ func resourceAwsOpsworksPermission() *schema.Resource { return }, }, - "stack_id": &schema.Schema{ + "stack_id": { Type: schema.TypeString, Computed: true, Optional: true, diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission_test.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission_test.go index e1d3c1b8f4..9ff9c7e6e2 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_permission_test.go @@ -20,7 +20,7 @@ func TestAccAWSOpsworksPermission(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksPermissionDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAwsOpsworksPermissionCreate(sName, "true", "true", "iam_only"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksPermissionExists( @@ -37,7 +37,7 @@ func TestAccAWSOpsworksPermission(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksPermissionCreate(sName, "true", "false", "iam_only"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksPermissionExists( @@ -54,7 +54,7 @@ func TestAccAWSOpsworksPermission(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksPermissionCreate(sName, "false", "false", "deny"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksPermissionExists( @@ -71,7 +71,7 @@ func TestAccAWSOpsworksPermission(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksPermissionCreate(sName, "false", "false", "show"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksPermissionExists( diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer.go index 54a0084ddb..55f869c6dd 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer.go @@ -10,32 +10,32 @@ func resourceAwsOpsworksRailsAppLayer() *schema.Resource { DefaultLayerName: "Rails App Server", Attributes: map[string]*opsworksLayerTypeAttribute{ - "ruby_version": &opsworksLayerTypeAttribute{ + "ruby_version": { AttrName: "RubyVersion", Type: schema.TypeString, Default: "2.0.0", }, - "app_server": &opsworksLayerTypeAttribute{ + "app_server": { AttrName: "RailsStack", Type: schema.TypeString, Default: "apache_passenger", }, - "passenger_version": &opsworksLayerTypeAttribute{ + "passenger_version": { AttrName: "PassengerVersion", Type: schema.TypeString, Default: "4.0.46", }, - "rubygems_version": &opsworksLayerTypeAttribute{ + "rubygems_version": { AttrName: "RubygemsVersion", Type: schema.TypeString, Default: "2.2.2", }, - "manage_bundler": &opsworksLayerTypeAttribute{ + "manage_bundler": { AttrName: "ManageBundler", Type: schema.TypeBool, Default: true, }, - "bundler_version": &opsworksLayerTypeAttribute{ + "bundler_version": { AttrName: "BundlerVersion", Type: schema.TypeString, Default: "1.5.3", diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer_test.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer_test.go index 05b7165315..710d88312a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rails_app_layer_test.go @@ -22,7 +22,7 @@ func TestAccAWSOpsworksRailsAppLayer(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksRailsAppLayerDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAwsOpsworksRailsAppLayerConfigVpcCreate(stackName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( @@ -33,7 +33,7 @@ func TestAccAWSOpsworksRailsAppLayer(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksRailsAppLayerNoManageBundlerConfigVpcCreate(stackName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance.go index 91bfcce303..d1aee90301 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance.go @@ -20,26 +20,26 @@ func resourceAwsOpsworksRdsDbInstance() *schema.Resource { Read: resourceAwsOpsworksRdsDbInstanceRead, Schema: map[string]*schema.Schema{ - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, }, - "stack_id": &schema.Schema{ + "stack_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "rds_db_instance_arn": &schema.Schema{ + "rds_db_instance_arn": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "db_password": &schema.Schema{ + "db_password": { Type: schema.TypeString, Required: true, Sensitive: true, }, - "db_user": &schema.Schema{ + "db_user": { Type: schema.TypeString, Required: true, }, diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance_test.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance_test.go index 8845ce2c1b..84c0d86b26 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_rds_db_instance_test.go @@ -20,7 +20,7 @@ func TestAccAWSOpsworksRdsDbInstance(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksRdsDbDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAwsOpsworksRdsDbInstance(sName, "foo", "barbarbarbar"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksRdsDbExists( @@ -31,7 +31,7 @@ func TestAccAWSOpsworksRdsDbInstance(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksRdsDbInstance(sName, "bar", "barbarbarbar"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksRdsDbExists( @@ -42,7 +42,7 @@ func TestAccAWSOpsworksRdsDbInstance(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksRdsDbInstance(sName, "bar", "foofoofoofoofoo"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksRdsDbExists( @@ -53,7 +53,7 @@ func TestAccAWSOpsworksRdsDbInstance(t *testing.T) { ), ), }, - resource.TestStep{ + { Config: testAccAwsOpsworksRdsDbInstanceForceNew(sName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksRdsDbExists( @@ -183,6 +183,8 @@ resource "aws_db_instance" "foo" { password = "foofoofoofoo" username = "foo" parameter_group_name = "default.mysql5.6" + + skip_final_snapshot = true } `, testAccAwsOpsworksStackConfigVpcCreate(name)) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack.go index c88b910ba2..496670506e 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack.go @@ -3,14 +3,17 @@ package aws import ( "fmt" "log" + "os" "strings" "time" + "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "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/opsworks" ) @@ -25,99 +28,101 @@ func resourceAwsOpsworksStack() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "agent_version": &schema.Schema{ + "agent_version": { Type: schema.TypeString, Optional: true, Computed: true, }, - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, ForceNew: true, Required: true, }, - "service_role_arn": &schema.Schema{ + "service_role_arn": { Type: schema.TypeString, Required: true, + ForceNew: true, }, - "default_instance_profile_arn": &schema.Schema{ + "default_instance_profile_arn": { Type: schema.TypeString, Required: true, }, - "color": &schema.Schema{ + "color": { Type: schema.TypeString, Optional: true, }, - "configuration_manager_name": &schema.Schema{ + "configuration_manager_name": { Type: schema.TypeString, Optional: true, Default: "Chef", }, - "configuration_manager_version": &schema.Schema{ + "configuration_manager_version": { Type: schema.TypeString, Optional: true, - Default: "11.4", + Default: "11.10", }, - "manage_berkshelf": &schema.Schema{ + "manage_berkshelf": { Type: schema.TypeBool, Optional: true, Default: false, }, - "berkshelf_version": &schema.Schema{ + "berkshelf_version": { Type: schema.TypeString, Optional: true, Default: "3.2.0", }, - "custom_cookbooks_source": &schema.Schema{ + "custom_cookbooks_source": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, }, - "url": &schema.Schema{ + "url": { Type: schema.TypeString, Required: true, }, - "username": &schema.Schema{ + "username": { Type: schema.TypeString, Optional: true, }, - "password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, }, - "revision": &schema.Schema{ + "revision": { Type: schema.TypeString, Optional: true, }, - "ssh_key": &schema.Schema{ + "ssh_key": { Type: schema.TypeString, Optional: true, }, @@ -125,62 +130,69 @@ func resourceAwsOpsworksStack() *schema.Resource { }, }, - "custom_json": &schema.Schema{ + "custom_json": { Type: schema.TypeString, Optional: true, }, - "default_availability_zone": &schema.Schema{ + "default_availability_zone": { Type: schema.TypeString, Optional: true, Computed: true, }, - "default_os": &schema.Schema{ + "default_os": { Type: schema.TypeString, Optional: true, Default: "Ubuntu 12.04 LTS", }, - "default_root_device_type": &schema.Schema{ + "default_root_device_type": { Type: schema.TypeString, Optional: true, Default: "instance-store", }, - "default_ssh_key_name": &schema.Schema{ + "default_ssh_key_name": { Type: schema.TypeString, Optional: true, }, - "default_subnet_id": &schema.Schema{ + "default_subnet_id": { Type: schema.TypeString, Optional: true, + Computed: true, }, - "hostname_theme": &schema.Schema{ + "hostname_theme": { Type: schema.TypeString, Optional: true, Default: "Layer_Dependent", }, - "use_custom_cookbooks": &schema.Schema{ + "use_custom_cookbooks": { Type: schema.TypeBool, Optional: true, Default: false, }, - "use_opsworks_security_groups": &schema.Schema{ + "use_opsworks_security_groups": { Type: schema.TypeBool, Optional: true, Default: true, }, - "vpc_id": &schema.Schema{ + "vpc_id": { Type: schema.TypeString, ForceNew: true, + Computed: true, Optional: true, }, + + "stack_endpoint": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -252,6 +264,13 @@ func resourceAwsOpsworksSetStackCustomCookbooksSource(d *schema.ResourceData, v func resourceAwsOpsworksStackRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).opsworksconn + var conErr error + if v := d.Get("stack_endpoint").(string); v != "" { + client, conErr = opsworksConnForRegion(v, meta) + if conErr != nil { + return conErr + } + } req := &opsworks.DescribeStacksInput{ StackIds: []*string{ @@ -261,16 +280,53 @@ func resourceAwsOpsworksStackRead(d *schema.ResourceData, meta interface{}) erro log.Printf("[DEBUG] Reading OpsWorks stack: %s", d.Id()) - resp, err := client.DescribeStacks(req) - if err != nil { - if awserr, ok := err.(awserr.Error); ok { - if awserr.Code() == "ResourceNotFoundException" { - log.Printf("[DEBUG] OpsWorks stack (%s) not found", d.Id()) - d.SetId("") - return nil + // notFound represents the number of times we've called DescribeStacks looking + // for this Stack. If it's not found in the the default region we're in, we + // check us-east-1 in the event this stack was created with Terraform before + // version 0.9 + // See https://github.com/hashicorp/terraform/issues/12842 + var notFound int + var resp *opsworks.DescribeStacksOutput + var dErr error + + for { + resp, dErr = client.DescribeStacks(req) + if dErr != nil { + if awserr, ok := dErr.(awserr.Error); ok { + if awserr.Code() == "ResourceNotFoundException" { + if notFound < 1 { + // If we haven't already, try us-east-1, legacy connection + notFound++ + var connErr error + client, connErr = opsworksConnForRegion("us-east-1", meta) + if connErr != nil { + return connErr + } + // start again from the top of the FOR loop, but with a client + // configured to talk to us-east-1 + continue + } + + // We've tried both the original and us-east-1 endpoint, and the stack + // is still not found + log.Printf("[DEBUG] OpsWorks stack (%s) not found", d.Id()) + d.SetId("") + return nil + } + // not ResoureNotFoundException, fall through to returning error } + return dErr } - return err + // If the stack was found, set the stack_endpoint + if client.Config.Region != nil && *client.Config.Region != "" { + log.Printf("[DEBUG] Setting stack_endpoint for (%s) to (%s)", d.Id(), *client.Config.Region) + if err := d.Set("stack_endpoint", *client.Config.Region); err != nil { + log.Printf("[WARN] Error setting stack_endpoint: %s", err) + } + } + log.Printf("[DEBUG] Breaking stack endpoint search, found stack for (%s)", d.Id()) + // Break the FOR loop + break } stack := resp.Stacks[0] @@ -307,6 +363,40 @@ func resourceAwsOpsworksStackRead(d *schema.ResourceData, meta interface{}) erro return nil } +// opsworksConn will return a connection for the stack_endpoint in the +// configuration. Stacks can only be accessed or managed within the endpoint +// in which they are created, so we allow users to specify an original endpoint +// for Stacks created before multiple endpoints were offered (Terraform v0.9.0). +// See: +// - https://github.com/hashicorp/terraform/pull/12688 +// - https://github.com/hashicorp/terraform/issues/12842 +func opsworksConnForRegion(region string, meta interface{}) (*opsworks.OpsWorks, error) { + originalConn := meta.(*AWSClient).opsworksconn + + // Regions are the same, no need to reconfigure + if originalConn.Config.Region != nil && *originalConn.Config.Region == region { + return originalConn, nil + } + + // Set up base session + sess, err := session.NewSession(&originalConn.Config) + if err != nil { + return nil, errwrap.Wrapf("Error creating AWS session: {{err}}", err) + } + + sess.Handlers.Build.PushBackNamed(addTerraformVersionToUserAgent) + + if extraDebug := os.Getenv("TERRAFORM_AWS_AUTHFAILURE_DEBUG"); extraDebug != "" { + sess.Handlers.UnmarshalError.PushFrontNamed(debugAuthFailure) + } + + newSession := sess.Copy(&aws.Config{Region: aws.String(region)}) + newOpsworksconn := opsworks.New(newSession) + + log.Printf("[DEBUG] Returning new OpsWorks client") + return newOpsworksconn, nil +} + func resourceAwsOpsworksStackCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).opsworksconn @@ -394,6 +484,13 @@ func resourceAwsOpsworksStackCreate(d *schema.ResourceData, meta interface{}) er func resourceAwsOpsworksStackUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).opsworksconn + var conErr error + if v := d.Get("stack_endpoint").(string); v != "" { + client, conErr = opsworksConnForRegion(v, meta) + if conErr != nil { + return conErr + } + } err := resourceAwsOpsworksStackValidate(d) if err != nil { @@ -431,10 +528,12 @@ func resourceAwsOpsworksStackUpdate(d *schema.ResourceData, meta interface{}) er if v, ok := d.GetOk("color"); ok { req.Attributes["Color"] = aws.String(v.(string)) } + req.ChefConfiguration = &opsworks.ChefConfiguration{ BerkshelfVersion: aws.String(d.Get("berkshelf_version").(string)), ManageBerkshelf: aws.Bool(d.Get("manage_berkshelf").(bool)), } + req.ConfigurationManager = &opsworks.StackConfigurationManager{ Name: aws.String(d.Get("configuration_manager_name").(string)), Version: aws.String(d.Get("configuration_manager_version").(string)), @@ -452,6 +551,13 @@ func resourceAwsOpsworksStackUpdate(d *schema.ResourceData, meta interface{}) er func resourceAwsOpsworksStackDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).opsworksconn + var conErr error + if v := d.Get("stack_endpoint").(string); v != "" { + client, conErr = opsworksConnForRegion(v, meta) + if conErr != nil { + return conErr + } + } req := &opsworks.DeleteStackInput{ StackId: aws.String(d.Id()), diff --git a/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack_test.go b/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack_test.go index 4c3b4b37a8..76c98a5fd5 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_opsworks_stack_test.go @@ -25,7 +25,7 @@ func TestAccAWSOpsworksStackNoVpc(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAwsOpsworksStackConfigNoVpcCreate(stackName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksStackExists( @@ -36,10 +36,33 @@ func TestAccAWSOpsworksStackNoVpc(t *testing.T) { "us-east-1a", stackName), ), }, - // resource.TestStep{ - // Config: testAccAWSOpsworksStackConfigNoVpcUpdate(stackName), - // Check: testAccAwsOpsworksStackCheckResourceAttrsUpdate("us-east-1c", stackName), - // }, + }, + }) +} + +func TestAccAWSOpsworksStackNoVpcChangeServiceRoleForceNew(t *testing.T) { + stackName := fmt.Sprintf("tf-opsworks-acc-%d", acctest.RandInt()) + var before, after opsworks.Stack + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsOpsworksStackDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsOpsworksStackConfigNoVpcCreate(stackName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSOpsworksStackExists( + "aws_opsworks_stack.tf-acc", false, &before), + ), + }, + { + Config: testAccAwsOpsworksStackConfigNoVpcCreateUpdateServiceRole(stackName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSOpsworksStackExists( + "aws_opsworks_stack.tf-acc", false, &after), + testAccCheckAWSOpsworksStackRecreated(t, &before, &after), + ), + }, }, }) } @@ -52,7 +75,7 @@ func TestAccAWSOpsworksStackVpc(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAwsOpsworksStackConfigVpcCreate(stackName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksStackExists( @@ -63,7 +86,7 @@ func TestAccAWSOpsworksStackVpc(t *testing.T) { "us-west-2a", stackName), ), }, - resource.TestStep{ + { Config: testAccAWSOpsworksStackConfigVpcUpdate(stackName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSOpsworksStackExists( @@ -78,6 +101,215 @@ func TestAccAWSOpsworksStackVpc(t *testing.T) { }) } +// Tests the addition of regional endpoints and supporting the classic link used +// to create Stack's prior to v0.9.0. +// See https://github.com/hashicorp/terraform/issues/12842 +func TestAccAWSOpsWorksStack_classic_endpoints(t *testing.T) { + stackName := fmt.Sprintf("tf-opsworks-acc-%d", acctest.RandInt()) + rInt := acctest.RandInt() + var opsstack opsworks.Stack + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsOpsworksStackDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsOpsWorksStack_classic_endpoint(stackName, rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSOpsworksStackExists( + "aws_opsworks_stack.main", false, &opsstack), + ), + }, + // Ensure that changing to us-west-2 region results in no plan + { + Config: testAccAwsOpsWorksStack_regional_endpoint(stackName, rInt), + PlanOnly: true, + }, + }, + }) + +} + +func testAccCheckAWSOpsworksStackRecreated(t *testing.T, + before, after *opsworks.Stack) resource.TestCheckFunc { + return func(s *terraform.State) error { + if *before.StackId == *after.StackId { + t.Fatalf("Expected change of Opsworks StackIds, but both were %v", before.StackId) + } + return nil + } +} + +func testAccAwsOpsWorksStack_classic_endpoint(rName string, rInt int) string { + return fmt.Sprintf(` +provider "aws" { + region = "us-east-1" +} + +resource "aws_opsworks_stack" "main" { + name = "%s" + region = "us-west-2" + service_role_arn = "${aws_iam_role.opsworks_service.arn}" + default_instance_profile_arn = "${aws_iam_instance_profile.opsworks_instance.arn}" + + configuration_manager_version = "12" + default_availability_zone = "us-west-2b" +} + +resource "aws_iam_role" "opsworks_service" { + name = "tf_opsworks_service_%d" + + assume_role_policy = < 0 { + createOpts.VpcSecurityGroupIds = expandStringList(attr.List()) + } + + if attr := d.Get("availability_zones").(*schema.Set); attr.Len() > 0 { + createOpts.AvailabilityZones = expandStringList(attr.List()) + } + + if v, ok := d.GetOk("backup_retention_period"); ok { + createOpts.BackupRetentionPeriod = aws.Int64(int64(v.(int))) + } + + if v, ok := d.GetOk("preferred_backup_window"); ok { + createOpts.PreferredBackupWindow = aws.String(v.(string)) + } + + if v, ok := d.GetOk("preferred_maintenance_window"); ok { + createOpts.PreferredMaintenanceWindow = aws.String(v.(string)) + } + + if attr, ok := d.GetOk("kms_key_id"); ok { + createOpts.KmsKeyId = aws.String(attr.(string)) + } + + log.Printf("[DEBUG] Create RDS Cluster as read replica: %s", createOpts) + resp, err := conn.CreateDBCluster(createOpts) + if err != nil { + log.Printf("[ERROR] Error creating RDS Cluster: %s", err) + return err + } + + log.Printf("[DEBUG]: RDS Cluster create response: %s", resp) + } else { if _, ok := d.GetOk("master_password"); !ok { return fmt.Errorf(`provider.aws: aws_rds_cluster: %s: "master_password": required field is not set`, d.Get("database_name").(string)) @@ -368,7 +449,7 @@ func resourceAwsRDSClusterCreate(d *schema.ResourceData, meta interface{}) error Pending: []string{"creating", "backing-up", "modifying"}, Target: []string{"available"}, Refresh: resourceAwsRDSClusterStateRefreshFunc(d, meta), - Timeout: 40 * time.Minute, + Timeout: 120 * time.Minute, MinTimeout: 3 * time.Second, } @@ -438,6 +519,7 @@ func resourceAwsRDSClusterRead(d *schema.ResourceData, meta interface{}) error { d.Set("preferred_maintenance_window", dbc.PreferredMaintenanceWindow) d.Set("kms_key_id", dbc.KmsKeyId) d.Set("reader_endpoint", dbc.ReaderEndpoint) + d.Set("replication_source_identifier", dbc.ReplicationSourceIdentifier) var vpcg []string for _, g := range dbc.VpcSecurityGroups { diff --git a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance.go b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance.go index 6dedec175a..2caca45732 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance.go +++ b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "strings" "time" "github.com/aws/aws-sdk-go/aws" @@ -23,10 +24,19 @@ func resourceAwsRDSClusterInstance() *schema.Resource { Schema: map[string]*schema.Schema{ "identifier": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"identifier_prefix"}, + ValidateFunc: validateRdsIdentifier, + }, + "identifier_prefix": { Type: schema.TypeString, Optional: true, + Computed: true, ForceNew: true, - ValidateFunc: validateRdsId, + ValidateFunc: validateRdsIdentifierPrefix, }, "db_subnet_group_name": { @@ -105,6 +115,27 @@ func resourceAwsRDSClusterInstance() *schema.Resource { Computed: true, }, + "preferred_maintenance_window": { + Type: schema.TypeString, + Optional: true, + Computed: true, + StateFunc: func(v interface{}) string { + if v != nil { + value := v.(string) + return strings.ToLower(value) + } + return "" + }, + ValidateFunc: validateOnceAWeekWindowFormat, + }, + + "preferred_backup_window": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validateOnceADayWindowFormat, + }, + "monitoring_interval": { Type: schema.TypeInt, Optional: true, @@ -140,10 +171,14 @@ func resourceAwsRDSClusterInstanceCreate(d *schema.ResourceData, meta interface{ createOpts.DBParameterGroupName = aws.String(attr.(string)) } - if v := d.Get("identifier").(string); v != "" { - createOpts.DBInstanceIdentifier = aws.String(v) + if v, ok := d.GetOk("identifier"); ok { + createOpts.DBInstanceIdentifier = aws.String(v.(string)) } else { - createOpts.DBInstanceIdentifier = aws.String(resource.UniqueId()) + if v, ok := d.GetOk("identifier_prefix"); ok { + createOpts.DBInstanceIdentifier = aws.String(resource.PrefixedUniqueId(v.(string))) + } else { + createOpts.DBInstanceIdentifier = aws.String(resource.PrefixedUniqueId("tf-")) + } } if attr, ok := d.GetOk("db_subnet_group_name"); ok { @@ -154,6 +189,14 @@ func resourceAwsRDSClusterInstanceCreate(d *schema.ResourceData, meta interface{ createOpts.MonitoringRoleArn = aws.String(attr.(string)) } + if attr, ok := d.GetOk("preferred_backup_window"); ok { + createOpts.PreferredBackupWindow = aws.String(attr.(string)) + } + + if attr, ok := d.GetOk("preferred_maintenance_window"); ok { + createOpts.PreferredMaintenanceWindow = aws.String(attr.(string)) + } + if attr, ok := d.GetOk("monitoring_interval"); ok { createOpts.MonitoringInterval = aws.Int64(int64(attr.(int))) } @@ -239,6 +282,8 @@ func resourceAwsRDSClusterInstanceRead(d *schema.ResourceData, meta interface{}) d.Set("kms_key_id", db.KmsKeyId) d.Set("auto_minor_version_upgrade", db.AutoMinorVersionUpgrade) d.Set("promotion_tier", db.PromotionTier) + d.Set("preferred_backup_window", db.PreferredBackupWindow) + d.Set("preferred_maintenance_window", db.PreferredMaintenanceWindow) if db.MonitoringInterval != nil { d.Set("monitoring_interval", db.MonitoringInterval) @@ -290,6 +335,18 @@ func resourceAwsRDSClusterInstanceUpdate(d *schema.ResourceData, meta interface{ requestUpdate = true } + if d.HasChange("preferred_backup_window") { + d.SetPartial("preferred_backup_window") + req.PreferredBackupWindow = aws.String(d.Get("preferred_backup_window").(string)) + requestUpdate = true + } + + if d.HasChange("preferred_maintenance_window") { + d.SetPartial("preferred_maintenance_window") + req.PreferredMaintenanceWindow = aws.String(d.Get("preferred_maintenance_window").(string)) + requestUpdate = true + } + if d.HasChange("monitoring_interval") { d.SetPartial("monitoring_interval") req.MonitoringInterval = aws.Int64(int64(d.Get("monitoring_interval").(int))) diff --git a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance_test.go b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance_test.go index dc70088929..df1a5d644a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_instance_test.go @@ -30,6 +30,8 @@ func TestAccAWSRDSClusterInstance_basic(t *testing.T) { testAccCheckAWSClusterInstanceExists("aws_rds_cluster_instance.cluster_instances", &v), testAccCheckAWSDBClusterInstanceAttributes(&v), resource.TestCheckResourceAttr("aws_rds_cluster_instance.cluster_instances", "auto_minor_version_upgrade", "true"), + resource.TestCheckResourceAttrSet("aws_rds_cluster_instance.cluster_instances", "preferred_maintenance_window"), + resource.TestCheckResourceAttrSet("aws_rds_cluster_instance.cluster_instances", "preferred_backup_window"), ), }, { @@ -44,6 +46,48 @@ func TestAccAWSRDSClusterInstance_basic(t *testing.T) { }) } +func TestAccAWSRDSClusterInstance_namePrefix(t *testing.T) { + var v rds.DBInstance + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSClusterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSClusterInstanceConfig_namePrefix(acctest.RandInt()), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSClusterInstanceExists("aws_rds_cluster_instance.test", &v), + testAccCheckAWSDBClusterInstanceAttributes(&v), + resource.TestMatchResourceAttr( + "aws_rds_cluster_instance.test", "identifier", regexp.MustCompile("^tf-cluster-instance-")), + ), + }, + }, + }) +} + +func TestAccAWSRDSClusterInstance_generatedName(t *testing.T) { + var v rds.DBInstance + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSClusterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSClusterInstanceConfig_generatedName(acctest.RandInt()), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSClusterInstanceExists("aws_rds_cluster_instance.test", &v), + testAccCheckAWSDBClusterInstanceAttributes(&v), + resource.TestMatchResourceAttr( + "aws_rds_cluster_instance.test", "identifier", regexp.MustCompile("^tf-")), + ), + }, + }, + }) +} + func TestAccAWSRDSClusterInstance_kmsKey(t *testing.T) { var v rds.DBInstance keyRegex := regexp.MustCompile("^arn:aws:kms:") @@ -87,41 +131,6 @@ func TestAccAWSRDSClusterInstance_disappears(t *testing.T) { }) } -func testAccCheckAWSClusterInstanceDestroy(s *terraform.State) error { - for _, rs := range s.RootModule().Resources { - if rs.Type != "aws_rds_cluster" { - continue - } - - // Try to find the Group - conn := testAccProvider.Meta().(*AWSClient).rdsconn - var err error - resp, err := conn.DescribeDBInstances( - &rds.DescribeDBInstancesInput{ - DBInstanceIdentifier: aws.String(rs.Primary.ID), - }) - - if err == nil { - if len(resp.DBInstances) != 0 && - *resp.DBInstances[0].DBInstanceIdentifier == rs.Primary.ID { - return fmt.Errorf("DB Cluster Instance %s still exists", rs.Primary.ID) - } - } - - // Return nil if the Cluster Instance is already destroyed - if awsErr, ok := err.(awserr.Error); ok { - if awsErr.Code() == "DBInstanceNotFound" { - return nil - } - } - - return err - - } - - return nil -} - func testAccCheckAWSDBClusterInstanceAttributes(v *rds.DBInstance) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -224,6 +233,7 @@ resource "aws_rds_cluster" "default" { database_name = "mydb" master_username = "foo" master_password = "mustbeeightcharaters" + skip_final_snapshot = true } resource "aws_rds_cluster_instance" "cluster_instances" { @@ -259,6 +269,7 @@ resource "aws_rds_cluster" "default" { database_name = "mydb" master_username = "foo" master_password = "mustbeeightcharaters" + skip_final_snapshot = true } resource "aws_rds_cluster_instance" "cluster_instances" { @@ -287,6 +298,83 @@ resource "aws_db_parameter_group" "bar" { `, n, n, n) } +func testAccAWSClusterInstanceConfig_namePrefix(n int) string { + return fmt.Sprintf(` +resource "aws_rds_cluster_instance" "test" { + identifier_prefix = "tf-cluster-instance-" + cluster_identifier = "${aws_rds_cluster.test.id}" + instance_class = "db.r3.large" +} + +resource "aws_rds_cluster" "test" { + cluster_identifier = "tf-aurora-cluster-%d" + master_username = "root" + master_password = "password" + db_subnet_group_name = "${aws_db_subnet_group.test.name}" + skip_final_snapshot = true +} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" +} + +resource "aws_subnet" "a" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.0.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_subnet" "b" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.1.0/24" + availability_zone = "us-west-2b" +} + +resource "aws_db_subnet_group" "test" { + name = "tf-test-%d" + subnet_ids = ["${aws_subnet.a.id}", "${aws_subnet.b.id}"] +} +`, n, n) +} + +func testAccAWSClusterInstanceConfig_generatedName(n int) string { + return fmt.Sprintf(` +resource "aws_rds_cluster_instance" "test" { + cluster_identifier = "${aws_rds_cluster.test.id}" + instance_class = "db.r3.large" +} + +resource "aws_rds_cluster" "test" { + cluster_identifier = "tf-aurora-cluster-%d" + master_username = "root" + master_password = "password" + db_subnet_group_name = "${aws_db_subnet_group.test.name}" + skip_final_snapshot = true +} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" +} + +resource "aws_subnet" "a" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.0.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_subnet" "b" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.1.0/24" + availability_zone = "us-west-2b" +} + +resource "aws_db_subnet_group" "test" { + name = "tf-test-%d" + subnet_ids = ["${aws_subnet.a.id}", "${aws_subnet.b.id}"] +} +`, n, n) +} + func testAccAWSClusterInstanceConfigKmsKey(n int) string { return fmt.Sprintf(` @@ -319,6 +407,7 @@ resource "aws_rds_cluster" "default" { master_password = "mustbeeightcharaters" storage_encrypted = true kms_key_id = "${aws_kms_key.foo.arn}" + skip_final_snapshot = true } resource "aws_rds_cluster_instance" "cluster_instances" { @@ -353,6 +442,7 @@ resource "aws_rds_cluster" "default" { database_name = "mydb" master_username = "foo" master_password = "mustbeeightcharaters" + skip_final_snapshot = true } resource "aws_rds_cluster_instance" "cluster_instances" { diff --git a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group.go b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group.go index 62b0d497bf..61cb20f01d 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group.go +++ b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group.go @@ -29,10 +29,19 @@ func resourceAwsRDSClusterParameterGroup() *schema.Resource { Computed: true, }, "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"name_prefix"}, + ValidateFunc: validateDbParamGroupName, + }, + "name_prefix": &schema.Schema{ Type: schema.TypeString, + Optional: true, + Computed: true, ForceNew: true, - Required: true, - ValidateFunc: validateDbParamGroupName, + ValidateFunc: validateDbParamGroupNamePrefix, }, "family": &schema.Schema{ Type: schema.TypeString, @@ -86,8 +95,17 @@ func resourceAwsRDSClusterParameterGroupCreate(d *schema.ResourceData, meta inte rdsconn := meta.(*AWSClient).rdsconn tags := tagsFromMapRDS(d.Get("tags").(map[string]interface{})) + var groupName string + if v, ok := d.GetOk("name"); ok { + groupName = v.(string) + } else if v, ok := d.GetOk("name_prefix"); ok { + groupName = resource.PrefixedUniqueId(v.(string)) + } else { + groupName = resource.UniqueId() + } + createOpts := rds.CreateDBClusterParameterGroupInput{ - DBClusterParameterGroupName: aws.String(d.Get("name").(string)), + DBClusterParameterGroupName: aws.String(groupName), DBParameterGroupFamily: aws.String(d.Get("family").(string)), Description: aws.String(d.Get("description").(string)), Tags: tags, diff --git a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group_test.go index d6bb77d8f1..231fdf44c2 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_parameter_group_test.go @@ -3,6 +3,7 @@ package aws import ( "errors" "fmt" + "regexp" "testing" "time" @@ -28,7 +29,7 @@ func TestAccAWSDBClusterParameterGroup_basic(t *testing.T) { Config: testAccAWSDBClusterParameterGroupConfig(parameterGroupName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.bar", &v), - testAccCheckAWSDBClusterParameterGroupAttributes(&v), + testAccCheckAWSDBClusterParameterGroupAttributes(&v, parameterGroupName), resource.TestCheckResourceAttr( "aws_rds_cluster_parameter_group.bar", "name", parameterGroupName), resource.TestCheckResourceAttr( @@ -55,7 +56,7 @@ func TestAccAWSDBClusterParameterGroup_basic(t *testing.T) { Config: testAccAWSDBClusterParameterGroupAddParametersConfig(parameterGroupName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.bar", &v), - testAccCheckAWSDBClusterParameterGroupAttributes(&v), + testAccCheckAWSDBClusterParameterGroupAttributes(&v, parameterGroupName), resource.TestCheckResourceAttr( "aws_rds_cluster_parameter_group.bar", "name", parameterGroupName), resource.TestCheckResourceAttr( @@ -90,6 +91,44 @@ func TestAccAWSDBClusterParameterGroup_basic(t *testing.T) { }) } +func TestAccAWSDBClusterParameterGroup_namePrefix(t *testing.T) { + var v rds.DBClusterParameterGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBClusterParameterGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDBClusterParameterGroupConfig_namePrefix, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.test", &v), + resource.TestMatchResourceAttr( + "aws_rds_cluster_parameter_group.test", "name", regexp.MustCompile("^tf-test-")), + ), + }, + }, + }) +} + +func TestAccAWSDBClusterParameterGroup_generatedName(t *testing.T) { + var v rds.DBClusterParameterGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBClusterParameterGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDBClusterParameterGroupConfig_generatedName, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.test", &v), + ), + }, + }, + }) +} + func TestAccAWSDBClusterParameterGroup_disappears(t *testing.T) { var v rds.DBClusterParameterGroup @@ -126,7 +165,7 @@ func TestAccAWSDBClusterParameterGroupOnly(t *testing.T) { Config: testAccAWSDBClusterParameterGroupOnlyConfig(parameterGroupName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.bar", &v), - testAccCheckAWSDBClusterParameterGroupAttributes(&v), + testAccCheckAWSDBClusterParameterGroupAttributes(&v, parameterGroupName), resource.TestCheckResourceAttr( "aws_rds_cluster_parameter_group.bar", "name", parameterGroupName), resource.TestCheckResourceAttr( @@ -213,15 +252,15 @@ func testAccCheckAWSDBClusterParameterGroupDestroy(s *terraform.State) error { return nil } -func testAccCheckAWSDBClusterParameterGroupAttributes(v *rds.DBClusterParameterGroup) resource.TestCheckFunc { +func testAccCheckAWSDBClusterParameterGroupAttributes(v *rds.DBClusterParameterGroup, name string) resource.TestCheckFunc { return func(s *terraform.State) error { - if *v.DBClusterParameterGroupName != "cluster-parameter-group-test-terraform" { - return fmt.Errorf("bad name: %#v", v.DBClusterParameterGroupName) + if *v.DBClusterParameterGroupName != name { + return fmt.Errorf("bad name: %#v expected: %v", *v.DBClusterParameterGroupName, name) } if *v.DBParameterGroupFamily != "aurora5.6" { - return fmt.Errorf("bad family: %#v", v.DBParameterGroupFamily) + return fmt.Errorf("bad family: %#v", *v.DBParameterGroupFamily) } return nil @@ -365,3 +404,15 @@ func testAccAWSDBClusterParameterGroupOnlyConfig(name string) string { family = "aurora5.6" }`, name) } + +const testAccAWSDBClusterParameterGroupConfig_namePrefix = ` +resource "aws_rds_cluster_parameter_group" "test" { + name_prefix = "tf-test-" + family = "aurora5.6" +} +` +const testAccAWSDBClusterParameterGroupConfig_generatedName = ` +resource "aws_rds_cluster_parameter_group" "test" { + family = "aurora5.6" +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_test.go b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_test.go index f9b5cb837e..6acb72757f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_rds_cluster_test.go @@ -2,7 +2,9 @@ package aws import ( "fmt" + "log" "regexp" + "strings" "testing" "github.com/hashicorp/terraform/helper/acctest" @@ -38,6 +40,65 @@ func TestAccAWSRDSCluster_basic(t *testing.T) { }) } +func TestAccAWSRDSCluster_namePrefix(t *testing.T) { + var v rds.DBCluster + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSClusterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSClusterConfig_namePrefix(acctest.RandInt()), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSClusterExists("aws_rds_cluster.test", &v), + resource.TestMatchResourceAttr( + "aws_rds_cluster.test", "cluster_identifier", regexp.MustCompile("^tf-test-")), + ), + }, + }, + }) +} + +func TestAccAWSRDSCluster_generatedName(t *testing.T) { + var v rds.DBCluster + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSClusterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSClusterConfig_generatedName(acctest.RandInt()), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSClusterExists("aws_rds_cluster.test", &v), + resource.TestMatchResourceAttr( + "aws_rds_cluster.test", "cluster_identifier", regexp.MustCompile("^tf-")), + ), + }, + }, + }) +} + +func TestAccAWSRDSCluster_takeFinalSnapshot(t *testing.T) { + var v rds.DBCluster + rInt := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSClusterSnapshot(rInt), + Steps: []resource.TestStep{ + { + Config: testAccAWSClusterConfigWithFinalSnapshot(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSClusterExists("aws_rds_cluster.default", &v), + ), + }, + }, + }) +} + /// This is a regression test to make sure that we always cover the scenario as hightlighted in /// https://github.com/hashicorp/terraform/issues/11568 func TestAccAWSRDSCluster_missingUserNameCausesError(t *testing.T) { @@ -198,6 +259,62 @@ func testAccCheckAWSClusterDestroy(s *terraform.State) error { return nil } +func testAccCheckAWSClusterSnapshot(rInt int) resource.TestCheckFunc { + return func(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_rds_cluster" { + continue + } + + // Try and delete the snapshot before we check for the cluster not found + snapshot_identifier := fmt.Sprintf("tf-acctest-rdscluster-snapshot-%d", rInt) + + awsClient := testAccProvider.Meta().(*AWSClient) + conn := awsClient.rdsconn + + arn, arnErr := buildRDSClusterARN(snapshot_identifier, awsClient.partition, awsClient.accountid, awsClient.region) + tagsARN := strings.Replace(arn, ":cluster:", ":snapshot:", 1) + if arnErr != nil { + return fmt.Errorf("Error building ARN for tags check with ARN (%s): %s", tagsARN, arnErr) + } + + log.Printf("[INFO] Deleting the Snapshot %s", snapshot_identifier) + _, snapDeleteErr := conn.DeleteDBClusterSnapshot( + &rds.DeleteDBClusterSnapshotInput{ + DBClusterSnapshotIdentifier: aws.String(snapshot_identifier), + }) + if snapDeleteErr != nil { + return snapDeleteErr + } + + // Try to find the Group + var err error + resp, err := conn.DescribeDBClusters( + &rds.DescribeDBClustersInput{ + DBClusterIdentifier: aws.String(rs.Primary.ID), + }) + + if err == nil { + if len(resp.DBClusters) != 0 && + *resp.DBClusters[0].DBClusterIdentifier == rs.Primary.ID { + return fmt.Errorf("DB Cluster %s still exists", rs.Primary.ID) + } + } + + // Return nil if the cluster is already destroyed + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "DBClusterNotFoundFault" { + return nil + } + } + + return err + } + + return nil + } +} + func testAccCheckAWSClusterExists(n string, v *rds.DBCluster) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -238,18 +355,101 @@ resource "aws_rds_cluster" "default" { master_username = "foo" master_password = "mustbeeightcharaters" db_cluster_parameter_group_name = "default.aurora5.6" + skip_final_snapshot = true tags { Environment = "production" } }`, n) } +func testAccAWSClusterConfig_namePrefix(n int) string { + return fmt.Sprintf(` +resource "aws_rds_cluster" "test" { + cluster_identifier_prefix = "tf-test-" + master_username = "root" + master_password = "password" + db_subnet_group_name = "${aws_db_subnet_group.test.name}" + skip_final_snapshot = true +} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" +} + +resource "aws_subnet" "a" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.0.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_subnet" "b" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.1.0/24" + availability_zone = "us-west-2b" +} + +resource "aws_db_subnet_group" "test" { + name = "tf-test-%d" + subnet_ids = ["${aws_subnet.a.id}", "${aws_subnet.b.id}"] +} +`, n) +} + +func testAccAWSClusterConfig_generatedName(n int) string { + return fmt.Sprintf(` +resource "aws_rds_cluster" "test" { + master_username = "root" + master_password = "password" + db_subnet_group_name = "${aws_db_subnet_group.test.name}" + skip_final_snapshot = true +} + +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" +} + +resource "aws_subnet" "a" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.0.0/24" + availability_zone = "us-west-2a" +} + +resource "aws_subnet" "b" { + vpc_id = "${aws_vpc.test.id}" + cidr_block = "10.0.1.0/24" + availability_zone = "us-west-2b" +} + +resource "aws_db_subnet_group" "test" { + name = "tf-test-%d" + subnet_ids = ["${aws_subnet.a.id}", "${aws_subnet.b.id}"] +} +`, n) +} + +func testAccAWSClusterConfigWithFinalSnapshot(n int) string { + return fmt.Sprintf(` +resource "aws_rds_cluster" "default" { + cluster_identifier = "tf-aurora-cluster-%d" + availability_zones = ["us-west-2a","us-west-2b","us-west-2c"] + database_name = "mydb" + master_username = "foo" + master_password = "mustbeeightcharaters" + db_cluster_parameter_group_name = "default.aurora5.6" + final_snapshot_identifier = "tf-acctest-rdscluster-snapshot-%d" + tags { + Environment = "production" + } +}`, n, n) +} + func testAccAWSClusterConfigWithoutUserNameAndPassword(n int) string { return fmt.Sprintf(` resource "aws_rds_cluster" "default" { cluster_identifier = "tf-aurora-cluster-%d" availability_zones = ["us-west-2a","us-west-2b","us-west-2c"] database_name = "mydb" + skip_final_snapshot = true }`, n) } @@ -262,6 +462,7 @@ resource "aws_rds_cluster" "default" { master_username = "foo" master_password = "mustbeeightcharaters" db_cluster_parameter_group_name = "default.aurora5.6" + skip_final_snapshot = true tags { Environment = "production" AnotherTag = "test" @@ -302,6 +503,7 @@ func testAccAWSClusterConfig_kmsKey(n int) string { db_cluster_parameter_group_name = "default.aurora5.6" storage_encrypted = true kms_key_id = "${aws_kms_key.foo.arn}" + skip_final_snapshot = true }`, n, n) } @@ -314,6 +516,7 @@ resource "aws_rds_cluster" "default" { master_username = "foo" master_password = "mustbeeightcharaters" storage_encrypted = true + skip_final_snapshot = true }`, n) } @@ -328,6 +531,7 @@ resource "aws_rds_cluster" "default" { backup_retention_period = 5 preferred_backup_window = "07:00-09:00" preferred_maintenance_window = "tue:04:00-tue:04:30" + skip_final_snapshot = true }`, n) } @@ -343,5 +547,6 @@ resource "aws_rds_cluster" "default" { preferred_backup_window = "03:00-09:00" preferred_maintenance_window = "wed:01:00-wed:01:30" apply_immediately = true + skip_final_snapshot = true }`, n) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster.go b/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster.go index df8ebbe7d4..5119fb8bf3 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster.go +++ b/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster.go @@ -188,7 +188,7 @@ func resourceAwsRedshiftCluster() *schema.Resource { "skip_final_snapshot": { Type: schema.TypeBool, Optional: true, - Default: true, + Default: false, }, "endpoint": { diff --git a/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster_test.go b/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster_test.go index 7a53996920..577e3eb67c 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_redshift_cluster_test.go @@ -2,8 +2,10 @@ package aws import ( "fmt" + "log" "math/rand" "regexp" + "strings" "testing" "time" @@ -76,6 +78,26 @@ func TestAccAWSRedshiftCluster_basic(t *testing.T) { }) } +func TestAccAWSRedshiftCluster_withFinalSnapshot(t *testing.T) { + var v redshift.Cluster + + rInt := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRedshiftClusterSnapshot(rInt), + Steps: []resource.TestStep{ + { + Config: testAccAWSRedshiftClusterConfigWithFinalSnapshot(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRedshiftClusterExists("aws_redshift_cluster.default", &v), + ), + }, + }, + }) +} + func TestAccAWSRedshiftCluster_kmsKey(t *testing.T) { var v redshift.Cluster @@ -332,6 +354,62 @@ func testAccCheckAWSRedshiftClusterDestroy(s *terraform.State) error { return nil } +func testAccCheckAWSRedshiftClusterSnapshot(rInt int) resource.TestCheckFunc { + return func(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_redshift_cluster" { + continue + } + + var err error + + // Try and delete the snapshot before we check for the cluster not found + conn := testAccProvider.Meta().(*AWSClient).redshiftconn + + snapshot_identifier := fmt.Sprintf("tf-acctest-snapshot-%d", rInt) + arn, err := buildRedshiftARN(snapshot_identifier, testAccProvider.Meta().(*AWSClient).partition, testAccProvider.Meta().(*AWSClient).accountid, testAccProvider.Meta().(*AWSClient).region) + tagsARN := strings.Replace(arn, ":cluster:", ":snapshot:", 1) + if err != nil { + return fmt.Errorf("Error building ARN for tags check with ARN (%s): %s", tagsARN, err) + } + + log.Printf("[INFO] Deleting the Snapshot %s", snapshot_identifier) + _, snapDeleteErr := conn.DeleteClusterSnapshot( + &redshift.DeleteClusterSnapshotInput{ + SnapshotIdentifier: aws.String(snapshot_identifier), + }) + if snapDeleteErr != nil { + return err + } + + //lastly check that the Cluster is missing + resp, err := conn.DescribeClusters( + &redshift.DescribeClustersInput{ + ClusterIdentifier: aws.String(rs.Primary.ID), + }) + + if err == nil { + if len(resp.Clusters) != 0 && + *resp.Clusters[0].ClusterIdentifier == rs.Primary.ID { + return fmt.Errorf("Redshift Cluster %s still exists", rs.Primary.ID) + } + } + + // Return nil if the cluster is already destroyed + if awsErr, ok := err.(awserr.Error); ok { + if awsErr.Code() == "ClusterNotFound" { + return nil + } + + return err + } + + } + + return nil + } +} + func testAccCheckAWSRedshiftClusterExists(n string, v *redshift.Cluster) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -514,6 +592,7 @@ resource "aws_redshift_cluster" "default" { automated_snapshot_retention_period = 0 allow_version_upgrade = false number_of_nodes = 2 + skip_final_snapshot = true } ` @@ -527,8 +606,25 @@ resource "aws_redshift_cluster" "default" { node_type = "dc1.large" automated_snapshot_retention_period = 0 allow_version_upgrade = false + skip_final_snapshot = true }` +func testAccAWSRedshiftClusterConfigWithFinalSnapshot(rInt int) string { + return fmt.Sprintf(` +resource "aws_redshift_cluster" "default" { + cluster_identifier = "tf-redshift-cluster-%d" + availability_zone = "us-west-2a" + database_name = "mydb" + master_username = "foo_test" + master_password = "Mustbe8characters" + node_type = "dc1.large" + automated_snapshot_retention_period = 0 + allow_version_upgrade = false + skip_final_snapshot = false + final_snapshot_identifier = "tf-acctest-snapshot-%d" +}`, rInt, rInt) +} + var testAccAWSRedshiftClusterConfig_kmsKey = ` resource "aws_kms_key" "foo" { description = "Terraform acc test %d" @@ -562,6 +658,7 @@ resource "aws_redshift_cluster" "default" { allow_version_upgrade = false kms_key_id = "${aws_kms_key.foo.arn}" encrypted = true + skip_final_snapshot = true }` var testAccAWSRedshiftClusterConfig_enhancedVpcRoutingEnabled = ` @@ -575,6 +672,7 @@ resource "aws_redshift_cluster" "default" { automated_snapshot_retention_period = 0 allow_version_upgrade = false enhanced_vpc_routing = true + skip_final_snapshot = true } ` @@ -589,6 +687,7 @@ resource "aws_redshift_cluster" "default" { automated_snapshot_retention_period = 0 allow_version_upgrade = false enhanced_vpc_routing = false + skip_final_snapshot = true } ` @@ -604,6 +703,7 @@ func testAccAWSRedshiftClusterConfig_loggingDisabled(rInt int) string { automated_snapshot_retention_period = 0 allow_version_upgrade = false enable_logging = false + skip_final_snapshot = true }`, rInt) } @@ -639,6 +739,7 @@ func testAccAWSRedshiftClusterConfig_loggingEnabled(rInt int) string { EOF } + resource "aws_redshift_cluster" "default" { cluster_identifier = "tf-redshift-cluster-%d" availability_zone = "us-west-2a" @@ -650,6 +751,7 @@ EOF allow_version_upgrade = false enable_logging = true bucket_name = "${aws_s3_bucket.bucket.bucket}" + skip_final_snapshot = true }`, rInt, rInt, rInt, rInt) } @@ -663,6 +765,7 @@ resource "aws_redshift_cluster" "default" { node_type = "dc1.large" automated_snapshot_retention_period = 7 allow_version_upgrade = false + skip_final_snapshot = true tags { environment = "Production" cluster = "reader" @@ -680,6 +783,7 @@ resource "aws_redshift_cluster" "default" { node_type = "dc1.large" automated_snapshot_retention_period = 7 allow_version_upgrade = false + skip_final_snapshot = true tags { environment = "Production" } @@ -736,6 +840,7 @@ func testAccAWSRedshiftClusterConfig_notPubliclyAccessible(rInt int) string { allow_version_upgrade = false cluster_subnet_group_name = "${aws_redshift_subnet_group.foo.name}" publicly_accessible = false + skip_final_snapshot = true }`, rInt, rInt) } @@ -790,6 +895,7 @@ func testAccAWSRedshiftClusterConfig_updatePubliclyAccessible(rInt int) string { allow_version_upgrade = false cluster_subnet_group_name = "${aws_redshift_subnet_group.foo.name}" publicly_accessible = true + skip_final_snapshot = true }`, rInt, rInt) } @@ -816,6 +922,7 @@ resource "aws_redshift_cluster" "default" { automated_snapshot_retention_period = 0 allow_version_upgrade = false iam_roles = ["${aws_iam_role.ec2-role.arn}", "${aws_iam_role.lambda-role.arn}"] + skip_final_snapshot = true }` var testAccAWSRedshiftClusterConfig_updateIamRoles = ` @@ -841,4 +948,5 @@ resource "aws_iam_role" "ec2-role" { automated_snapshot_retention_period = 0 allow_version_upgrade = false iam_roles = ["${aws_iam_role.ec2-role.arn}"] + skip_final_snapshot = true }` diff --git a/installer/server/terraform/plugins/aws/resource_aws_redshift_parameter_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_redshift_parameter_group_test.go index e53519750d..edd293b820 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_redshift_parameter_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_redshift_parameter_group_test.go @@ -7,24 +7,26 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/redshift" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccAWSRedshiftParameterGroup_withParameters(t *testing.T) { var v redshift.ClusterParameterGroup + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSRedshiftParameterGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSRedshiftParameterGroupConfig, + { + Config: testAccAWSRedshiftParameterGroupConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftParameterGroupExists("aws_redshift_parameter_group.bar", &v), resource.TestCheckResourceAttr( - "aws_redshift_parameter_group.bar", "name", "parameter-group-test-terraform"), + "aws_redshift_parameter_group.bar", "name", fmt.Sprintf("test-terraform-%d", rInt)), resource.TestCheckResourceAttr( "aws_redshift_parameter_group.bar", "family", "redshift-1.0"), resource.TestCheckResourceAttr( @@ -49,18 +51,19 @@ func TestAccAWSRedshiftParameterGroup_withParameters(t *testing.T) { func TestAccAWSRedshiftParameterGroup_withoutParameters(t *testing.T) { var v redshift.ClusterParameterGroup + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSRedshiftParameterGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSRedshiftParameterGroupOnlyConfig, + { + Config: testAccAWSRedshiftParameterGroupOnlyConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftParameterGroupExists("aws_redshift_parameter_group.bar", &v), resource.TestCheckResourceAttr( - "aws_redshift_parameter_group.bar", "name", "parameter-group-test-terraform"), + "aws_redshift_parameter_group.bar", "name", fmt.Sprintf("test-terraform-%d", rInt)), resource.TestCheckResourceAttr( "aws_redshift_parameter_group.bar", "family", "redshift-1.0"), resource.TestCheckResourceAttr( @@ -179,28 +182,31 @@ func testAccCheckAWSRedshiftParameterGroupExists(n string, v *redshift.ClusterPa } } -const testAccAWSRedshiftParameterGroupOnlyConfig = ` -resource "aws_redshift_parameter_group" "bar" { - name = "parameter-group-test-terraform" - family = "redshift-1.0" - description = "Test parameter group for terraform" -}` - -const testAccAWSRedshiftParameterGroupConfig = ` -resource "aws_redshift_parameter_group" "bar" { - name = "parameter-group-test-terraform" - family = "redshift-1.0" - parameter { - name = "require_ssl" - value = "true" - } - parameter { - name = "query_group" - value = "example" - } - parameter{ - name = "enable_user_activity_logging" - value = "true" - } +func testAccAWSRedshiftParameterGroupOnlyConfig(rInt int) string { + return fmt.Sprintf(` + resource "aws_redshift_parameter_group" "bar" { + name = "test-terraform-%d" + family = "redshift-1.0" + description = "Test parameter group for terraform" + }`, rInt) +} + +func testAccAWSRedshiftParameterGroupConfig(rInt int) string { + return fmt.Sprintf(` + resource "aws_redshift_parameter_group" "bar" { + name = "test-terraform-%d" + family = "redshift-1.0" + parameter { + name = "require_ssl" + value = "true" + } + parameter { + name = "query_group" + value = "example" + } + parameter{ + name = "enable_user_activity_logging" + value = "true" + } + }`, rInt) } -` diff --git a/installer/server/terraform/plugins/aws/resource_aws_redshift_security_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_redshift_security_group_test.go index fac514e0f6..aa30a51453 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_redshift_security_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_redshift_security_group_test.go @@ -7,24 +7,26 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/redshift" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccAWSRedshiftSecurityGroup_ingressCidr(t *testing.T) { var v redshift.ClusterSecurityGroup + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidr, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidr(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( - "aws_redshift_security_group.bar", "name", "redshift-sg-terraform"), + "aws_redshift_security_group.bar", "name", fmt.Sprintf("redshift-sg-terraform-%d", rInt)), resource.TestCheckResourceAttr( "aws_redshift_security_group.bar", "description", "Managed by Terraform"), resource.TestCheckResourceAttr( @@ -39,14 +41,15 @@ func TestAccAWSRedshiftSecurityGroup_ingressCidr(t *testing.T) { func TestAccAWSRedshiftSecurityGroup_updateIngressCidr(t *testing.T) { var v redshift.ClusterSecurityGroup + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidr, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidr(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( @@ -54,8 +57,8 @@ func TestAccAWSRedshiftSecurityGroup_updateIngressCidr(t *testing.T) { ), }, - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidrAdd, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidrAdd(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( @@ -63,8 +66,8 @@ func TestAccAWSRedshiftSecurityGroup_updateIngressCidr(t *testing.T) { ), }, - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidrReduce, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidrReduce(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( @@ -77,24 +80,23 @@ func TestAccAWSRedshiftSecurityGroup_updateIngressCidr(t *testing.T) { func TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup(t *testing.T) { var v redshift.ClusterSecurityGroup + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgId, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgId(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( - "aws_redshift_security_group.bar", "name", "redshift-sg-terraform"), + "aws_redshift_security_group.bar", "name", fmt.Sprintf("redshift-sg-terraform-%d", rInt)), resource.TestCheckResourceAttr( "aws_redshift_security_group.bar", "description", "this is a description"), resource.TestCheckResourceAttr( "aws_redshift_security_group.bar", "ingress.#", "1"), - resource.TestCheckResourceAttr( - "aws_redshift_security_group.bar", "ingress.2230908922.security_group_name", "terraform_redshift_acceptance_test"), ), }, }, @@ -103,14 +105,15 @@ func TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup(t *testing.T) { func TestAccAWSRedshiftSecurityGroup_updateIngressSecurityGroup(t *testing.T) { var v redshift.ClusterSecurityGroup + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgId, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgId(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( @@ -118,8 +121,8 @@ func TestAccAWSRedshiftSecurityGroup_updateIngressSecurityGroup(t *testing.T) { ), }, - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgIdAdd, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgIdAdd(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( @@ -127,8 +130,8 @@ func TestAccAWSRedshiftSecurityGroup_updateIngressSecurityGroup(t *testing.T) { ), }, - resource.TestStep{ - Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgIdReduce, + { + Config: testAccAWSRedshiftSecurityGroupConfig_ingressSgIdReduce(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRedshiftSecurityGroupExists("aws_redshift_security_group.bar", &v), resource.TestCheckResourceAttr( @@ -239,187 +242,199 @@ func TestResourceAWSRedshiftSecurityGroupNameValidation(t *testing.T) { } } -const testAccAWSRedshiftSecurityGroupConfig_ingressCidr = ` -provider "aws" { - region = "us-east-1" -} - -resource "aws_redshift_security_group" "bar" { - name = "redshift-sg-terraform" +func testAccAWSRedshiftSecurityGroupConfig_ingressCidr(rInt int) string { + return fmt.Sprintf(` + provider "aws" { + region = "us-east-1" + } - ingress { - cidr = "10.0.0.1/24" - } -}` + resource "aws_redshift_security_group" "bar" { + name = "redshift-sg-terraform-%d" -const testAccAWSRedshiftSecurityGroupConfig_ingressCidrAdd = ` -provider "aws" { - region = "us-east-1" + ingress { + cidr = "10.0.0.1/24" + } + }`, rInt) } -resource "aws_redshift_security_group" "bar" { - name = "redshift-sg-terraform" - description = "this is a description" +func testAccAWSRedshiftSecurityGroupConfig_ingressCidrAdd(rInt int) string { + return fmt.Sprintf(` + provider "aws" { + region = "us-east-1" + } - ingress { - cidr = "10.0.0.1/24" - } + resource "aws_redshift_security_group" "bar" { + name = "redshift-sg-terraform-%d" + description = "this is a description" - ingress { - cidr = "10.0.10.1/24" - } + ingress { + cidr = "10.0.0.1/24" + } - ingress { - cidr = "10.0.20.1/24" - } -}` + ingress { + cidr = "10.0.10.1/24" + } -const testAccAWSRedshiftSecurityGroupConfig_ingressCidrReduce = ` -provider "aws" { - region = "us-east-1" + ingress { + cidr = "10.0.20.1/24" + } + }`, rInt) } -resource "aws_redshift_security_group" "bar" { - name = "redshift-sg-terraform" - description = "this is a description" +func testAccAWSRedshiftSecurityGroupConfig_ingressCidrReduce(rInt int) string { + return fmt.Sprintf(` + provider "aws" { + region = "us-east-1" + } - ingress { - cidr = "10.0.0.1/24" - } + resource "aws_redshift_security_group" "bar" { + name = "redshift-sg-terraform-%d" + description = "this is a description" - ingress { - cidr = "10.0.10.1/24" - } -}` + ingress { + cidr = "10.0.0.1/24" + } -const testAccAWSRedshiftSecurityGroupConfig_ingressSgId = ` -provider "aws" { - region = "us-east-1" + ingress { + cidr = "10.0.10.1/24" + } + }`, rInt) } -resource "aws_security_group" "redshift" { - name = "terraform_redshift_acceptance_test" - description = "Used in the redshift acceptance tests" - - ingress { - protocol = "tcp" - from_port = 22 - to_port = 22 - cidr_blocks = ["10.0.0.0/8"] +func testAccAWSRedshiftSecurityGroupConfig_ingressSgId(rInt int) string { + return fmt.Sprintf(` + provider "aws" { + region = "us-east-1" } -} -resource "aws_redshift_security_group" "bar" { - name = "redshift-sg-terraform" - description = "this is a description" + resource "aws_security_group" "redshift" { + name = "terraform_redshift_test_%d" + description = "Used in the redshift acceptance tests" + + ingress { + protocol = "tcp" + from_port = 22 + to_port = 22 + cidr_blocks = ["10.0.0.0/8"] + } + } - ingress { - security_group_name = "${aws_security_group.redshift.name}" - security_group_owner_id = "${aws_security_group.redshift.owner_id}" - } -}` + resource "aws_redshift_security_group" "bar" { + name = "redshift-sg-terraform-%d" + description = "this is a description" -const testAccAWSRedshiftSecurityGroupConfig_ingressSgIdAdd = ` -provider "aws" { - region = "us-east-1" + ingress { + security_group_name = "${aws_security_group.redshift.name}" + security_group_owner_id = "${aws_security_group.redshift.owner_id}" + } + }`, rInt, rInt) } -resource "aws_security_group" "redshift" { - name = "terraform_redshift_acceptance_test" - description = "Used in the redshift acceptance tests" +func testAccAWSRedshiftSecurityGroupConfig_ingressSgIdAdd(rInt int) string { + return fmt.Sprintf(` + provider "aws" { + region = "us-east-1" + } - ingress { - protocol = "tcp" - from_port = 22 - to_port = 22 - cidr_blocks = ["10.0.0.0/16"] + resource "aws_security_group" "redshift" { + name = "terraform_redshift_test_%d" + description = "Used in the redshift acceptance tests" + + ingress { + protocol = "tcp" + from_port = 22 + to_port = 22 + cidr_blocks = ["10.0.0.0/16"] + } } -} -resource "aws_security_group" "redshift2" { - name = "terraform_redshift_acceptance_test_2" - description = "Used in the redshift acceptance tests #2" + resource "aws_security_group" "redshift2" { + name = "terraform_redshift_test_2_%d" + description = "Used in the redshift acceptance tests #2" - ingress { - protocol = "tcp" - from_port = 22 - to_port = 22 - cidr_blocks = ["10.1.0.0/16"] + ingress { + protocol = "tcp" + from_port = 22 + to_port = 22 + cidr_blocks = ["10.1.0.0/16"] + } } -} -resource "aws_security_group" "redshift3" { - name = "terraform_redshift_acceptance_test_3" - description = "Used in the redshift acceptance tests #3" + resource "aws_security_group" "redshift3" { + name = "terraform_redshift_test_3_%d" + description = "Used in the redshift acceptance tests #3" - ingress { - protocol = "tcp" - from_port = 22 - to_port = 22 - cidr_blocks = ["10.2.0.0/16"] + ingress { + protocol = "tcp" + from_port = 22 + to_port = 22 + cidr_blocks = ["10.2.0.0/16"] + } } -} -resource "aws_redshift_security_group" "bar" { - name = "redshift-sg-terraform" - description = "this is a description" - - ingress { - security_group_name = "${aws_security_group.redshift.name}" - security_group_owner_id = "${aws_security_group.redshift.owner_id}" - } - - ingress { - security_group_name = "${aws_security_group.redshift2.name}" - security_group_owner_id = "${aws_security_group.redshift.owner_id}" - } - - ingress { - security_group_name = "${aws_security_group.redshift3.name}" - security_group_owner_id = "${aws_security_group.redshift.owner_id}" - } -}` - -const testAccAWSRedshiftSecurityGroupConfig_ingressSgIdReduce = ` -provider "aws" { - region = "us-east-1" + resource "aws_redshift_security_group" "bar" { + name = "redshift-sg-terraform-%d" + description = "this is a description" + + ingress { + security_group_name = "${aws_security_group.redshift.name}" + security_group_owner_id = "${aws_security_group.redshift.owner_id}" + } + + ingress { + security_group_name = "${aws_security_group.redshift2.name}" + security_group_owner_id = "${aws_security_group.redshift.owner_id}" + } + + ingress { + security_group_name = "${aws_security_group.redshift3.name}" + security_group_owner_id = "${aws_security_group.redshift.owner_id}" + } + }`, rInt, rInt, rInt, rInt) } -resource "aws_security_group" "redshift" { - name = "terraform_redshift_acceptance_test" - description = "Used in the redshift acceptance tests" +func testAccAWSRedshiftSecurityGroupConfig_ingressSgIdReduce(rInt int) string { + return fmt.Sprintf(` + provider "aws" { + region = "us-east-1" + } + + resource "aws_security_group" "redshift" { + name = "terraform_redshift_test_%d" + description = "Used in the redshift acceptance tests" - ingress { - protocol = "tcp" - from_port = 22 - to_port = 22 - cidr_blocks = ["10.0.0.0/16"] + ingress { + protocol = "tcp" + from_port = 22 + to_port = 22 + cidr_blocks = ["10.0.0.0/16"] + } } -} -resource "aws_security_group" "redshift2" { - name = "terraform_redshift_acceptance_test_2" - description = "Used in the redshift acceptance tests #2" + resource "aws_security_group" "redshift2" { + name = "terraform_redshift_test_2_%d" + description = "Used in the redshift acceptance tests #2" - ingress { - protocol = "tcp" - from_port = 22 - to_port = 22 - cidr_blocks = ["10.1.0.0/16"] + ingress { + protocol = "tcp" + from_port = 22 + to_port = 22 + cidr_blocks = ["10.1.0.0/16"] + } } -} -resource "aws_redshift_security_group" "bar" { - name = "redshift-sg-terraform" - description = "this is a description" + resource "aws_redshift_security_group" "bar" { + name = "redshift-sg-terraform-%d" + description = "this is a description" - ingress { - security_group_name = "${aws_security_group.redshift.name}" - security_group_owner_id = "${aws_security_group.redshift.owner_id}" - } + ingress { + security_group_name = "${aws_security_group.redshift.name}" + security_group_owner_id = "${aws_security_group.redshift.owner_id}" + } - ingress { - security_group_name = "${aws_security_group.redshift2.name}" - security_group_owner_id = "${aws_security_group.redshift.owner_id}" - } -}` + ingress { + security_group_name = "${aws_security_group.redshift2.name}" + security_group_owner_id = "${aws_security_group.redshift.owner_id}" + } + }`, rInt, rInt, rInt) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_route.go b/installer/server/terraform/plugins/aws/resource_aws_route.go index 915e12e481..b33dfe3b7b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route.go @@ -16,7 +16,7 @@ import ( // How long to sleep if a limit-exceeded event happens var routeTargetValidationError = errors.New("Error: more than 1 target specified. Only 1 of gateway_id, " + - "nat_gateway_id, instance_id, network_interface_id, route_table_id or " + + "egress_only_gateway_id, nat_gateway_id, instance_id, network_interface_id, route_table_id or " + "vpc_peering_connection_id is allowed.") // AWS Route resource Schema declaration @@ -29,62 +29,73 @@ func resourceAwsRoute() *schema.Resource { Exists: resourceAwsRouteExists, Schema: map[string]*schema.Schema{ - "destination_cidr_block": &schema.Schema{ + "destination_cidr_block": { Type: schema.TypeString, - Required: true, + Optional: true, + ForceNew: true, + }, + "destination_ipv6_cidr_block": { + Type: schema.TypeString, + Optional: true, ForceNew: true, }, - "destination_prefix_list_id": &schema.Schema{ + "destination_prefix_list_id": { Type: schema.TypeString, Computed: true, }, - "gateway_id": &schema.Schema{ + "gateway_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "nat_gateway_id": &schema.Schema{ + "egress_only_gateway_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "instance_id": &schema.Schema{ + "nat_gateway_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "instance_owner_id": &schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "instance_owner_id": { Type: schema.TypeString, Computed: true, }, - "network_interface_id": &schema.Schema{ + "network_interface_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "origin": &schema.Schema{ + "origin": { Type: schema.TypeString, Computed: true, }, - "state": &schema.Schema{ + "state": { Type: schema.TypeString, Computed: true, }, - "route_table_id": &schema.Schema{ + "route_table_id": { Type: schema.TypeString, Required: true, }, - "vpc_peering_connection_id": &schema.Schema{ + "vpc_peering_connection_id": { Type: schema.TypeString, Optional: true, }, @@ -97,6 +108,7 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error { var numTargets int var setTarget string allowedTargets := []string{ + "egress_only_gateway_id", "gateway_id", "nat_gateway_id", "instance_id", @@ -125,6 +137,12 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error { DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), GatewayId: aws.String(d.Get("gateway_id").(string)), } + case "egress_only_gateway_id": + createOpts = &ec2.CreateRouteInput{ + RouteTableId: aws.String(d.Get("route_table_id").(string)), + DestinationIpv6CidrBlock: aws.String(d.Get("destination_ipv6_cidr_block").(string)), + EgressOnlyInternetGatewayId: aws.String(d.Get("egress_only_gateway_id").(string)), + } case "nat_gateway_id": createOpts = &ec2.CreateRouteInput{ RouteTableId: aws.String(d.Get("route_table_id").(string)), @@ -180,12 +198,25 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error { } var route *ec2.Route - err = resource.Retry(2*time.Minute, func() *resource.RetryError { - route, err = findResourceRoute(conn, d.Get("route_table_id").(string), d.Get("destination_cidr_block").(string)) - return resource.RetryableError(err) - }) - if err != nil { - return fmt.Errorf("Error finding route after creating it: %s", err) + + if v, ok := d.GetOk("destination_cidr_block"); ok { + err = resource.Retry(2*time.Minute, func() *resource.RetryError { + route, err = findResourceRoute(conn, d.Get("route_table_id").(string), v.(string), "") + return resource.RetryableError(err) + }) + if err != nil { + return fmt.Errorf("Error finding route after creating it: %s", err) + } + } + + if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { + err = resource.Retry(2*time.Minute, func() *resource.RetryError { + route, err = findResourceRoute(conn, d.Get("route_table_id").(string), "", v.(string)) + return resource.RetryableError(err) + }) + if err != nil { + return fmt.Errorf("Error finding route after creating it: %s", err) + } } d.SetId(routeIDHash(d, route)) @@ -197,7 +228,10 @@ func resourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn routeTableId := d.Get("route_table_id").(string) - route, err := findResourceRoute(conn, routeTableId, d.Get("destination_cidr_block").(string)) + destinationCidrBlock := d.Get("destination_cidr_block").(string) + destinationIpv6CidrBlock := d.Get("destination_ipv6_cidr_block").(string) + + route, err := findResourceRoute(conn, routeTableId, destinationCidrBlock, destinationIpv6CidrBlock) if err != nil { if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidRouteTableID.NotFound" { log.Printf("[WARN] Route Table %q could not be found. Removing Route from state.", @@ -214,6 +248,7 @@ func resourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsRouteSetResourceData(d *schema.ResourceData, route *ec2.Route) { d.Set("destination_prefix_list_id", route.DestinationPrefixListId) d.Set("gateway_id", route.GatewayId) + d.Set("egress_only_gateway_id", route.EgressOnlyInternetGatewayId) d.Set("nat_gateway_id", route.NatGatewayId) d.Set("instance_id", route.InstanceId) d.Set("instance_owner_id", route.InstanceOwnerId) @@ -229,6 +264,7 @@ func resourceAwsRouteUpdate(d *schema.ResourceData, meta interface{}) error { var setTarget string allowedTargets := []string{ + "egress_only_gateway_id", "gateway_id", "nat_gateway_id", "network_interface_id", @@ -267,6 +303,12 @@ func resourceAwsRouteUpdate(d *schema.ResourceData, meta interface{}) error { DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), GatewayId: aws.String(d.Get("gateway_id").(string)), } + case "egress_only_gateway_id": + replaceOpts = &ec2.ReplaceRouteInput{ + RouteTableId: aws.String(d.Get("route_table_id").(string)), + DestinationIpv6CidrBlock: aws.String(d.Get("destination_ipv6_cidr_block").(string)), + EgressOnlyInternetGatewayId: aws.String(d.Get("egress_only_gateway_id").(string)), + } case "nat_gateway_id": replaceOpts = &ec2.ReplaceRouteInput{ RouteTableId: aws.String(d.Get("route_table_id").(string)), @@ -309,8 +351,13 @@ func resourceAwsRouteDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn deleteOpts := &ec2.DeleteRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), + RouteTableId: aws.String(d.Get("route_table_id").(string)), + } + if v, ok := d.GetOk("destination_cidr_block"); ok { + deleteOpts.DestinationCidrBlock = aws.String(v.(string)) + } + if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { + deleteOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) } log.Printf("[DEBUG] Route delete opts: %s", deleteOpts) @@ -368,10 +415,19 @@ func resourceAwsRouteExists(d *schema.ResourceData, meta interface{}) (bool, err return false, nil } - cidr := d.Get("destination_cidr_block").(string) - for _, route := range (*res.RouteTables[0]).Routes { - if route.DestinationCidrBlock != nil && *route.DestinationCidrBlock == cidr { - return true, nil + if v, ok := d.GetOk("destination_cidr_block"); ok { + for _, route := range (*res.RouteTables[0]).Routes { + if route.DestinationCidrBlock != nil && *route.DestinationCidrBlock == v.(string) { + return true, nil + } + } + } + + if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { + for _, route := range (*res.RouteTables[0]).Routes { + if route.DestinationIpv6CidrBlock != nil && *route.DestinationIpv6CidrBlock == v.(string) { + return true, nil + } } } @@ -380,11 +436,16 @@ func resourceAwsRouteExists(d *schema.ResourceData, meta interface{}) (bool, err // Create an ID for a route func routeIDHash(d *schema.ResourceData, r *ec2.Route) string { + + if r.DestinationIpv6CidrBlock != nil && *r.DestinationIpv6CidrBlock != "" { + return fmt.Sprintf("r-%s%d", d.Get("route_table_id").(string), hashcode.String(*r.DestinationIpv6CidrBlock)) + } + return fmt.Sprintf("r-%s%d", d.Get("route_table_id").(string), hashcode.String(*r.DestinationCidrBlock)) } // Helper: retrieve a route -func findResourceRoute(conn *ec2.EC2, rtbid string, cidr string) (*ec2.Route, error) { +func findResourceRoute(conn *ec2.EC2, rtbid string, cidr string, ipv6cidr string) (*ec2.Route, error) { routeTableID := rtbid findOpts := &ec2.DescribeRouteTablesInput{ @@ -401,12 +462,29 @@ func findResourceRoute(conn *ec2.EC2, rtbid string, cidr string) (*ec2.Route, er routeTableID) } - for _, route := range (*resp.RouteTables[0]).Routes { - if route.DestinationCidrBlock != nil && *route.DestinationCidrBlock == cidr { - return route, nil + if cidr != "" { + for _, route := range (*resp.RouteTables[0]).Routes { + if route.DestinationCidrBlock != nil && *route.DestinationCidrBlock == cidr { + return route, nil + } } + + return nil, fmt.Errorf("Unable to find matching route for Route Table (%s) "+ + "and destination CIDR block (%s).", rtbid, cidr) } - return nil, fmt.Errorf("Unable to find matching route for Route Table (%s) "+ - "and destination CIDR block (%s).", rtbid, cidr) + if ipv6cidr != "" { + for _, route := range (*resp.RouteTables[0]).Routes { + if route.DestinationIpv6CidrBlock != nil && *route.DestinationIpv6CidrBlock == ipv6cidr { + return route, nil + } + } + + return nil, fmt.Errorf("Unable to find matching route for Route Table (%s) "+ + "and destination IPv6 CIDR block (%s).", rtbid, ipv6cidr) + } + + return nil, fmt.Errorf("When trying to find a matching route for Route Table %q "+ + "you need to specify a CIDR block of IPv6 CIDR Block", rtbid) + } diff --git a/installer/server/terraform/plugins/aws/resource_aws_route53_record.go b/installer/server/terraform/plugins/aws/resource_aws_route53_record.go index 8739141936..0a80f7892f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route53_record.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route53_record.go @@ -33,7 +33,7 @@ func resourceAwsRoute53Record() *schema.Resource { SchemaVersion: 2, MigrateState: resourceAwsRoute53RecordMigrateState, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -43,18 +43,18 @@ func resourceAwsRoute53Record() *schema.Resource { }, }, - "fqdn": &schema.Schema{ + "fqdn": { Type: schema.TypeString, Computed: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, ValidateFunc: validateRoute53RecordType, }, - "zone_id": &schema.Schema{ + "zone_id": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -67,41 +67,41 @@ func resourceAwsRoute53Record() *schema.Resource { }, }, - "ttl": &schema.Schema{ + "ttl": { Type: schema.TypeInt, Optional: true, ConflictsWith: []string{"alias"}, }, - "weight": &schema.Schema{ + "weight": { Type: schema.TypeInt, Optional: true, Removed: "Now implemented as weighted_routing_policy; Please see https://www.terraform.io/docs/providers/aws/r/route53_record.html", }, - "set_identifier": &schema.Schema{ + "set_identifier": { Type: schema.TypeString, Optional: true, }, - "alias": &schema.Schema{ + "alias": { Type: schema.TypeSet, Optional: true, ConflictsWith: []string{"records", "ttl"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "zone_id": &schema.Schema{ + "zone_id": { Type: schema.TypeString, Required: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, StateFunc: normalizeAwsAliasName, }, - "evaluate_target_health": &schema.Schema{ + "evaluate_target_health": { Type: schema.TypeBool, Required: true, }, @@ -110,13 +110,13 @@ func resourceAwsRoute53Record() *schema.Resource { Set: resourceAwsRoute53AliasRecordHash, }, - "failover": &schema.Schema{ // PRIMARY | SECONDARY + "failover": { // PRIMARY | SECONDARY Type: schema.TypeString, Optional: true, Removed: "Now implemented as failover_routing_policy; see docs", }, - "failover_routing_policy": &schema.Schema{ + "failover_routing_policy": { Type: schema.TypeList, Optional: true, ConflictsWith: []string{ @@ -126,7 +126,7 @@ func resourceAwsRoute53Record() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { @@ -141,7 +141,7 @@ func resourceAwsRoute53Record() *schema.Resource { }, }, - "latency_routing_policy": &schema.Schema{ + "latency_routing_policy": { Type: schema.TypeList, Optional: true, ConflictsWith: []string{ @@ -151,7 +151,7 @@ func resourceAwsRoute53Record() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Required: true, }, @@ -159,7 +159,7 @@ func resourceAwsRoute53Record() *schema.Resource { }, }, - "geolocation_routing_policy": &schema.Schema{ // AWS Geolocation + "geolocation_routing_policy": { // AWS Geolocation Type: schema.TypeList, Optional: true, ConflictsWith: []string{ @@ -169,15 +169,15 @@ func resourceAwsRoute53Record() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "continent": &schema.Schema{ + "continent": { Type: schema.TypeString, Optional: true, }, - "country": &schema.Schema{ + "country": { Type: schema.TypeString, Optional: true, }, - "subdivision": &schema.Schema{ + "subdivision": { Type: schema.TypeString, Optional: true, }, @@ -185,7 +185,7 @@ func resourceAwsRoute53Record() *schema.Resource { }, }, - "weighted_routing_policy": &schema.Schema{ + "weighted_routing_policy": { Type: schema.TypeList, Optional: true, ConflictsWith: []string{ @@ -195,7 +195,7 @@ func resourceAwsRoute53Record() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "weight": &schema.Schema{ + "weight": { Type: schema.TypeInt, Required: true, }, @@ -203,12 +203,12 @@ func resourceAwsRoute53Record() *schema.Resource { }, }, - "health_check_id": &schema.Schema{ // ID of health check + "health_check_id": { // ID of health check Type: schema.TypeString, Optional: true, }, - "records": &schema.Schema{ + "records": { Type: schema.TypeSet, ConflictsWith: []string{"alias"}, Elem: &schema.Schema{Type: schema.TypeString}, @@ -297,11 +297,11 @@ func resourceAwsRoute53RecordUpdate(d *schema.ResourceData, meta interface{}) er changeBatch := &route53.ChangeBatch{ Comment: aws.String("Managed by Terraform"), Changes: []*route53.Change{ - &route53.Change{ + { Action: aws.String("DELETE"), ResourceRecordSet: oldRec, }, - &route53.Change{ + { Action: aws.String("CREATE"), ResourceRecordSet: rec, }, @@ -368,7 +368,7 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er changeBatch := &route53.ChangeBatch{ Comment: aws.String("Managed by Terraform"), Changes: []*route53.Change{ - &route53.Change{ + { Action: aws.String("UPSERT"), ResourceRecordSet: rec, }, @@ -470,8 +470,6 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro if len(parts) > 3 { d.Set("set_identifier", parts[3]) } - - d.Set("weight", -1) } record, err := findRecord(d, meta) @@ -631,7 +629,7 @@ func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) er changeBatch := &route53.ChangeBatch{ Comment: aws.String("Deleted by Terraform"), Changes: []*route53.Change{ - &route53.Change{ + { Action: aws.String("DELETE"), ResourceRecordSet: rec, }, diff --git a/installer/server/terraform/plugins/aws/resource_aws_route53_zone.go b/installer/server/terraform/plugins/aws/resource_aws_route53_zone.go index 9faa716a12..b30d38829e 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route53_zone.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route53_zone.go @@ -300,7 +300,7 @@ func deleteAllRecordsInHostedZoneId(hostedZoneId, hostedZoneName string, conn *r changes := make([]*route53.Change, 0) // 100 items per page returned by default for _, set := range sets { - if *set.Name == hostedZoneName+"." && (*set.Type == "NS" || *set.Type == "SOA") { + if strings.TrimSuffix(*set.Name, ".") == strings.TrimSuffix(hostedZoneName, ".") && (*set.Type == "NS" || *set.Type == "SOA") { // Zone NS & SOA records cannot be deleted continue } diff --git a/installer/server/terraform/plugins/aws/resource_aws_route53_zone_association_test.go b/installer/server/terraform/plugins/aws/resource_aws_route53_zone_association_test.go index bcd84c7ca7..7817a113ce 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route53_zone_association_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route53_zone_association_test.go @@ -207,6 +207,7 @@ resource "aws_route53_zone" "foo" { provider = "aws.west" name = "foo.com" vpc_id = "${aws_vpc.foo.id}" + vpc_region = "us-west-2" } resource "aws_route53_zone_association" "foobar" { diff --git a/installer/server/terraform/plugins/aws/resource_aws_route53_zone_test.go b/installer/server/terraform/plugins/aws/resource_aws_route53_zone_test.go index 6679ea72dc..ee1b5d6d67 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route53_zone_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route53_zone_test.go @@ -89,7 +89,7 @@ func TestAccAWSRoute53Zone_basic(t *testing.T) { } func TestAccAWSRoute53Zone_forceDestroy(t *testing.T) { - var zone route53.GetHostedZoneOutput + var zone, zoneWithDot route53.GetHostedZoneOutput // record the initialized providers so that we can use them to // check for the instances in each region @@ -115,6 +115,11 @@ func TestAccAWSRoute53Zone_forceDestroy(t *testing.T) { // Add >100 records to verify pagination works ok testAccCreateRandomRoute53RecordsInZoneIdWithProviders(&providers, &zone, 100), testAccCreateRandomRoute53RecordsInZoneIdWithProviders(&providers, &zone, 5), + + testAccCheckRoute53ZoneExistsWithProviders("aws_route53_zone.with_trailing_dot", &zoneWithDot, &providers), + // Add >100 records to verify pagination works ok + testAccCreateRandomRoute53RecordsInZoneIdWithProviders(&providers, &zoneWithDot, 100), + testAccCreateRandomRoute53RecordsInZoneIdWithProviders(&providers, &zoneWithDot, 5), ), }, }, @@ -417,6 +422,11 @@ resource "aws_route53_zone" "destroyable" { name = "terraform.io" force_destroy = true } + +resource "aws_route53_zone" "with_trailing_dot" { + name = "hashicorptest.io." + force_destroy = true +} ` const testAccRoute53ZoneConfigUpdateComment = ` diff --git a/installer/server/terraform/plugins/aws/resource_aws_route_table.go b/installer/server/terraform/plugins/aws/resource_aws_route_table.go index e8e0cb8038..76ed913810 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route_table.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route_table.go @@ -25,7 +25,7 @@ func resourceAwsRouteTable() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "vpc_id": &schema.Schema{ + "vpc_id": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -33,45 +33,55 @@ func resourceAwsRouteTable() *schema.Resource { "tags": tagsSchema(), - "propagating_vgws": &schema.Schema{ + "propagating_vgws": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "route": &schema.Schema{ + "route": { Type: schema.TypeSet, Computed: true, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "cidr_block": &schema.Schema{ + "cidr_block": { Type: schema.TypeString, - Required: true, + Optional: true, + }, + + "ipv6_cidr_block": { + Type: schema.TypeString, + Optional: true, }, - "gateway_id": &schema.Schema{ + "egress_only_gateway_id": { Type: schema.TypeString, Optional: true, }, - "instance_id": &schema.Schema{ + "gateway_id": { Type: schema.TypeString, Optional: true, }, - "nat_gateway_id": &schema.Schema{ + "instance_id": { Type: schema.TypeString, Optional: true, }, - "vpc_peering_connection_id": &schema.Schema{ + "nat_gateway_id": { Type: schema.TypeString, Optional: true, }, - "network_interface_id": &schema.Schema{ + "vpc_peering_connection_id": { + Type: schema.TypeString, + Optional: true, + }, + + "network_interface_id": { Type: schema.TypeString, Optional: true, }, @@ -166,6 +176,12 @@ func resourceAwsRouteTableRead(d *schema.ResourceData, meta interface{}) error { if r.DestinationCidrBlock != nil { m["cidr_block"] = *r.DestinationCidrBlock } + if r.DestinationIpv6CidrBlock != nil { + m["ipv6_cidr_block"] = *r.DestinationIpv6CidrBlock + } + if r.EgressOnlyInternetGatewayId != nil { + m["egress_only_gateway_id"] = *r.EgressOnlyInternetGatewayId + } if r.GatewayId != nil { m["gateway_id"] = *r.GatewayId } @@ -266,14 +282,27 @@ func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error for _, route := range ors.List() { m := route.(map[string]interface{}) - // Delete the route as it no longer exists in the config - log.Printf( - "[INFO] Deleting route from %s: %s", - d.Id(), m["cidr_block"].(string)) - _, err := conn.DeleteRoute(&ec2.DeleteRouteInput{ - RouteTableId: aws.String(d.Id()), - DestinationCidrBlock: aws.String(m["cidr_block"].(string)), - }) + deleteOpts := &ec2.DeleteRouteInput{ + RouteTableId: aws.String(d.Id()), + } + + if s := m["ipv6_cidr_block"].(string); s != "" { + deleteOpts.DestinationIpv6CidrBlock = aws.String(s) + + log.Printf( + "[INFO] Deleting route from %s: %s", + d.Id(), m["ipv6_cidr_block"].(string)) + } + + if s := m["cidr_block"].(string); s != "" { + deleteOpts.DestinationCidrBlock = aws.String(s) + + log.Printf( + "[INFO] Deleting route from %s: %s", + d.Id(), m["cidr_block"].(string)) + } + + _, err := conn.DeleteRoute(deleteOpts) if err != nil { return err } @@ -288,16 +317,39 @@ func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error m := route.(map[string]interface{}) opts := ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Id()), - DestinationCidrBlock: aws.String(m["cidr_block"].(string)), - GatewayId: aws.String(m["gateway_id"].(string)), - InstanceId: aws.String(m["instance_id"].(string)), - VpcPeeringConnectionId: aws.String(m["vpc_peering_connection_id"].(string)), - NetworkInterfaceId: aws.String(m["network_interface_id"].(string)), + RouteTableId: aws.String(d.Id()), + } + + if s := m["vpc_peering_connection_id"].(string); s != "" { + opts.VpcPeeringConnectionId = aws.String(s) + } + + if s := m["network_interface_id"].(string); s != "" { + opts.NetworkInterfaceId = aws.String(s) + } + + if s := m["instance_id"].(string); s != "" { + opts.InstanceId = aws.String(s) + } + + if s := m["ipv6_cidr_block"].(string); s != "" { + opts.DestinationIpv6CidrBlock = aws.String(s) + } + + if s := m["cidr_block"].(string); s != "" { + opts.DestinationCidrBlock = aws.String(s) } - if m["nat_gateway_id"].(string) != "" { - opts.NatGatewayId = aws.String(m["nat_gateway_id"].(string)) + if s := m["gateway_id"].(string); s != "" { + opts.GatewayId = aws.String(s) + } + + if s := m["egress_only_gateway_id"].(string); s != "" { + opts.EgressOnlyInternetGatewayId = aws.String(s) + } + + if s := m["nat_gateway_id"].(string); s != "" { + opts.NatGatewayId = aws.String(s) } log.Printf("[INFO] Creating route for %s: %#v", d.Id(), opts) @@ -400,7 +452,14 @@ func resourceAwsRouteTableDelete(d *schema.ResourceData, meta interface{}) error func resourceAwsRouteTableHash(v interface{}) int { var buf bytes.Buffer - m := v.(map[string]interface{}) + m, castOk := v.(map[string]interface{}) + if !castOk { + return 0 + } + + if v, ok := m["ipv6_cidr_block"]; ok { + buf.WriteString(fmt.Sprintf("%s-", v.(string))) + } if v, ok := m["cidr_block"]; ok { buf.WriteString(fmt.Sprintf("%s-", v.(string))) @@ -410,6 +469,10 @@ func resourceAwsRouteTableHash(v interface{}) int { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } + if v, ok := m["egress_only_gateway_id"]; ok { + buf.WriteString(fmt.Sprintf("%s-", v.(string))) + } + natGatewaySet := false if v, ok := m["nat_gateway_id"]; ok { natGatewaySet = v.(string) != "" diff --git a/installer/server/terraform/plugins/aws/resource_aws_route_table_test.go b/installer/server/terraform/plugins/aws/resource_aws_route_table_test.go index 910f8c0135..b4b764d374 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route_table_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route_table_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -63,7 +64,7 @@ func TestAccAWSRouteTable_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRouteTableConfig, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -72,7 +73,7 @@ func TestAccAWSRouteTable_basic(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccRouteTableConfigChange, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -113,7 +114,7 @@ func TestAccAWSRouteTable_instance(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRouteTableConfigInstance, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -125,6 +126,35 @@ func TestAccAWSRouteTable_instance(t *testing.T) { }) } +func TestAccAWSRouteTable_ipv6(t *testing.T) { + var v ec2.RouteTable + + testCheck := func(*terraform.State) error { + // Expect 3: 2 IPv6 (local + all outbound) + 1 IPv4 + if len(v.Routes) != 3 { + return fmt.Errorf("bad routes: %#v", v.Routes) + } + + return nil + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_route_table.foo", + Providers: testAccProviders, + CheckDestroy: testAccCheckRouteTableDestroy, + Steps: []resource.TestStep{ + { + Config: testAccRouteTableConfigIpv6, + Check: resource.ComposeTestCheckFunc( + testAccCheckRouteTableExists("aws_route_table.foo", &v), + testCheck, + ), + }, + }, + }) +} + func TestAccAWSRouteTable_tags(t *testing.T) { var route_table ec2.RouteTable @@ -134,7 +164,7 @@ func TestAccAWSRouteTable_tags(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRouteTableConfigTags, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists("aws_route_table.foo", &route_table), @@ -142,7 +172,7 @@ func TestAccAWSRouteTable_tags(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccRouteTableConfigTagsUpdate, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists("aws_route_table.foo", &route_table), @@ -154,6 +184,22 @@ func TestAccAWSRouteTable_tags(t *testing.T) { }) } +// For GH-13545, Fixes panic on an empty route config block +func TestAccAWSRouteTable_panicEmptyRoute(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_route_table.foo", + Providers: testAccProviders, + CheckDestroy: testAccCheckRouteTableDestroy, + Steps: []resource.TestStep{ + { + Config: testAccRouteTableConfigPanicEmptyRoute, + ExpectError: regexp.MustCompile("The request must contain the parameter destinationCidrBlock or destinationIpv6CidrBlock"), + }, + }, + }) +} + func testAccCheckRouteTableDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ec2conn @@ -244,7 +290,7 @@ func TestAccAWSRouteTable_vpcPeering(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRouteTableVpcPeeringConfig, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -285,7 +331,7 @@ func TestAccAWSRouteTable_vgwRoutePropagation(t *testing.T) { testAccCheckRouteTableDestroy, ), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccRouteTableVgwRoutePropagationConfig, Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists( @@ -342,6 +388,26 @@ resource "aws_route_table" "foo" { } ` +const testAccRouteTableConfigIpv6 = ` +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true +} + +resource "aws_egress_only_internet_gateway" "foo" { + vpc_id = "${aws_vpc.foo.id}" +} + +resource "aws_route_table" "foo" { + vpc_id = "${aws_vpc.foo.id}" + + route { + ipv6_cidr_block = "::/0" + egress_only_gateway_id = "${aws_egress_only_internet_gateway.foo.id}" + } +} +` + const testAccRouteTableConfigInstance = ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" @@ -448,3 +514,17 @@ resource "aws_route_table" "foo" { propagating_vgws = ["${aws_vpn_gateway.foo.id}"] } ` + +// For GH-13545 +const testAccRouteTableConfigPanicEmptyRoute = ` +resource "aws_vpc" "foo" { + cidr_block = "10.2.0.0/16" +} + +resource "aws_route_table" "foo" { + vpc_id = "${aws_vpc.foo.id}" + + route { + } +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_route_test.go b/installer/server/terraform/plugins/aws/resource_aws_route_test.go index d7a2c0b995..a8bc00373b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_route_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_route_test.go @@ -38,7 +38,7 @@ func TestAccAWSRoute_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSRouteBasicConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists("aws_route.bar", &route), @@ -49,6 +49,43 @@ func TestAccAWSRoute_basic(t *testing.T) { }) } +func TestAccAWSRoute_ipv6Support(t *testing.T) { + var route ec2.Route + + //aws creates a default route + testCheck := func(s *terraform.State) error { + + name := "aws_egress_only_internet_gateway.foo" + gwres, ok := s.RootModule().Resources[name] + if !ok { + return fmt.Errorf("Not found: %s\n", name) + } + + if *route.EgressOnlyInternetGatewayId != gwres.Primary.ID { + return fmt.Errorf("Egress Only Internet Gateway Id (Expected=%s, Actual=%s)\n", gwres.Primary.ID, *route.EgressOnlyInternetGatewayId) + } + + return nil + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv6, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists("aws_route.bar", &route), + testCheck, + ), + }, + }, + }) +} + func TestAccAWSRoute_changeCidr(t *testing.T) { var route ec2.Route var routeTable ec2.RouteTable @@ -101,14 +138,14 @@ func TestAccAWSRoute_changeCidr(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSRouteBasicConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists("aws_route.bar", &route), testCheck, ), }, - resource.TestStep{ + { Config: testAccAWSRouteBasicConfigChangeCidr, Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists("aws_route.bar", &route), @@ -139,14 +176,14 @@ func TestAccAWSRoute_noopdiff(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSRouteNoopChange, Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists("aws_route.test", &route), testCheck, ), }, - resource.TestStep{ + { Config: testAccAWSRouteNoopChange, Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists("aws_route.test", &route), @@ -166,7 +203,7 @@ func TestAccAWSRoute_doesNotCrashWithVPCEndpoint(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSRouteWithVPCEndpoint, Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists("aws_route.bar", &route), @@ -192,6 +229,7 @@ func testAccCheckAWSRouteExists(n string, res *ec2.Route) resource.TestCheckFunc conn, rs.Primary.Attributes["route_table_id"], rs.Primary.Attributes["destination_cidr_block"], + rs.Primary.Attributes["destination_ipv6_cidr_block"], ) if err != nil { @@ -219,6 +257,7 @@ func testAccCheckAWSRouteDestroy(s *terraform.State) error { conn, rs.Primary.Attributes["route_table_id"], rs.Primary.Attributes["destination_cidr_block"], + rs.Primary.Attributes["destination_ipv6_cidr_block"], ) if route == nil && err == nil { @@ -249,6 +288,29 @@ resource "aws_route" "bar" { } `) +var testAccAWSRouteConfigIpv6 = fmt.Sprintf(` +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true +} + +resource "aws_egress_only_internet_gateway" "foo" { + vpc_id = "${aws_vpc.foo.id}" +} + +resource "aws_route_table" "foo" { + vpc_id = "${aws_vpc.foo.id}" +} + +resource "aws_route" "bar" { + route_table_id = "${aws_route_table.foo.id}" + destination_ipv6_cidr_block = "::/0" + egress_only_gateway_id = "${aws_egress_only_internet_gateway.foo.id}" +} + + +`) + var testAccAWSRouteBasicConfigChangeCidr = fmt.Sprint(` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" diff --git a/installer/server/terraform/plugins/aws/resource_aws_s3_bucket.go b/installer/server/terraform/plugins/aws/resource_aws_s3_bucket.go index f75824af2b..7da1ac18fe 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_s3_bucket.go +++ b/installer/server/terraform/plugins/aws/resource_aws_s3_bucket.go @@ -31,8 +31,15 @@ func resourceAwsS3Bucket() *schema.Resource { Schema: map[string]*schema.Schema{ "bucket": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"bucket_prefix"}, + }, + "bucket_prefix": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, }, @@ -389,7 +396,15 @@ func resourceAwsS3BucketCreate(d *schema.ResourceData, meta interface{}) error { s3conn := meta.(*AWSClient).s3conn // Get the bucket and acl - bucket := d.Get("bucket").(string) + var bucket string + if v, ok := d.GetOk("bucket"); ok { + bucket = v.(string) + } else if v, ok := d.GetOk("bucket_prefix"); ok { + bucket = resource.PrefixedUniqueId(v.(string)) + } else { + bucket = resource.UniqueId() + } + d.Set("bucket", bucket) acl := d.Get("acl").(string) log.Printf("[DEBUG] S3 bucket create: %s, ACL: %s", bucket, acl) @@ -728,8 +743,8 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { } log.Printf("[DEBUG] S3 Bucket: %s, logging: %v", d.Id(), logging) + lcl := make([]map[string]interface{}, 0, 1) if v := logging.LoggingEnabled; v != nil { - lcl := make([]map[string]interface{}, 0, 1) lc := make(map[string]interface{}) if *v.TargetBucket != "" { lc["target_bucket"] = *v.TargetBucket @@ -738,9 +753,9 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { lc["target_prefix"] = *v.TargetPrefix } lcl = append(lcl, lc) - if err := d.Set("logging", lcl); err != nil { - return err - } + } + if err := d.Set("logging", lcl); err != nil { + return err } // Read the lifecycle configuration diff --git a/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_object.go b/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_object.go index e945a09802..968344f69e 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_object.go +++ b/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_object.go @@ -275,7 +275,7 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err Key: aws.String(key), }) if err != nil { - return err + return fmt.Errorf("Failed to get object tags (bucket: %s, key: %s): %s", bucket, key, err) } d.Set("tags", tagsToMapS3(tagResp.TagSet)) @@ -319,7 +319,7 @@ func resourceAwsS3BucketObjectDelete(d *schema.ResourceData, meta interface{}) e } _, err := s3conn.DeleteObject(&input) if err != nil { - return fmt.Errorf("Error deleting S3 bucket object: %s", err) + return fmt.Errorf("Error deleting S3 bucket object: %s Bucket: %q Object: %q", err, bucket, key) } } diff --git a/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_test.go b/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_test.go index ff18b7810a..a12c8ec543 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_s3_bucket_test.go @@ -56,6 +56,40 @@ func TestAccAWSS3Bucket_basic(t *testing.T) { }) } +func TestAccAWSS3Bucket_namePrefix(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSS3BucketDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSS3BucketConfig_namePrefix, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSS3BucketExists("aws_s3_bucket.test"), + resource.TestMatchResourceAttr( + "aws_s3_bucket.test", "bucket", regexp.MustCompile("^tf-test-")), + ), + }, + }, + }) +} + +func TestAccAWSS3Bucket_generatedName(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSS3BucketDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSS3BucketConfig_generatedName, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSS3BucketExists("aws_s3_bucket.test"), + ), + }, + }, + }) +} + func TestAccAWSS3Bucket_region(t *testing.T) { rInt := acctest.RandInt() @@ -1601,3 +1635,15 @@ resource "aws_s3_bucket" "destination" { } `, randInt, randInt, randInt) } + +const testAccAWSS3BucketConfig_namePrefix = ` +resource "aws_s3_bucket" "test" { + bucket_prefix = "tf-test-" +} +` + +const testAccAWSS3BucketConfig_generatedName = ` +resource "aws_s3_bucket" "test" { + bucket_prefix = "tf-test-" +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_security_group.go b/installer/server/terraform/plugins/aws/resource_aws_security_group.go index 4c34fea967..e702c1aa0a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_security_group.go +++ b/installer/server/terraform/plugins/aws/resource_aws_security_group.go @@ -28,7 +28,7 @@ func resourceAwsSecurityGroup() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, Computed: true, @@ -44,7 +44,7 @@ func resourceAwsSecurityGroup() *schema.Resource { }, }, - "name_prefix": &schema.Schema{ + "name_prefix": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -58,7 +58,7 @@ func resourceAwsSecurityGroup() *schema.Resource { }, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -73,49 +73,61 @@ func resourceAwsSecurityGroup() *schema.Resource { }, }, - "vpc_id": &schema.Schema{ + "vpc_id": { Type: schema.TypeString, Optional: true, ForceNew: true, Computed: true, }, - "ingress": &schema.Schema{ + "ingress": { Type: schema.TypeSet, Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "from_port": &schema.Schema{ + "from_port": { Type: schema.TypeInt, Required: true, }, - "to_port": &schema.Schema{ + "to_port": { Type: schema.TypeInt, Required: true, }, - "protocol": &schema.Schema{ + "protocol": { Type: schema.TypeString, Required: true, StateFunc: protocolStateFunc, }, - "cidr_blocks": &schema.Schema{ + "cidr_blocks": { Type: schema.TypeList, Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateCIDRNetworkAddress, + }, }, - "security_groups": &schema.Schema{ + "ipv6_cidr_blocks": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateCIDRNetworkAddress, + }, + }, + + "security_groups": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "self": &schema.Schema{ + "self": { Type: schema.TypeBool, Optional: true, Default: false, @@ -125,48 +137,60 @@ func resourceAwsSecurityGroup() *schema.Resource { Set: resourceAwsSecurityGroupRuleHash, }, - "egress": &schema.Schema{ + "egress": { Type: schema.TypeSet, Optional: true, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "from_port": &schema.Schema{ + "from_port": { Type: schema.TypeInt, Required: true, }, - "to_port": &schema.Schema{ + "to_port": { Type: schema.TypeInt, Required: true, }, - "protocol": &schema.Schema{ + "protocol": { Type: schema.TypeString, Required: true, StateFunc: protocolStateFunc, }, - "cidr_blocks": &schema.Schema{ + "cidr_blocks": { Type: schema.TypeList, Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateCIDRNetworkAddress, + }, + }, + + "ipv6_cidr_blocks": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateCIDRNetworkAddress, + }, }, - "prefix_list_ids": &schema.Schema{ + "prefix_list_ids": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "security_groups": &schema.Schema{ + "security_groups": { Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "self": &schema.Schema{ + "self": { Type: schema.TypeBool, Optional: true, Default: false, @@ -176,7 +200,7 @@ func resourceAwsSecurityGroup() *schema.Resource { Set: resourceAwsSecurityGroupRuleHash, }, - "owner_id": &schema.Schema{ + "owner_id": { Type: schema.TypeString, Computed: true, }, @@ -252,11 +276,11 @@ func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) er req := &ec2.RevokeSecurityGroupEgressInput{ GroupId: createResp.GroupId, IpPermissions: []*ec2.IpPermission{ - &ec2.IpPermission{ + { FromPort: aws.Int64(int64(0)), ToPort: aws.Int64(int64(0)), IpRanges: []*ec2.IpRange{ - &ec2.IpRange{ + { CidrIp: aws.String("0.0.0.0/0"), }, }, @@ -412,6 +436,18 @@ func resourceAwsSecurityGroupRuleHash(v interface{}) int { buf.WriteString(fmt.Sprintf("%s-", v)) } } + if v, ok := m["ipv6_cidr_blocks"]; ok { + vs := v.([]interface{}) + s := make([]string, len(vs)) + for i, raw := range vs { + s[i] = raw.(string) + } + sort.Strings(s) + + for _, v := range s { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + } if v, ok := m["prefix_list_ids"]; ok { vs := v.([]interface{}) s := make([]string, len(vs)) @@ -476,6 +512,20 @@ func resourceAwsSecurityGroupIPPermGather(groupId string, permissions []*ec2.IpP m["cidr_blocks"] = list } + if len(perm.Ipv6Ranges) > 0 { + raw, ok := m["ipv6_cidr_blocks"] + if !ok { + raw = make([]string, 0, len(perm.Ipv6Ranges)) + } + list := raw.([]string) + + for _, ip := range perm.Ipv6Ranges { + list = append(list, *ip.CidrIpv6) + } + + m["ipv6_cidr_blocks"] = list + } + if len(perm.PrefixListIds) > 0 { raw, ok := m["prefix_list_ids"] if !ok { @@ -699,8 +749,9 @@ func matchRules(rType string, local []interface{}, remote []map[string]interface // local rule we're examining rHash := idHash(rType, r["protocol"].(string), r["to_port"].(int64), r["from_port"].(int64), remoteSelfVal) if rHash == localHash { - var numExpectedCidrs, numExpectedPrefixLists, numExpectedSGs, numRemoteCidrs, numRemotePrefixLists, numRemoteSGs int + var numExpectedCidrs, numExpectedIpv6Cidrs, numExpectedPrefixLists, numExpectedSGs, numRemoteCidrs, numRemoteIpv6Cidrs, numRemotePrefixLists, numRemoteSGs int var matchingCidrs []string + var matchingIpv6Cidrs []string var matchingSGs []string var matchingPrefixLists []string @@ -710,6 +761,10 @@ func matchRules(rType string, local []interface{}, remote []map[string]interface if ok { numExpectedCidrs = len(l["cidr_blocks"].([]interface{})) } + liRaw, ok := l["ipv6_cidr_blocks"] + if ok { + numExpectedIpv6Cidrs = len(l["ipv6_cidr_blocks"].([]interface{})) + } lpRaw, ok := l["prefix_list_ids"] if ok { numExpectedPrefixLists = len(l["prefix_list_ids"].([]interface{})) @@ -723,6 +778,10 @@ func matchRules(rType string, local []interface{}, remote []map[string]interface if ok { numRemoteCidrs = len(r["cidr_blocks"].([]string)) } + riRaw, ok := r["ipv6_cidr_blocks"] + if ok { + numRemoteIpv6Cidrs = len(r["ipv6_cidr_blocks"].([]string)) + } rpRaw, ok := r["prefix_list_ids"] if ok { numRemotePrefixLists = len(r["prefix_list_ids"].([]string)) @@ -738,6 +797,10 @@ func matchRules(rType string, local []interface{}, remote []map[string]interface log.Printf("[DEBUG] Local rule has more CIDR blocks, continuing (%d/%d)", numExpectedCidrs, numRemoteCidrs) continue } + if numExpectedIpv6Cidrs > numRemoteIpv6Cidrs { + log.Printf("[DEBUG] Local rule has more IPV6 CIDR blocks, continuing (%d/%d)", numExpectedIpv6Cidrs, numRemoteIpv6Cidrs) + continue + } if numExpectedPrefixLists > numRemotePrefixLists { log.Printf("[DEBUG] Local rule has more prefix lists, continuing (%d/%d)", numExpectedPrefixLists, numRemotePrefixLists) continue @@ -775,6 +838,29 @@ func matchRules(rType string, local []interface{}, remote []map[string]interface } } + //IPV6 CIDRs + var localIpv6Cidrs []interface{} + if liRaw != nil { + localIpv6Cidrs = liRaw.([]interface{}) + } + localIpv6CidrSet := schema.NewSet(schema.HashString, localIpv6Cidrs) + + var remoteIpv6Cidrs []string + if riRaw != nil { + remoteIpv6Cidrs = riRaw.([]string) + } + var listIpv6 []interface{} + for _, s := range remoteIpv6Cidrs { + listIpv6 = append(listIpv6, s) + } + remoteIpv6CidrSet := schema.NewSet(schema.HashString, listIpv6) + + for _, s := range localIpv6CidrSet.List() { + if remoteIpv6CidrSet.Contains(s) { + matchingIpv6Cidrs = append(matchingIpv6Cidrs, s.(string)) + } + } + // match prefix lists by converting both to sets, and using Set methods var localPrefixLists []interface{} if lpRaw != nil { @@ -830,73 +916,93 @@ func matchRules(rType string, local []interface{}, remote []map[string]interface // match, and then remove those elements from the remote rule, so that // this remote rule can still be considered by other local rules if numExpectedCidrs == len(matchingCidrs) { - if numExpectedPrefixLists == len(matchingPrefixLists) { - if numExpectedSGs == len(matchingSGs) { - // confirm that self references match - var lSelf bool - var rSelf bool - if _, ok := l["self"]; ok { - lSelf = l["self"].(bool) - } - if _, ok := r["self"]; ok { - rSelf = r["self"].(bool) - } - if rSelf == lSelf { - delete(r, "self") - // pop local cidrs from remote - diffCidr := remoteCidrSet.Difference(localCidrSet) - var newCidr []string - for _, cRaw := range diffCidr.List() { - newCidr = append(newCidr, cRaw.(string)) + if numExpectedIpv6Cidrs == len(matchingIpv6Cidrs) { + if numExpectedPrefixLists == len(matchingPrefixLists) { + if numExpectedSGs == len(matchingSGs) { + // confirm that self references match + var lSelf bool + var rSelf bool + if _, ok := l["self"]; ok { + lSelf = l["self"].(bool) } - - // reassigning - if len(newCidr) > 0 { - r["cidr_blocks"] = newCidr - } else { - delete(r, "cidr_blocks") + if _, ok := r["self"]; ok { + rSelf = r["self"].(bool) } - - // pop local prefix lists from remote - diffPrefixLists := remotePrefixListsSet.Difference(localPrefixListsSet) - var newPrefixLists []string - for _, pRaw := range diffPrefixLists.List() { - newPrefixLists = append(newPrefixLists, pRaw.(string)) - } - - // reassigning - if len(newPrefixLists) > 0 { - r["prefix_list_ids"] = newPrefixLists - } else { - delete(r, "prefix_list_ids") + if rSelf == lSelf { + delete(r, "self") + // pop local cidrs from remote + diffCidr := remoteCidrSet.Difference(localCidrSet) + var newCidr []string + for _, cRaw := range diffCidr.List() { + newCidr = append(newCidr, cRaw.(string)) + } + + // reassigning + if len(newCidr) > 0 { + r["cidr_blocks"] = newCidr + } else { + delete(r, "cidr_blocks") + } + + //// IPV6 + //// Comparison + diffIpv6Cidr := remoteIpv6CidrSet.Difference(localIpv6CidrSet) + var newIpv6Cidr []string + for _, cRaw := range diffIpv6Cidr.List() { + newIpv6Cidr = append(newIpv6Cidr, cRaw.(string)) + } + + // reassigning + if len(newIpv6Cidr) > 0 { + r["ipv6_cidr_blocks"] = newIpv6Cidr + } else { + delete(r, "ipv6_cidr_blocks") + } + + // pop local prefix lists from remote + diffPrefixLists := remotePrefixListsSet.Difference(localPrefixListsSet) + var newPrefixLists []string + for _, pRaw := range diffPrefixLists.List() { + newPrefixLists = append(newPrefixLists, pRaw.(string)) + } + + // reassigning + if len(newPrefixLists) > 0 { + r["prefix_list_ids"] = newPrefixLists + } else { + delete(r, "prefix_list_ids") + } + + // pop local sgs from remote + diffSGs := remoteSGSet.Difference(localSGSet) + if len(diffSGs.List()) > 0 { + r["security_groups"] = diffSGs + } else { + delete(r, "security_groups") + } + + saves = append(saves, l) } - - // pop local sgs from remote - diffSGs := remoteSGSet.Difference(localSGSet) - if len(diffSGs.List()) > 0 { - r["security_groups"] = diffSGs - } else { - delete(r, "security_groups") - } - - saves = append(saves, l) } } + } } } } } - // Here we catch any remote rules that have not been stripped of all self, // cidrs, and security groups. We'll add remote rules here that have not been // matched locally, and let the graph sort things out. This will happen when // rules are added externally to Terraform for _, r := range remote { - var lenCidr, lenPrefixLists, lenSGs int + var lenCidr, lenIpv6Cidr, lenPrefixLists, lenSGs int if rCidrs, ok := r["cidr_blocks"]; ok { lenCidr = len(rCidrs.([]string)) } + if rIpv6Cidrs, ok := r["ipv6_cidr_blocks"]; ok { + lenIpv6Cidr = len(rIpv6Cidrs.([]string)) + } if rPrefixLists, ok := r["prefix_list_ids"]; ok { lenPrefixLists = len(rPrefixLists.([]string)) } @@ -910,7 +1016,7 @@ func matchRules(rType string, local []interface{}, remote []map[string]interface } } - if lenSGs+lenCidr+lenPrefixLists > 0 { + if lenSGs+lenCidr+lenIpv6Cidr+lenPrefixLists > 0 { log.Printf("[DEBUG] Found a remote Rule that wasn't empty: (%#v)", r) saves = append(saves, r) } @@ -1003,15 +1109,15 @@ func deleteLingeringLambdaENIs(conn *ec2.EC2, d *schema.ResourceData) error { // Here we carefully find the offenders params := &ec2.DescribeNetworkInterfacesInput{ Filters: []*ec2.Filter{ - &ec2.Filter{ + { Name: aws.String("group-id"), Values: []*string{aws.String(d.Id())}, }, - &ec2.Filter{ + { Name: aws.String("description"), Values: []*string{aws.String("AWS Lambda VPC ENI: *")}, }, - &ec2.Filter{ + { Name: aws.String("requester-id"), Values: []*string{aws.String("*:awslambda_*")}, }, diff --git a/installer/server/terraform/plugins/aws/resource_aws_security_group_rule.go b/installer/server/terraform/plugins/aws/resource_aws_security_group_rule.go index f110f98ea8..1372bc83d1 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_security_group_rule.go +++ b/installer/server/terraform/plugins/aws/resource_aws_security_group_rule.go @@ -58,7 +58,20 @@ func resourceAwsSecurityGroupRule() *schema.Resource { Type: schema.TypeList, Optional: true, ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateCIDRNetworkAddress, + }, + }, + + "ipv6_cidr_blocks": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateCIDRNetworkAddress, + }, }, "prefix_list_ids": { @@ -400,6 +413,19 @@ func findRuleMatch(p *ec2.IpPermission, rules []*ec2.IpPermission, isVPC bool) * continue } + remaining = len(p.Ipv6Ranges) + for _, ipv6 := range p.Ipv6Ranges { + for _, ipv6ip := range r.Ipv6Ranges { + if *ipv6.CidrIpv6 == *ipv6ip.CidrIpv6 { + remaining-- + } + } + } + + if remaining > 0 { + continue + } + remaining = len(p.PrefixListIds) for _, pl := range p.PrefixListIds { for _, rpl := range r.PrefixListIds { @@ -463,6 +489,18 @@ func ipPermissionIDHash(sg_id, ruleType string, ip *ec2.IpPermission) string { } } + if len(ip.Ipv6Ranges) > 0 { + s := make([]string, len(ip.Ipv6Ranges)) + for i, r := range ip.Ipv6Ranges { + s[i] = *r.CidrIpv6 + } + sort.Strings(s) + + for _, v := range s { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + } + if len(ip.PrefixListIds) > 0 { s := make([]string, len(ip.PrefixListIds)) for i, pl := range ip.PrefixListIds { @@ -555,6 +593,18 @@ func expandIPPerm(d *schema.ResourceData, sg *ec2.SecurityGroup) (*ec2.IpPermiss } } + if raw, ok := d.GetOk("ipv6_cidr_blocks"); ok { + list := raw.([]interface{}) + perm.Ipv6Ranges = make([]*ec2.Ipv6Range, len(list)) + for i, v := range list { + cidrIP, ok := v.(string) + if !ok { + return nil, fmt.Errorf("empty element found in ipv6_cidr_blocks - consider using the compact function") + } + perm.Ipv6Ranges[i] = &ec2.Ipv6Range{CidrIpv6: aws.String(cidrIP)} + } + } + if raw, ok := d.GetOk("prefix_list_ids"); ok { list := raw.([]interface{}) perm.PrefixListIds = make([]*ec2.PrefixListId, len(list)) @@ -584,6 +634,12 @@ func setFromIPPerm(d *schema.ResourceData, sg *ec2.SecurityGroup, rule *ec2.IpPe d.Set("cidr_blocks", cb) + var ipv6 []string + for _, ip := range rule.Ipv6Ranges { + ipv6 = append(ipv6, *ip.CidrIpv6) + } + d.Set("ipv6_cidr_blocks", ipv6) + var pl []string for _, p := range rule.PrefixListIds { pl = append(pl, *p.PrefixListId) @@ -603,15 +659,16 @@ func setFromIPPerm(d *schema.ResourceData, sg *ec2.SecurityGroup, rule *ec2.IpPe return nil } -// Validates that either 'cidr_blocks', 'self', or 'source_security_group_id' is set +// Validates that either 'cidr_blocks', 'ipv6_cidr_blocks', 'self', or 'source_security_group_id' is set func validateAwsSecurityGroupRule(d *schema.ResourceData) error { _, blocksOk := d.GetOk("cidr_blocks") + _, ipv6Ok := d.GetOk("ipv6_cidr_blocks") _, sourceOk := d.GetOk("source_security_group_id") _, selfOk := d.GetOk("self") _, prefixOk := d.GetOk("prefix_list_ids") - if !blocksOk && !sourceOk && !selfOk && !prefixOk { + if !blocksOk && !sourceOk && !selfOk && !prefixOk && !ipv6Ok { return fmt.Errorf( - "One of ['cidr_blocks', 'self', 'source_security_group_id', 'prefix_list_ids'] must be set to create an AWS Security Group Rule") + "One of ['cidr_blocks', 'ipv6_cidr_blocks', 'self', 'source_security_group_id', 'prefix_list_ids'] must be set to create an AWS Security Group Rule") } return nil } diff --git a/installer/server/terraform/plugins/aws/resource_aws_security_group_rule_test.go b/installer/server/terraform/plugins/aws/resource_aws_security_group_rule_test.go index 424e2a40fb..2992763040 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_security_group_rule_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_security_group_rule_test.go @@ -52,15 +52,15 @@ func TestIpPermissionIDHash(t *testing.T) { FromPort: aws.Int64(int64(80)), ToPort: aws.Int64(int64(8000)), UserIdGroupPairs: []*ec2.UserIdGroupPair{ - &ec2.UserIdGroupPair{ + { UserId: aws.String("987654321"), GroupId: aws.String("sg-12345678"), }, - &ec2.UserIdGroupPair{ + { UserId: aws.String("123456789"), GroupId: aws.String("sg-987654321"), }, - &ec2.UserIdGroupPair{ + { UserId: aws.String("123456789"), GroupId: aws.String("sg-12345678"), }, @@ -72,15 +72,15 @@ func TestIpPermissionIDHash(t *testing.T) { FromPort: aws.Int64(int64(80)), ToPort: aws.Int64(int64(8000)), UserIdGroupPairs: []*ec2.UserIdGroupPair{ - &ec2.UserIdGroupPair{ + { UserId: aws.String("987654321"), GroupName: aws.String("my-security-group"), }, - &ec2.UserIdGroupPair{ + { UserId: aws.String("123456789"), GroupName: aws.String("my-security-group"), }, - &ec2.UserIdGroupPair{ + { UserId: aws.String("123456789"), GroupName: aws.String("my-other-security-group"), }, @@ -183,6 +183,46 @@ func TestAccAWSSecurityGroupRule_Ingress_Protocol(t *testing.T) { }) } +func TestAccAWSSecurityGroupRule_Ingress_Ipv6(t *testing.T) { + var group ec2.SecurityGroup + + testRuleCount := func(*terraform.State) error { + if len(group.IpPermissions) != 1 { + return fmt.Errorf("Wrong Security Group rule count, expected %d, got %d", + 1, len(group.IpPermissions)) + } + + rule := group.IpPermissions[0] + if *rule.FromPort != int64(80) { + return fmt.Errorf("Wrong Security Group port setting, expected %d, got %d", + 80, int(*rule.FromPort)) + } + + ipv6Address := rule.Ipv6Ranges[0] + if *ipv6Address.CidrIpv6 != "::/0" { + return fmt.Errorf("Wrong Security Group IPv6 address, expected %s, got %s", + "::/0", *ipv6Address.CidrIpv6) + } + + return nil + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityGroupRuleIngress_ipv6Config, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityGroupRuleExists("aws_security_group.web", &group), + testRuleCount, + ), + }, + }, + }) +} + func TestAccAWSSecurityGroupRule_Ingress_Classic(t *testing.T) { var group ec2.SecurityGroup rInt := acctest.RandInt() @@ -314,6 +354,25 @@ func TestAccAWSSecurityGroupRule_ExpectInvalidTypeError(t *testing.T) { }) } +func TestAccAWSSecurityGroupRule_ExpectInvalidCIDR(t *testing.T) { + rInt := acctest.RandInt() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityGroupRuleInvalidIPv4CIDR(rInt), + ExpectError: regexp.MustCompile("invalid CIDR address: 1.2.3.4/33"), + }, + { + Config: testAccAWSSecurityGroupRuleInvalidIPv6CIDR(rInt), + ExpectError: regexp.MustCompile("invalid CIDR address: ::/244"), + }, + }, + }) +} + // testing partial match implementation func TestAccAWSSecurityGroupRule_PartialMatching_basic(t *testing.T) { var group ec2.SecurityGroup @@ -376,7 +435,7 @@ func TestAccAWSSecurityGroupRule_PartialMatching_Source(t *testing.T) { ToPort: aws.Int64(80), IpProtocol: aws.String("tcp"), UserIdGroupPairs: []*ec2.UserIdGroupPair{ - &ec2.UserIdGroupPair{GroupId: nat.GroupId}, + {GroupId: nat.GroupId}, }, } @@ -696,6 +755,34 @@ func testAccAWSSecurityGroupRuleIngressConfig(rInt int) string { }`, rInt) } +const testAccAWSSecurityGroupRuleIngress_ipv6Config = ` +resource "aws_vpc" "tftest" { + cidr_block = "10.0.0.0/16" + + tags { + Name = "tf-testing" + } +} + +resource "aws_security_group" "web" { + vpc_id = "${aws_vpc.tftest.id}" + + tags { + Name = "tf-acc-test" + } +} + +resource "aws_security_group_rule" "ingress_1" { + type = "ingress" + protocol = "6" + from_port = 80 + to_port = 8000 + ipv6_cidr_blocks = ["::/0"] + + security_group_id = "${aws_security_group.web.id}" +} +` + const testAccAWSSecurityGroupRuleIngress_protocolConfig = ` resource "aws_vpc" "tftest" { cidr_block = "10.0.0.0/16" @@ -1098,3 +1185,35 @@ func testAccAWSSecurityGroupRuleExpectInvalidType(rInt int) string { source_security_group_id = "${aws_security_group.web.id}" }`, rInt) } + +func testAccAWSSecurityGroupRuleInvalidIPv4CIDR(rInt int) string { + return fmt.Sprintf(` +resource "aws_security_group" "foo" { + name = "testing-failure-%d" +} + +resource "aws_security_group_rule" "ing" { + type = "ingress" + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["1.2.3.4/33"] + security_group_id = "${aws_security_group.foo.id}" +}`, rInt) +} + +func testAccAWSSecurityGroupRuleInvalidIPv6CIDR(rInt int) string { + return fmt.Sprintf(` +resource "aws_security_group" "foo" { + name = "testing-failure-%d" +} + +resource "aws_security_group_rule" "ing" { + type = "egress" + from_port = 0 + to_port = 0 + protocol = "-1" + ipv6_cidr_blocks = ["::/244"] + security_group_id = "${aws_security_group.foo.id}" +}`, rInt) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_security_group_test.go b/installer/server/terraform/plugins/aws/resource_aws_security_group_test.go index 4c40537709..f5a4f8d169 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_security_group_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_security_group_test.go @@ -135,54 +135,54 @@ func TestProtocolForValue(t *testing.T) { func TestResourceAwsSecurityGroupIPPermGather(t *testing.T) { raw := []*ec2.IpPermission{ - &ec2.IpPermission{ + { IpProtocol: aws.String("tcp"), FromPort: aws.Int64(int64(1)), ToPort: aws.Int64(int64(-1)), - IpRanges: []*ec2.IpRange{&ec2.IpRange{CidrIp: aws.String("0.0.0.0/0")}}, + IpRanges: []*ec2.IpRange{{CidrIp: aws.String("0.0.0.0/0")}}, UserIdGroupPairs: []*ec2.UserIdGroupPair{ - &ec2.UserIdGroupPair{ + { GroupId: aws.String("sg-11111"), }, }, }, - &ec2.IpPermission{ + { IpProtocol: aws.String("tcp"), FromPort: aws.Int64(int64(80)), ToPort: aws.Int64(int64(80)), UserIdGroupPairs: []*ec2.UserIdGroupPair{ // VPC - &ec2.UserIdGroupPair{ + { GroupId: aws.String("sg-22222"), }, }, }, - &ec2.IpPermission{ + { IpProtocol: aws.String("tcp"), FromPort: aws.Int64(int64(443)), ToPort: aws.Int64(int64(443)), UserIdGroupPairs: []*ec2.UserIdGroupPair{ // Classic - &ec2.UserIdGroupPair{ + { UserId: aws.String("12345"), GroupId: aws.String("sg-33333"), GroupName: aws.String("ec2_classic"), }, - &ec2.UserIdGroupPair{ + { UserId: aws.String("amazon-elb"), GroupId: aws.String("sg-d2c979d3"), GroupName: aws.String("amazon-elb-sg"), }, }, }, - &ec2.IpPermission{ + { IpProtocol: aws.String("-1"), FromPort: aws.Int64(int64(0)), ToPort: aws.Int64(int64(0)), - PrefixListIds: []*ec2.PrefixListId{&ec2.PrefixListId{PrefixListId: aws.String("pl-12345678")}}, + PrefixListIds: []*ec2.PrefixListId{{PrefixListId: aws.String("pl-12345678")}}, UserIdGroupPairs: []*ec2.UserIdGroupPair{ // VPC - &ec2.UserIdGroupPair{ + { GroupId: aws.String("sg-22222"), }, }, @@ -190,14 +190,14 @@ func TestResourceAwsSecurityGroupIPPermGather(t *testing.T) { } local := []map[string]interface{}{ - map[string]interface{}{ + { "protocol": "tcp", "from_port": int64(1), "to_port": int64(-1), "cidr_blocks": []string{"0.0.0.0/0"}, "self": true, }, - map[string]interface{}{ + { "protocol": "tcp", "from_port": int64(80), "to_port": int64(80), @@ -205,7 +205,7 @@ func TestResourceAwsSecurityGroupIPPermGather(t *testing.T) { "sg-22222", }), }, - map[string]interface{}{ + { "protocol": "tcp", "from_port": int64(443), "to_port": int64(443), @@ -214,7 +214,7 @@ func TestResourceAwsSecurityGroupIPPermGather(t *testing.T) { "amazon-elb/amazon-elb-sg", }), }, - map[string]interface{}{ + { "protocol": "-1", "from_port": int64(0), "to_port": int64(0), @@ -263,7 +263,7 @@ func TestAccAWSSecurityGroup_basic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -288,6 +288,39 @@ func TestAccAWSSecurityGroup_basic(t *testing.T) { }) } +func TestAccAWSSecurityGroup_ipv6(t *testing.T) { + var group ec2.SecurityGroup + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_security_group.web", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityGroupConfigIpv6, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), + resource.TestCheckResourceAttr( + "aws_security_group.web", "name", "terraform_acceptance_test_example"), + resource.TestCheckResourceAttr( + "aws_security_group.web", "description", "Used in the terraform acceptance tests"), + resource.TestCheckResourceAttr( + "aws_security_group.web", "ingress.2293451516.protocol", "tcp"), + resource.TestCheckResourceAttr( + "aws_security_group.web", "ingress.2293451516.from_port", "80"), + resource.TestCheckResourceAttr( + "aws_security_group.web", "ingress.2293451516.to_port", "8000"), + resource.TestCheckResourceAttr( + "aws_security_group.web", "ingress.2293451516.ipv6_cidr_blocks.#", "1"), + resource.TestCheckResourceAttr( + "aws_security_group.web", "ingress.2293451516.ipv6_cidr_blocks.0", "::/0"), + ), + }, + }, + }) +} + func TestAccAWSSecurityGroup_tagsCreatedFirst(t *testing.T) { var group ec2.SecurityGroup @@ -296,7 +329,7 @@ func TestAccAWSSecurityGroup_tagsCreatedFirst(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigForTagsOrdering, ExpectError: regexp.MustCompile("InvalidParameterValue"), Check: resource.ComposeTestCheckFunc( @@ -318,7 +351,7 @@ func TestAccAWSSecurityGroup_namePrefix(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupPrefixNameConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.baz", &group), @@ -353,7 +386,7 @@ func TestAccAWSSecurityGroup_self(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigSelf, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -393,7 +426,7 @@ func TestAccAWSSecurityGroup_vpc(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigVpc, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -446,7 +479,7 @@ func TestAccAWSSecurityGroup_vpcNegOneIngress(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigVpcNegOneIngress, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -488,7 +521,7 @@ func TestAccAWSSecurityGroup_vpcProtoNumIngress(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigVpcProtoNumIngress, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -521,7 +554,7 @@ func TestAccAWSSecurityGroup_MultiIngress(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigMultiIngress, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -540,13 +573,13 @@ func TestAccAWSSecurityGroup_Change(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), ), }, - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigChange, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -566,7 +599,7 @@ func TestAccAWSSecurityGroup_generatedName(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_generatedName, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -596,7 +629,7 @@ func TestAccAWSSecurityGroup_DefaultEgress_VPC(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigDefaultEgress, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExistsWithoutDefault("aws_security_group.worker"), @@ -616,7 +649,7 @@ func TestAccAWSSecurityGroup_DefaultEgress_Classic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigClassic, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -634,7 +667,7 @@ func TestAccAWSSecurityGroup_drift(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_drift(), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -664,7 +697,7 @@ func TestAccAWSSecurityGroup_drift_complex(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_drift_complex(), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -686,6 +719,32 @@ func TestAccAWSSecurityGroup_drift_complex(t *testing.T) { }) } +func TestAccAWSSecurityGroup_invalidCIDRBlock(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSecurityGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSecurityGroupInvalidIngressCidr, + ExpectError: regexp.MustCompile("invalid CIDR address: 1.2.3.4/33"), + }, + { + Config: testAccAWSSecurityGroupInvalidEgressCidr, + ExpectError: regexp.MustCompile("invalid CIDR address: 1.2.3.4/33"), + }, + { + Config: testAccAWSSecurityGroupInvalidIPv6IngressCidr, + ExpectError: regexp.MustCompile("invalid CIDR address: ::/244"), + }, + { + Config: testAccAWSSecurityGroupInvalidIPv6EgressCidr, + ExpectError: regexp.MustCompile("invalid CIDR address: ::/244"), + }, + }, + }) +} + func testAccCheckAWSSecurityGroupDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ec2conn @@ -773,7 +832,7 @@ func testAccCheckAWSSecurityGroupAttributes(group *ec2.SecurityGroup) resource.T FromPort: aws.Int64(80), ToPort: aws.Int64(8000), IpProtocol: aws.String("tcp"), - IpRanges: []*ec2.IpRange{&ec2.IpRange{CidrIp: aws.String("10.0.0.0/8")}}, + IpRanges: []*ec2.IpRange{{CidrIp: aws.String("10.0.0.0/8")}}, } if *group.GroupName != "terraform_acceptance_test_example" { @@ -804,7 +863,7 @@ func testAccCheckAWSSecurityGroupAttributesNegOneProtocol(group *ec2.SecurityGro return func(s *terraform.State) error { p := &ec2.IpPermission{ IpProtocol: aws.String("-1"), - IpRanges: []*ec2.IpRange{&ec2.IpRange{CidrIp: aws.String("10.0.0.0/8")}}, + IpRanges: []*ec2.IpRange{{CidrIp: aws.String("10.0.0.0/8")}}, } if *group.GroupName != "terraform_acceptance_test_example" { @@ -839,7 +898,7 @@ func TestAccAWSSecurityGroup_tags(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigTags, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.foo", &group), @@ -847,7 +906,7 @@ func TestAccAWSSecurityGroup_tags(t *testing.T) { ), }, - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigTagsUpdate, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.foo", &group), @@ -868,7 +927,7 @@ func TestAccAWSSecurityGroup_CIDRandGroups(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupCombindCIDRandGroups, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.mixed", &group), @@ -887,7 +946,7 @@ func TestAccAWSSecurityGroup_ingressWithCidrAndSGs(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_ingressWithCidrAndSGs, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -913,7 +972,7 @@ func TestAccAWSSecurityGroup_ingressWithCidrAndSGs_classic(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_ingressWithCidrAndSGs_classic, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.web", &group), @@ -938,7 +997,7 @@ func TestAccAWSSecurityGroup_egressWithPrefixList(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfigPrefixListEgress, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.egress", &group), @@ -1016,21 +1075,21 @@ func testAccCheckAWSSecurityGroupPrefixListAttributes(group *ec2.SecurityGroup) func testAccCheckAWSSecurityGroupAttributesChanged(group *ec2.SecurityGroup) resource.TestCheckFunc { return func(s *terraform.State) error { p := []*ec2.IpPermission{ - &ec2.IpPermission{ + { FromPort: aws.Int64(80), ToPort: aws.Int64(9000), IpProtocol: aws.String("tcp"), - IpRanges: []*ec2.IpRange{&ec2.IpRange{CidrIp: aws.String("10.0.0.0/8")}}, + IpRanges: []*ec2.IpRange{{CidrIp: aws.String("10.0.0.0/8")}}, }, - &ec2.IpPermission{ + { FromPort: aws.Int64(80), ToPort: aws.Int64(8000), IpProtocol: aws.String("tcp"), IpRanges: []*ec2.IpRange{ - &ec2.IpRange{ + { CidrIp: aws.String("0.0.0.0/0"), }, - &ec2.IpRange{ + { CidrIp: aws.String("10.0.0.0/8"), }, }, @@ -1109,7 +1168,7 @@ func TestAccAWSSecurityGroup_failWithDiffMismatch(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccAWSSecurityGroupConfig_failWithDiffMismatch, Check: resource.ComposeTestCheckFunc( testAccCheckAWSSecurityGroupExists("aws_security_group.nat", &group), @@ -1148,6 +1207,36 @@ resource "aws_security_group" "web" { } }` +const testAccAWSSecurityGroupConfigIpv6 = ` +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_security_group" "web" { + name = "terraform_acceptance_test_example" + description = "Used in the terraform acceptance tests" + vpc_id = "${aws_vpc.foo.id}" + + ingress { + protocol = "6" + from_port = 80 + to_port = 8000 + ipv6_cidr_blocks = ["::/0"] + } + + egress { + protocol = "tcp" + from_port = 80 + to_port = 8000 + ipv6_cidr_blocks = ["::/0"] + } + + tags { + Name = "tf-acc-test" + } +} +` + const testAccAWSSecurityGroupConfig = ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" @@ -1586,6 +1675,54 @@ resource "aws_security_group" "web" { }`, acctest.RandInt(), acctest.RandInt()) } +const testAccAWSSecurityGroupInvalidIngressCidr = ` +resource "aws_security_group" "foo" { + name = "testing-foo" + description = "foo-testing" + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["1.2.3.4/33"] + } +}` + +const testAccAWSSecurityGroupInvalidEgressCidr = ` +resource "aws_security_group" "foo" { + name = "testing-foo" + description = "foo-testing" + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["1.2.3.4/33"] + } +}` + +const testAccAWSSecurityGroupInvalidIPv6IngressCidr = ` +resource "aws_security_group" "foo" { + name = "testing-foo" + description = "foo-testing" + ingress { + from_port = 0 + to_port = 0 + protocol = "-1" + ipv6_cidr_blocks = ["::/244"] + } +}` + +const testAccAWSSecurityGroupInvalidIPv6EgressCidr = ` +resource "aws_security_group" "foo" { + name = "testing-foo" + description = "foo-testing" + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + ipv6_cidr_blocks = ["::/244"] + } +}` + const testAccAWSSecurityGroupCombindCIDRandGroups = ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" @@ -1858,6 +1995,91 @@ resource "aws_security_group_rule" "allow_test_group_3" { } ` +const testAccAWSSecurityGroupConfig_importIPRangeAndSecurityGroupWithSameRules = ` +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" + + tags { + Name = "tf_sg_import_test" + } +} + +resource "aws_security_group" "test_group_1" { + name = "test group 1" + vpc_id = "${aws_vpc.foo.id}" +} + +resource "aws_security_group" "test_group_2" { + name = "test group 2" + vpc_id = "${aws_vpc.foo.id}" +} + +resource "aws_security_group_rule" "allow_security_group" { + type = "ingress" + from_port = 0 + to_port = 0 + protocol = "tcp" + + source_security_group_id = "${aws_security_group.test_group_2.id}" + security_group_id = "${aws_security_group.test_group_1.id}" +} + +resource "aws_security_group_rule" "allow_cidr_block" { + type = "ingress" + from_port = 0 + to_port = 0 + protocol = "tcp" + + cidr_blocks = ["10.0.0.0/32"] + security_group_id = "${aws_security_group.test_group_1.id}" +} + +resource "aws_security_group_rule" "allow_ipv6_cidr_block" { + type = "ingress" + from_port = 0 + to_port = 0 + protocol = "tcp" + + ipv6_cidr_blocks = ["::/0"] + security_group_id = "${aws_security_group.test_group_1.id}" +} +` + +const testAccAWSSecurityGroupConfig_importIPRangesWithSameRules = ` +resource "aws_vpc" "foo" { + cidr_block = "10.1.0.0/16" + + tags { + Name = "tf_sg_import_test" + } +} + +resource "aws_security_group" "test_group_1" { + name = "test group 1" + vpc_id = "${aws_vpc.foo.id}" +} + +resource "aws_security_group_rule" "allow_cidr_block" { + type = "ingress" + from_port = 0 + to_port = 0 + protocol = "tcp" + + cidr_blocks = ["10.0.0.0/32"] + security_group_id = "${aws_security_group.test_group_1.id}" +} + +resource "aws_security_group_rule" "allow_ipv6_cidr_block" { + type = "ingress" + from_port = 0 + to_port = 0 + protocol = "tcp" + + ipv6_cidr_blocks = ["::/0"] + security_group_id = "${aws_security_group.test_group_1.id}" +} +` + const testAccAWSSecurityGroupConfigPrefixListEgress = ` resource "aws_vpc" "tf_sg_prefix_list_egress_test" { cidr_block = "10.0.0.0/16" diff --git a/installer/server/terraform/plugins/aws/resource_aws_ses_configuration_set_test.go b/installer/server/terraform/plugins/aws/resource_aws_ses_configuration_set_test.go index 7cbbe4232e..5a5bd1ec8a 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ses_configuration_set_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ses_configuration_set_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/service/ses" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -42,7 +43,7 @@ func testAccCheckSESConfigurationSetDestroy(s *terraform.State) error { found := false for _, element := range response.ConfigurationSets { - if *element.Name == "some-configuration-set" { + if *element.Name == fmt.Sprintf("some-configuration-set-%d", escRandomInteger) { found = true } } @@ -77,7 +78,7 @@ func testAccCheckAwsSESConfigurationSetExists(n string) resource.TestCheckFunc { found := false for _, element := range response.ConfigurationSets { - if *element.Name == "some-configuration-set" { + if *element.Name == fmt.Sprintf("some-configuration-set-%d", escRandomInteger) { found = true } } @@ -90,8 +91,9 @@ func testAccCheckAwsSESConfigurationSetExists(n string) resource.TestCheckFunc { } } -const testAccAWSSESConfigurationSetConfig = ` +var escRandomInteger = acctest.RandInt() +var testAccAWSSESConfigurationSetConfig = fmt.Sprintf(` resource "aws_ses_configuration_set" "test" { - name = "some-configuration-set" + name = "some-configuration-set-%d" } -` +`, escRandomInteger) diff --git a/installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity.go b/installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity.go new file mode 100644 index 0000000000..7eba7a1873 --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity.go @@ -0,0 +1,99 @@ +package aws + +import ( + "fmt" + "log" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ses" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsSesDomainIdentity() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsSesDomainIdentityCreate, + Read: resourceAwsSesDomainIdentityRead, + Delete: resourceAwsSesDomainIdentityDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "domain": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "verification_token": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceAwsSesDomainIdentityCreate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).sesConn + + domainName := d.Get("domain").(string) + + createOpts := &ses.VerifyDomainIdentityInput{ + Domain: aws.String(domainName), + } + + _, err := conn.VerifyDomainIdentity(createOpts) + if err != nil { + return fmt.Errorf("Error requesting SES domain identity verification: %s", err) + } + + d.SetId(domainName) + + return resourceAwsSesDomainIdentityRead(d, meta) +} + +func resourceAwsSesDomainIdentityRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).sesConn + + domainName := d.Id() + d.Set("domain", domainName) + + readOpts := &ses.GetIdentityVerificationAttributesInput{ + Identities: []*string{ + aws.String(domainName), + }, + } + + response, err := conn.GetIdentityVerificationAttributes(readOpts) + if err != nil { + log.Printf("[WARN] Error fetching identity verification attributes for %s: %s", d.Id(), err) + return err + } + + verificationAttrs, ok := response.VerificationAttributes[domainName] + if !ok { + log.Printf("[WARN] Domain not listed in response when fetching verification attributes for %s", d.Id()) + d.SetId("") + return nil + } + + d.Set("verification_token", verificationAttrs.VerificationToken) + return nil +} + +func resourceAwsSesDomainIdentityDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).sesConn + + domainName := d.Get("domain").(string) + + deleteOpts := &ses.DeleteIdentityInput{ + Identity: aws.String(domainName), + } + + _, err := conn.DeleteIdentity(deleteOpts) + if err != nil { + return fmt.Errorf("Error deleting SES domain identity: %s", err) + } + + return nil +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity_test.go b/installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity_test.go new file mode 100644 index 0000000000..6119fa1231 --- /dev/null +++ b/installer/server/terraform/plugins/aws/resource_aws_ses_domain_identity_test.go @@ -0,0 +1,100 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ses" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAwsSESDomainIdentity_basic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsSESDomainIdentityDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: fmt.Sprintf( + testAccAwsSESDomainIdentityConfig, + acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsSESDomainIdentityExists("aws_ses_domain_identity.test"), + ), + }, + }, + }) +} + +func testAccCheckAwsSESDomainIdentityDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).sesConn + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_ses_domain_identity" { + continue + } + + domain := rs.Primary.ID + params := &ses.GetIdentityVerificationAttributesInput{ + Identities: []*string{ + aws.String(domain), + }, + } + + response, err := conn.GetIdentityVerificationAttributes(params) + if err != nil { + return err + } + + if response.VerificationAttributes[domain] != nil { + return fmt.Errorf("SES Domain Identity %s still exists. Failing!", domain) + } + } + + return nil +} + +func testAccCheckAwsSESDomainIdentityExists(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("SES Domain Identity not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("SES Domain Identity name not set") + } + + domain := rs.Primary.ID + conn := testAccProvider.Meta().(*AWSClient).sesConn + + params := &ses.GetIdentityVerificationAttributesInput{ + Identities: []*string{ + aws.String(domain), + }, + } + + response, err := conn.GetIdentityVerificationAttributes(params) + if err != nil { + return err + } + + if response.VerificationAttributes[domain] == nil { + return fmt.Errorf("SES Domain Identity %s not found in AWS", domain) + } + + return nil + } +} + +const testAccAwsSESDomainIdentityConfig = ` +resource "aws_ses_domain_identity" "test" { + domain = "%s.terraformtesting.com" +} +` diff --git a/installer/server/terraform/plugins/aws/resource_aws_ses_event_destination_test.go b/installer/server/terraform/plugins/aws/resource_aws_ses_event_destination_test.go index 378e2042c8..624ce0c832 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ses_event_destination_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ses_event_destination_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/service/ses" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -46,7 +47,7 @@ func testAccCheckSESEventDestinationDestroy(s *terraform.State) error { found := false for _, element := range response.ConfigurationSets { - if *element.Name == "some-configuration-set" { + if *element.Name == fmt.Sprintf("some-configuration-set-%d", edRandomInteger) { found = true } } @@ -81,7 +82,7 @@ func testAccCheckAwsSESEventDestinationExists(n string) resource.TestCheckFunc { found := false for _, element := range response.ConfigurationSets { - if *element.Name == "some-configuration-set" { + if *element.Name == fmt.Sprintf("some-configuration-set-%d", edRandomInteger) { found = true } } @@ -94,7 +95,8 @@ func testAccCheckAwsSESEventDestinationExists(n string) resource.TestCheckFunc { } } -const testAccAWSSESEventDestinationConfig = ` +var edRandomInteger = acctest.RandInt() +var testAccAWSSESEventDestinationConfig = fmt.Sprintf(` resource "aws_s3_bucket" "bucket" { bucket = "tf-test-bucket-format" acl = "private" @@ -155,7 +157,7 @@ data "aws_iam_policy_document" "fh_felivery_document" { } resource "aws_ses_configuration_set" "test" { - name = "some-configuration-set" + name = "some-configuration-set-%d" } resource "aws_ses_event_destination" "kinesis" { @@ -182,4 +184,4 @@ resource "aws_ses_event_destination" "cloudwatch" { value_source = "emailHeader" } } -` +`, edRandomInteger) diff --git a/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule.go b/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule.go index 54cb88c341..912620acd9 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule.go @@ -443,7 +443,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err addHeaderAction := map[string]interface{}{ "header_name": *element.AddHeaderAction.HeaderName, "header_value": *element.AddHeaderAction.HeaderValue, - "position": i, + "position": i + 1, } addHeaderActionList = append(addHeaderActionList, addHeaderAction) } @@ -453,7 +453,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err "message": *element.BounceAction.Message, "sender": *element.BounceAction.Sender, "smtp_reply_code": *element.BounceAction.SmtpReplyCode, - "position": i, + "position": i + 1, } if element.BounceAction.StatusCode != nil { @@ -470,7 +470,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err if element.LambdaAction != nil { lambdaAction := map[string]interface{}{ "function_arn": *element.LambdaAction.FunctionArn, - "position": i, + "position": i + 1, } if element.LambdaAction.InvocationType != nil { @@ -487,7 +487,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err if element.S3Action != nil { s3Action := map[string]interface{}{ "bucket_name": *element.S3Action.BucketName, - "position": i, + "position": i + 1, } if element.S3Action.KmsKeyArn != nil { @@ -508,7 +508,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err if element.SNSAction != nil { snsAction := map[string]interface{}{ "topic_arn": *element.SNSAction.TopicArn, - "position": i, + "position": i + 1, } snsActionList = append(snsActionList, snsAction) @@ -517,7 +517,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err if element.StopAction != nil { stopAction := map[string]interface{}{ "scope": *element.StopAction.Scope, - "position": i, + "position": i + 1, } if element.StopAction.TopicArn != nil { @@ -530,7 +530,7 @@ func resourceAwsSesReceiptRuleRead(d *schema.ResourceData, meta interface{}) err if element.WorkmailAction != nil { workmailAction := map[string]interface{}{ "organization_arn": *element.WorkmailAction.OrganizationArn, - "position": i, + "position": i + 1, } if element.WorkmailAction.TopicArn != nil { diff --git a/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule_test.go b/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule_test.go index f5770fcc4d..64d04f923b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ses_receipt_rule_test.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ses" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -111,7 +112,7 @@ func testAccCheckAwsSESReceiptRuleExists(n string) resource.TestCheckFunc { params := &ses.DescribeReceiptRuleInput{ RuleName: aws.String("basic"), - RuleSetName: aws.String("test-me"), + RuleSetName: aws.String(fmt.Sprintf("test-me-%d", srrsRandomInt)), } response, err := conn.DescribeReceiptRule(params) @@ -153,7 +154,7 @@ func testAccCheckAwsSESReceiptRuleOrder(n string) resource.TestCheckFunc { conn := testAccProvider.Meta().(*AWSClient).sesConn params := &ses.DescribeReceiptRuleSetInput{ - RuleSetName: aws.String("test-me"), + RuleSetName: aws.String(fmt.Sprintf("test-me-%d", srrsRandomInt)), } response, err := conn.DescribeReceiptRuleSet(params) @@ -185,8 +186,8 @@ func testAccCheckAwsSESReceiptRuleActions(n string) resource.TestCheckFunc { conn := testAccProvider.Meta().(*AWSClient).sesConn params := &ses.DescribeReceiptRuleInput{ - RuleName: aws.String("actions"), - RuleSetName: aws.String("test-me"), + RuleName: aws.String("actions4"), + RuleSetName: aws.String(fmt.Sprintf("test-me-%d", srrsRandomInt)), } response, err := conn.DescribeReceiptRule(params) @@ -227,9 +228,10 @@ func testAccCheckAwsSESReceiptRuleActions(n string) resource.TestCheckFunc { } } -const testAccAWSSESReceiptRuleBasicConfig = ` +var srrsRandomInt = acctest.RandInt() +var testAccAWSSESReceiptRuleBasicConfig = fmt.Sprintf(` resource "aws_ses_receipt_rule_set" "test" { - rule_set_name = "test-me" + rule_set_name = "test-me-%d" } resource "aws_ses_receipt_rule" "basic" { @@ -240,11 +242,11 @@ resource "aws_ses_receipt_rule" "basic" { scan_enabled = true tls_policy = "Require" } -` +`, srrsRandomInt) -const testAccAWSSESReceiptRuleOrderConfig = ` +var testAccAWSSESReceiptRuleOrderConfig = fmt.Sprintf(` resource "aws_ses_receipt_rule_set" "test" { - rule_set_name = "test-me" + rule_set_name = "test-me-%d" } resource "aws_ses_receipt_rule" "second" { @@ -257,36 +259,36 @@ resource "aws_ses_receipt_rule" "first" { name = "first" rule_set_name = "${aws_ses_receipt_rule_set.test.rule_set_name}" } -` +`, srrsRandomInt) -const testAccAWSSESReceiptRuleActionsConfig = ` +var testAccAWSSESReceiptRuleActionsConfig = fmt.Sprintf(` resource "aws_s3_bucket" "emails" { bucket = "ses-terraform-emails" } resource "aws_ses_receipt_rule_set" "test" { - rule_set_name = "test-me" + rule_set_name = "test-me-%d" } resource "aws_ses_receipt_rule" "actions" { - name = "actions" + name = "actions4" rule_set_name = "${aws_ses_receipt_rule_set.test.rule_set_name}" add_header_action { - header_name = "Added-By" - header_value = "Terraform" - position = 1 + header_name = "Added-By" + header_value = "Terraform" + position = 1 } add_header_action { - header_name = "Another-Header" - header_value = "First" - position = 0 + header_name = "Another-Header" + header_value = "First" + position = 0 } stop_action { - scope = "RuleSet" - position = 2 + scope = "RuleSet" + position = 2 } } -` +`, srrsRandomInt) diff --git a/installer/server/terraform/plugins/aws/resource_aws_sns_topic_subscription_test.go b/installer/server/terraform/plugins/aws/resource_aws_sns_topic_subscription_test.go index 146d2fa92e..3f730c9f7f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_sns_topic_subscription_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_sns_topic_subscription_test.go @@ -31,6 +31,25 @@ func TestAccAWSSNSTopicSubscription_basic(t *testing.T) { }) } +func TestAccAWSSNSTopicSubscription_autoConfirmingEndpoint(t *testing.T) { + ri := acctest.RandInt() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSSNSTopicSubscriptionConfig_autoConfirmingEndpoint(ri), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSNSTopicExists("aws_sns_topic.test_topic"), + testAccCheckAWSSNSTopicSubscriptionExists("aws_sns_topic_subscription.test_subscription"), + ), + }, + }, + }) +} + func testAccCheckAWSSNSTopicSubscriptionDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).snsconn @@ -103,3 +122,126 @@ resource "aws_sns_topic_subscription" "test_subscription" { } `, i) } + +func testAccAWSSNSTopicSubscriptionConfig_autoConfirmingEndpoint(i int) string { + return fmt.Sprintf(` +resource "aws_sns_topic" "test_topic" { + name = "tf-acc-test-sns-%d" +} + +resource "aws_api_gateway_rest_api" "test" { + name = "tf-acc-test-sns-%d" + description = "Terraform Acceptance test for SNS subscription" +} + +resource "aws_api_gateway_method" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + http_method = "POST" + authorization = "NONE" +} + +resource "aws_api_gateway_method_response" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + http_method = "${aws_api_gateway_method.test.http_method}" + status_code = "200" + + response_parameters { + "method.response.header.Access-Control-Allow-Origin" = true + } +} + +resource "aws_api_gateway_integration" "test" { + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + http_method = "${aws_api_gateway_method.test.http_method}" + integration_http_method = "POST" + type = "AWS" + uri = "${aws_lambda_function.lambda.invoke_arn}" +} + +resource "aws_api_gateway_integration_response" "test" { + depends_on = ["aws_api_gateway_integration.test"] + rest_api_id = "${aws_api_gateway_rest_api.test.id}" + resource_id = "${aws_api_gateway_rest_api.test.root_resource_id}" + http_method = "${aws_api_gateway_method.test.http_method}" + status_code = "${aws_api_gateway_method_response.test.status_code}" + + response_parameters { + "method.response.header.Access-Control-Allow-Origin" = "'*'" + } +} + +resource "aws_iam_role" "iam_for_lambda" { + name = "tf-acc-test-sns-%d" + + assume_role_policy = < 0 { for _, v := range s.List() { - opts.SecurityGroups = append(opts.SecurityGroups, &ec2.GroupIdentifier{GroupId: aws.String(v.(string))}) - groupIds = append(groupIds, aws.String(v.(string))) + securityGroupIds = append(securityGroupIds, aws.String(v.(string))) } } } @@ -378,11 +371,15 @@ func buildSpotFleetLaunchSpecification(d map[string]interface{}, meta interface{ DeleteOnTermination: aws.Bool(true), DeviceIndex: aws.Int64(int64(0)), SubnetId: aws.String(subnetId.(string)), - Groups: groupIds, + Groups: securityGroupIds, } opts.NetworkInterfaces = []*ec2.InstanceNetworkInterfaceSpecification{ni} opts.SubnetId = aws.String("") + } else { + for _, id := range securityGroupIds { + opts.SecurityGroups = append(opts.SecurityGroups, &ec2.GroupIdentifier{GroupId: id}) + } } blockDevices, err := readSpotFleetBlockDeviceMappingsFromConfig(d, conn) @@ -534,6 +531,7 @@ func resourceAwsSpotFleetRequestCreate(d *schema.ResourceData, meta interface{}) TargetCapacity: aws.Int64(int64(d.Get("target_capacity").(int))), ClientToken: aws.String(resource.UniqueId()), TerminateInstancesWithExpiration: aws.Bool(d.Get("terminate_instances_with_expiration").(bool)), + ReplaceUnhealthyInstances: aws.Bool(d.Get("replace_unhealthy_instances").(bool)), } if v, ok := d.GetOk("excess_capacity_termination_policy"); ok { @@ -725,29 +723,26 @@ func resourceAwsSpotFleetRequestRead(d *schema.ResourceData, meta interface{}) e aws.TimeValue(config.ValidUntil).Format(awsAutoscalingScheduleTimeLayout)) } + d.Set("replace_unhealthy_instances", config.ReplaceUnhealthyInstances) d.Set("launch_specification", launchSpecsToSet(config.LaunchSpecifications, conn)) return nil } -func launchSpecsToSet(ls []*ec2.SpotFleetLaunchSpecification, conn *ec2.EC2) *schema.Set { - specs := &schema.Set{F: hashLaunchSpecification} - for _, val := range ls { - dn, err := fetchRootDeviceName(aws.StringValue(val.ImageId), conn) +func launchSpecsToSet(launchSpecs []*ec2.SpotFleetLaunchSpecification, conn *ec2.EC2) *schema.Set { + specSet := &schema.Set{F: hashLaunchSpecification} + for _, spec := range launchSpecs { + rootDeviceName, err := fetchRootDeviceName(aws.StringValue(spec.ImageId), conn) if err != nil { log.Panic(err) - } else { - ls := launchSpecToMap(val, dn) - specs.Add(ls) } + + specSet.Add(launchSpecToMap(spec, rootDeviceName)) } - return specs + return specSet } -func launchSpecToMap( - l *ec2.SpotFleetLaunchSpecification, - rootDevName *string, -) map[string]interface{} { +func launchSpecToMap(l *ec2.SpotFleetLaunchSpecification, rootDevName *string) map[string]interface{} { m := make(map[string]interface{}) m["root_block_device"] = rootBlockDeviceToSet(l.BlockDeviceMappings, rootDevName) @@ -779,10 +774,7 @@ func launchSpecToMap( } if l.UserData != nil { - ud_dec, err := base64.StdEncoding.DecodeString(aws.StringValue(l.UserData)) - if err == nil { - m["user_data"] = string(ud_dec) - } + m["user_data"] = userDataHashSum(aws.StringValue(l.UserData)) } if l.KeyName != nil { @@ -797,11 +789,23 @@ func launchSpecToMap( m["subnet_id"] = aws.StringValue(l.SubnetId) } + securityGroupIds := &schema.Set{F: schema.HashString} + if len(l.NetworkInterfaces) > 0 { + // This resource auto-creates one network interface when associate_public_ip_address is true + for _, group := range l.NetworkInterfaces[0].Groups { + securityGroupIds.Add(aws.StringValue(group)) + } + } else { + for _, group := range l.SecurityGroups { + securityGroupIds.Add(aws.StringValue(group.GroupId)) + } + } + m["vpc_security_group_ids"] = securityGroupIds + if l.WeightedCapacity != nil { m["weighted_capacity"] = strconv.FormatFloat(*l.WeightedCapacity, 'f', 0, 64) } - // m["security_groups"] = securityGroupsToSet(l.SecutiryGroups) return m } @@ -1009,7 +1013,6 @@ func hashLaunchSpecification(v interface{}) int { } buf.WriteString(fmt.Sprintf("%s-", m["instance_type"].(string))) buf.WriteString(fmt.Sprintf("%s-", m["spot_price"].(string))) - buf.WriteString(fmt.Sprintf("%s-", m["user_data"].(string))) return hashcode.String(buf.String()) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_spot_fleet_request_test.go b/installer/server/terraform/plugins/aws/resource_aws_spot_fleet_request_test.go index 83a8246157..0f90a57f65 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_spot_fleet_request_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_spot_fleet_request_test.go @@ -1,7 +1,7 @@ package aws import ( - "encoding/base64" + "errors" "fmt" "log" "testing" @@ -17,14 +17,15 @@ import ( func TestAccAWSSpotFleetRequest_changePriceForcesNewRequest(t *testing.T) { var before, after ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfig(rName), + { + Config: testAccAWSSpotFleetRequestConfig(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &before), @@ -36,8 +37,8 @@ func TestAccAWSSpotFleetRequest_changePriceForcesNewRequest(t *testing.T) { "aws_spot_fleet_request.foo", "launch_specification.#", "1"), ), }, - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigChangeSpotBidPrice(rName), + { + Config: testAccAWSSpotFleetRequestConfigChangeSpotBidPrice(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &after), @@ -57,14 +58,15 @@ func TestAccAWSSpotFleetRequest_changePriceForcesNewRequest(t *testing.T) { func TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfig(rName), + { + Config: testAccAWSSpotFleetRequestConfig(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &sfr), @@ -81,14 +83,15 @@ func TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion(t *testing.T) { func TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigWithAzs(rName), + { + Config: testAccAWSSpotFleetRequestConfigWithAzs(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &sfr), @@ -97,9 +100,9 @@ func TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList(t *testing.T) { resource.TestCheckResourceAttr( "aws_spot_fleet_request.foo", "launch_specification.#", "2"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.1590006269.availability_zone", "us-west-2a"), + "aws_spot_fleet_request.foo", "launch_specification.335709043.availability_zone", "us-west-2a"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.3809475891.availability_zone", "us-west-2b"), + "aws_spot_fleet_request.foo", "launch_specification.1671188867.availability_zone", "us-west-2b"), ), }, }, @@ -109,14 +112,15 @@ func TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList(t *testing.T) { func TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigWithSubnet(rName), + { + Config: testAccAWSSpotFleetRequestConfigWithSubnet(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &sfr), @@ -133,14 +137,15 @@ func TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList(t *testing.T) { func TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigMultipleInstanceTypesinSameAz(rName), + { + Config: testAccAWSSpotFleetRequestConfigMultipleInstanceTypesinSameAz(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &sfr), @@ -149,13 +154,13 @@ func TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz(t *testing.T) { resource.TestCheckResourceAttr( "aws_spot_fleet_request.foo", "launch_specification.#", "2"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.1590006269.instance_type", "m1.small"), + "aws_spot_fleet_request.foo", "launch_specification.335709043.instance_type", "m1.small"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.1590006269.availability_zone", "us-west-2a"), + "aws_spot_fleet_request.foo", "launch_specification.335709043.availability_zone", "us-west-2a"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.3079734941.instance_type", "m3.large"), + "aws_spot_fleet_request.foo", "launch_specification.590403189.instance_type", "m3.large"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.3079734941.availability_zone", "us-west-2a"), + "aws_spot_fleet_request.foo", "launch_specification.590403189.availability_zone", "us-west-2a"), ), }, }, @@ -165,14 +170,15 @@ func TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz(t *testing.T) { func TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigMultipleInstanceTypesinSameSubnet(rName), + { + Config: testAccAWSSpotFleetRequestConfigMultipleInstanceTypesinSameSubnet(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &sfr), @@ -189,14 +195,15 @@ func TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet(t *testing.T) func TestAccAWSSpotFleetRequest_overriddingSpotPrice(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigOverridingSpotPrice(rName), + { + Config: testAccAWSSpotFleetRequestConfigOverridingSpotPrice(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &sfr), @@ -207,13 +214,13 @@ func TestAccAWSSpotFleetRequest_overriddingSpotPrice(t *testing.T) { resource.TestCheckResourceAttr( "aws_spot_fleet_request.foo", "launch_specification.#", "2"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.522395050.spot_price", "0.01"), + "aws_spot_fleet_request.foo", "launch_specification.4143232216.spot_price", "0.01"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.522395050.instance_type", "m3.large"), + "aws_spot_fleet_request.foo", "launch_specification.4143232216.instance_type", "m3.large"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.1590006269.spot_price", ""), //there will not be a value here since it's not overriding + "aws_spot_fleet_request.foo", "launch_specification.335709043.spot_price", ""), //there will not be a value here since it's not overriding resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.1590006269.instance_type", "m1.small"), + "aws_spot_fleet_request.foo", "launch_specification.335709043.instance_type", "m1.small"), ), }, }, @@ -223,14 +230,15 @@ func TestAccAWSSpotFleetRequest_overriddingSpotPrice(t *testing.T) { func TestAccAWSSpotFleetRequest_diversifiedAllocation(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigDiversifiedAllocation(rName), + { + Config: testAccAWSSpotFleetRequestConfigDiversifiedAllocation(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &sfr), @@ -249,6 +257,7 @@ func TestAccAWSSpotFleetRequest_diversifiedAllocation(t *testing.T) { func TestAccAWSSpotFleetRequest_withWeightedCapacity(t *testing.T) { var sfr ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() fulfillSleep := func() resource.TestCheckFunc { // sleep so that EC2 can fuflill the request. We do this to guard against a @@ -258,7 +267,7 @@ func TestAccAWSSpotFleetRequest_withWeightedCapacity(t *testing.T) { // destroyed // See https://github.com/hashicorp/terraform/pull/8938 return func(s *terraform.State) error { - log.Printf("[DEBUG] Test: Sleep to allow EC2 to actually begin fulfilling TestAccAWSSpotFleetRequest_withWeightedCapacity request") + log.Print("[DEBUG] Test: Sleep to allow EC2 to actually begin fulfilling TestAccAWSSpotFleetRequest_withWeightedCapacity request") time.Sleep(1 * time.Minute) return nil } @@ -269,8 +278,8 @@ func TestAccAWSSpotFleetRequest_withWeightedCapacity(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestConfigWithWeightedCapacity(rName), + { + Config: testAccAWSSpotFleetRequestConfigWithWeightedCapacity(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( fulfillSleep(), testAccCheckAWSSpotFleetRequestExists( @@ -280,13 +289,13 @@ func TestAccAWSSpotFleetRequest_withWeightedCapacity(t *testing.T) { resource.TestCheckResourceAttr( "aws_spot_fleet_request.foo", "launch_specification.#", "2"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.2325690000.weighted_capacity", "3"), + "aws_spot_fleet_request.foo", "launch_specification.4120185872.weighted_capacity", "3"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.2325690000.instance_type", "r3.large"), + "aws_spot_fleet_request.foo", "launch_specification.4120185872.instance_type", "r3.large"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.3079734941.weighted_capacity", "6"), + "aws_spot_fleet_request.foo", "launch_specification.590403189.weighted_capacity", "6"), resource.TestCheckResourceAttr( - "aws_spot_fleet_request.foo", "launch_specification.3079734941.instance_type", "m3.large"), + "aws_spot_fleet_request.foo", "launch_specification.590403189.instance_type", "m3.large"), ), }, }, @@ -296,14 +305,15 @@ func TestAccAWSSpotFleetRequest_withWeightedCapacity(t *testing.T) { func TestAccAWSSpotFleetRequest_withEBSDisk(t *testing.T) { var config ec2.SpotFleetRequestConfig rName := acctest.RandString(10) + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccAWSSpotFleetRequestEBSConfig(rName), + { + Config: testAccAWSSpotFleetRequestEBSConfig(rName, rInt), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSSpotFleetRequestExists( "aws_spot_fleet_request.foo", &config), @@ -316,9 +326,9 @@ func TestAccAWSSpotFleetRequest_withEBSDisk(t *testing.T) { } func TestAccAWSSpotFleetRequest_CannotUseEmptyKeyName(t *testing.T) { - _, errors := validateSpotFleetRequestKeyName("", "key_name") - if len(errors) == 0 { - t.Fatalf("Expected the key name to trigger a validation error") + _, errs := validateSpotFleetRequestKeyName("", "key_name") + if len(errs) == 0 { + t.Fatal("Expected the key name to trigger a validation error") } } @@ -341,7 +351,7 @@ func testAccCheckAWSSpotFleetRequestExists( } if rs.Primary.ID == "" { - return fmt.Errorf("No Spot fleet request with that id exists") + return errors.New("No Spot fleet request with that id exists") } conn := testAccProvider.Meta().(*AWSClient).ec2conn @@ -365,44 +375,11 @@ func testAccCheckAWSSpotFleetRequestExists( } } -func testAccCheckAWSSpotFleetRequest_LaunchSpecAttributes( - sfr *ec2.SpotFleetRequestConfig) resource.TestCheckFunc { - return func(s *terraform.State) error { - if len(sfr.SpotFleetRequestConfig.LaunchSpecifications) == 0 { - return fmt.Errorf("Missing launch specification") - } - - spec := *sfr.SpotFleetRequestConfig.LaunchSpecifications[0] - - if *spec.InstanceType != "m1.small" { - return fmt.Errorf("Unexpected launch specification instance type: %s", *spec.InstanceType) - } - - if *spec.ImageId != "ami-d06a90b0" { - return fmt.Errorf("Unexpected launch specification image id: %s", *spec.ImageId) - } - - if *spec.SpotPrice != "0.01" { - return fmt.Errorf("Unexpected launch specification spot price: %s", *spec.SpotPrice) - } - - if *spec.WeightedCapacity != 2 { - return fmt.Errorf("Unexpected launch specification weighted capacity: %f", *spec.WeightedCapacity) - } - - if *spec.UserData != base64.StdEncoding.EncodeToString([]byte("hello-world")) { - return fmt.Errorf("Unexpected launch specification user data: %s", *spec.UserData) - } - - return nil - } -} - func testAccCheckAWSSpotFleetRequest_EBSAttributes( sfr *ec2.SpotFleetRequestConfig) resource.TestCheckFunc { return func(s *terraform.State) error { if len(sfr.SpotFleetRequestConfig.LaunchSpecifications) == 0 { - return fmt.Errorf("Missing launch specification") + return errors.New("Missing launch specification") } spec := *sfr.SpotFleetRequestConfig.LaunchSpecifications[0] @@ -444,17 +421,40 @@ func testAccCheckAWSSpotFleetRequestDestroy(s *terraform.State) error { return nil } -func testAccAWSSpotFleetRequestConfig(rName string) string { +func testAccAWSSpotFleetRequestConfig(rName string, rInt int) string { return fmt.Sprintf(` resource "aws_key_pair" "debugging" { key_name = "tmp-key-%s" public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 phodgson@thoughtworks.com" } +resource "aws_iam_policy" "test-policy" { + name = "test-policy-%d" + path = "/" + description = "Spot Fleet Request ACCTest Policy" + policy = < 0 { + for _, ni := range instance.NetworkInterfaces { + if *ni.Attachment.DeviceIndex == 0 { + d.Set("subnet_id", ni.SubnetId) + d.Set("network_interface_id", ni.NetworkInterfaceId) + d.Set("associate_public_ip_address", ni.Association != nil) + d.Set("ipv6_address_count", len(ni.Ipv6Addresses)) + + for _, address := range ni.Ipv6Addresses { + ipv6Addresses = append(ipv6Addresses, *address.Ipv6Address) + } + } + } + } else { + d.Set("subnet_id", instance.SubnetId) + d.Set("network_interface_id", "") + } + + if err := d.Set("ipv6_addresses", ipv6Addresses); err != nil { + log.Printf("[WARN] Error setting ipv6_addresses for AWS Spot Instance (%s): %s", d.Id(), err) + } } return nil diff --git a/installer/server/terraform/plugins/aws/resource_aws_ssm_document.go b/installer/server/terraform/plugins/aws/resource_aws_ssm_document.go index df550215da..8658715607 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ssm_document.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ssm_document.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "strconv" "strings" "time" @@ -14,6 +15,10 @@ import ( "github.com/hashicorp/terraform/helper/schema" ) +const ( + MINIMUM_VERSIONED_SCHEMA = 2.0 +) + func resourceAwsSsmDocument() *schema.Resource { return &schema.Resource{ Create: resourceAwsSsmDocumentCreate, @@ -35,6 +40,10 @@ func resourceAwsSsmDocument() *schema.Resource { Required: true, ValidateFunc: validateAwsSSMDocumentType, }, + "schema_version": { + Type: schema.TypeString, + Computed: true, + }, "created_date": { Type: schema.TypeString, Computed: true, @@ -173,6 +182,7 @@ func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error d.Set("created_date", doc.CreatedDate) d.Set("default_version", doc.DefaultVersion) d.Set("description", doc.Description) + d.Set("schema_version", doc.SchemaVersion) if _, ok := d.GetOk("document_type"); ok { d.Set("document_type", doc.DocumentType) @@ -205,9 +215,15 @@ func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error if dp.DefaultValue != nil { param["default_value"] = *dp.DefaultValue } - param["description"] = *dp.Description - param["name"] = *dp.Name - param["type"] = *dp.Type + if dp.Description != nil { + param["description"] = *dp.Description + } + if dp.Name != nil { + param["name"] = *dp.Name + } + if dp.Type != nil { + param["type"] = *dp.Type + } params = append(params, param) } @@ -232,6 +248,23 @@ func resourceAwsSsmDocumentUpdate(d *schema.ResourceData, meta interface{}) erro log.Printf("[DEBUG] Not setting document permissions on %q", d.Id()) } + if !d.HasChange("content") { + return nil + } + + if schemaVersion, ok := d.GetOk("schemaVersion"); ok { + schemaNumber, _ := strconv.ParseFloat(schemaVersion.(string), 64) + + if schemaNumber < MINIMUM_VERSIONED_SCHEMA { + log.Printf("[DEBUG] Skipping document update because document version is not 2.0 %q", d.Id()) + return nil + } + } + + if err := updateAwsSSMDocument(d, meta); err != nil { + return err + } + return resourceAwsSsmDocumentRead(d, meta) } @@ -375,6 +408,47 @@ func deleteDocumentPermissions(d *schema.ResourceData, meta interface{}) error { return nil } +func updateAwsSSMDocument(d *schema.ResourceData, meta interface{}) error { + log.Printf("[INFO] Updating SSM Document: %s", d.Id()) + + name := d.Get("name").(string) + + updateDocInput := &ssm.UpdateDocumentInput{ + Name: aws.String(name), + Content: aws.String(d.Get("content").(string)), + DocumentVersion: aws.String(d.Get("default_version").(string)), + } + + newDefaultVersion := d.Get("default_version").(string) + + ssmconn := meta.(*AWSClient).ssmconn + updated, err := ssmconn.UpdateDocument(updateDocInput) + + if isAWSErr(err, "DuplicateDocumentContent", "") { + log.Printf("[DEBUG] Content is a duplicate of the latest version so update is not necessary: %s", d.Id()) + log.Printf("[INFO] Updating the default version to the latest version %s: %s", newDefaultVersion, d.Id()) + + newDefaultVersion = d.Get("latest_version").(string) + } else if err != nil { + return errwrap.Wrapf("Error updating SSM document: {{err}}", err) + } else { + log.Printf("[INFO] Updating the default version to the new version %s: %s", newDefaultVersion, d.Id()) + newDefaultVersion = *updated.DocumentDescription.DocumentVersion + } + + updateDefaultInput := &ssm.UpdateDocumentDefaultVersionInput{ + Name: aws.String(name), + DocumentVersion: aws.String(newDefaultVersion), + } + + _, err = ssmconn.UpdateDocumentDefaultVersion(updateDefaultInput) + + if err != nil { + return errwrap.Wrapf("Error updating the default document version to that of the updated document: {{err}}", err) + } + return nil +} + func validateAwsSSMDocumentType(v interface{}, k string) (ws []string, errors []error) { value := v.(string) types := map[string]bool{ @@ -384,7 +458,7 @@ func validateAwsSSMDocumentType(v interface{}, k string) (ws []string, errors [] } if !types[value] { - errors = append(errors, fmt.Errorf("CodeBuild: Arifacts Namespace Type can only be NONE / BUILD_ID")) + errors = append(errors, fmt.Errorf("Document type %s is invalid. Valid types are Command, Policy or Automation", value)) } return } diff --git a/installer/server/terraform/plugins/aws/resource_aws_ssm_document_test.go b/installer/server/terraform/plugins/aws/resource_aws_ssm_document_test.go index 2242c0b99d..dc34276e11 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_ssm_document_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_ssm_document_test.go @@ -29,6 +29,39 @@ func TestAccAWSSSMDocument_basic(t *testing.T) { }) } +func TestAccAWSSSMDocument_update(t *testing.T) { + name := acctest.RandString(10) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMDocumentDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSSSMDocument20Config(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMDocumentExists("aws_ssm_document.foo"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "schema_version", "2.0"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "latest_version", "1"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "default_version", "1"), + ), + }, + resource.TestStep{ + Config: testAccAWSSSMDocument20UpdatedConfig(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMDocumentExists("aws_ssm_document.foo"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "latest_version", "2"), + resource.TestCheckResourceAttr( + "aws_ssm_document.foo", "default_version", "2"), + ), + }, + }, + }) +} + func TestAccAWSSSMDocument_permission(t *testing.T) { name := acctest.RandString(10) resource.Test(t, resource.TestCase{ @@ -186,6 +219,66 @@ DOC `, rName) } +func testAccAWSSSMDocument20Config(rName string) string { + return fmt.Sprintf(` +resource "aws_ssm_document" "foo" { + name = "test_document-%s" + document_type = "Command" + + content = < 0 { + noDescriptors := []interface{}{} + err := updateWafIpSetDescriptors(d.Id(), oldDescriptors, noDescriptors, conn) + if err != nil { + return fmt.Errorf("Error updating IPSetDescriptors: %s", err) + } } - log.Printf("[INFO] Deleting WAF IPSet") - _, err = conn.DeleteIPSet(req) + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteIPSetInput{ + ChangeToken: token, + IPSetId: aws.String(d.Id()), + } + log.Printf("[INFO] Deleting WAF IPSet") + return conn.DeleteIPSet(req) + }) if err != nil { return fmt.Errorf("Error Deleting WAF IPSet: %s", err) } @@ -136,39 +142,54 @@ func resourceAwsWafIPSetDelete(d *schema.ResourceData, meta interface{}) error { return nil } -func updateIPSetResource(d *schema.ResourceData, meta interface{}, ChangeAction string) error { - conn := meta.(*AWSClient).wafconn - - // ChangeToken - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) +func updateWafIpSetDescriptors(id string, oldD, newD []interface{}, conn *waf.WAF) error { + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateIPSetInput{ + ChangeToken: token, + IPSetId: aws.String(id), + Updates: diffWafIpSetDescriptors(oldD, newD), + } + log.Printf("[INFO] Updating IPSet descriptors: %s", req) + return conn.UpdateIPSet(req) + }) if err != nil { - return fmt.Errorf("Error getting change token: %s", err) + return fmt.Errorf("Error Updating WAF IPSet: %s", err) } - req := &waf.UpdateIPSetInput{ - ChangeToken: resp.ChangeToken, - IPSetId: aws.String(d.Id()), - } + return nil +} + +func diffWafIpSetDescriptors(oldD, newD []interface{}) []*waf.IPSetUpdate { + updates := make([]*waf.IPSetUpdate, 0) - IPSetDescriptors := d.Get("ip_set_descriptors").(*schema.Set) - for _, IPSetDescriptor := range IPSetDescriptors.List() { - IPSet := IPSetDescriptor.(map[string]interface{}) - IPSetUpdate := &waf.IPSetUpdate{ - Action: aws.String(ChangeAction), + for _, od := range oldD { + descriptor := od.(map[string]interface{}) + + if idx, contains := sliceContainsMap(newD, descriptor); contains { + newD = append(newD[:idx], newD[idx+1:]...) + continue + } + + updates = append(updates, &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionDelete), IPSetDescriptor: &waf.IPSetDescriptor{ - Type: aws.String(IPSet["type"].(string)), - Value: aws.String(IPSet["value"].(string)), + Type: aws.String(descriptor["type"].(string)), + Value: aws.String(descriptor["value"].(string)), }, - } - req.Updates = append(req.Updates, IPSetUpdate) + }) } - _, err = conn.UpdateIPSet(req) - if err != nil { - return fmt.Errorf("Error Updating WAF IPSet: %s", err) - } + for _, nd := range newD { + descriptor := nd.(map[string]interface{}) - return nil + updates = append(updates, &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionInsert), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String(descriptor["type"].(string)), + Value: aws.String(descriptor["value"].(string)), + }, + }) + } + return updates } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_ipset_test.go b/installer/server/terraform/plugins/aws/resource_aws_waf_ipset_test.go index ffb4d6cb0a..ee75931163 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_ipset_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_ipset_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "reflect" "testing" "github.com/hashicorp/terraform/helper/resource" @@ -96,50 +97,206 @@ func TestAccAWSWafIPSet_changeNameForceNew(t *testing.T) { }) } -func testAccCheckAWSWafIPSetDisappears(v *waf.IPSet) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).wafconn +func TestAccAWSWafIPSet_changeDescriptors(t *testing.T) { + var before, after waf.IPSet + ipsetName := fmt.Sprintf("ip-set-%s", acctest.RandString(5)) - // ChangeToken - var ct *waf.GetChangeTokenInput + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSWafIPSetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSWafIPSetConfig(ipsetName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSWafIPSetExists("aws_waf_ipset.ipset", &before), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "name", ipsetName), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "ip_set_descriptors.#", "1"), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "ip_set_descriptors.4037960608.type", "IPV4"), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "ip_set_descriptors.4037960608.value", "192.0.7.0/24"), + ), + }, + { + Config: testAccAWSWafIPSetConfigChangeIPSetDescriptors(ipsetName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSWafIPSetExists("aws_waf_ipset.ipset", &after), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "name", ipsetName), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "ip_set_descriptors.#", "1"), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "ip_set_descriptors.115741513.type", "IPV4"), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "ip_set_descriptors.115741513.value", "192.0.8.0/24"), + ), + }, + }, + }) +} - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } +func TestAccAWSWafIPSet_noDescriptors(t *testing.T) { + var ipset waf.IPSet + ipsetName := fmt.Sprintf("ip-set-%s", acctest.RandString(5)) - req := &waf.UpdateIPSetInput{ - ChangeToken: resp.ChangeToken, - IPSetId: v.IPSetId, - } + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSWafIPSetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSWafIPSetConfig_noDescriptors(ipsetName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSWafIPSetExists("aws_waf_ipset.ipset", &ipset), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "name", ipsetName), + resource.TestCheckResourceAttr( + "aws_waf_ipset.ipset", "ip_set_descriptors.#", "0"), + ), + }, + }, + }) +} - for _, IPSetDescriptor := range v.IPSetDescriptors { - IPSetUpdate := &waf.IPSetUpdate{ - Action: aws.String("DELETE"), - IPSetDescriptor: &waf.IPSetDescriptor{ - Type: IPSetDescriptor.Type, - Value: IPSetDescriptor.Value, +func TestDiffWafIpSetDescriptors(t *testing.T) { + testCases := []struct { + Old []interface{} + New []interface{} + ExpectedUpdates []*waf.IPSetUpdate + }{ + { + // Change + Old: []interface{}{ + map[string]interface{}{"type": "IPV4", "value": "192.0.7.0/24"}, + }, + New: []interface{}{ + map[string]interface{}{"type": "IPV4", "value": "192.0.8.0/24"}, + }, + ExpectedUpdates: []*waf.IPSetUpdate{ + &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionDelete), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String("IPV4"), + Value: aws.String("192.0.7.0/24"), + }, + }, + &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionInsert), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String("IPV4"), + Value: aws.String("192.0.8.0/24"), + }, + }, + }, + }, + { + // Fresh IPSet + Old: []interface{}{}, + New: []interface{}{ + map[string]interface{}{"type": "IPV4", "value": "10.0.1.0/24"}, + map[string]interface{}{"type": "IPV4", "value": "10.0.2.0/24"}, + map[string]interface{}{"type": "IPV4", "value": "10.0.3.0/24"}, + }, + ExpectedUpdates: []*waf.IPSetUpdate{ + &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionInsert), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String("IPV4"), + Value: aws.String("10.0.1.0/24"), + }, + }, + &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionInsert), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String("IPV4"), + Value: aws.String("10.0.2.0/24"), + }, + }, + &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionInsert), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String("IPV4"), + Value: aws.String("10.0.3.0/24"), + }, + }, + }, + }, + { + // Deletion + Old: []interface{}{ + map[string]interface{}{"type": "IPV4", "value": "192.0.7.0/24"}, + map[string]interface{}{"type": "IPV4", "value": "192.0.8.0/24"}, + }, + New: []interface{}{}, + ExpectedUpdates: []*waf.IPSetUpdate{ + &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionDelete), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String("IPV4"), + Value: aws.String("192.0.7.0/24"), + }, + }, + &waf.IPSetUpdate{ + Action: aws.String(waf.ChangeActionDelete), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: aws.String("IPV4"), + Value: aws.String("192.0.8.0/24"), + }, }, + }, + }, + } + for i, tc := range testCases { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + updates := diffWafIpSetDescriptors(tc.Old, tc.New) + if !reflect.DeepEqual(updates, tc.ExpectedUpdates) { + t.Fatalf("IPSet updates don't match.\nGiven: %s\nExpected: %s", + updates, tc.ExpectedUpdates) + } + }) + } +} + +func testAccCheckAWSWafIPSetDisappears(v *waf.IPSet) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).wafconn + + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateIPSetInput{ + ChangeToken: token, + IPSetId: v.IPSetId, + } + + for _, IPSetDescriptor := range v.IPSetDescriptors { + IPSetUpdate := &waf.IPSetUpdate{ + Action: aws.String("DELETE"), + IPSetDescriptor: &waf.IPSetDescriptor{ + Type: IPSetDescriptor.Type, + Value: IPSetDescriptor.Value, + }, + } + req.Updates = append(req.Updates, IPSetUpdate) } - req.Updates = append(req.Updates, IPSetUpdate) - } - _, err = conn.UpdateIPSet(req) + return conn.UpdateIPSet(req) + }) if err != nil { return fmt.Errorf("Error Updating WAF IPSet: %s", err) } - resp, err = conn.GetChangeToken(ct) + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + opts := &waf.DeleteIPSetInput{ + ChangeToken: token, + IPSetId: v.IPSetId, + } + return conn.DeleteIPSet(opts) + }) if err != nil { - return fmt.Errorf("Error getting change token for waf IPSet: %s", err) - } - - opts := &waf.DeleteIPSetInput{ - ChangeToken: resp.ChangeToken, - IPSetId: v.IPSetId, - } - if _, err := conn.DeleteIPSet(opts); err != nil { - return err + return fmt.Errorf("Error Deleting WAF IPSet: %s", err) } return nil } @@ -235,3 +392,9 @@ func testAccAWSWafIPSetConfigChangeIPSetDescriptors(name string) string { } }`, name) } + +func testAccAWSWafIPSetConfig_noDescriptors(name string) string { + return fmt.Sprintf(`resource "aws_waf_ipset" "ipset" { + name = "%s" +}`, name) +} diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_rule.go b/installer/server/terraform/plugins/aws/resource_aws_waf_rule.go index ba59bf2228..543299879f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_rule.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_rule.go @@ -24,9 +24,10 @@ func resourceAwsWafRule() *schema.Resource { ForceNew: true, }, "metric_name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateWafMetricName, }, "predicates": &schema.Schema{ Type: schema.TypeSet, @@ -71,24 +72,20 @@ func resourceAwsWafRule() *schema.Resource { func resourceAwsWafRuleCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).wafconn - // ChangeToken - var ct *waf.GetChangeTokenInput - - res, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - params := &waf.CreateRuleInput{ - ChangeToken: res.ChangeToken, - MetricName: aws.String(d.Get("metric_name").(string)), - Name: aws.String(d.Get("name").(string)), - } + wr := newWafRetryer(conn, "global") + out, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + params := &waf.CreateRuleInput{ + ChangeToken: token, + MetricName: aws.String(d.Get("metric_name").(string)), + Name: aws.String(d.Get("name").(string)), + } - resp, err := conn.CreateRule(params) + return conn.CreateRule(params) + }) if err != nil { return err } + resp := out.(*waf.CreateRuleOutput) d.SetId(*resp.Rule.RuleId) return resourceAwsWafRuleUpdate(d, meta) } @@ -143,18 +140,16 @@ func resourceAwsWafRuleDelete(d *schema.ResourceData, meta interface{}) error { if err != nil { return fmt.Errorf("Error Removing WAF Rule Predicates: %s", err) } - // ChangeToken - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - - req := &waf.DeleteRuleInput{ - ChangeToken: resp.ChangeToken, - RuleId: aws.String(d.Id()), - } - log.Printf("[INFO] Deleting WAF Rule") - _, err = conn.DeleteRule(req) + wr := newWafRetryer(conn, "global") + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteRuleInput{ + ChangeToken: token, + RuleId: aws.String(d.Id()), + } + log.Printf("[INFO] Deleting WAF Rule") + return conn.DeleteRule(req) + }) if err != nil { return fmt.Errorf("Error deleting WAF Rule: %s", err) } @@ -165,34 +160,29 @@ func resourceAwsWafRuleDelete(d *schema.ResourceData, meta interface{}) error { func updateWafRuleResource(d *schema.ResourceData, meta interface{}, ChangeAction string) error { conn := meta.(*AWSClient).wafconn - // ChangeToken - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - req := &waf.UpdateRuleInput{ - ChangeToken: resp.ChangeToken, - RuleId: aws.String(d.Id()), - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateRuleInput{ + ChangeToken: token, + RuleId: aws.String(d.Id()), + } - predicatesSet := d.Get("predicates").(*schema.Set) - for _, predicateI := range predicatesSet.List() { - predicate := predicateI.(map[string]interface{}) - updatePredicate := &waf.RuleUpdate{ - Action: aws.String(ChangeAction), - Predicate: &waf.Predicate{ - Negated: aws.Bool(predicate["negated"].(bool)), - Type: aws.String(predicate["type"].(string)), - DataId: aws.String(predicate["data_id"].(string)), - }, + predicatesSet := d.Get("predicates").(*schema.Set) + for _, predicateI := range predicatesSet.List() { + predicate := predicateI.(map[string]interface{}) + updatePredicate := &waf.RuleUpdate{ + Action: aws.String(ChangeAction), + Predicate: &waf.Predicate{ + Negated: aws.Bool(predicate["negated"].(bool)), + Type: aws.String(predicate["type"].(string)), + DataId: aws.String(predicate["data_id"].(string)), + }, + } + req.Updates = append(req.Updates, updatePredicate) } - req.Updates = append(req.Updates, updatePredicate) - } - _, err = conn.UpdateRule(req) + return conn.UpdateRule(req) + }) if err != nil { return fmt.Errorf("Error Updating WAF Rule: %s", err) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_rule_test.go b/installer/server/terraform/plugins/aws/resource_aws_waf_rule_test.go index 52065b106b..c8e6bafbfa 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_rule_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_rule_test.go @@ -99,47 +99,40 @@ func testAccCheckAWSWafRuleDisappears(v *waf.Rule) resource.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).wafconn - // ChangeToken - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - req := &waf.UpdateRuleInput{ - ChangeToken: resp.ChangeToken, - RuleId: v.RuleId, - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateRuleInput{ + ChangeToken: token, + RuleId: v.RuleId, + } - for _, Predicate := range v.Predicates { - Predicate := &waf.RuleUpdate{ - Action: aws.String("DELETE"), - Predicate: &waf.Predicate{ - Negated: Predicate.Negated, - Type: Predicate.Type, - DataId: Predicate.DataId, - }, + for _, Predicate := range v.Predicates { + Predicate := &waf.RuleUpdate{ + Action: aws.String("DELETE"), + Predicate: &waf.Predicate{ + Negated: Predicate.Negated, + Type: Predicate.Type, + DataId: Predicate.DataId, + }, + } + req.Updates = append(req.Updates, Predicate) } - req.Updates = append(req.Updates, Predicate) - } - _, err = conn.UpdateRule(req) + return conn.UpdateRule(req) + }) if err != nil { return fmt.Errorf("Error Updating WAF Rule: %s", err) } - resp, err = conn.GetChangeToken(ct) + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + opts := &waf.DeleteRuleInput{ + ChangeToken: token, + RuleId: v.RuleId, + } + return conn.DeleteRule(opts) + }) if err != nil { - return fmt.Errorf("Error getting change token for waf Rule: %s", err) - } - - opts := &waf.DeleteRuleInput{ - ChangeToken: resp.ChangeToken, - RuleId: v.RuleId, - } - if _, err := conn.DeleteRule(opts); err != nil { - return err + return fmt.Errorf("Error Deleting WAF Rule: %s", err) } return nil } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set.go b/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set.go index 9f384e82c2..db9d5c516b 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set.go @@ -69,24 +69,19 @@ func resourceAwsWafSizeConstraintSetCreate(d *schema.ResourceData, meta interfac log.Printf("[INFO] Creating SizeConstraintSet: %s", d.Get("name").(string)) - // ChangeToken - var ct *waf.GetChangeTokenInput - - res, err := conn.GetChangeToken(ct) - if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - params := &waf.CreateSizeConstraintSetInput{ - ChangeToken: res.ChangeToken, - Name: aws.String(d.Get("name").(string)), - } - - resp, err := conn.CreateSizeConstraintSet(params) + wr := newWafRetryer(conn, "global") + out, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + params := &waf.CreateSizeConstraintSetInput{ + ChangeToken: token, + Name: aws.String(d.Get("name").(string)), + } + return conn.CreateSizeConstraintSet(params) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error creating SizeConstraintSet: {{err}}", err) } + resp := out.(*waf.CreateSizeConstraintSetOutput) d.SetId(*resp.SizeConstraintSet.SizeConstraintSetId) @@ -134,17 +129,14 @@ func resourceAwsWafSizeConstraintSetDelete(d *schema.ResourceData, meta interfac return errwrap.Wrapf("[ERROR] Error deleting SizeConstraintSet: {{err}}", err) } - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - - req := &waf.DeleteSizeConstraintSetInput{ - ChangeToken: resp.ChangeToken, - SizeConstraintSetId: aws.String(d.Id()), - } - - _, err = conn.DeleteSizeConstraintSet(req) - + wr := newWafRetryer(conn, "global") + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteSizeConstraintSetInput{ + ChangeToken: token, + SizeConstraintSetId: aws.String(d.Id()), + } + return conn.DeleteSizeConstraintSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error deleting SizeConstraintSet: {{err}}", err) } @@ -155,34 +147,30 @@ func resourceAwsWafSizeConstraintSetDelete(d *schema.ResourceData, meta interfac func updateSizeConstraintSetResource(d *schema.ResourceData, meta interface{}, ChangeAction string) error { conn := meta.(*AWSClient).wafconn - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - req := &waf.UpdateSizeConstraintSetInput{ - ChangeToken: resp.ChangeToken, - SizeConstraintSetId: aws.String(d.Id()), - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateSizeConstraintSetInput{ + ChangeToken: token, + SizeConstraintSetId: aws.String(d.Id()), + } - sizeConstraints := d.Get("size_constraints").(*schema.Set) - for _, sizeConstraint := range sizeConstraints.List() { - sc := sizeConstraint.(map[string]interface{}) - sizeConstraintUpdate := &waf.SizeConstraintSetUpdate{ - Action: aws.String(ChangeAction), - SizeConstraint: &waf.SizeConstraint{ - FieldToMatch: expandFieldToMatch(sc["field_to_match"].(*schema.Set).List()[0].(map[string]interface{})), - ComparisonOperator: aws.String(sc["comparison_operator"].(string)), - Size: aws.Int64(int64(sc["size"].(int))), - TextTransformation: aws.String(sc["text_transformation"].(string)), - }, + sizeConstraints := d.Get("size_constraints").(*schema.Set) + for _, sizeConstraint := range sizeConstraints.List() { + sc := sizeConstraint.(map[string]interface{}) + sizeConstraintUpdate := &waf.SizeConstraintSetUpdate{ + Action: aws.String(ChangeAction), + SizeConstraint: &waf.SizeConstraint{ + FieldToMatch: expandFieldToMatch(sc["field_to_match"].(*schema.Set).List()[0].(map[string]interface{})), + ComparisonOperator: aws.String(sc["comparison_operator"].(string)), + Size: aws.Int64(int64(sc["size"].(int))), + TextTransformation: aws.String(sc["text_transformation"].(string)), + }, + } + req.Updates = append(req.Updates, sizeConstraintUpdate) } - req.Updates = append(req.Updates, sizeConstraintUpdate) - } - _, err = conn.UpdateSizeConstraintSet(req) + return conn.UpdateSizeConstraintSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error updating SizeConstraintSet: {{err}}", err) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set_test.go b/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set_test.go index 13eee40e4e..a6bd5156e3 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_size_constraint_set_test.go @@ -96,45 +96,39 @@ func testAccCheckAWSWafSizeConstraintSetDisappears(v *waf.SizeConstraintSet) res return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).wafconn - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - req := &waf.UpdateSizeConstraintSetInput{ - ChangeToken: resp.ChangeToken, - SizeConstraintSetId: v.SizeConstraintSetId, - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateSizeConstraintSetInput{ + ChangeToken: token, + SizeConstraintSetId: v.SizeConstraintSetId, + } - for _, sizeConstraint := range v.SizeConstraints { - sizeConstraintUpdate := &waf.SizeConstraintSetUpdate{ - Action: aws.String("DELETE"), - SizeConstraint: &waf.SizeConstraint{ - FieldToMatch: sizeConstraint.FieldToMatch, - ComparisonOperator: sizeConstraint.ComparisonOperator, - Size: sizeConstraint.Size, - TextTransformation: sizeConstraint.TextTransformation, - }, + for _, sizeConstraint := range v.SizeConstraints { + sizeConstraintUpdate := &waf.SizeConstraintSetUpdate{ + Action: aws.String("DELETE"), + SizeConstraint: &waf.SizeConstraint{ + FieldToMatch: sizeConstraint.FieldToMatch, + ComparisonOperator: sizeConstraint.ComparisonOperator, + Size: sizeConstraint.Size, + TextTransformation: sizeConstraint.TextTransformation, + }, + } + req.Updates = append(req.Updates, sizeConstraintUpdate) } - req.Updates = append(req.Updates, sizeConstraintUpdate) - } - _, err = conn.UpdateSizeConstraintSet(req) + return conn.UpdateSizeConstraintSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error updating SizeConstraintSet: {{err}}", err) } - resp, err = conn.GetChangeToken(ct) + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + opts := &waf.DeleteSizeConstraintSetInput{ + ChangeToken: token, + SizeConstraintSetId: v.SizeConstraintSetId, + } + return conn.DeleteSizeConstraintSet(opts) + }) if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - opts := &waf.DeleteSizeConstraintSetInput{ - ChangeToken: resp.ChangeToken, - SizeConstraintSetId: v.SizeConstraintSetId, - } - if _, err := conn.DeleteSizeConstraintSet(opts); err != nil { return err } return nil diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set.go b/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set.go index 01efd6a32c..c888efe5a5 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set.go @@ -61,25 +61,19 @@ func resourceAwsWafSqlInjectionMatchSetCreate(d *schema.ResourceData, meta inter log.Printf("[INFO] Creating SqlInjectionMatchSet: %s", d.Get("name").(string)) - // ChangeToken - var ct *waf.GetChangeTokenInput - - res, err := conn.GetChangeToken(ct) - if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - params := &waf.CreateSqlInjectionMatchSetInput{ - ChangeToken: res.ChangeToken, - Name: aws.String(d.Get("name").(string)), - } - - resp, err := conn.CreateSqlInjectionMatchSet(params) + wr := newWafRetryer(conn, "global") + out, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + params := &waf.CreateSqlInjectionMatchSetInput{ + ChangeToken: token, + Name: aws.String(d.Get("name").(string)), + } + return conn.CreateSqlInjectionMatchSet(params) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error creating SqlInjectionMatchSet: {{err}}", err) } - + resp := out.(*waf.CreateSqlInjectionMatchSetOutput) d.SetId(*resp.SqlInjectionMatchSet.SqlInjectionMatchSetId) return resourceAwsWafSqlInjectionMatchSetUpdate(d, meta) @@ -126,17 +120,15 @@ func resourceAwsWafSqlInjectionMatchSetDelete(d *schema.ResourceData, meta inter return errwrap.Wrapf("[ERROR] Error deleting SqlInjectionMatchSet: {{err}}", err) } - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - - req := &waf.DeleteSqlInjectionMatchSetInput{ - ChangeToken: resp.ChangeToken, - SqlInjectionMatchSetId: aws.String(d.Id()), - } - - _, err = conn.DeleteSqlInjectionMatchSet(req) + wr := newWafRetryer(conn, "global") + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteSqlInjectionMatchSetInput{ + ChangeToken: token, + SqlInjectionMatchSetId: aws.String(d.Id()), + } + return conn.DeleteSqlInjectionMatchSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error deleting SqlInjectionMatchSet: {{err}}", err) } @@ -147,32 +139,28 @@ func resourceAwsWafSqlInjectionMatchSetDelete(d *schema.ResourceData, meta inter func updateSqlInjectionMatchSetResource(d *schema.ResourceData, meta interface{}, ChangeAction string) error { conn := meta.(*AWSClient).wafconn - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - req := &waf.UpdateSqlInjectionMatchSetInput{ - ChangeToken: resp.ChangeToken, - SqlInjectionMatchSetId: aws.String(d.Id()), - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateSqlInjectionMatchSetInput{ + ChangeToken: token, + SqlInjectionMatchSetId: aws.String(d.Id()), + } - sqlInjectionMatchTuples := d.Get("sql_injection_match_tuples").(*schema.Set) - for _, sqlInjectionMatchTuple := range sqlInjectionMatchTuples.List() { - simt := sqlInjectionMatchTuple.(map[string]interface{}) - sizeConstraintUpdate := &waf.SqlInjectionMatchSetUpdate{ - Action: aws.String(ChangeAction), - SqlInjectionMatchTuple: &waf.SqlInjectionMatchTuple{ - FieldToMatch: expandFieldToMatch(simt["field_to_match"].(*schema.Set).List()[0].(map[string]interface{})), - TextTransformation: aws.String(simt["text_transformation"].(string)), - }, + sqlInjectionMatchTuples := d.Get("sql_injection_match_tuples").(*schema.Set) + for _, sqlInjectionMatchTuple := range sqlInjectionMatchTuples.List() { + simt := sqlInjectionMatchTuple.(map[string]interface{}) + sizeConstraintUpdate := &waf.SqlInjectionMatchSetUpdate{ + Action: aws.String(ChangeAction), + SqlInjectionMatchTuple: &waf.SqlInjectionMatchTuple{ + FieldToMatch: expandFieldToMatch(simt["field_to_match"].(*schema.Set).List()[0].(map[string]interface{})), + TextTransformation: aws.String(simt["text_transformation"].(string)), + }, + } + req.Updates = append(req.Updates, sizeConstraintUpdate) } - req.Updates = append(req.Updates, sizeConstraintUpdate) - } - _, err = conn.UpdateSqlInjectionMatchSet(req) + return conn.UpdateSqlInjectionMatchSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error updating SqlInjectionMatchSet: {{err}}", err) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set_test.go b/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set_test.go index f13f6711ef..5ea8bca0fb 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_sql_injection_match_set_test.go @@ -96,44 +96,38 @@ func testAccCheckAWSWafSqlInjectionMatchSetDisappears(v *waf.SqlInjectionMatchSe return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).wafconn - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - req := &waf.UpdateSqlInjectionMatchSetInput{ - ChangeToken: resp.ChangeToken, - SqlInjectionMatchSetId: v.SqlInjectionMatchSetId, - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateSqlInjectionMatchSetInput{ + ChangeToken: token, + SqlInjectionMatchSetId: v.SqlInjectionMatchSetId, + } - for _, sqlInjectionMatchTuple := range v.SqlInjectionMatchTuples { - sqlInjectionMatchTupleUpdate := &waf.SqlInjectionMatchSetUpdate{ - Action: aws.String("DELETE"), - SqlInjectionMatchTuple: &waf.SqlInjectionMatchTuple{ - FieldToMatch: sqlInjectionMatchTuple.FieldToMatch, - TextTransformation: sqlInjectionMatchTuple.TextTransformation, - }, + for _, sqlInjectionMatchTuple := range v.SqlInjectionMatchTuples { + sqlInjectionMatchTupleUpdate := &waf.SqlInjectionMatchSetUpdate{ + Action: aws.String("DELETE"), + SqlInjectionMatchTuple: &waf.SqlInjectionMatchTuple{ + FieldToMatch: sqlInjectionMatchTuple.FieldToMatch, + TextTransformation: sqlInjectionMatchTuple.TextTransformation, + }, + } + req.Updates = append(req.Updates, sqlInjectionMatchTupleUpdate) } - req.Updates = append(req.Updates, sqlInjectionMatchTupleUpdate) - } - _, err = conn.UpdateSqlInjectionMatchSet(req) + return conn.UpdateSqlInjectionMatchSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error updating SqlInjectionMatchSet: {{err}}", err) } - resp, err = conn.GetChangeToken(ct) + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + opts := &waf.DeleteSqlInjectionMatchSetInput{ + ChangeToken: token, + SqlInjectionMatchSetId: v.SqlInjectionMatchSetId, + } + return conn.DeleteSqlInjectionMatchSet(opts) + }) if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - opts := &waf.DeleteSqlInjectionMatchSetInput{ - ChangeToken: resp.ChangeToken, - SqlInjectionMatchSetId: v.SqlInjectionMatchSetId, - } - if _, err := conn.DeleteSqlInjectionMatchSet(opts); err != nil { - return err + return errwrap.Wrapf("[ERROR] Error deleting SqlInjectionMatchSet: {{err}}", err) } return nil } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl.go b/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl.go index dd3a9d1d32..7e3ac72378 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl.go @@ -37,9 +37,10 @@ func resourceAwsWafWebAcl() *schema.Resource { }, }, "metric_name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateWafMetricName, }, "rules": &schema.Schema{ Type: schema.TypeSet, @@ -77,25 +78,21 @@ func resourceAwsWafWebAcl() *schema.Resource { func resourceAwsWafWebAclCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).wafconn - // ChangeToken - var ct *waf.GetChangeTokenInput - - res, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - params := &waf.CreateWebACLInput{ - ChangeToken: res.ChangeToken, - DefaultAction: expandDefaultAction(d), - MetricName: aws.String(d.Get("metric_name").(string)), - Name: aws.String(d.Get("name").(string)), - } + wr := newWafRetryer(conn, "global") + out, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + params := &waf.CreateWebACLInput{ + ChangeToken: token, + DefaultAction: expandDefaultAction(d), + MetricName: aws.String(d.Get("metric_name").(string)), + Name: aws.String(d.Get("name").(string)), + } - resp, err := conn.CreateWebACL(params) + return conn.CreateWebACL(params) + }) if err != nil { return err } + resp := out.(*waf.CreateWebACLOutput) d.SetId(*resp.WebACL.WebACLId) return resourceAwsWafWebAclUpdate(d, meta) } @@ -144,18 +141,16 @@ func resourceAwsWafWebAclDelete(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error Removing WAF ACL Rules: %s", err) } - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - - req := &waf.DeleteWebACLInput{ - ChangeToken: resp.ChangeToken, - WebACLId: aws.String(d.Id()), - } - - log.Printf("[INFO] Deleting WAF ACL") - _, err = conn.DeleteWebACL(req) + wr := newWafRetryer(conn, "global") + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteWebACLInput{ + ChangeToken: token, + WebACLId: aws.String(d.Id()), + } + log.Printf("[INFO] Deleting WAF ACL") + return conn.DeleteWebACL(req) + }) if err != nil { return fmt.Errorf("Error Deleting WAF ACL: %s", err) } @@ -164,38 +159,34 @@ func resourceAwsWafWebAclDelete(d *schema.ResourceData, meta interface{}) error func updateWebAclResource(d *schema.ResourceData, meta interface{}, ChangeAction string) error { conn := meta.(*AWSClient).wafconn - // ChangeToken - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - req := &waf.UpdateWebACLInput{ - ChangeToken: resp.ChangeToken, - WebACLId: aws.String(d.Id()), - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateWebACLInput{ + ChangeToken: token, + WebACLId: aws.String(d.Id()), + } - if d.HasChange("default_action") { - req.DefaultAction = expandDefaultAction(d) - } + if d.HasChange("default_action") { + req.DefaultAction = expandDefaultAction(d) + } - rules := d.Get("rules").(*schema.Set) - for _, rule := range rules.List() { - aclRule := rule.(map[string]interface{}) - action := aclRule["action"].(*schema.Set).List()[0].(map[string]interface{}) - aclRuleUpdate := &waf.WebACLUpdate{ - Action: aws.String(ChangeAction), - ActivatedRule: &waf.ActivatedRule{ - Priority: aws.Int64(int64(aclRule["priority"].(int))), - RuleId: aws.String(aclRule["rule_id"].(string)), - Action: &waf.WafAction{Type: aws.String(action["type"].(string))}, - }, + rules := d.Get("rules").(*schema.Set) + for _, rule := range rules.List() { + aclRule := rule.(map[string]interface{}) + action := aclRule["action"].(*schema.Set).List()[0].(map[string]interface{}) + aclRuleUpdate := &waf.WebACLUpdate{ + Action: aws.String(ChangeAction), + ActivatedRule: &waf.ActivatedRule{ + Priority: aws.Int64(int64(aclRule["priority"].(int))), + RuleId: aws.String(aclRule["rule_id"].(string)), + Action: &waf.WafAction{Type: aws.String(action["type"].(string))}, + }, + } + req.Updates = append(req.Updates, aclRuleUpdate) } - req.Updates = append(req.Updates, aclRuleUpdate) - } - _, err = conn.UpdateWebACL(req) + return conn.UpdateWebACL(req) + }) if err != nil { return fmt.Errorf("Error Updating WAF ACL: %s", err) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl_test.go b/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl_test.go index 265cb15a46..6591fed0e4 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_web_acl_test.go @@ -159,47 +159,40 @@ func testAccCheckAWSWafWebAclDisappears(v *waf.WebACL) resource.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).wafconn - // ChangeToken - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - req := &waf.UpdateWebACLInput{ - ChangeToken: resp.ChangeToken, - WebACLId: v.WebACLId, - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateWebACLInput{ + ChangeToken: token, + WebACLId: v.WebACLId, + } - for _, ActivatedRule := range v.Rules { - WebACLUpdate := &waf.WebACLUpdate{ - Action: aws.String("DELETE"), - ActivatedRule: &waf.ActivatedRule{ - Priority: ActivatedRule.Priority, - RuleId: ActivatedRule.RuleId, - Action: ActivatedRule.Action, - }, + for _, ActivatedRule := range v.Rules { + WebACLUpdate := &waf.WebACLUpdate{ + Action: aws.String("DELETE"), + ActivatedRule: &waf.ActivatedRule{ + Priority: ActivatedRule.Priority, + RuleId: ActivatedRule.RuleId, + Action: ActivatedRule.Action, + }, + } + req.Updates = append(req.Updates, WebACLUpdate) } - req.Updates = append(req.Updates, WebACLUpdate) - } - _, err = conn.UpdateWebACL(req) + return conn.UpdateWebACL(req) + }) if err != nil { return fmt.Errorf("Error Updating WAF ACL: %s", err) } - resp, err = conn.GetChangeToken(ct) + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + opts := &waf.DeleteWebACLInput{ + ChangeToken: token, + WebACLId: v.WebACLId, + } + return conn.DeleteWebACL(opts) + }) if err != nil { - return fmt.Errorf("Error getting change token for waf ACL: %s", err) - } - - opts := &waf.DeleteWebACLInput{ - ChangeToken: resp.ChangeToken, - WebACLId: v.WebACLId, - } - if _, err := conn.DeleteWebACL(opts); err != nil { - return err + return fmt.Errorf("Error Deleting WAF ACL: %s", err) } return nil } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set.go b/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set.go index 574245f8b4..222940dd04 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set.go @@ -61,24 +61,19 @@ func resourceAwsWafXssMatchSetCreate(d *schema.ResourceData, meta interface{}) e log.Printf("[INFO] Creating XssMatchSet: %s", d.Get("name").(string)) - // ChangeToken - var ct *waf.GetChangeTokenInput - - res, err := conn.GetChangeToken(ct) - if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - params := &waf.CreateXssMatchSetInput{ - ChangeToken: res.ChangeToken, - Name: aws.String(d.Get("name").(string)), - } - - resp, err := conn.CreateXssMatchSet(params) + wr := newWafRetryer(conn, "global") + out, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + params := &waf.CreateXssMatchSetInput{ + ChangeToken: token, + Name: aws.String(d.Get("name").(string)), + } + return conn.CreateXssMatchSet(params) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error creating XssMatchSet: {{err}}", err) } + resp := out.(*waf.CreateXssMatchSetOutput) d.SetId(*resp.XssMatchSet.XssMatchSetId) @@ -126,17 +121,15 @@ func resourceAwsWafXssMatchSetDelete(d *schema.ResourceData, meta interface{}) e return errwrap.Wrapf("[ERROR] Error deleting XssMatchSet: {{err}}", err) } - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - - req := &waf.DeleteXssMatchSetInput{ - ChangeToken: resp.ChangeToken, - XssMatchSetId: aws.String(d.Id()), - } - - _, err = conn.DeleteXssMatchSet(req) + wr := newWafRetryer(conn, "global") + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteXssMatchSetInput{ + ChangeToken: token, + XssMatchSetId: aws.String(d.Id()), + } + return conn.DeleteXssMatchSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error deleting XssMatchSet: {{err}}", err) } @@ -147,32 +140,28 @@ func resourceAwsWafXssMatchSetDelete(d *schema.ResourceData, meta interface{}) e func updateXssMatchSetResource(d *schema.ResourceData, meta interface{}, ChangeAction string) error { conn := meta.(*AWSClient).wafconn - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - req := &waf.UpdateXssMatchSetInput{ - ChangeToken: resp.ChangeToken, - XssMatchSetId: aws.String(d.Id()), - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateXssMatchSetInput{ + ChangeToken: token, + XssMatchSetId: aws.String(d.Id()), + } - xssMatchTuples := d.Get("xss_match_tuples").(*schema.Set) - for _, xssMatchTuple := range xssMatchTuples.List() { - xmt := xssMatchTuple.(map[string]interface{}) - xssMatchTupleUpdate := &waf.XssMatchSetUpdate{ - Action: aws.String(ChangeAction), - XssMatchTuple: &waf.XssMatchTuple{ - FieldToMatch: expandFieldToMatch(xmt["field_to_match"].(*schema.Set).List()[0].(map[string]interface{})), - TextTransformation: aws.String(xmt["text_transformation"].(string)), - }, + xssMatchTuples := d.Get("xss_match_tuples").(*schema.Set) + for _, xssMatchTuple := range xssMatchTuples.List() { + xmt := xssMatchTuple.(map[string]interface{}) + xssMatchTupleUpdate := &waf.XssMatchSetUpdate{ + Action: aws.String(ChangeAction), + XssMatchTuple: &waf.XssMatchTuple{ + FieldToMatch: expandFieldToMatch(xmt["field_to_match"].(*schema.Set).List()[0].(map[string]interface{})), + TextTransformation: aws.String(xmt["text_transformation"].(string)), + }, + } + req.Updates = append(req.Updates, xssMatchTupleUpdate) } - req.Updates = append(req.Updates, xssMatchTupleUpdate) - } - _, err = conn.UpdateXssMatchSet(req) + return conn.UpdateXssMatchSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error updating XssMatchSet: {{err}}", err) } diff --git a/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set_test.go b/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set_test.go index 5128fc813e..b2d223086f 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set_test.go +++ b/installer/server/terraform/plugins/aws/resource_aws_waf_xss_match_set_test.go @@ -96,44 +96,38 @@ func testAccCheckAWSWafXssMatchSetDisappears(v *waf.XssMatchSet) resource.TestCh return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).wafconn - var ct *waf.GetChangeTokenInput - - resp, err := conn.GetChangeToken(ct) - if err != nil { - return fmt.Errorf("Error getting change token: %s", err) - } - - req := &waf.UpdateXssMatchSetInput{ - ChangeToken: resp.ChangeToken, - XssMatchSetId: v.XssMatchSetId, - } + wr := newWafRetryer(conn, "global") + _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.UpdateXssMatchSetInput{ + ChangeToken: token, + XssMatchSetId: v.XssMatchSetId, + } - for _, xssMatchTuple := range v.XssMatchTuples { - xssMatchTupleUpdate := &waf.XssMatchSetUpdate{ - Action: aws.String("DELETE"), - XssMatchTuple: &waf.XssMatchTuple{ - FieldToMatch: xssMatchTuple.FieldToMatch, - TextTransformation: xssMatchTuple.TextTransformation, - }, + for _, xssMatchTuple := range v.XssMatchTuples { + xssMatchTupleUpdate := &waf.XssMatchSetUpdate{ + Action: aws.String("DELETE"), + XssMatchTuple: &waf.XssMatchTuple{ + FieldToMatch: xssMatchTuple.FieldToMatch, + TextTransformation: xssMatchTuple.TextTransformation, + }, + } + req.Updates = append(req.Updates, xssMatchTupleUpdate) } - req.Updates = append(req.Updates, xssMatchTupleUpdate) - } - _, err = conn.UpdateXssMatchSet(req) + return conn.UpdateXssMatchSet(req) + }) if err != nil { return errwrap.Wrapf("[ERROR] Error updating XssMatchSet: {{err}}", err) } - resp, err = conn.GetChangeToken(ct) + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + opts := &waf.DeleteXssMatchSetInput{ + ChangeToken: token, + XssMatchSetId: v.XssMatchSetId, + } + return conn.DeleteXssMatchSet(opts) + }) if err != nil { - return errwrap.Wrapf("[ERROR] Error getting change token: {{err}}", err) - } - - opts := &waf.DeleteXssMatchSetInput{ - ChangeToken: resp.ChangeToken, - XssMatchSetId: v.XssMatchSetId, - } - if _, err := conn.DeleteXssMatchSet(opts); err != nil { - return err + return errwrap.Wrapf("[ERROR] Error deleting XssMatchSet: {{err}}", err) } return nil } diff --git a/installer/server/terraform/plugins/aws/resource_vpn_connection_route_test.go b/installer/server/terraform/plugins/aws/resource_vpn_connection_route_test.go index 24e0480039..23229b0f9b 100644 --- a/installer/server/terraform/plugins/aws/resource_vpn_connection_route_test.go +++ b/installer/server/terraform/plugins/aws/resource_vpn_connection_route_test.go @@ -8,18 +8,20 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccAWSVpnConnectionRoute_basic(t *testing.T) { + rBgpAsn := acctest.RandIntRange(64512, 65534) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionRouteDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAwsVpnConnectionRouteConfig, + Config: testAccAwsVpnConnectionRouteConfig(rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccAwsVpnConnectionRoute( "aws_vpn_gateway.vpn_gateway", @@ -30,7 +32,7 @@ func TestAccAWSVpnConnectionRoute_basic(t *testing.T) { ), }, resource.TestStep{ - Config: testAccAwsVpnConnectionRouteConfigUpdate, + Config: testAccAwsVpnConnectionRouteConfigUpdate(rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccAwsVpnConnectionRoute( "aws_vpn_gateway.vpn_gateway", @@ -143,55 +145,59 @@ func testAccAwsVpnConnectionRoute( } } -const testAccAwsVpnConnectionRouteConfig = ` -resource "aws_vpn_gateway" "vpn_gateway" { - tags { - Name = "vpn_gateway" +func testAccAwsVpnConnectionRouteConfig(rBgpAsn int) string { + return fmt.Sprintf(` + resource "aws_vpn_gateway" "vpn_gateway" { + tags { + Name = "vpn_gateway" + } } -} -resource "aws_customer_gateway" "customer_gateway" { - bgp_asn = 65000 - ip_address = "182.0.0.1" - type = "ipsec.1" -} + resource "aws_customer_gateway" "customer_gateway" { + bgp_asn = %d + ip_address = "182.0.0.1" + type = "ipsec.1" + } -resource "aws_vpn_connection" "vpn_connection" { - vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}" - customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}" - type = "ipsec.1" - static_routes_only = true -} + resource "aws_vpn_connection" "vpn_connection" { + vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}" + customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}" + type = "ipsec.1" + static_routes_only = true + } -resource "aws_vpn_connection_route" "foo" { - destination_cidr_block = "172.168.10.0/24" - vpn_connection_id = "${aws_vpn_connection.vpn_connection.id}" + resource "aws_vpn_connection_route" "foo" { + destination_cidr_block = "172.168.10.0/24" + vpn_connection_id = "${aws_vpn_connection.vpn_connection.id}" + } + `, rBgpAsn) } -` // Change destination_cidr_block -const testAccAwsVpnConnectionRouteConfigUpdate = ` -resource "aws_vpn_gateway" "vpn_gateway" { - tags { - Name = "vpn_gateway" +func testAccAwsVpnConnectionRouteConfigUpdate(rBgpAsn int) string { + return fmt.Sprintf(` + resource "aws_vpn_gateway" "vpn_gateway" { + tags { + Name = "vpn_gateway" + } } -} -resource "aws_customer_gateway" "customer_gateway" { - bgp_asn = 65000 - ip_address = "182.0.0.1" - type = "ipsec.1" -} + resource "aws_customer_gateway" "customer_gateway" { + bgp_asn = %d + ip_address = "182.0.0.1" + type = "ipsec.1" + } -resource "aws_vpn_connection" "vpn_connection" { - vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}" - customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}" - type = "ipsec.1" - static_routes_only = true -} + resource "aws_vpn_connection" "vpn_connection" { + vpn_gateway_id = "${aws_vpn_gateway.vpn_gateway.id}" + customer_gateway_id = "${aws_customer_gateway.customer_gateway.id}" + type = "ipsec.1" + static_routes_only = true + } -resource "aws_vpn_connection_route" "foo" { - destination_cidr_block = "172.168.20.0/24" - vpn_connection_id = "${aws_vpn_connection.vpn_connection.id}" + resource "aws_vpn_connection_route" "foo" { + destination_cidr_block = "172.168.20.0/24" + vpn_connection_id = "${aws_vpn_connection.vpn_connection.id}" + } + `, rBgpAsn) } -` diff --git a/installer/server/terraform/plugins/aws/sort.go b/installer/server/terraform/plugins/aws/sort.go new file mode 100644 index 0000000000..0d90458ebf --- /dev/null +++ b/installer/server/terraform/plugins/aws/sort.go @@ -0,0 +1,53 @@ +package aws + +import ( + "sort" + "time" + + "github.com/aws/aws-sdk-go/service/ec2" +) + +type imageSort []*ec2.Image +type snapshotSort []*ec2.Snapshot + +func (a imageSort) Len() int { + return len(a) +} + +func (a imageSort) Swap(i, j int) { + a[i], a[j] = a[j], a[i] +} + +func (a imageSort) Less(i, j int) bool { + itime, _ := time.Parse(time.RFC3339, *a[i].CreationDate) + jtime, _ := time.Parse(time.RFC3339, *a[j].CreationDate) + return itime.Unix() < jtime.Unix() +} + +// Sort images by creation date, in descending order. +func sortImages(images []*ec2.Image) []*ec2.Image { + sortedImages := images + sort.Sort(sort.Reverse(imageSort(sortedImages))) + return sortedImages +} + +func (a snapshotSort) Len() int { + return len(a) +} + +func (a snapshotSort) Swap(i, j int) { + a[i], a[j] = a[j], a[i] +} + +func (a snapshotSort) Less(i, j int) bool { + itime := *a[i].StartTime + jtime := *a[j].StartTime + return itime.Unix() < jtime.Unix() +} + +// Sort snapshots by creation date, in descending order. +func sortSnapshots(snapshots []*ec2.Snapshot) []*ec2.Snapshot { + sortedSnapshots := snapshots + sort.Sort(sort.Reverse(snapshotSort(sortedSnapshots))) + return sortedSnapshots +} diff --git a/installer/server/terraform/plugins/aws/structure.go b/installer/server/terraform/plugins/aws/structure.go index 5fc791f8e0..34041b90c3 100644 --- a/installer/server/terraform/plugins/aws/structure.go +++ b/installer/server/terraform/plugins/aws/structure.go @@ -14,6 +14,7 @@ import ( "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" + "github.com/aws/aws-sdk-go/service/cognitoidentity" "github.com/aws/aws-sdk-go/service/configservice" "github.com/aws/aws-sdk-go/service/directoryservice" "github.com/aws/aws-sdk-go/service/ec2" @@ -216,6 +217,12 @@ func expandIPPerms( perm.IpRanges = append(perm.IpRanges, &ec2.IpRange{CidrIp: aws.String(v.(string))}) } } + if raw, ok := m["ipv6_cidr_blocks"]; ok { + list := raw.([]interface{}) + for _, v := range list { + perm.Ipv6Ranges = append(perm.Ipv6Ranges, &ec2.Ipv6Range{CidrIpv6: aws.String(v.(string))}) + } + } if raw, ok := m["prefix_list_ids"]; ok { list := raw.([]interface{}) @@ -1484,6 +1491,22 @@ func sortInterfaceSlice(in []interface{}) []interface{} { return b } +// This function sorts List A to look like a list found in the tf file. +func sortListBasedonTFFile(in []string, d *schema.ResourceData, listName string) ([]string, error) { + if attributeCount, ok := d.Get(listName + ".#").(int); ok { + for i := 0; i < attributeCount; i++ { + currAttributeId := d.Get(listName + "." + strconv.Itoa(i)) + for j := 0; j < len(in); j++ { + if currAttributeId == in[j] { + in[i], in[j] = in[j], in[i] + } + } + } + return in, nil + } + return in, fmt.Errorf("Could not find list: %s", listName) +} + func flattenApiGatewayThrottleSettings(settings *apigateway.ThrottleSettings) []map[string]interface{} { result := make([]map[string]interface{}, 0, 1) @@ -1843,3 +1866,164 @@ func flattenInspectorTags(cfTags []*cloudformation.Tag) map[string]string { } return tags } + +func flattenApiGatewayUsageApiStages(s []*apigateway.ApiStage) []map[string]interface{} { + stages := make([]map[string]interface{}, 0) + + for _, bd := range s { + if bd.ApiId != nil && bd.Stage != nil { + stage := make(map[string]interface{}) + stage["api_id"] = *bd.ApiId + stage["stage"] = *bd.Stage + + stages = append(stages, stage) + } + } + + if len(stages) > 0 { + return stages + } + + return nil +} + +func flattenApiGatewayUsagePlanThrottling(s *apigateway.ThrottleSettings) []map[string]interface{} { + settings := make(map[string]interface{}, 0) + + if s == nil { + return nil + } + + if s.BurstLimit != nil { + settings["burst_limit"] = *s.BurstLimit + } + + if s.RateLimit != nil { + settings["rate_limit"] = *s.RateLimit + } + + return []map[string]interface{}{settings} +} + +func flattenApiGatewayUsagePlanQuota(s *apigateway.QuotaSettings) []map[string]interface{} { + settings := make(map[string]interface{}, 0) + + if s == nil { + return nil + } + + if s.Limit != nil { + settings["limit"] = *s.Limit + } + + if s.Offset != nil { + settings["offset"] = *s.Offset + } + + if s.Period != nil { + settings["period"] = *s.Period + } + + return []map[string]interface{}{settings} +} + +func buildApiGatewayInvokeURL(restApiId, region, stageName string) string { + return fmt.Sprintf("https://%s.execute-api.%s.amazonaws.com/%s", + restApiId, region, stageName) +} + +func buildApiGatewayExecutionARN(restApiId, region, accountId string) (string, error) { + if accountId == "" { + return "", fmt.Errorf("Unable to build execution ARN for %s as account ID is missing", + restApiId) + } + return fmt.Sprintf("arn:aws:execute-api:%s:%s:%s", + region, accountId, restApiId), nil +} + +func expandCognitoSupportedLoginProviders(config map[string]interface{}) map[string]*string { + m := map[string]*string{} + for k, v := range config { + s := v.(string) + m[k] = &s + } + return m +} + +func flattenCognitoSupportedLoginProviders(config map[string]*string) map[string]string { + m := map[string]string{} + for k, v := range config { + m[k] = *v + } + return m +} + +func expandCognitoIdentityProviders(s *schema.Set) []*cognitoidentity.Provider { + ips := make([]*cognitoidentity.Provider, 0) + + for _, v := range s.List() { + s := v.(map[string]interface{}) + + ip := &cognitoidentity.Provider{} + + if sv, ok := s["client_id"].(string); ok { + ip.ClientId = aws.String(sv) + } + + if sv, ok := s["provider_name"].(string); ok { + ip.ProviderName = aws.String(sv) + } + + if sv, ok := s["server_side_token_check"].(bool); ok { + ip.ServerSideTokenCheck = aws.Bool(sv) + } + + ips = append(ips, ip) + } + + return ips +} + +func flattenCognitoIdentityProviders(ips []*cognitoidentity.Provider) []map[string]interface{} { + values := make([]map[string]interface{}, 0) + + for _, v := range ips { + ip := make(map[string]interface{}) + + if v == nil { + return nil + } + + if v.ClientId != nil { + ip["client_id"] = *v.ClientId + } + + if v.ProviderName != nil { + ip["provider_name"] = *v.ProviderName + } + + if v.ServerSideTokenCheck != nil { + ip["server_side_token_check"] = *v.ServerSideTokenCheck + } + + values = append(values, ip) + } + + return values +} + +func buildLambdaInvokeArn(lambdaArn, region string) string { + apiVersion := "2015-03-31" + return fmt.Sprintf("arn:aws:apigateway:%s:lambda:path/%s/functions/%s/invocations", + region, apiVersion, lambdaArn) +} + +func sliceContainsMap(l []interface{}, m map[string]interface{}) (int, bool) { + for i, t := range l { + if reflect.DeepEqual(m, t.(map[string]interface{})) { + return i, true + } + } + + return -1, false +} diff --git a/installer/server/terraform/plugins/aws/tags.go b/installer/server/terraform/plugins/aws/tags.go index 90fda0146d..57a8f6ab0a 100644 --- a/installer/server/terraform/plugins/aws/tags.go +++ b/installer/server/terraform/plugins/aws/tags.go @@ -69,6 +69,63 @@ func setElbV2Tags(conn *elbv2.ELBV2, d *schema.ResourceData) error { return nil } +func setVolumeTags(conn *ec2.EC2, d *schema.ResourceData) error { + if d.HasChange("volume_tags") { + oraw, nraw := d.GetChange("volume_tags") + o := oraw.(map[string]interface{}) + n := nraw.(map[string]interface{}) + create, remove := diffTags(tagsFromMap(o), tagsFromMap(n)) + + volumeIds, err := getAwsInstanceVolumeIds(conn, d) + if err != nil { + return err + } + + if len(remove) > 0 { + err := resource.Retry(2*time.Minute, func() *resource.RetryError { + log.Printf("[DEBUG] Removing volume tags: %#v from %s", remove, d.Id()) + _, err := conn.DeleteTags(&ec2.DeleteTagsInput{ + Resources: volumeIds, + Tags: remove, + }) + if err != nil { + ec2err, ok := err.(awserr.Error) + if ok && strings.Contains(ec2err.Code(), ".NotFound") { + return resource.RetryableError(err) // retry + } + return resource.NonRetryableError(err) + } + return nil + }) + if err != nil { + return err + } + } + if len(create) > 0 { + err := resource.Retry(2*time.Minute, func() *resource.RetryError { + log.Printf("[DEBUG] Creating vol tags: %s for %s", create, d.Id()) + _, err := conn.CreateTags(&ec2.CreateTagsInput{ + Resources: volumeIds, + Tags: create, + }) + if err != nil { + ec2err, ok := err.(awserr.Error) + if ok && strings.Contains(ec2err.Code(), ".NotFound") { + return resource.RetryableError(err) // retry + } + return resource.NonRetryableError(err) + } + return nil + }) + if err != nil { + return err + } + } + } + + return nil +} + // setTags is a helper to set the tags for a resource. It expects the // tags field to be named "tags" func setTags(conn *ec2.EC2, d *schema.ResourceData) error { diff --git a/installer/server/terraform/plugins/aws/tagsGeneric.go b/installer/server/terraform/plugins/aws/tagsGeneric.go new file mode 100644 index 0000000000..08bba67560 --- /dev/null +++ b/installer/server/terraform/plugins/aws/tagsGeneric.go @@ -0,0 +1,69 @@ +package aws + +import ( + "log" + "regexp" + + "github.com/aws/aws-sdk-go/aws" +) + +// diffTags takes our tags locally and the ones remotely and returns +// the set of tags that must be created, and the set of tags that must +// be destroyed. +func diffTagsGeneric(oldTags, newTags map[string]interface{}) (map[string]*string, map[string]*string) { + // First, we're creating everything we have + create := make(map[string]*string) + for k, v := range newTags { + create[k] = aws.String(v.(string)) + } + + // Build the map of what to remove + remove := make(map[string]*string) + for k, v := range oldTags { + old, ok := create[k] + if !ok || old != aws.String(v.(string)) { + // Delete it! + remove[k] = aws.String(v.(string)) + } + } + + return create, remove +} + +// tagsFromMap returns the tags for the given map of data. +func tagsFromMapGeneric(m map[string]interface{}) map[string]*string { + result := make(map[string]*string) + for k, v := range m { + if !tagIgnoredGeneric(k) { + result[k] = aws.String(v.(string)) + } + } + + return result +} + +// tagsToMap turns the tags into a map. +func tagsToMapGeneric(ts map[string]*string) map[string]string { + result := make(map[string]string) + for k, v := range ts { + if !tagIgnoredGeneric(k) { + result[k] = aws.StringValue(v) + } + } + + return result +} + +// compare a tag against a list of strings and checks if it should +// be ignored or not +func tagIgnoredGeneric(k string) bool { + filter := []string{"^aws:*"} + for _, v := range filter { + log.Printf("[DEBUG] Matching %v with %v\n", v, k) + if r, _ := regexp.MatchString(v, k); r == true { + log.Printf("[DEBUG] Found AWS specific tag %s, ignoring.\n", k) + return true + } + } + return false +} diff --git a/installer/server/terraform/plugins/aws/tagsGeneric_test.go b/installer/server/terraform/plugins/aws/tagsGeneric_test.go new file mode 100644 index 0000000000..2477f3aa50 --- /dev/null +++ b/installer/server/terraform/plugins/aws/tagsGeneric_test.go @@ -0,0 +1,73 @@ +package aws + +import ( + "reflect" + "testing" + + "github.com/aws/aws-sdk-go/aws" +) + +// go test -v -run="TestDiffGenericTags" +func TestDiffGenericTags(t *testing.T) { + cases := []struct { + Old, New map[string]interface{} + Create, Remove map[string]string + }{ + // Basic add/remove + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "bar": "baz", + }, + Create: map[string]string{ + "bar": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Modify + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "foo": "baz", + }, + Create: map[string]string{ + "foo": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + } + + for i, tc := range cases { + c, r := diffTagsGeneric(tc.Old, tc.New) + cm := tagsToMapGeneric(c) + rm := tagsToMapGeneric(r) + if !reflect.DeepEqual(cm, tc.Create) { + t.Fatalf("%d: bad create: %#v", i, cm) + } + if !reflect.DeepEqual(rm, tc.Remove) { + t.Fatalf("%d: bad remove: %#v", i, rm) + } + } +} + +// go test -v -run="TestIgnoringTagsGeneric" +func TestIgnoringTagsGeneric(t *testing.T) { + ignoredTags := map[string]*string{ + "aws:cloudformation:logical-id": aws.String("foo"), + "aws:foo:bar": aws.String("baz"), + } + for k, v := range ignoredTags { + if !tagIgnoredGeneric(k) { + t.Fatalf("Tag %v with value %v not ignored, but should be!", k, *v) + } + } +} diff --git a/installer/server/terraform/plugins/aws/tagsKMS.go b/installer/server/terraform/plugins/aws/tagsKMS.go new file mode 100644 index 0000000000..d4d2eca1c5 --- /dev/null +++ b/installer/server/terraform/plugins/aws/tagsKMS.go @@ -0,0 +1,115 @@ +package aws + +import ( + "log" + "regexp" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/kms" + "github.com/hashicorp/terraform/helper/schema" +) + +// setTags is a helper to set the tags for a resource. It expects the +// tags field to be named "tags" +func setTagsKMS(conn *kms.KMS, d *schema.ResourceData, keyId string) error { + if d.HasChange("tags") { + oraw, nraw := d.GetChange("tags") + o := oraw.(map[string]interface{}) + n := nraw.(map[string]interface{}) + create, remove := diffTagsKMS(tagsFromMapKMS(o), tagsFromMapKMS(n)) + + // Set tags + if len(remove) > 0 { + log.Printf("[DEBUG] Removing tags: %#v", remove) + k := make([]*string, len(remove), len(remove)) + for i, t := range remove { + k[i] = t.TagKey + } + + _, err := conn.UntagResource(&kms.UntagResourceInput{ + KeyId: aws.String(keyId), + TagKeys: k, + }) + if err != nil { + return err + } + } + if len(create) > 0 { + log.Printf("[DEBUG] Creating tags: %#v", create) + _, err := conn.TagResource(&kms.TagResourceInput{ + KeyId: aws.String(keyId), + Tags: create, + }) + if err != nil { + return err + } + } + } + + return nil +} + +// diffTags takes our tags locally and the ones remotely and returns +// the set of tags that must be created, and the set of tags that must +// be destroyed. +func diffTagsKMS(oldTags, newTags []*kms.Tag) ([]*kms.Tag, []*kms.Tag) { + // First, we're creating everything we have + create := make(map[string]interface{}) + for _, t := range newTags { + create[aws.StringValue(t.TagKey)] = aws.StringValue(t.TagValue) + } + + // Build the list of what to remove + var remove []*kms.Tag + for _, t := range oldTags { + old, ok := create[aws.StringValue(t.TagKey)] + if !ok || old != aws.StringValue(t.TagValue) { + // Delete it! + remove = append(remove, t) + } + } + + return tagsFromMapKMS(create), remove +} + +// tagsFromMap returns the tags for the given map of data. +func tagsFromMapKMS(m map[string]interface{}) []*kms.Tag { + result := make([]*kms.Tag, 0, len(m)) + for k, v := range m { + t := &kms.Tag{ + TagKey: aws.String(k), + TagValue: aws.String(v.(string)), + } + if !tagIgnoredKMS(t) { + result = append(result, t) + } + } + + return result +} + +// tagsToMap turns the list of tags into a map. +func tagsToMapKMS(ts []*kms.Tag) map[string]string { + result := make(map[string]string) + for _, t := range ts { + if !tagIgnoredKMS(t) { + result[aws.StringValue(t.TagKey)] = aws.StringValue(t.TagValue) + } + } + + return result +} + +// compare a tag against a list of strings and checks if it should +// be ignored or not +func tagIgnoredKMS(t *kms.Tag) bool { + filter := []string{"^aws:*"} + for _, v := range filter { + log.Printf("[DEBUG] Matching %v with %v\n", v, *t.TagKey) + if r, _ := regexp.MatchString(v, *t.TagKey); r == true { + log.Printf("[DEBUG] Found AWS specific tag %s (val: %s), ignoring.\n", *t.TagKey, *t.TagValue) + return true + } + } + return false +} diff --git a/installer/server/terraform/plugins/aws/tagsKMS_test.go b/installer/server/terraform/plugins/aws/tagsKMS_test.go new file mode 100644 index 0000000000..a1d7a770e2 --- /dev/null +++ b/installer/server/terraform/plugins/aws/tagsKMS_test.go @@ -0,0 +1,105 @@ +package aws + +import ( + "fmt" + "reflect" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/kms" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +// go test -v -run="TestDiffKMSTags" +func TestDiffKMSTags(t *testing.T) { + cases := []struct { + Old, New map[string]interface{} + Create, Remove map[string]string + }{ + // Basic add/remove + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "bar": "baz", + }, + Create: map[string]string{ + "bar": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Modify + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "foo": "baz", + }, + Create: map[string]string{ + "foo": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + } + + for i, tc := range cases { + c, r := diffTagsKMS(tagsFromMapKMS(tc.Old), tagsFromMapKMS(tc.New)) + cm := tagsToMapKMS(c) + rm := tagsToMapKMS(r) + if !reflect.DeepEqual(cm, tc.Create) { + t.Fatalf("%d: bad create: %#v", i, cm) + } + if !reflect.DeepEqual(rm, tc.Remove) { + t.Fatalf("%d: bad remove: %#v", i, rm) + } + } +} + +// go test -v -run="TestIgnoringTagsKMS" +func TestIgnoringTagsKMS(t *testing.T) { + var ignoredTags []*kms.Tag + ignoredTags = append(ignoredTags, &kms.Tag{ + TagKey: aws.String("aws:cloudformation:logical-id"), + TagValue: aws.String("foo"), + }) + ignoredTags = append(ignoredTags, &kms.Tag{ + TagKey: aws.String("aws:foo:bar"), + TagValue: aws.String("baz"), + }) + for _, tag := range ignoredTags { + if !tagIgnoredKMS(tag) { + t.Fatalf("Tag %v with value %v not ignored, but should be!", *tag.TagKey, *tag.TagValue) + } + } +} + +// testAccCheckTags can be used to check the tags on a resource. +func testAccCheckKMSTags( + ts []*kms.Tag, key string, value string) resource.TestCheckFunc { + return func(s *terraform.State) error { + m := tagsToMapKMS(ts) + v, ok := m[key] + if value != "" && !ok { + return fmt.Errorf("Missing tag: %s", key) + } else if value == "" && ok { + return fmt.Errorf("Extra tag: %s", key) + } + if value == "" { + return nil + } + + if v != value { + return fmt.Errorf("%s: bad value: %s", key, v) + } + + return nil + } +} diff --git a/installer/server/terraform/plugins/aws/tagsLambda.go b/installer/server/terraform/plugins/aws/tagsLambda.go new file mode 100644 index 0000000000..28aa251215 --- /dev/null +++ b/installer/server/terraform/plugins/aws/tagsLambda.go @@ -0,0 +1,50 @@ +package aws + +import ( + "log" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/lambda" + "github.com/hashicorp/terraform/helper/schema" +) + +// setTags is a helper to set the tags for a resource. It expects the +// tags field to be named "tags" +func setTagsLambda(conn *lambda.Lambda, d *schema.ResourceData, arn string) error { + if d.HasChange("tags") { + oraw, nraw := d.GetChange("tags") + o := oraw.(map[string]interface{}) + n := nraw.(map[string]interface{}) + create, remove := diffTagsGeneric(o, n) + + // Set tags + if len(remove) > 0 { + log.Printf("[DEBUG] Removing tags: %#v", remove) + keys := make([]*string, 0, len(remove)) + for k := range remove { + keys = append(keys, aws.String(k)) + } + + _, err := conn.UntagResource(&lambda.UntagResourceInput{ + Resource: aws.String(arn), + TagKeys: keys, + }) + if err != nil { + return err + } + } + if len(create) > 0 { + log.Printf("[DEBUG] Creating tags: %#v", create) + + _, err := conn.TagResource(&lambda.TagResourceInput{ + Resource: aws.String(arn), + Tags: create, + }) + if err != nil { + return err + } + } + } + + return nil +} diff --git a/installer/server/terraform/plugins/aws/test-fixtures/lambda_confirm_sns.zip b/installer/server/terraform/plugins/aws/test-fixtures/lambda_confirm_sns.zip new file mode 100644 index 0000000000000000000000000000000000000000..c88d2d400f569dade47f77989f654da4c709867e GIT binary patch literal 565 zcmWIWW@Zs#U|`^2FxfEOYk}b#wTX-j3@e!#7}yzP7;+Oc^YjWTLqj+jm{mCbMs)l9 zizuz&W?*Fb3RJ}c)W5~>*xk~%_?Q5AT&!=f{uDf-pq%-iSx3%i=>(8riioV>m^0J)VnuBFx z@`nN@H_m^{D*w`1EUP|O^pxd^)0>SgrNy6wtyTV_tiAuqBxxn@0;Z|o=J85+-gslO zKY7^%oA3P%YQ7c-pu)0`3WkTxZdj}^zG+?d1 z_dVEa<6`-a`>ea(nl0PjeKc6w<5}W_Quh-E3XlJC3;9IW?+>W9-ng0n`Qq9ew_A@} zTQW=j?Y94D?eQYv(|^ysk8gLx2Y53w$uZ-KQwdO 20) { errors = append(errors, fmt.Errorf( - "%q must contain from 1 to 20 alphanumeric characters or hyphens", k)) + "%q (%q) must contain from 1 to 20 alphanumeric characters or hyphens", k, value)) } if !regexp.MustCompile(`^[0-9a-z-]+$`).MatchString(value) { errors = append(errors, fmt.Errorf( - "only lowercase alphanumeric characters and hyphens allowed in %q", k)) + "only lowercase alphanumeric characters and hyphens allowed in %q (%q)", k, value)) } if !regexp.MustCompile(`^[a-z]`).MatchString(value) { errors = append(errors, fmt.Errorf( - "first character of %q must be a letter", k)) + "first character of %q (%q) must be a letter", k, value)) } if regexp.MustCompile(`--`).MatchString(value) { errors = append(errors, fmt.Errorf( - "%q cannot contain two consecutive hyphens", k)) + "%q (%q) cannot contain two consecutive hyphens", k, value)) } if regexp.MustCompile(`-$`).MatchString(value) { errors = append(errors, fmt.Errorf( - "%q cannot end with a hyphen", k)) + "%q (%q) cannot end with a hyphen", k, value)) } return } @@ -102,7 +121,27 @@ func validateDbParamGroupName(v interface{}, k string) (ws []string, errors []er "%q cannot be greater than 255 characters", k)) } return +} +func validateDbParamGroupNamePrefix(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[0-9a-z-]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "only lowercase alphanumeric characters and hyphens allowed in %q", k)) + } + if !regexp.MustCompile(`^[a-z]`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "first character of %q must be a letter", k)) + } + if regexp.MustCompile(`--`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q cannot contain two consecutive hyphens", k)) + } + if len(value) > 255 { + errors = append(errors, fmt.Errorf( + "%q cannot be greater than 226 characters", k)) + } + return } func validateStreamViewType(v interface{}, k string) (ws []string, errors []error) { @@ -140,7 +179,24 @@ func validateElbName(v interface{}, k string) (ws []string, errors []error) { "%q cannot end with a hyphen: %q", k, value)) } return +} +func validateElbNamePrefix(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "only alphanumeric characters and hyphens allowed in %q: %q", + k, value)) + } + if len(value) > 6 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 6 characters: %q", k, value)) + } + if regexp.MustCompile(`^-`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q cannot begin with a hyphen: %q", k, value)) + } + return } func validateEcrRepositoryName(v interface{}, k string) (ws []string, errors []error) { @@ -297,7 +353,7 @@ func validateArn(v interface{}, k string) (ws []string, errors []error) { } // http://docs.aws.amazon.com/lambda/latest/dg/API_AddPermission.html - pattern := `^arn:[\w-]+:([a-zA-Z0-9\-])+:([a-z]{2}-[a-z]+-\d{1})?:(\d{12})?:(.*)$` + pattern := `^arn:[\w-]+:([a-zA-Z0-9\-])+:([a-z]{2}-(gov-)?[a-z]+-\d{1})?:(\d{12})?:(.*)$` if !regexp.MustCompile(pattern).MatchString(value) { errors = append(errors, fmt.Errorf( "%q doesn't look like a valid ARN (%q): %q", @@ -427,6 +483,26 @@ func validateLogGroupName(v interface{}, k string) (ws []string, errors []error) return } +func validateLogGroupNamePrefix(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + + if len(value) > 483 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 483 characters: %q", k, value)) + } + + // http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html + pattern := `^[\.\-_/#A-Za-z0-9]+$` + if !regexp.MustCompile(pattern).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q isn't a valid log group name (alphanumeric characters, underscores,"+ + " hyphens, slashes, hash signs and dots are allowed): %q", + k, value)) + } + + return +} + func validateS3BucketLifecycleTimestamp(v interface{}, k string) (ws []string, errors []error) { value := v.(string) _, err := time.Parse(time.RFC3339, fmt.Sprintf("%sT00:00:00Z", value)) @@ -871,8 +947,9 @@ func validateDmsReplicationTaskId(v interface{}, k string) (ws []string, es []er func validateAppautoscalingScalableDimension(v interface{}, k string) (ws []string, errors []error) { value := v.(string) dimensions := map[string]bool{ - "ecs:service:DesiredCount": true, - "ec2:spot-fleet-request:TargetCapacity": true, + "ecs:service:DesiredCount": true, + "ec2:spot-fleet-request:TargetCapacity": true, + "elasticmapreduce:instancegroup:InstanceCount": true, } if !dimensions[value] { @@ -884,8 +961,9 @@ func validateAppautoscalingScalableDimension(v interface{}, k string) (ws []stri func validateAppautoscalingServiceNamespace(v interface{}, k string) (ws []string, errors []error) { value := v.(string) namespaces := map[string]bool{ - "ecs": true, - "ec2": true, + "ecs": true, + "ec2": true, + "elasticmapreduce": true, } if !namespaces[value] { @@ -926,7 +1004,300 @@ func validateConfigExecutionFrequency(v interface{}, k string) (ws []string, err } } errors = append(errors, fmt.Errorf( - "%q contains an invalid freqency %q. Valid frequencies are %q.", + "%q contains an invalid frequency %q. Valid frequencies are %q.", k, frequency, validFrequencies)) return } + +func validateAccountAlias(v interface{}, k string) (ws []string, es []error) { + val := v.(string) + + if (len(val) < 3) || (len(val) > 63) { + es = append(es, fmt.Errorf("%q must contain from 3 to 63 alphanumeric characters or hyphens", k)) + } + if !regexp.MustCompile("^[a-z0-9][a-z0-9-]+$").MatchString(val) { + es = append(es, fmt.Errorf("%q must start with an alphanumeric character and only contain lowercase alphanumeric characters and hyphens", k)) + } + if strings.Contains(val, "--") { + es = append(es, fmt.Errorf("%q must not contain consecutive hyphens", k)) + } + if strings.HasSuffix(val, "-") { + es = append(es, fmt.Errorf("%q must not end in a hyphen", k)) + } + return +} + +func validateApiGatewayApiKeyValue(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if len(value) < 30 { + errors = append(errors, fmt.Errorf( + "%q must be at least 30 characters long", k)) + } + if len(value) > 128 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 128 characters", k)) + } + return +} + +func validateIamRolePolicyName(v interface{}, k string) (ws []string, errors []error) { + // https://github.com/boto/botocore/blob/2485f5c/botocore/data/iam/2010-05-08/service-2.json#L8291-L8296 + value := v.(string) + if len(value) > 128 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 128 characters", k)) + } + if !regexp.MustCompile("^[\\w+=,.@-]+$").MatchString(value) { + errors = append(errors, fmt.Errorf("%q must match [\\w+=,.@-]", k)) + } + return +} + +func validateIamRolePolicyNamePrefix(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if len(value) > 100 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 100 characters", k)) + } + if !regexp.MustCompile("^[\\w+=,.@-]+$").MatchString(value) { + errors = append(errors, fmt.Errorf("%q must match [\\w+=,.@-]", k)) + } + return +} + +func validateApiGatewayUsagePlanQuotaSettingsPeriod(v interface{}, k string) (ws []string, errors []error) { + validPeriods := []string{ + apigateway.QuotaPeriodTypeDay, + apigateway.QuotaPeriodTypeWeek, + apigateway.QuotaPeriodTypeMonth, + } + period := v.(string) + for _, f := range validPeriods { + if period == f { + return + } + } + errors = append(errors, fmt.Errorf( + "%q contains an invalid period %q. Valid period are %q.", + k, period, validPeriods)) + return +} + +func validateApiGatewayUsagePlanQuotaSettings(v map[string]interface{}) (errors []error) { + period := v["period"].(string) + offset := v["offset"].(int) + + if period == apigateway.QuotaPeriodTypeDay && offset != 0 { + errors = append(errors, fmt.Errorf("Usage Plan quota offset must be zero in the DAY period")) + } + + if period == apigateway.QuotaPeriodTypeWeek && (offset < 0 || offset > 6) { + errors = append(errors, fmt.Errorf("Usage Plan quota offset must be between 0 and 6 inclusive in the WEEK period")) + } + + if period == apigateway.QuotaPeriodTypeMonth && (offset < 0 || offset > 27) { + errors = append(errors, fmt.Errorf("Usage Plan quota offset must be between 0 and 27 inclusive in the MONTH period")) + } + + return +} + +func validateDbSubnetGroupName(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[ .0-9a-z-_]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "only lowercase alphanumeric characters, hyphens, underscores, periods, and spaces allowed in %q", k)) + } + if len(value) > 255 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 255 characters", k)) + } + if regexp.MustCompile(`(?i)^default$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q is not allowed as %q", "Default", k)) + } + return +} + +func validateDbSubnetGroupNamePrefix(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[ .0-9a-z-_]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "only lowercase alphanumeric characters, hyphens, underscores, periods, and spaces allowed in %q", k)) + } + if len(value) > 229 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 229 characters", k)) + } + return +} + +func validateDbOptionGroupName(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[a-z]`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "first character of %q must be a letter", k)) + } + if !regexp.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "only alphanumeric characters and hyphens allowed in %q", k)) + } + if regexp.MustCompile(`--`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q cannot contain two consecutive hyphens", k)) + } + if regexp.MustCompile(`-$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q cannot end with a hyphen", k)) + } + if len(value) > 255 { + errors = append(errors, fmt.Errorf( + "%q cannot be greater than 255 characters", k)) + } + return +} + +func validateDbOptionGroupNamePrefix(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[a-z]`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "first character of %q must be a letter", k)) + } + if !regexp.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "only alphanumeric characters and hyphens allowed in %q", k)) + } + if regexp.MustCompile(`--`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q cannot contain two consecutive hyphens", k)) + } + if len(value) > 229 { + errors = append(errors, fmt.Errorf( + "%q cannot be greater than 229 characters", k)) + } + return +} + +func validateAwsAlbTargetGroupName(v interface{}, k string) (ws []string, errors []error) { + name := v.(string) + if len(name) > 32 { + errors = append(errors, fmt.Errorf("%q (%q) cannot be longer than '32' characters", k, name)) + } + return +} + +func validateAwsAlbTargetGroupNamePrefix(v interface{}, k string) (ws []string, errors []error) { + name := v.(string) + if len(name) > 32 { + errors = append(errors, fmt.Errorf("%q (%q) cannot be longer than '6' characters", k, name)) + } + return +} + +func validateOpenIdURL(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + u, err := url.Parse(value) + if err != nil { + errors = append(errors, fmt.Errorf("%q has to be a valid URL", k)) + return + } + if u.Scheme != "https" { + errors = append(errors, fmt.Errorf("%q has to use HTTPS scheme (i.e. begin with https://)", k)) + } + if len(u.Query()) > 0 { + errors = append(errors, fmt.Errorf("%q cannot contain query parameters per the OIDC standard", k)) + } + return +} + +func validateAwsKmsName(v interface{}, k string) (ws []string, es []error) { + value := v.(string) + if !regexp.MustCompile(`^(alias\/)[a-zA-Z0-9:/_-]+$`).MatchString(value) { + es = append(es, fmt.Errorf( + "%q must begin with 'alias/' and be comprised of only [a-zA-Z0-9:/_-]", k)) + } + return +} + +func validateCognitoIdentityPoolName(v interface{}, k string) (ws []string, errors []error) { + val := v.(string) + if !regexp.MustCompile("^[\\w _]+$").MatchString(val) { + errors = append(errors, fmt.Errorf("%q must contain only alphanumeric caracters and spaces", k)) + } + + return +} + +func validateCognitoProviderDeveloperName(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if len(value) > 100 { + errors = append(errors, fmt.Errorf("%q cannot be longer than 100 caracters", k)) + } + + if !regexp.MustCompile("^[\\w._-]+$").MatchString(value) { + errors = append(errors, fmt.Errorf("%q must contain only alphanumeric caracters, dots, underscores and hyphens", k)) + } + + return +} + +func validateCognitoSupportedLoginProviders(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if len(value) < 1 { + errors = append(errors, fmt.Errorf("%q cannot be less than 1 character", k)) + } + + if len(value) > 128 { + errors = append(errors, fmt.Errorf("%q cannot be longer than 128 caracters", k)) + } + + if !regexp.MustCompile("^[\\w.;_/-]+$").MatchString(value) { + errors = append(errors, fmt.Errorf("%q must contain only alphanumeric caracters, dots, semicolons, underscores, slashes and hyphens", k)) + } + + return +} + +func validateCognitoIdentityProvidersClientId(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if len(value) < 1 { + errors = append(errors, fmt.Errorf("%q cannot be less than 1 character", k)) + } + + if len(value) > 128 { + errors = append(errors, fmt.Errorf("%q cannot be longer than 128 caracters", k)) + } + + if !regexp.MustCompile("^[\\w_]+$").MatchString(value) { + errors = append(errors, fmt.Errorf("%q must contain only alphanumeric caracters and underscores", k)) + } + + return +} + +func validateCognitoIdentityProvidersProviderName(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if len(value) < 1 { + errors = append(errors, fmt.Errorf("%q cannot be less than 1 character", k)) + } + + if len(value) > 128 { + errors = append(errors, fmt.Errorf("%q cannot be longer than 128 caracters", k)) + } + + if !regexp.MustCompile("^[\\w._:/-]+$").MatchString(value) { + errors = append(errors, fmt.Errorf("%q must contain only alphanumeric caracters, dots, underscores, colons, slashes and hyphens", k)) + } + + return +} + +func validateWafMetricName(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[0-9A-Za-z]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "Only alphanumeric characters allowed in %q: %q", + k, value)) + } + return +} diff --git a/installer/server/terraform/plugins/aws/validators_test.go b/installer/server/terraform/plugins/aws/validators_test.go index 8920ae7649..b344f206d5 100644 --- a/installer/server/terraform/plugins/aws/validators_test.go +++ b/installer/server/terraform/plugins/aws/validators_test.go @@ -207,6 +207,7 @@ func TestValidateArn(t *testing.T) { "arn:aws:lambda:eu-west-1:319201112229:function:myCustomFunction", // Lambda function "arn:aws:lambda:eu-west-1:319201112229:function:myCustomFunction:Qualifier", // Lambda func qualifier "arn:aws-us-gov:s3:::corp_bucket/object.png", // GovCloud ARN + "arn:aws-us-gov:kms:us-gov-west-1:123456789012:key/some-uuid-abc123", // GovCloud KMS ARN } for _, v := range validNames { _, errors := validateArn(v, "arn") @@ -410,7 +411,7 @@ func TestValidateLogGroupName(t *testing.T) { for _, v := range validNames { _, errors := validateLogGroupName(v, "name") if len(errors) != 0 { - t.Fatalf("%q should be a valid Log Metric Filter Transformation Name: %q", v, errors) + t.Fatalf("%q should be a valid Log Group name: %q", v, errors) } } @@ -427,7 +428,42 @@ func TestValidateLogGroupName(t *testing.T) { for _, v := range invalidNames { _, errors := validateLogGroupName(v, "name") if len(errors) == 0 { - t.Fatalf("%q should be an invalid Log Metric Filter Transformation Name", v) + t.Fatalf("%q should be an invalid Log Group name", v) + } + } +} + +func TestValidateLogGroupNamePrefix(t *testing.T) { + validNames := []string{ + "ValidLogGroupName", + "ValidLogGroup.Name", + "valid/Log-group", + "1234", + "YadaValid#0123", + "Also_valid-name", + strings.Repeat("W", 483), + } + for _, v := range validNames { + _, errors := validateLogGroupNamePrefix(v, "name_prefix") + if len(errors) != 0 { + t.Fatalf("%q should be a valid Log Group name prefix: %q", v, errors) + } + } + + invalidNames := []string{ + "Here is a name with: colon", + "and here is another * invalid name", + "also $ invalid", + "This . is also %% invalid@!)+(", + "*", + "", + // length > 483 + strings.Repeat("W", 484), + } + for _, v := range invalidNames { + _, errors := validateLogGroupNamePrefix(v, "name_prefix") + if len(errors) == 0 { + t.Fatalf("%q should be an invalid Log Group name prefix", v) } } } @@ -1550,3 +1586,626 @@ func TestValidateDmsReplicationTaskId(t *testing.T) { } } } + +func TestValidateAccountAlias(t *testing.T) { + validAliases := []string{ + "tf-alias", + "0tf-alias1", + } + + for _, s := range validAliases { + _, errors := validateAccountAlias(s, "account_alias") + if len(errors) > 0 { + t.Fatalf("%q should be a valid account alias: %v", s, errors) + } + } + + invalidAliases := []string{ + "tf", + "-tf", + "tf-", + "TF-Alias", + "tf-alias-tf-alias-tf-alias-tf-alias-tf-alias-tf-alias-tf-alias-tf-alias", + } + + for _, s := range invalidAliases { + _, errors := validateAccountAlias(s, "account_alias") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid account alias: %v", s, errors) + } + } +} + +func TestValidateIamRoleProfileName(t *testing.T) { + validNames := []string{ + "tf-test-role-profile-1", + } + + for _, s := range validNames { + _, errors := validateIamRolePolicyName(s, "name") + if len(errors) > 0 { + t.Fatalf("%q should be a valid IAM role policy name: %v", s, errors) + } + } + + invalidNames := []string{ + "invalid#name", + "this-is-a-very-long-role-policy-name-this-is-a-very-long-role-policy-name-this-is-a-very-long-role-policy-name-this-is-a-very-long", + } + + for _, s := range invalidNames { + _, errors := validateIamRolePolicyName(s, "name") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid IAM role policy name: %v", s, errors) + } + } +} + +func TestValidateIamRoleProfileNamePrefix(t *testing.T) { + validNamePrefixes := []string{ + "tf-test-role-profile-", + } + + for _, s := range validNamePrefixes { + _, errors := validateIamRolePolicyNamePrefix(s, "name_prefix") + if len(errors) > 0 { + t.Fatalf("%q should be a valid IAM role policy name prefix: %v", s, errors) + } + } + + invalidNamePrefixes := []string{ + "invalid#name_prefix", + "this-is-a-very-long-role-policy-name-prefix-this-is-a-very-long-role-policy-name-prefix-this-is-a-very-", + } + + for _, s := range invalidNamePrefixes { + _, errors := validateIamRolePolicyNamePrefix(s, "name_prefix") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid IAM role policy name prefix: %v", s, errors) + } + } +} + +func TestValidateApiGatewayUsagePlanQuotaSettingsPeriod(t *testing.T) { + validEntries := []string{ + "DAY", + "WEEK", + "MONTH", + } + + invalidEntries := []string{ + "fooBAR", + "foobar45Baz", + "foobar45Baz@!", + } + + for _, v := range validEntries { + _, errors := validateApiGatewayUsagePlanQuotaSettingsPeriod(v, "name") + if len(errors) != 0 { + t.Fatalf("%q should be a valid API Gateway Quota Settings Period: %v", v, errors) + } + } + + for _, v := range invalidEntries { + _, errors := validateApiGatewayUsagePlanQuotaSettingsPeriod(v, "name") + if len(errors) == 0 { + t.Fatalf("%q should not be a API Gateway Quota Settings Period", v) + } + } +} + +func TestValidateApiGatewayUsagePlanQuotaSettings(t *testing.T) { + cases := []struct { + Offset int + Period string + ErrCount int + }{ + { + Offset: 0, + Period: "DAY", + ErrCount: 0, + }, + { + Offset: -1, + Period: "DAY", + ErrCount: 1, + }, + { + Offset: 1, + Period: "DAY", + ErrCount: 1, + }, + { + Offset: 0, + Period: "WEEK", + ErrCount: 0, + }, + { + Offset: 6, + Period: "WEEK", + ErrCount: 0, + }, + { + Offset: -1, + Period: "WEEK", + ErrCount: 1, + }, + { + Offset: 7, + Period: "WEEK", + ErrCount: 1, + }, + { + Offset: 0, + Period: "MONTH", + ErrCount: 0, + }, + { + Offset: 27, + Period: "MONTH", + ErrCount: 0, + }, + { + Offset: -1, + Period: "MONTH", + ErrCount: 1, + }, + { + Offset: 28, + Period: "MONTH", + ErrCount: 1, + }, + } + + for _, tc := range cases { + m := make(map[string]interface{}) + m["offset"] = tc.Offset + m["period"] = tc.Period + + errors := validateApiGatewayUsagePlanQuotaSettings(m) + if len(errors) != tc.ErrCount { + t.Fatalf("API Gateway Usage Plan Quota Settings validation failed: %v", errors) + } + } +} + +func TestValidateElbName(t *testing.T) { + validNames := []string{ + "tf-test-elb", + } + + for _, s := range validNames { + _, errors := validateElbName(s, "name") + if len(errors) > 0 { + t.Fatalf("%q should be a valid ELB name: %v", s, errors) + } + } + + invalidNames := []string{ + "tf.test.elb.1", + "tf-test-elb-tf-test-elb-tf-test-elb", + "-tf-test-elb", + "tf-test-elb-", + } + + for _, s := range invalidNames { + _, errors := validateElbName(s, "name") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid ELB name: %v", s, errors) + } + } +} + +func TestValidateElbNamePrefix(t *testing.T) { + validNamePrefixes := []string{ + "test-", + } + + for _, s := range validNamePrefixes { + _, errors := validateElbNamePrefix(s, "name_prefix") + if len(errors) > 0 { + t.Fatalf("%q should be a valid ELB name prefix: %v", s, errors) + } + } + + invalidNamePrefixes := []string{ + "tf.test.elb.", + "tf-test", + "-test", + } + + for _, s := range invalidNamePrefixes { + _, errors := validateElbNamePrefix(s, "name_prefix") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid ELB name prefix: %v", s, errors) + } + } +} + +func TestValidateDbSubnetGroupName(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + { + Value: "tEsting", + ErrCount: 1, + }, + { + Value: "testing?", + ErrCount: 1, + }, + { + Value: "default", + ErrCount: 1, + }, + { + Value: randomString(300), + ErrCount: 1, + }, + } + + for _, tc := range cases { + _, errors := validateDbSubnetGroupName(tc.Value, "aws_db_subnet_group") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the DB Subnet Group name to trigger a validation error") + } + } +} + +func TestValidateDbSubnetGroupNamePrefix(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + { + Value: "tEsting", + ErrCount: 1, + }, + { + Value: "testing?", + ErrCount: 1, + }, + { + Value: randomString(230), + ErrCount: 1, + }, + } + + for _, tc := range cases { + _, errors := validateDbSubnetGroupNamePrefix(tc.Value, "aws_db_subnet_group") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the DB Subnet Group name prefix to trigger a validation error") + } + } +} + +func TestValidateDbOptionGroupName(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + { + Value: "testing123!", + ErrCount: 1, + }, + { + Value: "1testing123", + ErrCount: 1, + }, + { + Value: "testing--123", + ErrCount: 1, + }, + { + Value: "testing123-", + ErrCount: 1, + }, + { + Value: randomString(256), + ErrCount: 1, + }, + } + + for _, tc := range cases { + _, errors := validateDbOptionGroupName(tc.Value, "aws_db_option_group_name") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the DB Option Group Name to trigger a validation error") + } + } +} + +func TestValidateDbOptionGroupNamePrefix(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + { + Value: "testing123!", + ErrCount: 1, + }, + { + Value: "1testing123", + ErrCount: 1, + }, + { + Value: "testing--123", + ErrCount: 1, + }, + { + Value: randomString(230), + ErrCount: 1, + }, + } + + for _, tc := range cases { + _, errors := validateDbOptionGroupNamePrefix(tc.Value, "aws_db_option_group_name") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the DB Option Group name prefix to trigger a validation error") + } + } +} + +func TestValidateOpenIdURL(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + { + Value: "http://wrong.scheme.com", + ErrCount: 1, + }, + { + Value: "ftp://wrong.scheme.co.uk", + ErrCount: 1, + }, + { + Value: "%@invalidUrl", + ErrCount: 1, + }, + { + Value: "https://example.com/?query=param", + ErrCount: 1, + }, + } + + for _, tc := range cases { + _, errors := validateOpenIdURL(tc.Value, "url") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected %d of OpenID URL validation errors, got %d", tc.ErrCount, len(errors)) + } + } +} + +func TestValidateAwsKmsName(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + { + Value: "alias/aws/s3", + ErrCount: 0, + }, + { + Value: "alias/hashicorp", + ErrCount: 0, + }, + { + Value: "hashicorp", + ErrCount: 1, + }, + { + Value: "hashicorp/terraform", + ErrCount: 1, + }, + } + + for _, tc := range cases { + _, errors := validateAwsKmsName(tc.Value, "name") + if len(errors) != tc.ErrCount { + t.Fatalf("AWS KMS Alias Name validation failed: %v", errors) + } + } +} + +func TestValidateCognitoIdentityPoolName(t *testing.T) { + validValues := []string{ + "123", + "1 2 3", + "foo", + "foo bar", + "foo_bar", + "1foo 2bar 3", + } + + for _, s := range validValues { + _, errors := validateCognitoIdentityPoolName(s, "identity_pool_name") + if len(errors) > 0 { + t.Fatalf("%q should be a valid Cognito Identity Pool Name: %v", s, errors) + } + } + + invalidValues := []string{ + "1-2-3", + "foo!", + "foo-bar", + "foo-bar", + "foo1-bar2", + } + + for _, s := range invalidValues { + _, errors := validateCognitoIdentityPoolName(s, "identity_pool_name") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid Cognito Identity Pool Name: %v", s, errors) + } + } +} + +func TestValidateCognitoProviderDeveloperName(t *testing.T) { + validValues := []string{ + "1", + "foo", + "1.2", + "foo1-bar2-baz3", + "foo_bar", + } + + for _, s := range validValues { + _, errors := validateCognitoProviderDeveloperName(s, "developer_provider_name") + if len(errors) > 0 { + t.Fatalf("%q should be a valid Cognito Provider Developer Name: %v", s, errors) + } + } + + invalidValues := []string{ + "foo!", + "foo:bar", + "foo/bar", + "foo;bar", + } + + for _, s := range invalidValues { + _, errors := validateCognitoProviderDeveloperName(s, "developer_provider_name") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid Cognito Provider Developer Name: %v", s, errors) + } + } +} + +func TestValidateCognitoSupportedLoginProviders(t *testing.T) { + validValues := []string{ + "foo", + "7346241598935552", + "123456789012.apps.googleusercontent.com", + "foo_bar", + "foo;bar", + "foo/bar", + "foo-bar", + "xvz1evFS4wEEPTGEFPHBog;kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw", + strings.Repeat("W", 128), + } + + for _, s := range validValues { + _, errors := validateCognitoSupportedLoginProviders(s, "supported_login_providers") + if len(errors) > 0 { + t.Fatalf("%q should be a valid Cognito Supported Login Providers: %v", s, errors) + } + } + + invalidValues := []string{ + "", + strings.Repeat("W", 129), // > 128 + "foo:bar_baz", + "foobar,foobaz", + "foobar=foobaz", + } + + for _, s := range invalidValues { + _, errors := validateCognitoSupportedLoginProviders(s, "supported_login_providers") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid Cognito Supported Login Providers: %v", s, errors) + } + } +} + +func TestValidateCognitoIdentityProvidersClientId(t *testing.T) { + validValues := []string{ + "7lhlkkfbfb4q5kpp90urffao", + "12345678", + "foo_123", + strings.Repeat("W", 128), + } + + for _, s := range validValues { + _, errors := validateCognitoIdentityProvidersClientId(s, "client_id") + if len(errors) > 0 { + t.Fatalf("%q should be a valid Cognito Identity Provider Client ID: %v", s, errors) + } + } + + invalidValues := []string{ + "", + strings.Repeat("W", 129), // > 128 + "foo-bar", + "foo:bar", + "foo;bar", + } + + for _, s := range invalidValues { + _, errors := validateCognitoIdentityProvidersClientId(s, "client_id") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid Cognito Identity Provider Client ID: %v", s, errors) + } + } +} + +func TestValidateCognitoIdentityProvidersProviderName(t *testing.T) { + validValues := []string{ + "foo", + "7346241598935552", + "foo_bar", + "foo:bar", + "foo/bar", + "foo-bar", + "cognito-idp.us-east-1.amazonaws.com/us-east-1_Zr231apJu", + strings.Repeat("W", 128), + } + + for _, s := range validValues { + _, errors := validateCognitoIdentityProvidersProviderName(s, "provider_name") + if len(errors) > 0 { + t.Fatalf("%q should be a valid Cognito Identity Provider Name: %v", s, errors) + } + } + + invalidValues := []string{ + "", + strings.Repeat("W", 129), // > 128 + "foo;bar_baz", + "foobar,foobaz", + "foobar=foobaz", + } + + for _, s := range invalidValues { + _, errors := validateCognitoIdentityProvidersProviderName(s, "provider_name") + if len(errors) == 0 { + t.Fatalf("%q should not be a valid Cognito Identity Provider Name: %v", s, errors) + } + } +} + +func TestValidateWafMetricName(t *testing.T) { + validNames := []string{ + "testrule", + "testRule", + "testRule123", + } + for _, v := range validNames { + _, errors := validateWafMetricName(v, "name") + if len(errors) != 0 { + t.Fatalf("%q should be a valid WAF metric name: %q", v, errors) + } + } + + invalidNames := []string{ + "!", + "/", + " ", + ":", + ";", + "white space", + "/slash-at-the-beginning", + "slash-at-the-end/", + } + for _, v := range invalidNames { + _, errors := validateWafMetricName(v, "name") + if len(errors) == 0 { + t.Fatalf("%q should be an invalid WAF metric name", v) + } + } +} diff --git a/installer/server/terraform/plugins/aws/waf_token_handlers.go b/installer/server/terraform/plugins/aws/waf_token_handlers.go new file mode 100644 index 0000000000..ac99f09507 --- /dev/null +++ b/installer/server/terraform/plugins/aws/waf_token_handlers.go @@ -0,0 +1,49 @@ +package aws + +import ( + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/errwrap" + "github.com/hashicorp/terraform/helper/resource" +) + +type WafRetryer struct { + Connection *waf.WAF + Region string +} + +type withTokenFunc func(token *string) (interface{}, error) + +func (t *WafRetryer) RetryWithToken(f withTokenFunc) (interface{}, error) { + awsMutexKV.Lock(t.Region) + defer awsMutexKV.Unlock(t.Region) + + var out interface{} + err := resource.Retry(15*time.Minute, func() *resource.RetryError { + var err error + var tokenOut *waf.GetChangeTokenOutput + + tokenOut, err = t.Connection.GetChangeToken(&waf.GetChangeTokenInput{}) + if err != nil { + return resource.NonRetryableError(errwrap.Wrapf("Failed to acquire change token: {{err}}", err)) + } + + out, err = f(tokenOut.ChangeToken) + if err != nil { + awsErr, ok := err.(awserr.Error) + if ok && awsErr.Code() == "WAFStaleDataException" { + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) + } + return nil + }) + + return out, err +} + +func newWafRetryer(conn *waf.WAF, region string) *WafRetryer { + return &WafRetryer{Connection: conn, Region: region} +} From 1107340a4482f97d5174fcb8db5ca023b90643cb Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Wed, 26 Apr 2017 17:09:01 -0700 Subject: [PATCH 4/7] installer/vendor: bump TerraForm to v0.9.4 (and other required deps) --- installer/glide.lock | 19 +- installer/glide.yaml | 6 +- .../resource_aws_dynamodb_table_migrate.go | 3 +- .../aws/aws-sdk-go/aws/client/client.go | 6 +- .../github.com/aws/aws-sdk-go/aws/config.go | 21 +- .../github.com/aws/aws-sdk-go/aws/context.go | 71 + .../aws/aws-sdk-go/aws/context_1_6.go | 41 + .../aws/aws-sdk-go/aws/context_1_7.go | 9 + .../aws-sdk-go/aws/corehandlers/handlers.go | 21 +- .../aws-sdk-go/aws/credentials/credentials.go | 23 +- .../stscreds/assume_role_provider.go | 159 +- .../aws/aws-sdk-go/aws/defaults/defaults.go | 47 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 110 +- .../aws/endpoints/v3model_codegen.go | 2 +- .../aws/aws-sdk-go/aws/jsonvalue.go | 11 + .../aws/aws-sdk-go/aws/request/handlers.go | 66 +- .../aws/aws-sdk-go/aws/request/request.go | 128 +- .../aws-sdk-go/aws/request/request_context.go | 14 + .../aws/request/request_context_1_6.go | 14 + .../aws/request/request_pagination.go | 154 +- .../aws/aws-sdk-go/aws/request/retryer.go | 76 +- .../aws/request/serialization_error.go | 19 + .../request/serialization_error_appengine.go | 11 + .../aws/request/timeout_read_closer.go | 94 + .../aws/aws-sdk-go/aws/request/waiter.go | 287 + .../aws/aws-sdk-go/aws/session/doc.go | 93 +- .../aws/aws-sdk-go/aws/session/env_config.go | 20 + .../aws/aws-sdk-go/aws/session/session.go | 178 +- .../aws/aws-sdk-go/aws/signer/v4/options.go | 7 + .../aws/aws-sdk-go/aws/signer/v4/v4.go | 27 +- .../github.com/aws/aws-sdk-go/aws/url.go | 12 + .../github.com/aws/aws-sdk-go/aws/url_1_7.go | 29 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../protocol/query/queryutil/queryutil.go | 7 +- .../aws-sdk-go/private/protocol/rest/build.go | 46 +- .../private/protocol/rest/unmarshal.go | 29 +- .../aws/aws-sdk-go/private/waiter/waiter.go | 134 - .../aws/aws-sdk-go/service/acm/api.go | 230 +- .../aws/aws-sdk-go/service/acm/errors.go | 2 +- .../aws/aws-sdk-go/service/acm/service.go | 2 +- .../aws/aws-sdk-go/service/apigateway/api.go | 3390 ++++++++++-- .../aws-sdk-go/service/apigateway/errors.go | 2 +- .../aws-sdk-go/service/apigateway/service.go | 2 +- .../service/applicationautoscaling/api.go | 313 +- .../service/applicationautoscaling/errors.go | 2 +- .../service/applicationautoscaling/service.go | 6 +- .../aws/aws-sdk-go/service/autoscaling/api.go | 1287 ++++- .../aws-sdk-go/service/autoscaling/errors.go | 2 +- .../aws-sdk-go/service/autoscaling/service.go | 2 +- .../aws-sdk-go/service/autoscaling/waiters.go | 157 +- .../aws-sdk-go/service/cloudformation/api.go | 757 ++- .../service/cloudformation/errors.go | 2 +- .../service/cloudformation/service.go | 2 +- .../service/cloudformation/waiters.go | 328 +- .../aws/aws-sdk-go/service/cloudfront/api.go | 1151 +++- .../aws-sdk-go/service/cloudfront/errors.go | 10 +- .../aws-sdk-go/service/cloudfront/service.go | 6 +- .../aws-sdk-go/service/cloudfront/waiters.go | 142 +- .../aws/aws-sdk-go/service/cloudtrail/api.go | 394 +- .../aws-sdk-go/service/cloudtrail/errors.go | 4 +- .../aws-sdk-go/service/cloudtrail/service.go | 2 +- .../aws/aws-sdk-go/service/cloudwatch/api.go | 411 +- .../aws-sdk-go/service/cloudwatch/errors.go | 2 +- .../aws-sdk-go/service/cloudwatch/service.go | 2 +- .../aws-sdk-go/service/cloudwatch/waiters.go | 52 +- .../service/cloudwatchevents/api.go | 911 ++- .../service/cloudwatchevents/errors.go | 9 +- .../service/cloudwatchevents/service.go | 10 +- .../aws-sdk-go/service/cloudwatchlogs/api.go | 794 ++- .../service/cloudwatchlogs/errors.go | 2 +- .../service/cloudwatchlogs/service.go | 2 +- .../aws/aws-sdk-go/service/codebuild/api.go | 229 +- .../aws-sdk-go/service/codebuild/errors.go | 2 +- .../aws-sdk-go/service/codebuild/service.go | 2 +- .../aws/aws-sdk-go/service/codecommit/api.go | 437 +- .../aws-sdk-go/service/codecommit/errors.go | 2 +- .../aws-sdk-go/service/codecommit/service.go | 2 +- .../aws/aws-sdk-go/service/codedeploy/api.go | 1042 +++- .../aws-sdk-go/service/codedeploy/errors.go | 2 +- .../aws-sdk-go/service/codedeploy/service.go | 2 +- .../aws-sdk-go/service/codedeploy/waiters.go | 62 +- .../aws-sdk-go/service/codepipeline/api.go | 497 +- .../aws-sdk-go/service/codepipeline/errors.go | 2 +- .../service/codepipeline/service.go | 2 +- .../aws-sdk-go/service/cognitoidentity/api.go | 4113 ++++++++++++++ .../service/cognitoidentity/customizations.go | 12 + .../service/cognitoidentity/errors.go | 77 + .../service/cognitoidentity/service.go | 124 + .../aws-sdk-go/service/configservice/api.go | 608 +- .../service/configservice/errors.go | 2 +- .../service/configservice/service.go | 2 +- .../service/databasemigrationservice/api.go | 630 ++- .../databasemigrationservice/errors.go | 2 +- .../databasemigrationservice/service.go | 2 +- .../service/directoryservice/api.go | 725 ++- .../service/directoryservice/errors.go | 2 +- .../service/directoryservice/service.go | 2 +- .../aws/aws-sdk-go/service/dynamodb/api.go | 963 +++- .../service/dynamodb/customizations.go | 23 +- .../aws/aws-sdk-go/service/dynamodb/errors.go | 2 +- .../aws-sdk-go/service/dynamodb/service.go | 2 +- .../aws-sdk-go/service/dynamodb/waiters.go | 102 +- .../aws/aws-sdk-go/service/ec2/api.go | 4888 +++++++++++++++-- .../aws/aws-sdk-go/service/ec2/errors.go | 2 +- .../aws/aws-sdk-go/service/ec2/service.go | 2 +- .../aws/aws-sdk-go/service/ec2/waiters.go | 1582 ++++-- .../aws/aws-sdk-go/service/ecr/api.go | 437 +- .../aws/aws-sdk-go/service/ecr/errors.go | 2 +- .../aws/aws-sdk-go/service/ecr/service.go | 2 +- .../aws/aws-sdk-go/service/ecs/api.go | 814 ++- .../aws/aws-sdk-go/service/ecs/errors.go | 2 +- .../aws/aws-sdk-go/service/ecs/service.go | 2 +- .../aws/aws-sdk-go/service/ecs/waiters.go | 217 +- .../aws/aws-sdk-go/service/efs/api.go | 212 +- .../aws/aws-sdk-go/service/efs/errors.go | 2 +- .../aws/aws-sdk-go/service/efs/service.go | 2 +- .../aws/aws-sdk-go/service/elasticache/api.go | 1525 ++++- .../aws-sdk-go/service/elasticache/errors.go | 22 +- .../aws-sdk-go/service/elasticache/service.go | 2 +- .../aws-sdk-go/service/elasticache/waiters.go | 257 +- .../service/elasticbeanstalk/api.go | 2012 ++++++- .../service/elasticbeanstalk/errors.go | 16 +- .../service/elasticbeanstalk/service.go | 2 +- .../service/elasticsearchservice/api.go | 1218 +++- .../service/elasticsearchservice/errors.go | 2 +- .../service/elasticsearchservice/service.go | 2 +- .../service/elastictranscoder/api.go | 474 +- .../service/elastictranscoder/errors.go | 2 +- .../service/elastictranscoder/service.go | 2 +- .../service/elastictranscoder/waiters.go | 62 +- .../aws/aws-sdk-go/service/elb/api.go | 572 +- .../aws/aws-sdk-go/service/elb/errors.go | 2 +- .../aws/aws-sdk-go/service/elb/service.go | 2 +- .../aws/aws-sdk-go/service/elb/waiters.go | 147 +- .../aws/aws-sdk-go/service/elbv2/api.go | 759 ++- .../aws/aws-sdk-go/service/elbv2/errors.go | 4 +- .../aws/aws-sdk-go/service/elbv2/service.go | 2 +- .../aws/aws-sdk-go/service/elbv2/waiters.go | 117 + .../aws/aws-sdk-go/service/emr/api.go | 2666 ++++++++- .../aws/aws-sdk-go/service/emr/errors.go | 2 +- .../aws/aws-sdk-go/service/emr/service.go | 2 +- .../aws/aws-sdk-go/service/emr/waiters.go | 176 +- .../aws/aws-sdk-go/service/firehose/api.go | 136 +- .../aws/aws-sdk-go/service/firehose/errors.go | 2 +- .../aws-sdk-go/service/firehose/service.go | 2 +- .../aws/aws-sdk-go/service/glacier/api.go | 778 ++- .../aws/aws-sdk-go/service/glacier/errors.go | 2 +- .../aws/aws-sdk-go/service/glacier/service.go | 2 +- .../aws-sdk-go/service/glacier/treehash.go | 12 +- .../aws/aws-sdk-go/service/glacier/waiters.go | 107 +- .../aws/aws-sdk-go/service/iam/api.go | 3256 +++++++++-- .../aws/aws-sdk-go/service/iam/errors.go | 2 +- .../aws/aws-sdk-go/service/iam/service.go | 2 +- .../aws/aws-sdk-go/service/iam/waiters.go | 107 +- .../aws/aws-sdk-go/service/inspector/api.go | 611 ++- .../aws-sdk-go/service/inspector/errors.go | 2 +- .../aws-sdk-go/service/inspector/service.go | 2 +- .../aws/aws-sdk-go/service/kinesis/api.go | 438 +- .../service/kinesis/customizations.go | 22 + .../aws/aws-sdk-go/service/kinesis/errors.go | 2 +- .../aws/aws-sdk-go/service/kinesis/service.go | 2 +- .../aws/aws-sdk-go/service/kinesis/waiters.go | 52 +- .../aws/aws-sdk-go/service/kms/api.go | 816 ++- .../aws/aws-sdk-go/service/kms/errors.go | 2 +- .../aws/aws-sdk-go/service/kms/service.go | 2 +- .../aws/aws-sdk-go/service/lambda/api.go | 1147 +++- .../aws/aws-sdk-go/service/lambda/errors.go | 2 +- .../aws/aws-sdk-go/service/lambda/service.go | 2 +- .../aws/aws-sdk-go/service/lightsail/api.go | 896 ++- .../aws-sdk-go/service/lightsail/errors.go | 2 +- .../aws-sdk-go/service/lightsail/service.go | 2 +- .../aws/aws-sdk-go/service/opsworks/api.go | 2311 ++++++-- .../aws/aws-sdk-go/service/opsworks/errors.go | 2 +- .../aws-sdk-go/service/opsworks/service.go | 30 +- .../aws-sdk-go/service/opsworks/waiters.go | 452 +- .../aws/aws-sdk-go/service/rds/api.go | 2510 ++++++++- .../aws-sdk-go/service/rds/customizations.go | 32 +- .../aws/aws-sdk-go/service/rds/errors.go | 2 +- .../aws/aws-sdk-go/service/rds/service.go | 2 +- .../aws/aws-sdk-go/service/rds/waiters.go | 147 +- .../aws/aws-sdk-go/service/redshift/api.go | 2043 ++++++- .../aws/aws-sdk-go/service/redshift/errors.go | 9 +- .../aws-sdk-go/service/redshift/service.go | 2 +- .../aws-sdk-go/service/redshift/waiters.go | 222 +- .../aws/aws-sdk-go/service/route53/api.go | 1415 +++-- .../aws/aws-sdk-go/service/route53/errors.go | 21 +- .../aws/aws-sdk-go/service/route53/service.go | 2 +- .../aws/aws-sdk-go/service/route53/waiters.go | 52 +- .../aws-sdk-go/service/route53domains/api.go | 514 +- .../service/route53domains/errors.go | 2 +- .../service/route53domains/service.go | 2 +- .../aws/aws-sdk-go/service/s3/api.go | 1594 +++++- .../aws/aws-sdk-go/service/s3/errors.go | 2 +- .../aws/aws-sdk-go/service/s3/service.go | 2 +- .../aws-sdk-go/service/s3/unmarshal_error.go | 64 +- .../aws/aws-sdk-go/service/s3/waiters.go | 207 +- .../aws/aws-sdk-go/service/ses/api.go | 971 +++- .../aws/aws-sdk-go/service/ses/errors.go | 2 +- .../aws/aws-sdk-go/service/ses/service.go | 2 +- .../aws/aws-sdk-go/service/ses/waiters.go | 52 +- .../aws/aws-sdk-go/service/sfn/api.go | 474 +- .../aws/aws-sdk-go/service/sfn/errors.go | 2 +- .../aws/aws-sdk-go/service/sfn/service.go | 2 +- .../aws/aws-sdk-go/service/simpledb/api.go | 324 +- .../aws/aws-sdk-go/service/simpledb/errors.go | 2 +- .../aws-sdk-go/service/simpledb/service.go | 3 +- .../aws/aws-sdk-go/service/sns/api.go | 758 ++- .../aws/aws-sdk-go/service/sns/errors.go | 2 +- .../aws/aws-sdk-go/service/sns/service.go | 2 +- .../aws/aws-sdk-go/service/sqs/api.go | 326 +- .../aws/aws-sdk-go/service/sqs/errors.go | 2 +- .../aws/aws-sdk-go/service/sqs/service.go | 2 +- .../aws/aws-sdk-go/service/ssm/api.go | 2111 +++++-- .../aws/aws-sdk-go/service/ssm/errors.go | 24 +- .../aws/aws-sdk-go/service/ssm/service.go | 18 +- .../aws/aws-sdk-go/service/sts/api.go | 136 +- .../aws/aws-sdk-go/service/sts/errors.go | 2 +- .../aws/aws-sdk-go/service/sts/service.go | 2 +- .../aws/aws-sdk-go/service/waf/api.go | 729 ++- .../aws/aws-sdk-go/service/waf/errors.go | 2 +- .../aws/aws-sdk-go/service/waf/service.go | 2 +- .../template/datasource_cloudinit_config.go | 23 +- .../builtin/providers/template/provider.go | 1 + .../template/resource_template_dir.go | 234 + .../hashicorp/terraform/commands.go | 61 +- .../github.com/hashicorp/terraform/config.go | 8 + .../hashicorp/terraform/config/append.go | 9 +- .../hashicorp/terraform/config/config.go | 89 +- .../terraform/config/config_string.go | 31 +- .../terraform/config/config_terraform.go | 117 + .../hashicorp/terraform/config/interpolate.go | 25 + .../terraform/config/interpolate_funcs.go | 161 + .../terraform/config/interpolate_walk.go | 6 + .../hashicorp/terraform/config/loader_hcl.go | 110 +- .../hashicorp/terraform/config/merge.go | 10 +- .../terraform/config/module/inode.go | 2 +- .../terraform/config/module/testing.go | 38 + .../hashicorp/terraform/config/module/tree.go | 93 +- .../terraform/config/provisioner_enums.go | 40 + .../terraform/config/resource_mode_string.go | 2 +- .../github.com/hashicorp/terraform/dag/dag.go | 94 +- .../github.com/hashicorp/terraform/dag/set.go | 22 + .../hashicorp/terraform/dag/walk.go | 445 ++ .../hashicorp/terraform/flatmap/expand.go | 49 +- .../terraform/helper/acctest/random.go | 47 + .../terraform/helper/experiment/experiment.go | 4 - .../terraform/helper/resource/state.go | 146 +- .../terraform/helper/resource/testing.go | 63 +- .../helper/resource/testing_config.go | 54 +- .../helper/resource/testing_import_state.go | 4 + .../terraform/helper/schema/backend.go | 94 + .../helper/schema/field_reader_config.go | 25 + .../helper/schema/getsource_string.go | 2 +- .../terraform/helper/schema/provider.go | 30 + .../terraform/helper/schema/provisioner.go | 180 + .../terraform/helper/schema/resource.go | 78 +- .../terraform/helper/schema/resource_data.go | 47 +- .../helper/schema/resource_timeout.go | 237 + .../terraform/helper/schema/schema.go | 174 +- .../terraform/helper/schema/testing.go | 30 + .../helper/schema/valuetype_string.go | 2 +- .../terraform/helper/structure/expand_json.go | 11 + .../helper/structure/flatten_json.go | 16 + .../helper/structure/normalize_json.go | 24 + .../helper/structure/suppress_json_diff.go | 21 + .../terraform/helper/validation/validation.go | 59 + .../github.com/hashicorp/terraform/main.go | 88 +- .../terraform/plugin/resource_provisioner.go | 28 + .../hashicorp/terraform/plugin/serve.go | 2 +- .../hashicorp/terraform/terraform/context.go | 343 +- .../terraform/terraform/context_graph_type.go | 6 + .../terraform/terraform/context_import.go | 3 +- .../hashicorp/terraform/terraform/debug.go | 2 +- .../hashicorp/terraform/terraform/diff.go | 10 +- .../terraform/terraform/eval_apply.go | 122 +- .../terraform/terraform/eval_context.go | 4 + .../terraform/eval_context_builtin.go | 13 + .../terraform/terraform/eval_context_mock.go | 8 + .../terraform/terraform/eval_diff.go | 122 +- .../terraform/terraform/eval_provider.go | 21 +- .../terraform/terraform/eval_sequence.go | 4 + .../terraform/terraform/eval_validate.go | 81 +- .../terraform/eval_validate_selfref.go | 74 + .../terraform/terraform/eval_variable.go | 49 +- .../hashicorp/terraform/terraform/graph.go | 204 +- .../terraform/terraform/graph_builder.go | 159 - .../terraform/graph_builder_apply.go | 13 +- .../terraform/graph_builder_import.go | 3 + .../terraform/graph_builder_input.go | 27 + .../terraform/terraform/graph_builder_plan.go | 80 +- .../terraform/graph_builder_refresh.go | 132 + .../terraform/graph_builder_validate.go | 36 + .../terraform/terraform/graph_config_node.go | 37 - .../terraform/graph_config_node_module.go | 215 - .../terraform/graph_config_node_output.go | 106 - .../terraform/graph_config_node_provider.go | 133 - .../terraform/graph_config_node_resource.go | 539 -- .../terraform/graph_config_node_type.go | 16 - .../terraform/graph_config_node_variable.go | 274 - .../terraform/terraform/graph_walk_context.go | 8 +- .../terraform/graphnodeconfigtype_string.go | 16 - .../terraform/terraform/graphtype_string.go | 6 +- .../hashicorp/terraform/terraform/hook.go | 4 +- .../terraform/terraform/hook_mock.go | 4 +- .../terraform/terraform/hook_stop.go | 2 +- .../terraform/instancetype_string.go | 2 +- .../terraform/terraform/interpolate.go | 41 +- .../terraform/terraform/node_data_destroy.go | 22 + .../terraform/terraform/node_data_refresh.go | 198 + .../terraform/node_provider_abstract.go | 7 + .../terraform/terraform/node_provisioner.go | 44 + .../terraform/node_resource_abstract.go | 66 +- .../terraform/node_resource_abstract_count.go | 50 + .../terraform/node_resource_apply.go | 19 +- .../terraform/node_resource_destroy.go | 68 + .../terraform/terraform/node_resource_plan.go | 31 +- .../terraform/node_resource_plan_instance.go | 9 +- .../terraform/node_resource_refresh.go | 100 + .../terraform/node_resource_validate.go | 158 + .../hashicorp/terraform/terraform/plan.go | 7 + .../terraform/terraform/resource_address.go | 3 + .../terraform/resource_provisioner.go | 20 + .../terraform/resource_provisioner_mock.go | 23 +- .../terraform/terraform/semantics.go | 19 - .../terraform/terraform/shadow_context.go | 5 +- .../terraform/shadow_resource_provisioner.go | 11 + .../hashicorp/terraform/terraform/state.go | 172 +- .../terraform/terraform/state_filter.go | 32 +- .../terraform/state_upgrade_v1_to_v2.go | 21 +- .../terraform/state_upgrade_v2_to_v3.go | 2 +- .../hashicorp/terraform/terraform/testing.go | 19 + .../terraform/transform_attach_state.go | 2 +- .../terraform/terraform/transform_config.go | 43 +- .../terraform/transform_config_old.go | 100 - .../terraform/terraform/transform_deposed.go | 6 + .../terraform/terraform/transform_destroy.go | 284 - .../terraform/transform_destroy_edge.go | 12 +- .../terraform/terraform/transform_expand.go | 17 - .../terraform/terraform/transform_flatten.go | 107 - .../terraform/transform_module_destroy_old.go | 62 - .../terraform/terraform/transform_noop.go | 104 - .../terraform/terraform/transform_orphan.go | 432 -- .../terraform/transform_output_orphan.go | 101 - .../terraform/terraform/transform_provider.go | 117 +- .../terraform/transform_provider_old.go | 174 - .../terraform/transform_provisioner.go | 65 +- .../terraform/terraform/transform_proxy.go | 62 - .../terraform/transform_reference.go | 19 + .../terraform/terraform/transform_resource.go | 962 ---- .../terraform/terraform/transform_root.go | 4 - .../terraform/terraform/transform_targets.go | 24 +- .../hashicorp/terraform/terraform/util.go | 18 + .../hashicorp/terraform/terraform/version.go | 2 +- .../terraform/walkoperation_string.go | 2 +- .../mitchellh/hashstructure/LICENSE | 21 + .../mitchellh/hashstructure/hashstructure.go | 335 ++ .../mitchellh/hashstructure/include.go | 15 + .../vendor/github.com/satori/uuid/LICENSE | 20 + .../vendor/github.com/satori/uuid/uuid.go | 481 ++ 359 files changed, 63294 insertions(+), 13738 deletions(-) create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/context.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error_appengine.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/url.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go delete mode 100644 installer/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/api.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/customizations.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/errors.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/service.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go create mode 100644 installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/resource_template_dir.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/config/config_terraform.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/config/module/testing.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/config/provisioner_enums.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/dag/walk.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/schema/backend.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_timeout.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/schema/testing.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/structure/expand_json.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/structure/flatten_json.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/structure/normalize_json.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/helper/structure/suppress_json_diff.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate_selfref.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_input.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_refresh.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_validate.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_module.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_output.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_provider.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_resource.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_type.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_variable.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/graphnodeconfigtype_string.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/node_data_destroy.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/node_data_refresh.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/node_provisioner.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract_count.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_refresh.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_validate.go create mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/testing.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_flatten.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_module_destroy_old.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_noop.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_orphan.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_output_orphan.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider_old.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_proxy.go delete mode 100644 installer/vendor/github.com/hashicorp/terraform/terraform/transform_resource.go create mode 100644 installer/vendor/github.com/mitchellh/hashstructure/LICENSE create mode 100644 installer/vendor/github.com/mitchellh/hashstructure/hashstructure.go create mode 100644 installer/vendor/github.com/mitchellh/hashstructure/include.go create mode 100644 installer/vendor/github.com/satori/uuid/LICENSE create mode 100644 installer/vendor/github.com/satori/uuid/uuid.go diff --git a/installer/glide.lock b/installer/glide.lock index 5554407422..d7836f702e 100644 --- a/installer/glide.lock +++ b/installer/glide.lock @@ -1,5 +1,5 @@ -hash: 0b5e1ee5c4c2ed0f8c26f0c3a7663bf6f7cdcbaea7225a505240718fb3c2396b -updated: 2017-04-19T15:41:38.436545146-07:00 +hash: 3d541a8ee07140ac74d67cd49410345dd3c52434cb3c152e17c9391ddf71e921 +updated: 2017-04-26T17:47:45.123449687-07:00 imports: - name: github.com/ajeddeloh/yaml version: 1072abfea31191db507785e2e0c1b8d1440d35a5 @@ -10,7 +10,7 @@ imports: subpackages: - cidr - name: github.com/aws/aws-sdk-go - version: b2852089fcfd0794d25d57f193e15121ab8a6d9e + version: 4bbd6fa3fdede4c68e941248f974b8951c17de89 subpackages: - aws - aws/awserr @@ -39,7 +39,6 @@ imports: - private/protocol/restxml - private/protocol/xml/xmlutil - private/signer/v2 - - private/waiter - service/acm - service/apigateway - service/applicationautoscaling @@ -54,6 +53,7 @@ imports: - service/codecommit - service/codedeploy - service/codepipeline + - service/cognitoidentity - service/configservice - service/databasemigrationservice - service/directoryservice @@ -142,7 +142,7 @@ imports: - httputil - timeutil - name: github.com/coreos/terraform-provider-matchbox - version: dd045535c826b7e2e0daeddc6b8d4b2cc81f9dd0 + version: 4c66aa75b60489a4220730d70b0446e25b0c9a0a subpackages: - matchbox - name: github.com/coreos/yaml @@ -241,7 +241,7 @@ imports: - name: github.com/hashicorp/logutils version: 0dc08b1671f34c4250ce212759ebd880f743d883 - name: github.com/hashicorp/terraform - version: 403a86dc557fae52f8e39676b11e1e4356b7d1a2 + version: 277bbf65d1141207dbb30485bf124b1dba08f80f subpackages: - builtin/providers/template - builtin/providers/tls @@ -261,11 +261,12 @@ imports: - helper/resource - helper/schema - helper/shadow + - helper/structure - helper/validation - plugin - terraform - name: github.com/hashicorp/vault - version: 33d2f6fafed24d25e26bed89d6ca160344671300 + version: 15842ec2809798baa7cd99a825b9b837dc37b742 subpackages: - helper/compressutil - helper/jsonutil @@ -308,6 +309,8 @@ imports: version: f81071c9d77b7931f78c90b416a074ecdc50e959 - name: github.com/mitchellh/go-homedir version: b8bc1bf767474819792c23f32d8286a45736f1c6 +- name: github.com/mitchellh/hashstructure + version: ab25296c0f51f1022f01cd99dfb45f1775de8799 - name: github.com/mitchellh/mapstructure version: 281073eb9eb092240d33ef253c404f1cca550309 - name: github.com/mitchellh/reflectwalk @@ -467,6 +470,8 @@ testImports: version: 8a290539e2e8629dbc4e6bad948158f790ec31f4 - name: github.com/PuerkitoBio/urlesc version: 5bd2802263f21d8788851d5305584c82a5c75d7e +- name: github.com/satori/uuid + version: 5bf94b69c6b68ee1b541973bb8e1144db23a194b - name: github.com/spf13/pflag version: 7f60f83a2c81bc3c3c0d5297f61ddfa68da9d3b7 - name: golang.org/x/oauth2 diff --git a/installer/glide.yaml b/installer/glide.yaml index 2089e329da..46a7bbe911 100644 --- a/installer/glide.yaml +++ b/installer/glide.yaml @@ -1,7 +1,7 @@ package: github.com/coreos/tectonic-installer/installer import: - package: github.com/aws/aws-sdk-go - version: v1.6.25 + version: v1.8.13 subpackages: - aws - aws/credentials @@ -204,7 +204,7 @@ import: - parser - scanner - package: github.com/hashicorp/terraform - version: 403a86dc557fae52f8e39676b11e1e4356b7d1a2 + version: 277bbf65d1141207dbb30485bf124b1dba08f80f subpackages: - config - config/module @@ -226,6 +226,6 @@ import: - package: github.com/mitchellh/mapstructure version: 281073eb9eb092240d33ef253c404f1cca550309 - package: github.com/coreos/terraform-provider-matchbox
 - version: dd045535c826b7e2e0daeddc6b8d4b2cc81f9dd0 + version: 4c66aa75b60489a4220730d70b0446e25b0c9a0a subpackages: - matchbox diff --git a/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go index 59865effc8..fe39da85dc 100644 --- a/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go +++ b/installer/server/terraform/plugins/aws/resource_aws_dynamodb_table_migrate.go @@ -4,9 +4,10 @@ import ( "fmt" "log" + "strings" + "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" - "strings" ) func resourceAwsDynamoDbTableMigrateState( diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/client/client.go index 17fc76a0f6..b2428c2864 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/client/client.go @@ -46,7 +46,7 @@ func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, op svc := &Client{ Config: cfg, ClientInfo: info, - Handlers: handlers, + Handlers: handlers.Copy(), } switch retryer, ok := cfg.Retryer.(request.Retryer); { @@ -86,8 +86,8 @@ func (c *Client) AddDebugHandlers() { return } - c.Handlers.Send.PushFront(logRequest) - c.Handlers.Send.PushBack(logResponse) + c.Handlers.Send.PushFrontNamed(request.NamedHandler{Name: "awssdk.client.LogRequest", Fn: logRequest}) + c.Handlers.Send.PushBackNamed(request.NamedHandler{Name: "awssdk.client.LogResponse", Fn: logResponse}) } const logReqMsg = `DEBUG: Request %s/%s Details: diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/config.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/config.go index d58b81280a..948e0a6792 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -22,9 +22,9 @@ type RequestRetryer interface{} // // // Create Session with MaxRetry configuration to be shared by multiple // // service clients. -// sess, err := session.NewSession(&aws.Config{ +// sess := session.Must(session.NewSession(&aws.Config{ // MaxRetries: aws.Int(3), -// }) +// })) // // // Create S3 service client with a specific Region. // svc := s3.New(sess, &aws.Config{ @@ -154,7 +154,8 @@ type Config struct { // the EC2Metadata overriding the timeout for default credentials chain. // // Example: - // sess, err := session.NewSession(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // sess := session.Must(session.NewSession(aws.NewConfig() + // .WithEC2MetadataDiableTimeoutOverride(true))) // // svc := s3.New(sess) // @@ -174,7 +175,7 @@ type Config struct { // // Only supported with. // - // sess, err := session.NewSession() + // sess := session.Must(session.NewSession()) // // svc := s3.New(sess, &aws.Config{ // UseDualStack: aws.Bool(true), @@ -186,13 +187,19 @@ type Config struct { // request delays. This value should only be used for testing. To adjust // the delay of a request see the aws/client.DefaultRetryer and // aws/request.Retryer. + // + // SleepDelay will prevent any Context from being used for canceling retry + // delay of an API operation. It is recommended to not use SleepDelay at all + // and specify a Retryer instead. SleepDelay func(time.Duration) // DisableRestProtocolURICleaning will not clean the URL path when making rest protocol requests. // Will default to false. This would only be used for empty directory names in s3 requests. // // Example: - // sess, err := session.NewSession(&aws.Config{DisableRestProtocolURICleaning: aws.Bool(true)) + // sess := session.Must(session.NewSession(&aws.Config{ + // DisableRestProtocolURICleaning: aws.Bool(true), + // })) // // svc := s3.New(sess) // out, err := svc.GetObject(&s3.GetObjectInput { @@ -207,9 +214,9 @@ type Config struct { // // // Create Session with MaxRetry configuration to be shared by multiple // // service clients. -// sess, err := session.NewSession(aws.NewConfig(). +// sess := session.Must(session.NewSession(aws.NewConfig(). // WithMaxRetries(3), -// ) +// )) // // // Create S3 service client with a specific Region. // svc := s3.New(sess, aws.NewConfig(). diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/context.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/context.go new file mode 100644 index 0000000000..79f426853b --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/context.go @@ -0,0 +1,71 @@ +package aws + +import ( + "time" +) + +// Context is an copy of the Go v1.7 stdlib's context.Context interface. +// It is represented as a SDK interface to enable you to use the "WithContext" +// API methods with Go v1.6 and a Context type such as golang.org/x/net/context. +// +// See https://golang.org/pkg/context on how to use contexts. +type Context interface { + // Deadline returns the time when work done on behalf of this context + // should be canceled. Deadline returns ok==false when no deadline is + // set. Successive calls to Deadline return the same results. + Deadline() (deadline time.Time, ok bool) + + // Done returns a channel that's closed when work done on behalf of this + // context should be canceled. Done may return nil if this context can + // never be canceled. Successive calls to Done return the same value. + Done() <-chan struct{} + + // Err returns a non-nil error value after Done is closed. Err returns + // Canceled if the context was canceled or DeadlineExceeded if the + // context's deadline passed. No other values for Err are defined. + // After Done is closed, successive calls to Err return the same value. + Err() error + + // Value returns the value associated with this context for key, or nil + // if no value is associated with key. Successive calls to Value with + // the same key returns the same result. + // + // Use context values only for request-scoped data that transits + // processes and API boundaries, not for passing optional parameters to + // functions. + Value(key interface{}) interface{} +} + +// BackgroundContext returns a context that will never be canceled, has no +// values, and no deadline. This context is used by the SDK to provide +// backwards compatibility with non-context API operations and functionality. +// +// Go 1.6 and before: +// This context function is equivalent to context.Background in the Go stdlib. +// +// Go 1.7 and later: +// The context returned will be the value returned by context.Background() +// +// See https://golang.org/pkg/context for more information on Contexts. +func BackgroundContext() Context { + return backgroundCtx +} + +// SleepWithContext will wait for the timer duration to expire, or the context +// is canceled. Which ever happens first. If the context is canceled the Context's +// error will be returned. +// +// Expects Context to always return a non-nil error if the Done channel is closed. +func SleepWithContext(ctx Context, dur time.Duration) error { + t := time.NewTimer(dur) + defer t.Stop() + + select { + case <-t.C: + break + case <-ctx.Done(): + return ctx.Err() + } + + return nil +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go new file mode 100644 index 0000000000..e8cf93d269 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go @@ -0,0 +1,41 @@ +// +build !go1.7 + +package aws + +import "time" + +// An emptyCtx is a copy of the the Go 1.7 context.emptyCtx type. This +// is copied to provide a 1.6 and 1.5 safe version of context that is compatible +// with Go 1.7's Context. +// +// An emptyCtx is never canceled, has no values, and has no deadline. It is not +// struct{}, since vars of this type must have distinct addresses. +type emptyCtx int + +func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { + return +} + +func (*emptyCtx) Done() <-chan struct{} { + return nil +} + +func (*emptyCtx) Err() error { + return nil +} + +func (*emptyCtx) Value(key interface{}) interface{} { + return nil +} + +func (e *emptyCtx) String() string { + switch e { + case backgroundCtx: + return "aws.BackgroundContext" + } + return "unknown empty Context" +} + +var ( + backgroundCtx = new(emptyCtx) +) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go new file mode 100644 index 0000000000..064f75c925 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go @@ -0,0 +1,9 @@ +// +build go1.7 + +package aws + +import "context" + +var ( + backgroundCtx = context.Background() +) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 8a7bafc78c..08a6665901 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -134,6 +134,16 @@ var SendHandler = request.NamedHandler{Name: "core.SendHandler", Fn: func(r *req // Catch all other request errors. r.Error = awserr.New("RequestError", "send request failed", err) r.Retryable = aws.Bool(true) // network errors are retryable + + // Override the error with a context canceled error, if that was canceled. + ctx := r.Context() + select { + case <-ctx.Done(): + r.Error = awserr.New(request.CanceledErrorCode, + "request context canceled", ctx.Err()) + r.Retryable = aws.Bool(false) + default: + } } }} @@ -156,7 +166,16 @@ var AfterRetryHandler = request.NamedHandler{Name: "core.AfterRetryHandler", Fn: if r.WillRetry() { r.RetryDelay = r.RetryRules(r) - r.Config.SleepDelay(r.RetryDelay) + + if sleepFn := r.Config.SleepDelay; sleepFn != nil { + // Support SleepDelay for backwards compatibility and testing + sleepFn(r.RetryDelay) + } else if err := aws.SleepWithContext(r.Context(), r.RetryDelay); err != nil { + r.Error = awserr.New(request.CanceledErrorCode, + "request context canceled", err) + r.Retryable = aws.Bool(false) + return + } // when the expired token exception occurs the credentials // need to be expired locally so that the next request to diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go index 7b8ebf5f9d..03630cf0dd 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -88,7 +88,7 @@ type Value struct { // The Provider should not need to implement its own mutexes, because // that will be managed by Credentials. type Provider interface { - // Refresh returns nil if it successfully retrieved the value. + // Retrieve returns nil if it successfully retrieved the value. // Error is returned if the value were not obtainable, or empty. Retrieve() (Value, error) @@ -97,6 +97,27 @@ type Provider interface { IsExpired() bool } +// An ErrorProvider is a stub credentials provider that always returns an error +// this is used by the SDK when construction a known provider is not possible +// due to an error. +type ErrorProvider struct { + // The error to be returned from Retrieve + Err error + + // The provider name to set on the Retrieved returned Value + ProviderName string +} + +// Retrieve will always return the error that the ErrorProvider was created with. +func (p ErrorProvider) Retrieve() (Value, error) { + return Value{ProviderName: p.ProviderName}, p.Err +} + +// IsExpired will always return not expired. +func (p ErrorProvider) IsExpired() bool { + return false +} + // A Expiry provides shared expiration logic to be used by credentials // providers to implement expiry functionality. // diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index 30c847ae22..b84062332e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -1,7 +1,81 @@ -// Package stscreds are credential Providers to retrieve STS AWS credentials. -// -// STS provides multiple ways to retrieve credentials which can be used when making -// future AWS service API operation calls. +/* +Package stscreds are credential Providers to retrieve STS AWS credentials. + +STS provides multiple ways to retrieve credentials which can be used when making +future AWS service API operation calls. + +The SDK will ensure that per instance of credentials.Credentials all requests +to refresh the credentials will be synchronized. But, the SDK is unable to +ensure synchronous usage of the AssumeRoleProvider if the value is shared +between multiple Credentials, Sessions or service clients. + +Assume Role + +To assume an IAM role using STS with the SDK you can create a new Credentials +with the SDKs's stscreds package. + + // Initial credentials loaded from SDK's default credential chain. Such as + // the environment, shared credentials (~/.aws/credentials), or EC2 Instance + // Role. These credentials will be used to to make the STS Assume Role API. + sess := session.Must(session.NewSession()) + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. + creds := stscreds.NewCredentials(sess, "myRoleArn") + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +Assume Role with static MFA Token + +To assume an IAM role with a MFA token you can either specify a MFA token code +directly or provide a function to prompt the user each time the credentials +need to refresh the role's credentials. Specifying the TokenCode should be used +for short lived operations that will not need to be refreshed, and when you do +not want to have direct control over the user provides their MFA token. + +With TokenCode the AssumeRoleProvider will be not be able to refresh the role's +credentials. + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN using the MFA token code provided. + creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { + p.SerialNumber = aws.String("myTokenSerialNumber") + p.TokenCode = aws.String("00000000") + }) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +Assume Role with MFA Token Provider + +To assume an IAM role with MFA for longer running tasks where the credentials +may need to be refreshed setting the TokenProvider field of AssumeRoleProvider +will allow the credential provider to prompt for new MFA token code when the +role's credentials need to be refreshed. + +The StdinTokenProvider function is available to prompt on stdin to retrieve +the MFA token code from the user. You can also implement custom prompts by +satisfing the TokenProvider function signature. + +Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will +have undesirable results as the StdinTokenProvider will not be synchronized. A +single Credentials with an AssumeRoleProvider can be shared safely. + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. Prompting for MFA token from stdin. + creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { + p.SerialNumber = aws.String("myTokenSerialNumber") + p.TokenProvider = stscreds.StdinTokenProvider + }) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +*/ package stscreds import ( @@ -9,11 +83,31 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/service/sts" ) +// StdinTokenProvider will prompt on stdout and read from stdin for a string value. +// An error is returned if reading from stdin fails. +// +// Use this function go read MFA tokens from stdin. The function makes no attempt +// to make atomic prompts from stdin across multiple gorouties. +// +// Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will +// have undesirable results as the StdinTokenProvider will not be synchronized. A +// single Credentials with an AssumeRoleProvider can be shared safely +// +// Will wait forever until something is provided on the stdin. +func StdinTokenProvider() (string, error) { + var v string + fmt.Printf("Assume Role MFA token code: ") + _, err := fmt.Scanln(&v) + + return v, err +} + // ProviderName provides a name of AssumeRole provider const ProviderName = "AssumeRoleProvider" @@ -27,8 +121,15 @@ type AssumeRoler interface { var DefaultDuration = time.Duration(15) * time.Minute // AssumeRoleProvider retrieves temporary credentials from the STS service, and -// keeps track of their expiration time. This provider must be used explicitly, -// as it is not included in the credentials chain. +// keeps track of their expiration time. +// +// This credential provider will be used by the SDKs default credential change +// when shared configuration is enabled, and the shared config or shared credentials +// file configure assume role. See Session docs for how to do this. +// +// AssumeRoleProvider does not provide any synchronization and it is not safe +// to share this value across multiple Credentials, Sessions, or service clients +// without also sharing the same Credentials instance. type AssumeRoleProvider struct { credentials.Expiry @@ -65,8 +166,23 @@ type AssumeRoleProvider struct { // assumed requires MFA (that is, if the policy includes a condition that tests // for MFA). If the role being assumed requires MFA and if the TokenCode value // is missing or expired, the AssumeRole call returns an "access denied" error. + // + // If SerialNumber is set and neither TokenCode nor TokenProvider are also + // set an error will be returned. TokenCode *string + // Async method of providing MFA token code for assuming an IAM role with MFA. + // The value returned by the function will be used as the TokenCode in the Retrieve + // call. See StdinTokenProvider for a provider that prompts and reads from stdin. + // + // This token provider will be called when ever the assumed role's + // credentials need to be refreshed when SerialNumber is also set and + // TokenCode is not set. + // + // If both TokenCode and TokenProvider is set, TokenProvider will be used and + // TokenCode is ignored. + TokenProvider func() (string, error) + // ExpiryWindow will allow the credentials to trigger refreshing prior to // the credentials actually expiring. This is beneficial so race conditions // with expiring credentials do not cause request to fail unexpectedly @@ -85,6 +201,10 @@ type AssumeRoleProvider struct { // // Takes a Config provider to create the STS client. The ConfigProvider is // satisfied by the session.Session type. +// +// It is safe to share the returned Credentials with multiple Sessions and +// service clients. All access to the credentials and refreshing them +// will be synchronized. func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { p := &AssumeRoleProvider{ Client: sts.New(c), @@ -103,7 +223,11 @@ func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*As // AssumeRoleProvider. The credentials will expire every 15 minutes and the // role will be named after a nanosecond timestamp of this operation. // -// Takes an AssumeRoler which can be satisfiede by the STS client. +// Takes an AssumeRoler which can be satisfied by the STS client. +// +// It is safe to share the returned Credentials with multiple Sessions and +// service clients. All access to the credentials and refreshing them +// will be synchronized. func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { p := &AssumeRoleProvider{ Client: svc, @@ -139,12 +263,25 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { if p.Policy != nil { input.Policy = p.Policy } - if p.SerialNumber != nil && p.TokenCode != nil { - input.SerialNumber = p.SerialNumber - input.TokenCode = p.TokenCode + if p.SerialNumber != nil { + if p.TokenCode != nil { + input.SerialNumber = p.SerialNumber + input.TokenCode = p.TokenCode + } else if p.TokenProvider != nil { + input.SerialNumber = p.SerialNumber + code, err := p.TokenProvider() + if err != nil { + return credentials.Value{ProviderName: ProviderName}, err + } + input.TokenCode = aws.String(code) + } else { + return credentials.Value{ProviderName: ProviderName}, + awserr.New("AssumeRoleTokenNotAvailable", + "assume role with MFA enabled, but neither TokenCode nor TokenProvider are set", nil) + } } - roleOutput, err := p.Client.AssumeRole(input) + roleOutput, err := p.Client.AssumeRole(input) if err != nil { return credentials.Value{ProviderName: ProviderName}, err } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go index 0ef55040a8..07afe3b8e6 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -10,10 +10,12 @@ package defaults import ( "fmt" "net/http" + "net/url" "os" "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" @@ -56,7 +58,6 @@ func Config() *aws.Config { WithMaxRetries(aws.UseServiceDefaultRetries). WithLogger(aws.NewDefaultLogger()). WithLogLevel(aws.LogOff). - WithSleepDelay(time.Sleep). WithEndpointResolver(endpoints.DefaultResolver()) } @@ -97,23 +98,51 @@ func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credenti }) } -// RemoteCredProvider returns a credenitials provider for the default remote +const ( + httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" + ecsCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" +) + +// RemoteCredProvider returns a credentials provider for the default remote // endpoints such as EC2 or ECS Roles. func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { - ecsCredURI := os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") + if u := os.Getenv(httpProviderEnvVar); len(u) > 0 { + return localHTTPCredProvider(cfg, handlers, u) + } - if len(ecsCredURI) > 0 { - return ecsCredProvider(cfg, handlers, ecsCredURI) + if uri := os.Getenv(ecsCredsProviderEnvVar); len(uri) > 0 { + u := fmt.Sprintf("http://169.254.170.2%s", uri) + return httpCredProvider(cfg, handlers, u) } return ec2RoleProvider(cfg, handlers) } -func ecsCredProvider(cfg aws.Config, handlers request.Handlers, uri string) credentials.Provider { - const host = `169.254.170.2` +func localHTTPCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { + var errMsg string + + parsed, err := url.Parse(u) + if err != nil { + errMsg = fmt.Sprintf("invalid URL, %v", err) + } else if host := aws.URLHostname(parsed); !(host == "localhost" || host == "127.0.0.1") { + errMsg = fmt.Sprintf("invalid host address, %q, only localhost and 127.0.0.1 are valid.", host) + } + + if len(errMsg) > 0 { + if cfg.Logger != nil { + cfg.Logger.Log("Ignoring, HTTP credential provider", errMsg, err) + } + return credentials.ErrorProvider{ + Err: awserr.New("CredentialsEndpointError", errMsg, err), + ProviderName: endpointcreds.ProviderName, + } + } + + return httpCredProvider(cfg, handlers, u) +} - return endpointcreds.NewProviderClient(cfg, handlers, - fmt.Sprintf("http://%s%s", host, uri), +func httpCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { + return endpointcreds.NewProviderClient(cfg, handlers, u, func(p *endpointcreds.Provider) { p.ExpiryWindow = 5 * time.Minute }, diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 53616560d8..4adca3a7f3 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. package endpoints @@ -104,8 +104,10 @@ const ( MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. MonitoringServiceID = "monitoring" // Monitoring. + MturkRequesterServiceID = "mturk-requester" // MturkRequester. OpsworksServiceID = "opsworks" // Opsworks. OpsworksCmServiceID = "opsworks-cm" // OpsworksCm. + OrganizationsServiceID = "organizations" // Organizations. PinpointServiceID = "pinpoint" // Pinpoint. PollyServiceID = "polly" // Polly. RdsServiceID = "rds" // Rds. @@ -129,8 +131,10 @@ const ( StsServiceID = "sts" // Sts. SupportServiceID = "support" // Support. SwfServiceID = "swf" // Swf. + TaggingServiceID = "tagging" // Tagging. WafServiceID = "waf" // Waf. WafRegionalServiceID = "waf-regional" // WafRegional. + WorkdocsServiceID = "workdocs" // Workdocs. WorkspacesServiceID = "workspaces" // Workspaces. XrayServiceID = "xray" // Xray. ) @@ -246,6 +250,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, @@ -432,10 +437,14 @@ var awsPartition = partition{ "codebuild": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "codecommit": service{ @@ -488,6 +497,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -501,6 +511,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -514,6 +525,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -749,10 +761,11 @@ var awsPartition = partition{ "elasticfilesystem": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "elasticloadbalancing": service{ @@ -848,6 +861,7 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, @@ -958,6 +972,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -1014,6 +1029,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, @@ -1075,10 +1091,13 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, @@ -1110,6 +1129,16 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "mturk-requester": service{ + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "sandbox": endpoint{ + Hostname: "mturk-requester-sandbox.us-east-1.amazonaws.com", + }, + "us-east-1": endpoint{}, + }, + }, "opsworks": service{ Endpoints: endpoints{ @@ -1136,6 +1165,19 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "organizations": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "organizations.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, "pinpoint": service{ Defaults: endpoint{ CredentialScope: credentialScope{ @@ -1346,7 +1388,6 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, @@ -1421,6 +1462,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1532,6 +1574,25 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "tagging": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "waf": service{ PartitionEndpoint: "aws-global", IsRegionalized: boxedFalse, @@ -1554,6 +1615,17 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "workdocs": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "workspaces": service{ Endpoints: endpoints{ @@ -1632,6 +1704,12 @@ var awscnPartition = partition{ "cn-north-1": endpoint{}, }, }, + "codedeploy": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "config": service{ Endpoints: endpoints{ @@ -1809,6 +1887,12 @@ var awscnPartition = partition{ }, "swf": service{ + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "tagging": service{ + Endpoints: endpoints{ "cn-north-1": endpoint{}, }, @@ -1946,6 +2030,12 @@ var awsusgovPartition = partition{ }, }, }, + "kinesis": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "kms": service{ Endpoints: endpoints{ diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go index 1e7369dbfd..fc7eada77f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go @@ -158,7 +158,7 @@ var funcMap = template.FuncMap{ const v3Tmpl = ` {{ define "defaults" -}} -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. package endpoints diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go new file mode 100644 index 0000000000..a94f041070 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go @@ -0,0 +1,11 @@ +package aws + +// JSONValue is a representation of a grab bag type that will be marshaled +// into a json string. This type can be used just like any other map. +// +// Example: +// values := JSONValue{ +// "Foo": "Bar", +// } +// values["Baz"] = "Qux" +type JSONValue map[string]interface{} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 5279c19c09..6c14336f66 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -18,6 +18,7 @@ type Handlers struct { UnmarshalError HandlerList Retry HandlerList AfterRetry HandlerList + Complete HandlerList } // Copy returns of this handler's lists. @@ -33,6 +34,7 @@ func (h *Handlers) Copy() Handlers { UnmarshalMeta: h.UnmarshalMeta.copy(), Retry: h.Retry.copy(), AfterRetry: h.AfterRetry.copy(), + Complete: h.Complete.copy(), } } @@ -48,6 +50,7 @@ func (h *Handlers) Clear() { h.ValidateResponse.Clear() h.Retry.Clear() h.AfterRetry.Clear() + h.Complete.Clear() } // A HandlerListRunItem represents an entry in the HandlerList which @@ -85,13 +88,17 @@ func (l *HandlerList) copy() HandlerList { n := HandlerList{ AfterEachFn: l.AfterEachFn, } - n.list = append([]NamedHandler{}, l.list...) + if len(l.list) == 0 { + return n + } + + n.list = append(make([]NamedHandler, 0, len(l.list)), l.list...) return n } // Clear clears the handler list. func (l *HandlerList) Clear() { - l.list = []NamedHandler{} + l.list = l.list[0:0] } // Len returns the number of handlers in the list. @@ -101,33 +108,54 @@ func (l *HandlerList) Len() int { // PushBack pushes handler f to the back of the handler list. func (l *HandlerList) PushBack(f func(*Request)) { - l.list = append(l.list, NamedHandler{"__anonymous", f}) -} - -// PushFront pushes handler f to the front of the handler list. -func (l *HandlerList) PushFront(f func(*Request)) { - l.list = append([]NamedHandler{{"__anonymous", f}}, l.list...) + l.PushBackNamed(NamedHandler{"__anonymous", f}) } // PushBackNamed pushes named handler f to the back of the handler list. func (l *HandlerList) PushBackNamed(n NamedHandler) { + if cap(l.list) == 0 { + l.list = make([]NamedHandler, 0, 5) + } l.list = append(l.list, n) } +// PushFront pushes handler f to the front of the handler list. +func (l *HandlerList) PushFront(f func(*Request)) { + l.PushFrontNamed(NamedHandler{"__anonymous", f}) +} + // PushFrontNamed pushes named handler f to the front of the handler list. func (l *HandlerList) PushFrontNamed(n NamedHandler) { - l.list = append([]NamedHandler{n}, l.list...) + if cap(l.list) == len(l.list) { + // Allocating new list required + l.list = append([]NamedHandler{n}, l.list...) + } else { + // Enough room to prepend into list. + l.list = append(l.list, NamedHandler{}) + copy(l.list[1:], l.list) + l.list[0] = n + } } // Remove removes a NamedHandler n func (l *HandlerList) Remove(n NamedHandler) { - newlist := []NamedHandler{} - for _, m := range l.list { - if m.Name != n.Name { - newlist = append(newlist, m) + l.RemoveByName(n.Name) +} + +// RemoveByName removes a NamedHandler by name. +func (l *HandlerList) RemoveByName(name string) { + for i := 0; i < len(l.list); i++ { + m := l.list[i] + if m.Name == name { + // Shift array preventing creating new arrays + copy(l.list[i:], l.list[i+1:]) + l.list[len(l.list)-1] = NamedHandler{} + l.list = l.list[:len(l.list)-1] + + // decrement list so next check to length is correct + i-- } } - l.list = newlist } // Run executes all handlers in the list with a given request object. @@ -163,6 +191,16 @@ func HandlerListStopOnError(item HandlerListRunItem) bool { return item.Request.Error == nil } +// WithAppendUserAgent will add a string to the user agent prefixed with a +// single white space. +func WithAppendUserAgent(s string) Option { + return func(r *Request) { + r.Handlers.Build.PushBack(func(r2 *Request) { + AddToUserAgent(r, s) + }) + } +} + // MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request // header. If the extra parameters are provided they will be added as metadata to the // name/version pair resulting in the following format. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 77312bb665..1f131dfd3a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -16,6 +16,21 @@ import ( "github.com/aws/aws-sdk-go/aws/client/metadata" ) +const ( + // ErrCodeSerialization is the serialization error code that is received + // during protocol unmarshaling. + ErrCodeSerialization = "SerializationError" + + // ErrCodeResponseTimeout is the connection timeout error that is recieved + // during body reads. + ErrCodeResponseTimeout = "ResponseTimeout" + + // CanceledErrorCode is the error code that will be returned by an + // API request that was canceled. Requests given a aws.Context may + // return this error when canceled. + CanceledErrorCode = "RequestCanceled" +) + // A Request is the service request to be made. type Request struct { Config aws.Config @@ -41,12 +56,14 @@ type Request struct { SignedHeaderVals http.Header LastSignedAt time.Time + context aws.Context + built bool - // Need to persist an intermideant body betweend the input Body and HTTP + // Need to persist an intermediate body between the input Body and HTTP // request body because the HTTP Client's transport can maintain a reference // to the HTTP request's body after the client has returned. This value is - // safe to use concurrently and rewraps the input Body for each HTTP request. + // safe to use concurrently and wrap the input Body for each HTTP request. safeBody *offsetReader } @@ -60,14 +77,6 @@ type Operation struct { BeforePresignFn func(r *Request) error } -// Paginator keeps track of pagination configuration for an API operation. -type Paginator struct { - InputTokens []string - OutputTokens []string - LimitToken string - TruncationToken string -} - // New returns a new Request pointer for the service API // operation and parameters. // @@ -111,6 +120,94 @@ func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, return r } +// A Option is a functional option that can augment or modify a request when +// using a WithContext API operation method. +type Option func(*Request) + +// WithGetResponseHeader builds a request Option which will retrieve a single +// header value from the HTTP Response. If there are multiple values for the +// header key use WithGetResponseHeaders instead to access the http.Header +// map directly. The passed in val pointer must be non-nil. +// +// This Option can be used multiple times with a single API operation. +// +// var id2, versionID string +// svc.PutObjectWithContext(ctx, params, +// request.WithGetResponseHeader("x-amz-id-2", &id2), +// request.WithGetResponseHeader("x-amz-version-id", &versionID), +// ) +func WithGetResponseHeader(key string, val *string) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *val = req.HTTPResponse.Header.Get(key) + }) + } +} + +// WithGetResponseHeaders builds a request Option which will retrieve the +// headers from the HTTP response and assign them to the passed in headers +// variable. The passed in headers pointer must be non-nil. +// +// var headers http.Header +// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) +func WithGetResponseHeaders(headers *http.Header) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *headers = req.HTTPResponse.Header + }) + } +} + +// WithLogLevel is a request option that will set the request to use a specific +// log level when the request is made. +// +// svc.PutObjectWithContext(ctx, params, request.WithLogLevel(aws.LogDebugWithHTTPBody) +func WithLogLevel(l aws.LogLevelType) Option { + return func(r *Request) { + r.Config.LogLevel = aws.LogLevel(l) + } +} + +// ApplyOptions will apply each option to the request calling them in the order +// the were provided. +func (r *Request) ApplyOptions(opts ...Option) { + for _, opt := range opts { + opt(r) + } +} + +// Context will always returns a non-nil context. If Request does not have a +// context aws.BackgroundContext will be returned. +func (r *Request) Context() aws.Context { + if r.context != nil { + return r.context + } + return aws.BackgroundContext() +} + +// SetContext adds a Context to the current request that can be used to cancel +// a in-flight request. The Context value must not be nil, or this method will +// panic. +// +// Unlike http.Request.WithContext, SetContext does not return a copy of the +// Request. It is not safe to use use a single Request value for multiple +// requests. A new Request should be created for each API operation request. +// +// Go 1.6 and below: +// The http.Request's Cancel field will be set to the Done() value of +// the context. This will overwrite the Cancel field's value. +// +// Go 1.7 and above: +// The http.Request.WithContext will be used to set the context on the underlying +// http.Request. This will create a shallow copy of the http.Request. The SDK +// may create sub contexts in the future for nested requests such as retries. +func (r *Request) SetContext(ctx aws.Context) { + if ctx == nil { + panic("context cannot be nil") + } + setRequestContext(r, ctx) +} + // WillRetry returns if the request's can be retried. func (r *Request) WillRetry() bool { return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() @@ -262,7 +359,7 @@ func (r *Request) ResetBody() { // Related golang/go#18257 l, err := computeBodyLength(r.Body) if err != nil { - r.Error = awserr.New("SerializationError", "failed to compute request body size", err) + r.Error = awserr.New(ErrCodeSerialization, "failed to compute request body size", err) return } @@ -344,6 +441,12 @@ func (r *Request) GetBody() io.ReadSeeker { // // Send will not close the request.Request's body. func (r *Request) Send() error { + defer func() { + // Regardless of success or failure of the request trigger the Complete + // request handlers. + r.Handlers.Complete.Run(r) + }() + for { if aws.BoolValue(r.Retryable) { if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { @@ -446,6 +549,9 @@ func shouldRetryCancel(r *Request) bool { timeoutErr := false errStr := r.Error.Error() if ok { + if awsErr.Code() == CanceledErrorCode { + return false + } err := awsErr.OrigErr() netErr, netOK := err.(net.Error) timeoutErr = netOK && netErr.Temporary() diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go new file mode 100644 index 0000000000..a7365cd1e4 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go @@ -0,0 +1,14 @@ +// +build go1.7 + +package request + +import "github.com/aws/aws-sdk-go/aws" + +// setContext updates the Request to use the passed in context for cancellation. +// Context will also be used for request retry delay. +// +// Creates shallow copy of the http.Request with the WithContext method. +func setRequestContext(r *Request, ctx aws.Context) { + r.context = ctx + r.HTTPRequest = r.HTTPRequest.WithContext(ctx) +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go new file mode 100644 index 0000000000..307fa0705b --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go @@ -0,0 +1,14 @@ +// +build !go1.7 + +package request + +import "github.com/aws/aws-sdk-go/aws" + +// setContext updates the Request to use the passed in context for cancellation. +// Context will also be used for request retry delay. +// +// Creates shallow copy of the http.Request with the WithContext method. +func setRequestContext(r *Request, ctx aws.Context) { + r.context = ctx + r.HTTPRequest.Cancel = ctx.Done() +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go index 2939ec473f..59de6736b6 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go @@ -2,29 +2,125 @@ package request import ( "reflect" + "sync/atomic" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" ) -//type Paginater interface { -// HasNextPage() bool -// NextPage() *Request -// EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error -//} +// A Pagination provides paginating of SDK API operations which are paginatable. +// Generally you should not use this type directly, but use the "Pages" API +// operations method to automatically perform pagination for you. Such as, +// "S3.ListObjectsPages", and "S3.ListObjectsPagesWithContext" methods. +// +// Pagination differs from a Paginator type in that pagination is the type that +// does the pagination between API operations, and Paginator defines the +// configuration that will be used per page request. +// +// cont := true +// for p.Next() && cont { +// data := p.Page().(*s3.ListObjectsOutput) +// // process the page's data +// } +// return p.Err() +// +// See service client API operation Pages methods for examples how the SDK will +// use the Pagination type. +type Pagination struct { + // Function to return a Request value for each pagination request. + // Any configuration or handlers that need to be applied to the request + // prior to getting the next page should be done here before the request + // returned. + // + // NewRequest should always be built from the same API operations. It is + // undefined if different API operations are returned on subsequent calls. + NewRequest func() (*Request, error) -// HasNextPage returns true if this request has more pages of data available. -func (r *Request) HasNextPage() bool { - return len(r.nextPageTokens()) > 0 + started bool + nextTokens []interface{} + + err error + curPage interface{} } -// nextPageTokens returns the tokens to use when asking for the next page of -// data. +// HasNextPage will return true if Pagination is able to determine that the API +// operation has additional pages. False will be returned if there are no more +// pages remaining. +// +// Will always return true if Next has not been called yet. +func (p *Pagination) HasNextPage() bool { + return !(p.started && len(p.nextTokens) == 0) +} + +// Err returns the error Pagination encountered when retrieving the next page. +func (p *Pagination) Err() error { + return p.err +} + +// Page returns the current page. Page should only be called after a successful +// call to Next. It is undefined what Page will return if Page is called after +// Next returns false. +func (p *Pagination) Page() interface{} { + return p.curPage +} + +// Next will attempt to retrieve the next page for the API operation. When a page +// is retrieved true will be returned. If the page cannot be retrieved, or there +// are no more pages false will be returned. +// +// Use the Page method to retrieve the current page data. The data will need +// to be cast to the API operation's output type. +// +// Use the Err method to determine if an error occurred if Page returns false. +func (p *Pagination) Next() bool { + if !p.HasNextPage() { + return false + } + + req, err := p.NewRequest() + if err != nil { + p.err = err + return false + } + + if p.started { + for i, intok := range req.Operation.InputTokens { + awsutil.SetValueAtPath(req.Params, intok, p.nextTokens[i]) + } + } + p.started = true + + err = req.Send() + if err != nil { + p.err = err + return false + } + + p.nextTokens = req.nextPageTokens() + p.curPage = req.Data + + return true +} + +// A Paginator is the configuration data that defines how an API operation +// should be paginated. This type is used by the API service models to define +// the generated pagination config for service APIs. +// +// The Pagination type is what provides iterating between pages of an API. It +// is only used to store the token metadata the SDK should use for performing +// pagination. +type Paginator struct { + InputTokens []string + OutputTokens []string + LimitToken string + TruncationToken string +} + +// nextPageTokens returns the tokens to use when asking for the next page of data. func (r *Request) nextPageTokens() []interface{} { if r.Operation.Paginator == nil { return nil } - if r.Operation.TruncationToken != "" { tr, _ := awsutil.ValuesAtPath(r.Data, r.Operation.TruncationToken) if len(tr) == 0 { @@ -61,9 +157,40 @@ func (r *Request) nextPageTokens() []interface{} { return tokens } +// Ensure a deprecated item is only logged once instead of each time its used. +func logDeprecatedf(logger aws.Logger, flag *int32, msg string) { + if logger == nil { + return + } + if atomic.CompareAndSwapInt32(flag, 0, 1) { + logger.Log(msg) + } +} + +var ( + logDeprecatedHasNextPage int32 + logDeprecatedNextPage int32 + logDeprecatedEachPage int32 +) + +// HasNextPage returns true if this request has more pages of data available. +// +// Deprecated Use Pagination type for configurable pagination of API operations +func (r *Request) HasNextPage() bool { + logDeprecatedf(r.Config.Logger, &logDeprecatedHasNextPage, + "Request.HasNextPage deprecated. Use Pagination type for configurable pagination of API operations") + + return len(r.nextPageTokens()) > 0 +} + // NextPage returns a new Request that can be executed to return the next // page of result data. Call .Send() on this request to execute it. +// +// Deprecated Use Pagination type for configurable pagination of API operations func (r *Request) NextPage() *Request { + logDeprecatedf(r.Config.Logger, &logDeprecatedNextPage, + "Request.NextPage deprecated. Use Pagination type for configurable pagination of API operations") + tokens := r.nextPageTokens() if len(tokens) == 0 { return nil @@ -90,7 +217,12 @@ func (r *Request) NextPage() *Request { // as the structure "T". The lastPage value represents whether the page is // the last page of data or not. The return value of this function should // return true to keep iterating or false to stop. +// +// Deprecated Use Pagination type for configurable pagination of API operations func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error { + logDeprecatedf(r.Config.Logger, &logDeprecatedEachPage, + "Request.EachPage deprecated. Use Pagination type for configurable pagination of API operations") + for page := r; page != nil; page = page.NextPage() { if err := page.Send(); err != nil { return err diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index ebd60ccc4f..bf07a1e9c2 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -26,8 +26,10 @@ func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { // retryableCodes is a collection of service response codes which are retry-able // without any further action. var retryableCodes = map[string]struct{}{ - "RequestError": {}, - "RequestTimeout": {}, + "RequestError": {}, + "RequestTimeout": {}, + ErrCodeResponseTimeout: {}, + "RequestTimeoutException": {}, // Glacier's flavor of RequestTimeout } var throttleCodes = map[string]struct{}{ @@ -68,35 +70,73 @@ func isCodeExpiredCreds(code string) bool { return ok } +func isSerializationErrorRetryable(err error) bool { + if err == nil { + return false + } + + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) + } + + return isErrConnectionReset(err) +} + // IsErrorRetryable returns whether the error is retryable, based on its Code. -// Returns false if the request has no Error set. -func (r *Request) IsErrorRetryable() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeRetryable(err.Code()) +// Returns false if error is nil. +func IsErrorRetryable(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok && aerr.Code() != ErrCodeSerialization { + return isCodeRetryable(aerr.Code()) + } else if ok { + return isSerializationErrorRetryable(aerr.OrigErr()) } } return false } // IsErrorThrottle returns whether the error is to be throttled based on its code. -// Returns false if the request has no Error set -func (r *Request) IsErrorThrottle() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeThrottle(err.Code()) +// Returns false if error is nil. +func IsErrorThrottle(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeThrottle(aerr.Code()) } } return false } -// IsErrorExpired returns whether the error code is a credential expiry error. -// Returns false if the request has no Error set. -func (r *Request) IsErrorExpired() bool { - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeExpiredCreds(err.Code()) +// IsErrorExpiredCreds returns whether the error code is a credential expiry error. +// Returns false if error is nil. +func IsErrorExpiredCreds(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeExpiredCreds(aerr.Code()) } } return false } + +// IsErrorRetryable returns whether the error is retryable, based on its Code. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorRetryable +func (r *Request) IsErrorRetryable() bool { + return IsErrorRetryable(r.Error) +} + +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if the request has no Error set +// +// Alias for the utility function IsErrorThrottle +func (r *Request) IsErrorThrottle() bool { + return IsErrorThrottle(r.Error) +} + +// IsErrorExpired returns whether the error code is a credential expiry error. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorExpiredCreds +func (r *Request) IsErrorExpired() bool { + return IsErrorExpiredCreds(r.Error) +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error.go new file mode 100644 index 0000000000..10fc8cb246 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error.go @@ -0,0 +1,19 @@ +// +build !appengine + +package request + +import ( + "net" + "os" + "syscall" +) + +func isErrConnectionReset(err error) bool { + if opErr, ok := err.(*net.OpError); ok { + if sysErr, ok := opErr.Err.(*os.SyscallError); ok { + return sysErr.Err == syscall.ECONNRESET + } + } + + return false +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error_appengine.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error_appengine.go new file mode 100644 index 0000000000..996196e730 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/serialization_error_appengine.go @@ -0,0 +1,11 @@ +// +build appengine + +package request + +import ( + "strings" +) + +func isErrConnectionReset(err error) bool { + return strings.Contains(err.Error(), "connection reset") +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go new file mode 100644 index 0000000000..09a44eb987 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go @@ -0,0 +1,94 @@ +package request + +import ( + "io" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +var timeoutErr = awserr.New( + ErrCodeResponseTimeout, + "read on body has reached the timeout limit", + nil, +) + +type readResult struct { + n int + err error +} + +// timeoutReadCloser will handle body reads that take too long. +// We will return a ErrReadTimeout error if a timeout occurs. +type timeoutReadCloser struct { + reader io.ReadCloser + duration time.Duration +} + +// Read will spin off a goroutine to call the reader's Read method. We will +// select on the timer's channel or the read's channel. Whoever completes first +// will be returned. +func (r *timeoutReadCloser) Read(b []byte) (int, error) { + timer := time.NewTimer(r.duration) + c := make(chan readResult, 1) + + go func() { + n, err := r.reader.Read(b) + timer.Stop() + c <- readResult{n: n, err: err} + }() + + select { + case data := <-c: + return data.n, data.err + case <-timer.C: + return 0, timeoutErr + } +} + +func (r *timeoutReadCloser) Close() error { + return r.reader.Close() +} + +const ( + // HandlerResponseTimeout is what we use to signify the name of the + // response timeout handler. + HandlerResponseTimeout = "ResponseTimeoutHandler" +) + +// adaptToResponseTimeoutError is a handler that will replace any top level error +// to a ErrCodeResponseTimeout, if its child is that. +func adaptToResponseTimeoutError(req *Request) { + if err, ok := req.Error.(awserr.Error); ok { + aerr, ok := err.OrigErr().(awserr.Error) + if ok && aerr.Code() == ErrCodeResponseTimeout { + req.Error = aerr + } + } +} + +// WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. +// This will allow for per read timeouts. If a timeout occurred, we will return the +// ErrCodeResponseTimeout. +// +// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) +func WithResponseReadTimeout(duration time.Duration) Option { + return func(r *Request) { + + var timeoutHandler = NamedHandler{ + HandlerResponseTimeout, + func(req *Request) { + req.HTTPResponse.Body = &timeoutReadCloser{ + reader: req.HTTPResponse.Body, + duration: duration, + } + }} + + // remove the handler so we are not stomping over any new durations. + r.Handlers.Send.RemoveByName(HandlerResponseTimeout) + r.Handlers.Send.PushBackNamed(timeoutHandler) + + r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) + r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) + } +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go new file mode 100644 index 0000000000..854b0854a2 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go @@ -0,0 +1,287 @@ +package request + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/awsutil" +) + +// WaiterResourceNotReadyErrorCode is the error code returned by a waiter when +// the waiter's max attempts have been exhausted. +const WaiterResourceNotReadyErrorCode = "ResourceNotReady" + +// A WaiterOption is a function that will update the Waiter value's fields to +// configure the waiter. +type WaiterOption func(*Waiter) + +// WithWaiterMaxAttempts returns the maximum number of times the waiter should +// attempt to check the resource for the target state. +func WithWaiterMaxAttempts(max int) WaiterOption { + return func(w *Waiter) { + w.MaxAttempts = max + } +} + +// WaiterDelay will return a delay the waiter should pause between attempts to +// check the resource state. The passed in attempt is the number of times the +// Waiter has checked the resource state. +// +// Attempt is the number of attempts the Waiter has made checking the resource +// state. +type WaiterDelay func(attempt int) time.Duration + +// ConstantWaiterDelay returns a WaiterDelay that will always return a constant +// delay the waiter should use between attempts. It ignores the number of +// attempts made. +func ConstantWaiterDelay(delay time.Duration) WaiterDelay { + return func(attempt int) time.Duration { + return delay + } +} + +// WithWaiterDelay will set the Waiter to use the WaiterDelay passed in. +func WithWaiterDelay(delayer WaiterDelay) WaiterOption { + return func(w *Waiter) { + w.Delay = delayer + } +} + +// WithWaiterLogger returns a waiter option to set the logger a waiter +// should use to log warnings and errors to. +func WithWaiterLogger(logger aws.Logger) WaiterOption { + return func(w *Waiter) { + w.Logger = logger + } +} + +// WithWaiterRequestOptions returns a waiter option setting the request +// options for each request the waiter makes. Appends to waiter's request +// options already set. +func WithWaiterRequestOptions(opts ...Option) WaiterOption { + return func(w *Waiter) { + w.RequestOptions = append(w.RequestOptions, opts...) + } +} + +// A Waiter provides the functionality to performing blocking call which will +// wait for an resource state to be satisfied a service. +// +// This type should not be used directly. The API operations provided in the +// service packages prefixed with "WaitUntil" should be used instead. +type Waiter struct { + Name string + Acceptors []WaiterAcceptor + Logger aws.Logger + + MaxAttempts int + Delay WaiterDelay + + RequestOptions []Option + NewRequest func([]Option) (*Request, error) +} + +// ApplyOptions updates the waiter with the list of waiter options provided. +func (w *Waiter) ApplyOptions(opts ...WaiterOption) { + for _, fn := range opts { + fn(w) + } +} + +// WaiterState are states the waiter uses based on WaiterAcceptor definitions +// to identify if the resource state the waiter is waiting on has occurred. +type WaiterState int + +// String returns the string representation of the waiter state. +func (s WaiterState) String() string { + switch s { + case SuccessWaiterState: + return "success" + case FailureWaiterState: + return "failure" + case RetryWaiterState: + return "retry" + default: + return "unknown waiter state" + } +} + +// States the waiter acceptors will use to identify target resource states. +const ( + SuccessWaiterState WaiterState = iota // waiter successful + FailureWaiterState // waiter failed + RetryWaiterState // waiter needs to be retried +) + +// WaiterMatchMode is the mode that the waiter will use to match the WaiterAcceptor +// definition's Expected attribute. +type WaiterMatchMode int + +// Modes the waiter will use when inspecting API response to identify target +// resource states. +const ( + PathAllWaiterMatch WaiterMatchMode = iota // match on all paths + PathWaiterMatch // match on specific path + PathAnyWaiterMatch // match on any path + PathListWaiterMatch // match on list of paths + StatusWaiterMatch // match on status code + ErrorWaiterMatch // match on error +) + +// String returns the string representation of the waiter match mode. +func (m WaiterMatchMode) String() string { + switch m { + case PathAllWaiterMatch: + return "pathAll" + case PathWaiterMatch: + return "path" + case PathAnyWaiterMatch: + return "pathAny" + case PathListWaiterMatch: + return "pathList" + case StatusWaiterMatch: + return "status" + case ErrorWaiterMatch: + return "error" + default: + return "unknown waiter match mode" + } +} + +// WaitWithContext will make requests for the API operation using NewRequest to +// build API requests. The request's response will be compared against the +// Waiter's Acceptors to determine the successful state of the resource the +// waiter is inspecting. +// +// The passed in context must not be nil. If it is nil a panic will occur. The +// Context will be used to cancel the waiter's pending requests and retry delays. +// Use aws.BackgroundContext if no context is available. +// +// The waiter will continue until the target state defined by the Acceptors, +// or the max attempts expires. +// +// Will return the WaiterResourceNotReadyErrorCode error code if the waiter's +// retryer ShouldRetry returns false. This normally will happen when the max +// wait attempts expires. +func (w Waiter) WaitWithContext(ctx aws.Context) error { + + for attempt := 1; ; attempt++ { + req, err := w.NewRequest(w.RequestOptions) + if err != nil { + waiterLogf(w.Logger, "unable to create request %v", err) + return err + } + req.Handlers.Build.PushBack(MakeAddToUserAgentFreeFormHandler("Waiter")) + err = req.Send() + + // See if any of the acceptors match the request's response, or error + for _, a := range w.Acceptors { + if matched, matchErr := a.match(w.Name, w.Logger, req, err); matched { + return matchErr + } + } + + // The Waiter should only check the resource state MaxAttempts times + // This is here instead of in the for loop above to prevent delaying + // unnecessary when the waiter will not retry. + if attempt == w.MaxAttempts { + break + } + + // Delay to wait before inspecting the resource again + delay := w.Delay(attempt) + if sleepFn := req.Config.SleepDelay; sleepFn != nil { + // Support SleepDelay for backwards compatibility and testing + sleepFn(delay) + } else if err := aws.SleepWithContext(ctx, delay); err != nil { + return awserr.New(CanceledErrorCode, "waiter context canceled", err) + } + } + + return awserr.New(WaiterResourceNotReadyErrorCode, "exceeded wait attempts", nil) +} + +// A WaiterAcceptor provides the information needed to wait for an API operation +// to complete. +type WaiterAcceptor struct { + State WaiterState + Matcher WaiterMatchMode + Argument string + Expected interface{} +} + +// match returns if the acceptor found a match with the passed in request +// or error. True is returned if the acceptor made a match, error is returned +// if there was an error attempting to perform the match. +func (a *WaiterAcceptor) match(name string, l aws.Logger, req *Request, err error) (bool, error) { + result := false + var vals []interface{} + + switch a.Matcher { + case PathAllWaiterMatch, PathWaiterMatch: + // Require all matches to be equal for result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + if len(vals) == 0 { + break + } + result = true + for _, val := range vals { + if !awsutil.DeepEqual(val, a.Expected) { + result = false + break + } + } + case PathAnyWaiterMatch: + // Only a single match needs to equal for the result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + for _, val := range vals { + if awsutil.DeepEqual(val, a.Expected) { + result = true + break + } + } + case PathListWaiterMatch: + // ignored matcher + case StatusWaiterMatch: + s := a.Expected.(int) + result = s == req.HTTPResponse.StatusCode + case ErrorWaiterMatch: + if aerr, ok := err.(awserr.Error); ok { + result = aerr.Code() == a.Expected.(string) + } + default: + waiterLogf(l, "WARNING: Waiter %s encountered unexpected matcher: %s", + name, a.Matcher) + } + + if !result { + // If there was no matching result found there is nothing more to do + // for this response, retry the request. + return false, nil + } + + switch a.State { + case SuccessWaiterState: + // waiter completed + return true, nil + case FailureWaiterState: + // Waiter failure state triggered + return true, awserr.New(WaiterResourceNotReadyErrorCode, + "failed waiting for successful resource state", err) + case RetryWaiterState: + // clear the error and retry the operation + return false, nil + default: + waiterLogf(l, "WARNING: Waiter %s encountered unexpected state: %s", + name, a.State) + return false, nil + } +} + +func waiterLogf(logger aws.Logger, msg string, args ...interface{}) { + if logger != nil { + logger.Log(fmt.Sprintf(msg, args...)) + } +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go index d3dc8404ed..2fe35e74d7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -23,7 +23,7 @@ additional config if the AWS_SDK_LOAD_CONFIG environment variable is set. Alternatively you can explicitly create a Session with shared config enabled. To do this you can use NewSessionWithOptions to configure how the Session will be created. Using the NewSessionWithOptions with SharedConfigState set to -SharedConfigEnabled will create the session as if the AWS_SDK_LOAD_CONFIG +SharedConfigEnable will create the session as if the AWS_SDK_LOAD_CONFIG environment variable was set. Creating Sessions @@ -45,16 +45,16 @@ region, and profile loaded from the environment and shared config automatically. Requires the AWS_PROFILE to be set, or "default" is used. // Create Session - sess, err := session.NewSession() + sess := session.Must(session.NewSession()) // Create a Session with a custom region - sess, err := session.NewSession(&aws.Config{Region: aws.String("us-east-1")}) + sess := session.Must(session.NewSession(&aws.Config{ + Region: aws.String("us-east-1"), + })) // Create a S3 client instance from a session - sess, err := session.NewSession() - if err != nil { - // Handle Session creation error - } + sess := session.Must(session.NewSession()) + svc := s3.New(sess) Create Session With Option Overrides @@ -67,23 +67,25 @@ Use NewSessionWithOptions when you want to provide the config profile, or override the shared config state (AWS_SDK_LOAD_CONFIG). // Equivalent to session.NewSession() - sess, err := session.NewSessionWithOptions(session.Options{}) + sess := session.Must(session.NewSessionWithOptions(session.Options{ + // Options + })) // Specify profile to load for the session's config - sess, err := session.NewSessionWithOptions(session.Options{ + sess := session.Must(session.NewSessionWithOptions(session.Options{ Profile: "profile_name", - }) + })) // Specify profile for config and region for requests - sess, err := session.NewSessionWithOptions(session.Options{ + sess := session.Must(session.NewSessionWithOptions(session.Options{ Config: aws.Config{Region: aws.String("us-east-1")}, Profile: "profile_name", - }) + })) // Force enable Shared Config support - sess, err := session.NewSessionWithOptions(session.Options{ - SharedConfigState: SharedConfigEnable, - }) + sess := session.Must(session.NewSessionWithOptions(session.Options{ + SharedConfigState: session.SharedConfigEnable, + })) Adding Handlers @@ -93,7 +95,8 @@ handler logs every request and its payload made by a service client: // Create a session, and add additional handlers for all service // clients created with the Session to inherit. Adds logging handler. - sess, err := session.NewSession() + sess := session.Must(session.NewSession()) + sess.Handlers.Send.PushFront(func(r *request.Request) { // Log every request made and its payload logger.Println("Request: %s/%s, Payload: %s", @@ -138,15 +141,14 @@ the other two fields are also provided. Assume Role values allow you to configure the SDK to assume an IAM role using a set of credentials provided in a config file via the source_profile field. -Both "role_arn" and "source_profile" are required. The SDK does not support -assuming a role with MFA token Via the Session's constructor. You can use the -stscreds.AssumeRoleProvider credentials provider to specify custom -configuration and support for MFA. +Both "role_arn" and "source_profile" are required. The SDK supports assuming +a role with MFA token if the session option AssumeRoleTokenProvider +is set. role_arn = arn:aws:iam:::role/ source_profile = profile_with_creds external_id = 1234 - mfa_serial = not supported! + mfa_serial = role_session_name = session_name Region is the region the SDK should use for looking up AWS service endpoints @@ -154,6 +156,37 @@ and signing requests. region = us-east-1 +Assume Role with MFA token + +To create a session with support for assuming an IAM role with MFA set the +session option AssumeRoleTokenProvider to a function that will prompt for the +MFA token code when the SDK assumes the role and refreshes the role's credentials. +This allows you to configure the SDK via the shared config to assumea role +with MFA tokens. + +In order for the SDK to assume a role with MFA the SharedConfigState +session option must be set to SharedConfigEnable, or AWS_SDK_LOAD_CONFIG +environment variable set. + +The shared configuration instructs the SDK to assume an IAM role with MFA +when the mfa_serial configuration field is set in the shared config +(~/.aws/config) or shared credentials (~/.aws/credentials) file. + +If mfa_serial is set in the configuration, the SDK will assume the role, and +the AssumeRoleTokenProvider session option is not set an an error will +be returned when creating the session. + + sess := session.Must(session.NewSessionWithOptions(session.Options{ + AssumeRoleTokenProvider: stscreds.StdinTokenProvider, + })) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess) + +To setup assume role outside of a session see the stscrds.AssumeRoleProvider +documentation. + Environment Variables When a Session is created several environment variables can be set to adjust @@ -218,6 +251,24 @@ $HOME/.aws/config on Linux/Unix based systems, and AWS_CONFIG_FILE=$HOME/my_shared_config +Path to a custom Credentials Authority (CA) bundle PEM file that the SDK +will use instead of the default system's root CA bundle. Use this only +if you want to replace the CA bundle the SDK uses for TLS requests. + + AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle + +Enabling this option will attempt to merge the Transport into the SDK's HTTP +client. If the client's Transport is not a http.Transport an error will be +returned. If the Transport's TLS config is set this option will cause the SDK +to overwrite the Transport's TLS config's RootCAs value. If the CA bundle file +contains multiple certificates all of them will be loaded. + +The Session option CustomCABundle is also available when creating sessions +to also enable this feature. CustomCABundle session option field has priority +over the AWS_CA_BUNDLE environment variable, and will be used if both are set. +Setting a custom HTTPClient in the aws.Config options will override this setting. +To use this option and custom HTTP client, the HTTP client needs to be provided +when creating the session. Not the service client. */ package session diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go index d2f0c84481..e6278a782c 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -75,6 +75,24 @@ type envConfig struct { // // AWS_CONFIG_FILE=$HOME/my_shared_config SharedConfigFile string + + // Sets the path to a custom Credentials Authroity (CA) Bundle PEM file + // that the SDK will use instead of the the system's root CA bundle. + // Only use this if you want to configure the SDK to use a custom set + // of CAs. + // + // Enabling this option will attempt to merge the Transport + // into the SDK's HTTP client. If the client's Transport is + // not a http.Transport an error will be returned. If the + // Transport's TLS config is set this option will cause the + // SDK to overwrite the Transport's TLS config's RootCAs value. + // + // Setting a custom HTTPClient in the aws.Config options will override this setting. + // To use this option and custom HTTP client, the HTTP client needs to be provided + // when creating the session. Not the service client. + // + // AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle + CustomCABundle string } var ( @@ -150,6 +168,8 @@ func envConfigLoad(enableSharedConfig bool) envConfig { cfg.SharedCredentialsFile = sharedCredentialsFilename() cfg.SharedConfigFile = sharedConfigFilename() + cfg.CustomCABundle = os.Getenv("AWS_CA_BUNDLE") + return cfg } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 3d52fc20d7..96c740d00f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -1,7 +1,13 @@ package session import ( + "crypto/tls" + "crypto/x509" "fmt" + "io" + "io/ioutil" + "net/http" + "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" @@ -52,7 +58,7 @@ func New(cfgs ...*aws.Config) *Session { envCfg := loadEnvConfig() if envCfg.EnableSharedConfig { - s, err := newSession(envCfg, cfgs...) + s, err := newSession(Options{}, envCfg, cfgs...) if err != nil { // Old session.New expected all errors to be discovered when // a request is made, and would report the errors then. This @@ -73,7 +79,7 @@ func New(cfgs ...*aws.Config) *Session { return s } - return oldNewSession(cfgs...) + return deprecatedNewSession(cfgs...) } // NewSession returns a new Session created from SDK defaults, config files, @@ -92,9 +98,10 @@ func New(cfgs ...*aws.Config) *Session { // control through code how the Session will be created. Such as specifying the // config profile, and controlling if shared config is enabled or not. func NewSession(cfgs ...*aws.Config) (*Session, error) { - envCfg := loadEnvConfig() + opts := Options{} + opts.Config.MergeIn(cfgs...) - return newSession(envCfg, cfgs...) + return NewSessionWithOptions(opts) } // SharedConfigState provides the ability to optionally override the state @@ -147,6 +154,41 @@ type Options struct { // will allow you to override the AWS_SDK_LOAD_CONFIG environment variable // and enable or disable the shared config functionality. SharedConfigState SharedConfigState + + // When the SDK's shared config is configured to assume a role with MFA + // this option is required in order to provide the mechanism that will + // retrieve the MFA token. There is no default value for this field. If + // it is not set an error will be returned when creating the session. + // + // This token provider will be called when ever the assumed role's + // credentials need to be refreshed. Within the context of service clients + // all sharing the same session the SDK will ensure calls to the token + // provider are atomic. When sharing a token provider across multiple + // sessions additional synchronization logic is needed to ensure the + // token providers do not introduce race conditions. It is recommend to + // share the session where possible. + // + // stscreds.StdinTokenProvider is a basic implementation that will prompt + // from stdin for the MFA token code. + // + // This field is only used if the shared configuration is enabled, and + // the config enables assume role wit MFA via the mfa_serial field. + AssumeRoleTokenProvider func() (string, error) + + // Reader for a custom Credentials Authority (CA) bundle in PEM format that + // the SDK will use instead of the default system's root CA bundle. Use this + // only if you want to replace the CA bundle the SDK uses for TLS requests. + // + // Enabling this option will attempt to merge the Transport into the SDK's HTTP + // client. If the client's Transport is not a http.Transport an error will be + // returned. If the Transport's TLS config is set this option will cause the SDK + // to overwrite the Transport's TLS config's RootCAs value. If the CA + // bundle reader contains multiple certificates all of them will be loaded. + // + // The Session option CustomCABundle is also available when creating sessions + // to also enable this feature. CustomCABundle session option field has priority + // over the AWS_CA_BUNDLE environment variable, and will be used if both are set. + CustomCABundle io.Reader } // NewSessionWithOptions returns a new Session created from SDK defaults, config files, @@ -161,23 +203,23 @@ type Options struct { // to be built with retrieving credentials with AssumeRole set in the config. // // // Equivalent to session.New -// sess, err := session.NewSessionWithOptions(session.Options{}) +// sess := session.Must(session.NewSessionWithOptions(session.Options{})) // // // Specify profile to load for the session's config -// sess, err := session.NewSessionWithOptions(session.Options{ +// sess := session.Must(session.NewSessionWithOptions(session.Options{ // Profile: "profile_name", -// }) +// })) // // // Specify profile for config and region for requests -// sess, err := session.NewSessionWithOptions(session.Options{ +// sess := session.Must(session.NewSessionWithOptions(session.Options{ // Config: aws.Config{Region: aws.String("us-east-1")}, // Profile: "profile_name", -// }) +// })) // // // Force enable Shared Config support -// sess, err := session.NewSessionWithOptions(session.Options{ +// sess := session.Must(session.NewSessionWithOptions(session.Options{ // SharedConfigState: SharedConfigEnable, -// }) +// })) func NewSessionWithOptions(opts Options) (*Session, error) { var envCfg envConfig if opts.SharedConfigState == SharedConfigEnable { @@ -197,7 +239,18 @@ func NewSessionWithOptions(opts Options) (*Session, error) { envCfg.EnableSharedConfig = true } - return newSession(envCfg, &opts.Config) + // Only use AWS_CA_BUNDLE if session option is not provided. + if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { + f, err := os.Open(envCfg.CustomCABundle) + if err != nil { + return nil, awserr.New("LoadCustomCABundleError", + "failed to open custom CA bundle PEM file", err) + } + defer f.Close() + opts.CustomCABundle = f + } + + return newSession(opts, envCfg, &opts.Config) } // Must is a helper function to ensure the Session is valid and there was no @@ -215,7 +268,7 @@ func Must(sess *Session, err error) *Session { return sess } -func oldNewSession(cfgs ...*aws.Config) *Session { +func deprecatedNewSession(cfgs ...*aws.Config) *Session { cfg := defaults.Config() handlers := defaults.Handlers() @@ -242,7 +295,7 @@ func oldNewSession(cfgs ...*aws.Config) *Session { return s } -func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { +func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { cfg := defaults.Config() handlers := defaults.Handlers() @@ -266,7 +319,9 @@ func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { return nil, err } - mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers) + if err := mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers, opts); err != nil { + return nil, err + } s := &Session{ Config: cfg, @@ -275,10 +330,62 @@ func newSession(envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { initHandlers(s) + // Setup HTTP client with custom cert bundle if enabled + if opts.CustomCABundle != nil { + if err := loadCustomCABundle(s, opts.CustomCABundle); err != nil { + return nil, err + } + } + return s, nil } -func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers) { +func loadCustomCABundle(s *Session, bundle io.Reader) error { + var t *http.Transport + switch v := s.Config.HTTPClient.Transport.(type) { + case *http.Transport: + t = v + default: + if s.Config.HTTPClient.Transport != nil { + return awserr.New("LoadCustomCABundleError", + "unable to load custom CA bundle, HTTPClient's transport unsupported type", nil) + } + } + if t == nil { + t = &http.Transport{} + } + + p, err := loadCertPool(bundle) + if err != nil { + return err + } + if t.TLSClientConfig == nil { + t.TLSClientConfig = &tls.Config{} + } + t.TLSClientConfig.RootCAs = p + + s.Config.HTTPClient.Transport = t + + return nil +} + +func loadCertPool(r io.Reader) (*x509.CertPool, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, awserr.New("LoadCustomCABundleError", + "failed to read custom CA bundle PEM file", err) + } + + p := x509.NewCertPool() + if !p.AppendCertsFromPEM(b) { + return nil, awserr.New("LoadCustomCABundleError", + "failed to load custom CA bundle PEM file", err) + } + + return p, nil +} + +func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers, sessOpts Options) error { // Merge in user provided configuration cfg.MergeIn(userCfg) @@ -302,6 +409,11 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds( sharedCfg.AssumeRoleSource.Creds, ) + if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { + // AssumeRole Token provider is required if doing Assume Role + // with MFA. + return AssumeRoleTokenProviderNotSetError{} + } cfg.Credentials = stscreds.NewCredentials( &Session{ Config: &cfgCp, @@ -311,11 +423,16 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share func(opt *stscreds.AssumeRoleProvider) { opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName + // Assume role with external ID if len(sharedCfg.AssumeRole.ExternalID) > 0 { opt.ExternalID = aws.String(sharedCfg.AssumeRole.ExternalID) } - // MFA not supported + // Assume role with MFA + if len(sharedCfg.AssumeRole.MFASerial) > 0 { + opt.SerialNumber = aws.String(sharedCfg.AssumeRole.MFASerial) + opt.TokenProvider = sessOpts.AssumeRoleTokenProvider + } }, ) } else if len(sharedCfg.Creds.AccessKeyID) > 0 { @@ -336,6 +453,33 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share }) } } + + return nil +} + +// AssumeRoleTokenProviderNotSetError is an error returned when creating a session when the +// MFAToken option is not set when shared config is configured load assume a +// role with an MFA token. +type AssumeRoleTokenProviderNotSetError struct{} + +// Code is the short id of the error. +func (e AssumeRoleTokenProviderNotSetError) Code() string { + return "AssumeRoleTokenProviderNotSetError" +} + +// Message is the description of the error +func (e AssumeRoleTokenProviderNotSetError) Message() string { + return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") +} + +// OrigErr is the underlying error that caused the failure. +func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { + return nil +} + +// Error satisfies the error interface. +func (e AssumeRoleTokenProviderNotSetError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", nil) } type credProviderError struct { diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go new file mode 100644 index 0000000000..6aa2ed241b --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go @@ -0,0 +1,7 @@ +package v4 + +// WithUnsignedPayload will enable and set the UnsignedPayload field to +// true of the signer. +func WithUnsignedPayload(v4 *Signer) { + v4.UnsignedPayload = true +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index 98bfe742b3..434ac872de 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -194,6 +194,10 @@ type Signer struct { // This value should only be used for testing. If it is nil the default // time.Now will be used. currentTimeFn func() time.Time + + // UnsignedPayload will prevent signing of the payload. This will only + // work for services that have support for this. + UnsignedPayload bool } // NewSigner returns a Signer pointer configured with the credentials and optional @@ -227,6 +231,7 @@ type signingCtx struct { isPresign bool formattedTime string formattedShortTime string + unsignedPayload bool bodyDigest string signedHeaders string @@ -317,6 +322,7 @@ func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, regi ServiceName: service, Region: region, DisableURIPathEscaping: v4.DisableURIPathEscaping, + unsignedPayload: v4.UnsignedPayload, } for key := range ctx.Query { @@ -409,7 +415,18 @@ var SignRequestHandler = request.NamedHandler{ func SignSDKRequest(req *request.Request) { signSDKRequestWithCurrTime(req, time.Now) } -func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time) { + +// BuildNamedHandler will build a generic handler for signing. +func BuildNamedHandler(name string, opts ...func(*Signer)) request.NamedHandler { + return request.NamedHandler{ + Name: name, + Fn: func(req *request.Request) { + signSDKRequestWithCurrTime(req, time.Now, opts...) + }, + } +} + +func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time, opts ...func(*Signer)) { // If the request does not need to be signed ignore the signing of the // request if the AnonymousCredentials object is used. if req.Config.Credentials == credentials.AnonymousCredentials { @@ -441,6 +458,10 @@ func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time v4.DisableRequestBodyOverwrite = true }) + for _, opt := range opts { + opt(v4) + } + signingTime := req.Time if !req.LastSignedAt.IsZero() { signingTime = req.LastSignedAt @@ -634,14 +655,14 @@ func (ctx *signingCtx) buildSignature() { func (ctx *signingCtx) buildBodyDigest() { hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") if hash == "" { - if ctx.isPresign && ctx.ServiceName == "s3" { + if ctx.unsignedPayload || (ctx.isPresign && ctx.ServiceName == "s3") { hash = "UNSIGNED-PAYLOAD" } else if ctx.Body == nil { hash = emptyStringSHA256 } else { hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) } - if ctx.ServiceName == "s3" || ctx.ServiceName == "glacier" { + if ctx.unsignedPayload || ctx.ServiceName == "s3" || ctx.ServiceName == "glacier" { ctx.Request.Header.Set("X-Amz-Content-Sha256", hash) } } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/url.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/url.go new file mode 100644 index 0000000000..6192b2455b --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/url.go @@ -0,0 +1,12 @@ +// +build go1.8 + +package aws + +import "net/url" + +// URLHostname will extract the Hostname without port from the URL value. +// +// Wrapper of net/url#URL.Hostname for backwards Go version compatibility. +func URLHostname(url *url.URL) string { + return url.Hostname() +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go new file mode 100644 index 0000000000..0210d2720e --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go @@ -0,0 +1,29 @@ +// +build !go1.8 + +package aws + +import ( + "net/url" + "strings" +) + +// URLHostname will extract the Hostname without port from the URL value. +// +// Copy of Go 1.8's net/url#URL.Hostname functionality. +func URLHostname(url *url.URL) string { + return stripPort(url.Host) + +} + +// stripPort is copy of Go 1.8 url#URL.Hostname functionality. +// https://golang.org/src/net/url/url.go +func stripPort(hostport string) string { + colon := strings.IndexByte(hostport, ':') + if colon == -1 { + return hostport + } + if i := strings.IndexByte(hostport, ']'); i != -1 { + return strings.TrimPrefix(hostport[:i], "[") + } + return hostport[:colon] +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/aws/version.go b/installer/vendor/github.com/aws/aws-sdk-go/aws/version.go index be7ac143ee..a58e54551d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.6.25" +const SDKVersion = "1.8.13" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go b/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go index f434ab7cb9..524ca952ad 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go @@ -80,7 +80,6 @@ func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix stri continue } - if protocol.CanSetIdempotencyToken(value.Field(i), field) { token := protocol.GetIdempotencyToken() elemValue = reflect.ValueOf(token) @@ -124,7 +123,11 @@ func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string // check for unflattened list member if !q.isEC2 && tag.Get("flattened") == "" { - prefix += ".member" + if listName := tag.Get("locationNameList"); listName == "" { + prefix += ".member" + } else { + prefix += "." + listName + } } for i := 0; i < value.Len(); i++ { diff --git a/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go index 20a41d462c..7161835649 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go @@ -4,6 +4,7 @@ package rest import ( "bytes" "encoding/base64" + "encoding/json" "fmt" "io" "net/http" @@ -82,8 +83,12 @@ func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bo if name == "" { name = field.Name } - if m.Kind() == reflect.Ptr { + if kind := m.Kind(); kind == reflect.Ptr { m = m.Elem() + } else if kind == reflect.Interface { + if !m.Elem().IsValid() { + continue + } } if !m.IsValid() { continue @@ -95,16 +100,16 @@ func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bo var err error switch field.Tag.Get("location") { case "headers": // header maps - err = buildHeaderMap(&r.HTTPRequest.Header, m, field.Tag.Get("locationName")) + err = buildHeaderMap(&r.HTTPRequest.Header, m, field.Tag) case "header": - err = buildHeader(&r.HTTPRequest.Header, m, name) + err = buildHeader(&r.HTTPRequest.Header, m, name, field.Tag) case "uri": - err = buildURI(r.HTTPRequest.URL, m, name) + err = buildURI(r.HTTPRequest.URL, m, name, field.Tag) case "querystring": - err = buildQueryString(query, m, name) + err = buildQueryString(query, m, name, field.Tag) default: if buildGETQuery { - err = buildQueryString(query, m, name) + err = buildQueryString(query, m, name, field.Tag) } } r.Error = err @@ -145,8 +150,8 @@ func buildBody(r *request.Request, v reflect.Value) { } } -func buildHeader(header *http.Header, v reflect.Value, name string) error { - str, err := convertType(v) +func buildHeader(header *http.Header, v reflect.Value, name string, tag reflect.StructTag) error { + str, err := convertType(v, tag) if err == errValueNotSet { return nil } else if err != nil { @@ -158,9 +163,10 @@ func buildHeader(header *http.Header, v reflect.Value, name string) error { return nil } -func buildHeaderMap(header *http.Header, v reflect.Value, prefix string) error { +func buildHeaderMap(header *http.Header, v reflect.Value, tag reflect.StructTag) error { + prefix := tag.Get("locationName") for _, key := range v.MapKeys() { - str, err := convertType(v.MapIndex(key)) + str, err := convertType(v.MapIndex(key), tag) if err == errValueNotSet { continue } else if err != nil { @@ -173,8 +179,8 @@ func buildHeaderMap(header *http.Header, v reflect.Value, prefix string) error { return nil } -func buildURI(u *url.URL, v reflect.Value, name string) error { - value, err := convertType(v) +func buildURI(u *url.URL, v reflect.Value, name string, tag reflect.StructTag) error { + value, err := convertType(v, tag) if err == errValueNotSet { return nil } else if err != nil { @@ -190,7 +196,7 @@ func buildURI(u *url.URL, v reflect.Value, name string) error { return nil } -func buildQueryString(query url.Values, v reflect.Value, name string) error { +func buildQueryString(query url.Values, v reflect.Value, name string, tag reflect.StructTag) error { switch value := v.Interface().(type) { case []*string: for _, item := range value { @@ -207,7 +213,7 @@ func buildQueryString(query url.Values, v reflect.Value, name string) error { } } default: - str, err := convertType(v) + str, err := convertType(v, tag) if err == errValueNotSet { return nil } else if err != nil { @@ -246,7 +252,7 @@ func EscapePath(path string, encodeSep bool) string { return buf.String() } -func convertType(v reflect.Value) (string, error) { +func convertType(v reflect.Value, tag reflect.StructTag) (string, error) { v = reflect.Indirect(v) if !v.IsValid() { return "", errValueNotSet @@ -266,6 +272,16 @@ func convertType(v reflect.Value) (string, error) { str = strconv.FormatFloat(value, 'f', -1, 64) case time.Time: str = value.UTC().Format(RFC822) + case aws.JSONValue: + b, err := json.Marshal(value) + if err != nil { + return "", err + } + if tag.Get("location") == "header" { + str = base64.StdEncoding.EncodeToString(b) + } else { + str = string(b) + } default: err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) return "", err diff --git a/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go index 9c00921c09..7a779ee226 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go @@ -3,6 +3,7 @@ package rest import ( "bytes" "encoding/base64" + "encoding/json" "fmt" "io" "io/ioutil" @@ -12,6 +13,7 @@ import ( "strings" "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" ) @@ -111,7 +113,7 @@ func unmarshalLocationElements(r *request.Request, v reflect.Value) { case "statusCode": unmarshalStatusCode(m, r.HTTPResponse.StatusCode) case "header": - err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name)) + err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name), field.Tag) if err != nil { r.Error = awserr.New("SerializationError", "failed to decode REST response", err) break @@ -158,8 +160,13 @@ func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) err return nil } -func unmarshalHeader(v reflect.Value, header string) error { - if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { +func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) error { + isJSONValue := tag.Get("type") == "jsonvalue" + if isJSONValue { + if len(header) == 0 { + return nil + } + } else if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { return nil } @@ -196,6 +203,22 @@ func unmarshalHeader(v reflect.Value, header string) error { return err } v.Set(reflect.ValueOf(&t)) + case aws.JSONValue: + b := []byte(header) + var err error + if tag.Get("location") == "header" { + b, err = base64.StdEncoding.DecodeString(header) + if err != nil { + return err + } + } + + m := aws.JSONValue{} + err = json.Unmarshal(b, &m) + if err != nil { + return err + } + v.Set(reflect.ValueOf(m)) default: err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) return err diff --git a/installer/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go b/installer/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go deleted file mode 100644 index b51e9449c1..0000000000 --- a/installer/vendor/github.com/aws/aws-sdk-go/private/waiter/waiter.go +++ /dev/null @@ -1,134 +0,0 @@ -package waiter - -import ( - "fmt" - "reflect" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" -) - -// A Config provides a collection of configuration values to setup a generated -// waiter code with. -type Config struct { - Name string - Delay int - MaxAttempts int - Operation string - Acceptors []WaitAcceptor -} - -// A WaitAcceptor provides the information needed to wait for an API operation -// to complete. -type WaitAcceptor struct { - Expected interface{} - Matcher string - State string - Argument string -} - -// A Waiter provides waiting for an operation to complete. -type Waiter struct { - Config - Client interface{} - Input interface{} -} - -// Wait waits for an operation to complete, expire max attempts, or fail. Error -// is returned if the operation fails. -func (w *Waiter) Wait() error { - client := reflect.ValueOf(w.Client) - in := reflect.ValueOf(w.Input) - method := client.MethodByName(w.Config.Operation + "Request") - - for i := 0; i < w.MaxAttempts; i++ { - res := method.Call([]reflect.Value{in}) - req := res[0].Interface().(*request.Request) - req.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Waiter")) - - err := req.Send() - for _, a := range w.Acceptors { - result := false - var vals []interface{} - switch a.Matcher { - case "pathAll", "path": - // Require all matches to be equal for result to match - vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) - if len(vals) == 0 { - break - } - result = true - for _, val := range vals { - if !awsutil.DeepEqual(val, a.Expected) { - result = false - break - } - } - case "pathAny": - // Only a single match needs to equal for the result to match - vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) - for _, val := range vals { - if awsutil.DeepEqual(val, a.Expected) { - result = true - break - } - } - case "status": - s := a.Expected.(int) - result = s == req.HTTPResponse.StatusCode - case "error": - if aerr, ok := err.(awserr.Error); ok { - result = aerr.Code() == a.Expected.(string) - } - case "pathList": - // ignored matcher - default: - logf(client, "WARNING: Waiter for %s encountered unexpected matcher: %s", - w.Config.Operation, a.Matcher) - } - - if !result { - // If there was no matching result found there is nothing more to do - // for this response, retry the request. - continue - } - - switch a.State { - case "success": - // waiter completed - return nil - case "failure": - // Waiter failure state triggered - return awserr.New("ResourceNotReady", - fmt.Sprintf("failed waiting for successful resource state"), err) - case "retry": - // clear the error and retry the operation - err = nil - default: - logf(client, "WARNING: Waiter for %s encountered unexpected state: %s", - w.Config.Operation, a.State) - } - } - if err != nil { - return err - } - - time.Sleep(time.Second * time.Duration(w.Delay)) - } - - return awserr.New("ResourceNotReady", - fmt.Sprintf("exceeded %d wait attempts", w.MaxAttempts), nil) -} - -func logf(client reflect.Value, msg string, args ...interface{}) { - cfgVal := client.FieldByName("Config") - if !cfgVal.IsValid() { - return - } - if cfg, ok := cfgVal.Interface().(*aws.Config); ok && cfg.Logger != nil { - cfg.Logger.Log(fmt.Sprintf(msg, args...)) - } -} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/acm/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/acm/api.go index d17990db4a..c1dfaf9ea2 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/acm/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/acm/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package acm provides a client for AWS Certificate Manager. package acm @@ -7,6 +7,7 @@ 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" @@ -103,8 +104,23 @@ func (c *ACM) AddTagsToCertificateRequest(input *AddTagsToCertificateInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/AddTagsToCertificate func (c *ACM) AddTagsToCertificate(input *AddTagsToCertificateInput) (*AddTagsToCertificateOutput, error) { req, out := c.AddTagsToCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToCertificateWithContext is the same as AddTagsToCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToCertificate 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 *ACM) AddTagsToCertificateWithContext(ctx aws.Context, input *AddTagsToCertificateInput, opts ...request.Option) (*AddTagsToCertificateOutput, error) { + req, out := c.AddTagsToCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCertificate = "DeleteCertificate" @@ -186,8 +202,23 @@ func (c *ACM) DeleteCertificateRequest(input *DeleteCertificateInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/DeleteCertificate func (c *ACM) DeleteCertificate(input *DeleteCertificateInput) (*DeleteCertificateOutput, error) { req, out := c.DeleteCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCertificateWithContext is the same as DeleteCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCertificate 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 *ACM) DeleteCertificateWithContext(ctx aws.Context, input *DeleteCertificateInput, opts ...request.Option) (*DeleteCertificateOutput, error) { + req, out := c.DeleteCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCertificate = "DescribeCertificate" @@ -255,8 +286,23 @@ func (c *ACM) DescribeCertificateRequest(input *DescribeCertificateInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/DescribeCertificate func (c *ACM) DescribeCertificate(input *DescribeCertificateInput) (*DescribeCertificateOutput, error) { req, out := c.DescribeCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCertificateWithContext is the same as DescribeCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCertificate 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 *ACM) DescribeCertificateWithContext(ctx aws.Context, input *DescribeCertificateInput, opts ...request.Option) (*DescribeCertificateOutput, error) { + req, out := c.DescribeCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetCertificate = "GetCertificate" @@ -336,8 +382,23 @@ func (c *ACM) GetCertificateRequest(input *GetCertificateInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/GetCertificate func (c *ACM) GetCertificate(input *GetCertificateInput) (*GetCertificateOutput, error) { req, out := c.GetCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCertificateWithContext is the same as GetCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See GetCertificate 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 *ACM) GetCertificateWithContext(ctx aws.Context, input *GetCertificateInput, opts ...request.Option) (*GetCertificateOutput, error) { + req, out := c.GetCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportCertificate = "ImportCertificate" @@ -434,8 +495,23 @@ func (c *ACM) ImportCertificateRequest(input *ImportCertificateInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/ImportCertificate func (c *ACM) ImportCertificate(input *ImportCertificateInput) (*ImportCertificateOutput, error) { req, out := c.ImportCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportCertificateWithContext is the same as ImportCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See ImportCertificate 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 *ACM) ImportCertificateWithContext(ctx aws.Context, input *ImportCertificateInput, opts ...request.Option) (*ImportCertificateOutput, error) { + req, out := c.ImportCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListCertificates = "ListCertificates" @@ -502,8 +578,23 @@ func (c *ACM) ListCertificatesRequest(input *ListCertificatesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/ListCertificates func (c *ACM) ListCertificates(input *ListCertificatesInput) (*ListCertificatesOutput, error) { req, out := c.ListCertificatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListCertificatesWithContext is the same as ListCertificates with the addition of +// the ability to pass a context and additional request options. +// +// See ListCertificates 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 *ACM) ListCertificatesWithContext(ctx aws.Context, input *ListCertificatesInput, opts ...request.Option) (*ListCertificatesOutput, error) { + req, out := c.ListCertificatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListCertificatesPages iterates over the pages of a ListCertificates operation, @@ -523,12 +614,37 @@ func (c *ACM) ListCertificates(input *ListCertificatesInput) (*ListCertificatesO // return pageNum <= 3 // }) // -func (c *ACM) ListCertificatesPages(input *ListCertificatesInput, fn func(p *ListCertificatesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListCertificatesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListCertificatesOutput), lastPage) - }) +func (c *ACM) ListCertificatesPages(input *ListCertificatesInput, fn func(*ListCertificatesOutput, bool) bool) error { + return c.ListCertificatesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListCertificatesPagesWithContext same as ListCertificatesPages 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 *ACM) ListCertificatesPagesWithContext(ctx aws.Context, input *ListCertificatesInput, fn func(*ListCertificatesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListCertificatesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListCertificatesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListCertificatesOutput), !p.HasNextPage()) + } + return p.Err() } const opListTagsForCertificate = "ListTagsForCertificate" @@ -599,8 +715,23 @@ func (c *ACM) ListTagsForCertificateRequest(input *ListTagsForCertificateInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/ListTagsForCertificate func (c *ACM) ListTagsForCertificate(input *ListTagsForCertificateInput) (*ListTagsForCertificateOutput, error) { req, out := c.ListTagsForCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForCertificateWithContext is the same as ListTagsForCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForCertificate 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 *ACM) ListTagsForCertificateWithContext(ctx aws.Context, input *ListTagsForCertificateInput, opts ...request.Option) (*ListTagsForCertificateOutput, error) { + req, out := c.ListTagsForCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromCertificate = "RemoveTagsFromCertificate" @@ -681,8 +812,23 @@ func (c *ACM) RemoveTagsFromCertificateRequest(input *RemoveTagsFromCertificateI // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/RemoveTagsFromCertificate func (c *ACM) RemoveTagsFromCertificate(input *RemoveTagsFromCertificateInput) (*RemoveTagsFromCertificateOutput, error) { req, out := c.RemoveTagsFromCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromCertificateWithContext is the same as RemoveTagsFromCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromCertificate 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 *ACM) RemoveTagsFromCertificateWithContext(ctx aws.Context, input *RemoveTagsFromCertificateInput, opts ...request.Option) (*RemoveTagsFromCertificateOutput, error) { + req, out := c.RemoveTagsFromCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRequestCertificate = "RequestCertificate" @@ -759,8 +905,23 @@ func (c *ACM) RequestCertificateRequest(input *RequestCertificateInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/RequestCertificate func (c *ACM) RequestCertificate(input *RequestCertificateInput) (*RequestCertificateOutput, error) { req, out := c.RequestCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RequestCertificateWithContext is the same as RequestCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See RequestCertificate 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 *ACM) RequestCertificateWithContext(ctx aws.Context, input *RequestCertificateInput, opts ...request.Option) (*RequestCertificateOutput, error) { + req, out := c.RequestCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResendValidationEmail = "ResendValidationEmail" @@ -847,8 +1008,23 @@ func (c *ACM) ResendValidationEmailRequest(input *ResendValidationEmailInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/ResendValidationEmail func (c *ACM) ResendValidationEmail(input *ResendValidationEmailInput) (*ResendValidationEmailOutput, error) { req, out := c.ResendValidationEmailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResendValidationEmailWithContext is the same as ResendValidationEmail with the addition of +// the ability to pass a context and additional request options. +// +// See ResendValidationEmail 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 *ACM) ResendValidationEmailWithContext(ctx aws.Context, input *ResendValidationEmailInput, opts ...request.Option) (*ResendValidationEmailOutput, error) { + req, out := c.ResendValidationEmailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/AddTagsToCertificateRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/acm/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/acm/errors.go index 73093d1c5d..d09bda760b 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/acm/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/acm/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package acm diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/acm/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/acm/service.go index 0c1d69a591..299438ea0f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/acm/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/acm/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package acm diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/api.go index 12775be03b..7d281f77fa 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package apigateway provides a client for Amazon API Gateway. package apigateway @@ -6,6 +6,7 @@ package apigateway import ( "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" @@ -81,8 +82,23 @@ func (c *APIGateway) CreateApiKeyRequest(input *CreateApiKeyInput) (req *request // func (c *APIGateway) CreateApiKey(input *CreateApiKeyInput) (*ApiKey, error) { req, out := c.CreateApiKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateApiKeyWithContext is the same as CreateApiKey with the addition of +// the ability to pass a context and additional request options. +// +// See CreateApiKey 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 *APIGateway) CreateApiKeyWithContext(ctx aws.Context, input *CreateApiKeyInput, opts ...request.Option) (*ApiKey, error) { + req, out := c.CreateApiKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAuthorizer = "CreateAuthorizer" @@ -152,8 +168,23 @@ func (c *APIGateway) CreateAuthorizerRequest(input *CreateAuthorizerInput) (req // func (c *APIGateway) CreateAuthorizer(input *CreateAuthorizerInput) (*Authorizer, error) { req, out := c.CreateAuthorizerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAuthorizerWithContext is the same as CreateAuthorizer with the addition of +// the ability to pass a context and additional request options. +// +// See CreateAuthorizer 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 *APIGateway) CreateAuthorizerWithContext(ctx aws.Context, input *CreateAuthorizerInput, opts ...request.Option) (*Authorizer, error) { + req, out := c.CreateAuthorizerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateBasePathMapping = "CreateBasePathMapping" @@ -221,8 +252,23 @@ func (c *APIGateway) CreateBasePathMappingRequest(input *CreateBasePathMappingIn // func (c *APIGateway) CreateBasePathMapping(input *CreateBasePathMappingInput) (*BasePathMapping, error) { req, out := c.CreateBasePathMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateBasePathMappingWithContext is the same as CreateBasePathMapping with the addition of +// the ability to pass a context and additional request options. +// +// See CreateBasePathMapping 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 *APIGateway) CreateBasePathMappingWithContext(ctx aws.Context, input *CreateBasePathMappingInput, opts ...request.Option) (*BasePathMapping, error) { + req, out := c.CreateBasePathMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDeployment = "CreateDeployment" @@ -295,8 +341,23 @@ func (c *APIGateway) CreateDeploymentRequest(input *CreateDeploymentInput) (req // func (c *APIGateway) CreateDeployment(input *CreateDeploymentInput) (*Deployment, error) { req, out := c.CreateDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDeploymentWithContext is the same as CreateDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDeployment 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 *APIGateway) CreateDeploymentWithContext(ctx aws.Context, input *CreateDeploymentInput, opts ...request.Option) (*Deployment, error) { + req, out := c.CreateDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDocumentationPart = "CreateDocumentationPart" @@ -364,8 +425,23 @@ func (c *APIGateway) CreateDocumentationPartRequest(input *CreateDocumentationPa // func (c *APIGateway) CreateDocumentationPart(input *CreateDocumentationPartInput) (*DocumentationPart, error) { req, out := c.CreateDocumentationPartRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDocumentationPartWithContext is the same as CreateDocumentationPart with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDocumentationPart 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 *APIGateway) CreateDocumentationPartWithContext(ctx aws.Context, input *CreateDocumentationPartInput, opts ...request.Option) (*DocumentationPart, error) { + req, out := c.CreateDocumentationPartRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDocumentationVersion = "CreateDocumentationVersion" @@ -433,8 +509,23 @@ func (c *APIGateway) CreateDocumentationVersionRequest(input *CreateDocumentatio // func (c *APIGateway) CreateDocumentationVersion(input *CreateDocumentationVersionInput) (*DocumentationVersion, error) { req, out := c.CreateDocumentationVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDocumentationVersionWithContext is the same as CreateDocumentationVersion with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDocumentationVersion 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 *APIGateway) CreateDocumentationVersionWithContext(ctx aws.Context, input *CreateDocumentationVersionInput, opts ...request.Option) (*DocumentationVersion, error) { + req, out := c.CreateDocumentationVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDomainName = "CreateDomainName" @@ -500,8 +591,23 @@ func (c *APIGateway) CreateDomainNameRequest(input *CreateDomainNameInput) (req // func (c *APIGateway) CreateDomainName(input *CreateDomainNameInput) (*DomainName, error) { req, out := c.CreateDomainNameRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDomainNameWithContext is the same as CreateDomainName with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDomainName 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 *APIGateway) CreateDomainNameWithContext(ctx aws.Context, input *CreateDomainNameInput, opts ...request.Option) (*DomainName, error) { + req, out := c.CreateDomainNameRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateModel = "CreateModel" @@ -571,8 +677,107 @@ func (c *APIGateway) CreateModelRequest(input *CreateModelInput) (req *request.R // func (c *APIGateway) CreateModel(input *CreateModelInput) (*Model, error) { req, out := c.CreateModelRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateModelWithContext is the same as CreateModel with the addition of +// the ability to pass a context and additional request options. +// +// See CreateModel 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 *APIGateway) CreateModelWithContext(ctx aws.Context, input *CreateModelInput, opts ...request.Option) (*Model, error) { + req, out := c.CreateModelRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateRequestValidator = "CreateRequestValidator" + +// CreateRequestValidatorRequest generates a "aws/request.Request" representing the +// client's request for the CreateRequestValidator operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See CreateRequestValidator for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateRequestValidator method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateRequestValidatorRequest method. +// req, resp := client.CreateRequestValidatorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +func (c *APIGateway) CreateRequestValidatorRequest(input *CreateRequestValidatorInput) (req *request.Request, output *UpdateRequestValidatorOutput) { + op := &request.Operation{ + Name: opCreateRequestValidator, + HTTPMethod: "POST", + HTTPPath: "/restapis/{restapi_id}/requestvalidators", + } + + if input == nil { + input = &CreateRequestValidatorInput{} + } + + output = &UpdateRequestValidatorOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateRequestValidator API operation for Amazon API Gateway. +// +// Creates a ReqeustValidator of a given RestApi. +// +// 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 Amazon API Gateway's +// API operation CreateRequestValidator for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// +// * ErrCodeUnauthorizedException "UnauthorizedException" +// +// * ErrCodeNotFoundException "NotFoundException" +// +// * ErrCodeLimitExceededException "LimitExceededException" +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +func (c *APIGateway) CreateRequestValidator(input *CreateRequestValidatorInput) (*UpdateRequestValidatorOutput, error) { + req, out := c.CreateRequestValidatorRequest(input) + return out, req.Send() +} + +// CreateRequestValidatorWithContext is the same as CreateRequestValidator with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRequestValidator 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 *APIGateway) CreateRequestValidatorWithContext(ctx aws.Context, input *CreateRequestValidatorInput, opts ...request.Option) (*UpdateRequestValidatorOutput, error) { + req, out := c.CreateRequestValidatorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateResource = "CreateResource" @@ -642,8 +847,23 @@ func (c *APIGateway) CreateResourceRequest(input *CreateResourceInput) (req *req // func (c *APIGateway) CreateResource(input *CreateResourceInput) (*Resource, error) { req, out := c.CreateResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateResourceWithContext is the same as CreateResource with the addition of +// the ability to pass a context and additional request options. +// +// See CreateResource 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 *APIGateway) CreateResourceWithContext(ctx aws.Context, input *CreateResourceInput, opts ...request.Option) (*Resource, error) { + req, out := c.CreateResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateRestApi = "CreateRestApi" @@ -709,8 +929,23 @@ func (c *APIGateway) CreateRestApiRequest(input *CreateRestApiInput) (req *reque // func (c *APIGateway) CreateRestApi(input *CreateRestApiInput) (*RestApi, error) { req, out := c.CreateRestApiRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateRestApiWithContext is the same as CreateRestApi with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRestApi 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 *APIGateway) CreateRestApiWithContext(ctx aws.Context, input *CreateRestApiInput, opts ...request.Option) (*RestApi, error) { + req, out := c.CreateRestApiRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateStage = "CreateStage" @@ -781,8 +1016,23 @@ func (c *APIGateway) CreateStageRequest(input *CreateStageInput) (req *request.R // func (c *APIGateway) CreateStage(input *CreateStageInput) (*Stage, error) { req, out := c.CreateStageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateStageWithContext is the same as CreateStage with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStage 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 *APIGateway) CreateStageWithContext(ctx aws.Context, input *CreateStageInput, opts ...request.Option) (*Stage, error) { + req, out := c.CreateStageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateUsagePlan = "CreateUsagePlan" @@ -853,8 +1103,23 @@ func (c *APIGateway) CreateUsagePlanRequest(input *CreateUsagePlanInput) (req *r // func (c *APIGateway) CreateUsagePlan(input *CreateUsagePlanInput) (*UsagePlan, error) { req, out := c.CreateUsagePlanRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateUsagePlanWithContext is the same as CreateUsagePlan with the addition of +// the ability to pass a context and additional request options. +// +// See CreateUsagePlan 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 *APIGateway) CreateUsagePlanWithContext(ctx aws.Context, input *CreateUsagePlanInput, opts ...request.Option) (*UsagePlan, error) { + req, out := c.CreateUsagePlanRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateUsagePlanKey = "CreateUsagePlanKey" @@ -922,8 +1187,23 @@ func (c *APIGateway) CreateUsagePlanKeyRequest(input *CreateUsagePlanKeyInput) ( // func (c *APIGateway) CreateUsagePlanKey(input *CreateUsagePlanKeyInput) (*UsagePlanKey, error) { req, out := c.CreateUsagePlanKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateUsagePlanKeyWithContext is the same as CreateUsagePlanKey with the addition of +// the ability to pass a context and additional request options. +// +// See CreateUsagePlanKey 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 *APIGateway) CreateUsagePlanKeyWithContext(ctx aws.Context, input *CreateUsagePlanKeyInput, opts ...request.Option) (*UsagePlanKey, error) { + req, out := c.CreateUsagePlanKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteApiKey = "DeleteApiKey" @@ -989,8 +1269,23 @@ func (c *APIGateway) DeleteApiKeyRequest(input *DeleteApiKeyInput) (req *request // func (c *APIGateway) DeleteApiKey(input *DeleteApiKeyInput) (*DeleteApiKeyOutput, error) { req, out := c.DeleteApiKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteApiKeyWithContext is the same as DeleteApiKey with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteApiKey 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 *APIGateway) DeleteApiKeyWithContext(ctx aws.Context, input *DeleteApiKeyInput, opts ...request.Option) (*DeleteApiKeyOutput, error) { + req, out := c.DeleteApiKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAuthorizer = "DeleteAuthorizer" @@ -1062,8 +1357,23 @@ func (c *APIGateway) DeleteAuthorizerRequest(input *DeleteAuthorizerInput) (req // func (c *APIGateway) DeleteAuthorizer(input *DeleteAuthorizerInput) (*DeleteAuthorizerOutput, error) { req, out := c.DeleteAuthorizerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAuthorizerWithContext is the same as DeleteAuthorizer with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAuthorizer 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 *APIGateway) DeleteAuthorizerWithContext(ctx aws.Context, input *DeleteAuthorizerInput, opts ...request.Option) (*DeleteAuthorizerOutput, error) { + req, out := c.DeleteAuthorizerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBasePathMapping = "DeleteBasePathMapping" @@ -1129,8 +1439,23 @@ func (c *APIGateway) DeleteBasePathMappingRequest(input *DeleteBasePathMappingIn // func (c *APIGateway) DeleteBasePathMapping(input *DeleteBasePathMappingInput) (*DeleteBasePathMappingOutput, error) { req, out := c.DeleteBasePathMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBasePathMappingWithContext is the same as DeleteBasePathMapping with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBasePathMapping 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 *APIGateway) DeleteBasePathMappingWithContext(ctx aws.Context, input *DeleteBasePathMappingInput, opts ...request.Option) (*DeleteBasePathMappingOutput, error) { + req, out := c.DeleteBasePathMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteClientCertificate = "DeleteClientCertificate" @@ -1198,8 +1523,23 @@ func (c *APIGateway) DeleteClientCertificateRequest(input *DeleteClientCertifica // func (c *APIGateway) DeleteClientCertificate(input *DeleteClientCertificateInput) (*DeleteClientCertificateOutput, error) { req, out := c.DeleteClientCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteClientCertificateWithContext is the same as DeleteClientCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteClientCertificate 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 *APIGateway) DeleteClientCertificateWithContext(ctx aws.Context, input *DeleteClientCertificateInput, opts ...request.Option) (*DeleteClientCertificateOutput, error) { + req, out := c.DeleteClientCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDeployment = "DeleteDeployment" @@ -1268,8 +1608,23 @@ func (c *APIGateway) DeleteDeploymentRequest(input *DeleteDeploymentInput) (req // func (c *APIGateway) DeleteDeployment(input *DeleteDeploymentInput) (*DeleteDeploymentOutput, error) { req, out := c.DeleteDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDeploymentWithContext is the same as DeleteDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeployment 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 *APIGateway) DeleteDeploymentWithContext(ctx aws.Context, input *DeleteDeploymentInput, opts ...request.Option) (*DeleteDeploymentOutput, error) { + req, out := c.DeleteDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDocumentationPart = "DeleteDocumentationPart" @@ -1337,8 +1692,23 @@ func (c *APIGateway) DeleteDocumentationPartRequest(input *DeleteDocumentationPa // func (c *APIGateway) DeleteDocumentationPart(input *DeleteDocumentationPartInput) (*DeleteDocumentationPartOutput, error) { req, out := c.DeleteDocumentationPartRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDocumentationPartWithContext is the same as DeleteDocumentationPart with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDocumentationPart 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 *APIGateway) DeleteDocumentationPartWithContext(ctx aws.Context, input *DeleteDocumentationPartInput, opts ...request.Option) (*DeleteDocumentationPartOutput, error) { + req, out := c.DeleteDocumentationPartRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDocumentationVersion = "DeleteDocumentationVersion" @@ -1406,8 +1776,23 @@ func (c *APIGateway) DeleteDocumentationVersionRequest(input *DeleteDocumentatio // func (c *APIGateway) DeleteDocumentationVersion(input *DeleteDocumentationVersionInput) (*DeleteDocumentationVersionOutput, error) { req, out := c.DeleteDocumentationVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDocumentationVersionWithContext is the same as DeleteDocumentationVersion with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDocumentationVersion 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 *APIGateway) DeleteDocumentationVersionWithContext(ctx aws.Context, input *DeleteDocumentationVersionInput, opts ...request.Option) (*DeleteDocumentationVersionOutput, error) { + req, out := c.DeleteDocumentationVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDomainName = "DeleteDomainName" @@ -1473,8 +1858,23 @@ func (c *APIGateway) DeleteDomainNameRequest(input *DeleteDomainNameInput) (req // func (c *APIGateway) DeleteDomainName(input *DeleteDomainNameInput) (*DeleteDomainNameOutput, error) { req, out := c.DeleteDomainNameRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDomainNameWithContext is the same as DeleteDomainName with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDomainName 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 *APIGateway) DeleteDomainNameWithContext(ctx aws.Context, input *DeleteDomainNameInput, opts ...request.Option) (*DeleteDomainNameOutput, error) { + req, out := c.DeleteDomainNameRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteIntegration = "DeleteIntegration" @@ -1542,8 +1942,23 @@ func (c *APIGateway) DeleteIntegrationRequest(input *DeleteIntegrationInput) (re // func (c *APIGateway) DeleteIntegration(input *DeleteIntegrationInput) (*DeleteIntegrationOutput, error) { req, out := c.DeleteIntegrationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteIntegrationWithContext is the same as DeleteIntegration with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteIntegration 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 *APIGateway) DeleteIntegrationWithContext(ctx aws.Context, input *DeleteIntegrationInput, opts ...request.Option) (*DeleteIntegrationOutput, error) { + req, out := c.DeleteIntegrationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteIntegrationResponse = "DeleteIntegrationResponse" @@ -1613,8 +2028,23 @@ func (c *APIGateway) DeleteIntegrationResponseRequest(input *DeleteIntegrationRe // func (c *APIGateway) DeleteIntegrationResponse(input *DeleteIntegrationResponseInput) (*DeleteIntegrationResponseOutput, error) { req, out := c.DeleteIntegrationResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteIntegrationResponseWithContext is the same as DeleteIntegrationResponse with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteIntegrationResponse 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 *APIGateway) DeleteIntegrationResponseWithContext(ctx aws.Context, input *DeleteIntegrationResponseInput, opts ...request.Option) (*DeleteIntegrationResponseOutput, error) { + req, out := c.DeleteIntegrationResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteMethod = "DeleteMethod" @@ -1682,8 +2112,23 @@ func (c *APIGateway) DeleteMethodRequest(input *DeleteMethodInput) (req *request // func (c *APIGateway) DeleteMethod(input *DeleteMethodInput) (*DeleteMethodOutput, error) { req, out := c.DeleteMethodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteMethodWithContext is the same as DeleteMethod with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMethod 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 *APIGateway) DeleteMethodWithContext(ctx aws.Context, input *DeleteMethodInput, opts ...request.Option) (*DeleteMethodOutput, error) { + req, out := c.DeleteMethodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteMethodResponse = "DeleteMethodResponse" @@ -1753,8 +2198,23 @@ func (c *APIGateway) DeleteMethodResponseRequest(input *DeleteMethodResponseInpu // func (c *APIGateway) DeleteMethodResponse(input *DeleteMethodResponseInput) (*DeleteMethodResponseOutput, error) { req, out := c.DeleteMethodResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteMethodResponseWithContext is the same as DeleteMethodResponse with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMethodResponse 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 *APIGateway) DeleteMethodResponseWithContext(ctx aws.Context, input *DeleteMethodResponseInput, opts ...request.Option) (*DeleteMethodResponseOutput, error) { + req, out := c.DeleteMethodResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteModel = "DeleteModel" @@ -1824,8 +2284,109 @@ func (c *APIGateway) DeleteModelRequest(input *DeleteModelInput) (req *request.R // func (c *APIGateway) DeleteModel(input *DeleteModelInput) (*DeleteModelOutput, error) { req, out := c.DeleteModelRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteModelWithContext is the same as DeleteModel with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteModel 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 *APIGateway) DeleteModelWithContext(ctx aws.Context, input *DeleteModelInput, opts ...request.Option) (*DeleteModelOutput, error) { + req, out := c.DeleteModelRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteRequestValidator = "DeleteRequestValidator" + +// DeleteRequestValidatorRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRequestValidator operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DeleteRequestValidator for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteRequestValidator method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteRequestValidatorRequest method. +// req, resp := client.DeleteRequestValidatorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +func (c *APIGateway) DeleteRequestValidatorRequest(input *DeleteRequestValidatorInput) (req *request.Request, output *DeleteRequestValidatorOutput) { + op := &request.Operation{ + Name: opDeleteRequestValidator, + HTTPMethod: "DELETE", + HTTPPath: "/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}", + } + + if input == nil { + input = &DeleteRequestValidatorInput{} + } + + output = &DeleteRequestValidatorOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteRequestValidator API operation for Amazon API Gateway. +// +// Deletes a RequestValidator of a given RestApi. +// +// 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 Amazon API Gateway's +// API operation DeleteRequestValidator for usage and error information. +// +// Returned Error Codes: +// * ErrCodeUnauthorizedException "UnauthorizedException" +// +// * ErrCodeNotFoundException "NotFoundException" +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +// * ErrCodeBadRequestException "BadRequestException" +// +// * ErrCodeConflictException "ConflictException" +// +func (c *APIGateway) DeleteRequestValidator(input *DeleteRequestValidatorInput) (*DeleteRequestValidatorOutput, error) { + req, out := c.DeleteRequestValidatorRequest(input) + return out, req.Send() +} + +// DeleteRequestValidatorWithContext is the same as DeleteRequestValidator with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRequestValidator 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 *APIGateway) DeleteRequestValidatorWithContext(ctx aws.Context, input *DeleteRequestValidatorInput, opts ...request.Option) (*DeleteRequestValidatorOutput, error) { + req, out := c.DeleteRequestValidatorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteResource = "DeleteResource" @@ -1895,8 +2456,23 @@ func (c *APIGateway) DeleteResourceRequest(input *DeleteResourceInput) (req *req // func (c *APIGateway) DeleteResource(input *DeleteResourceInput) (*DeleteResourceOutput, error) { req, out := c.DeleteResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteResourceWithContext is the same as DeleteResource with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteResource 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 *APIGateway) DeleteResourceWithContext(ctx aws.Context, input *DeleteResourceInput, opts ...request.Option) (*DeleteResourceOutput, error) { + req, out := c.DeleteResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRestApi = "DeleteRestApi" @@ -1964,8 +2540,23 @@ func (c *APIGateway) DeleteRestApiRequest(input *DeleteRestApiInput) (req *reque // func (c *APIGateway) DeleteRestApi(input *DeleteRestApiInput) (*DeleteRestApiOutput, error) { req, out := c.DeleteRestApiRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRestApiWithContext is the same as DeleteRestApi with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRestApi 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 *APIGateway) DeleteRestApiWithContext(ctx aws.Context, input *DeleteRestApiInput, opts ...request.Option) (*DeleteRestApiOutput, error) { + req, out := c.DeleteRestApiRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteStage = "DeleteStage" @@ -2033,8 +2624,23 @@ func (c *APIGateway) DeleteStageRequest(input *DeleteStageInput) (req *request.R // func (c *APIGateway) DeleteStage(input *DeleteStageInput) (*DeleteStageOutput, error) { req, out := c.DeleteStageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteStageWithContext is the same as DeleteStage with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteStage 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 *APIGateway) DeleteStageWithContext(ctx aws.Context, input *DeleteStageInput, opts ...request.Option) (*DeleteStageOutput, error) { + req, out := c.DeleteStageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteUsagePlan = "DeleteUsagePlan" @@ -2102,11 +2708,26 @@ func (c *APIGateway) DeleteUsagePlanRequest(input *DeleteUsagePlanInput) (req *r // func (c *APIGateway) DeleteUsagePlan(input *DeleteUsagePlanInput) (*DeleteUsagePlanOutput, error) { req, out := c.DeleteUsagePlanRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opDeleteUsagePlanKey = "DeleteUsagePlanKey" +// DeleteUsagePlanWithContext is the same as DeleteUsagePlan with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteUsagePlan 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 *APIGateway) DeleteUsagePlanWithContext(ctx aws.Context, input *DeleteUsagePlanInput, opts ...request.Option) (*DeleteUsagePlanOutput, error) { + req, out := c.DeleteUsagePlanRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteUsagePlanKey = "DeleteUsagePlanKey" // DeleteUsagePlanKeyRequest generates a "aws/request.Request" representing the // client's request for the DeleteUsagePlanKey operation. The "output" return @@ -2174,8 +2795,23 @@ func (c *APIGateway) DeleteUsagePlanKeyRequest(input *DeleteUsagePlanKeyInput) ( // func (c *APIGateway) DeleteUsagePlanKey(input *DeleteUsagePlanKeyInput) (*DeleteUsagePlanKeyOutput, error) { req, out := c.DeleteUsagePlanKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteUsagePlanKeyWithContext is the same as DeleteUsagePlanKey with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteUsagePlanKey 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 *APIGateway) DeleteUsagePlanKeyWithContext(ctx aws.Context, input *DeleteUsagePlanKeyInput, opts ...request.Option) (*DeleteUsagePlanKeyOutput, error) { + req, out := c.DeleteUsagePlanKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opFlushStageAuthorizersCache = "FlushStageAuthorizersCache" @@ -2243,8 +2879,23 @@ func (c *APIGateway) FlushStageAuthorizersCacheRequest(input *FlushStageAuthoriz // func (c *APIGateway) FlushStageAuthorizersCache(input *FlushStageAuthorizersCacheInput) (*FlushStageAuthorizersCacheOutput, error) { req, out := c.FlushStageAuthorizersCacheRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// FlushStageAuthorizersCacheWithContext is the same as FlushStageAuthorizersCache with the addition of +// the ability to pass a context and additional request options. +// +// See FlushStageAuthorizersCache 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 *APIGateway) FlushStageAuthorizersCacheWithContext(ctx aws.Context, input *FlushStageAuthorizersCacheInput, opts ...request.Option) (*FlushStageAuthorizersCacheOutput, error) { + req, out := c.FlushStageAuthorizersCacheRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opFlushStageCache = "FlushStageCache" @@ -2312,8 +2963,23 @@ func (c *APIGateway) FlushStageCacheRequest(input *FlushStageCacheInput) (req *r // func (c *APIGateway) FlushStageCache(input *FlushStageCacheInput) (*FlushStageCacheOutput, error) { req, out := c.FlushStageCacheRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// FlushStageCacheWithContext is the same as FlushStageCache with the addition of +// the ability to pass a context and additional request options. +// +// See FlushStageCache 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 *APIGateway) FlushStageCacheWithContext(ctx aws.Context, input *FlushStageCacheInput, opts ...request.Option) (*FlushStageCacheOutput, error) { + req, out := c.FlushStageCacheRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGenerateClientCertificate = "GenerateClientCertificate" @@ -2377,8 +3043,23 @@ func (c *APIGateway) GenerateClientCertificateRequest(input *GenerateClientCerti // func (c *APIGateway) GenerateClientCertificate(input *GenerateClientCertificateInput) (*ClientCertificate, error) { req, out := c.GenerateClientCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GenerateClientCertificateWithContext is the same as GenerateClientCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See GenerateClientCertificate 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 *APIGateway) GenerateClientCertificateWithContext(ctx aws.Context, input *GenerateClientCertificateInput, opts ...request.Option) (*ClientCertificate, error) { + req, out := c.GenerateClientCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAccount = "GetAccount" @@ -2442,8 +3123,23 @@ func (c *APIGateway) GetAccountRequest(input *GetAccountInput) (req *request.Req // func (c *APIGateway) GetAccount(input *GetAccountInput) (*Account, error) { req, out := c.GetAccountRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAccountWithContext is the same as GetAccount with the addition of +// the ability to pass a context and additional request options. +// +// See GetAccount 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 *APIGateway) GetAccountWithContext(ctx aws.Context, input *GetAccountInput, opts ...request.Option) (*Account, error) { + req, out := c.GetAccountRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetApiKey = "GetApiKey" @@ -2507,8 +3203,23 @@ func (c *APIGateway) GetApiKeyRequest(input *GetApiKeyInput) (req *request.Reque // func (c *APIGateway) GetApiKey(input *GetApiKeyInput) (*ApiKey, error) { req, out := c.GetApiKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetApiKeyWithContext is the same as GetApiKey with the addition of +// the ability to pass a context and additional request options. +// +// See GetApiKey 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 *APIGateway) GetApiKeyWithContext(ctx aws.Context, input *GetApiKeyInput, opts ...request.Option) (*ApiKey, error) { + req, out := c.GetApiKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetApiKeys = "GetApiKeys" @@ -2578,8 +3289,23 @@ func (c *APIGateway) GetApiKeysRequest(input *GetApiKeysInput) (req *request.Req // func (c *APIGateway) GetApiKeys(input *GetApiKeysInput) (*GetApiKeysOutput, error) { req, out := c.GetApiKeysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetApiKeysWithContext is the same as GetApiKeys with the addition of +// the ability to pass a context and additional request options. +// +// See GetApiKeys 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 *APIGateway) GetApiKeysWithContext(ctx aws.Context, input *GetApiKeysInput, opts ...request.Option) (*GetApiKeysOutput, error) { + req, out := c.GetApiKeysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetApiKeysPages iterates over the pages of a GetApiKeys operation, @@ -2599,12 +3325,37 @@ func (c *APIGateway) GetApiKeys(input *GetApiKeysInput) (*GetApiKeysOutput, erro // return pageNum <= 3 // }) // -func (c *APIGateway) GetApiKeysPages(input *GetApiKeysInput, fn func(p *GetApiKeysOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetApiKeysRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetApiKeysOutput), lastPage) - }) +func (c *APIGateway) GetApiKeysPages(input *GetApiKeysInput, fn func(*GetApiKeysOutput, bool) bool) error { + return c.GetApiKeysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetApiKeysPagesWithContext same as GetApiKeysPages 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 *APIGateway) GetApiKeysPagesWithContext(ctx aws.Context, input *GetApiKeysInput, fn func(*GetApiKeysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetApiKeysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetApiKeysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetApiKeysOutput), !p.HasNextPage()) + } + return p.Err() } const opGetAuthorizer = "GetAuthorizer" @@ -2670,8 +3421,23 @@ func (c *APIGateway) GetAuthorizerRequest(input *GetAuthorizerInput) (req *reque // func (c *APIGateway) GetAuthorizer(input *GetAuthorizerInput) (*Authorizer, error) { req, out := c.GetAuthorizerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAuthorizerWithContext is the same as GetAuthorizer with the addition of +// the ability to pass a context and additional request options. +// +// See GetAuthorizer 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 *APIGateway) GetAuthorizerWithContext(ctx aws.Context, input *GetAuthorizerInput, opts ...request.Option) (*Authorizer, error) { + req, out := c.GetAuthorizerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAuthorizers = "GetAuthorizers" @@ -2739,8 +3505,23 @@ func (c *APIGateway) GetAuthorizersRequest(input *GetAuthorizersInput) (req *req // func (c *APIGateway) GetAuthorizers(input *GetAuthorizersInput) (*GetAuthorizersOutput, error) { req, out := c.GetAuthorizersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAuthorizersWithContext is the same as GetAuthorizers with the addition of +// the ability to pass a context and additional request options. +// +// See GetAuthorizers 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 *APIGateway) GetAuthorizersWithContext(ctx aws.Context, input *GetAuthorizersInput, opts ...request.Option) (*GetAuthorizersOutput, error) { + req, out := c.GetAuthorizersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBasePathMapping = "GetBasePathMapping" @@ -2804,8 +3585,23 @@ func (c *APIGateway) GetBasePathMappingRequest(input *GetBasePathMappingInput) ( // func (c *APIGateway) GetBasePathMapping(input *GetBasePathMappingInput) (*BasePathMapping, error) { req, out := c.GetBasePathMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBasePathMappingWithContext is the same as GetBasePathMapping with the addition of +// the ability to pass a context and additional request options. +// +// See GetBasePathMapping 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 *APIGateway) GetBasePathMappingWithContext(ctx aws.Context, input *GetBasePathMappingInput, opts ...request.Option) (*BasePathMapping, error) { + req, out := c.GetBasePathMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBasePathMappings = "GetBasePathMappings" @@ -2875,8 +3671,23 @@ func (c *APIGateway) GetBasePathMappingsRequest(input *GetBasePathMappingsInput) // func (c *APIGateway) GetBasePathMappings(input *GetBasePathMappingsInput) (*GetBasePathMappingsOutput, error) { req, out := c.GetBasePathMappingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBasePathMappingsWithContext is the same as GetBasePathMappings with the addition of +// the ability to pass a context and additional request options. +// +// See GetBasePathMappings 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 *APIGateway) GetBasePathMappingsWithContext(ctx aws.Context, input *GetBasePathMappingsInput, opts ...request.Option) (*GetBasePathMappingsOutput, error) { + req, out := c.GetBasePathMappingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetBasePathMappingsPages iterates over the pages of a GetBasePathMappings operation, @@ -2896,12 +3707,37 @@ func (c *APIGateway) GetBasePathMappings(input *GetBasePathMappingsInput) (*GetB // return pageNum <= 3 // }) // -func (c *APIGateway) GetBasePathMappingsPages(input *GetBasePathMappingsInput, fn func(p *GetBasePathMappingsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetBasePathMappingsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetBasePathMappingsOutput), lastPage) - }) +func (c *APIGateway) GetBasePathMappingsPages(input *GetBasePathMappingsInput, fn func(*GetBasePathMappingsOutput, bool) bool) error { + return c.GetBasePathMappingsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetBasePathMappingsPagesWithContext same as GetBasePathMappingsPages 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 *APIGateway) GetBasePathMappingsPagesWithContext(ctx aws.Context, input *GetBasePathMappingsInput, fn func(*GetBasePathMappingsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetBasePathMappingsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetBasePathMappingsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetBasePathMappingsOutput), !p.HasNextPage()) + } + return p.Err() } const opGetClientCertificate = "GetClientCertificate" @@ -2965,8 +3801,23 @@ func (c *APIGateway) GetClientCertificateRequest(input *GetClientCertificateInpu // func (c *APIGateway) GetClientCertificate(input *GetClientCertificateInput) (*ClientCertificate, error) { req, out := c.GetClientCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetClientCertificateWithContext is the same as GetClientCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See GetClientCertificate 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 *APIGateway) GetClientCertificateWithContext(ctx aws.Context, input *GetClientCertificateInput, opts ...request.Option) (*ClientCertificate, error) { + req, out := c.GetClientCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetClientCertificates = "GetClientCertificates" @@ -3036,8 +3887,23 @@ func (c *APIGateway) GetClientCertificatesRequest(input *GetClientCertificatesIn // func (c *APIGateway) GetClientCertificates(input *GetClientCertificatesInput) (*GetClientCertificatesOutput, error) { req, out := c.GetClientCertificatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetClientCertificatesWithContext is the same as GetClientCertificates with the addition of +// the ability to pass a context and additional request options. +// +// See GetClientCertificates 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 *APIGateway) GetClientCertificatesWithContext(ctx aws.Context, input *GetClientCertificatesInput, opts ...request.Option) (*GetClientCertificatesOutput, error) { + req, out := c.GetClientCertificatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetClientCertificatesPages iterates over the pages of a GetClientCertificates operation, @@ -3057,12 +3923,37 @@ func (c *APIGateway) GetClientCertificates(input *GetClientCertificatesInput) (* // return pageNum <= 3 // }) // -func (c *APIGateway) GetClientCertificatesPages(input *GetClientCertificatesInput, fn func(p *GetClientCertificatesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetClientCertificatesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetClientCertificatesOutput), lastPage) - }) +func (c *APIGateway) GetClientCertificatesPages(input *GetClientCertificatesInput, fn func(*GetClientCertificatesOutput, bool) bool) error { + return c.GetClientCertificatesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetClientCertificatesPagesWithContext same as GetClientCertificatesPages 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 *APIGateway) GetClientCertificatesPagesWithContext(ctx aws.Context, input *GetClientCertificatesInput, fn func(*GetClientCertificatesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetClientCertificatesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetClientCertificatesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetClientCertificatesOutput), !p.HasNextPage()) + } + return p.Err() } const opGetDeployment = "GetDeployment" @@ -3128,8 +4019,23 @@ func (c *APIGateway) GetDeploymentRequest(input *GetDeploymentInput) (req *reque // func (c *APIGateway) GetDeployment(input *GetDeploymentInput) (*Deployment, error) { req, out := c.GetDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDeploymentWithContext is the same as GetDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeployment 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 *APIGateway) GetDeploymentWithContext(ctx aws.Context, input *GetDeploymentInput, opts ...request.Option) (*Deployment, error) { + req, out := c.GetDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDeployments = "GetDeployments" @@ -3201,8 +4107,23 @@ func (c *APIGateway) GetDeploymentsRequest(input *GetDeploymentsInput) (req *req // func (c *APIGateway) GetDeployments(input *GetDeploymentsInput) (*GetDeploymentsOutput, error) { req, out := c.GetDeploymentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDeploymentsWithContext is the same as GetDeployments with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeployments 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 *APIGateway) GetDeploymentsWithContext(ctx aws.Context, input *GetDeploymentsInput, opts ...request.Option) (*GetDeploymentsOutput, error) { + req, out := c.GetDeploymentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetDeploymentsPages iterates over the pages of a GetDeployments operation, @@ -3222,12 +4143,37 @@ func (c *APIGateway) GetDeployments(input *GetDeploymentsInput) (*GetDeployments // return pageNum <= 3 // }) // -func (c *APIGateway) GetDeploymentsPages(input *GetDeploymentsInput, fn func(p *GetDeploymentsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetDeploymentsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetDeploymentsOutput), lastPage) - }) +func (c *APIGateway) GetDeploymentsPages(input *GetDeploymentsInput, fn func(*GetDeploymentsOutput, bool) bool) error { + return c.GetDeploymentsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetDeploymentsPagesWithContext same as GetDeploymentsPages 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 *APIGateway) GetDeploymentsPagesWithContext(ctx aws.Context, input *GetDeploymentsInput, fn func(*GetDeploymentsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetDeploymentsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetDeploymentsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetDeploymentsOutput), !p.HasNextPage()) + } + return p.Err() } const opGetDocumentationPart = "GetDocumentationPart" @@ -3289,8 +4235,23 @@ func (c *APIGateway) GetDocumentationPartRequest(input *GetDocumentationPartInpu // func (c *APIGateway) GetDocumentationPart(input *GetDocumentationPartInput) (*DocumentationPart, error) { req, out := c.GetDocumentationPartRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDocumentationPartWithContext is the same as GetDocumentationPart with the addition of +// the ability to pass a context and additional request options. +// +// See GetDocumentationPart 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 *APIGateway) GetDocumentationPartWithContext(ctx aws.Context, input *GetDocumentationPartInput, opts ...request.Option) (*DocumentationPart, error) { + req, out := c.GetDocumentationPartRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDocumentationParts = "GetDocumentationParts" @@ -3354,8 +4315,23 @@ func (c *APIGateway) GetDocumentationPartsRequest(input *GetDocumentationPartsIn // func (c *APIGateway) GetDocumentationParts(input *GetDocumentationPartsInput) (*GetDocumentationPartsOutput, error) { req, out := c.GetDocumentationPartsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDocumentationPartsWithContext is the same as GetDocumentationParts with the addition of +// the ability to pass a context and additional request options. +// +// See GetDocumentationParts 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 *APIGateway) GetDocumentationPartsWithContext(ctx aws.Context, input *GetDocumentationPartsInput, opts ...request.Option) (*GetDocumentationPartsOutput, error) { + req, out := c.GetDocumentationPartsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDocumentationVersion = "GetDocumentationVersion" @@ -3417,8 +4393,23 @@ func (c *APIGateway) GetDocumentationVersionRequest(input *GetDocumentationVersi // func (c *APIGateway) GetDocumentationVersion(input *GetDocumentationVersionInput) (*DocumentationVersion, error) { req, out := c.GetDocumentationVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDocumentationVersionWithContext is the same as GetDocumentationVersion with the addition of +// the ability to pass a context and additional request options. +// +// See GetDocumentationVersion 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 *APIGateway) GetDocumentationVersionWithContext(ctx aws.Context, input *GetDocumentationVersionInput, opts ...request.Option) (*DocumentationVersion, error) { + req, out := c.GetDocumentationVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDocumentationVersions = "GetDocumentationVersions" @@ -3482,8 +4473,23 @@ func (c *APIGateway) GetDocumentationVersionsRequest(input *GetDocumentationVers // func (c *APIGateway) GetDocumentationVersions(input *GetDocumentationVersionsInput) (*GetDocumentationVersionsOutput, error) { req, out := c.GetDocumentationVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDocumentationVersionsWithContext is the same as GetDocumentationVersions with the addition of +// the ability to pass a context and additional request options. +// +// See GetDocumentationVersions 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 *APIGateway) GetDocumentationVersionsWithContext(ctx aws.Context, input *GetDocumentationVersionsInput, opts ...request.Option) (*GetDocumentationVersionsOutput, error) { + req, out := c.GetDocumentationVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDomainName = "GetDomainName" @@ -3550,8 +4556,23 @@ func (c *APIGateway) GetDomainNameRequest(input *GetDomainNameInput) (req *reque // func (c *APIGateway) GetDomainName(input *GetDomainNameInput) (*DomainName, error) { req, out := c.GetDomainNameRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDomainNameWithContext is the same as GetDomainName with the addition of +// the ability to pass a context and additional request options. +// +// See GetDomainName 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 *APIGateway) GetDomainNameWithContext(ctx aws.Context, input *GetDomainNameInput, opts ...request.Option) (*DomainName, error) { + req, out := c.GetDomainNameRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDomainNames = "GetDomainNames" @@ -3621,8 +4642,23 @@ func (c *APIGateway) GetDomainNamesRequest(input *GetDomainNamesInput) (req *req // func (c *APIGateway) GetDomainNames(input *GetDomainNamesInput) (*GetDomainNamesOutput, error) { req, out := c.GetDomainNamesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDomainNamesWithContext is the same as GetDomainNames with the addition of +// the ability to pass a context and additional request options. +// +// See GetDomainNames 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 *APIGateway) GetDomainNamesWithContext(ctx aws.Context, input *GetDomainNamesInput, opts ...request.Option) (*GetDomainNamesOutput, error) { + req, out := c.GetDomainNamesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetDomainNamesPages iterates over the pages of a GetDomainNames operation, @@ -3642,12 +4678,37 @@ func (c *APIGateway) GetDomainNames(input *GetDomainNamesInput) (*GetDomainNames // return pageNum <= 3 // }) // -func (c *APIGateway) GetDomainNamesPages(input *GetDomainNamesInput, fn func(p *GetDomainNamesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetDomainNamesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetDomainNamesOutput), lastPage) - }) +func (c *APIGateway) GetDomainNamesPages(input *GetDomainNamesInput, fn func(*GetDomainNamesOutput, bool) bool) error { + return c.GetDomainNamesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetDomainNamesPagesWithContext same as GetDomainNamesPages 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 *APIGateway) GetDomainNamesPagesWithContext(ctx aws.Context, input *GetDomainNamesInput, fn func(*GetDomainNamesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetDomainNamesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetDomainNamesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetDomainNamesOutput), !p.HasNextPage()) + } + return p.Err() } const opGetExport = "GetExport" @@ -3713,8 +4774,23 @@ func (c *APIGateway) GetExportRequest(input *GetExportInput) (req *request.Reque // func (c *APIGateway) GetExport(input *GetExportInput) (*GetExportOutput, error) { req, out := c.GetExportRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetExportWithContext is the same as GetExport with the addition of +// the ability to pass a context and additional request options. +// +// See GetExport 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 *APIGateway) GetExportWithContext(ctx aws.Context, input *GetExportInput, opts ...request.Option) (*GetExportOutput, error) { + req, out := c.GetExportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIntegration = "GetIntegration" @@ -3778,8 +4854,23 @@ func (c *APIGateway) GetIntegrationRequest(input *GetIntegrationInput) (req *req // func (c *APIGateway) GetIntegration(input *GetIntegrationInput) (*Integration, error) { req, out := c.GetIntegrationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIntegrationWithContext is the same as GetIntegration with the addition of +// the ability to pass a context and additional request options. +// +// See GetIntegration 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 *APIGateway) GetIntegrationWithContext(ctx aws.Context, input *GetIntegrationInput, opts ...request.Option) (*Integration, error) { + req, out := c.GetIntegrationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIntegrationResponse = "GetIntegrationResponse" @@ -3843,8 +4934,23 @@ func (c *APIGateway) GetIntegrationResponseRequest(input *GetIntegrationResponse // func (c *APIGateway) GetIntegrationResponse(input *GetIntegrationResponseInput) (*IntegrationResponse, error) { req, out := c.GetIntegrationResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIntegrationResponseWithContext is the same as GetIntegrationResponse with the addition of +// the ability to pass a context and additional request options. +// +// See GetIntegrationResponse 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 *APIGateway) GetIntegrationResponseWithContext(ctx aws.Context, input *GetIntegrationResponseInput, opts ...request.Option) (*IntegrationResponse, error) { + req, out := c.GetIntegrationResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetMethod = "GetMethod" @@ -3908,8 +5014,23 @@ func (c *APIGateway) GetMethodRequest(input *GetMethodInput) (req *request.Reque // func (c *APIGateway) GetMethod(input *GetMethodInput) (*Method, error) { req, out := c.GetMethodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetMethodWithContext is the same as GetMethod with the addition of +// the ability to pass a context and additional request options. +// +// See GetMethod 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 *APIGateway) GetMethodWithContext(ctx aws.Context, input *GetMethodInput, opts ...request.Option) (*Method, error) { + req, out := c.GetMethodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetMethodResponse = "GetMethodResponse" @@ -3973,8 +5094,23 @@ func (c *APIGateway) GetMethodResponseRequest(input *GetMethodResponseInput) (re // func (c *APIGateway) GetMethodResponse(input *GetMethodResponseInput) (*MethodResponse, error) { req, out := c.GetMethodResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetMethodResponseWithContext is the same as GetMethodResponse with the addition of +// the ability to pass a context and additional request options. +// +// See GetMethodResponse 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 *APIGateway) GetMethodResponseWithContext(ctx aws.Context, input *GetMethodResponseInput, opts ...request.Option) (*MethodResponse, error) { + req, out := c.GetMethodResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetModel = "GetModel" @@ -4038,8 +5174,23 @@ func (c *APIGateway) GetModelRequest(input *GetModelInput) (req *request.Request // func (c *APIGateway) GetModel(input *GetModelInput) (*Model, error) { req, out := c.GetModelRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetModelWithContext is the same as GetModel with the addition of +// the ability to pass a context and additional request options. +// +// See GetModel 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 *APIGateway) GetModelWithContext(ctx aws.Context, input *GetModelInput, opts ...request.Option) (*Model, error) { + req, out := c.GetModelRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetModelTemplate = "GetModelTemplate" @@ -4106,8 +5257,23 @@ func (c *APIGateway) GetModelTemplateRequest(input *GetModelTemplateInput) (req // func (c *APIGateway) GetModelTemplate(input *GetModelTemplateInput) (*GetModelTemplateOutput, error) { req, out := c.GetModelTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetModelTemplateWithContext is the same as GetModelTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See GetModelTemplate 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 *APIGateway) GetModelTemplateWithContext(ctx aws.Context, input *GetModelTemplateInput, opts ...request.Option) (*GetModelTemplateOutput, error) { + req, out := c.GetModelTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetModels = "GetModels" @@ -4179,8 +5345,23 @@ func (c *APIGateway) GetModelsRequest(input *GetModelsInput) (req *request.Reque // func (c *APIGateway) GetModels(input *GetModelsInput) (*GetModelsOutput, error) { req, out := c.GetModelsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetModelsWithContext is the same as GetModels with the addition of +// the ability to pass a context and additional request options. +// +// See GetModels 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 *APIGateway) GetModelsWithContext(ctx aws.Context, input *GetModelsInput, opts ...request.Option) (*GetModelsOutput, error) { + req, out := c.GetModelsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetModelsPages iterates over the pages of a GetModels operation, @@ -4200,12 +5381,199 @@ func (c *APIGateway) GetModels(input *GetModelsInput) (*GetModelsOutput, error) // return pageNum <= 3 // }) // -func (c *APIGateway) GetModelsPages(input *GetModelsInput, fn func(p *GetModelsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetModelsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetModelsOutput), lastPage) - }) +func (c *APIGateway) GetModelsPages(input *GetModelsInput, fn func(*GetModelsOutput, bool) bool) error { + return c.GetModelsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetModelsPagesWithContext same as GetModelsPages 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 *APIGateway) GetModelsPagesWithContext(ctx aws.Context, input *GetModelsInput, fn func(*GetModelsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetModelsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetModelsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetModelsOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opGetRequestValidator = "GetRequestValidator" + +// GetRequestValidatorRequest generates a "aws/request.Request" representing the +// client's request for the GetRequestValidator operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetRequestValidator for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetRequestValidator method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetRequestValidatorRequest method. +// req, resp := client.GetRequestValidatorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +func (c *APIGateway) GetRequestValidatorRequest(input *GetRequestValidatorInput) (req *request.Request, output *UpdateRequestValidatorOutput) { + op := &request.Operation{ + Name: opGetRequestValidator, + HTTPMethod: "GET", + HTTPPath: "/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}", + } + + if input == nil { + input = &GetRequestValidatorInput{} + } + + output = &UpdateRequestValidatorOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRequestValidator API operation for Amazon API Gateway. +// +// Gets a RequestValidator of a given RestApi. +// +// 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 Amazon API Gateway's +// API operation GetRequestValidator for usage and error information. +// +// Returned Error Codes: +// * ErrCodeUnauthorizedException "UnauthorizedException" +// +// * ErrCodeNotFoundException "NotFoundException" +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +func (c *APIGateway) GetRequestValidator(input *GetRequestValidatorInput) (*UpdateRequestValidatorOutput, error) { + req, out := c.GetRequestValidatorRequest(input) + return out, req.Send() +} + +// GetRequestValidatorWithContext is the same as GetRequestValidator with the addition of +// the ability to pass a context and additional request options. +// +// See GetRequestValidator 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 *APIGateway) GetRequestValidatorWithContext(ctx aws.Context, input *GetRequestValidatorInput, opts ...request.Option) (*UpdateRequestValidatorOutput, error) { + req, out := c.GetRequestValidatorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRequestValidators = "GetRequestValidators" + +// GetRequestValidatorsRequest generates a "aws/request.Request" representing the +// client's request for the GetRequestValidators operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetRequestValidators for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetRequestValidators method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetRequestValidatorsRequest method. +// req, resp := client.GetRequestValidatorsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +func (c *APIGateway) GetRequestValidatorsRequest(input *GetRequestValidatorsInput) (req *request.Request, output *GetRequestValidatorsOutput) { + op := &request.Operation{ + Name: opGetRequestValidators, + HTTPMethod: "GET", + HTTPPath: "/restapis/{restapi_id}/requestvalidators", + } + + if input == nil { + input = &GetRequestValidatorsInput{} + } + + output = &GetRequestValidatorsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRequestValidators API operation for Amazon API Gateway. +// +// Gets the RequestValidators collection of a given RestApi. +// +// 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 Amazon API Gateway's +// API operation GetRequestValidators for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// +// * ErrCodeUnauthorizedException "UnauthorizedException" +// +// * ErrCodeNotFoundException "NotFoundException" +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +func (c *APIGateway) GetRequestValidators(input *GetRequestValidatorsInput) (*GetRequestValidatorsOutput, error) { + req, out := c.GetRequestValidatorsRequest(input) + return out, req.Send() +} + +// GetRequestValidatorsWithContext is the same as GetRequestValidators with the addition of +// the ability to pass a context and additional request options. +// +// See GetRequestValidators 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 *APIGateway) GetRequestValidatorsWithContext(ctx aws.Context, input *GetRequestValidatorsInput, opts ...request.Option) (*GetRequestValidatorsOutput, error) { + req, out := c.GetRequestValidatorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetResource = "GetResource" @@ -4269,8 +5637,23 @@ func (c *APIGateway) GetResourceRequest(input *GetResourceInput) (req *request.R // func (c *APIGateway) GetResource(input *GetResourceInput) (*Resource, error) { req, out := c.GetResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetResourceWithContext is the same as GetResource with the addition of +// the ability to pass a context and additional request options. +// +// See GetResource 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 *APIGateway) GetResourceWithContext(ctx aws.Context, input *GetResourceInput, opts ...request.Option) (*Resource, error) { + req, out := c.GetResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetResources = "GetResources" @@ -4342,8 +5725,23 @@ func (c *APIGateway) GetResourcesRequest(input *GetResourcesInput) (req *request // func (c *APIGateway) GetResources(input *GetResourcesInput) (*GetResourcesOutput, error) { req, out := c.GetResourcesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetResourcesWithContext is the same as GetResources with the addition of +// the ability to pass a context and additional request options. +// +// See GetResources 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 *APIGateway) GetResourcesWithContext(ctx aws.Context, input *GetResourcesInput, opts ...request.Option) (*GetResourcesOutput, error) { + req, out := c.GetResourcesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetResourcesPages iterates over the pages of a GetResources operation, @@ -4363,12 +5761,37 @@ func (c *APIGateway) GetResources(input *GetResourcesInput) (*GetResourcesOutput // return pageNum <= 3 // }) // -func (c *APIGateway) GetResourcesPages(input *GetResourcesInput, fn func(p *GetResourcesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetResourcesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetResourcesOutput), lastPage) - }) +func (c *APIGateway) GetResourcesPages(input *GetResourcesInput, fn func(*GetResourcesOutput, bool) bool) error { + return c.GetResourcesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetResourcesPagesWithContext same as GetResourcesPages 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 *APIGateway) GetResourcesPagesWithContext(ctx aws.Context, input *GetResourcesInput, fn func(*GetResourcesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetResourcesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetResourcesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetResourcesOutput), !p.HasNextPage()) + } + return p.Err() } const opGetRestApi = "GetRestApi" @@ -4432,8 +5855,23 @@ func (c *APIGateway) GetRestApiRequest(input *GetRestApiInput) (req *request.Req // func (c *APIGateway) GetRestApi(input *GetRestApiInput) (*RestApi, error) { req, out := c.GetRestApiRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRestApiWithContext is the same as GetRestApi with the addition of +// the ability to pass a context and additional request options. +// +// See GetRestApi 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 *APIGateway) GetRestApiWithContext(ctx aws.Context, input *GetRestApiInput, opts ...request.Option) (*RestApi, error) { + req, out := c.GetRestApiRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRestApis = "GetRestApis" @@ -4503,8 +5941,23 @@ func (c *APIGateway) GetRestApisRequest(input *GetRestApisInput) (req *request.R // func (c *APIGateway) GetRestApis(input *GetRestApisInput) (*GetRestApisOutput, error) { req, out := c.GetRestApisRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRestApisWithContext is the same as GetRestApis with the addition of +// the ability to pass a context and additional request options. +// +// See GetRestApis 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 *APIGateway) GetRestApisWithContext(ctx aws.Context, input *GetRestApisInput, opts ...request.Option) (*GetRestApisOutput, error) { + req, out := c.GetRestApisRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetRestApisPages iterates over the pages of a GetRestApis operation, @@ -4524,12 +5977,37 @@ func (c *APIGateway) GetRestApis(input *GetRestApisInput) (*GetRestApisOutput, e // return pageNum <= 3 // }) // -func (c *APIGateway) GetRestApisPages(input *GetRestApisInput, fn func(p *GetRestApisOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetRestApisRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetRestApisOutput), lastPage) - }) +func (c *APIGateway) GetRestApisPages(input *GetRestApisInput, fn func(*GetRestApisOutput, bool) bool) error { + return c.GetRestApisPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetRestApisPagesWithContext same as GetRestApisPages 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 *APIGateway) GetRestApisPagesWithContext(ctx aws.Context, input *GetRestApisInput, fn func(*GetRestApisOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetRestApisInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetRestApisRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetRestApisOutput), !p.HasNextPage()) + } + return p.Err() } const opGetSdk = "GetSdk" @@ -4595,8 +6073,23 @@ func (c *APIGateway) GetSdkRequest(input *GetSdkInput) (req *request.Request, ou // func (c *APIGateway) GetSdk(input *GetSdkInput) (*GetSdkOutput, error) { req, out := c.GetSdkRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSdkWithContext is the same as GetSdk with the addition of +// the ability to pass a context and additional request options. +// +// See GetSdk 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 *APIGateway) GetSdkWithContext(ctx aws.Context, input *GetSdkInput, opts ...request.Option) (*GetSdkOutput, error) { + req, out := c.GetSdkRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSdkType = "GetSdkType" @@ -4658,8 +6151,23 @@ func (c *APIGateway) GetSdkTypeRequest(input *GetSdkTypeInput) (req *request.Req // func (c *APIGateway) GetSdkType(input *GetSdkTypeInput) (*SdkType, error) { req, out := c.GetSdkTypeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSdkTypeWithContext is the same as GetSdkType with the addition of +// the ability to pass a context and additional request options. +// +// See GetSdkType 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 *APIGateway) GetSdkTypeWithContext(ctx aws.Context, input *GetSdkTypeInput, opts ...request.Option) (*SdkType, error) { + req, out := c.GetSdkTypeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSdkTypes = "GetSdkTypes" @@ -4719,8 +6227,23 @@ func (c *APIGateway) GetSdkTypesRequest(input *GetSdkTypesInput) (req *request.R // func (c *APIGateway) GetSdkTypes(input *GetSdkTypesInput) (*GetSdkTypesOutput, error) { req, out := c.GetSdkTypesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSdkTypesWithContext is the same as GetSdkTypes with the addition of +// the ability to pass a context and additional request options. +// +// See GetSdkTypes 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 *APIGateway) GetSdkTypesWithContext(ctx aws.Context, input *GetSdkTypesInput, opts ...request.Option) (*GetSdkTypesOutput, error) { + req, out := c.GetSdkTypesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetStage = "GetStage" @@ -4784,8 +6307,23 @@ func (c *APIGateway) GetStageRequest(input *GetStageInput) (req *request.Request // func (c *APIGateway) GetStage(input *GetStageInput) (*Stage, error) { req, out := c.GetStageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetStageWithContext is the same as GetStage with the addition of +// the ability to pass a context and additional request options. +// +// See GetStage 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 *APIGateway) GetStageWithContext(ctx aws.Context, input *GetStageInput, opts ...request.Option) (*Stage, error) { + req, out := c.GetStageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetStages = "GetStages" @@ -4849,8 +6387,23 @@ func (c *APIGateway) GetStagesRequest(input *GetStagesInput) (req *request.Reque // func (c *APIGateway) GetStages(input *GetStagesInput) (*GetStagesOutput, error) { req, out := c.GetStagesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetStagesWithContext is the same as GetStages with the addition of +// the ability to pass a context and additional request options. +// +// See GetStages 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 *APIGateway) GetStagesWithContext(ctx aws.Context, input *GetStagesInput, opts ...request.Option) (*GetStagesOutput, error) { + req, out := c.GetStagesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetUsage = "GetUsage" @@ -4922,8 +6475,23 @@ func (c *APIGateway) GetUsageRequest(input *GetUsageInput) (req *request.Request // func (c *APIGateway) GetUsage(input *GetUsageInput) (*Usage, error) { req, out := c.GetUsageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetUsageWithContext is the same as GetUsage with the addition of +// the ability to pass a context and additional request options. +// +// See GetUsage 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 *APIGateway) GetUsageWithContext(ctx aws.Context, input *GetUsageInput, opts ...request.Option) (*Usage, error) { + req, out := c.GetUsageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetUsagePages iterates over the pages of a GetUsage operation, @@ -4943,12 +6511,37 @@ func (c *APIGateway) GetUsage(input *GetUsageInput) (*Usage, error) { // return pageNum <= 3 // }) // -func (c *APIGateway) GetUsagePages(input *GetUsageInput, fn func(p *Usage, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetUsageRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*Usage), lastPage) - }) +func (c *APIGateway) GetUsagePages(input *GetUsageInput, fn func(*Usage, bool) bool) error { + return c.GetUsagePagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetUsagePagesWithContext same as GetUsagePages 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 *APIGateway) GetUsagePagesWithContext(ctx aws.Context, input *GetUsageInput, fn func(*Usage, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetUsageInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetUsageRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*Usage), !p.HasNextPage()) + } + return p.Err() } const opGetUsagePlan = "GetUsagePlan" @@ -5014,8 +6607,23 @@ func (c *APIGateway) GetUsagePlanRequest(input *GetUsagePlanInput) (req *request // func (c *APIGateway) GetUsagePlan(input *GetUsagePlanInput) (*UsagePlan, error) { req, out := c.GetUsagePlanRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetUsagePlanWithContext is the same as GetUsagePlan with the addition of +// the ability to pass a context and additional request options. +// +// See GetUsagePlan 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 *APIGateway) GetUsagePlanWithContext(ctx aws.Context, input *GetUsagePlanInput, opts ...request.Option) (*UsagePlan, error) { + req, out := c.GetUsagePlanRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetUsagePlanKey = "GetUsagePlanKey" @@ -5081,8 +6689,23 @@ func (c *APIGateway) GetUsagePlanKeyRequest(input *GetUsagePlanKeyInput) (req *r // func (c *APIGateway) GetUsagePlanKey(input *GetUsagePlanKeyInput) (*UsagePlanKey, error) { req, out := c.GetUsagePlanKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetUsagePlanKeyWithContext is the same as GetUsagePlanKey with the addition of +// the ability to pass a context and additional request options. +// +// See GetUsagePlanKey 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 *APIGateway) GetUsagePlanKeyWithContext(ctx aws.Context, input *GetUsagePlanKeyInput, opts ...request.Option) (*UsagePlanKey, error) { + req, out := c.GetUsagePlanKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetUsagePlanKeys = "GetUsagePlanKeys" @@ -5155,8 +6778,23 @@ func (c *APIGateway) GetUsagePlanKeysRequest(input *GetUsagePlanKeysInput) (req // func (c *APIGateway) GetUsagePlanKeys(input *GetUsagePlanKeysInput) (*GetUsagePlanKeysOutput, error) { req, out := c.GetUsagePlanKeysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetUsagePlanKeysWithContext is the same as GetUsagePlanKeys with the addition of +// the ability to pass a context and additional request options. +// +// See GetUsagePlanKeys 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 *APIGateway) GetUsagePlanKeysWithContext(ctx aws.Context, input *GetUsagePlanKeysInput, opts ...request.Option) (*GetUsagePlanKeysOutput, error) { + req, out := c.GetUsagePlanKeysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetUsagePlanKeysPages iterates over the pages of a GetUsagePlanKeys operation, @@ -5176,12 +6814,37 @@ func (c *APIGateway) GetUsagePlanKeys(input *GetUsagePlanKeysInput) (*GetUsagePl // return pageNum <= 3 // }) // -func (c *APIGateway) GetUsagePlanKeysPages(input *GetUsagePlanKeysInput, fn func(p *GetUsagePlanKeysOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetUsagePlanKeysRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetUsagePlanKeysOutput), lastPage) - }) +func (c *APIGateway) GetUsagePlanKeysPages(input *GetUsagePlanKeysInput, fn func(*GetUsagePlanKeysOutput, bool) bool) error { + return c.GetUsagePlanKeysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetUsagePlanKeysPagesWithContext same as GetUsagePlanKeysPages 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 *APIGateway) GetUsagePlanKeysPagesWithContext(ctx aws.Context, input *GetUsagePlanKeysInput, fn func(*GetUsagePlanKeysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetUsagePlanKeysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetUsagePlanKeysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetUsagePlanKeysOutput), !p.HasNextPage()) + } + return p.Err() } const opGetUsagePlans = "GetUsagePlans" @@ -5255,8 +6918,23 @@ func (c *APIGateway) GetUsagePlansRequest(input *GetUsagePlansInput) (req *reque // func (c *APIGateway) GetUsagePlans(input *GetUsagePlansInput) (*GetUsagePlansOutput, error) { req, out := c.GetUsagePlansRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetUsagePlansWithContext is the same as GetUsagePlans with the addition of +// the ability to pass a context and additional request options. +// +// See GetUsagePlans 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 *APIGateway) GetUsagePlansWithContext(ctx aws.Context, input *GetUsagePlansInput, opts ...request.Option) (*GetUsagePlansOutput, error) { + req, out := c.GetUsagePlansRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetUsagePlansPages iterates over the pages of a GetUsagePlans operation, @@ -5276,12 +6954,37 @@ func (c *APIGateway) GetUsagePlans(input *GetUsagePlansInput) (*GetUsagePlansOut // return pageNum <= 3 // }) // -func (c *APIGateway) GetUsagePlansPages(input *GetUsagePlansInput, fn func(p *GetUsagePlansOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetUsagePlansRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetUsagePlansOutput), lastPage) - }) +func (c *APIGateway) GetUsagePlansPages(input *GetUsagePlansInput, fn func(*GetUsagePlansOutput, bool) bool) error { + return c.GetUsagePlansPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetUsagePlansPagesWithContext same as GetUsagePlansPages 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 *APIGateway) GetUsagePlansPagesWithContext(ctx aws.Context, input *GetUsagePlansInput, fn func(*GetUsagePlansOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetUsagePlansInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetUsagePlansRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetUsagePlansOutput), !p.HasNextPage()) + } + return p.Err() } const opImportApiKeys = "ImportApiKeys" @@ -5347,12 +7050,27 @@ func (c *APIGateway) ImportApiKeysRequest(input *ImportApiKeysInput) (req *reque // // * ErrCodeBadRequestException "BadRequestException" // -// * ErrCodeConflictException "ConflictException" +// * ErrCodeConflictException "ConflictException" +// +func (c *APIGateway) ImportApiKeys(input *ImportApiKeysInput) (*ImportApiKeysOutput, error) { + req, out := c.ImportApiKeysRequest(input) + return out, req.Send() +} + +// ImportApiKeysWithContext is the same as ImportApiKeys with the addition of +// the ability to pass a context and additional request options. +// +// See ImportApiKeys for details on how to use this API operation. // -func (c *APIGateway) ImportApiKeys(input *ImportApiKeysInput) (*ImportApiKeysOutput, error) { +// 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 *APIGateway) ImportApiKeysWithContext(ctx aws.Context, input *ImportApiKeysInput, opts ...request.Option) (*ImportApiKeysOutput, error) { req, out := c.ImportApiKeysRequest(input) - err := req.Send() - return out, err + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportDocumentationParts = "ImportDocumentationParts" @@ -5418,8 +7136,23 @@ func (c *APIGateway) ImportDocumentationPartsRequest(input *ImportDocumentationP // func (c *APIGateway) ImportDocumentationParts(input *ImportDocumentationPartsInput) (*ImportDocumentationPartsOutput, error) { req, out := c.ImportDocumentationPartsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportDocumentationPartsWithContext is the same as ImportDocumentationParts with the addition of +// the ability to pass a context and additional request options. +// +// See ImportDocumentationParts 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 *APIGateway) ImportDocumentationPartsWithContext(ctx aws.Context, input *ImportDocumentationPartsInput, opts ...request.Option) (*ImportDocumentationPartsOutput, error) { + req, out := c.ImportDocumentationPartsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportRestApi = "ImportRestApi" @@ -5488,8 +7221,23 @@ func (c *APIGateway) ImportRestApiRequest(input *ImportRestApiInput) (req *reque // func (c *APIGateway) ImportRestApi(input *ImportRestApiInput) (*RestApi, error) { req, out := c.ImportRestApiRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportRestApiWithContext is the same as ImportRestApi with the addition of +// the ability to pass a context and additional request options. +// +// See ImportRestApi 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 *APIGateway) ImportRestApiWithContext(ctx aws.Context, input *ImportRestApiInput, opts ...request.Option) (*RestApi, error) { + req, out := c.ImportRestApiRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutIntegration = "PutIntegration" @@ -5557,8 +7305,23 @@ func (c *APIGateway) PutIntegrationRequest(input *PutIntegrationInput) (req *req // func (c *APIGateway) PutIntegration(input *PutIntegrationInput) (*Integration, error) { req, out := c.PutIntegrationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutIntegrationWithContext is the same as PutIntegration with the addition of +// the ability to pass a context and additional request options. +// +// See PutIntegration 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 *APIGateway) PutIntegrationWithContext(ctx aws.Context, input *PutIntegrationInput, opts ...request.Option) (*Integration, error) { + req, out := c.PutIntegrationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutIntegrationResponse = "PutIntegrationResponse" @@ -5628,8 +7391,23 @@ func (c *APIGateway) PutIntegrationResponseRequest(input *PutIntegrationResponse // func (c *APIGateway) PutIntegrationResponse(input *PutIntegrationResponseInput) (*IntegrationResponse, error) { req, out := c.PutIntegrationResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutIntegrationResponseWithContext is the same as PutIntegrationResponse with the addition of +// the ability to pass a context and additional request options. +// +// See PutIntegrationResponse 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 *APIGateway) PutIntegrationResponseWithContext(ctx aws.Context, input *PutIntegrationResponseInput, opts ...request.Option) (*IntegrationResponse, error) { + req, out := c.PutIntegrationResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutMethod = "PutMethod" @@ -5699,8 +7477,23 @@ func (c *APIGateway) PutMethodRequest(input *PutMethodInput) (req *request.Reque // func (c *APIGateway) PutMethod(input *PutMethodInput) (*Method, error) { req, out := c.PutMethodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutMethodWithContext is the same as PutMethod with the addition of +// the ability to pass a context and additional request options. +// +// See PutMethod 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 *APIGateway) PutMethodWithContext(ctx aws.Context, input *PutMethodInput, opts ...request.Option) (*Method, error) { + req, out := c.PutMethodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutMethodResponse = "PutMethodResponse" @@ -5770,8 +7563,23 @@ func (c *APIGateway) PutMethodResponseRequest(input *PutMethodResponseInput) (re // func (c *APIGateway) PutMethodResponse(input *PutMethodResponseInput) (*MethodResponse, error) { req, out := c.PutMethodResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutMethodResponseWithContext is the same as PutMethodResponse with the addition of +// the ability to pass a context and additional request options. +// +// See PutMethodResponse 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 *APIGateway) PutMethodResponseWithContext(ctx aws.Context, input *PutMethodResponseInput, opts ...request.Option) (*MethodResponse, error) { + req, out := c.PutMethodResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRestApi = "PutRestApi" @@ -5844,8 +7652,23 @@ func (c *APIGateway) PutRestApiRequest(input *PutRestApiInput) (req *request.Req // func (c *APIGateway) PutRestApi(input *PutRestApiInput) (*RestApi, error) { req, out := c.PutRestApiRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRestApiWithContext is the same as PutRestApi with the addition of +// the ability to pass a context and additional request options. +// +// See PutRestApi 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 *APIGateway) PutRestApiWithContext(ctx aws.Context, input *PutRestApiInput, opts ...request.Option) (*RestApi, error) { + req, out := c.PutRestApiRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestInvokeAuthorizer = "TestInvokeAuthorizer" @@ -5914,8 +7737,23 @@ func (c *APIGateway) TestInvokeAuthorizerRequest(input *TestInvokeAuthorizerInpu // func (c *APIGateway) TestInvokeAuthorizer(input *TestInvokeAuthorizerInput) (*TestInvokeAuthorizerOutput, error) { req, out := c.TestInvokeAuthorizerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestInvokeAuthorizerWithContext is the same as TestInvokeAuthorizer with the addition of +// the ability to pass a context and additional request options. +// +// See TestInvokeAuthorizer 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 *APIGateway) TestInvokeAuthorizerWithContext(ctx aws.Context, input *TestInvokeAuthorizerInput, opts ...request.Option) (*TestInvokeAuthorizerOutput, error) { + req, out := c.TestInvokeAuthorizerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestInvokeMethod = "TestInvokeMethod" @@ -5982,8 +7820,23 @@ func (c *APIGateway) TestInvokeMethodRequest(input *TestInvokeMethodInput) (req // func (c *APIGateway) TestInvokeMethod(input *TestInvokeMethodInput) (*TestInvokeMethodOutput, error) { req, out := c.TestInvokeMethodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestInvokeMethodWithContext is the same as TestInvokeMethod with the addition of +// the ability to pass a context and additional request options. +// +// See TestInvokeMethod 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 *APIGateway) TestInvokeMethodWithContext(ctx aws.Context, input *TestInvokeMethodInput, opts ...request.Option) (*TestInvokeMethodOutput, error) { + req, out := c.TestInvokeMethodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateAccount = "UpdateAccount" @@ -6049,8 +7902,23 @@ func (c *APIGateway) UpdateAccountRequest(input *UpdateAccountInput) (req *reque // func (c *APIGateway) UpdateAccount(input *UpdateAccountInput) (*Account, error) { req, out := c.UpdateAccountRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAccountWithContext is the same as UpdateAccount with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAccount 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 *APIGateway) UpdateAccountWithContext(ctx aws.Context, input *UpdateAccountInput, opts ...request.Option) (*Account, error) { + req, out := c.UpdateAccountRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateApiKey = "UpdateApiKey" @@ -6118,8 +7986,23 @@ func (c *APIGateway) UpdateApiKeyRequest(input *UpdateApiKeyInput) (req *request // func (c *APIGateway) UpdateApiKey(input *UpdateApiKeyInput) (*ApiKey, error) { req, out := c.UpdateApiKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateApiKeyWithContext is the same as UpdateApiKey with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateApiKey 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 *APIGateway) UpdateApiKeyWithContext(ctx aws.Context, input *UpdateApiKeyInput, opts ...request.Option) (*ApiKey, error) { + req, out := c.UpdateApiKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateAuthorizer = "UpdateAuthorizer" @@ -6187,8 +8070,23 @@ func (c *APIGateway) UpdateAuthorizerRequest(input *UpdateAuthorizerInput) (req // func (c *APIGateway) UpdateAuthorizer(input *UpdateAuthorizerInput) (*Authorizer, error) { req, out := c.UpdateAuthorizerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAuthorizerWithContext is the same as UpdateAuthorizer with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAuthorizer 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 *APIGateway) UpdateAuthorizerWithContext(ctx aws.Context, input *UpdateAuthorizerInput, opts ...request.Option) (*Authorizer, error) { + req, out := c.UpdateAuthorizerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateBasePathMapping = "UpdateBasePathMapping" @@ -6256,8 +8154,23 @@ func (c *APIGateway) UpdateBasePathMappingRequest(input *UpdateBasePathMappingIn // func (c *APIGateway) UpdateBasePathMapping(input *UpdateBasePathMappingInput) (*BasePathMapping, error) { req, out := c.UpdateBasePathMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateBasePathMappingWithContext is the same as UpdateBasePathMapping with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateBasePathMapping 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 *APIGateway) UpdateBasePathMappingWithContext(ctx aws.Context, input *UpdateBasePathMappingInput, opts ...request.Option) (*BasePathMapping, error) { + req, out := c.UpdateBasePathMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateClientCertificate = "UpdateClientCertificate" @@ -6323,8 +8236,23 @@ func (c *APIGateway) UpdateClientCertificateRequest(input *UpdateClientCertifica // func (c *APIGateway) UpdateClientCertificate(input *UpdateClientCertificateInput) (*ClientCertificate, error) { req, out := c.UpdateClientCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateClientCertificateWithContext is the same as UpdateClientCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateClientCertificate 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 *APIGateway) UpdateClientCertificateWithContext(ctx aws.Context, input *UpdateClientCertificateInput, opts ...request.Option) (*ClientCertificate, error) { + req, out := c.UpdateClientCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDeployment = "UpdateDeployment" @@ -6392,8 +8320,23 @@ func (c *APIGateway) UpdateDeploymentRequest(input *UpdateDeploymentInput) (req // func (c *APIGateway) UpdateDeployment(input *UpdateDeploymentInput) (*Deployment, error) { req, out := c.UpdateDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDeploymentWithContext is the same as UpdateDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDeployment 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 *APIGateway) UpdateDeploymentWithContext(ctx aws.Context, input *UpdateDeploymentInput, opts ...request.Option) (*Deployment, error) { + req, out := c.UpdateDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDocumentationPart = "UpdateDocumentationPart" @@ -6461,8 +8404,23 @@ func (c *APIGateway) UpdateDocumentationPartRequest(input *UpdateDocumentationPa // func (c *APIGateway) UpdateDocumentationPart(input *UpdateDocumentationPartInput) (*DocumentationPart, error) { req, out := c.UpdateDocumentationPartRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDocumentationPartWithContext is the same as UpdateDocumentationPart with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDocumentationPart 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 *APIGateway) UpdateDocumentationPartWithContext(ctx aws.Context, input *UpdateDocumentationPartInput, opts ...request.Option) (*DocumentationPart, error) { + req, out := c.UpdateDocumentationPartRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDocumentationVersion = "UpdateDocumentationVersion" @@ -6528,8 +8486,23 @@ func (c *APIGateway) UpdateDocumentationVersionRequest(input *UpdateDocumentatio // func (c *APIGateway) UpdateDocumentationVersion(input *UpdateDocumentationVersionInput) (*DocumentationVersion, error) { req, out := c.UpdateDocumentationVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDocumentationVersionWithContext is the same as UpdateDocumentationVersion with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDocumentationVersion 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 *APIGateway) UpdateDocumentationVersionWithContext(ctx aws.Context, input *UpdateDocumentationVersionInput, opts ...request.Option) (*DocumentationVersion, error) { + req, out := c.UpdateDocumentationVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDomainName = "UpdateDomainName" @@ -6597,8 +8570,23 @@ func (c *APIGateway) UpdateDomainNameRequest(input *UpdateDomainNameInput) (req // func (c *APIGateway) UpdateDomainName(input *UpdateDomainNameInput) (*DomainName, error) { req, out := c.UpdateDomainNameRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDomainNameWithContext is the same as UpdateDomainName with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDomainName 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 *APIGateway) UpdateDomainNameWithContext(ctx aws.Context, input *UpdateDomainNameInput, opts ...request.Option) (*DomainName, error) { + req, out := c.UpdateDomainNameRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateIntegration = "UpdateIntegration" @@ -6666,8 +8654,23 @@ func (c *APIGateway) UpdateIntegrationRequest(input *UpdateIntegrationInput) (re // func (c *APIGateway) UpdateIntegration(input *UpdateIntegrationInput) (*Integration, error) { req, out := c.UpdateIntegrationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateIntegrationWithContext is the same as UpdateIntegration with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateIntegration 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 *APIGateway) UpdateIntegrationWithContext(ctx aws.Context, input *UpdateIntegrationInput, opts ...request.Option) (*Integration, error) { + req, out := c.UpdateIntegrationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateIntegrationResponse = "UpdateIntegrationResponse" @@ -6735,8 +8738,23 @@ func (c *APIGateway) UpdateIntegrationResponseRequest(input *UpdateIntegrationRe // func (c *APIGateway) UpdateIntegrationResponse(input *UpdateIntegrationResponseInput) (*IntegrationResponse, error) { req, out := c.UpdateIntegrationResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateIntegrationResponseWithContext is the same as UpdateIntegrationResponse with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateIntegrationResponse 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 *APIGateway) UpdateIntegrationResponseWithContext(ctx aws.Context, input *UpdateIntegrationResponseInput, opts ...request.Option) (*IntegrationResponse, error) { + req, out := c.UpdateIntegrationResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateMethod = "UpdateMethod" @@ -6804,8 +8822,23 @@ func (c *APIGateway) UpdateMethodRequest(input *UpdateMethodInput) (req *request // func (c *APIGateway) UpdateMethod(input *UpdateMethodInput) (*Method, error) { req, out := c.UpdateMethodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateMethodWithContext is the same as UpdateMethod with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateMethod 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 *APIGateway) UpdateMethodWithContext(ctx aws.Context, input *UpdateMethodInput, opts ...request.Option) (*Method, error) { + req, out := c.UpdateMethodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateMethodResponse = "UpdateMethodResponse" @@ -6875,8 +8908,23 @@ func (c *APIGateway) UpdateMethodResponseRequest(input *UpdateMethodResponseInpu // func (c *APIGateway) UpdateMethodResponse(input *UpdateMethodResponseInput) (*MethodResponse, error) { req, out := c.UpdateMethodResponseRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateMethodResponseWithContext is the same as UpdateMethodResponse with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateMethodResponse 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 *APIGateway) UpdateMethodResponseWithContext(ctx aws.Context, input *UpdateMethodResponseInput, opts ...request.Option) (*MethodResponse, error) { + req, out := c.UpdateMethodResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateModel = "UpdateModel" @@ -6944,8 +8992,105 @@ func (c *APIGateway) UpdateModelRequest(input *UpdateModelInput) (req *request.R // func (c *APIGateway) UpdateModel(input *UpdateModelInput) (*Model, error) { req, out := c.UpdateModelRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateModelWithContext is the same as UpdateModel with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateModel 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 *APIGateway) UpdateModelWithContext(ctx aws.Context, input *UpdateModelInput, opts ...request.Option) (*Model, error) { + req, out := c.UpdateModelRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateRequestValidator = "UpdateRequestValidator" + +// UpdateRequestValidatorRequest generates a "aws/request.Request" representing the +// client's request for the UpdateRequestValidator operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See UpdateRequestValidator for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UpdateRequestValidator method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UpdateRequestValidatorRequest method. +// req, resp := client.UpdateRequestValidatorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +func (c *APIGateway) UpdateRequestValidatorRequest(input *UpdateRequestValidatorInput) (req *request.Request, output *UpdateRequestValidatorOutput) { + op := &request.Operation{ + Name: opUpdateRequestValidator, + HTTPMethod: "PATCH", + HTTPPath: "/restapis/{restapi_id}/requestvalidators/{requestvalidator_id}", + } + + if input == nil { + input = &UpdateRequestValidatorInput{} + } + + output = &UpdateRequestValidatorOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateRequestValidator API operation for Amazon API Gateway. +// +// Updates a RequestValidator of a given RestApi. +// +// 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 Amazon API Gateway's +// API operation UpdateRequestValidator for usage and error information. +// +// Returned Error Codes: +// * ErrCodeUnauthorizedException "UnauthorizedException" +// +// * ErrCodeNotFoundException "NotFoundException" +// +// * ErrCodeBadRequestException "BadRequestException" +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +func (c *APIGateway) UpdateRequestValidator(input *UpdateRequestValidatorInput) (*UpdateRequestValidatorOutput, error) { + req, out := c.UpdateRequestValidatorRequest(input) + return out, req.Send() +} + +// UpdateRequestValidatorWithContext is the same as UpdateRequestValidator with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRequestValidator 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 *APIGateway) UpdateRequestValidatorWithContext(ctx aws.Context, input *UpdateRequestValidatorInput, opts ...request.Option) (*UpdateRequestValidatorOutput, error) { + req, out := c.UpdateRequestValidatorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateResource = "UpdateResource" @@ -7013,8 +9158,23 @@ func (c *APIGateway) UpdateResourceRequest(input *UpdateResourceInput) (req *req // func (c *APIGateway) UpdateResource(input *UpdateResourceInput) (*Resource, error) { req, out := c.UpdateResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateResourceWithContext is the same as UpdateResource with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateResource 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 *APIGateway) UpdateResourceWithContext(ctx aws.Context, input *UpdateResourceInput, opts ...request.Option) (*Resource, error) { + req, out := c.UpdateResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateRestApi = "UpdateRestApi" @@ -7082,8 +9242,23 @@ func (c *APIGateway) UpdateRestApiRequest(input *UpdateRestApiInput) (req *reque // func (c *APIGateway) UpdateRestApi(input *UpdateRestApiInput) (*RestApi, error) { req, out := c.UpdateRestApiRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateRestApiWithContext is the same as UpdateRestApi with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRestApi 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 *APIGateway) UpdateRestApiWithContext(ctx aws.Context, input *UpdateRestApiInput, opts ...request.Option) (*RestApi, error) { + req, out := c.UpdateRestApiRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateStage = "UpdateStage" @@ -7151,8 +9326,23 @@ func (c *APIGateway) UpdateStageRequest(input *UpdateStageInput) (req *request.R // func (c *APIGateway) UpdateStage(input *UpdateStageInput) (*Stage, error) { req, out := c.UpdateStageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateStageWithContext is the same as UpdateStage with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateStage 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 *APIGateway) UpdateStageWithContext(ctx aws.Context, input *UpdateStageInput, opts ...request.Option) (*Stage, error) { + req, out := c.UpdateStageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateUsage = "UpdateUsage" @@ -7219,8 +9409,23 @@ func (c *APIGateway) UpdateUsageRequest(input *UpdateUsageInput) (req *request.R // func (c *APIGateway) UpdateUsage(input *UpdateUsageInput) (*Usage, error) { req, out := c.UpdateUsageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateUsageWithContext is the same as UpdateUsage with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateUsage 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 *APIGateway) UpdateUsageWithContext(ctx aws.Context, input *UpdateUsageInput, opts ...request.Option) (*Usage, error) { + req, out := c.UpdateUsageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateUsagePlan = "UpdateUsagePlan" @@ -7288,8 +9493,23 @@ func (c *APIGateway) UpdateUsagePlanRequest(input *UpdateUsagePlanInput) (req *r // func (c *APIGateway) UpdateUsagePlan(input *UpdateUsagePlanInput) (*UsagePlan, error) { req, out := c.UpdateUsagePlanRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateUsagePlanWithContext is the same as UpdateUsagePlan with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateUsagePlan 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 *APIGateway) UpdateUsagePlanWithContext(ctx aws.Context, input *UpdateUsagePlanInput, opts ...request.Option) (*UsagePlan, error) { + req, out := c.UpdateUsagePlanRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents an AWS account that is associated with Amazon API Gateway. @@ -7388,7 +9608,7 @@ func (s *Account) SetThrottleSettings(v *ThrottleSettings) *Account { type ApiKey struct { _ struct{} `type:"structure"` - // The date when the API Key was created, in ISO 8601 format (http://www.iso.org/iso/home/standards/iso8601.htm). + // The timestamp when the API Key was created. CreatedDate *time.Time `locationName:"createdDate" type:"timestamp" timestampFormat:"unix"` // An AWS Marketplace customer identifier , when integrating with the AWS SaaS @@ -7404,7 +9624,7 @@ type ApiKey struct { // The identifier of the API Key. Id *string `locationName:"id" type:"string"` - // When the API Key was last updated, in ISO 8601 format. + // The timestamp when the API Key was last updated. LastUpdatedDate *time.Time `locationName:"lastUpdatedDate" type:"timestamp" timestampFormat:"unix"` // The name of the API Key. @@ -7706,13 +9926,13 @@ type ClientCertificate struct { // The identifier of the client certificate. ClientCertificateId *string `locationName:"clientCertificateId" type:"string"` - // The date when the client certificate was created, in ISO 8601 format (http://www.iso.org/iso/home/standards/iso8601.htm). + // The timestamp when the client certificate was created. CreatedDate *time.Time `locationName:"createdDate" type:"timestamp" timestampFormat:"unix"` // The description of the client certificate. Description *string `locationName:"description" type:"string"` - // The date when the client certificate will expire, in ISO 8601 format (http://www.iso.org/iso/home/standards/iso8601.htm). + // The timestamp when the client certificate will expire. ExpirationDate *time.Time `locationName:"expirationDate" type:"timestamp" timestampFormat:"unix"` // The PEM-encoded public key of the client certificate, which can be used to @@ -8299,32 +10519,29 @@ func (s *CreateDocumentationVersionInput) SetStageName(v string) *CreateDocument type CreateDomainNameInput struct { _ struct{} `type:"structure"` - // The body of the server certificate provided by your certificate authority. - // - // CertificateBody is a required field - CertificateBody *string `locationName:"certificateBody" type:"string" required:"true"` + // The reference to an AWS-managed certificate. AWS Certificate Manager is the + // only supported source. + CertificateArn *string `locationName:"certificateArn" type:"string"` - // The intermediate certificates and optionally the root certificate, one after - // the other without any blank lines. If you include the root certificate, your - // certificate chain must start with intermediate certificates and end with - // the root certificate. Use the intermediate certificates that were provided + // [Deprecated] The body of the server certificate provided by your certificate + // authority. + CertificateBody *string `locationName:"certificateBody" type:"string"` + + // [Deprecated] The intermediate certificates and optionally the root certificate, + // one after the other without any blank lines. If you include the root certificate, + // your certificate chain must start with intermediate certificates and end + // with the root certificate. Use the intermediate certificates that were provided // by your certificate authority. Do not include any intermediaries that are // not in the chain of trust path. - // - // CertificateChain is a required field - CertificateChain *string `locationName:"certificateChain" type:"string" required:"true"` + CertificateChain *string `locationName:"certificateChain" type:"string"` - // The name of the certificate. - // - // CertificateName is a required field - CertificateName *string `locationName:"certificateName" type:"string" required:"true"` + // The user-friendly name of the certificate. + CertificateName *string `locationName:"certificateName" type:"string"` - // Your certificate's private key. - // - // CertificatePrivateKey is a required field - CertificatePrivateKey *string `locationName:"certificatePrivateKey" type:"string" required:"true"` + // [Deprecated] Your certificate's private key. + CertificatePrivateKey *string `locationName:"certificatePrivateKey" type:"string"` - // The name of the DomainName resource. + // (Required) The name of the DomainName resource. // // DomainName is a required field DomainName *string `locationName:"domainName" type:"string" required:"true"` @@ -8343,18 +10560,6 @@ func (s CreateDomainNameInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *CreateDomainNameInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "CreateDomainNameInput"} - if s.CertificateBody == nil { - invalidParams.Add(request.NewErrParamRequired("CertificateBody")) - } - if s.CertificateChain == nil { - invalidParams.Add(request.NewErrParamRequired("CertificateChain")) - } - if s.CertificateName == nil { - invalidParams.Add(request.NewErrParamRequired("CertificateName")) - } - if s.CertificatePrivateKey == nil { - invalidParams.Add(request.NewErrParamRequired("CertificatePrivateKey")) - } if s.DomainName == nil { invalidParams.Add(request.NewErrParamRequired("DomainName")) } @@ -8365,6 +10570,12 @@ func (s *CreateDomainNameInput) Validate() error { return nil } +// SetCertificateArn sets the CertificateArn field's value. +func (s *CreateDomainNameInput) SetCertificateArn(v string) *CreateDomainNameInput { + s.CertificateArn = &v + return s +} + // SetCertificateBody sets the CertificateBody field's value. func (s *CreateDomainNameInput) SetCertificateBody(v string) *CreateDomainNameInput { s.CertificateBody = &v @@ -8481,6 +10692,75 @@ func (s *CreateModelInput) SetSchema(v string) *CreateModelInput { return s } +// Creates a RequestValidator of a given RestApi. +type CreateRequestValidatorInput struct { + _ struct{} `type:"structure"` + + // The name of the to-be-created RequestValidator. + Name *string `locationName:"name" type:"string"` + + // [Required] The identifier of the RestApi for which the RequestValidator is + // created. + // + // RestApiId is a required field + RestApiId *string `location:"uri" locationName:"restapi_id" type:"string" required:"true"` + + // A Boolean flag to indicate whether to validate request body according to + // the configured model schema for the method (true) or not (false). + ValidateRequestBody *bool `locationName:"validateRequestBody" type:"boolean"` + + // A Boolean flag to indicate whether to validate request parameters, true, + // or not false. + ValidateRequestParameters *bool `locationName:"validateRequestParameters" type:"boolean"` +} + +// String returns the string representation +func (s CreateRequestValidatorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRequestValidatorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRequestValidatorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRequestValidatorInput"} + if s.RestApiId == nil { + invalidParams.Add(request.NewErrParamRequired("RestApiId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *CreateRequestValidatorInput) SetName(v string) *CreateRequestValidatorInput { + s.Name = &v + return s +} + +// SetRestApiId sets the RestApiId field's value. +func (s *CreateRequestValidatorInput) SetRestApiId(v string) *CreateRequestValidatorInput { + s.RestApiId = &v + return s +} + +// SetValidateRequestBody sets the ValidateRequestBody field's value. +func (s *CreateRequestValidatorInput) SetValidateRequestBody(v bool) *CreateRequestValidatorInput { + s.ValidateRequestBody = &v + return s +} + +// SetValidateRequestParameters sets the ValidateRequestParameters field's value. +func (s *CreateRequestValidatorInput) SetValidateRequestParameters(v bool) *CreateRequestValidatorInput { + s.ValidateRequestParameters = &v + return s +} + // Requests Amazon API Gateway to create a Resource resource. type CreateResourceInput struct { _ struct{} `type:"structure"` @@ -9798,6 +12078,74 @@ func (s DeleteModelOutput) GoString() string { return s.String() } +// Deletes a specified RequestValidator of a given RestApi. +type DeleteRequestValidatorInput struct { + _ struct{} `type:"structure"` + + // [Required] The identifier of the RequestValidator to be deleted. + // + // RequestValidatorId is a required field + RequestValidatorId *string `location:"uri" locationName:"requestvalidator_id" type:"string" required:"true"` + + // [Required] The identifier of the RestApi from which the given RequestValidator + // is deleted. + // + // RestApiId is a required field + RestApiId *string `location:"uri" locationName:"restapi_id" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteRequestValidatorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRequestValidatorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRequestValidatorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRequestValidatorInput"} + if s.RequestValidatorId == nil { + invalidParams.Add(request.NewErrParamRequired("RequestValidatorId")) + } + if s.RestApiId == nil { + invalidParams.Add(request.NewErrParamRequired("RestApiId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRequestValidatorId sets the RequestValidatorId field's value. +func (s *DeleteRequestValidatorInput) SetRequestValidatorId(v string) *DeleteRequestValidatorInput { + s.RequestValidatorId = &v + return s +} + +// SetRestApiId sets the RestApiId field's value. +func (s *DeleteRequestValidatorInput) SetRestApiId(v string) *DeleteRequestValidatorInput { + s.RestApiId = &v + return s +} + +type DeleteRequestValidatorOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteRequestValidatorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRequestValidatorOutput) GoString() string { + return s.String() +} + // Request to delete a Resource. type DeleteResourceInput struct { _ struct{} `type:"structure"` @@ -10275,7 +12623,8 @@ type DocumentationPartLocation struct { // a valid and required field for API entity types of API, AUTHORIZER, MODEL, // RESOURCE, METHOD, PATH_PARAMETER, QUERY_PARAMETER, REQUEST_HEADER, REQUEST_BODY, // RESPONSE, RESPONSE_HEADER, and RESPONSE_BODY. Content inheritance does not - // apply to any entity of the API, AUTHROZER, MODEL, or RESOURCE type. + // apply to any entity of the API, AUTHROZER, METHOD, MODEL, REQUEST_BODY, or + // RESOURCE type. // // Type is a required field Type *string `locationName:"type" type:"string" required:"true" enum:"DocumentationPartType"` @@ -10390,10 +12739,14 @@ func (s *DocumentationVersion) SetVersion(v string) *DocumentationVersion { type DomainName struct { _ struct{} `type:"structure"` + // The reference to an AWS-managed certificate. AWS Certificate Manager is the + // only supported source. + CertificateArn *string `locationName:"certificateArn" type:"string"` + // The name of the certificate. CertificateName *string `locationName:"certificateName" type:"string"` - // The date when the certificate was uploaded, in ISO 8601 format (http://www.iso.org/iso/home/standards/iso8601.htm). + // The timestamp when the certificate was uploaded. CertificateUploadDate *time.Time `locationName:"certificateUploadDate" type:"timestamp" timestampFormat:"unix"` // The domain name of the Amazon CloudFront distribution. For more information, @@ -10414,6 +12767,12 @@ func (s DomainName) GoString() string { return s.String() } +// SetCertificateArn sets the CertificateArn field's value. +func (s *DomainName) SetCertificateArn(v string) *DomainName { + s.CertificateArn = &v + return s +} + // SetCertificateName sets the CertificateName field's value. func (s *DomainName) SetCertificateName(v string) *DomainName { s.CertificateName = &v @@ -10679,7 +13038,7 @@ type GetApiKeysInput struct { // The name of queried API keys. NameQuery *string `location:"querystring" locationName:"name" type:"string"` - // The position of the current ApiKeys resource to get information about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` } @@ -10824,11 +13183,10 @@ func (s *GetAuthorizerInput) SetRestApiId(v string) *GetAuthorizerInput { type GetAuthorizersInput struct { _ struct{} `type:"structure"` - // Limit the number of Authorizer resources in the response. + // The maximum number of returned results per page. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // If not all Authorizer resources in the response were present, the position - // will specify where to start the next page of results. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // The RestApi identifier for the Authorizers resource. @@ -10977,13 +13335,11 @@ type GetBasePathMappingsInput struct { // DomainName is a required field DomainName *string `location:"uri" locationName:"domain_name" type:"string" required:"true"` - // The maximum number of BasePathMapping resources in the collection to get - // information about. The default limit is 25. It should be an integer between - // 1 - 500. + // The maximum number of returned results per page. The value is 25 by default + // and could be between 1 - 500. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the current BasePathMapping resource in the collection to - // get information about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` } @@ -11106,13 +13462,11 @@ func (s *GetClientCertificateInput) SetClientCertificateId(v string) *GetClientC type GetClientCertificatesInput struct { _ struct{} `type:"structure"` - // The maximum number of ClientCertificate resources in the collection to get - // information about. The default limit is 25. It should be an integer between - // 1 - 500. + // The maximum number of returned results per page. The value is 25 by default + // and could be between 1 - 500. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the current ClientCertificate resource in the collection - // to get information about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` } @@ -11231,12 +13585,11 @@ func (s *GetDeploymentInput) SetRestApiId(v string) *GetDeploymentInput { type GetDeploymentsInput struct { _ struct{} `type:"structure"` - // The maximum number of Deployment resources in the collection to get information - // about. The default limit is 25. It should be an integer between 1 - 500. + // The maximum number of returned results per page. The value is 25 by default + // and could be between 1 - 500. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the current Deployment resource in the collection to get - // information about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // The identifier of the RestApi resource for the collection of Deployment resources @@ -11390,7 +13743,7 @@ func (s *GetDocumentationPartInput) SetRestApiId(v string) *GetDocumentationPart type GetDocumentationPartsInput struct { _ struct{} `type:"structure"` - // The size of the paged results. + // The maximum number of returned results per page. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` // The name of API entities of the to-be-retrieved documentation parts. @@ -11399,8 +13752,7 @@ type GetDocumentationPartsInput struct { // The path of API entities of the to-be-retrieved documentation parts. Path *string `location:"querystring" locationName:"path" type:"string"` - // The position of the to-be-retrieved documentation part in the DocumentationParts - // collection. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // [Required] The identifier of the API of the to-be-retrieved documentation @@ -11565,11 +13917,10 @@ func (s *GetDocumentationVersionInput) SetRestApiId(v string) *GetDocumentationV type GetDocumentationVersionsInput struct { _ struct{} `type:"structure"` - // The page size of the returned documentation versions. + // The maximum number of returned results per page. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the returned DocumentationVersion in the DocumentationVersions - // collection. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // [Required] The identifier of an API of the to-be-retrieved documentation @@ -11702,11 +14053,11 @@ func (s *GetDomainNameInput) SetDomainName(v string) *GetDomainNameInput { type GetDomainNamesInput struct { _ struct{} `type:"structure"` - // The maximum number of DomainName resources in the collection to get information - // about. The default limit is 25. It should be an integer between 1 - 500. + // The maximum number of returned results per page. The value is 25 by default + // and could be between 1 - 500. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the current domain names to get information about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` } @@ -12347,12 +14698,11 @@ func (s *GetModelTemplateOutput) SetValue(v string) *GetModelTemplateOutput { type GetModelsInput struct { _ struct{} `type:"structure"` - // The maximum number of models in the collection to get information about. - // The default limit is 25. It should be an integer between 1 - 500. + // The maximum number of returned results per page. The value is 25 by default + // and could be between 1 - 500. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the next set of results in the Models resource to get information - // about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // The RestApi identifier. @@ -12436,6 +14786,156 @@ func (s *GetModelsOutput) SetPosition(v string) *GetModelsOutput { return s } +// Gets a RequestValidator of a given RestApi. +type GetRequestValidatorInput struct { + _ struct{} `type:"structure"` + + // [Required] The identifier of the RequestValidator to be retrieved. + // + // RequestValidatorId is a required field + RequestValidatorId *string `location:"uri" locationName:"requestvalidator_id" type:"string" required:"true"` + + // [Required] The identifier of the RestApi to which the specified RequestValidator + // belongs. + // + // RestApiId is a required field + RestApiId *string `location:"uri" locationName:"restapi_id" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRequestValidatorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRequestValidatorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRequestValidatorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRequestValidatorInput"} + if s.RequestValidatorId == nil { + invalidParams.Add(request.NewErrParamRequired("RequestValidatorId")) + } + if s.RestApiId == nil { + invalidParams.Add(request.NewErrParamRequired("RestApiId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRequestValidatorId sets the RequestValidatorId field's value. +func (s *GetRequestValidatorInput) SetRequestValidatorId(v string) *GetRequestValidatorInput { + s.RequestValidatorId = &v + return s +} + +// SetRestApiId sets the RestApiId field's value. +func (s *GetRequestValidatorInput) SetRestApiId(v string) *GetRequestValidatorInput { + s.RestApiId = &v + return s +} + +// Gets the RequestValidators collection of a given RestApi. +type GetRequestValidatorsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of returned results per page. + Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` + + // The current pagination position in the paged result set. + Position *string `location:"querystring" locationName:"position" type:"string"` + + // [Required] The identifier of a RestApi to which the RequestValidators collection + // belongs. + // + // RestApiId is a required field + RestApiId *string `location:"uri" locationName:"restapi_id" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRequestValidatorsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRequestValidatorsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRequestValidatorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRequestValidatorsInput"} + if s.RestApiId == nil { + invalidParams.Add(request.NewErrParamRequired("RestApiId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *GetRequestValidatorsInput) SetLimit(v int64) *GetRequestValidatorsInput { + s.Limit = &v + return s +} + +// SetPosition sets the Position field's value. +func (s *GetRequestValidatorsInput) SetPosition(v string) *GetRequestValidatorsInput { + s.Position = &v + return s +} + +// SetRestApiId sets the RestApiId field's value. +func (s *GetRequestValidatorsInput) SetRestApiId(v string) *GetRequestValidatorsInput { + s.RestApiId = &v + return s +} + +// A collection of RequestValidator resources of a given RestApi. +// +// In Swagger, the RequestValidators of an API is defined by the x-amazon-apigateway-request-validators +// (http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions.html#api-gateway-swagger-extensions-request-validators.html) +// extension. +// +// Enable Basic Request Validation in API Gateway (http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-request-validation.html) +type GetRequestValidatorsOutput struct { + _ struct{} `type:"structure"` + + // The current page of RequestValidator resources in the RequestValidators collection. + Items []*UpdateRequestValidatorOutput `locationName:"item" type:"list"` + + Position *string `locationName:"position" type:"string"` +} + +// String returns the string representation +func (s GetRequestValidatorsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRequestValidatorsOutput) GoString() string { + return s.String() +} + +// SetItems sets the Items field's value. +func (s *GetRequestValidatorsOutput) SetItems(v []*UpdateRequestValidatorOutput) *GetRequestValidatorsOutput { + s.Items = v + return s +} + +// SetPosition sets the Position field's value. +func (s *GetRequestValidatorsOutput) SetPosition(v string) *GetRequestValidatorsOutput { + s.Position = &v + return s +} + // Request to list information about a resource. type GetResourceInput struct { _ struct{} `type:"structure"` @@ -12493,12 +14993,11 @@ func (s *GetResourceInput) SetRestApiId(v string) *GetResourceInput { type GetResourcesInput struct { _ struct{} `type:"structure"` - // The maximum number of Resource resources in the collection to get information - // about. The default limit is 25. It should be an integer between 1 - 500. + // The maximum number of returned results per page. The value is 25 by default + // and could be between 1 - 500. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the next set of results in the current Resources resource - // to get information about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // The RestApi identifier for the Resource. @@ -12625,12 +15124,11 @@ func (s *GetRestApiInput) SetRestApiId(v string) *GetRestApiInput { type GetRestApisInput struct { _ struct{} `type:"structure"` - // The maximum number of RestApi resources in the collection to get information - // about. The default limit is 25. It should be an integer between 1 - 500. + // The maximum number of returned results per page. The value is 25 by default + // and could be between 1 - 500. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the current RestApis resource in the collection to get information - // about. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` } @@ -12856,10 +15354,10 @@ func (s *GetSdkTypeInput) SetId(v string) *GetSdkTypeInput { type GetSdkTypesInput struct { _ struct{} `type:"structure"` - // The maximum number of SdkType instances to be returned. + // The maximum number of returned results per page. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The position of the last fetched element in the SdkTypes collection. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` } @@ -13058,10 +15556,10 @@ type GetUsageInput struct { // The Id of the API key associated with the resultant usage data. KeyId *string `location:"querystring" locationName:"keyId" type:"string"` - // The maximum number of results to be returned. + // The maximum number of returned results per page. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // Position + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // The starting date (e.g., 2016-01-01) of the usage data. @@ -13239,15 +15737,13 @@ func (s *GetUsagePlanKeyInput) SetUsagePlanId(v string) *GetUsagePlanKeyInput { type GetUsagePlanKeysInput struct { _ struct{} `type:"structure"` - // A query parameter specifying the maximum number usage plan keys returned - // by the GET request. + // The maximum number of returned results per page. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` // A query parameter specifying the name of the to-be-returned usage plan keys. NameQuery *string `location:"querystring" locationName:"name" type:"string"` - // A query parameter specifying the zero-based index specifying the position - // of a usage plan key. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` // The Id of the UsagePlan resource representing the usage plan containing the @@ -13346,11 +15842,10 @@ type GetUsagePlansInput struct { // The identifier of the API key associated with the usage plans. KeyId *string `location:"querystring" locationName:"keyId" type:"string"` - // The number of UsagePlan resources to be returned as the result. + // The maximum number of returned results per page. Limit *int64 `location:"querystring" locationName:"limit" type:"integer"` - // The zero-based array index specifying the position of the to-be-retrieved - // UsagePlan resource. + // The current pagination position in the paged result set. Position *string `location:"querystring" locationName:"position" type:"string"` } @@ -14056,7 +16551,9 @@ type Method struct { // method. ApiKeyRequired *bool `locationName:"apiKeyRequired" type:"boolean"` - // The method's authorization type. + // The method's authorization type. Valid values are NONE for open access, AWS_IAM + // for using AWS IAM permissions, CUSTOM for using a custom authorizer, or COGNITO_USER_POOLS + // for using a Cognito user pool. AuthorizationType *string `locationName:"authorizationType" type:"string"` // The identifier of an Authorizer to use on this method. The authorizationType @@ -14157,6 +16654,9 @@ type Method struct { // parameter names defined here are available in Integration to be mapped to // integration request parameters or templates. RequestParameters map[string]*bool `locationName:"requestParameters" type:"map"` + + // The identifier of a RequestValidator for request validation. + RequestValidatorId *string `locationName:"requestValidatorId" type:"string"` } // String returns the string representation @@ -14223,6 +16723,12 @@ func (s *Method) SetRequestParameters(v map[string]*bool) *Method { return s } +// SetRequestValidatorId sets the RequestValidatorId field's value. +func (s *Method) SetRequestValidatorId(v string) *Method { + s.RequestValidatorId = &v + return s +} + // Represents a method response of a given HTTP status code returned to the // client. The method response is passed from the back end through the associated // integration response that can be transformed using a mapping template. @@ -14435,7 +16941,9 @@ type MethodSnapshot struct { // Specifies whether the method requires a valid ApiKey. ApiKeyRequired *bool `locationName:"apiKeyRequired" type:"boolean"` - // Specifies the type of authorization used for the method. + // The method's authorization type. Valid values are NONE for open access, AWS_IAM + // for using AWS IAM permissions, CUSTOM for using a custom authorizer, or COGNITO_USER_POOLS + // for using a Cognito user pool. AuthorizationType *string `locationName:"authorizationType" type:"string"` } @@ -14562,7 +17070,10 @@ type PatchOperation struct { // op operation can have only one path associated with it. Path *string `locationName:"path" type:"string"` - // The new target value of the update operation. + // The new target value of the update operation. When using AWS CLI to update + // a property of a JSON value, enclose the JSON object with a pair of single + // quotes in a Linux shell, e.g., '{"a": ...}'. In a Windows shell, see Using + // JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json). Value *string `locationName:"value" type:"string"` } @@ -14943,7 +17454,9 @@ type PutMethodInput struct { // Specifies whether the method required a valid ApiKey. ApiKeyRequired *bool `locationName:"apiKeyRequired" type:"boolean"` - // Specifies the type of authorization used for the method. + // The method's authorization type. Valid values are NONE for open access, AWS_IAM + // for using AWS IAM permissions, CUSTOM for using a custom authorizer, or COGNITO_USER_POOLS + // for using a Cognito user pool. // // AuthorizationType is a required field AuthorizationType *string `locationName:"authorizationType" type:"string" required:"true"` @@ -14977,6 +17490,9 @@ type PutMethodInput struct { // integration request parameters or body-mapping templates. RequestParameters map[string]*bool `locationName:"requestParameters" type:"map"` + // The identifier of a RequestValidator for validating the method request. + RequestValidatorId *string `locationName:"requestValidatorId" type:"string"` + // The Resource identifier for the new Method resource. // // ResourceId is a required field @@ -15062,6 +17578,12 @@ func (s *PutMethodInput) SetRequestParameters(v map[string]*bool) *PutMethodInpu return s } +// SetRequestValidatorId sets the RequestValidatorId field's value. +func (s *PutMethodInput) SetRequestValidatorId(v string) *PutMethodInput { + s.RequestValidatorId = &v + return s +} + // SetResourceId sets the ResourceId field's value. func (s *PutMethodInput) SetResourceId(v string) *PutMethodInput { s.ResourceId = &v @@ -15343,8 +17865,8 @@ type Resource struct { // Request // // GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET HTTP/1.1 Content-Type: - // application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160608T031827Z - // Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160608/us-east-1/apigateway/aws4_request, + // application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20170223T031827Z + // Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20170223/us-east-1/apigateway/aws4_request, // SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash} // Response // @@ -15441,7 +17963,7 @@ type RestApi struct { // RestApi supports only UTF-8-encoded text payloads. BinaryMediaTypes []*string `locationName:"binaryMediaTypes" type:"list"` - // The date when the API was created, in ISO 8601 format (http://www.iso.org/iso/home/standards/iso8601.htm). + // The timestamp when the API was created. CreatedDate *time.Time `locationName:"createdDate" type:"timestamp" timestampFormat:"unix"` // The API's description. @@ -15645,7 +18167,7 @@ type Stage struct { // The identifier of a client certificate for an API stage. ClientCertificateId *string `locationName:"clientCertificateId" type:"string"` - // The date and time that the stage was created, in ISO 8601 format (http://www.iso.org/iso/home/standards/iso8601.htm). + // The timestamp when the stage was created. CreatedDate *time.Time `locationName:"createdDate" type:"timestamp" timestampFormat:"unix"` // The identifier of the Deployment that the stage points to. @@ -15657,8 +18179,7 @@ type Stage struct { // The version of the associated API documentation. DocumentationVersion *string `locationName:"documentationVersion" type:"string"` - // The date and time that information about the stage was last updated, in ISO - // 8601 format (http://www.iso.org/iso/home/standards/iso8601.htm). + // The timestamp when the stage last updated. LastUpdatedDate *time.Time `locationName:"lastUpdatedDate" type:"timestamp" timestampFormat:"unix"` // A map that defines the method settings for a Stage resource. Keys (designated @@ -17076,6 +19597,131 @@ func (s *UpdateModelInput) SetRestApiId(v string) *UpdateModelInput { return s } +// Updates a RequestValidator of a given RestApi. +type UpdateRequestValidatorInput struct { + _ struct{} `type:"structure"` + + // A list of update operations to be applied to the specified resource and in + // the order specified in this list. + PatchOperations []*PatchOperation `locationName:"patchOperations" type:"list"` + + // [Required] The identifier of RequestValidator to be updated. + // + // RequestValidatorId is a required field + RequestValidatorId *string `location:"uri" locationName:"requestvalidator_id" type:"string" required:"true"` + + // [Required] The identifier of the RestApi for which the given RequestValidator + // is updated. + // + // RestApiId is a required field + RestApiId *string `location:"uri" locationName:"restapi_id" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateRequestValidatorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRequestValidatorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateRequestValidatorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateRequestValidatorInput"} + if s.RequestValidatorId == nil { + invalidParams.Add(request.NewErrParamRequired("RequestValidatorId")) + } + if s.RestApiId == nil { + invalidParams.Add(request.NewErrParamRequired("RestApiId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPatchOperations sets the PatchOperations field's value. +func (s *UpdateRequestValidatorInput) SetPatchOperations(v []*PatchOperation) *UpdateRequestValidatorInput { + s.PatchOperations = v + return s +} + +// SetRequestValidatorId sets the RequestValidatorId field's value. +func (s *UpdateRequestValidatorInput) SetRequestValidatorId(v string) *UpdateRequestValidatorInput { + s.RequestValidatorId = &v + return s +} + +// SetRestApiId sets the RestApiId field's value. +func (s *UpdateRequestValidatorInput) SetRestApiId(v string) *UpdateRequestValidatorInput { + s.RestApiId = &v + return s +} + +// A set of validation rules for incoming Method requests. +// +// In Swagger, a RequestValidator of an API is defined by the x-amazon-apigateway-request-validators.requestValidator +// (http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions.html#api-gateway-swagger-extensions-request-validators.requestValidator.html) +// object. It the referenced using the x-amazon-apigateway-request-validator +// (http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions.html#api-gateway-swagger-extensions-request-validator) +// property. +// +// Enable Basic Request Validation in API Gateway (http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-request-validation.html) +type UpdateRequestValidatorOutput struct { + _ struct{} `type:"structure"` + + // The identifier of this RequestValidator. + Id *string `locationName:"id" type:"string"` + + // The name of this RequestValidator + Name *string `locationName:"name" type:"string"` + + // A Boolean flag to indicate whether to validate a request body according to + // the configured Model schema. + ValidateRequestBody *bool `locationName:"validateRequestBody" type:"boolean"` + + // A Boolean flag to indicate whether to validate request parameters (true) + // or not (false). + ValidateRequestParameters *bool `locationName:"validateRequestParameters" type:"boolean"` +} + +// String returns the string representation +func (s UpdateRequestValidatorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRequestValidatorOutput) GoString() string { + return s.String() +} + +// SetId sets the Id field's value. +func (s *UpdateRequestValidatorOutput) SetId(v string) *UpdateRequestValidatorOutput { + s.Id = &v + return s +} + +// SetName sets the Name field's value. +func (s *UpdateRequestValidatorOutput) SetName(v string) *UpdateRequestValidatorOutput { + s.Name = &v + return s +} + +// SetValidateRequestBody sets the ValidateRequestBody field's value. +func (s *UpdateRequestValidatorOutput) SetValidateRequestBody(v bool) *UpdateRequestValidatorOutput { + s.ValidateRequestBody = &v + return s +} + +// SetValidateRequestParameters sets the ValidateRequestParameters field's value. +func (s *UpdateRequestValidatorOutput) SetValidateRequestParameters(v bool) *UpdateRequestValidatorOutput { + s.ValidateRequestParameters = &v + return s +} + // Request to change information about a Resource resource. type UpdateResourceInput struct { _ struct{} `type:"structure"` diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/errors.go index b06644b71e..b8f2efc297 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package apigateway diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/service.go index 052f84a693..c544015c48 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/apigateway/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package apigateway diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/api.go index ba6abe54f5..24e9f5be38 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package applicationautoscaling provides a client for Application Auto Scaling. package applicationautoscaling @@ -7,6 +7,7 @@ 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" ) @@ -94,8 +95,23 @@ func (c *ApplicationAutoScaling) DeleteScalingPolicyRequest(input *DeleteScaling // Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScalingPolicy func (c *ApplicationAutoScaling) DeleteScalingPolicy(input *DeleteScalingPolicyInput) (*DeleteScalingPolicyOutput, error) { req, out := c.DeleteScalingPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteScalingPolicyWithContext is the same as DeleteScalingPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteScalingPolicy 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 *ApplicationAutoScaling) DeleteScalingPolicyWithContext(ctx aws.Context, input *DeleteScalingPolicyInput, opts ...request.Option) (*DeleteScalingPolicyOutput, error) { + req, out := c.DeleteScalingPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterScalableTarget = "DeregisterScalableTarget" @@ -180,8 +196,23 @@ func (c *ApplicationAutoScaling) DeregisterScalableTargetRequest(input *Deregist // Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeregisterScalableTarget func (c *ApplicationAutoScaling) DeregisterScalableTarget(input *DeregisterScalableTargetInput) (*DeregisterScalableTargetOutput, error) { req, out := c.DeregisterScalableTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterScalableTargetWithContext is the same as DeregisterScalableTarget with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterScalableTarget 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 *ApplicationAutoScaling) DeregisterScalableTargetWithContext(ctx aws.Context, input *DeregisterScalableTargetInput, opts ...request.Option) (*DeregisterScalableTargetOutput, error) { + req, out := c.DeregisterScalableTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeScalableTargets = "DescribeScalableTargets" @@ -269,8 +300,23 @@ func (c *ApplicationAutoScaling) DescribeScalableTargetsRequest(input *DescribeS // Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalableTargets func (c *ApplicationAutoScaling) DescribeScalableTargets(input *DescribeScalableTargetsInput) (*DescribeScalableTargetsOutput, error) { req, out := c.DescribeScalableTargetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeScalableTargetsWithContext is the same as DescribeScalableTargets with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeScalableTargets 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 *ApplicationAutoScaling) DescribeScalableTargetsWithContext(ctx aws.Context, input *DescribeScalableTargetsInput, opts ...request.Option) (*DescribeScalableTargetsOutput, error) { + req, out := c.DescribeScalableTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeScalableTargetsPages iterates over the pages of a DescribeScalableTargets operation, @@ -290,12 +336,37 @@ func (c *ApplicationAutoScaling) DescribeScalableTargets(input *DescribeScalable // return pageNum <= 3 // }) // -func (c *ApplicationAutoScaling) DescribeScalableTargetsPages(input *DescribeScalableTargetsInput, fn func(p *DescribeScalableTargetsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeScalableTargetsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeScalableTargetsOutput), lastPage) - }) +func (c *ApplicationAutoScaling) DescribeScalableTargetsPages(input *DescribeScalableTargetsInput, fn func(*DescribeScalableTargetsOutput, bool) bool) error { + return c.DescribeScalableTargetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeScalableTargetsPagesWithContext same as DescribeScalableTargetsPages 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 *ApplicationAutoScaling) DescribeScalableTargetsPagesWithContext(ctx aws.Context, input *DescribeScalableTargetsInput, fn func(*DescribeScalableTargetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeScalableTargetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeScalableTargetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeScalableTargetsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeScalingActivities = "DescribeScalingActivities" @@ -384,8 +455,23 @@ func (c *ApplicationAutoScaling) DescribeScalingActivitiesRequest(input *Describ // Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingActivities func (c *ApplicationAutoScaling) DescribeScalingActivities(input *DescribeScalingActivitiesInput) (*DescribeScalingActivitiesOutput, error) { req, out := c.DescribeScalingActivitiesRequest(input) - err := req.Send() - return out, err + 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 *ApplicationAutoScaling) 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, @@ -405,12 +491,37 @@ func (c *ApplicationAutoScaling) DescribeScalingActivities(input *DescribeScalin // return pageNum <= 3 // }) // -func (c *ApplicationAutoScaling) DescribeScalingActivitiesPages(input *DescribeScalingActivitiesInput, fn func(p *DescribeScalingActivitiesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeScalingActivitiesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeScalingActivitiesOutput), lastPage) - }) +func (c *ApplicationAutoScaling) 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 *ApplicationAutoScaling) 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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeScalingActivitiesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeScalingPolicies = "DescribeScalingPolicies" @@ -507,8 +618,23 @@ func (c *ApplicationAutoScaling) DescribeScalingPoliciesRequest(input *DescribeS // Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingPolicies func (c *ApplicationAutoScaling) DescribeScalingPolicies(input *DescribeScalingPoliciesInput) (*DescribeScalingPoliciesOutput, error) { req, out := c.DescribeScalingPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeScalingPoliciesWithContext is the same as DescribeScalingPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeScalingPolicies 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 *ApplicationAutoScaling) DescribeScalingPoliciesWithContext(ctx aws.Context, input *DescribeScalingPoliciesInput, opts ...request.Option) (*DescribeScalingPoliciesOutput, error) { + req, out := c.DescribeScalingPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeScalingPoliciesPages iterates over the pages of a DescribeScalingPolicies operation, @@ -528,12 +654,37 @@ func (c *ApplicationAutoScaling) DescribeScalingPolicies(input *DescribeScalingP // return pageNum <= 3 // }) // -func (c *ApplicationAutoScaling) DescribeScalingPoliciesPages(input *DescribeScalingPoliciesInput, fn func(p *DescribeScalingPoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeScalingPoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeScalingPoliciesOutput), lastPage) - }) +func (c *ApplicationAutoScaling) DescribeScalingPoliciesPages(input *DescribeScalingPoliciesInput, fn func(*DescribeScalingPoliciesOutput, bool) bool) error { + return c.DescribeScalingPoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeScalingPoliciesPagesWithContext same as DescribeScalingPoliciesPages 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 *ApplicationAutoScaling) DescribeScalingPoliciesPagesWithContext(ctx aws.Context, input *DescribeScalingPoliciesInput, fn func(*DescribeScalingPoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeScalingPoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeScalingPoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeScalingPoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opPutScalingPolicy = "PutScalingPolicy" @@ -630,8 +781,23 @@ func (c *ApplicationAutoScaling) PutScalingPolicyRequest(input *PutScalingPolicy // Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScalingPolicy func (c *ApplicationAutoScaling) PutScalingPolicy(input *PutScalingPolicyInput) (*PutScalingPolicyOutput, error) { req, out := c.PutScalingPolicyRequest(input) - err := req.Send() - return out, err + 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 *ApplicationAutoScaling) 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 opRegisterScalableTarget = "RegisterScalableTarget" @@ -716,8 +882,23 @@ func (c *ApplicationAutoScaling) RegisterScalableTargetRequest(input *RegisterSc // Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/RegisterScalableTarget func (c *ApplicationAutoScaling) RegisterScalableTarget(input *RegisterScalableTargetInput) (*RegisterScalableTargetOutput, error) { req, out := c.RegisterScalableTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterScalableTargetWithContext is the same as RegisterScalableTarget with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterScalableTarget 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 *ApplicationAutoScaling) RegisterScalableTargetWithContext(ctx aws.Context, input *RegisterScalableTargetInput, opts ...request.Option) (*RegisterScalableTargetOutput, error) { + req, out := c.RegisterScalableTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents a CloudWatch alarm associated with a scaling policy. @@ -779,6 +960,9 @@ type DeleteScalingPolicyInput struct { // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. + // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` @@ -793,6 +977,9 @@ type DeleteScalingPolicyInput struct { // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. + // // ScalableDimension is a required field ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"` @@ -897,6 +1084,9 @@ type DeregisterScalableTargetInput struct { // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. + // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` @@ -911,6 +1101,9 @@ type DeregisterScalableTargetInput struct { // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. + // // ScalableDimension is a required field ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"` @@ -1015,6 +1208,9 @@ type DescribeScalableTargetsInput struct { // // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. + // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. ResourceIds []*string `type:"list"` // The scalable dimension associated with the scalable target. This string consists @@ -1028,6 +1224,9 @@ type DescribeScalableTargetsInput struct { // // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. + // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. ScalableDimension *string `type:"string" enum:"ScalableDimension"` // The namespace of the AWS service. For more information, see AWS Service Namespaces @@ -1153,6 +1352,9 @@ type DescribeScalingActivitiesInput struct { // // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. + // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. ResourceId *string `min:"1" type:"string"` // The scalable dimension. This string consists of the service namespace, resource @@ -1166,6 +1368,9 @@ type DescribeScalingActivitiesInput struct { // // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. + // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. ScalableDimension *string `type:"string" enum:"ScalableDimension"` // The namespace of the AWS service. For more information, see AWS Service Namespaces @@ -1297,6 +1502,9 @@ type DescribeScalingPoliciesInput struct { // // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. + // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. ResourceId *string `min:"1" type:"string"` // The scalable dimension. This string consists of the service namespace, resource @@ -1310,6 +1518,9 @@ type DescribeScalingPoliciesInput struct { // // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. + // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. ScalableDimension *string `type:"string" enum:"ScalableDimension"` // The namespace of the AWS service. For more information, see AWS Service Namespaces @@ -1441,6 +1652,9 @@ type PutScalingPolicyInput struct { // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. + // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` @@ -1455,6 +1669,9 @@ type PutScalingPolicyInput struct { // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. + // // ScalableDimension is a required field ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"` @@ -1603,6 +1820,9 @@ type RegisterScalableTargetInput struct { // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. + // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` @@ -1622,6 +1842,9 @@ type RegisterScalableTargetInput struct { // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. + // // ScalableDimension is a required field ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"` @@ -1751,6 +1974,9 @@ type ScalableTarget struct { // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. + // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` @@ -1771,6 +1997,9 @@ type ScalableTarget struct { // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. + // // ScalableDimension is a required field ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"` @@ -1872,6 +2101,9 @@ type ScalingActivity struct { // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. + // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` @@ -1886,6 +2118,9 @@ type ScalingActivity struct { // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. + // // ScalableDimension is a required field ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"` @@ -2026,6 +2261,9 @@ type ScalingPolicy struct { // * EMR cluster - The resource type is instancegroup and the unique identifier // is the cluster ID and instance group ID. Example: instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0. // + // * AppStream 2.0 fleet - The resource type is fleet and the unique identifier + // is the fleet name. Example: fleet/sample-fleet. + // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` @@ -2040,6 +2278,9 @@ type ScalingPolicy struct { // * elasticmapreduce:instancegroup:InstanceCount - The instance count of // an EMR Instance Group. // + // * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream + // 2.0 fleet. + // // ScalableDimension is a required field ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"` @@ -2358,6 +2599,9 @@ const ( // ScalableDimensionElasticmapreduceInstancegroupInstanceCount is a ScalableDimension enum value ScalableDimensionElasticmapreduceInstancegroupInstanceCount = "elasticmapreduce:instancegroup:InstanceCount" + + // ScalableDimensionAppstreamFleetDesiredCapacity is a ScalableDimension enum value + ScalableDimensionAppstreamFleetDesiredCapacity = "appstream:fleet:DesiredCapacity" ) const ( @@ -2389,4 +2633,7 @@ const ( // ServiceNamespaceEc2 is a ServiceNamespace enum value ServiceNamespaceEc2 = "ec2" + + // ServiceNamespaceAppstream is a ServiceNamespace enum value + ServiceNamespaceAppstream = "appstream" ) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/errors.go index 019a4bfc41..a028955cc5 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package applicationautoscaling diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/service.go index 80a7498566..4ce02860e2 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/applicationautoscaling/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package applicationautoscaling @@ -35,6 +35,10 @@ import ( // in Amazon EMR (http://docs.aws.amazon.com/ElasticMapReduce/latest/ManagementGuide/emr-automatic-scaling.html) // in the Amazon EMR Management Guide. // +// * AppStream 2.0 fleets. For more information, see Autoscaling Amazon AppStream +// 2.0 Resources (http://docs.aws.amazon.com/appstream2/latest/developerguide/autoscaling.html) +// in the Amazon AppStream 2.0 Developer Guide. +// // For a list of supported regions, see AWS Regions and Endpoints: Application // Auto Scaling (http://docs.aws.amazon.com/general/latest/gr/rande.html#as-app_region) // in the AWS General Reference. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go index 64bb6017f9..a4512f9897 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package autoscaling provides a client for Auto Scaling. package autoscaling @@ -7,6 +7,7 @@ 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" @@ -91,8 +92,23 @@ func (c *AutoScaling) AttachInstancesRequest(input *AttachInstancesInput) (req * // Please also see 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) - err := req.Send() - return out, err + 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" @@ -164,8 +180,23 @@ func (c *AutoScaling) AttachLoadBalancerTargetGroupsRequest(input *AttachLoadBal // Please also see 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) - err := req.Send() - return out, err + 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" @@ -240,8 +271,23 @@ func (c *AutoScaling) AttachLoadBalancersRequest(input *AttachLoadBalancersInput // Please also see 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) - err := req.Send() - return out, err + 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 opCompleteLifecycleAction = "CompleteLifecycleAction" @@ -328,8 +374,23 @@ func (c *AutoScaling) CompleteLifecycleActionRequest(input *CompleteLifecycleAct // Please also see 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) - err := req.Send() - return out, err + 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" @@ -412,8 +473,23 @@ func (c *AutoScaling) CreateAutoScalingGroupRequest(input *CreateAutoScalingGrou // Please also see 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) - err := req.Send() - return out, err + 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" @@ -496,8 +572,23 @@ func (c *AutoScaling) CreateLaunchConfigurationRequest(input *CreateLaunchConfig // Please also see 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) - err := req.Send() - return out, err + 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" @@ -579,8 +670,23 @@ func (c *AutoScaling) CreateOrUpdateTagsRequest(input *CreateOrUpdateTagsInput) // Please also see 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) - err := req.Send() - return out, err + 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" @@ -668,8 +774,23 @@ func (c *AutoScaling) DeleteAutoScalingGroupRequest(input *DeleteAutoScalingGrou // Please also see 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) - err := req.Send() - return out, err + 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" @@ -743,8 +864,23 @@ func (c *AutoScaling) DeleteLaunchConfigurationRequest(input *DeleteLaunchConfig // Please also see 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) - err := req.Send() - return out, err + 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" @@ -812,8 +948,23 @@ func (c *AutoScaling) DeleteLifecycleHookRequest(input *DeleteLifecycleHookInput // Please also see 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) - err := req.Send() - return out, err + 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" @@ -880,8 +1031,23 @@ func (c *AutoScaling) DeleteNotificationConfigurationRequest(input *DeleteNotifi // Please also see 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) - err := req.Send() - return out, err + 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" @@ -951,8 +1117,23 @@ func (c *AutoScaling) DeletePolicyRequest(input *DeletePolicyInput) (req *reques // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1019,8 +1200,23 @@ func (c *AutoScaling) DeleteScheduledActionRequest(input *DeleteScheduledActionI // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1087,8 +1283,23 @@ func (c *AutoScaling) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Re // Please also see 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) - err := req.Send() - return out, err + 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 opDescribeAccountLimits = "DescribeAccountLimits" @@ -1157,8 +1368,23 @@ func (c *AutoScaling) DescribeAccountLimitsRequest(input *DescribeAccountLimitsI // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1223,8 +1449,23 @@ func (c *AutoScaling) DescribeAdjustmentTypesRequest(input *DescribeAdjustmentTy // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1298,8 +1539,23 @@ func (c *AutoScaling) DescribeAutoScalingGroupsRequest(input *DescribeAutoScalin // Please also see 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) - err := req.Send() - return out, err + 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, @@ -1319,12 +1575,37 @@ func (c *AutoScaling) DescribeAutoScalingGroups(input *DescribeAutoScalingGroups // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribeAutoScalingGroupsPages(input *DescribeAutoScalingGroupsInput, fn func(p *DescribeAutoScalingGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeAutoScalingGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeAutoScalingGroupsOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeAutoScalingGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeAutoScalingInstances = "DescribeAutoScalingInstances" @@ -1398,8 +1679,23 @@ func (c *AutoScaling) DescribeAutoScalingInstancesRequest(input *DescribeAutoSca // Please also see 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) - err := req.Send() - return out, err + 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, @@ -1419,12 +1715,37 @@ func (c *AutoScaling) DescribeAutoScalingInstances(input *DescribeAutoScalingIns // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribeAutoScalingInstancesPages(input *DescribeAutoScalingInstancesInput, fn func(p *DescribeAutoScalingInstancesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeAutoScalingInstancesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeAutoScalingInstancesOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeAutoScalingInstancesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeAutoScalingNotificationTypes = "DescribeAutoScalingNotificationTypes" @@ -1489,8 +1810,23 @@ func (c *AutoScaling) DescribeAutoScalingNotificationTypesRequest(input *Describ // Please also see 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) - err := req.Send() - return out, err + 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 opDescribeLaunchConfigurations = "DescribeLaunchConfigurations" @@ -1564,8 +1900,23 @@ func (c *AutoScaling) DescribeLaunchConfigurationsRequest(input *DescribeLaunchC // Please also see 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) - err := req.Send() - return out, err + 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, @@ -1585,12 +1936,37 @@ func (c *AutoScaling) DescribeLaunchConfigurations(input *DescribeLaunchConfigur // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribeLaunchConfigurationsPages(input *DescribeLaunchConfigurationsInput, fn func(p *DescribeLaunchConfigurationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeLaunchConfigurationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeLaunchConfigurationsOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeLaunchConfigurationsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeLifecycleHookTypes = "DescribeLifecycleHookTypes" @@ -1655,8 +2031,23 @@ func (c *AutoScaling) DescribeLifecycleHookTypesRequest(input *DescribeLifecycle // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1721,8 +2112,23 @@ func (c *AutoScaling) DescribeLifecycleHooksRequest(input *DescribeLifecycleHook // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1787,8 +2193,23 @@ func (c *AutoScaling) DescribeLoadBalancerTargetGroupsRequest(input *DescribeLoa // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1856,8 +2277,23 @@ func (c *AutoScaling) DescribeLoadBalancersRequest(input *DescribeLoadBalancersI // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1925,8 +2361,23 @@ func (c *AutoScaling) DescribeMetricCollectionTypesRequest(input *DescribeMetric // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2001,8 +2452,23 @@ func (c *AutoScaling) DescribeNotificationConfigurationsRequest(input *DescribeN // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2022,12 +2488,37 @@ func (c *AutoScaling) DescribeNotificationConfigurations(input *DescribeNotifica // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribeNotificationConfigurationsPages(input *DescribeNotificationConfigurationsInput, fn func(p *DescribeNotificationConfigurationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeNotificationConfigurationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeNotificationConfigurationsOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeNotificationConfigurationsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribePolicies = "DescribePolicies" @@ -2101,8 +2592,23 @@ func (c *AutoScaling) DescribePoliciesRequest(input *DescribePoliciesInput) (req // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2122,12 +2628,37 @@ func (c *AutoScaling) DescribePolicies(input *DescribePoliciesInput) (*DescribeP // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribePoliciesPages(input *DescribePoliciesInput, fn func(p *DescribePoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribePoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribePoliciesOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribePoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeScalingActivities = "DescribeScalingActivities" @@ -2201,8 +2732,23 @@ func (c *AutoScaling) DescribeScalingActivitiesRequest(input *DescribeScalingAct // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2222,12 +2768,37 @@ func (c *AutoScaling) DescribeScalingActivities(input *DescribeScalingActivities // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribeScalingActivitiesPages(input *DescribeScalingActivitiesInput, fn func(p *DescribeScalingActivitiesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeScalingActivitiesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeScalingActivitiesOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeScalingActivitiesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeScalingProcessTypes = "DescribeScalingProcessTypes" @@ -2292,8 +2863,23 @@ func (c *AutoScaling) DescribeScalingProcessTypesRequest(input *DescribeScalingP // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2368,8 +2954,23 @@ func (c *AutoScaling) DescribeScheduledActionsRequest(input *DescribeScheduledAc // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2389,12 +2990,37 @@ func (c *AutoScaling) DescribeScheduledActions(input *DescribeScheduledActionsIn // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribeScheduledActionsPages(input *DescribeScheduledActionsInput, fn func(p *DescribeScheduledActionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeScheduledActionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeScheduledActionsOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeScheduledActionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeTags = "DescribeTags" @@ -2477,8 +3103,23 @@ func (c *AutoScaling) DescribeTagsRequest(input *DescribeTagsInput) (req *reques // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2498,12 +3139,37 @@ func (c *AutoScaling) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutpu // return pageNum <= 3 // }) // -func (c *AutoScaling) DescribeTagsPages(input *DescribeTagsInput, fn func(p *DescribeTagsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeTagsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeTagsOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTagsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeTerminationPolicyTypes = "DescribeTerminationPolicyTypes" @@ -2568,8 +3234,23 @@ func (c *AutoScaling) DescribeTerminationPolicyTypesRequest(input *DescribeTermi // Please also see 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) - err := req.Send() - return out, err + 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 opDetachInstances = "DetachInstances" @@ -2649,8 +3330,23 @@ func (c *AutoScaling) DetachInstancesRequest(input *DetachInstancesInput) (req * // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2715,8 +3411,23 @@ func (c *AutoScaling) DetachLoadBalancerTargetGroupsRequest(input *DetachLoadBal // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2790,8 +3501,23 @@ func (c *AutoScaling) DetachLoadBalancersRequest(input *DetachLoadBalancersInput // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2858,8 +3584,23 @@ func (c *AutoScaling) DisableMetricsCollectionRequest(input *DisableMetricsColle // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2928,8 +3669,23 @@ func (c *AutoScaling) EnableMetricsCollectionRequest(input *EnableMetricsCollect // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2997,8 +3753,23 @@ func (c *AutoScaling) EnterStandbyRequest(input *EnterStandbyInput) (req *reques // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3069,8 +3840,23 @@ func (c *AutoScaling) ExecutePolicyRequest(input *ExecutePolicyInput) (req *requ // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3138,8 +3924,23 @@ func (c *AutoScaling) ExitStandbyRequest(input *ExitStandbyInput) (req *request. // Please also see 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) - err := req.Send() - return out, err + 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 opPutLifecycleHook = "PutLifecycleHook" @@ -3239,8 +4040,23 @@ func (c *AutoScaling) PutLifecycleHookRequest(input *PutLifecycleHookInput) (req // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3320,8 +4136,23 @@ func (c *AutoScaling) PutNotificationConfigurationRequest(input *PutNotification // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3399,8 +4230,23 @@ func (c *AutoScaling) PutScalingPolicyRequest(input *PutScalingPolicyInput) (req // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3481,8 +4327,23 @@ func (c *AutoScaling) PutScheduledUpdateGroupActionRequest(input *PutScheduledUp // Please also see 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) - err := req.Send() - return out, err + 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 opRecordLifecycleActionHeartbeat = "RecordLifecycleActionHeartbeat" @@ -3570,8 +4431,23 @@ func (c *AutoScaling) RecordLifecycleActionHeartbeatRequest(input *RecordLifecyc // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3646,8 +4522,23 @@ func (c *AutoScaling) ResumeProcessesRequest(input *ScalingProcessQuery) (req *r // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3721,8 +4612,23 @@ func (c *AutoScaling) SetDesiredCapacityRequest(input *SetDesiredCapacityInput) // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3792,8 +4698,23 @@ func (c *AutoScaling) SetInstanceHealthRequest(input *SetInstanceHealthInput) (r // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3866,8 +4787,23 @@ func (c *AutoScaling) SetInstanceProtectionRequest(input *SetInstanceProtectionI // Please also see 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) - err := req.Send() - return out, err + 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 opSuspendProcesses = "SuspendProcesses" @@ -3947,8 +4883,23 @@ func (c *AutoScaling) SuspendProcessesRequest(input *ScalingProcessQuery) (req * // Please also see 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) - err := req.Send() - return out, err + 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" @@ -4021,8 +4972,23 @@ func (c *AutoScaling) TerminateInstanceInAutoScalingGroupRequest(input *Terminat // Please also see 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) - err := req.Send() - return out, err + 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" @@ -4116,8 +5082,23 @@ func (c *AutoScaling) UpdateAutoScalingGroupRequest(input *UpdateAutoScalingGrou // Please also see 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) - err := req.Send() - return out, err + 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() } // Describes scaling activity, which is a long-running process that represents diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go index 227e6b3b33..68ab1e3c12 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package autoscaling diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go index 98e1bb4adb..752375f1fe 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package autoscaling diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go index 15a9fd86ef..1b1c5a3a18 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/autoscaling/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package autoscaling import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilGroupExists uses the Auto Scaling API operation @@ -11,32 +14,50 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *AutoScaling) WaitUntilGroupExists(input *DescribeAutoScalingGroupsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeAutoScalingGroups", - Delay: 5, + 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, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "length(AutoScalingGroups) > `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(AutoScalingGroups) > `0`", Expected: true, }, { - State: "retry", - Matcher: "path", - Argument: "length(AutoScalingGroups) > `0`", + 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...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilGroupInService uses the Auto Scaling API operation @@ -44,32 +65,50 @@ func (c *AutoScaling) WaitUntilGroupExists(input *DescribeAutoScalingGroupsInput // If the condition is not meet within the max attempt window an error will // be returned. func (c *AutoScaling) WaitUntilGroupInService(input *DescribeAutoScalingGroupsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeAutoScalingGroups", - Delay: 15, + 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, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)", Expected: false, }, { - State: "retry", - Matcher: "path", - Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `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...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilGroupNotExists uses the Auto Scaling API operation @@ -77,30 +116,48 @@ func (c *AutoScaling) WaitUntilGroupInService(input *DescribeAutoScalingGroupsIn // If the condition is not meet within the max attempt window an error will // be returned. func (c *AutoScaling) WaitUntilGroupNotExists(input *DescribeAutoScalingGroupsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeAutoScalingGroups", - Delay: 15, + 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, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "length(AutoScalingGroups) > `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(AutoScalingGroups) > `0`", Expected: false, }, { - State: "retry", - Matcher: "path", - Argument: "length(AutoScalingGroups) > `0`", + 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...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go index be60e851f1..37b1eabbe3 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package cloudformation provides a client for AWS CloudFormation. package cloudformation @@ -6,6 +6,7 @@ package cloudformation import ( "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" @@ -73,8 +74,23 @@ func (c *CloudFormation) CancelUpdateStackRequest(input *CancelUpdateStackInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CancelUpdateStack func (c *CloudFormation) CancelUpdateStack(input *CancelUpdateStackInput) (*CancelUpdateStackOutput, error) { req, out := c.CancelUpdateStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelUpdateStackWithContext is the same as CancelUpdateStack with the addition of +// the ability to pass a context and additional request options. +// +// See CancelUpdateStack 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 *CloudFormation) CancelUpdateStackWithContext(ctx aws.Context, input *CancelUpdateStackInput, opts ...request.Option) (*CancelUpdateStackOutput, error) { + req, out := c.CancelUpdateStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opContinueUpdateRollback = "ContinueUpdateRollback" @@ -145,8 +161,23 @@ func (c *CloudFormation) ContinueUpdateRollbackRequest(input *ContinueUpdateRoll // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ContinueUpdateRollback func (c *CloudFormation) ContinueUpdateRollback(input *ContinueUpdateRollbackInput) (*ContinueUpdateRollbackOutput, error) { req, out := c.ContinueUpdateRollbackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ContinueUpdateRollbackWithContext is the same as ContinueUpdateRollback with the addition of +// the ability to pass a context and additional request options. +// +// See ContinueUpdateRollback 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 *CloudFormation) ContinueUpdateRollbackWithContext(ctx aws.Context, input *ContinueUpdateRollbackInput, opts ...request.Option) (*ContinueUpdateRollbackOutput, error) { + req, out := c.ContinueUpdateRollbackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateChangeSet = "CreateChangeSet" @@ -230,8 +261,23 @@ func (c *CloudFormation) CreateChangeSetRequest(input *CreateChangeSetInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateChangeSet func (c *CloudFormation) CreateChangeSet(input *CreateChangeSetInput) (*CreateChangeSetOutput, error) { req, out := c.CreateChangeSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateChangeSetWithContext is the same as CreateChangeSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateChangeSet 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 *CloudFormation) CreateChangeSetWithContext(ctx aws.Context, input *CreateChangeSetInput, opts ...request.Option) (*CreateChangeSetOutput, error) { + req, out := c.CreateChangeSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateStack = "CreateStack" @@ -304,8 +350,23 @@ func (c *CloudFormation) CreateStackRequest(input *CreateStackInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStack func (c *CloudFormation) CreateStack(input *CreateStackInput) (*CreateStackOutput, error) { req, out := c.CreateStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateStackWithContext is the same as CreateStack with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStack 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 *CloudFormation) CreateStackWithContext(ctx aws.Context, input *CreateStackInput, opts ...request.Option) (*CreateStackOutput, error) { + req, out := c.CreateStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteChangeSet = "DeleteChangeSet" @@ -375,8 +436,23 @@ func (c *CloudFormation) DeleteChangeSetRequest(input *DeleteChangeSetInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteChangeSet func (c *CloudFormation) DeleteChangeSet(input *DeleteChangeSetInput) (*DeleteChangeSetOutput, error) { req, out := c.DeleteChangeSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteChangeSetWithContext is the same as DeleteChangeSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteChangeSet 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 *CloudFormation) DeleteChangeSetWithContext(ctx aws.Context, input *DeleteChangeSetInput, opts ...request.Option) (*DeleteChangeSetOutput, error) { + req, out := c.DeleteChangeSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteStack = "DeleteStack" @@ -439,8 +515,23 @@ func (c *CloudFormation) DeleteStackRequest(input *DeleteStackInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStack func (c *CloudFormation) DeleteStack(input *DeleteStackInput) (*DeleteStackOutput, error) { req, out := c.DeleteStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteStackWithContext is the same as DeleteStack with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteStack 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 *CloudFormation) DeleteStackWithContext(ctx aws.Context, input *DeleteStackInput, opts ...request.Option) (*DeleteStackOutput, error) { + req, out := c.DeleteStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAccountLimits = "DescribeAccountLimits" @@ -500,8 +591,23 @@ func (c *CloudFormation) DescribeAccountLimitsRequest(input *DescribeAccountLimi // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeAccountLimits func (c *CloudFormation) DescribeAccountLimits(input *DescribeAccountLimitsInput) (*DescribeAccountLimitsOutput, error) { req, out := c.DescribeAccountLimitsRequest(input) - err := req.Send() - return out, err + 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 *CloudFormation) 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 opDescribeChangeSet = "DescribeChangeSet" @@ -569,8 +675,23 @@ func (c *CloudFormation) DescribeChangeSetRequest(input *DescribeChangeSetInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeChangeSet func (c *CloudFormation) DescribeChangeSet(input *DescribeChangeSetInput) (*DescribeChangeSetOutput, error) { req, out := c.DescribeChangeSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeChangeSetWithContext is the same as DescribeChangeSet with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeChangeSet 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 *CloudFormation) DescribeChangeSetWithContext(ctx aws.Context, input *DescribeChangeSetInput, opts ...request.Option) (*DescribeChangeSetOutput, error) { + req, out := c.DescribeChangeSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStackEvents = "DescribeStackEvents" @@ -640,8 +761,23 @@ func (c *CloudFormation) DescribeStackEventsRequest(input *DescribeStackEventsIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackEvents func (c *CloudFormation) DescribeStackEvents(input *DescribeStackEventsInput) (*DescribeStackEventsOutput, error) { req, out := c.DescribeStackEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStackEventsWithContext is the same as DescribeStackEvents with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStackEvents 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 *CloudFormation) DescribeStackEventsWithContext(ctx aws.Context, input *DescribeStackEventsInput, opts ...request.Option) (*DescribeStackEventsOutput, error) { + req, out := c.DescribeStackEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeStackEventsPages iterates over the pages of a DescribeStackEvents operation, @@ -661,12 +797,37 @@ func (c *CloudFormation) DescribeStackEvents(input *DescribeStackEventsInput) (* // return pageNum <= 3 // }) // -func (c *CloudFormation) DescribeStackEventsPages(input *DescribeStackEventsInput, fn func(p *DescribeStackEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeStackEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeStackEventsOutput), lastPage) - }) +func (c *CloudFormation) DescribeStackEventsPages(input *DescribeStackEventsInput, fn func(*DescribeStackEventsOutput, bool) bool) error { + return c.DescribeStackEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeStackEventsPagesWithContext same as DescribeStackEventsPages 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 *CloudFormation) DescribeStackEventsPagesWithContext(ctx aws.Context, input *DescribeStackEventsInput, fn func(*DescribeStackEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeStackEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStackEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeStackEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeStackResource = "DescribeStackResource" @@ -728,8 +889,23 @@ func (c *CloudFormation) DescribeStackResourceRequest(input *DescribeStackResour // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResource func (c *CloudFormation) DescribeStackResource(input *DescribeStackResourceInput) (*DescribeStackResourceOutput, error) { req, out := c.DescribeStackResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStackResourceWithContext is the same as DescribeStackResource with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStackResource 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 *CloudFormation) DescribeStackResourceWithContext(ctx aws.Context, input *DescribeStackResourceInput, opts ...request.Option) (*DescribeStackResourceOutput, error) { + req, out := c.DescribeStackResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStackResources = "DescribeStackResources" @@ -805,8 +981,23 @@ func (c *CloudFormation) DescribeStackResourcesRequest(input *DescribeStackResou // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResources func (c *CloudFormation) DescribeStackResources(input *DescribeStackResourcesInput) (*DescribeStackResourcesOutput, error) { req, out := c.DescribeStackResourcesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStackResourcesWithContext is the same as DescribeStackResources with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStackResources 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 *CloudFormation) DescribeStackResourcesWithContext(ctx aws.Context, input *DescribeStackResourcesInput, opts ...request.Option) (*DescribeStackResourcesOutput, error) { + req, out := c.DescribeStackResourcesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStacks = "DescribeStacks" @@ -874,8 +1065,23 @@ func (c *CloudFormation) DescribeStacksRequest(input *DescribeStacksInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStacks func (c *CloudFormation) DescribeStacks(input *DescribeStacksInput) (*DescribeStacksOutput, error) { req, out := c.DescribeStacksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStacksWithContext is the same as DescribeStacks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStacks 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 *CloudFormation) DescribeStacksWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.Option) (*DescribeStacksOutput, error) { + req, out := c.DescribeStacksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeStacksPages iterates over the pages of a DescribeStacks operation, @@ -895,12 +1101,37 @@ func (c *CloudFormation) DescribeStacks(input *DescribeStacksInput) (*DescribeSt // return pageNum <= 3 // }) // -func (c *CloudFormation) DescribeStacksPages(input *DescribeStacksInput, fn func(p *DescribeStacksOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeStacksRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeStacksOutput), lastPage) - }) +func (c *CloudFormation) DescribeStacksPages(input *DescribeStacksInput, fn func(*DescribeStacksOutput, bool) bool) error { + return c.DescribeStacksPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeStacksPagesWithContext same as DescribeStacksPages 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 *CloudFormation) DescribeStacksPagesWithContext(ctx aws.Context, input *DescribeStacksInput, fn func(*DescribeStacksOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeStacksOutput), !p.HasNextPage()) + } + return p.Err() } const opEstimateTemplateCost = "EstimateTemplateCost" @@ -961,8 +1192,23 @@ func (c *CloudFormation) EstimateTemplateCostRequest(input *EstimateTemplateCost // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/EstimateTemplateCost func (c *CloudFormation) EstimateTemplateCost(input *EstimateTemplateCostInput) (*EstimateTemplateCostOutput, error) { req, out := c.EstimateTemplateCostRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EstimateTemplateCostWithContext is the same as EstimateTemplateCost with the addition of +// the ability to pass a context and additional request options. +// +// See EstimateTemplateCost 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 *CloudFormation) EstimateTemplateCostWithContext(ctx aws.Context, input *EstimateTemplateCostInput, opts ...request.Option) (*EstimateTemplateCostOutput, error) { + req, out := c.EstimateTemplateCostRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opExecuteChangeSet = "ExecuteChangeSet" @@ -1047,8 +1293,23 @@ func (c *CloudFormation) ExecuteChangeSetRequest(input *ExecuteChangeSetInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ExecuteChangeSet func (c *CloudFormation) ExecuteChangeSet(input *ExecuteChangeSetInput) (*ExecuteChangeSetOutput, error) { req, out := c.ExecuteChangeSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ExecuteChangeSetWithContext is the same as ExecuteChangeSet with the addition of +// the ability to pass a context and additional request options. +// +// See ExecuteChangeSet 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 *CloudFormation) ExecuteChangeSetWithContext(ctx aws.Context, input *ExecuteChangeSetInput, opts ...request.Option) (*ExecuteChangeSetOutput, error) { + req, out := c.ExecuteChangeSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetStackPolicy = "GetStackPolicy" @@ -1108,8 +1369,23 @@ func (c *CloudFormation) GetStackPolicyRequest(input *GetStackPolicyInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetStackPolicy func (c *CloudFormation) GetStackPolicy(input *GetStackPolicyInput) (*GetStackPolicyOutput, error) { req, out := c.GetStackPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetStackPolicyWithContext is the same as GetStackPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetStackPolicy 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 *CloudFormation) GetStackPolicyWithContext(ctx aws.Context, input *GetStackPolicyInput, opts ...request.Option) (*GetStackPolicyOutput, error) { + req, out := c.GetStackPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTemplate = "GetTemplate" @@ -1180,8 +1456,23 @@ func (c *CloudFormation) GetTemplateRequest(input *GetTemplateInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplate func (c *CloudFormation) GetTemplate(input *GetTemplateInput) (*GetTemplateOutput, error) { req, out := c.GetTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTemplateWithContext is the same as GetTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See GetTemplate 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 *CloudFormation) GetTemplateWithContext(ctx aws.Context, input *GetTemplateInput, opts ...request.Option) (*GetTemplateOutput, error) { + req, out := c.GetTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTemplateSummary = "GetTemplateSummary" @@ -1249,8 +1540,23 @@ func (c *CloudFormation) GetTemplateSummaryRequest(input *GetTemplateSummaryInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplateSummary func (c *CloudFormation) GetTemplateSummary(input *GetTemplateSummaryInput) (*GetTemplateSummaryOutput, error) { req, out := c.GetTemplateSummaryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTemplateSummaryWithContext is the same as GetTemplateSummary with the addition of +// the ability to pass a context and additional request options. +// +// See GetTemplateSummary 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 *CloudFormation) GetTemplateSummaryWithContext(ctx aws.Context, input *GetTemplateSummaryInput, opts ...request.Option) (*GetTemplateSummaryOutput, error) { + req, out := c.GetTemplateSummaryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListChangeSets = "ListChangeSets" @@ -1311,8 +1617,23 @@ func (c *CloudFormation) ListChangeSetsRequest(input *ListChangeSetsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListChangeSets func (c *CloudFormation) ListChangeSets(input *ListChangeSetsInput) (*ListChangeSetsOutput, error) { req, out := c.ListChangeSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListChangeSetsWithContext is the same as ListChangeSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListChangeSets 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 *CloudFormation) ListChangeSetsWithContext(ctx aws.Context, input *ListChangeSetsInput, opts ...request.Option) (*ListChangeSetsOutput, error) { + req, out := c.ListChangeSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListExports = "ListExports" @@ -1347,6 +1668,12 @@ func (c *CloudFormation) ListExportsRequest(input *ListExportsInput) (req *reque Name: opListExports, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -1377,8 +1704,73 @@ func (c *CloudFormation) ListExportsRequest(input *ListExportsInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListExports func (c *CloudFormation) ListExports(input *ListExportsInput) (*ListExportsOutput, error) { req, out := c.ListExportsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListExportsWithContext is the same as ListExports with the addition of +// the ability to pass a context and additional request options. +// +// See ListExports 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 *CloudFormation) ListExportsWithContext(ctx aws.Context, input *ListExportsInput, opts ...request.Option) (*ListExportsOutput, error) { + req, out := c.ListExportsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListExportsPages iterates over the pages of a ListExports operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListExports 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 ListExports operation. +// pageNum := 0 +// err := client.ListExportsPages(params, +// func(page *ListExportsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CloudFormation) ListExportsPages(input *ListExportsInput, fn func(*ListExportsOutput, bool) bool) error { + return c.ListExportsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListExportsPagesWithContext same as ListExportsPages 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 *CloudFormation) ListExportsPagesWithContext(ctx aws.Context, input *ListExportsInput, fn func(*ListExportsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListExportsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListExportsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListExportsOutput), !p.HasNextPage()) + } + return p.Err() } const opListImports = "ListImports" @@ -1413,6 +1805,12 @@ func (c *CloudFormation) ListImportsRequest(input *ListImportsInput) (req *reque Name: opListImports, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -1443,8 +1841,73 @@ func (c *CloudFormation) ListImportsRequest(input *ListImportsInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListImports func (c *CloudFormation) ListImports(input *ListImportsInput) (*ListImportsOutput, error) { req, out := c.ListImportsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListImportsWithContext is the same as ListImports with the addition of +// the ability to pass a context and additional request options. +// +// See ListImports 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 *CloudFormation) ListImportsWithContext(ctx aws.Context, input *ListImportsInput, opts ...request.Option) (*ListImportsOutput, error) { + req, out := c.ListImportsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListImportsPages iterates over the pages of a ListImports operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListImports 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 ListImports operation. +// pageNum := 0 +// err := client.ListImportsPages(params, +// func(page *ListImportsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CloudFormation) ListImportsPages(input *ListImportsInput, fn func(*ListImportsOutput, bool) bool) error { + return c.ListImportsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListImportsPagesWithContext same as ListImportsPages 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 *CloudFormation) ListImportsPagesWithContext(ctx aws.Context, input *ListImportsInput, fn func(*ListImportsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListImportsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListImportsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListImportsOutput), !p.HasNextPage()) + } + return p.Err() } const opListStackResources = "ListStackResources" @@ -1512,8 +1975,23 @@ func (c *CloudFormation) ListStackResourcesRequest(input *ListStackResourcesInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackResources func (c *CloudFormation) ListStackResources(input *ListStackResourcesInput) (*ListStackResourcesOutput, error) { req, out := c.ListStackResourcesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListStackResourcesWithContext is the same as ListStackResources with the addition of +// the ability to pass a context and additional request options. +// +// See ListStackResources 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 *CloudFormation) ListStackResourcesWithContext(ctx aws.Context, input *ListStackResourcesInput, opts ...request.Option) (*ListStackResourcesOutput, error) { + req, out := c.ListStackResourcesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListStackResourcesPages iterates over the pages of a ListStackResources operation, @@ -1533,12 +2011,37 @@ func (c *CloudFormation) ListStackResources(input *ListStackResourcesInput) (*Li // return pageNum <= 3 // }) // -func (c *CloudFormation) ListStackResourcesPages(input *ListStackResourcesInput, fn func(p *ListStackResourcesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListStackResourcesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListStackResourcesOutput), lastPage) - }) +func (c *CloudFormation) ListStackResourcesPages(input *ListStackResourcesInput, fn func(*ListStackResourcesOutput, bool) bool) error { + return c.ListStackResourcesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListStackResourcesPagesWithContext same as ListStackResourcesPages 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 *CloudFormation) ListStackResourcesPagesWithContext(ctx aws.Context, input *ListStackResourcesInput, fn func(*ListStackResourcesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListStackResourcesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListStackResourcesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListStackResourcesOutput), !p.HasNextPage()) + } + return p.Err() } const opListStacks = "ListStacks" @@ -1607,8 +2110,23 @@ func (c *CloudFormation) ListStacksRequest(input *ListStacksInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStacks func (c *CloudFormation) ListStacks(input *ListStacksInput) (*ListStacksOutput, error) { req, out := c.ListStacksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListStacksWithContext is the same as ListStacks with the addition of +// the ability to pass a context and additional request options. +// +// See ListStacks 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 *CloudFormation) ListStacksWithContext(ctx aws.Context, input *ListStacksInput, opts ...request.Option) (*ListStacksOutput, error) { + req, out := c.ListStacksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListStacksPages iterates over the pages of a ListStacks operation, @@ -1628,12 +2146,37 @@ func (c *CloudFormation) ListStacks(input *ListStacksInput) (*ListStacksOutput, // return pageNum <= 3 // }) // -func (c *CloudFormation) ListStacksPages(input *ListStacksInput, fn func(p *ListStacksOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListStacksRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListStacksOutput), lastPage) - }) +func (c *CloudFormation) ListStacksPages(input *ListStacksInput, fn func(*ListStacksOutput, bool) bool) error { + return c.ListStacksPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListStacksPagesWithContext same as ListStacksPages 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 *CloudFormation) ListStacksPagesWithContext(ctx aws.Context, input *ListStacksInput, fn func(*ListStacksOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListStacksOutput), !p.HasNextPage()) + } + return p.Err() } const opSetStackPolicy = "SetStackPolicy" @@ -1694,8 +2237,23 @@ func (c *CloudFormation) SetStackPolicyRequest(input *SetStackPolicyInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SetStackPolicy func (c *CloudFormation) SetStackPolicy(input *SetStackPolicyInput) (*SetStackPolicyOutput, error) { req, out := c.SetStackPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetStackPolicyWithContext is the same as SetStackPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See SetStackPolicy 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 *CloudFormation) SetStackPolicyWithContext(ctx aws.Context, input *SetStackPolicyInput, opts ...request.Option) (*SetStackPolicyOutput, error) { + req, out := c.SetStackPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSignalResource = "SignalResource" @@ -1761,8 +2319,23 @@ func (c *CloudFormation) SignalResourceRequest(input *SignalResourceInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SignalResource func (c *CloudFormation) SignalResource(input *SignalResourceInput) (*SignalResourceOutput, error) { req, out := c.SignalResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SignalResourceWithContext is the same as SignalResource with the addition of +// the ability to pass a context and additional request options. +// +// See SignalResource 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 *CloudFormation) SignalResourceWithContext(ctx aws.Context, input *SignalResourceInput, opts ...request.Option) (*SignalResourceOutput, error) { + req, out := c.SignalResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateStack = "UpdateStack" @@ -1835,8 +2408,23 @@ func (c *CloudFormation) UpdateStackRequest(input *UpdateStackInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStack func (c *CloudFormation) UpdateStack(input *UpdateStackInput) (*UpdateStackOutput, error) { req, out := c.UpdateStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateStackWithContext is the same as UpdateStack with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateStack 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 *CloudFormation) UpdateStackWithContext(ctx aws.Context, input *UpdateStackInput, opts ...request.Option) (*UpdateStackOutput, error) { + req, out := c.UpdateStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opValidateTemplate = "ValidateTemplate" @@ -1898,8 +2486,23 @@ func (c *CloudFormation) ValidateTemplateRequest(input *ValidateTemplateInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ValidateTemplate func (c *CloudFormation) ValidateTemplate(input *ValidateTemplateInput) (*ValidateTemplateOutput, error) { req, out := c.ValidateTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ValidateTemplateWithContext is the same as ValidateTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See ValidateTemplate 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 *CloudFormation) ValidateTemplateWithContext(ctx aws.Context, input *ValidateTemplateInput, opts ...request.Option) (*ValidateTemplateOutput, error) { + req, out := c.ValidateTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // The AccountLimit data type. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/errors.go index 29fae92219..b49437e313 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudformation diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go index 0591a3204e..12883f60a7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudformation diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go index 5960e94439..e4454d381e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudformation/waiters.go @@ -1,72 +1,144 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudformation import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) +// WaitUntilChangeSetCreateComplete uses the AWS CloudFormation API operation +// DescribeChangeSet to wait for a condition to be met before returning. +// If the condition is not meet within the max attempt window an error will +// be returned. +func (c *CloudFormation) WaitUntilChangeSetCreateComplete(input *DescribeChangeSetInput) error { + return c.WaitUntilChangeSetCreateCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilChangeSetCreateCompleteWithContext is an extended version of WaitUntilChangeSetCreateComplete. +// 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 *CloudFormation) WaitUntilChangeSetCreateCompleteWithContext(ctx aws.Context, input *DescribeChangeSetInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilChangeSetCreateComplete", + MaxAttempts: 120, + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Status", + Expected: "CREATE_COMPLETE", + }, + { + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Status", + Expected: "FAILED", + }, + { + State: request.FailureWaiterState, + Matcher: request.ErrorWaiterMatch, + Expected: "ValidationError", + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeChangeSetInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeChangeSetRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + // WaitUntilStackCreateComplete uses the AWS CloudFormation API operation // DescribeStacks to wait for a condition to be met before returning. // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeStacks", - Delay: 30, + return c.WaitUntilStackCreateCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackCreateCompleteWithContext is an extended version of WaitUntilStackCreateComplete. +// 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 *CloudFormation) WaitUntilStackCreateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilStackCreateComplete", MaxAttempts: 120, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Stacks[].StackStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "CREATE_COMPLETE", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "CREATE_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "DELETE_COMPLETE", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "DELETE_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "ROLLBACK_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "ROLLBACK_COMPLETE", }, { - State: "failure", - Matcher: "error", - Argument: "", + State: request.FailureWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ValidationError", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilStackDeleteComplete uses the AWS CloudFormation API operation @@ -74,62 +146,75 @@ func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeStacks", - Delay: 30, + return c.WaitUntilStackDeleteCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackDeleteCompleteWithContext is an extended version of WaitUntilStackDeleteComplete. +// 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 *CloudFormation) WaitUntilStackDeleteCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilStackDeleteComplete", MaxAttempts: 120, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Stacks[].StackStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "DELETE_COMPLETE", }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ValidationError", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "DELETE_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "CREATE_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "ROLLBACK_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "UPDATE_ROLLBACK_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "UPDATE_ROLLBACK_IN_PROGRESS", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilStackExists uses the AWS CloudFormation API operation @@ -137,32 +222,50 @@ func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeStacks", - Delay: 5, + return c.WaitUntilStackExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackExistsWithContext is an extended version of WaitUntilStackExists. +// 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 *CloudFormation) WaitUntilStackExistsWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilStackExists", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ValidationError", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilStackUpdateComplete uses the AWS CloudFormation API operation @@ -170,48 +273,63 @@ func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudFormation) WaitUntilStackUpdateComplete(input *DescribeStacksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeStacks", - Delay: 30, + return c.WaitUntilStackUpdateCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackUpdateCompleteWithContext is an extended version of WaitUntilStackUpdateComplete. +// 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 *CloudFormation) WaitUntilStackUpdateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilStackUpdateComplete", MaxAttempts: 120, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Stacks[].StackStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "UPDATE_COMPLETE", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "UPDATE_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "UPDATE_ROLLBACK_FAILED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Stacks[].StackStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", Expected: "UPDATE_ROLLBACK_COMPLETE", }, { - State: "failure", - Matcher: "error", - Argument: "", + State: request.FailureWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ValidationError", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/api.go index 17a7eb51af..f0168c0cfe 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package cloudfront provides a client for Amazon CloudFront. package cloudfront @@ -7,13 +7,14 @@ 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/restxml" ) -const opCreateCloudFrontOriginAccessIdentity = "CreateCloudFrontOriginAccessIdentity2016_11_25" +const opCreateCloudFrontOriginAccessIdentity = "CreateCloudFrontOriginAccessIdentity2017_03_25" // CreateCloudFrontOriginAccessIdentityRequest generates a "aws/request.Request" representing the // client's request for the CreateCloudFrontOriginAccessIdentity operation. The "output" return @@ -39,12 +40,12 @@ const opCreateCloudFrontOriginAccessIdentity = "CreateCloudFrontOriginAccessIden // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateCloudFrontOriginAccessIdentity func (c *CloudFront) CreateCloudFrontOriginAccessIdentityRequest(input *CreateCloudFrontOriginAccessIdentityInput) (req *request.Request, output *CreateCloudFrontOriginAccessIdentityOutput) { op := &request.Operation{ Name: opCreateCloudFrontOriginAccessIdentity, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/origin-access-identity/cloudfront", + HTTPPath: "/2017-03-25/origin-access-identity/cloudfront", } if input == nil { @@ -93,14 +94,29 @@ func (c *CloudFront) CreateCloudFrontOriginAccessIdentityRequest(input *CreateCl // * ErrCodeInconsistentQuantities "InconsistentQuantities" // The value of Quantity and the size of Items do not match. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateCloudFrontOriginAccessIdentity func (c *CloudFront) CreateCloudFrontOriginAccessIdentity(input *CreateCloudFrontOriginAccessIdentityInput) (*CreateCloudFrontOriginAccessIdentityOutput, error) { req, out := c.CreateCloudFrontOriginAccessIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opCreateDistribution = "CreateDistribution2016_11_25" +// CreateCloudFrontOriginAccessIdentityWithContext is the same as CreateCloudFrontOriginAccessIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCloudFrontOriginAccessIdentity 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 *CloudFront) CreateCloudFrontOriginAccessIdentityWithContext(ctx aws.Context, input *CreateCloudFrontOriginAccessIdentityInput, opts ...request.Option) (*CreateCloudFrontOriginAccessIdentityOutput, error) { + req, out := c.CreateCloudFrontOriginAccessIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateDistribution = "CreateDistribution2017_03_25" // CreateDistributionRequest generates a "aws/request.Request" representing the // client's request for the CreateDistribution operation. The "output" return @@ -126,12 +142,12 @@ const opCreateDistribution = "CreateDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistribution func (c *CloudFront) CreateDistributionRequest(input *CreateDistributionInput) (req *request.Request, output *CreateDistributionOutput) { op := &request.Operation{ Name: opCreateDistribution, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/distribution", + HTTPPath: "/2017-03-25/distribution", } if input == nil { @@ -145,7 +161,7 @@ func (c *CloudFront) CreateDistributionRequest(input *CreateDistributionInput) ( // CreateDistribution API operation for Amazon CloudFront. // -// Creates a new web distribution. Send a GET request to the /CloudFront API +// Creates a new web distribution. Send a POST request to the /CloudFront API // version/distribution/distribution ID resource. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -270,14 +286,33 @@ func (c *CloudFront) CreateDistributionRequest(input *CreateDistributionInput) ( // * ErrCodeInvalidLambdaFunctionAssociation "InvalidLambdaFunctionAssociation" // The specified Lambda function association is invalid. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistribution +// * ErrCodeInvalidOriginReadTimeout "InvalidOriginReadTimeout" +// +// * ErrCodeInvalidOriginKeepaliveTimeout "InvalidOriginKeepaliveTimeout" +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistribution func (c *CloudFront) CreateDistribution(input *CreateDistributionInput) (*CreateDistributionOutput, error) { req, out := c.CreateDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDistributionWithContext is the same as CreateDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDistribution 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 *CloudFront) CreateDistributionWithContext(ctx aws.Context, input *CreateDistributionInput, opts ...request.Option) (*CreateDistributionOutput, error) { + req, out := c.CreateDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opCreateDistributionWithTags = "CreateDistributionWithTags2016_11_25" +const opCreateDistributionWithTags = "CreateDistributionWithTags2017_03_25" // CreateDistributionWithTagsRequest generates a "aws/request.Request" representing the // client's request for the CreateDistributionWithTags operation. The "output" return @@ -303,12 +338,12 @@ const opCreateDistributionWithTags = "CreateDistributionWithTags2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistributionWithTags +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistributionWithTags func (c *CloudFront) CreateDistributionWithTagsRequest(input *CreateDistributionWithTagsInput) (req *request.Request, output *CreateDistributionWithTagsOutput) { op := &request.Operation{ Name: opCreateDistributionWithTags, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/distribution?WithTags", + HTTPPath: "/2017-03-25/distribution?WithTags", } if input == nil { @@ -448,14 +483,33 @@ func (c *CloudFront) CreateDistributionWithTagsRequest(input *CreateDistribution // * ErrCodeInvalidLambdaFunctionAssociation "InvalidLambdaFunctionAssociation" // The specified Lambda function association is invalid. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistributionWithTags +// * ErrCodeInvalidOriginReadTimeout "InvalidOriginReadTimeout" +// +// * ErrCodeInvalidOriginKeepaliveTimeout "InvalidOriginKeepaliveTimeout" +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistributionWithTags func (c *CloudFront) CreateDistributionWithTags(input *CreateDistributionWithTagsInput) (*CreateDistributionWithTagsOutput, error) { req, out := c.CreateDistributionWithTagsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDistributionWithTagsWithContext is the same as CreateDistributionWithTags with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDistributionWithTags 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 *CloudFront) CreateDistributionWithTagsWithContext(ctx aws.Context, input *CreateDistributionWithTagsInput, opts ...request.Option) (*CreateDistributionWithTagsOutput, error) { + req, out := c.CreateDistributionWithTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opCreateInvalidation = "CreateInvalidation2016_11_25" +const opCreateInvalidation = "CreateInvalidation2017_03_25" // CreateInvalidationRequest generates a "aws/request.Request" representing the // client's request for the CreateInvalidation operation. The "output" return @@ -481,12 +535,12 @@ const opCreateInvalidation = "CreateInvalidation2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateInvalidation +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateInvalidation func (c *CloudFront) CreateInvalidationRequest(input *CreateInvalidationInput) (req *request.Request, output *CreateInvalidationOutput) { op := &request.Operation{ Name: opCreateInvalidation, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/distribution/{DistributionId}/invalidation", + HTTPPath: "/2017-03-25/distribution/{DistributionId}/invalidation", } if input == nil { @@ -532,14 +586,29 @@ func (c *CloudFront) CreateInvalidationRequest(input *CreateInvalidationInput) ( // * ErrCodeInconsistentQuantities "InconsistentQuantities" // The value of Quantity and the size of Items do not match. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateInvalidation +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateInvalidation func (c *CloudFront) CreateInvalidation(input *CreateInvalidationInput) (*CreateInvalidationOutput, error) { req, out := c.CreateInvalidationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInvalidationWithContext is the same as CreateInvalidation with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInvalidation 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 *CloudFront) CreateInvalidationWithContext(ctx aws.Context, input *CreateInvalidationInput, opts ...request.Option) (*CreateInvalidationOutput, error) { + req, out := c.CreateInvalidationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opCreateStreamingDistribution = "CreateStreamingDistribution2016_11_25" +const opCreateStreamingDistribution = "CreateStreamingDistribution2017_03_25" // CreateStreamingDistributionRequest generates a "aws/request.Request" representing the // client's request for the CreateStreamingDistribution operation. The "output" return @@ -565,12 +634,12 @@ const opCreateStreamingDistribution = "CreateStreamingDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistribution func (c *CloudFront) CreateStreamingDistributionRequest(input *CreateStreamingDistributionInput) (req *request.Request, output *CreateStreamingDistributionOutput) { op := &request.Operation{ Name: opCreateStreamingDistribution, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/streaming-distribution", + HTTPPath: "/2017-03-25/streaming-distribution", } if input == nil { @@ -657,14 +726,29 @@ func (c *CloudFront) CreateStreamingDistributionRequest(input *CreateStreamingDi // * ErrCodeInconsistentQuantities "InconsistentQuantities" // The value of Quantity and the size of Items do not match. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistribution func (c *CloudFront) CreateStreamingDistribution(input *CreateStreamingDistributionInput) (*CreateStreamingDistributionOutput, error) { req, out := c.CreateStreamingDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opCreateStreamingDistributionWithTags = "CreateStreamingDistributionWithTags2016_11_25" +// CreateStreamingDistributionWithContext is the same as CreateStreamingDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStreamingDistribution 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 *CloudFront) CreateStreamingDistributionWithContext(ctx aws.Context, input *CreateStreamingDistributionInput, opts ...request.Option) (*CreateStreamingDistributionOutput, error) { + req, out := c.CreateStreamingDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateStreamingDistributionWithTags = "CreateStreamingDistributionWithTags2017_03_25" // CreateStreamingDistributionWithTagsRequest generates a "aws/request.Request" representing the // client's request for the CreateStreamingDistributionWithTags operation. The "output" return @@ -690,12 +774,12 @@ const opCreateStreamingDistributionWithTags = "CreateStreamingDistributionWithTa // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistributionWithTags +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistributionWithTags func (c *CloudFront) CreateStreamingDistributionWithTagsRequest(input *CreateStreamingDistributionWithTagsInput) (req *request.Request, output *CreateStreamingDistributionWithTagsOutput) { op := &request.Operation{ Name: opCreateStreamingDistributionWithTags, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/streaming-distribution?WithTags", + HTTPPath: "/2017-03-25/streaming-distribution?WithTags", } if input == nil { @@ -757,14 +841,29 @@ func (c *CloudFront) CreateStreamingDistributionWithTagsRequest(input *CreateStr // // * ErrCodeInvalidTagging "InvalidTagging" // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistributionWithTags +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistributionWithTags func (c *CloudFront) CreateStreamingDistributionWithTags(input *CreateStreamingDistributionWithTagsInput) (*CreateStreamingDistributionWithTagsOutput, error) { req, out := c.CreateStreamingDistributionWithTagsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateStreamingDistributionWithTagsWithContext is the same as CreateStreamingDistributionWithTags with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStreamingDistributionWithTags 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 *CloudFront) CreateStreamingDistributionWithTagsWithContext(ctx aws.Context, input *CreateStreamingDistributionWithTagsInput, opts ...request.Option) (*CreateStreamingDistributionWithTagsOutput, error) { + req, out := c.CreateStreamingDistributionWithTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opDeleteCloudFrontOriginAccessIdentity = "DeleteCloudFrontOriginAccessIdentity2016_11_25" +const opDeleteCloudFrontOriginAccessIdentity = "DeleteCloudFrontOriginAccessIdentity2017_03_25" // DeleteCloudFrontOriginAccessIdentityRequest generates a "aws/request.Request" representing the // client's request for the DeleteCloudFrontOriginAccessIdentity operation. The "output" return @@ -790,12 +889,12 @@ const opDeleteCloudFrontOriginAccessIdentity = "DeleteCloudFrontOriginAccessIden // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteCloudFrontOriginAccessIdentity func (c *CloudFront) DeleteCloudFrontOriginAccessIdentityRequest(input *DeleteCloudFrontOriginAccessIdentityInput) (req *request.Request, output *DeleteCloudFrontOriginAccessIdentityOutput) { op := &request.Operation{ Name: opDeleteCloudFrontOriginAccessIdentity, HTTPMethod: "DELETE", - HTTPPath: "/2016-11-25/origin-access-identity/cloudfront/{Id}", + HTTPPath: "/2017-03-25/origin-access-identity/cloudfront/{Id}", } if input == nil { @@ -836,14 +935,29 @@ func (c *CloudFront) DeleteCloudFrontOriginAccessIdentityRequest(input *DeleteCl // // * ErrCodeOriginAccessIdentityInUse "OriginAccessIdentityInUse" // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteCloudFrontOriginAccessIdentity func (c *CloudFront) DeleteCloudFrontOriginAccessIdentity(input *DeleteCloudFrontOriginAccessIdentityInput) (*DeleteCloudFrontOriginAccessIdentityOutput, error) { req, out := c.DeleteCloudFrontOriginAccessIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opDeleteDistribution = "DeleteDistribution2016_11_25" +// DeleteCloudFrontOriginAccessIdentityWithContext is the same as DeleteCloudFrontOriginAccessIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCloudFrontOriginAccessIdentity 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 *CloudFront) DeleteCloudFrontOriginAccessIdentityWithContext(ctx aws.Context, input *DeleteCloudFrontOriginAccessIdentityInput, opts ...request.Option) (*DeleteCloudFrontOriginAccessIdentityOutput, error) { + req, out := c.DeleteCloudFrontOriginAccessIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDistribution = "DeleteDistribution2017_03_25" // DeleteDistributionRequest generates a "aws/request.Request" representing the // client's request for the DeleteDistribution operation. The "output" return @@ -869,12 +983,12 @@ const opDeleteDistribution = "DeleteDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteDistribution func (c *CloudFront) DeleteDistributionRequest(input *DeleteDistributionInput) (req *request.Request, output *DeleteDistributionOutput) { op := &request.Operation{ Name: opDeleteDistribution, HTTPMethod: "DELETE", - HTTPPath: "/2016-11-25/distribution/{Id}", + HTTPPath: "/2017-03-25/distribution/{Id}", } if input == nil { @@ -915,14 +1029,29 @@ func (c *CloudFront) DeleteDistributionRequest(input *DeleteDistributionInput) ( // The precondition given in one or more of the request-header fields evaluated // to false. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteDistribution func (c *CloudFront) DeleteDistribution(input *DeleteDistributionInput) (*DeleteDistributionOutput, error) { req, out := c.DeleteDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opDeleteStreamingDistribution = "DeleteStreamingDistribution2016_11_25" +// DeleteDistributionWithContext is the same as DeleteDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDistribution 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 *CloudFront) DeleteDistributionWithContext(ctx aws.Context, input *DeleteDistributionInput, opts ...request.Option) (*DeleteDistributionOutput, error) { + req, out := c.DeleteDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteStreamingDistribution = "DeleteStreamingDistribution2017_03_25" // DeleteStreamingDistributionRequest generates a "aws/request.Request" representing the // client's request for the DeleteStreamingDistribution operation. The "output" return @@ -948,12 +1077,12 @@ const opDeleteStreamingDistribution = "DeleteStreamingDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteStreamingDistribution func (c *CloudFront) DeleteStreamingDistributionRequest(input *DeleteStreamingDistributionInput) (req *request.Request, output *DeleteStreamingDistributionOutput) { op := &request.Operation{ Name: opDeleteStreamingDistribution, HTTPMethod: "DELETE", - HTTPPath: "/2016-11-25/streaming-distribution/{Id}", + HTTPPath: "/2017-03-25/streaming-distribution/{Id}", } if input == nil { @@ -1029,14 +1158,29 @@ func (c *CloudFront) DeleteStreamingDistributionRequest(input *DeleteStreamingDi // The precondition given in one or more of the request-header fields evaluated // to false. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteStreamingDistribution func (c *CloudFront) DeleteStreamingDistribution(input *DeleteStreamingDistributionInput) (*DeleteStreamingDistributionOutput, error) { req, out := c.DeleteStreamingDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opGetCloudFrontOriginAccessIdentity = "GetCloudFrontOriginAccessIdentity2016_11_25" +// DeleteStreamingDistributionWithContext is the same as DeleteStreamingDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteStreamingDistribution 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 *CloudFront) DeleteStreamingDistributionWithContext(ctx aws.Context, input *DeleteStreamingDistributionInput, opts ...request.Option) (*DeleteStreamingDistributionOutput, error) { + req, out := c.DeleteStreamingDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetCloudFrontOriginAccessIdentity = "GetCloudFrontOriginAccessIdentity2017_03_25" // GetCloudFrontOriginAccessIdentityRequest generates a "aws/request.Request" representing the // client's request for the GetCloudFrontOriginAccessIdentity operation. The "output" return @@ -1062,12 +1206,12 @@ const opGetCloudFrontOriginAccessIdentity = "GetCloudFrontOriginAccessIdentity20 // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentity func (c *CloudFront) GetCloudFrontOriginAccessIdentityRequest(input *GetCloudFrontOriginAccessIdentityInput) (req *request.Request, output *GetCloudFrontOriginAccessIdentityOutput) { op := &request.Operation{ Name: opGetCloudFrontOriginAccessIdentity, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/origin-access-identity/cloudfront/{Id}", + HTTPPath: "/2017-03-25/origin-access-identity/cloudfront/{Id}", } if input == nil { @@ -1097,14 +1241,29 @@ func (c *CloudFront) GetCloudFrontOriginAccessIdentityRequest(input *GetCloudFro // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentity func (c *CloudFront) GetCloudFrontOriginAccessIdentity(input *GetCloudFrontOriginAccessIdentityInput) (*GetCloudFrontOriginAccessIdentityOutput, error) { req, out := c.GetCloudFrontOriginAccessIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCloudFrontOriginAccessIdentityWithContext is the same as GetCloudFrontOriginAccessIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See GetCloudFrontOriginAccessIdentity 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 *CloudFront) GetCloudFrontOriginAccessIdentityWithContext(ctx aws.Context, input *GetCloudFrontOriginAccessIdentityInput, opts ...request.Option) (*GetCloudFrontOriginAccessIdentityOutput, error) { + req, out := c.GetCloudFrontOriginAccessIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opGetCloudFrontOriginAccessIdentityConfig = "GetCloudFrontOriginAccessIdentityConfig2016_11_25" +const opGetCloudFrontOriginAccessIdentityConfig = "GetCloudFrontOriginAccessIdentityConfig2017_03_25" // GetCloudFrontOriginAccessIdentityConfigRequest generates a "aws/request.Request" representing the // client's request for the GetCloudFrontOriginAccessIdentityConfig operation. The "output" return @@ -1130,12 +1289,12 @@ const opGetCloudFrontOriginAccessIdentityConfig = "GetCloudFrontOriginAccessIden // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentityConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentityConfig func (c *CloudFront) GetCloudFrontOriginAccessIdentityConfigRequest(input *GetCloudFrontOriginAccessIdentityConfigInput) (req *request.Request, output *GetCloudFrontOriginAccessIdentityConfigOutput) { op := &request.Operation{ Name: opGetCloudFrontOriginAccessIdentityConfig, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/origin-access-identity/cloudfront/{Id}/config", + HTTPPath: "/2017-03-25/origin-access-identity/cloudfront/{Id}/config", } if input == nil { @@ -1165,14 +1324,29 @@ func (c *CloudFront) GetCloudFrontOriginAccessIdentityConfigRequest(input *GetCl // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentityConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentityConfig func (c *CloudFront) GetCloudFrontOriginAccessIdentityConfig(input *GetCloudFrontOriginAccessIdentityConfigInput) (*GetCloudFrontOriginAccessIdentityConfigOutput, error) { req, out := c.GetCloudFrontOriginAccessIdentityConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCloudFrontOriginAccessIdentityConfigWithContext is the same as GetCloudFrontOriginAccessIdentityConfig with the addition of +// the ability to pass a context and additional request options. +// +// See GetCloudFrontOriginAccessIdentityConfig 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 *CloudFront) GetCloudFrontOriginAccessIdentityConfigWithContext(ctx aws.Context, input *GetCloudFrontOriginAccessIdentityConfigInput, opts ...request.Option) (*GetCloudFrontOriginAccessIdentityConfigOutput, error) { + req, out := c.GetCloudFrontOriginAccessIdentityConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opGetDistribution = "GetDistribution2016_11_25" +const opGetDistribution = "GetDistribution2017_03_25" // GetDistributionRequest generates a "aws/request.Request" representing the // client's request for the GetDistribution operation. The "output" return @@ -1198,12 +1372,12 @@ const opGetDistribution = "GetDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistribution func (c *CloudFront) GetDistributionRequest(input *GetDistributionInput) (req *request.Request, output *GetDistributionOutput) { op := &request.Operation{ Name: opGetDistribution, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/distribution/{Id}", + HTTPPath: "/2017-03-25/distribution/{Id}", } if input == nil { @@ -1233,14 +1407,29 @@ func (c *CloudFront) GetDistributionRequest(input *GetDistributionInput) (req *r // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistribution func (c *CloudFront) GetDistribution(input *GetDistributionInput) (*GetDistributionOutput, error) { req, out := c.GetDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opGetDistributionConfig = "GetDistributionConfig2016_11_25" +// GetDistributionWithContext is the same as GetDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See GetDistribution 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 *CloudFront) GetDistributionWithContext(ctx aws.Context, input *GetDistributionInput, opts ...request.Option) (*GetDistributionOutput, error) { + req, out := c.GetDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetDistributionConfig = "GetDistributionConfig2017_03_25" // GetDistributionConfigRequest generates a "aws/request.Request" representing the // client's request for the GetDistributionConfig operation. The "output" return @@ -1266,12 +1455,12 @@ const opGetDistributionConfig = "GetDistributionConfig2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistributionConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistributionConfig func (c *CloudFront) GetDistributionConfigRequest(input *GetDistributionConfigInput) (req *request.Request, output *GetDistributionConfigOutput) { op := &request.Operation{ Name: opGetDistributionConfig, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/distribution/{Id}/config", + HTTPPath: "/2017-03-25/distribution/{Id}/config", } if input == nil { @@ -1301,14 +1490,29 @@ func (c *CloudFront) GetDistributionConfigRequest(input *GetDistributionConfigIn // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistributionConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistributionConfig func (c *CloudFront) GetDistributionConfig(input *GetDistributionConfigInput) (*GetDistributionConfigOutput, error) { req, out := c.GetDistributionConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opGetInvalidation = "GetInvalidation2016_11_25" +// GetDistributionConfigWithContext is the same as GetDistributionConfig with the addition of +// the ability to pass a context and additional request options. +// +// See GetDistributionConfig 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 *CloudFront) GetDistributionConfigWithContext(ctx aws.Context, input *GetDistributionConfigInput, opts ...request.Option) (*GetDistributionConfigOutput, error) { + req, out := c.GetDistributionConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetInvalidation = "GetInvalidation2017_03_25" // GetInvalidationRequest generates a "aws/request.Request" representing the // client's request for the GetInvalidation operation. The "output" return @@ -1334,12 +1538,12 @@ const opGetInvalidation = "GetInvalidation2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetInvalidation +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetInvalidation func (c *CloudFront) GetInvalidationRequest(input *GetInvalidationInput) (req *request.Request, output *GetInvalidationOutput) { op := &request.Operation{ Name: opGetInvalidation, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/distribution/{DistributionId}/invalidation/{Id}", + HTTPPath: "/2017-03-25/distribution/{DistributionId}/invalidation/{Id}", } if input == nil { @@ -1372,14 +1576,29 @@ func (c *CloudFront) GetInvalidationRequest(input *GetInvalidationInput) (req *r // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetInvalidation +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetInvalidation func (c *CloudFront) GetInvalidation(input *GetInvalidationInput) (*GetInvalidationOutput, error) { req, out := c.GetInvalidationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInvalidationWithContext is the same as GetInvalidation with the addition of +// the ability to pass a context and additional request options. +// +// See GetInvalidation 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 *CloudFront) GetInvalidationWithContext(ctx aws.Context, input *GetInvalidationInput, opts ...request.Option) (*GetInvalidationOutput, error) { + req, out := c.GetInvalidationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opGetStreamingDistribution = "GetStreamingDistribution2016_11_25" +const opGetStreamingDistribution = "GetStreamingDistribution2017_03_25" // GetStreamingDistributionRequest generates a "aws/request.Request" representing the // client's request for the GetStreamingDistribution operation. The "output" return @@ -1405,12 +1624,12 @@ const opGetStreamingDistribution = "GetStreamingDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistribution func (c *CloudFront) GetStreamingDistributionRequest(input *GetStreamingDistributionInput) (req *request.Request, output *GetStreamingDistributionOutput) { op := &request.Operation{ Name: opGetStreamingDistribution, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/streaming-distribution/{Id}", + HTTPPath: "/2017-03-25/streaming-distribution/{Id}", } if input == nil { @@ -1441,14 +1660,29 @@ func (c *CloudFront) GetStreamingDistributionRequest(input *GetStreamingDistribu // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistribution func (c *CloudFront) GetStreamingDistribution(input *GetStreamingDistributionInput) (*GetStreamingDistributionOutput, error) { req, out := c.GetStreamingDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetStreamingDistributionWithContext is the same as GetStreamingDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See GetStreamingDistribution 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 *CloudFront) GetStreamingDistributionWithContext(ctx aws.Context, input *GetStreamingDistributionInput, opts ...request.Option) (*GetStreamingDistributionOutput, error) { + req, out := c.GetStreamingDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opGetStreamingDistributionConfig = "GetStreamingDistributionConfig2016_11_25" +const opGetStreamingDistributionConfig = "GetStreamingDistributionConfig2017_03_25" // GetStreamingDistributionConfigRequest generates a "aws/request.Request" representing the // client's request for the GetStreamingDistributionConfig operation. The "output" return @@ -1474,12 +1708,12 @@ const opGetStreamingDistributionConfig = "GetStreamingDistributionConfig2016_11_ // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistributionConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistributionConfig func (c *CloudFront) GetStreamingDistributionConfigRequest(input *GetStreamingDistributionConfigInput) (req *request.Request, output *GetStreamingDistributionConfigOutput) { op := &request.Operation{ Name: opGetStreamingDistributionConfig, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/streaming-distribution/{Id}/config", + HTTPPath: "/2017-03-25/streaming-distribution/{Id}/config", } if input == nil { @@ -1509,14 +1743,29 @@ func (c *CloudFront) GetStreamingDistributionConfigRequest(input *GetStreamingDi // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistributionConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistributionConfig func (c *CloudFront) GetStreamingDistributionConfig(input *GetStreamingDistributionConfigInput) (*GetStreamingDistributionConfigOutput, error) { req, out := c.GetStreamingDistributionConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opListCloudFrontOriginAccessIdentities = "ListCloudFrontOriginAccessIdentities2016_11_25" +// GetStreamingDistributionConfigWithContext is the same as GetStreamingDistributionConfig with the addition of +// the ability to pass a context and additional request options. +// +// See GetStreamingDistributionConfig 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 *CloudFront) GetStreamingDistributionConfigWithContext(ctx aws.Context, input *GetStreamingDistributionConfigInput, opts ...request.Option) (*GetStreamingDistributionConfigOutput, error) { + req, out := c.GetStreamingDistributionConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListCloudFrontOriginAccessIdentities = "ListCloudFrontOriginAccessIdentities2017_03_25" // ListCloudFrontOriginAccessIdentitiesRequest generates a "aws/request.Request" representing the // client's request for the ListCloudFrontOriginAccessIdentities operation. The "output" return @@ -1542,12 +1791,12 @@ const opListCloudFrontOriginAccessIdentities = "ListCloudFrontOriginAccessIdenti // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListCloudFrontOriginAccessIdentities +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListCloudFrontOriginAccessIdentities func (c *CloudFront) ListCloudFrontOriginAccessIdentitiesRequest(input *ListCloudFrontOriginAccessIdentitiesInput) (req *request.Request, output *ListCloudFrontOriginAccessIdentitiesOutput) { op := &request.Operation{ Name: opListCloudFrontOriginAccessIdentities, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/origin-access-identity/cloudfront", + HTTPPath: "/2017-03-25/origin-access-identity/cloudfront", Paginator: &request.Paginator{ InputTokens: []string{"Marker"}, OutputTokens: []string{"CloudFrontOriginAccessIdentityList.NextMarker"}, @@ -1580,11 +1829,26 @@ func (c *CloudFront) ListCloudFrontOriginAccessIdentitiesRequest(input *ListClou // * ErrCodeInvalidArgument "InvalidArgument" // The argument is invalid. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListCloudFrontOriginAccessIdentities +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListCloudFrontOriginAccessIdentities func (c *CloudFront) ListCloudFrontOriginAccessIdentities(input *ListCloudFrontOriginAccessIdentitiesInput) (*ListCloudFrontOriginAccessIdentitiesOutput, error) { req, out := c.ListCloudFrontOriginAccessIdentitiesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListCloudFrontOriginAccessIdentitiesWithContext is the same as ListCloudFrontOriginAccessIdentities with the addition of +// the ability to pass a context and additional request options. +// +// See ListCloudFrontOriginAccessIdentities 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 *CloudFront) ListCloudFrontOriginAccessIdentitiesWithContext(ctx aws.Context, input *ListCloudFrontOriginAccessIdentitiesInput, opts ...request.Option) (*ListCloudFrontOriginAccessIdentitiesOutput, error) { + req, out := c.ListCloudFrontOriginAccessIdentitiesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListCloudFrontOriginAccessIdentitiesPages iterates over the pages of a ListCloudFrontOriginAccessIdentities operation, @@ -1604,15 +1868,40 @@ func (c *CloudFront) ListCloudFrontOriginAccessIdentities(input *ListCloudFrontO // return pageNum <= 3 // }) // -func (c *CloudFront) ListCloudFrontOriginAccessIdentitiesPages(input *ListCloudFrontOriginAccessIdentitiesInput, fn func(p *ListCloudFrontOriginAccessIdentitiesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListCloudFrontOriginAccessIdentitiesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListCloudFrontOriginAccessIdentitiesOutput), lastPage) - }) +func (c *CloudFront) ListCloudFrontOriginAccessIdentitiesPages(input *ListCloudFrontOriginAccessIdentitiesInput, fn func(*ListCloudFrontOriginAccessIdentitiesOutput, bool) bool) error { + return c.ListCloudFrontOriginAccessIdentitiesPagesWithContext(aws.BackgroundContext(), input, fn) } -const opListDistributions = "ListDistributions2016_11_25" +// ListCloudFrontOriginAccessIdentitiesPagesWithContext same as ListCloudFrontOriginAccessIdentitiesPages 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 *CloudFront) ListCloudFrontOriginAccessIdentitiesPagesWithContext(ctx aws.Context, input *ListCloudFrontOriginAccessIdentitiesInput, fn func(*ListCloudFrontOriginAccessIdentitiesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListCloudFrontOriginAccessIdentitiesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListCloudFrontOriginAccessIdentitiesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListCloudFrontOriginAccessIdentitiesOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListDistributions = "ListDistributions2017_03_25" // ListDistributionsRequest generates a "aws/request.Request" representing the // client's request for the ListDistributions operation. The "output" return @@ -1638,12 +1927,12 @@ const opListDistributions = "ListDistributions2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributions +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributions func (c *CloudFront) ListDistributionsRequest(input *ListDistributionsInput) (req *request.Request, output *ListDistributionsOutput) { op := &request.Operation{ Name: opListDistributions, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/distribution", + HTTPPath: "/2017-03-25/distribution", Paginator: &request.Paginator{ InputTokens: []string{"Marker"}, OutputTokens: []string{"DistributionList.NextMarker"}, @@ -1676,11 +1965,26 @@ func (c *CloudFront) ListDistributionsRequest(input *ListDistributionsInput) (re // * ErrCodeInvalidArgument "InvalidArgument" // The argument is invalid. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributions +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributions func (c *CloudFront) ListDistributions(input *ListDistributionsInput) (*ListDistributionsOutput, error) { req, out := c.ListDistributionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDistributionsWithContext is the same as ListDistributions with the addition of +// the ability to pass a context and additional request options. +// +// See ListDistributions 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 *CloudFront) ListDistributionsWithContext(ctx aws.Context, input *ListDistributionsInput, opts ...request.Option) (*ListDistributionsOutput, error) { + req, out := c.ListDistributionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListDistributionsPages iterates over the pages of a ListDistributions operation, @@ -1700,15 +2004,40 @@ func (c *CloudFront) ListDistributions(input *ListDistributionsInput) (*ListDist // return pageNum <= 3 // }) // -func (c *CloudFront) ListDistributionsPages(input *ListDistributionsInput, fn func(p *ListDistributionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListDistributionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListDistributionsOutput), lastPage) - }) +func (c *CloudFront) ListDistributionsPages(input *ListDistributionsInput, fn func(*ListDistributionsOutput, bool) bool) error { + return c.ListDistributionsPagesWithContext(aws.BackgroundContext(), input, fn) } -const opListDistributionsByWebACLId = "ListDistributionsByWebACLId2016_11_25" +// ListDistributionsPagesWithContext same as ListDistributionsPages 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 *CloudFront) ListDistributionsPagesWithContext(ctx aws.Context, input *ListDistributionsInput, fn func(*ListDistributionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDistributionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDistributionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDistributionsOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListDistributionsByWebACLId = "ListDistributionsByWebACLId2017_03_25" // ListDistributionsByWebACLIdRequest generates a "aws/request.Request" representing the // client's request for the ListDistributionsByWebACLId operation. The "output" return @@ -1734,12 +2063,12 @@ const opListDistributionsByWebACLId = "ListDistributionsByWebACLId2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributionsByWebACLId +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributionsByWebACLId func (c *CloudFront) ListDistributionsByWebACLIdRequest(input *ListDistributionsByWebACLIdInput) (req *request.Request, output *ListDistributionsByWebACLIdOutput) { op := &request.Operation{ Name: opListDistributionsByWebACLId, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/distributionsByWebACLId/{WebACLId}", + HTTPPath: "/2017-03-25/distributionsByWebACLId/{WebACLId}", } if input == nil { @@ -1768,14 +2097,29 @@ func (c *CloudFront) ListDistributionsByWebACLIdRequest(input *ListDistributions // // * ErrCodeInvalidWebACLId "InvalidWebACLId" // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributionsByWebACLId +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributionsByWebACLId func (c *CloudFront) ListDistributionsByWebACLId(input *ListDistributionsByWebACLIdInput) (*ListDistributionsByWebACLIdOutput, error) { req, out := c.ListDistributionsByWebACLIdRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opListInvalidations = "ListInvalidations2016_11_25" +// ListDistributionsByWebACLIdWithContext is the same as ListDistributionsByWebACLId with the addition of +// the ability to pass a context and additional request options. +// +// See ListDistributionsByWebACLId 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 *CloudFront) ListDistributionsByWebACLIdWithContext(ctx aws.Context, input *ListDistributionsByWebACLIdInput, opts ...request.Option) (*ListDistributionsByWebACLIdOutput, error) { + req, out := c.ListDistributionsByWebACLIdRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListInvalidations = "ListInvalidations2017_03_25" // ListInvalidationsRequest generates a "aws/request.Request" representing the // client's request for the ListInvalidations operation. The "output" return @@ -1801,12 +2145,12 @@ const opListInvalidations = "ListInvalidations2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListInvalidations +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListInvalidations func (c *CloudFront) ListInvalidationsRequest(input *ListInvalidationsInput) (req *request.Request, output *ListInvalidationsOutput) { op := &request.Operation{ Name: opListInvalidations, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/distribution/{DistributionId}/invalidation", + HTTPPath: "/2017-03-25/distribution/{DistributionId}/invalidation", Paginator: &request.Paginator{ InputTokens: []string{"Marker"}, OutputTokens: []string{"InvalidationList.NextMarker"}, @@ -1845,11 +2189,26 @@ func (c *CloudFront) ListInvalidationsRequest(input *ListInvalidationsInput) (re // * ErrCodeAccessDenied "AccessDenied" // Access denied. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListInvalidations +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListInvalidations func (c *CloudFront) ListInvalidations(input *ListInvalidationsInput) (*ListInvalidationsOutput, error) { req, out := c.ListInvalidationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListInvalidationsWithContext is the same as ListInvalidations with the addition of +// the ability to pass a context and additional request options. +// +// See ListInvalidations 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 *CloudFront) ListInvalidationsWithContext(ctx aws.Context, input *ListInvalidationsInput, opts ...request.Option) (*ListInvalidationsOutput, error) { + req, out := c.ListInvalidationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListInvalidationsPages iterates over the pages of a ListInvalidations operation, @@ -1869,15 +2228,40 @@ func (c *CloudFront) ListInvalidations(input *ListInvalidationsInput) (*ListInva // return pageNum <= 3 // }) // -func (c *CloudFront) ListInvalidationsPages(input *ListInvalidationsInput, fn func(p *ListInvalidationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListInvalidationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListInvalidationsOutput), lastPage) - }) +func (c *CloudFront) ListInvalidationsPages(input *ListInvalidationsInput, fn func(*ListInvalidationsOutput, bool) bool) error { + return c.ListInvalidationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListInvalidationsPagesWithContext same as ListInvalidationsPages 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 *CloudFront) ListInvalidationsPagesWithContext(ctx aws.Context, input *ListInvalidationsInput, fn func(*ListInvalidationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListInvalidationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListInvalidationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListInvalidationsOutput), !p.HasNextPage()) + } + return p.Err() } -const opListStreamingDistributions = "ListStreamingDistributions2016_11_25" +const opListStreamingDistributions = "ListStreamingDistributions2017_03_25" // ListStreamingDistributionsRequest generates a "aws/request.Request" representing the // client's request for the ListStreamingDistributions operation. The "output" return @@ -1903,12 +2287,12 @@ const opListStreamingDistributions = "ListStreamingDistributions2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListStreamingDistributions +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListStreamingDistributions func (c *CloudFront) ListStreamingDistributionsRequest(input *ListStreamingDistributionsInput) (req *request.Request, output *ListStreamingDistributionsOutput) { op := &request.Operation{ Name: opListStreamingDistributions, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/streaming-distribution", + HTTPPath: "/2017-03-25/streaming-distribution", Paginator: &request.Paginator{ InputTokens: []string{"Marker"}, OutputTokens: []string{"StreamingDistributionList.NextMarker"}, @@ -1941,11 +2325,26 @@ func (c *CloudFront) ListStreamingDistributionsRequest(input *ListStreamingDistr // * ErrCodeInvalidArgument "InvalidArgument" // The argument is invalid. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListStreamingDistributions +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListStreamingDistributions func (c *CloudFront) ListStreamingDistributions(input *ListStreamingDistributionsInput) (*ListStreamingDistributionsOutput, error) { req, out := c.ListStreamingDistributionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListStreamingDistributionsWithContext is the same as ListStreamingDistributions with the addition of +// the ability to pass a context and additional request options. +// +// See ListStreamingDistributions 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 *CloudFront) ListStreamingDistributionsWithContext(ctx aws.Context, input *ListStreamingDistributionsInput, opts ...request.Option) (*ListStreamingDistributionsOutput, error) { + req, out := c.ListStreamingDistributionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListStreamingDistributionsPages iterates over the pages of a ListStreamingDistributions operation, @@ -1965,15 +2364,40 @@ func (c *CloudFront) ListStreamingDistributions(input *ListStreamingDistribution // return pageNum <= 3 // }) // -func (c *CloudFront) ListStreamingDistributionsPages(input *ListStreamingDistributionsInput, fn func(p *ListStreamingDistributionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListStreamingDistributionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListStreamingDistributionsOutput), lastPage) - }) +func (c *CloudFront) ListStreamingDistributionsPages(input *ListStreamingDistributionsInput, fn func(*ListStreamingDistributionsOutput, bool) bool) error { + return c.ListStreamingDistributionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListStreamingDistributionsPagesWithContext same as ListStreamingDistributionsPages 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 *CloudFront) ListStreamingDistributionsPagesWithContext(ctx aws.Context, input *ListStreamingDistributionsInput, fn func(*ListStreamingDistributionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListStreamingDistributionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListStreamingDistributionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListStreamingDistributionsOutput), !p.HasNextPage()) + } + return p.Err() } -const opListTagsForResource = "ListTagsForResource2016_11_25" +const opListTagsForResource = "ListTagsForResource2017_03_25" // ListTagsForResourceRequest generates a "aws/request.Request" representing the // client's request for the ListTagsForResource operation. The "output" return @@ -1999,12 +2423,12 @@ const opListTagsForResource = "ListTagsForResource2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListTagsForResource +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListTagsForResource func (c *CloudFront) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { op := &request.Operation{ Name: opListTagsForResource, HTTPMethod: "GET", - HTTPPath: "/2016-11-25/tagging", + HTTPPath: "/2017-03-25/tagging", } if input == nil { @@ -2038,14 +2462,29 @@ func (c *CloudFront) ListTagsForResourceRequest(input *ListTagsForResourceInput) // // * ErrCodeNoSuchResource "NoSuchResource" // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListTagsForResource +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListTagsForResource func (c *CloudFront) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *CloudFront) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opTagResource = "TagResource2016_11_25" +const opTagResource = "TagResource2017_03_25" // TagResourceRequest generates a "aws/request.Request" representing the // client's request for the TagResource operation. The "output" return @@ -2071,12 +2510,12 @@ const opTagResource = "TagResource2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/TagResource +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/TagResource func (c *CloudFront) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { op := &request.Operation{ Name: opTagResource, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/tagging?Operation=Tag", + HTTPPath: "/2017-03-25/tagging?Operation=Tag", } if input == nil { @@ -2112,14 +2551,29 @@ func (c *CloudFront) TagResourceRequest(input *TagResourceInput) (req *request.R // // * ErrCodeNoSuchResource "NoSuchResource" // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/TagResource +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/TagResource func (c *CloudFront) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { req, out := c.TagResourceRequest(input) - err := req.Send() - return out, err + 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 *CloudFront) 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 = "UntagResource2016_11_25" +const opUntagResource = "UntagResource2017_03_25" // UntagResourceRequest generates a "aws/request.Request" representing the // client's request for the UntagResource operation. The "output" return @@ -2145,12 +2599,12 @@ const opUntagResource = "UntagResource2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UntagResource +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UntagResource func (c *CloudFront) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { op := &request.Operation{ Name: opUntagResource, HTTPMethod: "POST", - HTTPPath: "/2016-11-25/tagging?Operation=Untag", + HTTPPath: "/2017-03-25/tagging?Operation=Untag", } if input == nil { @@ -2186,14 +2640,29 @@ func (c *CloudFront) UntagResourceRequest(input *UntagResourceInput) (req *reque // // * ErrCodeNoSuchResource "NoSuchResource" // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UntagResource +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UntagResource func (c *CloudFront) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { req, out := c.UntagResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opUpdateCloudFrontOriginAccessIdentity = "UpdateCloudFrontOriginAccessIdentity2016_11_25" +// 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 *CloudFront) 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 opUpdateCloudFrontOriginAccessIdentity = "UpdateCloudFrontOriginAccessIdentity2017_03_25" // UpdateCloudFrontOriginAccessIdentityRequest generates a "aws/request.Request" representing the // client's request for the UpdateCloudFrontOriginAccessIdentity operation. The "output" return @@ -2219,12 +2688,12 @@ const opUpdateCloudFrontOriginAccessIdentity = "UpdateCloudFrontOriginAccessIden // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateCloudFrontOriginAccessIdentity func (c *CloudFront) UpdateCloudFrontOriginAccessIdentityRequest(input *UpdateCloudFrontOriginAccessIdentityInput) (req *request.Request, output *UpdateCloudFrontOriginAccessIdentityOutput) { op := &request.Operation{ Name: opUpdateCloudFrontOriginAccessIdentity, HTTPMethod: "PUT", - HTTPPath: "/2016-11-25/origin-access-identity/cloudfront/{Id}/config", + HTTPPath: "/2017-03-25/origin-access-identity/cloudfront/{Id}/config", } if input == nil { @@ -2274,14 +2743,29 @@ func (c *CloudFront) UpdateCloudFrontOriginAccessIdentityRequest(input *UpdateCl // * ErrCodeInconsistentQuantities "InconsistentQuantities" // The value of Quantity and the size of Items do not match. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateCloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateCloudFrontOriginAccessIdentity func (c *CloudFront) UpdateCloudFrontOriginAccessIdentity(input *UpdateCloudFrontOriginAccessIdentityInput) (*UpdateCloudFrontOriginAccessIdentityOutput, error) { req, out := c.UpdateCloudFrontOriginAccessIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opUpdateDistribution = "UpdateDistribution2016_11_25" +// UpdateCloudFrontOriginAccessIdentityWithContext is the same as UpdateCloudFrontOriginAccessIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateCloudFrontOriginAccessIdentity 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 *CloudFront) UpdateCloudFrontOriginAccessIdentityWithContext(ctx aws.Context, input *UpdateCloudFrontOriginAccessIdentityInput, opts ...request.Option) (*UpdateCloudFrontOriginAccessIdentityOutput, error) { + req, out := c.UpdateCloudFrontOriginAccessIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateDistribution = "UpdateDistribution2017_03_25" // UpdateDistributionRequest generates a "aws/request.Request" representing the // client's request for the UpdateDistribution operation. The "output" return @@ -2307,12 +2791,12 @@ const opUpdateDistribution = "UpdateDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateDistribution func (c *CloudFront) UpdateDistributionRequest(input *UpdateDistributionInput) (req *request.Request, output *UpdateDistributionOutput) { op := &request.Operation{ Name: opUpdateDistribution, HTTPMethod: "PUT", - HTTPPath: "/2016-11-25/distribution/{Id}/config", + HTTPPath: "/2017-03-25/distribution/{Id}/config", } if input == nil { @@ -2447,14 +2931,33 @@ func (c *CloudFront) UpdateDistributionRequest(input *UpdateDistributionInput) ( // * ErrCodeInvalidLambdaFunctionAssociation "InvalidLambdaFunctionAssociation" // The specified Lambda function association is invalid. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateDistribution +// * ErrCodeInvalidOriginReadTimeout "InvalidOriginReadTimeout" +// +// * ErrCodeInvalidOriginKeepaliveTimeout "InvalidOriginKeepaliveTimeout" +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateDistribution func (c *CloudFront) UpdateDistribution(input *UpdateDistributionInput) (*UpdateDistributionOutput, error) { req, out := c.UpdateDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDistributionWithContext is the same as UpdateDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDistribution 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 *CloudFront) UpdateDistributionWithContext(ctx aws.Context, input *UpdateDistributionInput, opts ...request.Option) (*UpdateDistributionOutput, error) { + req, out := c.UpdateDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -const opUpdateStreamingDistribution = "UpdateStreamingDistribution2016_11_25" +const opUpdateStreamingDistribution = "UpdateStreamingDistribution2017_03_25" // UpdateStreamingDistributionRequest generates a "aws/request.Request" representing the // client's request for the UpdateStreamingDistribution operation. The "output" return @@ -2480,12 +2983,12 @@ const opUpdateStreamingDistribution = "UpdateStreamingDistribution2016_11_25" // fmt.Println(resp) // } // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateStreamingDistribution func (c *CloudFront) UpdateStreamingDistributionRequest(input *UpdateStreamingDistributionInput) (req *request.Request, output *UpdateStreamingDistributionOutput) { op := &request.Operation{ Name: opUpdateStreamingDistribution, HTTPMethod: "PUT", - HTTPPath: "/2016-11-25/streaming-distribution/{Id}/config", + HTTPPath: "/2017-03-25/streaming-distribution/{Id}/config", } if input == nil { @@ -2548,11 +3051,26 @@ func (c *CloudFront) UpdateStreamingDistributionRequest(input *UpdateStreamingDi // * ErrCodeInconsistentQuantities "InconsistentQuantities" // The value of Quantity and the size of Items do not match. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateStreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateStreamingDistribution func (c *CloudFront) UpdateStreamingDistribution(input *UpdateStreamingDistributionInput) (*UpdateStreamingDistributionOutput, error) { req, out := c.UpdateStreamingDistributionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateStreamingDistributionWithContext is the same as UpdateStreamingDistribution with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateStreamingDistribution 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 *CloudFront) UpdateStreamingDistributionWithContext(ctx aws.Context, input *UpdateStreamingDistributionInput, opts ...request.Option) (*UpdateStreamingDistributionOutput, error) { + req, out := c.UpdateStreamingDistributionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // A complex type that lists the AWS accounts, if any, that you included in @@ -2567,7 +3085,7 @@ func (c *CloudFront) UpdateStreamingDistribution(input *UpdateStreamingDistribut // // For more information, see Serving Private Content through CloudFront (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ActiveTrustedSigners +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ActiveTrustedSigners type ActiveTrustedSigners struct { _ struct{} `type:"structure"` @@ -2625,7 +3143,7 @@ func (s *ActiveTrustedSigners) SetQuantity(v int64) *ActiveTrustedSigners { // A complex type that contains information about CNAMEs (alternate domain names), // if any, for this distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Aliases +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Aliases type Aliases struct { _ struct{} `type:"structure"` @@ -2690,7 +3208,7 @@ func (s *Aliases) SetQuantity(v int64) *Aliases { // S3 bucket or to your custom origin so users can't perform operations that // you don't want them to. For example, you might not want users to have permissions // to delete objects from your origin. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/AllowedMethods +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/AllowedMethods type AllowedMethods struct { _ struct{} `type:"structure"` @@ -2795,7 +3313,7 @@ func (s *AllowedMethods) SetQuantity(v int64) *AllowedMethods { // // For more information about cache behaviors, see Cache Behaviors (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesCacheBehavior) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CacheBehavior +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CacheBehavior type CacheBehavior struct { _ struct{} `type:"structure"` @@ -3077,7 +3595,7 @@ func (s *CacheBehavior) SetViewerProtocolPolicy(v string) *CacheBehavior { } // A complex type that contains zero or more CacheBehavior elements. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CacheBehaviors +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CacheBehaviors type CacheBehaviors struct { _ struct{} `type:"structure"` @@ -3146,7 +3664,7 @@ func (s *CacheBehaviors) SetQuantity(v int64) *CacheBehaviors { // If you pick the second choice for your Amazon S3 Origin, you may need to // forward Access-Control-Request-Method, Access-Control-Request-Headers, and // Origin headers for the responses to be cached correctly. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CachedMethods +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CachedMethods type CachedMethods struct { _ struct{} `type:"structure"` @@ -3207,7 +3725,7 @@ func (s *CachedMethods) SetQuantity(v int64) *CachedMethods { // cookies to the origin, see How CloudFront Forwards, Caches, and Logs Cookies // (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Cookies.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CookieNames +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CookieNames type CookieNames struct { _ struct{} `type:"structure"` @@ -3262,7 +3780,7 @@ func (s *CookieNames) SetQuantity(v int64) *CookieNames { // cookies to the origin, see How CloudFront Forwards, Caches, and Logs Cookies // (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Cookies.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CookiePreference +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CookiePreference type CookiePreference struct { _ struct{} `type:"structure"` @@ -3333,7 +3851,7 @@ func (s *CookiePreference) SetWhitelistedNames(v *CookieNames) *CookiePreference } // The request to create a new origin access identity. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateCloudFrontOriginAccessIdentityRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateCloudFrontOriginAccessIdentityRequest type CreateCloudFrontOriginAccessIdentityInput struct { _ struct{} `type:"structure" payload:"CloudFrontOriginAccessIdentityConfig"` @@ -3378,7 +3896,7 @@ func (s *CreateCloudFrontOriginAccessIdentityInput) SetCloudFrontOriginAccessIde } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateCloudFrontOriginAccessIdentityResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateCloudFrontOriginAccessIdentityResult type CreateCloudFrontOriginAccessIdentityOutput struct { _ struct{} `type:"structure" payload:"CloudFrontOriginAccessIdentity"` @@ -3422,7 +3940,7 @@ func (s *CreateCloudFrontOriginAccessIdentityOutput) SetLocation(v string) *Crea } // The request to create a new distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistributionRequest type CreateDistributionInput struct { _ struct{} `type:"structure" payload:"DistributionConfig"` @@ -3467,7 +3985,7 @@ func (s *CreateDistributionInput) SetDistributionConfig(v *DistributionConfig) * } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistributionResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistributionResult type CreateDistributionOutput struct { _ struct{} `type:"structure" payload:"Distribution"` @@ -3511,7 +4029,7 @@ func (s *CreateDistributionOutput) SetLocation(v string) *CreateDistributionOutp } // The request to create a new distribution with tags. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistributionWithTagsRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistributionWithTagsRequest type CreateDistributionWithTagsInput struct { _ struct{} `type:"structure" payload:"DistributionConfigWithTags"` @@ -3556,7 +4074,7 @@ func (s *CreateDistributionWithTagsInput) SetDistributionConfigWithTags(v *Distr } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateDistributionWithTagsResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateDistributionWithTagsResult type CreateDistributionWithTagsOutput struct { _ struct{} `type:"structure" payload:"Distribution"` @@ -3600,7 +4118,7 @@ func (s *CreateDistributionWithTagsOutput) SetLocation(v string) *CreateDistribu } // The request to create an invalidation. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateInvalidationRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateInvalidationRequest type CreateInvalidationInput struct { _ struct{} `type:"structure" payload:"InvalidationBatch"` @@ -3659,7 +4177,7 @@ func (s *CreateInvalidationInput) SetInvalidationBatch(v *InvalidationBatch) *Cr } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateInvalidationResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateInvalidationResult type CreateInvalidationOutput struct { _ struct{} `type:"structure" payload:"Invalidation"` @@ -3694,7 +4212,7 @@ func (s *CreateInvalidationOutput) SetLocation(v string) *CreateInvalidationOutp } // The request to create a new streaming distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistributionRequest type CreateStreamingDistributionInput struct { _ struct{} `type:"structure" payload:"StreamingDistributionConfig"` @@ -3739,7 +4257,7 @@ func (s *CreateStreamingDistributionInput) SetStreamingDistributionConfig(v *Str } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistributionResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistributionResult type CreateStreamingDistributionOutput struct { _ struct{} `type:"structure" payload:"StreamingDistribution"` @@ -3783,7 +4301,7 @@ func (s *CreateStreamingDistributionOutput) SetStreamingDistribution(v *Streamin } // The request to create a new streaming distribution with tags. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistributionWithTagsRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistributionWithTagsRequest type CreateStreamingDistributionWithTagsInput struct { _ struct{} `type:"structure" payload:"StreamingDistributionConfigWithTags"` @@ -3828,7 +4346,7 @@ func (s *CreateStreamingDistributionWithTagsInput) SetStreamingDistributionConfi } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CreateStreamingDistributionWithTagsResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CreateStreamingDistributionWithTagsResult type CreateStreamingDistributionWithTagsOutput struct { _ struct{} `type:"structure" payload:"StreamingDistribution"` @@ -3881,7 +4399,7 @@ func (s *CreateStreamingDistributionWithTagsOutput) SetStreamingDistribution(v * // For more information about custom error pages, see Customizing Error Responses // (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CustomErrorResponse +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CustomErrorResponse type CustomErrorResponse struct { _ struct{} `type:"structure"` @@ -4009,7 +4527,7 @@ func (s *CustomErrorResponse) SetResponsePagePath(v string) *CustomErrorResponse // For more information about custom error pages, see Customizing Error Responses // (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CustomErrorResponses +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CustomErrorResponses type CustomErrorResponses struct { _ struct{} `type:"structure"` @@ -4071,7 +4589,7 @@ func (s *CustomErrorResponses) SetQuantity(v int64) *CustomErrorResponses { } // A complex type that contains the list of Custom Headers for each origin. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CustomHeaders +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CustomHeaders type CustomHeaders struct { _ struct{} `type:"structure"` @@ -4132,7 +4650,7 @@ func (s *CustomHeaders) SetQuantity(v int64) *CustomHeaders { } // A customer origin. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CustomOriginConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CustomOriginConfig type CustomOriginConfig struct { _ struct{} `type:"structure"` @@ -4146,11 +4664,29 @@ type CustomOriginConfig struct { // HTTPSPort is a required field HTTPSPort *int64 `type:"integer" required:"true"` + // You can create a custom keep-alive timeout. All timeout units are in seconds. + // The default keep-alive timeout is 5 seconds, but you can configure custom + // timeout lengths using the CloudFront API. The minimum timeout length is 1 + // second; the maximum is 60 seconds. + // + // If you need to increase the maximum time limit, contact the AWS Support Center + // (https://console.aws.amazon.com/support/home#/). + OriginKeepaliveTimeout *int64 `type:"integer"` + // The origin protocol policy to apply to your origin. // // OriginProtocolPolicy is a required field OriginProtocolPolicy *string `type:"string" required:"true" enum:"OriginProtocolPolicy"` + // You can create a custom origin read timeout. All timeout units are in seconds. + // The default origin read timeout is 30 seconds, but you can configure custom + // timeout lengths using the CloudFront API. The minimum timeout length is 4 + // seconds; the maximum is 60 seconds. + // + // If you need to increase the maximum time limit, contact the AWS Support Center + // (https://console.aws.amazon.com/support/home#/). + OriginReadTimeout *int64 `type:"integer"` + // The SSL/TLS protocols that you want CloudFront to use when communicating // with your origin over HTTPS. OriginSslProtocols *OriginSslProtocols `type:"structure"` @@ -4202,12 +4738,24 @@ func (s *CustomOriginConfig) SetHTTPSPort(v int64) *CustomOriginConfig { return s } +// SetOriginKeepaliveTimeout sets the OriginKeepaliveTimeout field's value. +func (s *CustomOriginConfig) SetOriginKeepaliveTimeout(v int64) *CustomOriginConfig { + s.OriginKeepaliveTimeout = &v + return s +} + // SetOriginProtocolPolicy sets the OriginProtocolPolicy field's value. func (s *CustomOriginConfig) SetOriginProtocolPolicy(v string) *CustomOriginConfig { s.OriginProtocolPolicy = &v return s } +// SetOriginReadTimeout sets the OriginReadTimeout field's value. +func (s *CustomOriginConfig) SetOriginReadTimeout(v int64) *CustomOriginConfig { + s.OriginReadTimeout = &v + return s +} + // SetOriginSslProtocols sets the OriginSslProtocols field's value. func (s *CustomOriginConfig) SetOriginSslProtocols(v *OriginSslProtocols) *CustomOriginConfig { s.OriginSslProtocols = v @@ -4217,7 +4765,7 @@ func (s *CustomOriginConfig) SetOriginSslProtocols(v *OriginSslProtocols) *Custo // A complex type that describes the default cache behavior if you do not specify // a CacheBehavior element or if files don't match any of the values of PathPattern // in CacheBehavior elements. You must create exactly one default cache behavior. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DefaultCacheBehavior +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DefaultCacheBehavior type DefaultCacheBehavior struct { _ struct{} `type:"structure"` @@ -4463,7 +5011,7 @@ func (s *DefaultCacheBehavior) SetViewerProtocolPolicy(v string) *DefaultCacheBe } // Deletes a origin access identity. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteCloudFrontOriginAccessIdentityRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteCloudFrontOriginAccessIdentityRequest type DeleteCloudFrontOriginAccessIdentityInput struct { _ struct{} `type:"structure"` @@ -4512,7 +5060,7 @@ func (s *DeleteCloudFrontOriginAccessIdentityInput) SetIfMatch(v string) *Delete return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteCloudFrontOriginAccessIdentityOutput +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteCloudFrontOriginAccessIdentityOutput type DeleteCloudFrontOriginAccessIdentityOutput struct { _ struct{} `type:"structure"` } @@ -4562,7 +5110,7 @@ func (s DeleteCloudFrontOriginAccessIdentityOutput) GoString() string { // For information about deleting a distribution using the CloudFront console, // see Deleting a Distribution (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HowToDeleteDistribution.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteDistributionRequest type DeleteDistributionInput struct { _ struct{} `type:"structure"` @@ -4611,7 +5159,7 @@ func (s *DeleteDistributionInput) SetIfMatch(v string) *DeleteDistributionInput return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteDistributionOutput +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteDistributionOutput type DeleteDistributionOutput struct { _ struct{} `type:"structure"` } @@ -4627,7 +5175,7 @@ func (s DeleteDistributionOutput) GoString() string { } // The request to delete a streaming distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteStreamingDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteStreamingDistributionRequest type DeleteStreamingDistributionInput struct { _ struct{} `type:"structure"` @@ -4676,7 +5224,7 @@ func (s *DeleteStreamingDistributionInput) SetIfMatch(v string) *DeleteStreaming return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DeleteStreamingDistributionOutput +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DeleteStreamingDistributionOutput type DeleteStreamingDistributionOutput struct { _ struct{} `type:"structure"` } @@ -4692,7 +5240,7 @@ func (s DeleteStreamingDistributionOutput) GoString() string { } // The distribution's information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Distribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Distribution type Distribution struct { _ struct{} `type:"structure"` @@ -4807,7 +5355,7 @@ func (s *Distribution) SetStatus(v string) *Distribution { } // A distribution configuration. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DistributionConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DistributionConfig type DistributionConfig struct { _ struct{} `type:"structure"` @@ -4890,12 +5438,7 @@ type DistributionConfig struct { // in the Amazon CloudFront Developer Guide. DefaultRootObject *string `type:"string"` - // Specifies whether you want CloudFront to save access logs to an Amazon S3 - // bucket. - // - // If you do not want to enable logging when you create a distribution, or if - // you want to disable logging for an existing distribution, specify false for - // Enabled, and specify empty Bucket and Prefix elements. + // From this field, you can enable or disable the selected distribution. // // If you specify false for Enabled but you specify values for Bucket and Prefix, // the values are automatically deleted. @@ -5180,7 +5723,7 @@ func (s *DistributionConfig) SetWebACLId(v string) *DistributionConfig { // A distribution Configuration and a list of tags to be associated with the // distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DistributionConfigWithTags +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DistributionConfigWithTags type DistributionConfigWithTags struct { _ struct{} `type:"structure"` @@ -5244,7 +5787,7 @@ func (s *DistributionConfigWithTags) SetTags(v *Tags) *DistributionConfigWithTag } // A distribution list. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DistributionList +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DistributionList type DistributionList struct { _ struct{} `type:"structure"` @@ -5328,7 +5871,7 @@ func (s *DistributionList) SetQuantity(v int64) *DistributionList { } // A summary of the information about a CloudFront distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/DistributionSummary +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/DistributionSummary type DistributionSummary struct { _ struct{} `type:"structure"` @@ -5562,7 +6105,7 @@ func (s *DistributionSummary) SetWebACLId(v string) *DistributionSummary { } // A complex type that specifies how CloudFront handles query strings and cookies. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ForwardedValues +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ForwardedValues type ForwardedValues struct { _ struct{} `type:"structure"` @@ -5678,7 +6221,7 @@ func (s *ForwardedValues) SetQueryStringCacheKeys(v *QueryStringCacheKeys) *Forw // A complex type that controls the countries in which your content is distributed. // CloudFront determines the location of your users using MaxMind GeoIP databases. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GeoRestriction +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GeoRestriction type GeoRestriction struct { _ struct{} `type:"structure"` @@ -5766,7 +6309,7 @@ func (s *GeoRestriction) SetRestrictionType(v string) *GeoRestriction { // The origin access identity's configuration information. For more information, // see CloudFrontOriginAccessIdentityConfigComplexType. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentityConfigRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentityConfigRequest type GetCloudFrontOriginAccessIdentityConfigInput struct { _ struct{} `type:"structure"` @@ -5806,7 +6349,7 @@ func (s *GetCloudFrontOriginAccessIdentityConfigInput) SetId(v string) *GetCloud } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentityConfigResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentityConfigResult type GetCloudFrontOriginAccessIdentityConfigOutput struct { _ struct{} `type:"structure" payload:"CloudFrontOriginAccessIdentityConfig"` @@ -5840,7 +6383,7 @@ func (s *GetCloudFrontOriginAccessIdentityConfigOutput) SetETag(v string) *GetCl } // The request to get an origin access identity's information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentityRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentityRequest type GetCloudFrontOriginAccessIdentityInput struct { _ struct{} `type:"structure"` @@ -5880,7 +6423,7 @@ func (s *GetCloudFrontOriginAccessIdentityInput) SetId(v string) *GetCloudFrontO } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetCloudFrontOriginAccessIdentityResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetCloudFrontOriginAccessIdentityResult type GetCloudFrontOriginAccessIdentityOutput struct { _ struct{} `type:"structure" payload:"CloudFrontOriginAccessIdentity"` @@ -5915,7 +6458,7 @@ func (s *GetCloudFrontOriginAccessIdentityOutput) SetETag(v string) *GetCloudFro } // The request to get a distribution configuration. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistributionConfigRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistributionConfigRequest type GetDistributionConfigInput struct { _ struct{} `type:"structure"` @@ -5955,7 +6498,7 @@ func (s *GetDistributionConfigInput) SetId(v string) *GetDistributionConfigInput } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistributionConfigResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistributionConfigResult type GetDistributionConfigOutput struct { _ struct{} `type:"structure" payload:"DistributionConfig"` @@ -5989,7 +6532,7 @@ func (s *GetDistributionConfigOutput) SetETag(v string) *GetDistributionConfigOu } // The request to get a distribution's information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistributionRequest type GetDistributionInput struct { _ struct{} `type:"structure"` @@ -6029,7 +6572,7 @@ func (s *GetDistributionInput) SetId(v string) *GetDistributionInput { } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetDistributionResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetDistributionResult type GetDistributionOutput struct { _ struct{} `type:"structure" payload:"Distribution"` @@ -6063,7 +6606,7 @@ func (s *GetDistributionOutput) SetETag(v string) *GetDistributionOutput { } // The request to get an invalidation's information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetInvalidationRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetInvalidationRequest type GetInvalidationInput struct { _ struct{} `type:"structure"` @@ -6117,7 +6660,7 @@ func (s *GetInvalidationInput) SetId(v string) *GetInvalidationInput { } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetInvalidationResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetInvalidationResult type GetInvalidationOutput struct { _ struct{} `type:"structure" payload:"Invalidation"` @@ -6143,7 +6686,7 @@ func (s *GetInvalidationOutput) SetInvalidation(v *Invalidation) *GetInvalidatio } // To request to get a streaming distribution configuration. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistributionConfigRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistributionConfigRequest type GetStreamingDistributionConfigInput struct { _ struct{} `type:"structure"` @@ -6183,7 +6726,7 @@ func (s *GetStreamingDistributionConfigInput) SetId(v string) *GetStreamingDistr } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistributionConfigResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistributionConfigResult type GetStreamingDistributionConfigOutput struct { _ struct{} `type:"structure" payload:"StreamingDistributionConfig"` @@ -6217,7 +6760,7 @@ func (s *GetStreamingDistributionConfigOutput) SetStreamingDistributionConfig(v } // The request to get a streaming distribution's information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistributionRequest type GetStreamingDistributionInput struct { _ struct{} `type:"structure"` @@ -6257,7 +6800,7 @@ func (s *GetStreamingDistributionInput) SetId(v string) *GetStreamingDistributio } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/GetStreamingDistributionResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/GetStreamingDistributionResult type GetStreamingDistributionOutput struct { _ struct{} `type:"structure" payload:"StreamingDistribution"` @@ -6303,7 +6846,7 @@ func (s *GetStreamingDistributionOutput) SetStreamingDistribution(v *StreamingDi // once for each header value. For more information about caching based on header // values, see How CloudFront Forwards and Caches Headers (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Headers +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Headers type Headers struct { _ struct{} `type:"structure"` @@ -6374,7 +6917,7 @@ func (s *Headers) SetQuantity(v int64) *Headers { } // An invalidation. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Invalidation +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Invalidation type Invalidation struct { _ struct{} `type:"structure"` @@ -6435,7 +6978,7 @@ func (s *Invalidation) SetStatus(v string) *Invalidation { } // An invalidation batch. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/InvalidationBatch +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/InvalidationBatch type InvalidationBatch struct { _ struct{} `type:"structure"` @@ -6514,7 +7057,7 @@ func (s *InvalidationBatch) SetPaths(v *Paths) *InvalidationBatch { // For more information about invalidation, see Invalidating Objects (Web Distributions // Only) (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/InvalidationList +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/InvalidationList type InvalidationList struct { _ struct{} `type:"structure"` @@ -6598,7 +7141,7 @@ func (s *InvalidationList) SetQuantity(v int64) *InvalidationList { } // A summary of an invalidation request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/InvalidationSummary +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/InvalidationSummary type InvalidationSummary struct { _ struct{} `type:"structure"` @@ -6648,7 +7191,7 @@ func (s *InvalidationSummary) SetStatus(v string) *InvalidationSummary { // associated with AwsAccountNumber. // // For more information, see ActiveTrustedSigners. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/KeyPairIds +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/KeyPairIds type KeyPairIds struct { _ struct{} `type:"structure"` @@ -6689,7 +7232,7 @@ func (s *KeyPairIds) SetQuantity(v int64) *KeyPairIds { } // A complex type that contains a Lambda function association. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/LambdaFunctionAssociation +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/LambdaFunctionAssociation type LambdaFunctionAssociation struct { _ struct{} `type:"structure"` @@ -6742,7 +7285,7 @@ func (s *LambdaFunctionAssociation) SetLambdaFunctionARN(v string) *LambdaFuncti // // If you don't want to invoke any Lambda functions for the requests that match // PathPattern, specify 0 for Quantity and omit Items. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/LambdaFunctionAssociations +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/LambdaFunctionAssociations type LambdaFunctionAssociations struct { _ struct{} `type:"structure"` @@ -6792,7 +7335,7 @@ func (s *LambdaFunctionAssociations) SetQuantity(v int64) *LambdaFunctionAssocia } // The request to list origin access identities. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListCloudFrontOriginAccessIdentitiesRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListCloudFrontOriginAccessIdentitiesRequest type ListCloudFrontOriginAccessIdentitiesInput struct { _ struct{} `type:"structure"` @@ -6830,7 +7373,7 @@ func (s *ListCloudFrontOriginAccessIdentitiesInput) SetMaxItems(v int64) *ListCl } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListCloudFrontOriginAccessIdentitiesResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListCloudFrontOriginAccessIdentitiesResult type ListCloudFrontOriginAccessIdentitiesOutput struct { _ struct{} `type:"structure" payload:"CloudFrontOriginAccessIdentityList"` @@ -6856,7 +7399,7 @@ func (s *ListCloudFrontOriginAccessIdentitiesOutput) SetCloudFrontOriginAccessId // The request to list distributions that are associated with a specified AWS // WAF web ACL. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributionsByWebACLIdRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributionsByWebACLIdRequest type ListDistributionsByWebACLIdInput struct { _ struct{} `type:"structure"` @@ -6922,7 +7465,7 @@ func (s *ListDistributionsByWebACLIdInput) SetWebACLId(v string) *ListDistributi // The response to a request to list the distributions that are associated with // a specified AWS WAF web ACL. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributionsByWebACLIdResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributionsByWebACLIdResult type ListDistributionsByWebACLIdOutput struct { _ struct{} `type:"structure" payload:"DistributionList"` @@ -6947,7 +7490,7 @@ func (s *ListDistributionsByWebACLIdOutput) SetDistributionList(v *DistributionL } // The request to list your distributions. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributionsRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributionsRequest type ListDistributionsInput struct { _ struct{} `type:"structure"` @@ -6985,7 +7528,7 @@ func (s *ListDistributionsInput) SetMaxItems(v int64) *ListDistributionsInput { } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListDistributionsResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListDistributionsResult type ListDistributionsOutput struct { _ struct{} `type:"structure" payload:"DistributionList"` @@ -7010,7 +7553,7 @@ func (s *ListDistributionsOutput) SetDistributionList(v *DistributionList) *List } // The request to list invalidations. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListInvalidationsRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListInvalidationsRequest type ListInvalidationsInput struct { _ struct{} `type:"structure"` @@ -7075,7 +7618,7 @@ func (s *ListInvalidationsInput) SetMaxItems(v int64) *ListInvalidationsInput { } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListInvalidationsResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListInvalidationsResult type ListInvalidationsOutput struct { _ struct{} `type:"structure" payload:"InvalidationList"` @@ -7100,7 +7643,7 @@ func (s *ListInvalidationsOutput) SetInvalidationList(v *InvalidationList) *List } // The request to list your streaming distributions. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListStreamingDistributionsRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListStreamingDistributionsRequest type ListStreamingDistributionsInput struct { _ struct{} `type:"structure"` @@ -7134,7 +7677,7 @@ func (s *ListStreamingDistributionsInput) SetMaxItems(v int64) *ListStreamingDis } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListStreamingDistributionsResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListStreamingDistributionsResult type ListStreamingDistributionsOutput struct { _ struct{} `type:"structure" payload:"StreamingDistributionList"` @@ -7159,7 +7702,7 @@ func (s *ListStreamingDistributionsOutput) SetStreamingDistributionList(v *Strea } // The request to list tags for a CloudFront resource. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListTagsForResourceRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListTagsForResourceRequest type ListTagsForResourceInput struct { _ struct{} `type:"structure"` @@ -7199,7 +7742,7 @@ func (s *ListTagsForResourceInput) SetResource(v string) *ListTagsForResourceInp } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ListTagsForResourceResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ListTagsForResourceResult type ListTagsForResourceOutput struct { _ struct{} `type:"structure" payload:"Tags"` @@ -7226,7 +7769,7 @@ func (s *ListTagsForResourceOutput) SetTags(v *Tags) *ListTagsForResourceOutput } // A complex type that controls whether access logs are written for the distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/LoggingConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/LoggingConfig type LoggingConfig struct { _ struct{} `type:"structure"` @@ -7327,7 +7870,7 @@ func (s *LoggingConfig) SetPrefix(v string) *LoggingConfig { // For the current limit on the number of origins that you can create for a // distribution, see Amazon CloudFront Limits (http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_cloudfront) // in the AWS General Reference. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Origin +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Origin type Origin struct { _ struct{} `type:"structure"` @@ -7485,7 +8028,7 @@ func (s *Origin) SetS3OriginConfig(v *S3OriginConfig) *Origin { } // CloudFront origin access identity. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CloudFrontOriginAccessIdentity +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CloudFrontOriginAccessIdentity type OriginAccessIdentity struct { _ struct{} `type:"structure"` @@ -7535,7 +8078,7 @@ func (s *OriginAccessIdentity) SetS3CanonicalUserId(v string) *OriginAccessIdent // Origin access identity configuration. Send a GET request to the /CloudFront // API version/CloudFront/identity ID/config resource. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CloudFrontOriginAccessIdentityConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CloudFrontOriginAccessIdentityConfig type OriginAccessIdentityConfig struct { _ struct{} `type:"structure"` @@ -7607,7 +8150,7 @@ func (s *OriginAccessIdentityConfig) SetComment(v string) *OriginAccessIdentityC // child elements. By default, your entire list of origin access identities // is returned in one single page. If the list is long, you can paginate it // using the MaxItems and Marker parameters. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CloudFrontOriginAccessIdentityList +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CloudFrontOriginAccessIdentityList type OriginAccessIdentityList struct { _ struct{} `type:"structure"` @@ -7696,7 +8239,7 @@ func (s *OriginAccessIdentityList) SetQuantity(v int64) *OriginAccessIdentityLis } // Summary of the information about a CloudFront origin access identity. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/CloudFrontOriginAccessIdentitySummary +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/CloudFrontOriginAccessIdentitySummary type OriginAccessIdentitySummary struct { _ struct{} `type:"structure"` @@ -7749,7 +8292,7 @@ func (s *OriginAccessIdentitySummary) SetS3CanonicalUserId(v string) *OriginAcce // A complex type that contains HeaderName and HeaderValue elements, if any, // for this distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/OriginCustomHeader +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/OriginCustomHeader type OriginCustomHeader struct { _ struct{} `type:"structure"` @@ -7807,7 +8350,7 @@ func (s *OriginCustomHeader) SetHeaderValue(v string) *OriginCustomHeader { // A complex type that contains information about the SSL/TLS protocols that // CloudFront can use when establishing an HTTPS connection with your origin. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/OriginSslProtocols +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/OriginSslProtocols type OriginSslProtocols struct { _ struct{} `type:"structure"` @@ -7862,7 +8405,7 @@ func (s *OriginSslProtocols) SetQuantity(v int64) *OriginSslProtocols { } // A complex type that contains information about origins for this distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Origins +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Origins type Origins struct { _ struct{} `type:"structure"` @@ -7927,7 +8470,7 @@ func (s *Origins) SetQuantity(v int64) *Origins { // to invalidate. For more information, see Specifying the Objects to Invalidate // (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidation-specifying-objects) // in the Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Paths +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Paths type Paths struct { _ struct{} `type:"structure"` @@ -7975,7 +8518,7 @@ func (s *Paths) SetQuantity(v int64) *Paths { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/QueryStringCacheKeys +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/QueryStringCacheKeys type QueryStringCacheKeys struct { _ struct{} `type:"structure"` @@ -8027,7 +8570,7 @@ func (s *QueryStringCacheKeys) SetQuantity(v int64) *QueryStringCacheKeys { // A complex type that identifies ways in which you want to restrict distribution // of your content. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Restrictions +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Restrictions type Restrictions struct { _ struct{} `type:"structure"` @@ -8074,7 +8617,7 @@ func (s *Restrictions) SetGeoRestriction(v *GeoRestriction) *Restrictions { // A complex type that contains information about the Amazon S3 bucket from // which you want CloudFront to get your media files for distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/S3Origin +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/S3Origin type S3Origin struct { _ struct{} `type:"structure"` @@ -8145,7 +8688,7 @@ func (s *S3Origin) SetOriginAccessIdentity(v string) *S3Origin { // A complex type that contains information about the Amazon S3 origin. If the // origin is a custom origin, use the CustomOriginConfig element instead. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/S3OriginConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/S3OriginConfig type S3OriginConfig struct { _ struct{} `type:"structure"` @@ -8208,7 +8751,7 @@ func (s *S3OriginConfig) SetOriginAccessIdentity(v string) *S3OriginConfig { // A complex type that lists the AWS accounts that were included in the TrustedSigners // complex type, as well as their active CloudFront key pair IDs, if any. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Signer +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Signer type Signer struct { _ struct{} `type:"structure"` @@ -8248,7 +8791,7 @@ func (s *Signer) SetKeyPairIds(v *KeyPairIds) *Signer { } // A streaming distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/StreamingDistribution +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/StreamingDistribution type StreamingDistribution struct { _ struct{} `type:"structure"` @@ -8350,7 +8893,7 @@ func (s *StreamingDistribution) SetStreamingDistributionConfig(v *StreamingDistr } // The RTMP distribution's configuration information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/StreamingDistributionConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/StreamingDistributionConfig type StreamingDistributionConfig struct { _ struct{} `type:"structure"` @@ -8513,7 +9056,7 @@ func (s *StreamingDistributionConfig) SetTrustedSigners(v *TrustedSigners) *Stre // A streaming distribution Configuration and a list of tags to be associated // with the streaming distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/StreamingDistributionConfigWithTags +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/StreamingDistributionConfigWithTags type StreamingDistributionConfigWithTags struct { _ struct{} `type:"structure"` @@ -8577,7 +9120,7 @@ func (s *StreamingDistributionConfigWithTags) SetTags(v *Tags) *StreamingDistrib } // A streaming distribution list. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/StreamingDistributionList +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/StreamingDistributionList type StreamingDistributionList struct { _ struct{} `type:"structure"` @@ -8662,7 +9205,7 @@ func (s *StreamingDistributionList) SetQuantity(v int64) *StreamingDistributionL } // A summary of the information for an Amazon CloudFront streaming distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/StreamingDistributionSummary +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/StreamingDistributionSummary type StreamingDistributionSummary struct { _ struct{} `type:"structure"` @@ -8813,7 +9356,7 @@ func (s *StreamingDistributionSummary) SetTrustedSigners(v *TrustedSigners) *Str // A complex type that controls whether access logs are written for this streaming // distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/StreamingLoggingConfig +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/StreamingLoggingConfig type StreamingLoggingConfig struct { _ struct{} `type:"structure"` @@ -8889,7 +9432,7 @@ func (s *StreamingLoggingConfig) SetPrefix(v string) *StreamingLoggingConfig { } // A complex type that contains Tag key and Tag value. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Tag +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Tag type Tag struct { _ struct{} `type:"structure"` @@ -8947,7 +9490,7 @@ func (s *Tag) SetValue(v string) *Tag { } // A complex type that contains zero or more Tag elements. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/TagKeys +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/TagKeys type TagKeys struct { _ struct{} `type:"structure"` @@ -8972,7 +9515,7 @@ func (s *TagKeys) SetItems(v []*string) *TagKeys { } // The request to add tags to a CloudFront resource. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/TagResourceRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/TagResourceRequest type TagResourceInput struct { _ struct{} `type:"structure" payload:"Tags"` @@ -9030,7 +9573,7 @@ func (s *TagResourceInput) SetTags(v *Tags) *TagResourceInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/TagResourceOutput +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/TagResourceOutput type TagResourceOutput struct { _ struct{} `type:"structure"` } @@ -9046,7 +9589,7 @@ func (s TagResourceOutput) GoString() string { } // A complex type that contains zero or more Tag elements. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/Tags +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/Tags type Tags struct { _ struct{} `type:"structure"` @@ -9108,7 +9651,7 @@ func (s *Tags) SetItems(v []*Tag) *Tags { // // For more information about updating the distribution configuration, see DistributionConfig // . -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/TrustedSigners +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/TrustedSigners type TrustedSigners struct { _ struct{} `type:"structure"` @@ -9173,7 +9716,7 @@ func (s *TrustedSigners) SetQuantity(v int64) *TrustedSigners { } // The request to remove tags from a CloudFront resource. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UntagResourceRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UntagResourceRequest type UntagResourceInput struct { _ struct{} `type:"structure" payload:"TagKeys"` @@ -9226,7 +9769,7 @@ func (s *UntagResourceInput) SetTagKeys(v *TagKeys) *UntagResourceInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UntagResourceOutput +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UntagResourceOutput type UntagResourceOutput struct { _ struct{} `type:"structure"` } @@ -9242,7 +9785,7 @@ func (s UntagResourceOutput) GoString() string { } // The request to update an origin access identity. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateCloudFrontOriginAccessIdentityRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateCloudFrontOriginAccessIdentityRequest type UpdateCloudFrontOriginAccessIdentityInput struct { _ struct{} `type:"structure" payload:"CloudFrontOriginAccessIdentityConfig"` @@ -9311,7 +9854,7 @@ func (s *UpdateCloudFrontOriginAccessIdentityInput) SetIfMatch(v string) *Update } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateCloudFrontOriginAccessIdentityResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateCloudFrontOriginAccessIdentityResult type UpdateCloudFrontOriginAccessIdentityOutput struct { _ struct{} `type:"structure" payload:"CloudFrontOriginAccessIdentity"` @@ -9345,7 +9888,7 @@ func (s *UpdateCloudFrontOriginAccessIdentityOutput) SetETag(v string) *UpdateCl } // The request to update a distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateDistributionRequest type UpdateDistributionInput struct { _ struct{} `type:"structure" payload:"DistributionConfig"` @@ -9414,7 +9957,7 @@ func (s *UpdateDistributionInput) SetIfMatch(v string) *UpdateDistributionInput } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateDistributionResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateDistributionResult type UpdateDistributionOutput struct { _ struct{} `type:"structure" payload:"Distribution"` @@ -9448,7 +9991,7 @@ func (s *UpdateDistributionOutput) SetETag(v string) *UpdateDistributionOutput { } // The request to update a streaming distribution. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateStreamingDistributionRequest +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateStreamingDistributionRequest type UpdateStreamingDistributionInput struct { _ struct{} `type:"structure" payload:"StreamingDistributionConfig"` @@ -9517,7 +10060,7 @@ func (s *UpdateStreamingDistributionInput) SetStreamingDistributionConfig(v *Str } // The returned result of the corresponding request. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/UpdateStreamingDistributionResult +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/UpdateStreamingDistributionResult type UpdateStreamingDistributionOutput struct { _ struct{} `type:"structure" payload:"StreamingDistribution"` @@ -9564,7 +10107,7 @@ func (s *UpdateStreamingDistributionOutput) SetStreamingDistribution(v *Streamin // For more information, see Using an HTTPS Connection to Access Your Objects // (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/SecureConnections.html) // in the Amazon Amazon CloudFront Developer Guide. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25/ViewerCertificate +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25/ViewerCertificate type ViewerCertificate struct { _ struct{} `type:"structure"` @@ -9679,8 +10222,8 @@ type ViewerCertificate struct { // a method that works for all clients or one that works for most clients: // // * vip: CloudFront uses dedicated IP addresses for your content and can - // respond to HTTPS requests from any viewer. However, you must request permission - // to use this feature, and you incur additional monthly charges. + // respond to HTTPS requests from any viewer. However, you will incur additional + // monthly charges. // // * sni-only: CloudFront can respond to HTTPS requests from viewers that // support Server Name Indication (SNI). All modern browsers support SNI, diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/errors.go index 072359c4c9..2a38d5442c 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudfront @@ -107,6 +107,14 @@ const ( // The origin access identity is not valid or doesn't exist. ErrCodeInvalidOriginAccessIdentity = "InvalidOriginAccessIdentity" + // ErrCodeInvalidOriginKeepaliveTimeout for service response error code + // "InvalidOriginKeepaliveTimeout". + ErrCodeInvalidOriginKeepaliveTimeout = "InvalidOriginKeepaliveTimeout" + + // ErrCodeInvalidOriginReadTimeout for service response error code + // "InvalidOriginReadTimeout". + ErrCodeInvalidOriginReadTimeout = "InvalidOriginReadTimeout" + // ErrCodeInvalidProtocolSettings for service response error code // "InvalidProtocolSettings". // diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/service.go index b815814e7b..35b82c442a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudfront @@ -17,7 +17,7 @@ import ( // associated API calls, see the Amazon CloudFront Developer Guide. // The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2016-11-25 +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2017-03-25 type CloudFront struct { *client.Client } @@ -59,7 +59,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio SigningName: signingName, SigningRegion: signingRegion, Endpoint: endpoint, - APIVersion: "2016-11-25", + APIVersion: "2017-03-25", }, handlers, ), diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/waiters.go index c14e9d101f..c8d4b14dad 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudfront/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudfront import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilDistributionDeployed uses the CloudFront API operation @@ -11,26 +14,45 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudFront) WaitUntilDistributionDeployed(input *GetDistributionInput) error { - waiterCfg := waiter.Config{ - Operation: "GetDistribution", - Delay: 60, + return c.WaitUntilDistributionDeployedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilDistributionDeployedWithContext is an extended version of WaitUntilDistributionDeployed. +// 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 *CloudFront) WaitUntilDistributionDeployedWithContext(ctx aws.Context, input *GetDistributionInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilDistributionDeployed", MaxAttempts: 25, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(60 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "Distribution.Status", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Distribution.Status", Expected: "Deployed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetDistributionInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetDistributionRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInvalidationCompleted uses the CloudFront API operation @@ -38,26 +60,45 @@ func (c *CloudFront) WaitUntilDistributionDeployed(input *GetDistributionInput) // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudFront) WaitUntilInvalidationCompleted(input *GetInvalidationInput) error { - waiterCfg := waiter.Config{ - Operation: "GetInvalidation", - Delay: 20, + return c.WaitUntilInvalidationCompletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInvalidationCompletedWithContext is an extended version of WaitUntilInvalidationCompleted. +// 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 *CloudFront) WaitUntilInvalidationCompletedWithContext(ctx aws.Context, input *GetInvalidationInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInvalidationCompleted", MaxAttempts: 30, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(20 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "Invalidation.Status", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Invalidation.Status", Expected: "Completed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetInvalidationInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetInvalidationRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilStreamingDistributionDeployed uses the CloudFront API operation @@ -65,24 +106,43 @@ func (c *CloudFront) WaitUntilInvalidationCompleted(input *GetInvalidationInput) // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudFront) WaitUntilStreamingDistributionDeployed(input *GetStreamingDistributionInput) error { - waiterCfg := waiter.Config{ - Operation: "GetStreamingDistribution", - Delay: 60, + return c.WaitUntilStreamingDistributionDeployedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStreamingDistributionDeployedWithContext is an extended version of WaitUntilStreamingDistributionDeployed. +// 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 *CloudFront) WaitUntilStreamingDistributionDeployedWithContext(ctx aws.Context, input *GetStreamingDistributionInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilStreamingDistributionDeployed", MaxAttempts: 25, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(60 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "StreamingDistribution.Status", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "StreamingDistribution.Status", Expected: "Deployed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetStreamingDistributionInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetStreamingDistributionRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/api.go index c1a105a820..f48b86cbd7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package cloudtrail provides a client for AWS CloudTrail. package cloudtrail @@ -7,6 +7,7 @@ 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" ) @@ -117,8 +118,23 @@ func (c *CloudTrail) AddTagsRequest(input *AddTagsInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/AddTags func (c *CloudTrail) AddTags(input *AddTagsInput) (*AddTagsOutput, error) { req, out := c.AddTagsRequest(input) - err := req.Send() - return out, err + 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 *CloudTrail) 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 opCreateTrail = "CreateTrail" @@ -261,8 +277,23 @@ func (c *CloudTrail) CreateTrailRequest(input *CreateTrailInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/CreateTrail func (c *CloudTrail) CreateTrail(input *CreateTrailInput) (*CreateTrailOutput, error) { req, out := c.CreateTrailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTrailWithContext is the same as CreateTrail with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrail 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 *CloudTrail) CreateTrailWithContext(ctx aws.Context, input *CreateTrailInput, opts ...request.Option) (*CreateTrailOutput, error) { + req, out := c.CreateTrailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTrail = "DeleteTrail" @@ -348,8 +379,23 @@ func (c *CloudTrail) DeleteTrailRequest(input *DeleteTrailInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/DeleteTrail func (c *CloudTrail) DeleteTrail(input *DeleteTrailInput) (*DeleteTrailOutput, error) { req, out := c.DeleteTrailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteTrailWithContext is the same as DeleteTrail with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrail 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 *CloudTrail) DeleteTrailWithContext(ctx aws.Context, input *DeleteTrailInput, opts ...request.Option) (*DeleteTrailOutput, error) { + req, out := c.DeleteTrailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTrails = "DescribeTrails" @@ -417,8 +463,23 @@ func (c *CloudTrail) DescribeTrailsRequest(input *DescribeTrailsInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/DescribeTrails func (c *CloudTrail) DescribeTrails(input *DescribeTrailsInput) (*DescribeTrailsOutput, error) { req, out := c.DescribeTrailsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTrailsWithContext is the same as DescribeTrails with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTrails 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 *CloudTrail) DescribeTrailsWithContext(ctx aws.Context, input *DescribeTrailsInput, opts ...request.Option) (*DescribeTrailsOutput, error) { + req, out := c.DescribeTrailsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetEventSelectors = "GetEventSelectors" @@ -476,7 +537,8 @@ func (c *CloudTrail) GetEventSelectorsRequest(input *GetEventSelectorsInput) (re // * If your event selector includes read-only events, write-only events, // or all. // -// For more information, see Configuring Event Selectors for Trails (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/create-event-selectors-for-a-trail.html) +// For more information, see Logging Data and Management Events for Trails +// (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html) // in the AWS CloudTrail User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -515,8 +577,23 @@ func (c *CloudTrail) GetEventSelectorsRequest(input *GetEventSelectorsInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/GetEventSelectors func (c *CloudTrail) GetEventSelectors(input *GetEventSelectorsInput) (*GetEventSelectorsOutput, error) { req, out := c.GetEventSelectorsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetEventSelectorsWithContext is the same as GetEventSelectors with the addition of +// the ability to pass a context and additional request options. +// +// See GetEventSelectors 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 *CloudTrail) GetEventSelectorsWithContext(ctx aws.Context, input *GetEventSelectorsInput, opts ...request.Option) (*GetEventSelectorsOutput, error) { + req, out := c.GetEventSelectorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTrailStatus = "GetTrailStatus" @@ -600,8 +677,23 @@ func (c *CloudTrail) GetTrailStatusRequest(input *GetTrailStatusInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/GetTrailStatus func (c *CloudTrail) GetTrailStatus(input *GetTrailStatusInput) (*GetTrailStatusOutput, error) { req, out := c.GetTrailStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTrailStatusWithContext is the same as GetTrailStatus with the addition of +// the ability to pass a context and additional request options. +// +// See GetTrailStatus 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 *CloudTrail) GetTrailStatusWithContext(ctx aws.Context, input *GetTrailStatusInput, opts ...request.Option) (*GetTrailStatusOutput, error) { + req, out := c.GetTrailStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListPublicKeys = "ListPublicKeys" @@ -682,8 +774,23 @@ func (c *CloudTrail) ListPublicKeysRequest(input *ListPublicKeysInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/ListPublicKeys func (c *CloudTrail) ListPublicKeys(input *ListPublicKeysInput) (*ListPublicKeysOutput, error) { req, out := c.ListPublicKeysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPublicKeysWithContext is the same as ListPublicKeys with the addition of +// the ability to pass a context and additional request options. +// +// See ListPublicKeys 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 *CloudTrail) ListPublicKeysWithContext(ctx aws.Context, input *ListPublicKeysInput, opts ...request.Option) (*ListPublicKeysOutput, error) { + req, out := c.ListPublicKeysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTags = "ListTags" @@ -782,8 +889,23 @@ func (c *CloudTrail) ListTagsRequest(input *ListTagsInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/ListTags func (c *CloudTrail) ListTags(input *ListTagsInput) (*ListTagsOutput, error) { req, out := c.ListTagsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsWithContext is the same as ListTags with the addition of +// the ability to pass a context and additional request options. +// +// See ListTags 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 *CloudTrail) ListTagsWithContext(ctx aws.Context, input *ListTagsInput, opts ...request.Option) (*ListTagsOutput, error) { + req, out := c.ListTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opLookupEvents = "LookupEvents" @@ -846,6 +968,8 @@ func (c *CloudTrail) LookupEventsRequest(input *LookupEventsInput) (req *request // // * Event name // +// * Event source +// // * Resource name // // * Resource type @@ -887,8 +1011,23 @@ func (c *CloudTrail) LookupEventsRequest(input *LookupEventsInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/LookupEvents func (c *CloudTrail) LookupEvents(input *LookupEventsInput) (*LookupEventsOutput, error) { req, out := c.LookupEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// LookupEventsWithContext is the same as LookupEvents with the addition of +// the ability to pass a context and additional request options. +// +// See LookupEvents 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 *CloudTrail) LookupEventsWithContext(ctx aws.Context, input *LookupEventsInput, opts ...request.Option) (*LookupEventsOutput, error) { + req, out := c.LookupEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // LookupEventsPages iterates over the pages of a LookupEvents operation, @@ -908,12 +1047,37 @@ func (c *CloudTrail) LookupEvents(input *LookupEventsInput) (*LookupEventsOutput // return pageNum <= 3 // }) // -func (c *CloudTrail) LookupEventsPages(input *LookupEventsInput, fn func(p *LookupEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.LookupEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*LookupEventsOutput), lastPage) - }) +func (c *CloudTrail) LookupEventsPages(input *LookupEventsInput, fn func(*LookupEventsOutput, bool) bool) error { + return c.LookupEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// LookupEventsPagesWithContext same as LookupEventsPages 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 *CloudTrail) LookupEventsPagesWithContext(ctx aws.Context, input *LookupEventsInput, fn func(*LookupEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *LookupEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.LookupEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*LookupEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opPutEventSelectors = "PutEventSelectors" @@ -962,11 +1126,11 @@ func (c *CloudTrail) PutEventSelectorsRequest(input *PutEventSelectorsInput) (re // PutEventSelectors API operation for AWS CloudTrail. // // Configures an event selector for your trail. Use event selectors to specify -// the type of events that you want your trail to log. When an event occurs -// in your account, CloudTrail evaluates the event selectors in all trails. -// For each trail, if the event matches any event selector, the trail processes -// and logs the event. If the event doesn't match any event selector, the trail -// doesn't log the event. +// whether you want your trail to log management and/or data events. When an +// event occurs in your account, CloudTrail evaluates the event selectors in +// all trails. For each trail, if the event matches any event selector, the +// trail processes and logs the event. If the event doesn't match any event +// selector, the trail doesn't log the event. // // Example // @@ -987,7 +1151,7 @@ func (c *CloudTrail) PutEventSelectorsRequest(input *PutEventSelectorsInput) (re // trail was created; otherwise, an InvalidHomeRegionException is thrown. // // You can configure up to five event selectors for each trail. For more information, -// see Configuring Event Selectors for Trails (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/create-event-selectors-for-a-trail.html) +// see Logging Data and Management Events for Trails (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html) // in the AWS CloudTrail User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1028,7 +1192,7 @@ func (c *CloudTrail) PutEventSelectorsRequest(input *PutEventSelectorsInput) (re // // * Specify a valid number of event selectors (1 to 5) for a trail. // -// * Specify a valid number of data resources (1 to 50) for an event selector. +// * Specify a valid number of data resources (1 to 250) for an event selector. // // * Specify a valid value for a parameter. For example, specifying the ReadWriteType // parameter with a value of read-only is invalid. @@ -1042,8 +1206,23 @@ func (c *CloudTrail) PutEventSelectorsRequest(input *PutEventSelectorsInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/PutEventSelectors func (c *CloudTrail) PutEventSelectors(input *PutEventSelectorsInput) (*PutEventSelectorsOutput, error) { req, out := c.PutEventSelectorsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutEventSelectorsWithContext is the same as PutEventSelectors with the addition of +// the ability to pass a context and additional request options. +// +// See PutEventSelectors 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 *CloudTrail) PutEventSelectorsWithContext(ctx aws.Context, input *PutEventSelectorsInput, opts ...request.Option) (*PutEventSelectorsOutput, error) { + req, out := c.PutEventSelectorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTags = "RemoveTags" @@ -1143,8 +1322,23 @@ func (c *CloudTrail) RemoveTagsRequest(input *RemoveTagsInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/RemoveTags func (c *CloudTrail) RemoveTags(input *RemoveTagsInput) (*RemoveTagsOutput, error) { req, out := c.RemoveTagsRequest(input) - err := req.Send() - return out, err + 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 *CloudTrail) 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 opStartLogging = "StartLogging" @@ -1232,8 +1426,23 @@ func (c *CloudTrail) StartLoggingRequest(input *StartLoggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/StartLogging func (c *CloudTrail) StartLogging(input *StartLoggingInput) (*StartLoggingOutput, error) { req, out := c.StartLoggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartLoggingWithContext is the same as StartLogging with the addition of +// the ability to pass a context and additional request options. +// +// See StartLogging 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 *CloudTrail) StartLoggingWithContext(ctx aws.Context, input *StartLoggingInput, opts ...request.Option) (*StartLoggingOutput, error) { + req, out := c.StartLoggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopLogging = "StopLogging" @@ -1323,8 +1532,23 @@ func (c *CloudTrail) StopLoggingRequest(input *StopLoggingInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/StopLogging func (c *CloudTrail) StopLogging(input *StopLoggingInput) (*StopLoggingOutput, error) { req, out := c.StopLoggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopLoggingWithContext is the same as StopLogging with the addition of +// the ability to pass a context and additional request options. +// +// See StopLogging 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 *CloudTrail) StopLoggingWithContext(ctx aws.Context, input *StopLoggingInput, opts ...request.Option) (*StopLoggingOutput, error) { + req, out := c.StopLoggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateTrail = "UpdateTrail" @@ -1471,8 +1695,23 @@ func (c *CloudTrail) UpdateTrailRequest(input *UpdateTrailInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/UpdateTrail func (c *CloudTrail) UpdateTrail(input *UpdateTrailInput) (*UpdateTrailOutput, error) { req, out := c.UpdateTrailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateTrailWithContext is the same as UpdateTrail with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateTrail 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 *CloudTrail) UpdateTrailWithContext(ctx aws.Context, input *UpdateTrailInput, opts ...request.Option) (*UpdateTrailOutput, error) { + req, out := c.UpdateTrailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Specifies the tags to add to a trail. @@ -1590,8 +1829,8 @@ type CreateTrailInput struct { IsMultiRegionTrail *bool `type:"boolean"` // Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. - // The value can be a an alias name prefixed by "alias/", a fully specified - // ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. + // The value can be an alias name prefixed by "alias/", a fully specified ARN + // to an alias, a fully specified ARN to a key, or a globally unique identifier. // // Examples: // @@ -1865,9 +2104,9 @@ func (s *CreateTrailOutput) SetTrailARN(v string) *CreateTrailOutput { } // The Amazon S3 objects that you specify in your event selectors for your trail -// to log data events. Data events are object level API operations that access +// to log data events. Data events are object-level API operations that access // S3 objects, such as GetObject, DeleteObject, and PutObject. You can specify -// up to 50 S3 buckets and object prefixes for an event selector. +// up to 250 S3 buckets and object prefixes for a trail. // // Example // @@ -2144,11 +2383,11 @@ func (s *Event) SetUsername(v string) *Event { return s } -// Use event selectors to specify the types of events that you want your trail -// to log. When an event occurs in your account, CloudTrail evaluates the event -// selector for all trails. For each trail, if the event matches any event selector, -// the trail processes and logs the event. If the event doesn't match any event -// selector, the trail doesn't log the event. +// Use event selectors to specify whether you want your trail to log management +// and/or data events. When an event occurs in your account, CloudTrail evaluates +// the event selector for all trails. For each trail, if the event matches any +// event selector, the trail processes and logs the event. If the event doesn't +// match any event selector, the trail doesn't log the event. // // You can configure up to five event selectors for a trail. // Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/EventSelector @@ -2156,16 +2395,16 @@ type EventSelector struct { _ struct{} `type:"structure"` // CloudTrail supports logging only data events for S3 objects. You can specify - // up to 50 S3 buckets and object prefixes for an event selector. + // up to 250 S3 buckets and object prefixes for a trail. // - // For more information, see Data Events (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/create-event-selectors-for-a-trail.html#data-events-resources) + // For more information, see Data Events (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html#logging-data-events) // in the AWS CloudTrail User Guide. DataResources []*DataResource `type:"list"` // Specify if you want your event selector to include management events for // your trail. // - // For more information, see Management Events (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/create-event-selectors-for-a-trail.html#event-selector-for-management-events) + // For more information, see Management Events (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html#logging-management-events) // in the AWS CloudTrail User Guide. // // By default, the value is true. @@ -2229,7 +2468,9 @@ type GetEventSelectorsInput struct { // If you specify a trail ARN, it must be in the format: // // arn:aws:cloudtrail:us-east-1:123456789012:trail/MyTrail - TrailName *string `type:"string"` + // + // TrailName is a required field + TrailName *string `type:"string" required:"true"` } // String returns the string representation @@ -2242,6 +2483,19 @@ func (s GetEventSelectorsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetEventSelectorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetEventSelectorsInput"} + if s.TrailName == nil { + invalidParams.Add(request.NewErrParamRequired("TrailName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetTrailName sets the TrailName field's value. func (s *GetEventSelectorsInput) SetTrailName(v string) *GetEventSelectorsInput { s.TrailName = &v @@ -2938,7 +3192,9 @@ type PutEventSelectorsInput struct { // Specifies the settings for your event selectors. You can configure up to // five event selectors for a trail. - EventSelectors []*EventSelector `type:"list"` + // + // EventSelectors is a required field + EventSelectors []*EventSelector `type:"list" required:"true"` // Specifies the name of the trail or trail ARN. If you specify a trail name, // the string must meet the following requirements: @@ -2958,7 +3214,9 @@ type PutEventSelectorsInput struct { // If you specify a trail ARN, it must be in the format: // // arn:aws:cloudtrail:us-east-1:123456789012:trail/MyTrail - TrailName *string `type:"string"` + // + // TrailName is a required field + TrailName *string `type:"string" required:"true"` } // String returns the string representation @@ -2971,6 +3229,22 @@ func (s PutEventSelectorsInput) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutEventSelectorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutEventSelectorsInput"} + if s.EventSelectors == nil { + invalidParams.Add(request.NewErrParamRequired("EventSelectors")) + } + if s.TrailName == nil { + invalidParams.Add(request.NewErrParamRequired("TrailName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetEventSelectors sets the EventSelectors field's value. func (s *PutEventSelectorsInput) SetEventSelectors(v []*EventSelector) *PutEventSelectorsInput { s.EventSelectors = v @@ -3541,8 +3815,8 @@ type UpdateTrailInput struct { IsMultiRegionTrail *bool `type:"boolean"` // Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. - // The value can be a an alias name prefixed by "alias/", a fully specified - // ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. + // The value can be an alias name prefixed by "alias/", a fully specified ARN + // to an alias, a fully specified ARN to a key, or a globally unique identifier. // // Examples: // diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/errors.go index 20f511a73c..0da999b332 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudtrail @@ -59,7 +59,7 @@ const ( // // * Specify a valid number of event selectors (1 to 5) for a trail. // - // * Specify a valid number of data resources (1 to 50) for an event selector. + // * Specify a valid number of data resources (1 to 250) for an event selector. // // * Specify a valid value for a parameter. For example, specifying the ReadWriteType // parameter with a value of read-only is invalid. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/service.go index f5fcb38c2a..05bcdbde1e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudtrail/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudtrail diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go index 3abedb2cef..917da5aa38 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package cloudwatch provides a client for Amazon CloudWatch. package cloudwatch @@ -7,6 +7,7 @@ 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" @@ -76,8 +77,23 @@ func (c *CloudWatch) DeleteAlarmsRequest(input *DeleteAlarmsInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarms func (c *CloudWatch) DeleteAlarms(input *DeleteAlarmsInput) (*DeleteAlarmsOutput, error) { req, out := c.DeleteAlarmsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAlarmsWithContext is the same as DeleteAlarms with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAlarms 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 *CloudWatch) DeleteAlarmsWithContext(ctx aws.Context, input *DeleteAlarmsInput, opts ...request.Option) (*DeleteAlarmsOutput, error) { + req, out := c.DeleteAlarmsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAlarmHistory = "DescribeAlarmHistory" @@ -152,8 +168,23 @@ func (c *CloudWatch) DescribeAlarmHistoryRequest(input *DescribeAlarmHistoryInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistory func (c *CloudWatch) DescribeAlarmHistory(input *DescribeAlarmHistoryInput) (*DescribeAlarmHistoryOutput, error) { req, out := c.DescribeAlarmHistoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAlarmHistoryWithContext is the same as DescribeAlarmHistory with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAlarmHistory 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 *CloudWatch) DescribeAlarmHistoryWithContext(ctx aws.Context, input *DescribeAlarmHistoryInput, opts ...request.Option) (*DescribeAlarmHistoryOutput, error) { + req, out := c.DescribeAlarmHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeAlarmHistoryPages iterates over the pages of a DescribeAlarmHistory operation, @@ -173,12 +204,37 @@ func (c *CloudWatch) DescribeAlarmHistory(input *DescribeAlarmHistoryInput) (*De // return pageNum <= 3 // }) // -func (c *CloudWatch) DescribeAlarmHistoryPages(input *DescribeAlarmHistoryInput, fn func(p *DescribeAlarmHistoryOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeAlarmHistoryRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeAlarmHistoryOutput), lastPage) - }) +func (c *CloudWatch) DescribeAlarmHistoryPages(input *DescribeAlarmHistoryInput, fn func(*DescribeAlarmHistoryOutput, bool) bool) error { + return c.DescribeAlarmHistoryPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeAlarmHistoryPagesWithContext same as DescribeAlarmHistoryPages 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 *CloudWatch) DescribeAlarmHistoryPagesWithContext(ctx aws.Context, input *DescribeAlarmHistoryInput, fn func(*DescribeAlarmHistoryOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeAlarmHistoryInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAlarmHistoryRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeAlarmHistoryOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeAlarms = "DescribeAlarms" @@ -250,8 +306,23 @@ func (c *CloudWatch) DescribeAlarmsRequest(input *DescribeAlarmsInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarms func (c *CloudWatch) DescribeAlarms(input *DescribeAlarmsInput) (*DescribeAlarmsOutput, error) { req, out := c.DescribeAlarmsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAlarmsWithContext is the same as DescribeAlarms with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAlarms 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 *CloudWatch) DescribeAlarmsWithContext(ctx aws.Context, input *DescribeAlarmsInput, opts ...request.Option) (*DescribeAlarmsOutput, error) { + req, out := c.DescribeAlarmsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeAlarmsPages iterates over the pages of a DescribeAlarms operation, @@ -271,12 +342,37 @@ func (c *CloudWatch) DescribeAlarms(input *DescribeAlarmsInput) (*DescribeAlarms // return pageNum <= 3 // }) // -func (c *CloudWatch) DescribeAlarmsPages(input *DescribeAlarmsInput, fn func(p *DescribeAlarmsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeAlarmsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeAlarmsOutput), lastPage) - }) +func (c *CloudWatch) DescribeAlarmsPages(input *DescribeAlarmsInput, fn func(*DescribeAlarmsOutput, bool) bool) error { + return c.DescribeAlarmsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeAlarmsPagesWithContext same as DescribeAlarmsPages 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 *CloudWatch) DescribeAlarmsPagesWithContext(ctx aws.Context, input *DescribeAlarmsInput, fn func(*DescribeAlarmsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeAlarmsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAlarmsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeAlarmsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeAlarmsForMetric = "DescribeAlarmsForMetric" @@ -336,8 +432,23 @@ func (c *CloudWatch) DescribeAlarmsForMetricRequest(input *DescribeAlarmsForMetr // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetric func (c *CloudWatch) DescribeAlarmsForMetric(input *DescribeAlarmsForMetricInput) (*DescribeAlarmsForMetricOutput, error) { req, out := c.DescribeAlarmsForMetricRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAlarmsForMetricWithContext is the same as DescribeAlarmsForMetric with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAlarmsForMetric 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 *CloudWatch) DescribeAlarmsForMetricWithContext(ctx aws.Context, input *DescribeAlarmsForMetricInput, opts ...request.Option) (*DescribeAlarmsForMetricOutput, error) { + req, out := c.DescribeAlarmsForMetricRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableAlarmActions = "DisableAlarmActions" @@ -399,8 +510,23 @@ func (c *CloudWatch) DisableAlarmActionsRequest(input *DisableAlarmActionsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActions func (c *CloudWatch) DisableAlarmActions(input *DisableAlarmActionsInput) (*DisableAlarmActionsOutput, error) { req, out := c.DisableAlarmActionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableAlarmActionsWithContext is the same as DisableAlarmActions with the addition of +// the ability to pass a context and additional request options. +// +// See DisableAlarmActions 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 *CloudWatch) DisableAlarmActionsWithContext(ctx aws.Context, input *DisableAlarmActionsInput, opts ...request.Option) (*DisableAlarmActionsOutput, error) { + req, out := c.DisableAlarmActionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableAlarmActions = "EnableAlarmActions" @@ -461,8 +587,23 @@ func (c *CloudWatch) EnableAlarmActionsRequest(input *EnableAlarmActionsInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActions func (c *CloudWatch) EnableAlarmActions(input *EnableAlarmActionsInput) (*EnableAlarmActionsOutput, error) { req, out := c.EnableAlarmActionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableAlarmActionsWithContext is the same as EnableAlarmActions with the addition of +// the ability to pass a context and additional request options. +// +// See EnableAlarmActions 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 *CloudWatch) EnableAlarmActionsWithContext(ctx aws.Context, input *EnableAlarmActionsInput, opts ...request.Option) (*EnableAlarmActionsOutput, error) { + req, out := c.EnableAlarmActionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetMetricStatistics = "GetMetricStatistics" @@ -539,6 +680,14 @@ func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) // fall within each one-hour period. Therefore, the number of values aggregated // by CloudWatch is larger than the number of data points returned. // +// CloudWatch needs raw data points to calculate percentile statistics. If you +// publish data using a statistic set instead, you cannot retrieve percentile +// statistics for this data unless one of the following conditions is true: +// +// * The SampleCount of the statistic set is 1 +// +// * The Min and the Max of the statistic set are equal +// // For a list of metrics and dimensions supported by AWS services, see the Amazon // CloudWatch Metrics and Dimensions Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html) // in the Amazon CloudWatch User Guide. @@ -566,8 +715,23 @@ func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatistics func (c *CloudWatch) GetMetricStatistics(input *GetMetricStatisticsInput) (*GetMetricStatisticsOutput, error) { req, out := c.GetMetricStatisticsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetMetricStatisticsWithContext is the same as GetMetricStatistics with the addition of +// the ability to pass a context and additional request options. +// +// See GetMetricStatistics 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 *CloudWatch) GetMetricStatisticsWithContext(ctx aws.Context, input *GetMetricStatisticsInput, opts ...request.Option) (*GetMetricStatisticsOutput, error) { + req, out := c.GetMetricStatisticsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListMetrics = "ListMetrics" @@ -648,8 +812,23 @@ func (c *CloudWatch) ListMetricsRequest(input *ListMetricsInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics func (c *CloudWatch) ListMetrics(input *ListMetricsInput) (*ListMetricsOutput, error) { req, out := c.ListMetricsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListMetricsWithContext is the same as ListMetrics with the addition of +// the ability to pass a context and additional request options. +// +// See ListMetrics 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 *CloudWatch) ListMetricsWithContext(ctx aws.Context, input *ListMetricsInput, opts ...request.Option) (*ListMetricsOutput, error) { + req, out := c.ListMetricsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListMetricsPages iterates over the pages of a ListMetrics operation, @@ -669,12 +848,37 @@ func (c *CloudWatch) ListMetrics(input *ListMetricsInput) (*ListMetricsOutput, e // return pageNum <= 3 // }) // -func (c *CloudWatch) ListMetricsPages(input *ListMetricsInput, fn func(p *ListMetricsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListMetricsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListMetricsOutput), lastPage) - }) +func (c *CloudWatch) ListMetricsPages(input *ListMetricsInput, fn func(*ListMetricsOutput, bool) bool) error { + return c.ListMetricsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListMetricsPagesWithContext same as ListMetricsPages 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 *CloudWatch) ListMetricsPagesWithContext(ctx aws.Context, input *ListMetricsInput, fn func(*ListMetricsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListMetricsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListMetricsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListMetricsOutput), !p.HasNextPage()) + } + return p.Err() } const opPutMetricAlarm = "PutMetricAlarm" @@ -781,8 +985,23 @@ func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarm func (c *CloudWatch) PutMetricAlarm(input *PutMetricAlarmInput) (*PutMetricAlarmOutput, error) { req, out := c.PutMetricAlarmRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutMetricAlarmWithContext is the same as PutMetricAlarm with the addition of +// the ability to pass a context and additional request options. +// +// See PutMetricAlarm 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 *CloudWatch) PutMetricAlarmWithContext(ctx aws.Context, input *PutMetricAlarmInput, opts ...request.Option) (*PutMetricAlarmOutput, error) { + req, out := c.PutMetricAlarmRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutMetricData = "PutMetricData" @@ -838,8 +1057,7 @@ func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *reque // a metric, it can take up to fifteen minutes for the metric to appear in calls // to ListMetrics. // -// Each PutMetricData request is limited to 8 KB in size for HTTP GET requests -// and is limited to 40 KB in size for HTTP POST requests. +// Each PutMetricData request is limited to 40 KB in size for HTTP POST requests. // // Although the Value parameter accepts numbers of type Double, Amazon CloudWatch // rejects values that are either too small or too large. Values must be in @@ -847,10 +1065,23 @@ func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *reque // (Base 2). In addition, special values (e.g., NaN, +Infinity, -Infinity) are // not supported. // +// You can use up to 10 dimensions per metric to further clarify what data the +// metric collects. For more information on specifying dimensions, see Publishing +// Metrics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) +// in the Amazon CloudWatch User Guide. +// // Data points with time stamps from 24 hours ago or longer can take at least // 48 hours to become available for GetMetricStatistics from the time they are // submitted. // +// CloudWatch needs raw data points to calculate percentile statistics. If you +// publish data using a statistic set instead, you cannot retrieve percentile +// statistics for this data unless one of the following conditions is true: +// +// * The SampleCount of the statistic set is 1 +// +// * The Min and the Max of the statistic set are equal +// // 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. @@ -874,8 +1105,23 @@ func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricData func (c *CloudWatch) PutMetricData(input *PutMetricDataInput) (*PutMetricDataOutput, error) { req, out := c.PutMetricDataRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutMetricDataWithContext is the same as PutMetricData with the addition of +// the ability to pass a context and additional request options. +// +// See PutMetricData 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 *CloudWatch) PutMetricDataWithContext(ctx aws.Context, input *PutMetricDataInput, opts ...request.Option) (*PutMetricDataOutput, error) { + req, out := c.PutMetricDataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetAlarmState = "SetAlarmState" @@ -951,8 +1197,23 @@ func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmState func (c *CloudWatch) SetAlarmState(input *SetAlarmStateInput) (*SetAlarmStateOutput, error) { req, out := c.SetAlarmStateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetAlarmStateWithContext is the same as SetAlarmState with the addition of +// the ability to pass a context and additional request options. +// +// See SetAlarmState 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 *CloudWatch) SetAlarmStateWithContext(ctx aws.Context, input *SetAlarmStateInput, opts ...request.Option) (*SetAlarmStateOutput, error) { + req, out := c.SetAlarmStateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents the history of a specific alarm. @@ -1773,11 +2034,14 @@ func (s EnableAlarmActionsOutput) GoString() string { type GetMetricStatisticsInput struct { _ struct{} `type:"structure"` - // The dimensions. CloudWatch treats each unique combination of dimensions as - // a separate metric. You can't retrieve statistics using combinations of dimensions - // that were not specially published. You must specify the same dimensions that - // were used when the metrics were created. For an example, see Dimension Combinations - // (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations) + // The dimensions. If the metric contains multiple dimensions, you must include + // a value for each dimension. CloudWatch treats each unique combination of + // dimensions as a separate metric. You can't retrieve statistics using combinations + // of dimensions that were not specially published. You must specify the same + // dimensions that were used when the metrics were created. For an example, + // see Dimension Combinations (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations) + // in the Amazon CloudWatch User Guide. For more information on specifying dimensions, + // see Publishing Metrics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) // in the Amazon CloudWatch User Guide. Dimensions []*Dimension `type:"list"` @@ -2184,6 +2448,8 @@ type MetricAlarm struct { // The dimensions for the metric associated with the alarm. Dimensions []*Dimension `type:"list"` + EvaluateLowSampleCountPercentile *string `min:"1" type:"string"` + // The number of periods over which data is compared to the specified threshold. EvaluationPeriods *int64 `min:"1" type:"integer"` @@ -2228,6 +2494,8 @@ type MetricAlarm struct { // The value to compare with the specified statistic. Threshold *float64 `type:"double"` + TreatMissingData *string `min:"1" type:"string"` + // The unit of the metric associated with the alarm. Unit *string `type:"string" enum:"StandardUnit"` } @@ -2290,6 +2558,12 @@ func (s *MetricAlarm) SetDimensions(v []*Dimension) *MetricAlarm { return s } +// SetEvaluateLowSampleCountPercentile sets the EvaluateLowSampleCountPercentile field's value. +func (s *MetricAlarm) SetEvaluateLowSampleCountPercentile(v string) *MetricAlarm { + s.EvaluateLowSampleCountPercentile = &v + return s +} + // SetEvaluationPeriods sets the EvaluationPeriods field's value. func (s *MetricAlarm) SetEvaluationPeriods(v int64) *MetricAlarm { s.EvaluationPeriods = &v @@ -2368,6 +2642,12 @@ func (s *MetricAlarm) SetThreshold(v float64) *MetricAlarm { return s } +// SetTreatMissingData sets the TreatMissingData field's value. +func (s *MetricAlarm) SetTreatMissingData(v string) *MetricAlarm { + s.TreatMissingData = &v + return s +} + // SetUnit sets the Unit field's value. func (s *MetricAlarm) SetUnit(v string) *MetricAlarm { s.Unit = &v @@ -2521,6 +2801,16 @@ type PutMetricAlarmInput struct { // The dimensions for the metric associated with the alarm. Dimensions []*Dimension `type:"list"` + // Used only for alarms based on percentiles. If you specify ignore, the alarm + // state will not change during periods with too few data points to be statistically + // significant. If you specify evaluate or omit this parameter, the alarm will + // always be evaluated and possibly change state no matter how many data points + // are available. For more information, see Percentile-Based CloudWatch Alarms + // and Low Data Samples (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples). + // + // Valid Values: evaluate | ignore + EvaluateLowSampleCountPercentile *string `min:"1" type:"string"` + // The number of periods over which data is compared to the specified threshold. // // EvaluationPeriods is a required field @@ -2577,6 +2867,13 @@ type PutMetricAlarmInput struct { // Threshold is a required field Threshold *float64 `type:"double" required:"true"` + // Sets how this alarm is to handle missing data points. If TreatMissingData + // is omitted, the default behavior of missing is used. For more information, + // see Configuring How CloudWatch Alarms Treats Missing Data (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data). + // + // Valid Values: breaching | notBreaching | ignore | missing + TreatMissingData *string `min:"1" type:"string"` + // The unit of measure for the statistic. For example, the units for the Amazon // EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes // that an instance receives on all network interfaces. You can also specify @@ -2612,6 +2909,9 @@ func (s *PutMetricAlarmInput) Validate() error { if s.ComparisonOperator == nil { invalidParams.Add(request.NewErrParamRequired("ComparisonOperator")) } + if s.EvaluateLowSampleCountPercentile != nil && len(*s.EvaluateLowSampleCountPercentile) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EvaluateLowSampleCountPercentile", 1)) + } if s.EvaluationPeriods == nil { invalidParams.Add(request.NewErrParamRequired("EvaluationPeriods")) } @@ -2639,6 +2939,9 @@ func (s *PutMetricAlarmInput) Validate() error { if s.Threshold == nil { invalidParams.Add(request.NewErrParamRequired("Threshold")) } + if s.TreatMissingData != nil && len(*s.TreatMissingData) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TreatMissingData", 1)) + } if s.Dimensions != nil { for i, v := range s.Dimensions { if v == nil { @@ -2692,6 +2995,12 @@ func (s *PutMetricAlarmInput) SetDimensions(v []*Dimension) *PutMetricAlarmInput return s } +// SetEvaluateLowSampleCountPercentile sets the EvaluateLowSampleCountPercentile field's value. +func (s *PutMetricAlarmInput) SetEvaluateLowSampleCountPercentile(v string) *PutMetricAlarmInput { + s.EvaluateLowSampleCountPercentile = &v + return s +} + // SetEvaluationPeriods sets the EvaluationPeriods field's value. func (s *PutMetricAlarmInput) SetEvaluationPeriods(v int64) *PutMetricAlarmInput { s.EvaluationPeriods = &v @@ -2746,6 +3055,12 @@ func (s *PutMetricAlarmInput) SetThreshold(v float64) *PutMetricAlarmInput { return s } +// SetTreatMissingData sets the TreatMissingData field's value. +func (s *PutMetricAlarmInput) SetTreatMissingData(v string) *PutMetricAlarmInput { + s.TreatMissingData = &v + return s +} + // SetUnit sets the Unit field's value. func (s *PutMetricAlarmInput) SetUnit(v string) *PutMetricAlarmInput { s.Unit = &v diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go index 60bced5f19..6eb8cb37fe 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudwatch diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go index 4a992be670..8bffc874e0 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudwatch diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/waiters.go index 1184650e28..064abf0156 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudwatch import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilAlarmExists uses the CloudWatch API operation @@ -11,24 +14,43 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *CloudWatch) WaitUntilAlarmExists(input *DescribeAlarmsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeAlarms", - Delay: 5, + return c.WaitUntilAlarmExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilAlarmExistsWithContext is an extended version of WaitUntilAlarmExists. +// 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 *CloudWatch) WaitUntilAlarmExistsWithContext(ctx aws.Context, input *DescribeAlarmsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilAlarmExists", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "length(MetricAlarms[]) > `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(MetricAlarms[]) > `0`", Expected: true, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeAlarmsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAlarmsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go index 74f38b0939..c8627baade 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package cloudwatchevents provides a client for Amazon CloudWatch Events. package cloudwatchevents @@ -7,6 +7,7 @@ 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" @@ -60,12 +61,13 @@ func (c *CloudWatchEvents) DeleteRuleRequest(input *DeleteRuleInput) (req *reque // DeleteRule API operation for Amazon CloudWatch Events. // -// Deletes a rule. You must remove all targets from a rule using RemoveTargets -// before you can delete the rule. +// Deletes the specified rule. // -// Note: When you delete a rule, incoming events might still continue to match -// to the deleted rule. Please allow a short period of time for changes to take -// effect. +// You must remove all targets from a rule using RemoveTargets before you can +// delete the rule. +// +// When you delete a rule, incoming events might continue to match to the deleted +// rule. Please allow a short period of time for changes to take effect. // // 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 @@ -76,7 +78,7 @@ func (c *CloudWatchEvents) DeleteRuleRequest(input *DeleteRuleInput) (req *reque // // Returned Error Codes: // * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// This exception occurs if there is concurrent modification on rule or target. +// There is concurrent modification on a rule or target. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. @@ -84,8 +86,23 @@ func (c *CloudWatchEvents) DeleteRuleRequest(input *DeleteRuleInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteRule func (c *CloudWatchEvents) DeleteRule(input *DeleteRuleInput) (*DeleteRuleOutput, error) { req, out := c.DeleteRuleRequest(input) - err := req.Send() - return out, err + 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 *CloudWatchEvents) 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 opDescribeRule = "DescribeRule" @@ -133,7 +150,7 @@ func (c *CloudWatchEvents) DescribeRuleRequest(input *DescribeRuleInput) (req *r // DescribeRule API operation for Amazon CloudWatch Events. // -// Describes the details of the specified rule. +// Describes the specified 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 @@ -152,8 +169,23 @@ func (c *CloudWatchEvents) DescribeRuleRequest(input *DescribeRuleInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRule func (c *CloudWatchEvents) DescribeRule(input *DescribeRuleInput) (*DescribeRuleOutput, error) { req, out := c.DescribeRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRuleWithContext is the same as DescribeRule with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRule 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 *CloudWatchEvents) DescribeRuleWithContext(ctx aws.Context, input *DescribeRuleInput, opts ...request.Option) (*DescribeRuleOutput, error) { + req, out := c.DescribeRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableRule = "DisableRule" @@ -203,12 +235,11 @@ func (c *CloudWatchEvents) DisableRuleRequest(input *DisableRuleInput) (req *req // DisableRule API operation for Amazon CloudWatch Events. // -// Disables a rule. A disabled rule won't match any events, and won't self-trigger -// if it has a schedule expression. +// Disables the specified rule. A disabled rule won't match any events, and +// won't self-trigger if it has a schedule expression. // -// Note: When you disable a rule, incoming events might still continue to match -// to the disabled rule. Please allow a short period of time for changes to -// take effect. +// When you disable a rule, incoming events might continue to match to the disabled +// rule. Please allow a short period of time for changes to take effect. // // 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 @@ -222,7 +253,7 @@ func (c *CloudWatchEvents) DisableRuleRequest(input *DisableRuleInput) (req *req // The rule does not exist. // // * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// This exception occurs if there is concurrent modification on rule or target. +// There is concurrent modification on a rule or target. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. @@ -230,8 +261,23 @@ func (c *CloudWatchEvents) DisableRuleRequest(input *DisableRuleInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRule func (c *CloudWatchEvents) DisableRule(input *DisableRuleInput) (*DisableRuleOutput, error) { req, out := c.DisableRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableRuleWithContext is the same as DisableRule with the addition of +// the ability to pass a context and additional request options. +// +// See DisableRule 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 *CloudWatchEvents) DisableRuleWithContext(ctx aws.Context, input *DisableRuleInput, opts ...request.Option) (*DisableRuleOutput, error) { + req, out := c.DisableRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableRule = "EnableRule" @@ -281,11 +327,11 @@ func (c *CloudWatchEvents) EnableRuleRequest(input *EnableRuleInput) (req *reque // EnableRule API operation for Amazon CloudWatch Events. // -// Enables a rule. If the rule does not exist, the operation fails. +// Enables the specified rule. If the rule does not exist, the operation fails. // -// Note: When you enable a rule, incoming events might not immediately start -// matching to a newly enabled rule. Please allow a short period of time for -// changes to take effect. +// When you enable a rule, incoming events might not immediately start matching +// to a newly enabled rule. Please allow a short period of time for changes +// to take effect. // // 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 @@ -299,7 +345,7 @@ func (c *CloudWatchEvents) EnableRuleRequest(input *EnableRuleInput) (req *reque // The rule does not exist. // // * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// This exception occurs if there is concurrent modification on rule or target. +// There is concurrent modification on a rule or target. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. @@ -307,8 +353,23 @@ func (c *CloudWatchEvents) EnableRuleRequest(input *EnableRuleInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EnableRule func (c *CloudWatchEvents) EnableRule(input *EnableRuleInput) (*EnableRuleOutput, error) { req, out := c.EnableRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableRuleWithContext is the same as EnableRule with the addition of +// the ability to pass a context and additional request options. +// +// See EnableRule 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 *CloudWatchEvents) EnableRuleWithContext(ctx aws.Context, input *EnableRuleInput, opts ...request.Option) (*EnableRuleOutput, error) { + req, out := c.EnableRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListRuleNamesByTarget = "ListRuleNamesByTarget" @@ -356,12 +417,8 @@ func (c *CloudWatchEvents) ListRuleNamesByTargetRequest(input *ListRuleNamesByTa // ListRuleNamesByTarget API operation for Amazon CloudWatch Events. // -// Lists the names of the rules that the given target is put to. You can see -// which of the rules in Amazon CloudWatch Events can invoke a specific target -// in your account. If you have more rules in your account than the given limit, -// the results will be paginated. In that case, use the next token returned -// in the response and repeat ListRulesByTarget until the NextToken in the response -// is returned as null. +// Lists the rules for the specified target. You can see which of the rules +// in Amazon CloudWatch Events can invoke a specific target in your account. // // 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 @@ -377,8 +434,23 @@ func (c *CloudWatchEvents) ListRuleNamesByTargetRequest(input *ListRuleNamesByTa // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTarget func (c *CloudWatchEvents) ListRuleNamesByTarget(input *ListRuleNamesByTargetInput) (*ListRuleNamesByTargetOutput, error) { req, out := c.ListRuleNamesByTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListRuleNamesByTargetWithContext is the same as ListRuleNamesByTarget with the addition of +// the ability to pass a context and additional request options. +// +// See ListRuleNamesByTarget 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 *CloudWatchEvents) ListRuleNamesByTargetWithContext(ctx aws.Context, input *ListRuleNamesByTargetInput, opts ...request.Option) (*ListRuleNamesByTargetOutput, error) { + req, out := c.ListRuleNamesByTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListRules = "ListRules" @@ -426,11 +498,8 @@ func (c *CloudWatchEvents) ListRulesRequest(input *ListRulesInput) (req *request // ListRules API operation for Amazon CloudWatch Events. // -// Lists the Amazon CloudWatch Events rules in your account. You can either -// list all the rules or you can provide a prefix to match to the rule names. -// If you have more rules in your account than the given limit, the results -// will be paginated. In that case, use the next token returned in the response -// and repeat ListRules until the NextToken in the response is returned as null. +// Lists your Amazon CloudWatch Events rules. You can either list all the rules +// or you can provide a prefix to match to the rule names. // // 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 @@ -446,8 +515,23 @@ func (c *CloudWatchEvents) ListRulesRequest(input *ListRulesInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRules func (c *CloudWatchEvents) ListRules(input *ListRulesInput) (*ListRulesOutput, error) { req, out := c.ListRulesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListRulesWithContext is the same as ListRules with the addition of +// the ability to pass a context and additional request options. +// +// See ListRules 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 *CloudWatchEvents) ListRulesWithContext(ctx aws.Context, input *ListRulesInput, opts ...request.Option) (*ListRulesOutput, error) { + req, out := c.ListRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTargetsByRule = "ListTargetsByRule" @@ -495,7 +579,7 @@ func (c *CloudWatchEvents) ListTargetsByRuleRequest(input *ListTargetsByRuleInpu // ListTargetsByRule API operation for Amazon CloudWatch Events. // -// Lists of targets assigned to the rule. +// Lists the targets assigned to the specified 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 @@ -514,8 +598,23 @@ func (c *CloudWatchEvents) ListTargetsByRuleRequest(input *ListTargetsByRuleInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRule func (c *CloudWatchEvents) ListTargetsByRule(input *ListTargetsByRuleInput) (*ListTargetsByRuleOutput, error) { req, out := c.ListTargetsByRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTargetsByRuleWithContext is the same as ListTargetsByRule with the addition of +// the ability to pass a context and additional request options. +// +// See ListTargetsByRule 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 *CloudWatchEvents) ListTargetsByRuleWithContext(ctx aws.Context, input *ListTargetsByRuleInput, opts ...request.Option) (*ListTargetsByRuleOutput, error) { + req, out := c.ListTargetsByRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutEvents = "PutEvents" @@ -580,8 +679,23 @@ func (c *CloudWatchEvents) PutEventsRequest(input *PutEventsInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEvents func (c *CloudWatchEvents) PutEvents(input *PutEventsInput) (*PutEventsOutput, error) { req, out := c.PutEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutEventsWithContext is the same as PutEvents with the addition of +// the ability to pass a context and additional request options. +// +// See PutEvents 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 *CloudWatchEvents) PutEventsWithContext(ctx aws.Context, input *PutEventsInput, opts ...request.Option) (*PutEventsOutput, error) { + req, out := c.PutEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRule = "PutRule" @@ -629,20 +743,20 @@ func (c *CloudWatchEvents) PutRuleRequest(input *PutRuleInput) (req *request.Req // PutRule API operation for Amazon CloudWatch Events. // -// Creates or updates a rule. Rules are enabled by default, or based on value -// of the State parameter. You can disable a rule using DisableRule. +// Creates or updates the specified rule. Rules are enabled by default, or based +// on value of the state. You can disable a rule using DisableRule. // -// Note: When you create or update a rule, incoming events might not immediately -// start matching to new or updated rules. Please allow a short period of time -// for changes to take effect. +// When you create or update a rule, incoming events might not immediately start +// matching to new or updated rules. Please allow a short period of time for +// changes to take effect. // // A rule must contain at least an EventPattern or ScheduleExpression. Rules // with EventPatterns are triggered when a matching event is observed. Rules // with ScheduleExpressions self-trigger based on the given schedule. A rule // can have both an EventPattern and a ScheduleExpression, in which case the -// rule will trigger on matching events as well as on a schedule. +// rule triggers on matching events as well as on a schedule. // -// Note: Most services in AWS treat : or / as the same character in Amazon Resource +// Most services in AWS treat : or / as the same character in Amazon Resource // Names (ARNs). However, CloudWatch Events uses an exact match in event patterns // and rules. Be sure to use the correct ARN characters when creating event // patterns so that they match the ARN syntax in the event you want to match. @@ -656,14 +770,13 @@ func (c *CloudWatchEvents) PutRuleRequest(input *PutRuleInput) (req *request.Req // // Returned Error Codes: // * ErrCodeInvalidEventPatternException "InvalidEventPatternException" -// The event pattern is invalid. +// The event pattern is not valid. // // * ErrCodeLimitExceededException "LimitExceededException" -// This exception occurs if you try to create more rules or add more targets -// to a rule than allowed by default. +// You tried to create more rules or add more targets to a rule than is allowed. // // * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// This exception occurs if there is concurrent modification on rule or target. +// There is concurrent modification on a rule or target. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. @@ -671,8 +784,23 @@ func (c *CloudWatchEvents) PutRuleRequest(input *PutRuleInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRule func (c *CloudWatchEvents) PutRule(input *PutRuleInput) (*PutRuleOutput, error) { req, out := c.PutRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRuleWithContext is the same as PutRule with the addition of +// the ability to pass a context and additional request options. +// +// See PutRule 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 *CloudWatchEvents) PutRuleWithContext(ctx aws.Context, input *PutRuleInput, opts ...request.Option) (*PutRuleOutput, error) { + req, out := c.PutRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutTargets = "PutTargets" @@ -720,30 +848,49 @@ func (c *CloudWatchEvents) PutTargetsRequest(input *PutTargetsInput) (req *reque // PutTargets API operation for Amazon CloudWatch Events. // -// Adds target(s) to a rule. Targets are the resources that can be invoked when -// a rule is triggered. For example, AWS Lambda functions, Amazon Kinesis streams, -// and built-in targets. Updates the target(s) if they are already associated -// with the role. In other words, if there is already a target with the given -// target ID, then the target associated with that ID is updated. -// -// In order to be able to make API calls against the resources you own, Amazon -// CloudWatch Events needs the appropriate permissions. For AWS Lambda and Amazon -// SNS resources, CloudWatch Events relies on resource-based policies. For Amazon -// Kinesis streams, CloudWatch Events relies on IAM roles. For more information, -// see Permissions for Sending Events to Targets (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/EventsTargetPermissions.html) -// in the Amazon CloudWatch Developer Guide. -// -// Input and InputPath are mutually-exclusive and optional parameters of a target. -// When a rule is triggered due to a matched event, if for a target: -// -// * Neither Input nor InputPath is specified, then the entire event is passed -// to the target in JSON form. -// * InputPath is specified in the form of JSONPath (e.g. $.detail), then -// only the part of the event specified in the path is passed to the target -// (e.g. only the detail part of the event is passed). -// * Input is specified in the form of a valid JSON, then the matched event +// Adds the specified targets to the specified rule, or updates the targets +// if they are already associated with the rule. +// +// Targets are the resources that are invoked when a rule is triggered. Example +// targets include EC2 instances, AWS Lambda functions, Amazon Kinesis streams, +// Amazon ECS tasks, AWS Step Functions state machines, and built-in targets. +// Note that creating rules with built-in targets is supported only in the AWS +// Management Console. +// +// For some target types, PutTargets provides target-specific parameters. If +// the target is an Amazon Kinesis stream, you can optionally specify which +// shard the event goes to by using the KinesisParameters argument. To invoke +// a command on multiple EC2 instances with one rule, you can use the RunCommandParameters +// field. +// +// To be able to make API calls against the resources that you own, Amazon CloudWatch +// Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, +// CloudWatch Events relies on resource-based policies. For EC2 instances, Amazon +// Kinesis streams, and AWS Step Functions state machines, CloudWatch Events +// relies on IAM roles that you specify in the RoleARN argument in PutTarget. +// For more information, see Authentication and Access Control (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/auth-and-access-control-cwe.html) +// in the Amazon CloudWatch Events User Guide. +// +// Input, InputPath and InputTransformer are mutually exclusive and optional +// parameters of a target. When a rule is triggered due to a matched event: +// +// * If none of the following arguments are specified for a target, then +// the entire event is passed to the target in JSON form (unless the target +// is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from +// the event is passed to the target). +// +// * If Input is specified in the form of valid JSON, then the matched event // is overridden with this constant. -// Note: When you add targets to a rule, when the associated rule triggers, +// +// * If InputPath is specified in the form of JSONPath (for example, $.detail), +// then only the part of the event specified in the path is passed to the +// target (for example, only the detail part of the event is passed). +// +// * If InputTransformer is specified, then one or more specified JSONPaths +// are extracted from the event and used as values in a template that you +// specify as the input to the target. +// +// When you add targets to a rule and the associated rule triggers soon after, // new or updated targets might not be immediately invoked. Please allow a short // period of time for changes to take effect. // @@ -759,11 +906,10 @@ func (c *CloudWatchEvents) PutTargetsRequest(input *PutTargetsInput) (req *reque // The rule does not exist. // // * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// This exception occurs if there is concurrent modification on rule or target. +// There is concurrent modification on a rule or target. // // * ErrCodeLimitExceededException "LimitExceededException" -// This exception occurs if you try to create more rules or add more targets -// to a rule than allowed by default. +// You tried to create more rules or add more targets to a rule than is allowed. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. @@ -771,8 +917,23 @@ func (c *CloudWatchEvents) PutTargetsRequest(input *PutTargetsInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargets func (c *CloudWatchEvents) PutTargets(input *PutTargetsInput) (*PutTargetsOutput, error) { req, out := c.PutTargetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutTargetsWithContext is the same as PutTargets with the addition of +// the ability to pass a context and additional request options. +// +// See PutTargets 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 *CloudWatchEvents) PutTargetsWithContext(ctx aws.Context, input *PutTargetsInput, opts ...request.Option) (*PutTargetsOutput, error) { + req, out := c.PutTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTargets = "RemoveTargets" @@ -820,12 +981,12 @@ func (c *CloudWatchEvents) RemoveTargetsRequest(input *RemoveTargetsInput) (req // RemoveTargets API operation for Amazon CloudWatch Events. // -// Removes target(s) from a rule so that when the rule is triggered, those targets -// will no longer be invoked. +// Removes the specified targets from the specified rule. When the rule is triggered, +// those targets are no longer be invoked. // -// Note: When you remove a target, when the associated rule triggers, removed -// targets might still continue to be invoked. Please allow a short period of -// time for changes to take effect. +// When you remove a target, when the associated rule triggers, removed targets +// might continue to be invoked. Please allow a short period of time for changes +// to take effect. // // 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 @@ -839,7 +1000,7 @@ func (c *CloudWatchEvents) RemoveTargetsRequest(input *RemoveTargetsInput) (req // The rule does not exist. // // * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// This exception occurs if there is concurrent modification on rule or target. +// There is concurrent modification on a rule or target. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. @@ -847,8 +1008,23 @@ func (c *CloudWatchEvents) RemoveTargetsRequest(input *RemoveTargetsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargets func (c *CloudWatchEvents) RemoveTargets(input *RemoveTargetsInput) (*RemoveTargetsOutput, error) { req, out := c.RemoveTargetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTargetsWithContext is the same as RemoveTargets with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTargets 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 *CloudWatchEvents) RemoveTargetsWithContext(ctx aws.Context, input *RemoveTargetsInput, opts ...request.Option) (*RemoveTargetsOutput, error) { + req, out := c.RemoveTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestEventPattern = "TestEventPattern" @@ -896,9 +1072,9 @@ func (c *CloudWatchEvents) TestEventPatternRequest(input *TestEventPatternInput) // TestEventPattern API operation for Amazon CloudWatch Events. // -// Tests whether an event pattern matches the provided event. +// Tests whether the specified event pattern matches the provided event. // -// Note: Most services in AWS treat : or / as the same character in Amazon Resource +// Most services in AWS treat : or / as the same character in Amazon Resource // Names (ARNs). However, CloudWatch Events uses an exact match in event patterns // and rules. Be sure to use the correct ARN characters when creating event // patterns so that they match the ARN syntax in the event you want to match. @@ -912,7 +1088,7 @@ func (c *CloudWatchEvents) TestEventPatternRequest(input *TestEventPatternInput) // // Returned Error Codes: // * ErrCodeInvalidEventPatternException "InvalidEventPatternException" -// The event pattern is invalid. +// The event pattern is not valid. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. @@ -920,16 +1096,30 @@ func (c *CloudWatchEvents) TestEventPatternRequest(input *TestEventPatternInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPattern func (c *CloudWatchEvents) TestEventPattern(input *TestEventPatternInput) (*TestEventPatternOutput, error) { req, out := c.TestEventPatternRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestEventPatternWithContext is the same as TestEventPattern with the addition of +// the ability to pass a context and additional request options. +// +// See TestEventPattern 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 *CloudWatchEvents) TestEventPatternWithContext(ctx aws.Context, input *TestEventPatternInput, opts ...request.Option) (*TestEventPatternOutput, error) { + req, out := c.TestEventPatternRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } -// Container for the parameters to the DeleteRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteRuleRequest type DeleteRuleInput struct { _ struct{} `type:"structure"` - // The name of the rule to be deleted. + // The name of the rule. // // Name is a required field Name *string `min:"1" type:"string" required:"true"` @@ -982,12 +1172,11 @@ func (s DeleteRuleOutput) GoString() string { return s.String() } -// Container for the parameters to the DescribeRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRuleRequest type DescribeRuleInput struct { _ struct{} `type:"structure"` - // The name of the rule you want to describe details for. + // The name of the rule. // // Name is a required field Name *string `min:"1" type:"string" required:"true"` @@ -1025,21 +1214,20 @@ func (s *DescribeRuleInput) SetName(v string) *DescribeRuleInput { return s } -// The result of the DescribeRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRuleResponse type DescribeRuleOutput struct { _ struct{} `type:"structure"` - // The Amazon Resource Name (ARN) associated with the rule. + // The Amazon Resource Name (ARN) of the rule. Arn *string `min:"1" type:"string"` - // The rule's description. + // The description of the rule. Description *string `type:"string"` // The event pattern. EventPattern *string `type:"string"` - // The rule's name. + // The name of the rule. Name *string `min:"1" type:"string"` // The Amazon Resource Name (ARN) of the IAM role associated with the rule. @@ -1104,12 +1292,11 @@ func (s *DescribeRuleOutput) SetState(v string) *DescribeRuleOutput { return s } -// Container for the parameters to the DisableRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRuleRequest type DisableRuleInput struct { _ struct{} `type:"structure"` - // The name of the rule you want to disable. + // The name of the rule. // // Name is a required field Name *string `min:"1" type:"string" required:"true"` @@ -1162,12 +1349,68 @@ func (s DisableRuleOutput) GoString() string { return s.String() } -// Container for the parameters to the EnableRule operation. +// The custom parameters to be used when the target is an Amazon ECS cluster. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EcsParameters +type EcsParameters struct { + _ struct{} `type:"structure"` + + // The number of tasks to create based on the TaskDefinition. The default is + // one. + TaskCount *int64 `min:"1" type:"integer"` + + // The ARN of the task definition to use if the event target is an Amazon ECS + // cluster. + // + // TaskDefinitionArn is a required field + TaskDefinitionArn *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s EcsParameters) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EcsParameters) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EcsParameters) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EcsParameters"} + if s.TaskCount != nil && *s.TaskCount < 1 { + invalidParams.Add(request.NewErrParamMinValue("TaskCount", 1)) + } + if s.TaskDefinitionArn == nil { + invalidParams.Add(request.NewErrParamRequired("TaskDefinitionArn")) + } + if s.TaskDefinitionArn != nil && len(*s.TaskDefinitionArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TaskDefinitionArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetTaskCount sets the TaskCount field's value. +func (s *EcsParameters) SetTaskCount(v int64) *EcsParameters { + s.TaskCount = &v + return s +} + +// SetTaskDefinitionArn sets the TaskDefinitionArn field's value. +func (s *EcsParameters) SetTaskDefinitionArn(v string) *EcsParameters { + s.TaskDefinitionArn = &v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EnableRuleRequest type EnableRuleInput struct { _ struct{} `type:"structure"` - // The name of the rule that you want to enable. + // The name of the rule. // // Name is a required field Name *string `min:"1" type:"string" required:"true"` @@ -1220,7 +1463,106 @@ func (s EnableRuleOutput) GoString() string { return s.String() } -// Container for the parameters to the ListRuleNamesByTarget operation. +// Contains the parameters needed for you to provide custom input to a target +// based on one or more pieces of data extracted from the event. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/InputTransformer +type InputTransformer struct { + _ struct{} `type:"structure"` + + // Map of JSON paths to be extracted from the event. These are key-value pairs, + // where each value is a JSON path. + InputPathsMap map[string]*string `type:"map"` + + // Input template where you can use the values of the keys from InputPathsMap + // to customize the data sent to the target. + // + // InputTemplate is a required field + InputTemplate *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s InputTransformer) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InputTransformer) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InputTransformer) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InputTransformer"} + if s.InputTemplate == nil { + invalidParams.Add(request.NewErrParamRequired("InputTemplate")) + } + if s.InputTemplate != nil && len(*s.InputTemplate) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InputTemplate", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetInputPathsMap sets the InputPathsMap field's value. +func (s *InputTransformer) SetInputPathsMap(v map[string]*string) *InputTransformer { + s.InputPathsMap = v + return s +} + +// SetInputTemplate sets the InputTemplate field's value. +func (s *InputTransformer) SetInputTemplate(v string) *InputTransformer { + s.InputTemplate = &v + return s +} + +// This object enables you to specify a JSON path to extract from the event +// and use as the partition key for the Amazon Kinesis stream, so that you can +// control the shard to which the event goes. If you do not include this parameter, +// the default is to use the eventId as the partition key. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/KinesisParameters +type KinesisParameters struct { + _ struct{} `type:"structure"` + + // The JSON path to be extracted from the event and used as the partition key. + // For more information, see Amazon Kinesis Streams Key Concepts (http://docs.aws.amazon.com/streams/latest/dev/key-concepts.html#partition-key) + // in the Amazon Kinesis Streams Developer Guide. + // + // PartitionKeyPath is a required field + PartitionKeyPath *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s KinesisParameters) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s KinesisParameters) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *KinesisParameters) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "KinesisParameters"} + if s.PartitionKeyPath == nil { + invalidParams.Add(request.NewErrParamRequired("PartitionKeyPath")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPartitionKeyPath sets the PartitionKeyPath field's value. +func (s *KinesisParameters) SetPartitionKeyPath(v string) *KinesisParameters { + s.PartitionKeyPath = &v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTargetRequest type ListRuleNamesByTargetInput struct { _ struct{} `type:"structure"` @@ -1228,12 +1570,10 @@ type ListRuleNamesByTargetInput struct { // The maximum number of results to return. Limit *int64 `min:"1" type:"integer"` - // The token returned by a previous call to indicate that there is more data - // available. + // The token returned by a previous call to retrieve the next set of results. NextToken *string `min:"1" type:"string"` - // The Amazon Resource Name (ARN) of the target resource that you want to list - // the rules for. + // The Amazon Resource Name (ARN) of the target resource. // // TargetArn is a required field TargetArn *string `min:"1" type:"string" required:"true"` @@ -1289,15 +1629,15 @@ func (s *ListRuleNamesByTargetInput) SetTargetArn(v string) *ListRuleNamesByTarg return s } -// The result of the ListRuleNamesByTarget operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTargetResponse type ListRuleNamesByTargetOutput struct { _ struct{} `type:"structure"` - // Indicates that there are additional results to retrieve. + // Indicates whether there are additional results to retrieve. If there are + // no more results, the value is null. NextToken *string `min:"1" type:"string"` - // List of rules names that can invoke the given target. + // The names of the rules that can invoke the given target. RuleNames []*string `type:"list"` } @@ -1323,7 +1663,6 @@ func (s *ListRuleNamesByTargetOutput) SetRuleNames(v []*string) *ListRuleNamesBy return s } -// Container for the parameters to the ListRules operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRulesRequest type ListRulesInput struct { _ struct{} `type:"structure"` @@ -1334,8 +1673,7 @@ type ListRulesInput struct { // The prefix matching the rule name. NamePrefix *string `min:"1" type:"string"` - // The token returned by a previous call to indicate that there is more data - // available. + // The token returned by a previous call to retrieve the next set of results. NextToken *string `min:"1" type:"string"` } @@ -1386,15 +1724,15 @@ func (s *ListRulesInput) SetNextToken(v string) *ListRulesInput { return s } -// The result of the ListRules operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRulesResponse type ListRulesOutput struct { _ struct{} `type:"structure"` - // Indicates that there are additional results to retrieve. + // Indicates whether there are additional results to retrieve. If there are + // no more results, the value is null. NextToken *string `min:"1" type:"string"` - // List of rules matching the specified criteria. + // The rules that match the specified criteria. Rules []*Rule `type:"list"` } @@ -1420,7 +1758,6 @@ func (s *ListRulesOutput) SetRules(v []*Rule) *ListRulesOutput { return s } -// Container for the parameters to the ListTargetsByRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRuleRequest type ListTargetsByRuleInput struct { _ struct{} `type:"structure"` @@ -1428,11 +1765,10 @@ type ListTargetsByRuleInput struct { // The maximum number of results to return. Limit *int64 `min:"1" type:"integer"` - // The token returned by a previous call to indicate that there is more data - // available. + // The token returned by a previous call to retrieve the next set of results. NextToken *string `min:"1" type:"string"` - // The name of the rule whose targets you want to list. + // The name of the rule. // // Rule is a required field Rule *string `min:"1" type:"string" required:"true"` @@ -1488,16 +1824,16 @@ func (s *ListTargetsByRuleInput) SetRule(v string) *ListTargetsByRuleInput { return s } -// The result of the ListTargetsByRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRuleResponse type ListTargetsByRuleOutput struct { _ struct{} `type:"structure"` - // Indicates that there are additional results to retrieve. + // Indicates whether there are additional results to retrieve. If there are + // no more results, the value is null. NextToken *string `min:"1" type:"string"` - // Lists the targets assigned to the rule. - Targets []*Target `type:"list"` + // The targets assigned to the rule. + Targets []*Target `min:"1" type:"list"` } // String returns the string representation @@ -1522,7 +1858,6 @@ func (s *ListTargetsByRuleOutput) SetTargets(v []*Target) *ListTargetsByRuleOutp return s } -// Container for the parameters to the PutEvents operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEventsRequest type PutEventsInput struct { _ struct{} `type:"structure"` @@ -1567,15 +1902,13 @@ func (s *PutEventsInput) SetEntries(v []*PutEventsRequestEntry) *PutEventsInput return s } -// The result of the PutEvents operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEventsResponse type PutEventsOutput struct { _ struct{} `type:"structure"` - // A list of successfully and unsuccessfully ingested events results. If the - // ingestion was successful, the entry will have the event ID in it. If not, - // then the ErrorCode and ErrorMessage can be used to identify the problem with - // the entry. + // The successfully and unsuccessfully ingested events results. If the ingestion + // was successful, the entry has the event ID in it. Otherwise, you can use + // the error code and error message to identify the problem with the entry. Entries []*PutEventsResultEntry `type:"list"` // The number of failed entries. @@ -1604,13 +1937,13 @@ func (s *PutEventsOutput) SetFailedEntryCount(v int64) *PutEventsOutput { return s } -// Contains information about the event to be used in PutEvents. +// Represents an event to be submitted. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEventsRequestEntry type PutEventsRequestEntry struct { _ struct{} `type:"structure"` // In the JSON sense, an object containing fields, which may also contain nested - // sub-objects. No constraints are imposed on its contents. + // subobjects. No constraints are imposed on its contents. Detail *string `type:"string"` // Free-form string used to decide what fields to expect in the event detail. @@ -1623,9 +1956,8 @@ type PutEventsRequestEntry struct { // The source of the event. Source *string `type:"string"` - // Timestamp of event, per RFC3339 (https://www.rfc-editor.org/rfc/rfc3339.txt). - // If no timestamp is provided, the timestamp of the PutEvents call will be - // used. + // The timestamp of the event, per RFC3339 (https://www.rfc-editor.org/rfc/rfc3339.txt). + // If no timestamp is provided, the timestamp of the PutEvents call is used. Time *time.Time `type:"timestamp" timestampFormat:"unix"` } @@ -1669,18 +2001,18 @@ func (s *PutEventsRequestEntry) SetTime(v time.Time) *PutEventsRequestEntry { return s } -// A PutEventsResult contains a list of PutEventsResultEntry. +// Represents an event that failed to be submitted. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEventsResultEntry type PutEventsResultEntry struct { _ struct{} `type:"structure"` - // The error code representing why the event submission failed on this entry. + // The error code that indicates why the event submission failed. ErrorCode *string `type:"string"` - // The error message explaining why the event submission failed on this entry. + // The error message that explains why the event submission failed. ErrorMessage *string `type:"string"` - // The ID of the event submitted to Amazon CloudWatch Events. + // The ID of the event. EventId *string `type:"string"` } @@ -1712,7 +2044,6 @@ func (s *PutEventsResultEntry) SetEventId(v string) *PutEventsResultEntry { return s } -// Container for the parameters to the PutRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRuleRequest type PutRuleInput struct { _ struct{} `type:"structure"` @@ -1803,12 +2134,11 @@ func (s *PutRuleInput) SetState(v string) *PutRuleInput { return s } -// The result of the PutRule operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRuleResponse type PutRuleOutput struct { _ struct{} `type:"structure"` - // The Amazon Resource Name (ARN) that identifies the rule. + // The Amazon Resource Name (ARN) of the rule. RuleArn *string `min:"1" type:"string"` } @@ -1828,20 +2158,19 @@ func (s *PutRuleOutput) SetRuleArn(v string) *PutRuleOutput { return s } -// Container for the parameters to the PutTargets operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargetsRequest type PutTargetsInput struct { _ struct{} `type:"structure"` - // The name of the rule you want to add targets to. + // The name of the rule. // // Rule is a required field Rule *string `min:"1" type:"string" required:"true"` - // List of targets you want to update or add to the rule. + // The targets to update or add to the rule. // // Targets is a required field - Targets []*Target `type:"list" required:"true"` + Targets []*Target `min:"1" type:"list" required:"true"` } // String returns the string representation @@ -1866,6 +2195,9 @@ func (s *PutTargetsInput) Validate() error { if s.Targets == nil { invalidParams.Add(request.NewErrParamRequired("Targets")) } + if s.Targets != nil && len(s.Targets) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Targets", 1)) + } if s.Targets != nil { for i, v := range s.Targets { if v == nil { @@ -1895,12 +2227,11 @@ func (s *PutTargetsInput) SetTargets(v []*Target) *PutTargetsInput { return s } -// The result of the PutTargets operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargetsResponse type PutTargetsOutput struct { _ struct{} `type:"structure"` - // An array of failed target entries. + // The failed target entries. FailedEntries []*PutTargetsResultEntry `type:"list"` // The number of failed entries. @@ -1929,18 +2260,18 @@ func (s *PutTargetsOutput) SetFailedEntryCount(v int64) *PutTargetsOutput { return s } -// A PutTargetsResult contains a list of PutTargetsResultEntry. +// Represents a target that failed to be added to a rule. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargetsResultEntry type PutTargetsResultEntry struct { _ struct{} `type:"structure"` - // The error code representing why the target submission failed on this entry. + // The error code that indicates why the target addition failed. ErrorCode *string `type:"string"` - // The error message explaining why the target submission failed on this entry. + // The error message that explains why the target addition failed. ErrorMessage *string `type:"string"` - // The ID of the target submitted to Amazon CloudWatch Events. + // The ID of the target. TargetId *string `min:"1" type:"string"` } @@ -1972,17 +2303,16 @@ func (s *PutTargetsResultEntry) SetTargetId(v string) *PutTargetsResultEntry { return s } -// Container for the parameters to the RemoveTargets operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargetsRequest type RemoveTargetsInput struct { _ struct{} `type:"structure"` - // The list of target IDs to remove from the rule. + // The IDs of the targets to remove from the rule. // // Ids is a required field Ids []*string `min:"1" type:"list" required:"true"` - // The name of the rule you want to remove targets from. + // The name of the rule. // // Rule is a required field Rule *string `min:"1" type:"string" required:"true"` @@ -2032,12 +2362,11 @@ func (s *RemoveTargetsInput) SetRule(v string) *RemoveTargetsInput { return s } -// The result of the RemoveTargets operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargetsResponse type RemoveTargetsOutput struct { _ struct{} `type:"structure"` - // An array of failed target entries. + // The failed target entries. FailedEntries []*RemoveTargetsResultEntry `type:"list"` // The number of failed entries. @@ -2066,19 +2395,18 @@ func (s *RemoveTargetsOutput) SetFailedEntryCount(v int64) *RemoveTargetsOutput return s } -// The ID of the target requested to be removed from the rule by Amazon CloudWatch -// Events. +// Represents a target that failed to be removed from a rule. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargetsResultEntry type RemoveTargetsResultEntry struct { _ struct{} `type:"structure"` - // The error code representing why the target removal failed on this entry. + // The error code that indicates why the target removal failed. ErrorCode *string `type:"string"` - // The error message explaining why the target removal failed on this entry. + // The error message that explains why the target removal failed. ErrorMessage *string `type:"string"` - // The ID of the target requested to be removed by Amazon CloudWatch Events. + // The ID of the target. TargetId *string `min:"1" type:"string"` } @@ -2110,8 +2438,7 @@ func (s *RemoveTargetsResultEntry) SetTargetId(v string) *RemoveTargetsResultEnt return s } -// Contains information about a rule in Amazon CloudWatch Events. A ListRulesResult -// contains a list of Rules. +// Contains information about a rule in Amazon CloudWatch Events. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/Rule type Rule struct { _ struct{} `type:"structure"` @@ -2125,17 +2452,16 @@ type Rule struct { // The event pattern of the rule. EventPattern *string `type:"string"` - // The rule's name. + // The name of the rule. Name *string `min:"1" type:"string"` - // The Amazon Resource Name (ARN) associated with the role that is used for - // target invocation. + // The Amazon Resource Name (ARN) of the role that is used for target invocation. RoleArn *string `min:"1" type:"string"` // The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)". ScheduleExpression *string `type:"string"` - // The rule's state. + // The state of the rule. State *string `type:"string" enum:"RuleState"` } @@ -2191,41 +2517,175 @@ func (s *Rule) SetState(v string) *Rule { return s } -// Targets are the resources that can be invoked when a rule is triggered. For -// example, AWS Lambda functions, Amazon Kinesis streams, and built-in targets. -// -// Input and InputPath are mutually-exclusive and optional parameters of a target. -// When a rule is triggered due to a matched event, if for a target: -// -// * Neither Input nor InputPath is specified, then the entire event is passed -// to the target in JSON form. -// * InputPath is specified in the form of JSONPath (e.g. $.detail), then -// only the part of the event specified in the path is passed to the target -// (e.g. only the detail part of the event is passed). -// * Input is specified in the form of a valid JSON, then the matched event -// is overridden with this constant. +// This parameter contains the criteria (either InstanceIds or a tag) used to +// specify which EC2 instances are to be sent the command. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RunCommandParameters +type RunCommandParameters struct { + _ struct{} `type:"structure"` + + // Currently, we support including only one RunCommandTarget block, which specifies + // either an array of InstanceIds or a tag. + // + // RunCommandTargets is a required field + RunCommandTargets []*RunCommandTarget `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s RunCommandParameters) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RunCommandParameters) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RunCommandParameters) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RunCommandParameters"} + if s.RunCommandTargets == nil { + invalidParams.Add(request.NewErrParamRequired("RunCommandTargets")) + } + if s.RunCommandTargets != nil && len(s.RunCommandTargets) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RunCommandTargets", 1)) + } + if s.RunCommandTargets != nil { + for i, v := range s.RunCommandTargets { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RunCommandTargets", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRunCommandTargets sets the RunCommandTargets field's value. +func (s *RunCommandParameters) SetRunCommandTargets(v []*RunCommandTarget) *RunCommandParameters { + s.RunCommandTargets = v + return s +} + +// Information about the EC2 instances that are to be sent the command, specified +// as key-value pairs. Each RunCommandTarget block can include only one key, +// but this key may specify multiple values. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RunCommandTarget +type RunCommandTarget struct { + _ struct{} `type:"structure"` + + // Can be either tag:tag-key or InstanceIds. + // + // Key is a required field + Key *string `min:"1" type:"string" required:"true"` + + // If Key is tag:tag-key, Values is a list of tag values. If Key is InstanceIds, + // Values is a list of Amazon EC2 instance IDs. + // + // Values is a required field + Values []*string `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s RunCommandTarget) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RunCommandTarget) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RunCommandTarget) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RunCommandTarget"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.Values == nil { + invalidParams.Add(request.NewErrParamRequired("Values")) + } + if s.Values != nil && len(s.Values) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Values", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKey sets the Key field's value. +func (s *RunCommandTarget) SetKey(v string) *RunCommandTarget { + s.Key = &v + return s +} + +// SetValues sets the Values field's value. +func (s *RunCommandTarget) SetValues(v []*string) *RunCommandTarget { + s.Values = v + return s +} + +// Targets are the resources to be invoked when a rule is triggered. Target +// types include EC2 instances, AWS Lambda functions, Amazon Kinesis streams, +// Amazon ECS tasks, AWS Step Functions state machines, Run Command, and built-in +// targets. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/Target type Target struct { _ struct{} `type:"structure"` - // The Amazon Resource Name (ARN) associated of the target. + // The Amazon Resource Name (ARN) of the target. // // Arn is a required field Arn *string `min:"1" type:"string" required:"true"` - // The unique target assignment ID. + // Contains the Amazon ECS task definition and task count to be used, if the + // event target is an Amazon ECS task. For more information about Amazon ECS + // tasks, see Task Definitions (http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html) + // in the Amazon EC2 Container Service Developer Guide. + EcsParameters *EcsParameters `type:"structure"` + + // The ID of the target. // // Id is a required field Id *string `min:"1" type:"string" required:"true"` - // Valid JSON text passed to the target. For more information about JSON text, - // see The JavaScript Object Notation (JSON) Data Interchange Format (http://www.rfc-editor.org/rfc/rfc7159.txt). + // Valid JSON text passed to the target. In this case, nothing from the event + // itself is passed to the target. For more information, see The JavaScript + // Object Notation (JSON) Data Interchange Format (http://www.rfc-editor.org/rfc/rfc7159.txt). Input *string `type:"string"` // The value of the JSONPath that is used for extracting part of the matched // event when passing it to the target. For more information about JSON paths, // see JSONPath (http://goessner.net/articles/JsonPath/). InputPath *string `type:"string"` + + // Settings to enable you to provide custom input to a target based on certain + // event data. You can extract one or more key-value pairs from the event and + // then use that data to send customized input to the target. + InputTransformer *InputTransformer `type:"structure"` + + // The custom parameter you can use to control shard assignment, when the target + // is an Amazon Kinesis stream. If you do not include this parameter, the default + // is to use the eventId as the partition key. + KinesisParameters *KinesisParameters `type:"structure"` + + // The Amazon Resource Name (ARN) of the IAM role to be used for this target + // when the rule is triggered. If one rule triggers multiple targets, you can + // use a different IAM role for each target. + RoleArn *string `min:"1" type:"string"` + + // Parameters used when you are using the rule to invoke Amazon EC2 Run Command. + RunCommandParameters *RunCommandParameters `type:"structure"` } // String returns the string representation @@ -2253,6 +2713,29 @@ func (s *Target) Validate() error { if s.Id != nil && len(*s.Id) < 1 { invalidParams.Add(request.NewErrParamMinLen("Id", 1)) } + if s.RoleArn != nil && len(*s.RoleArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RoleArn", 1)) + } + if s.EcsParameters != nil { + if err := s.EcsParameters.Validate(); err != nil { + invalidParams.AddNested("EcsParameters", err.(request.ErrInvalidParams)) + } + } + if s.InputTransformer != nil { + if err := s.InputTransformer.Validate(); err != nil { + invalidParams.AddNested("InputTransformer", err.(request.ErrInvalidParams)) + } + } + if s.KinesisParameters != nil { + if err := s.KinesisParameters.Validate(); err != nil { + invalidParams.AddNested("KinesisParameters", err.(request.ErrInvalidParams)) + } + } + if s.RunCommandParameters != nil { + if err := s.RunCommandParameters.Validate(); err != nil { + invalidParams.AddNested("RunCommandParameters", err.(request.ErrInvalidParams)) + } + } if invalidParams.Len() > 0 { return invalidParams @@ -2266,6 +2749,12 @@ func (s *Target) SetArn(v string) *Target { return s } +// SetEcsParameters sets the EcsParameters field's value. +func (s *Target) SetEcsParameters(v *EcsParameters) *Target { + s.EcsParameters = v + return s +} + // SetId sets the Id field's value. func (s *Target) SetId(v string) *Target { s.Id = &v @@ -2284,17 +2773,40 @@ func (s *Target) SetInputPath(v string) *Target { return s } -// Container for the parameters to the TestEventPattern operation. +// SetInputTransformer sets the InputTransformer field's value. +func (s *Target) SetInputTransformer(v *InputTransformer) *Target { + s.InputTransformer = v + return s +} + +// SetKinesisParameters sets the KinesisParameters field's value. +func (s *Target) SetKinesisParameters(v *KinesisParameters) *Target { + s.KinesisParameters = v + return s +} + +// SetRoleArn sets the RoleArn field's value. +func (s *Target) SetRoleArn(v string) *Target { + s.RoleArn = &v + return s +} + +// SetRunCommandParameters sets the RunCommandParameters field's value. +func (s *Target) SetRunCommandParameters(v *RunCommandParameters) *Target { + s.RunCommandParameters = v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPatternRequest type TestEventPatternInput struct { _ struct{} `type:"structure"` - // The event in the JSON format to test against the event pattern. + // The event, in JSON format, to test against the event pattern. // // Event is a required field Event *string `type:"string" required:"true"` - // The event pattern you want to test. + // The event pattern. // // EventPattern is a required field EventPattern *string `type:"string" required:"true"` @@ -2338,7 +2850,6 @@ func (s *TestEventPatternInput) SetEventPattern(v string) *TestEventPatternInput return s } -// The result of the TestEventPattern operation. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPatternResponse type TestEventPatternOutput struct { _ struct{} `type:"structure"` diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go index f0d17b88d5..c7bbe1f582 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudwatchevents @@ -7,7 +7,7 @@ const ( // ErrCodeConcurrentModificationException for service response error code // "ConcurrentModificationException". // - // This exception occurs if there is concurrent modification on rule or target. + // There is concurrent modification on a rule or target. ErrCodeConcurrentModificationException = "ConcurrentModificationException" // ErrCodeInternalException for service response error code @@ -19,14 +19,13 @@ const ( // ErrCodeInvalidEventPatternException for service response error code // "InvalidEventPatternException". // - // The event pattern is invalid. + // The event pattern is not valid. ErrCodeInvalidEventPatternException = "InvalidEventPatternException" // ErrCodeLimitExceededException for service response error code // "LimitExceededException". // - // This exception occurs if you try to create more rules or add more targets - // to a rule than allowed by default. + // You tried to create more rules or add more targets to a rule than is allowed. ErrCodeLimitExceededException = "LimitExceededException" // ErrCodeResourceNotFoundException for service response error code diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/service.go index 1e814137b0..88c8421d46 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudwatchevents @@ -12,7 +12,7 @@ import ( ) // Amazon CloudWatch Events helps you to respond to state changes in your AWS -// resources. When your resources change state they automatically send events +// resources. When your resources change state, they automatically send events // into an event stream. You can create rules that match selected events in // the stream and route them to targets to take action. You can also use rules // to take action on a pre-determined schedule. For example, you can configure @@ -23,10 +23,12 @@ import ( // // * Direct specific API records from CloudTrail to an Amazon Kinesis stream // for detailed analysis of potential security or availability risks. +// // * Periodically invoke a built-in target to create a snapshot of an Amazon // EBS volume. -// For more information about Amazon CloudWatch Events features, see the Amazon -// CloudWatch Developer Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide). +// +// For more information about the features of Amazon CloudWatch Events, see +// the Amazon CloudWatch Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events). // The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. // Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go index 38fee5bc76..444b2fd768 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package cloudwatchlogs provides a client for Amazon CloudWatch Logs. package cloudwatchlogs @@ -6,6 +6,7 @@ package cloudwatchlogs import ( "fmt" + "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" @@ -86,8 +87,23 @@ func (c *CloudWatchLogs) CancelExportTaskRequest(input *CancelExportTaskInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CancelExportTask func (c *CloudWatchLogs) CancelExportTask(input *CancelExportTaskInput) (*CancelExportTaskOutput, error) { req, out := c.CancelExportTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelExportTaskWithContext is the same as CancelExportTask with the addition of +// the ability to pass a context and additional request options. +// +// See CancelExportTask 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 *CloudWatchLogs) CancelExportTaskWithContext(ctx aws.Context, input *CancelExportTaskInput, opts ...request.Option) (*CancelExportTaskOutput, error) { + req, out := c.CancelExportTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateExportTask = "CreateExportTask" @@ -177,8 +193,23 @@ func (c *CloudWatchLogs) CreateExportTaskRequest(input *CreateExportTaskInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateExportTask func (c *CloudWatchLogs) CreateExportTask(input *CreateExportTaskInput) (*CreateExportTaskOutput, error) { req, out := c.CreateExportTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateExportTaskWithContext is the same as CreateExportTask with the addition of +// the ability to pass a context and additional request options. +// +// See CreateExportTask 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 *CloudWatchLogs) CreateExportTaskWithContext(ctx aws.Context, input *CreateExportTaskInput, opts ...request.Option) (*CreateExportTaskOutput, error) { + req, out := c.CreateExportTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateLogGroup = "CreateLogGroup" @@ -267,8 +298,23 @@ func (c *CloudWatchLogs) CreateLogGroupRequest(input *CreateLogGroupInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogGroup func (c *CloudWatchLogs) CreateLogGroup(input *CreateLogGroupInput) (*CreateLogGroupOutput, error) { req, out := c.CreateLogGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateLogGroupWithContext is the same as CreateLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateLogGroup 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 *CloudWatchLogs) CreateLogGroupWithContext(ctx aws.Context, input *CreateLogGroupInput, opts ...request.Option) (*CreateLogGroupOutput, error) { + req, out := c.CreateLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateLogStream = "CreateLogStream" @@ -354,8 +400,23 @@ func (c *CloudWatchLogs) CreateLogStreamRequest(input *CreateLogStreamInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogStream func (c *CloudWatchLogs) CreateLogStream(input *CreateLogStreamInput) (*CreateLogStreamOutput, error) { req, out := c.CreateLogStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateLogStreamWithContext is the same as CreateLogStream with the addition of +// the ability to pass a context and additional request options. +// +// See CreateLogStream 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 *CloudWatchLogs) CreateLogStreamWithContext(ctx aws.Context, input *CreateLogStreamInput, opts ...request.Option) (*CreateLogStreamOutput, error) { + req, out := c.CreateLogStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDestination = "DeleteDestination" @@ -432,8 +493,23 @@ func (c *CloudWatchLogs) DeleteDestinationRequest(input *DeleteDestinationInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDestination func (c *CloudWatchLogs) DeleteDestination(input *DeleteDestinationInput) (*DeleteDestinationOutput, error) { req, out := c.DeleteDestinationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDestinationWithContext is the same as DeleteDestination with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDestination 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 *CloudWatchLogs) DeleteDestinationWithContext(ctx aws.Context, input *DeleteDestinationInput, opts ...request.Option) (*DeleteDestinationOutput, error) { + req, out := c.DeleteDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteLogGroup = "DeleteLogGroup" @@ -509,8 +585,23 @@ func (c *CloudWatchLogs) DeleteLogGroupRequest(input *DeleteLogGroupInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogGroup func (c *CloudWatchLogs) DeleteLogGroup(input *DeleteLogGroupInput) (*DeleteLogGroupOutput, error) { req, out := c.DeleteLogGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteLogGroupWithContext is the same as DeleteLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteLogGroup 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 *CloudWatchLogs) DeleteLogGroupWithContext(ctx aws.Context, input *DeleteLogGroupInput, opts ...request.Option) (*DeleteLogGroupOutput, error) { + req, out := c.DeleteLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteLogStream = "DeleteLogStream" @@ -586,8 +677,23 @@ func (c *CloudWatchLogs) DeleteLogStreamRequest(input *DeleteLogStreamInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogStream func (c *CloudWatchLogs) DeleteLogStream(input *DeleteLogStreamInput) (*DeleteLogStreamOutput, error) { req, out := c.DeleteLogStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteLogStreamWithContext is the same as DeleteLogStream with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteLogStream 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 *CloudWatchLogs) DeleteLogStreamWithContext(ctx aws.Context, input *DeleteLogStreamInput, opts ...request.Option) (*DeleteLogStreamOutput, error) { + req, out := c.DeleteLogStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteMetricFilter = "DeleteMetricFilter" @@ -662,8 +768,23 @@ func (c *CloudWatchLogs) DeleteMetricFilterRequest(input *DeleteMetricFilterInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteMetricFilter func (c *CloudWatchLogs) DeleteMetricFilter(input *DeleteMetricFilterInput) (*DeleteMetricFilterOutput, error) { req, out := c.DeleteMetricFilterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteMetricFilterWithContext is the same as DeleteMetricFilter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMetricFilter 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 *CloudWatchLogs) DeleteMetricFilterWithContext(ctx aws.Context, input *DeleteMetricFilterInput, opts ...request.Option) (*DeleteMetricFilterOutput, error) { + req, out := c.DeleteMetricFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRetentionPolicy = "DeleteRetentionPolicy" @@ -741,8 +862,23 @@ func (c *CloudWatchLogs) DeleteRetentionPolicyRequest(input *DeleteRetentionPoli // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteRetentionPolicy func (c *CloudWatchLogs) DeleteRetentionPolicy(input *DeleteRetentionPolicyInput) (*DeleteRetentionPolicyOutput, error) { req, out := c.DeleteRetentionPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRetentionPolicyWithContext is the same as DeleteRetentionPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRetentionPolicy 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 *CloudWatchLogs) DeleteRetentionPolicyWithContext(ctx aws.Context, input *DeleteRetentionPolicyInput, opts ...request.Option) (*DeleteRetentionPolicyOutput, error) { + req, out := c.DeleteRetentionPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSubscriptionFilter = "DeleteSubscriptionFilter" @@ -817,8 +953,23 @@ func (c *CloudWatchLogs) DeleteSubscriptionFilterRequest(input *DeleteSubscripti // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteSubscriptionFilter func (c *CloudWatchLogs) DeleteSubscriptionFilter(input *DeleteSubscriptionFilterInput) (*DeleteSubscriptionFilterOutput, error) { req, out := c.DeleteSubscriptionFilterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSubscriptionFilterWithContext is the same as DeleteSubscriptionFilter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSubscriptionFilter 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 *CloudWatchLogs) DeleteSubscriptionFilterWithContext(ctx aws.Context, input *DeleteSubscriptionFilterInput, opts ...request.Option) (*DeleteSubscriptionFilterOutput, error) { + req, out := c.DeleteSubscriptionFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDestinations = "DescribeDestinations" @@ -892,8 +1043,23 @@ func (c *CloudWatchLogs) DescribeDestinationsRequest(input *DescribeDestinations // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDestinations func (c *CloudWatchLogs) DescribeDestinations(input *DescribeDestinationsInput) (*DescribeDestinationsOutput, error) { req, out := c.DescribeDestinationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDestinationsWithContext is the same as DescribeDestinations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDestinations 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 *CloudWatchLogs) DescribeDestinationsWithContext(ctx aws.Context, input *DescribeDestinationsInput, opts ...request.Option) (*DescribeDestinationsOutput, error) { + req, out := c.DescribeDestinationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDestinationsPages iterates over the pages of a DescribeDestinations operation, @@ -913,12 +1079,37 @@ func (c *CloudWatchLogs) DescribeDestinations(input *DescribeDestinationsInput) // return pageNum <= 3 // }) // -func (c *CloudWatchLogs) DescribeDestinationsPages(input *DescribeDestinationsInput, fn func(p *DescribeDestinationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDestinationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDestinationsOutput), lastPage) - }) +func (c *CloudWatchLogs) DescribeDestinationsPages(input *DescribeDestinationsInput, fn func(*DescribeDestinationsOutput, bool) bool) error { + return c.DescribeDestinationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDestinationsPagesWithContext same as DescribeDestinationsPages 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 *CloudWatchLogs) DescribeDestinationsPagesWithContext(ctx aws.Context, input *DescribeDestinationsInput, fn func(*DescribeDestinationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDestinationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDestinationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDestinationsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeExportTasks = "DescribeExportTasks" @@ -986,8 +1177,23 @@ func (c *CloudWatchLogs) DescribeExportTasksRequest(input *DescribeExportTasksIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeExportTasks func (c *CloudWatchLogs) DescribeExportTasks(input *DescribeExportTasksInput) (*DescribeExportTasksOutput, error) { req, out := c.DescribeExportTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeExportTasksWithContext is the same as DescribeExportTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeExportTasks 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 *CloudWatchLogs) DescribeExportTasksWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.Option) (*DescribeExportTasksOutput, error) { + req, out := c.DescribeExportTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeLogGroups = "DescribeLogGroups" @@ -1061,8 +1267,23 @@ func (c *CloudWatchLogs) DescribeLogGroupsRequest(input *DescribeLogGroupsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogGroups func (c *CloudWatchLogs) DescribeLogGroups(input *DescribeLogGroupsInput) (*DescribeLogGroupsOutput, error) { req, out := c.DescribeLogGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeLogGroupsWithContext is the same as DescribeLogGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLogGroups 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 *CloudWatchLogs) DescribeLogGroupsWithContext(ctx aws.Context, input *DescribeLogGroupsInput, opts ...request.Option) (*DescribeLogGroupsOutput, error) { + req, out := c.DescribeLogGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeLogGroupsPages iterates over the pages of a DescribeLogGroups operation, @@ -1082,12 +1303,37 @@ func (c *CloudWatchLogs) DescribeLogGroups(input *DescribeLogGroupsInput) (*Desc // return pageNum <= 3 // }) // -func (c *CloudWatchLogs) DescribeLogGroupsPages(input *DescribeLogGroupsInput, fn func(p *DescribeLogGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeLogGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeLogGroupsOutput), lastPage) - }) +func (c *CloudWatchLogs) DescribeLogGroupsPages(input *DescribeLogGroupsInput, fn func(*DescribeLogGroupsOutput, bool) bool) error { + return c.DescribeLogGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeLogGroupsPagesWithContext same as DescribeLogGroupsPages 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 *CloudWatchLogs) DescribeLogGroupsPagesWithContext(ctx aws.Context, input *DescribeLogGroupsInput, fn func(*DescribeLogGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeLogGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeLogGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeLogGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeLogStreams = "DescribeLogStreams" @@ -1168,8 +1414,23 @@ func (c *CloudWatchLogs) DescribeLogStreamsRequest(input *DescribeLogStreamsInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogStreams func (c *CloudWatchLogs) DescribeLogStreams(input *DescribeLogStreamsInput) (*DescribeLogStreamsOutput, error) { req, out := c.DescribeLogStreamsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeLogStreamsWithContext is the same as DescribeLogStreams with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLogStreams 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 *CloudWatchLogs) DescribeLogStreamsWithContext(ctx aws.Context, input *DescribeLogStreamsInput, opts ...request.Option) (*DescribeLogStreamsOutput, error) { + req, out := c.DescribeLogStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeLogStreamsPages iterates over the pages of a DescribeLogStreams operation, @@ -1189,12 +1450,37 @@ func (c *CloudWatchLogs) DescribeLogStreams(input *DescribeLogStreamsInput) (*De // return pageNum <= 3 // }) // -func (c *CloudWatchLogs) DescribeLogStreamsPages(input *DescribeLogStreamsInput, fn func(p *DescribeLogStreamsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeLogStreamsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeLogStreamsOutput), lastPage) - }) +func (c *CloudWatchLogs) DescribeLogStreamsPages(input *DescribeLogStreamsInput, fn func(*DescribeLogStreamsOutput, bool) bool) error { + return c.DescribeLogStreamsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeLogStreamsPagesWithContext same as DescribeLogStreamsPages 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 *CloudWatchLogs) DescribeLogStreamsPagesWithContext(ctx aws.Context, input *DescribeLogStreamsInput, fn func(*DescribeLogStreamsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeLogStreamsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeLogStreamsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeLogStreamsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeMetricFilters = "DescribeMetricFilters" @@ -1272,8 +1558,23 @@ func (c *CloudWatchLogs) DescribeMetricFiltersRequest(input *DescribeMetricFilte // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeMetricFilters func (c *CloudWatchLogs) DescribeMetricFilters(input *DescribeMetricFiltersInput) (*DescribeMetricFiltersOutput, error) { req, out := c.DescribeMetricFiltersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMetricFiltersWithContext is the same as DescribeMetricFilters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMetricFilters 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 *CloudWatchLogs) DescribeMetricFiltersWithContext(ctx aws.Context, input *DescribeMetricFiltersInput, opts ...request.Option) (*DescribeMetricFiltersOutput, error) { + req, out := c.DescribeMetricFiltersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeMetricFiltersPages iterates over the pages of a DescribeMetricFilters operation, @@ -1293,12 +1594,37 @@ func (c *CloudWatchLogs) DescribeMetricFilters(input *DescribeMetricFiltersInput // return pageNum <= 3 // }) // -func (c *CloudWatchLogs) DescribeMetricFiltersPages(input *DescribeMetricFiltersInput, fn func(p *DescribeMetricFiltersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeMetricFiltersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeMetricFiltersOutput), lastPage) - }) +func (c *CloudWatchLogs) DescribeMetricFiltersPages(input *DescribeMetricFiltersInput, fn func(*DescribeMetricFiltersOutput, bool) bool) error { + return c.DescribeMetricFiltersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeMetricFiltersPagesWithContext same as DescribeMetricFiltersPages 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 *CloudWatchLogs) DescribeMetricFiltersPagesWithContext(ctx aws.Context, input *DescribeMetricFiltersInput, fn func(*DescribeMetricFiltersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeMetricFiltersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeMetricFiltersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeMetricFiltersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeSubscriptionFilters = "DescribeSubscriptionFilters" @@ -1376,8 +1702,23 @@ func (c *CloudWatchLogs) DescribeSubscriptionFiltersRequest(input *DescribeSubsc // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeSubscriptionFilters func (c *CloudWatchLogs) DescribeSubscriptionFilters(input *DescribeSubscriptionFiltersInput) (*DescribeSubscriptionFiltersOutput, error) { req, out := c.DescribeSubscriptionFiltersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSubscriptionFiltersWithContext is the same as DescribeSubscriptionFilters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSubscriptionFilters 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 *CloudWatchLogs) DescribeSubscriptionFiltersWithContext(ctx aws.Context, input *DescribeSubscriptionFiltersInput, opts ...request.Option) (*DescribeSubscriptionFiltersOutput, error) { + req, out := c.DescribeSubscriptionFiltersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeSubscriptionFiltersPages iterates over the pages of a DescribeSubscriptionFilters operation, @@ -1397,12 +1738,37 @@ func (c *CloudWatchLogs) DescribeSubscriptionFilters(input *DescribeSubscription // return pageNum <= 3 // }) // -func (c *CloudWatchLogs) DescribeSubscriptionFiltersPages(input *DescribeSubscriptionFiltersInput, fn func(p *DescribeSubscriptionFiltersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeSubscriptionFiltersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeSubscriptionFiltersOutput), lastPage) - }) +func (c *CloudWatchLogs) DescribeSubscriptionFiltersPages(input *DescribeSubscriptionFiltersInput, fn func(*DescribeSubscriptionFiltersOutput, bool) bool) error { + return c.DescribeSubscriptionFiltersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSubscriptionFiltersPagesWithContext same as DescribeSubscriptionFiltersPages 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 *CloudWatchLogs) DescribeSubscriptionFiltersPagesWithContext(ctx aws.Context, input *DescribeSubscriptionFiltersInput, fn func(*DescribeSubscriptionFiltersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSubscriptionFiltersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSubscriptionFiltersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeSubscriptionFiltersOutput), !p.HasNextPage()) + } + return p.Err() } const opFilterLogEvents = "FilterLogEvents" @@ -1486,8 +1852,23 @@ func (c *CloudWatchLogs) FilterLogEventsRequest(input *FilterLogEventsInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/FilterLogEvents func (c *CloudWatchLogs) FilterLogEvents(input *FilterLogEventsInput) (*FilterLogEventsOutput, error) { req, out := c.FilterLogEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// FilterLogEventsWithContext is the same as FilterLogEvents with the addition of +// the ability to pass a context and additional request options. +// +// See FilterLogEvents 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 *CloudWatchLogs) FilterLogEventsWithContext(ctx aws.Context, input *FilterLogEventsInput, opts ...request.Option) (*FilterLogEventsOutput, error) { + req, out := c.FilterLogEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // FilterLogEventsPages iterates over the pages of a FilterLogEvents operation, @@ -1507,12 +1888,37 @@ func (c *CloudWatchLogs) FilterLogEvents(input *FilterLogEventsInput) (*FilterLo // return pageNum <= 3 // }) // -func (c *CloudWatchLogs) FilterLogEventsPages(input *FilterLogEventsInput, fn func(p *FilterLogEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.FilterLogEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*FilterLogEventsOutput), lastPage) - }) +func (c *CloudWatchLogs) FilterLogEventsPages(input *FilterLogEventsInput, fn func(*FilterLogEventsOutput, bool) bool) error { + return c.FilterLogEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// FilterLogEventsPagesWithContext same as FilterLogEventsPages 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 *CloudWatchLogs) FilterLogEventsPagesWithContext(ctx aws.Context, input *FilterLogEventsInput, fn func(*FilterLogEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *FilterLogEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.FilterLogEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*FilterLogEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opGetLogEvents = "GetLogEvents" @@ -1594,8 +2000,23 @@ func (c *CloudWatchLogs) GetLogEventsRequest(input *GetLogEventsInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogEvents func (c *CloudWatchLogs) GetLogEvents(input *GetLogEventsInput) (*GetLogEventsOutput, error) { req, out := c.GetLogEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetLogEventsWithContext is the same as GetLogEvents with the addition of +// the ability to pass a context and additional request options. +// +// See GetLogEvents 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 *CloudWatchLogs) GetLogEventsWithContext(ctx aws.Context, input *GetLogEventsInput, opts ...request.Option) (*GetLogEventsOutput, error) { + req, out := c.GetLogEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetLogEventsPages iterates over the pages of a GetLogEvents operation, @@ -1615,12 +2036,37 @@ func (c *CloudWatchLogs) GetLogEvents(input *GetLogEventsInput) (*GetLogEventsOu // return pageNum <= 3 // }) // -func (c *CloudWatchLogs) GetLogEventsPages(input *GetLogEventsInput, fn func(p *GetLogEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetLogEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetLogEventsOutput), lastPage) - }) +func (c *CloudWatchLogs) GetLogEventsPages(input *GetLogEventsInput, fn func(*GetLogEventsOutput, bool) bool) error { + return c.GetLogEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetLogEventsPagesWithContext same as GetLogEventsPages 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 *CloudWatchLogs) GetLogEventsPagesWithContext(ctx aws.Context, input *GetLogEventsInput, fn func(*GetLogEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetLogEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetLogEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetLogEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opListTagsLogGroup = "ListTagsLogGroup" @@ -1689,8 +2135,23 @@ func (c *CloudWatchLogs) ListTagsLogGroupRequest(input *ListTagsLogGroupInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsLogGroup func (c *CloudWatchLogs) ListTagsLogGroup(input *ListTagsLogGroupInput) (*ListTagsLogGroupOutput, error) { req, out := c.ListTagsLogGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsLogGroupWithContext is the same as ListTagsLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsLogGroup 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 *CloudWatchLogs) ListTagsLogGroupWithContext(ctx aws.Context, input *ListTagsLogGroupInput, opts ...request.Option) (*ListTagsLogGroupOutput, error) { + req, out := c.ListTagsLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutDestination = "PutDestination" @@ -1770,8 +2231,23 @@ func (c *CloudWatchLogs) PutDestinationRequest(input *PutDestinationInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestination func (c *CloudWatchLogs) PutDestination(input *PutDestinationInput) (*PutDestinationOutput, error) { req, out := c.PutDestinationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutDestinationWithContext is the same as PutDestination with the addition of +// the ability to pass a context and additional request options. +// +// See PutDestination 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 *CloudWatchLogs) PutDestinationWithContext(ctx aws.Context, input *PutDestinationInput, opts ...request.Option) (*PutDestinationOutput, error) { + req, out := c.PutDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutDestinationPolicy = "PutDestinationPolicy" @@ -1846,8 +2322,23 @@ func (c *CloudWatchLogs) PutDestinationPolicyRequest(input *PutDestinationPolicy // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationPolicy func (c *CloudWatchLogs) PutDestinationPolicy(input *PutDestinationPolicyInput) (*PutDestinationPolicyOutput, error) { req, out := c.PutDestinationPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutDestinationPolicyWithContext is the same as PutDestinationPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutDestinationPolicy 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 *CloudWatchLogs) PutDestinationPolicyWithContext(ctx aws.Context, input *PutDestinationPolicyInput, opts ...request.Option) (*PutDestinationPolicyOutput, error) { + req, out := c.PutDestinationPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutLogEvents = "PutLogEvents" @@ -1948,8 +2439,23 @@ func (c *CloudWatchLogs) PutLogEventsRequest(input *PutLogEventsInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutLogEvents func (c *CloudWatchLogs) PutLogEvents(input *PutLogEventsInput) (*PutLogEventsOutput, error) { req, out := c.PutLogEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutLogEventsWithContext is the same as PutLogEvents with the addition of +// the ability to pass a context and additional request options. +// +// See PutLogEvents 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 *CloudWatchLogs) PutLogEventsWithContext(ctx aws.Context, input *PutLogEventsInput, opts ...request.Option) (*PutLogEventsOutput, error) { + req, out := c.PutLogEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutMetricFilter = "PutMetricFilter" @@ -2032,8 +2538,23 @@ func (c *CloudWatchLogs) PutMetricFilterRequest(input *PutMetricFilterInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutMetricFilter func (c *CloudWatchLogs) PutMetricFilter(input *PutMetricFilterInput) (*PutMetricFilterOutput, error) { req, out := c.PutMetricFilterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutMetricFilterWithContext is the same as PutMetricFilter with the addition of +// the ability to pass a context and additional request options. +// +// See PutMetricFilter 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 *CloudWatchLogs) PutMetricFilterWithContext(ctx aws.Context, input *PutMetricFilterInput, opts ...request.Option) (*PutMetricFilterOutput, error) { + req, out := c.PutMetricFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRetentionPolicy = "PutRetentionPolicy" @@ -2110,8 +2631,23 @@ func (c *CloudWatchLogs) PutRetentionPolicyRequest(input *PutRetentionPolicyInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutRetentionPolicy func (c *CloudWatchLogs) PutRetentionPolicy(input *PutRetentionPolicyInput) (*PutRetentionPolicyOutput, error) { req, out := c.PutRetentionPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRetentionPolicyWithContext is the same as PutRetentionPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutRetentionPolicy 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 *CloudWatchLogs) PutRetentionPolicyWithContext(ctx aws.Context, input *PutRetentionPolicyInput, opts ...request.Option) (*PutRetentionPolicyOutput, error) { + req, out := c.PutRetentionPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutSubscriptionFilter = "PutSubscriptionFilter" @@ -2206,8 +2742,23 @@ func (c *CloudWatchLogs) PutSubscriptionFilterRequest(input *PutSubscriptionFilt // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutSubscriptionFilter func (c *CloudWatchLogs) PutSubscriptionFilter(input *PutSubscriptionFilterInput) (*PutSubscriptionFilterOutput, error) { req, out := c.PutSubscriptionFilterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutSubscriptionFilterWithContext is the same as PutSubscriptionFilter with the addition of +// the ability to pass a context and additional request options. +// +// See PutSubscriptionFilter 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 *CloudWatchLogs) PutSubscriptionFilterWithContext(ctx aws.Context, input *PutSubscriptionFilterInput, opts ...request.Option) (*PutSubscriptionFilterOutput, error) { + req, out := c.PutSubscriptionFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTagLogGroup = "TagLogGroup" @@ -2283,8 +2834,23 @@ func (c *CloudWatchLogs) TagLogGroupRequest(input *TagLogGroupInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagLogGroup func (c *CloudWatchLogs) TagLogGroup(input *TagLogGroupInput) (*TagLogGroupOutput, error) { req, out := c.TagLogGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TagLogGroupWithContext is the same as TagLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See TagLogGroup 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 *CloudWatchLogs) TagLogGroupWithContext(ctx aws.Context, input *TagLogGroupInput, opts ...request.Option) (*TagLogGroupOutput, error) { + req, out := c.TagLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestMetricFilter = "TestMetricFilter" @@ -2353,8 +2919,23 @@ func (c *CloudWatchLogs) TestMetricFilterRequest(input *TestMetricFilterInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TestMetricFilter func (c *CloudWatchLogs) TestMetricFilter(input *TestMetricFilterInput) (*TestMetricFilterOutput, error) { req, out := c.TestMetricFilterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestMetricFilterWithContext is the same as TestMetricFilter with the addition of +// the ability to pass a context and additional request options. +// +// See TestMetricFilter 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 *CloudWatchLogs) TestMetricFilterWithContext(ctx aws.Context, input *TestMetricFilterInput, opts ...request.Option) (*TestMetricFilterOutput, error) { + req, out := c.TestMetricFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUntagLogGroup = "UntagLogGroup" @@ -2423,8 +3004,23 @@ func (c *CloudWatchLogs) UntagLogGroupRequest(input *UntagLogGroupInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagLogGroup func (c *CloudWatchLogs) UntagLogGroup(input *UntagLogGroupInput) (*UntagLogGroupOutput, error) { req, out := c.UntagLogGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UntagLogGroupWithContext is the same as UntagLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See UntagLogGroup 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 *CloudWatchLogs) UntagLogGroupWithContext(ctx aws.Context, input *UntagLogGroupInput, opts ...request.Option) (*UntagLogGroupOutput, error) { + req, out := c.UntagLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CancelExportTaskRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/errors.go index de1b3fd9d3..772141f53a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudwatchlogs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go index e161f962be..d4b0cb559a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package cloudwatchlogs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/api.go index ebef335d18..8ffd903399 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package codebuild provides a client for AWS CodeBuild. package codebuild @@ -7,6 +7,7 @@ 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" ) @@ -72,8 +73,23 @@ func (c *CodeBuild) BatchGetBuildsRequest(input *BatchGetBuildsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/BatchGetBuilds func (c *CodeBuild) BatchGetBuilds(input *BatchGetBuildsInput) (*BatchGetBuildsOutput, error) { req, out := c.BatchGetBuildsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetBuildsWithContext is the same as BatchGetBuilds with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetBuilds 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 *CodeBuild) BatchGetBuildsWithContext(ctx aws.Context, input *BatchGetBuildsInput, opts ...request.Option) (*BatchGetBuildsOutput, error) { + req, out := c.BatchGetBuildsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetProjects = "BatchGetProjects" @@ -137,8 +153,23 @@ func (c *CodeBuild) BatchGetProjectsRequest(input *BatchGetProjectsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/BatchGetProjects func (c *CodeBuild) BatchGetProjects(input *BatchGetProjectsInput) (*BatchGetProjectsOutput, error) { req, out := c.BatchGetProjectsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetProjectsWithContext is the same as BatchGetProjects with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetProjects 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 *CodeBuild) BatchGetProjectsWithContext(ctx aws.Context, input *BatchGetProjectsInput, opts ...request.Option) (*BatchGetProjectsOutput, error) { + req, out := c.BatchGetProjectsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateProject = "CreateProject" @@ -209,8 +240,23 @@ func (c *CodeBuild) CreateProjectRequest(input *CreateProjectInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/CreateProject func (c *CodeBuild) CreateProject(input *CreateProjectInput) (*CreateProjectOutput, error) { req, out := c.CreateProjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateProjectWithContext is the same as CreateProject with the addition of +// the ability to pass a context and additional request options. +// +// See CreateProject 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 *CodeBuild) CreateProjectWithContext(ctx aws.Context, input *CreateProjectInput, opts ...request.Option) (*CreateProjectOutput, error) { + req, out := c.CreateProjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteProject = "DeleteProject" @@ -274,8 +320,23 @@ func (c *CodeBuild) DeleteProjectRequest(input *DeleteProjectInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/DeleteProject func (c *CodeBuild) DeleteProject(input *DeleteProjectInput) (*DeleteProjectOutput, error) { req, out := c.DeleteProjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteProjectWithContext is the same as DeleteProject with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteProject 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 *CodeBuild) DeleteProjectWithContext(ctx aws.Context, input *DeleteProjectInput, opts ...request.Option) (*DeleteProjectOutput, error) { + req, out := c.DeleteProjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBuilds = "ListBuilds" @@ -339,8 +400,23 @@ func (c *CodeBuild) ListBuildsRequest(input *ListBuildsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/ListBuilds func (c *CodeBuild) ListBuilds(input *ListBuildsInput) (*ListBuildsOutput, error) { req, out := c.ListBuildsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBuildsWithContext is the same as ListBuilds with the addition of +// the ability to pass a context and additional request options. +// +// See ListBuilds 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 *CodeBuild) ListBuildsWithContext(ctx aws.Context, input *ListBuildsInput, opts ...request.Option) (*ListBuildsOutput, error) { + req, out := c.ListBuildsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBuildsForProject = "ListBuildsForProject" @@ -408,8 +484,23 @@ func (c *CodeBuild) ListBuildsForProjectRequest(input *ListBuildsForProjectInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/ListBuildsForProject func (c *CodeBuild) ListBuildsForProject(input *ListBuildsForProjectInput) (*ListBuildsForProjectOutput, error) { req, out := c.ListBuildsForProjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBuildsForProjectWithContext is the same as ListBuildsForProject with the addition of +// the ability to pass a context and additional request options. +// +// See ListBuildsForProject 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 *CodeBuild) ListBuildsForProjectWithContext(ctx aws.Context, input *ListBuildsForProjectInput, opts ...request.Option) (*ListBuildsForProjectOutput, error) { + req, out := c.ListBuildsForProjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListCuratedEnvironmentImages = "ListCuratedEnvironmentImages" @@ -468,8 +559,23 @@ func (c *CodeBuild) ListCuratedEnvironmentImagesRequest(input *ListCuratedEnviro // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/ListCuratedEnvironmentImages func (c *CodeBuild) ListCuratedEnvironmentImages(input *ListCuratedEnvironmentImagesInput) (*ListCuratedEnvironmentImagesOutput, error) { req, out := c.ListCuratedEnvironmentImagesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListCuratedEnvironmentImagesWithContext is the same as ListCuratedEnvironmentImages with the addition of +// the ability to pass a context and additional request options. +// +// See ListCuratedEnvironmentImages 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 *CodeBuild) ListCuratedEnvironmentImagesWithContext(ctx aws.Context, input *ListCuratedEnvironmentImagesInput, opts ...request.Option) (*ListCuratedEnvironmentImagesOutput, error) { + req, out := c.ListCuratedEnvironmentImagesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListProjects = "ListProjects" @@ -534,8 +640,23 @@ func (c *CodeBuild) ListProjectsRequest(input *ListProjectsInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/ListProjects func (c *CodeBuild) ListProjects(input *ListProjectsInput) (*ListProjectsOutput, error) { req, out := c.ListProjectsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListProjectsWithContext is the same as ListProjects with the addition of +// the ability to pass a context and additional request options. +// +// See ListProjects 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 *CodeBuild) ListProjectsWithContext(ctx aws.Context, input *ListProjectsInput, opts ...request.Option) (*ListProjectsOutput, error) { + req, out := c.ListProjectsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartBuild = "StartBuild" @@ -605,8 +726,23 @@ func (c *CodeBuild) StartBuildRequest(input *StartBuildInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/StartBuild func (c *CodeBuild) StartBuild(input *StartBuildInput) (*StartBuildOutput, error) { req, out := c.StartBuildRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartBuildWithContext is the same as StartBuild with the addition of +// the ability to pass a context and additional request options. +// +// See StartBuild 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 *CodeBuild) StartBuildWithContext(ctx aws.Context, input *StartBuildInput, opts ...request.Option) (*StartBuildOutput, error) { + req, out := c.StartBuildRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopBuild = "StopBuild" @@ -673,8 +809,23 @@ func (c *CodeBuild) StopBuildRequest(input *StopBuildInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/StopBuild func (c *CodeBuild) StopBuild(input *StopBuildInput) (*StopBuildOutput, error) { req, out := c.StopBuildRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopBuildWithContext is the same as StopBuild with the addition of +// the ability to pass a context and additional request options. +// +// See StopBuild 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 *CodeBuild) StopBuildWithContext(ctx aws.Context, input *StopBuildInput, opts ...request.Option) (*StopBuildOutput, error) { + req, out := c.StopBuildRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateProject = "UpdateProject" @@ -741,8 +892,23 @@ func (c *CodeBuild) UpdateProjectRequest(input *UpdateProjectInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/UpdateProject func (c *CodeBuild) UpdateProject(input *UpdateProjectInput) (*UpdateProjectOutput, error) { req, out := c.UpdateProjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateProjectWithContext is the same as UpdateProject with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateProject 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 *CodeBuild) UpdateProjectWithContext(ctx aws.Context, input *UpdateProjectInput, opts ...request.Option) (*UpdateProjectOutput, error) { + req, out := c.UpdateProjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/BatchGetBuildsInput @@ -2505,14 +2671,15 @@ type ProjectSource struct { // bucket, the path to the ZIP file that contains the source code (for example, // bucket-name/path/to/object-name.zip) // - // * For source code in a GitHub repository, instead of specifying a value - // here, you connect your AWS account to your GitHub account. To do this, - // use the AWS CodeBuild console to begin creating a build project, and follow - // the on-screen instructions to complete the connection. (After you have - // connected to your GitHub account, you do not need to finish creating the - // build project, and you may then leave the AWS CodeBuild console.) To instruct - // AWS CodeBuild to then use this connection, in the source object, set the - // auth object's type value to OAUTH. + // * For source code in a GitHub repository, the HTTPS clone URL to the repository + // that contains the source and the build spec. Also, you must connect your + // AWS account to your GitHub account. To do this, use the AWS CodeBuild + // console to begin creating a build project, and follow the on-screen instructions + // to complete the connection. (After you have connected to your GitHub account, + // you do not need to finish creating the build project, and you may then + // leave the AWS CodeBuild console.) To instruct AWS CodeBuild to then use + // this connection, in the source object, set the auth object's type value + // to OAUTH. Location *string `locationName:"location" type:"string"` // The type of repository that contains the source code to be built. Valid values diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/errors.go index 88cfe77ad3..2b91b700a7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codebuild diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/service.go index 41d6dd7e72..22fc184dbe 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codebuild/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codebuild diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/api.go index 47ab5eab25..28e7837e91 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package codecommit provides a client for AWS CodeCommit. package codecommit @@ -7,6 +7,7 @@ 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" @@ -106,8 +107,23 @@ func (c *CodeCommit) BatchGetRepositoriesRequest(input *BatchGetRepositoriesInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/BatchGetRepositories func (c *CodeCommit) BatchGetRepositories(input *BatchGetRepositoriesInput) (*BatchGetRepositoriesOutput, error) { req, out := c.BatchGetRepositoriesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetRepositoriesWithContext is the same as BatchGetRepositories with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetRepositories 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 *CodeCommit) BatchGetRepositoriesWithContext(ctx aws.Context, input *BatchGetRepositoriesInput, opts ...request.Option) (*BatchGetRepositoriesOutput, error) { + req, out := c.BatchGetRepositoriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateBranch = "CreateBranch" @@ -220,8 +236,23 @@ func (c *CodeCommit) CreateBranchRequest(input *CreateBranchInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateBranch func (c *CodeCommit) CreateBranch(input *CreateBranchInput) (*CreateBranchOutput, error) { req, out := c.CreateBranchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateBranchWithContext is the same as CreateBranch with the addition of +// the ability to pass a context and additional request options. +// +// See CreateBranch 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 *CodeCommit) CreateBranchWithContext(ctx aws.Context, input *CreateBranchInput, opts ...request.Option) (*CreateBranchOutput, error) { + req, out := c.CreateBranchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateRepository = "CreateRepository" @@ -316,8 +347,23 @@ func (c *CodeCommit) CreateRepositoryRequest(input *CreateRepositoryInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/CreateRepository func (c *CodeCommit) CreateRepository(input *CreateRepositoryInput) (*CreateRepositoryOutput, error) { req, out := c.CreateRepositoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateRepositoryWithContext is the same as CreateRepository with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRepository 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 *CodeCommit) CreateRepositoryWithContext(ctx aws.Context, input *CreateRepositoryInput, opts ...request.Option) (*CreateRepositoryOutput, error) { + req, out := c.CreateRepositoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRepository = "DeleteRepository" @@ -408,8 +454,23 @@ func (c *CodeCommit) DeleteRepositoryRequest(input *DeleteRepositoryInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/DeleteRepository func (c *CodeCommit) DeleteRepository(input *DeleteRepositoryInput) (*DeleteRepositoryOutput, error) { req, out := c.DeleteRepositoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRepositoryWithContext is the same as DeleteRepository with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRepository 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 *CodeCommit) DeleteRepositoryWithContext(ctx aws.Context, input *DeleteRepositoryInput, opts ...request.Option) (*DeleteRepositoryOutput, error) { + req, out := c.DeleteRepositoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBlob = "GetBlob" @@ -512,8 +573,23 @@ func (c *CodeCommit) GetBlobRequest(input *GetBlobInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetBlob func (c *CodeCommit) GetBlob(input *GetBlobInput) (*GetBlobOutput, error) { req, out := c.GetBlobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBlobWithContext is the same as GetBlob with the addition of +// the ability to pass a context and additional request options. +// +// See GetBlob 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 *CodeCommit) GetBlobWithContext(ctx aws.Context, input *GetBlobInput, opts ...request.Option) (*GetBlobOutput, error) { + req, out := c.GetBlobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBranch = "GetBranch" @@ -612,8 +688,23 @@ func (c *CodeCommit) GetBranchRequest(input *GetBranchInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetBranch func (c *CodeCommit) GetBranch(input *GetBranchInput) (*GetBranchOutput, error) { req, out := c.GetBranchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBranchWithContext is the same as GetBranch with the addition of +// the ability to pass a context and additional request options. +// +// See GetBranch 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 *CodeCommit) GetBranchWithContext(ctx aws.Context, input *GetBranchInput, opts ...request.Option) (*GetBranchOutput, error) { + req, out := c.GetBranchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetCommit = "GetCommit" @@ -712,8 +803,23 @@ func (c *CodeCommit) GetCommitRequest(input *GetCommitInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetCommit func (c *CodeCommit) GetCommit(input *GetCommitInput) (*GetCommitOutput, error) { req, out := c.GetCommitRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCommitWithContext is the same as GetCommit with the addition of +// the ability to pass a context and additional request options. +// +// See GetCommit 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 *CodeCommit) GetCommitWithContext(ctx aws.Context, input *GetCommitInput, opts ...request.Option) (*GetCommitOutput, error) { + req, out := c.GetCommitRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDifferences = "GetDifferences" @@ -835,8 +941,23 @@ func (c *CodeCommit) GetDifferencesRequest(input *GetDifferencesInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetDifferences func (c *CodeCommit) GetDifferences(input *GetDifferencesInput) (*GetDifferencesOutput, error) { req, out := c.GetDifferencesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDifferencesWithContext is the same as GetDifferences with the addition of +// the ability to pass a context and additional request options. +// +// See GetDifferences 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 *CodeCommit) GetDifferencesWithContext(ctx aws.Context, input *GetDifferencesInput, opts ...request.Option) (*GetDifferencesOutput, error) { + req, out := c.GetDifferencesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetDifferencesPages iterates over the pages of a GetDifferences operation, @@ -856,12 +977,37 @@ func (c *CodeCommit) GetDifferences(input *GetDifferencesInput) (*GetDifferences // return pageNum <= 3 // }) // -func (c *CodeCommit) GetDifferencesPages(input *GetDifferencesInput, fn func(p *GetDifferencesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetDifferencesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetDifferencesOutput), lastPage) - }) +func (c *CodeCommit) GetDifferencesPages(input *GetDifferencesInput, fn func(*GetDifferencesOutput, bool) bool) error { + return c.GetDifferencesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetDifferencesPagesWithContext same as GetDifferencesPages 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 *CodeCommit) GetDifferencesPagesWithContext(ctx aws.Context, input *GetDifferencesInput, fn func(*GetDifferencesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetDifferencesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetDifferencesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetDifferencesOutput), !p.HasNextPage()) + } + return p.Err() } const opGetRepository = "GetRepository" @@ -956,8 +1102,23 @@ func (c *CodeCommit) GetRepositoryRequest(input *GetRepositoryInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetRepository func (c *CodeCommit) GetRepository(input *GetRepositoryInput) (*GetRepositoryOutput, error) { req, out := c.GetRepositoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRepositoryWithContext is the same as GetRepository with the addition of +// the ability to pass a context and additional request options. +// +// See GetRepository 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 *CodeCommit) GetRepositoryWithContext(ctx aws.Context, input *GetRepositoryInput, opts ...request.Option) (*GetRepositoryOutput, error) { + req, out := c.GetRepositoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRepositoryTriggers = "GetRepositoryTriggers" @@ -1046,8 +1207,23 @@ func (c *CodeCommit) GetRepositoryTriggersRequest(input *GetRepositoryTriggersIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetRepositoryTriggers func (c *CodeCommit) GetRepositoryTriggers(input *GetRepositoryTriggersInput) (*GetRepositoryTriggersOutput, error) { req, out := c.GetRepositoryTriggersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRepositoryTriggersWithContext is the same as GetRepositoryTriggers with the addition of +// the ability to pass a context and additional request options. +// +// See GetRepositoryTriggers 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 *CodeCommit) GetRepositoryTriggersWithContext(ctx aws.Context, input *GetRepositoryTriggersInput, opts ...request.Option) (*GetRepositoryTriggersOutput, error) { + req, out := c.GetRepositoryTriggersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBranches = "ListBranches" @@ -1145,8 +1321,23 @@ func (c *CodeCommit) ListBranchesRequest(input *ListBranchesInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListBranches func (c *CodeCommit) ListBranches(input *ListBranchesInput) (*ListBranchesOutput, error) { req, out := c.ListBranchesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBranchesWithContext is the same as ListBranches with the addition of +// the ability to pass a context and additional request options. +// +// See ListBranches 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 *CodeCommit) ListBranchesWithContext(ctx aws.Context, input *ListBranchesInput, opts ...request.Option) (*ListBranchesOutput, error) { + req, out := c.ListBranchesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListBranchesPages iterates over the pages of a ListBranches operation, @@ -1166,12 +1357,37 @@ func (c *CodeCommit) ListBranches(input *ListBranchesInput) (*ListBranchesOutput // return pageNum <= 3 // }) // -func (c *CodeCommit) ListBranchesPages(input *ListBranchesInput, fn func(p *ListBranchesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListBranchesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListBranchesOutput), lastPage) - }) +func (c *CodeCommit) ListBranchesPages(input *ListBranchesInput, fn func(*ListBranchesOutput, bool) bool) error { + return c.ListBranchesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListBranchesPagesWithContext same as ListBranchesPages 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 *CodeCommit) ListBranchesPagesWithContext(ctx aws.Context, input *ListBranchesInput, fn func(*ListBranchesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListBranchesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListBranchesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListBranchesOutput), !p.HasNextPage()) + } + return p.Err() } const opListRepositories = "ListRepositories" @@ -1247,8 +1463,23 @@ func (c *CodeCommit) ListRepositoriesRequest(input *ListRepositoriesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/ListRepositories func (c *CodeCommit) ListRepositories(input *ListRepositoriesInput) (*ListRepositoriesOutput, error) { req, out := c.ListRepositoriesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListRepositoriesWithContext is the same as ListRepositories with the addition of +// the ability to pass a context and additional request options. +// +// See ListRepositories 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 *CodeCommit) ListRepositoriesWithContext(ctx aws.Context, input *ListRepositoriesInput, opts ...request.Option) (*ListRepositoriesOutput, error) { + req, out := c.ListRepositoriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListRepositoriesPages iterates over the pages of a ListRepositories operation, @@ -1268,12 +1499,37 @@ func (c *CodeCommit) ListRepositories(input *ListRepositoriesInput) (*ListReposi // return pageNum <= 3 // }) // -func (c *CodeCommit) ListRepositoriesPages(input *ListRepositoriesInput, fn func(p *ListRepositoriesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListRepositoriesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListRepositoriesOutput), lastPage) - }) +func (c *CodeCommit) ListRepositoriesPages(input *ListRepositoriesInput, fn func(*ListRepositoriesOutput, bool) bool) error { + return c.ListRepositoriesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListRepositoriesPagesWithContext same as ListRepositoriesPages 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 *CodeCommit) ListRepositoriesPagesWithContext(ctx aws.Context, input *ListRepositoriesInput, fn func(*ListRepositoriesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListRepositoriesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListRepositoriesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListRepositoriesOutput), !p.HasNextPage()) + } + return p.Err() } const opPutRepositoryTriggers = "PutRepositoryTriggers" @@ -1408,8 +1664,23 @@ func (c *CodeCommit) PutRepositoryTriggersRequest(input *PutRepositoryTriggersIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/PutRepositoryTriggers func (c *CodeCommit) PutRepositoryTriggers(input *PutRepositoryTriggersInput) (*PutRepositoryTriggersOutput, error) { req, out := c.PutRepositoryTriggersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRepositoryTriggersWithContext is the same as PutRepositoryTriggers with the addition of +// the ability to pass a context and additional request options. +// +// See PutRepositoryTriggers 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 *CodeCommit) PutRepositoryTriggersWithContext(ctx aws.Context, input *PutRepositoryTriggersInput, opts ...request.Option) (*PutRepositoryTriggersOutput, error) { + req, out := c.PutRepositoryTriggersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestRepositoryTriggers = "TestRepositoryTriggers" @@ -1546,8 +1817,23 @@ func (c *CodeCommit) TestRepositoryTriggersRequest(input *TestRepositoryTriggers // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/TestRepositoryTriggers func (c *CodeCommit) TestRepositoryTriggers(input *TestRepositoryTriggersInput) (*TestRepositoryTriggersOutput, error) { req, out := c.TestRepositoryTriggersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestRepositoryTriggersWithContext is the same as TestRepositoryTriggers with the addition of +// the ability to pass a context and additional request options. +// +// See TestRepositoryTriggers 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 *CodeCommit) TestRepositoryTriggersWithContext(ctx aws.Context, input *TestRepositoryTriggersInput, opts ...request.Option) (*TestRepositoryTriggersOutput, error) { + req, out := c.TestRepositoryTriggersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDefaultBranch = "UpdateDefaultBranch" @@ -1651,8 +1937,23 @@ func (c *CodeCommit) UpdateDefaultBranchRequest(input *UpdateDefaultBranchInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateDefaultBranch func (c *CodeCommit) UpdateDefaultBranch(input *UpdateDefaultBranchInput) (*UpdateDefaultBranchOutput, error) { req, out := c.UpdateDefaultBranchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDefaultBranchWithContext is the same as UpdateDefaultBranch with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDefaultBranch 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 *CodeCommit) UpdateDefaultBranchWithContext(ctx aws.Context, input *UpdateDefaultBranchInput, opts ...request.Option) (*UpdateDefaultBranchOutput, error) { + req, out := c.UpdateDefaultBranchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateRepositoryDescription = "UpdateRepositoryDescription" @@ -1752,8 +2053,23 @@ func (c *CodeCommit) UpdateRepositoryDescriptionRequest(input *UpdateRepositoryD // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateRepositoryDescription func (c *CodeCommit) UpdateRepositoryDescription(input *UpdateRepositoryDescriptionInput) (*UpdateRepositoryDescriptionOutput, error) { req, out := c.UpdateRepositoryDescriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateRepositoryDescriptionWithContext is the same as UpdateRepositoryDescription with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRepositoryDescription 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 *CodeCommit) UpdateRepositoryDescriptionWithContext(ctx aws.Context, input *UpdateRepositoryDescriptionInput, opts ...request.Option) (*UpdateRepositoryDescriptionOutput, error) { + req, out := c.UpdateRepositoryDescriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateRepositoryName = "UpdateRepositoryName" @@ -1837,8 +2153,23 @@ func (c *CodeCommit) UpdateRepositoryNameRequest(input *UpdateRepositoryNameInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/UpdateRepositoryName func (c *CodeCommit) UpdateRepositoryName(input *UpdateRepositoryNameInput) (*UpdateRepositoryNameOutput, error) { req, out := c.UpdateRepositoryNameRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateRepositoryNameWithContext is the same as UpdateRepositoryName with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRepositoryName 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 *CodeCommit) UpdateRepositoryNameWithContext(ctx aws.Context, input *UpdateRepositoryNameInput, opts ...request.Option) (*UpdateRepositoryNameOutput, error) { + req, out := c.UpdateRepositoryNameRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents the input of a batch get repositories operation. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/errors.go index 718d09dec8..6200809f44 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codecommit diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/service.go index dd0b666134..b1e292ce01 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codecommit/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codecommit diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go index 8b4986235d..96e1b208c8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package codedeploy provides a client for AWS CodeDeploy. package codedeploy @@ -6,6 +6,7 @@ package codedeploy import ( "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" @@ -91,8 +92,23 @@ func (c *CodeDeploy) AddTagsToOnPremisesInstancesRequest(input *AddTagsToOnPremi // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/AddTagsToOnPremisesInstances func (c *CodeDeploy) AddTagsToOnPremisesInstances(input *AddTagsToOnPremisesInstancesInput) (*AddTagsToOnPremisesInstancesOutput, error) { req, out := c.AddTagsToOnPremisesInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToOnPremisesInstancesWithContext is the same as AddTagsToOnPremisesInstances with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToOnPremisesInstances 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 *CodeDeploy) AddTagsToOnPremisesInstancesWithContext(ctx aws.Context, input *AddTagsToOnPremisesInstancesInput, opts ...request.Option) (*AddTagsToOnPremisesInstancesOutput, error) { + req, out := c.AddTagsToOnPremisesInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetApplicationRevisions = "BatchGetApplicationRevisions" @@ -171,8 +187,23 @@ func (c *CodeDeploy) BatchGetApplicationRevisionsRequest(input *BatchGetApplicat // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/BatchGetApplicationRevisions func (c *CodeDeploy) BatchGetApplicationRevisions(input *BatchGetApplicationRevisionsInput) (*BatchGetApplicationRevisionsOutput, error) { req, out := c.BatchGetApplicationRevisionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetApplicationRevisionsWithContext is the same as BatchGetApplicationRevisions with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetApplicationRevisions 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 *CodeDeploy) BatchGetApplicationRevisionsWithContext(ctx aws.Context, input *BatchGetApplicationRevisionsInput, opts ...request.Option) (*BatchGetApplicationRevisionsOutput, error) { + req, out := c.BatchGetApplicationRevisionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetApplications = "BatchGetApplications" @@ -245,8 +276,23 @@ func (c *CodeDeploy) BatchGetApplicationsRequest(input *BatchGetApplicationsInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/BatchGetApplications func (c *CodeDeploy) BatchGetApplications(input *BatchGetApplicationsInput) (*BatchGetApplicationsOutput, error) { req, out := c.BatchGetApplicationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetApplicationsWithContext is the same as BatchGetApplications with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetApplications 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 *CodeDeploy) BatchGetApplicationsWithContext(ctx aws.Context, input *BatchGetApplicationsInput, opts ...request.Option) (*BatchGetApplicationsOutput, error) { + req, out := c.BatchGetApplicationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetDeploymentGroups = "BatchGetDeploymentGroups" @@ -325,8 +371,23 @@ func (c *CodeDeploy) BatchGetDeploymentGroupsRequest(input *BatchGetDeploymentGr // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/BatchGetDeploymentGroups func (c *CodeDeploy) BatchGetDeploymentGroups(input *BatchGetDeploymentGroupsInput) (*BatchGetDeploymentGroupsOutput, error) { req, out := c.BatchGetDeploymentGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetDeploymentGroupsWithContext is the same as BatchGetDeploymentGroups with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetDeploymentGroups 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 *CodeDeploy) BatchGetDeploymentGroupsWithContext(ctx aws.Context, input *BatchGetDeploymentGroupsInput, opts ...request.Option) (*BatchGetDeploymentGroupsOutput, error) { + req, out := c.BatchGetDeploymentGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetDeploymentInstances = "BatchGetDeploymentInstances" @@ -406,8 +467,23 @@ func (c *CodeDeploy) BatchGetDeploymentInstancesRequest(input *BatchGetDeploymen // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/BatchGetDeploymentInstances func (c *CodeDeploy) BatchGetDeploymentInstances(input *BatchGetDeploymentInstancesInput) (*BatchGetDeploymentInstancesOutput, error) { req, out := c.BatchGetDeploymentInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetDeploymentInstancesWithContext is the same as BatchGetDeploymentInstances with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetDeploymentInstances 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 *CodeDeploy) BatchGetDeploymentInstancesWithContext(ctx aws.Context, input *BatchGetDeploymentInstancesInput, opts ...request.Option) (*BatchGetDeploymentInstancesOutput, error) { + req, out := c.BatchGetDeploymentInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetDeployments = "BatchGetDeployments" @@ -477,8 +553,23 @@ func (c *CodeDeploy) BatchGetDeploymentsRequest(input *BatchGetDeploymentsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/BatchGetDeployments func (c *CodeDeploy) BatchGetDeployments(input *BatchGetDeploymentsInput) (*BatchGetDeploymentsOutput, error) { req, out := c.BatchGetDeploymentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetDeploymentsWithContext is the same as BatchGetDeployments with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetDeployments 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 *CodeDeploy) BatchGetDeploymentsWithContext(ctx aws.Context, input *BatchGetDeploymentsInput, opts ...request.Option) (*BatchGetDeploymentsOutput, error) { + req, out := c.BatchGetDeploymentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetOnPremisesInstances = "BatchGetOnPremisesInstances" @@ -548,8 +639,23 @@ func (c *CodeDeploy) BatchGetOnPremisesInstancesRequest(input *BatchGetOnPremise // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/BatchGetOnPremisesInstances func (c *CodeDeploy) BatchGetOnPremisesInstances(input *BatchGetOnPremisesInstancesInput) (*BatchGetOnPremisesInstancesOutput, error) { req, out := c.BatchGetOnPremisesInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetOnPremisesInstancesWithContext is the same as BatchGetOnPremisesInstances with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetOnPremisesInstances 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 *CodeDeploy) BatchGetOnPremisesInstancesWithContext(ctx aws.Context, input *BatchGetOnPremisesInstancesInput, opts ...request.Option) (*BatchGetOnPremisesInstancesOutput, error) { + req, out := c.BatchGetOnPremisesInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opContinueDeployment = "ContinueDeployment" @@ -634,8 +740,23 @@ func (c *CodeDeploy) ContinueDeploymentRequest(input *ContinueDeploymentInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ContinueDeployment func (c *CodeDeploy) ContinueDeployment(input *ContinueDeploymentInput) (*ContinueDeploymentOutput, error) { req, out := c.ContinueDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ContinueDeploymentWithContext is the same as ContinueDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See ContinueDeployment 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 *CodeDeploy) ContinueDeploymentWithContext(ctx aws.Context, input *ContinueDeploymentInput, opts ...request.Option) (*ContinueDeploymentOutput, error) { + req, out := c.ContinueDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateApplication = "CreateApplication" @@ -709,8 +830,23 @@ func (c *CodeDeploy) CreateApplicationRequest(input *CreateApplicationInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/CreateApplication func (c *CodeDeploy) CreateApplication(input *CreateApplicationInput) (*CreateApplicationOutput, error) { req, out := c.CreateApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateApplicationWithContext is the same as CreateApplication with the addition of +// the ability to pass a context and additional request options. +// +// See CreateApplication 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 *CodeDeploy) CreateApplicationWithContext(ctx aws.Context, input *CreateApplicationInput, opts ...request.Option) (*CreateApplicationOutput, error) { + req, out := c.CreateApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDeployment = "CreateDeployment" @@ -832,8 +968,23 @@ func (c *CodeDeploy) CreateDeploymentRequest(input *CreateDeploymentInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/CreateDeployment func (c *CodeDeploy) CreateDeployment(input *CreateDeploymentInput) (*CreateDeploymentOutput, error) { req, out := c.CreateDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDeploymentWithContext is the same as CreateDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDeployment 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 *CodeDeploy) CreateDeploymentWithContext(ctx aws.Context, input *CreateDeploymentInput, opts ...request.Option) (*CreateDeploymentOutput, error) { + req, out := c.CreateDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDeploymentConfig = "CreateDeploymentConfig" @@ -910,8 +1061,23 @@ func (c *CodeDeploy) CreateDeploymentConfigRequest(input *CreateDeploymentConfig // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/CreateDeploymentConfig func (c *CodeDeploy) CreateDeploymentConfig(input *CreateDeploymentConfigInput) (*CreateDeploymentConfigOutput, error) { req, out := c.CreateDeploymentConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDeploymentConfigWithContext is the same as CreateDeploymentConfig with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDeploymentConfig 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 *CodeDeploy) CreateDeploymentConfigWithContext(ctx aws.Context, input *CreateDeploymentConfigInput, opts ...request.Option) (*CreateDeploymentConfigOutput, error) { + req, out := c.CreateDeploymentConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDeploymentGroup = "CreateDeploymentGroup" @@ -1061,8 +1227,23 @@ func (c *CodeDeploy) CreateDeploymentGroupRequest(input *CreateDeploymentGroupIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/CreateDeploymentGroup func (c *CodeDeploy) CreateDeploymentGroup(input *CreateDeploymentGroupInput) (*CreateDeploymentGroupOutput, error) { req, out := c.CreateDeploymentGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDeploymentGroupWithContext is the same as CreateDeploymentGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDeploymentGroup 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 *CodeDeploy) CreateDeploymentGroupWithContext(ctx aws.Context, input *CreateDeploymentGroupInput, opts ...request.Option) (*CreateDeploymentGroupOutput, error) { + req, out := c.CreateDeploymentGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteApplication = "DeleteApplication" @@ -1131,8 +1312,23 @@ func (c *CodeDeploy) DeleteApplicationRequest(input *DeleteApplicationInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/DeleteApplication func (c *CodeDeploy) DeleteApplication(input *DeleteApplicationInput) (*DeleteApplicationOutput, error) { req, out := c.DeleteApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteApplicationWithContext is the same as DeleteApplication with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteApplication 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 *CodeDeploy) DeleteApplicationWithContext(ctx aws.Context, input *DeleteApplicationInput, opts ...request.Option) (*DeleteApplicationOutput, error) { + req, out := c.DeleteApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDeploymentConfig = "DeleteDeploymentConfig" @@ -1210,8 +1406,23 @@ func (c *CodeDeploy) DeleteDeploymentConfigRequest(input *DeleteDeploymentConfig // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/DeleteDeploymentConfig func (c *CodeDeploy) DeleteDeploymentConfig(input *DeleteDeploymentConfigInput) (*DeleteDeploymentConfigOutput, error) { req, out := c.DeleteDeploymentConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDeploymentConfigWithContext is the same as DeleteDeploymentConfig with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeploymentConfig 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 *CodeDeploy) DeleteDeploymentConfigWithContext(ctx aws.Context, input *DeleteDeploymentConfigInput, opts ...request.Option) (*DeleteDeploymentConfigOutput, error) { + req, out := c.DeleteDeploymentConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDeploymentGroup = "DeleteDeploymentGroup" @@ -1289,8 +1500,23 @@ func (c *CodeDeploy) DeleteDeploymentGroupRequest(input *DeleteDeploymentGroupIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/DeleteDeploymentGroup func (c *CodeDeploy) DeleteDeploymentGroup(input *DeleteDeploymentGroupInput) (*DeleteDeploymentGroupOutput, error) { req, out := c.DeleteDeploymentGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDeploymentGroupWithContext is the same as DeleteDeploymentGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeploymentGroup 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 *CodeDeploy) DeleteDeploymentGroupWithContext(ctx aws.Context, input *DeleteDeploymentGroupInput, opts ...request.Option) (*DeleteDeploymentGroupOutput, error) { + req, out := c.DeleteDeploymentGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterOnPremisesInstance = "DeregisterOnPremisesInstance" @@ -1359,8 +1585,23 @@ func (c *CodeDeploy) DeregisterOnPremisesInstanceRequest(input *DeregisterOnPrem // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/DeregisterOnPremisesInstance func (c *CodeDeploy) DeregisterOnPremisesInstance(input *DeregisterOnPremisesInstanceInput) (*DeregisterOnPremisesInstanceOutput, error) { req, out := c.DeregisterOnPremisesInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterOnPremisesInstanceWithContext is the same as DeregisterOnPremisesInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterOnPremisesInstance 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 *CodeDeploy) DeregisterOnPremisesInstanceWithContext(ctx aws.Context, input *DeregisterOnPremisesInstanceInput, opts ...request.Option) (*DeregisterOnPremisesInstanceOutput, error) { + req, out := c.DeregisterOnPremisesInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetApplication = "GetApplication" @@ -1430,8 +1671,23 @@ func (c *CodeDeploy) GetApplicationRequest(input *GetApplicationInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/GetApplication func (c *CodeDeploy) GetApplication(input *GetApplicationInput) (*GetApplicationOutput, error) { req, out := c.GetApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetApplicationWithContext is the same as GetApplication with the addition of +// the ability to pass a context and additional request options. +// +// See GetApplication 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 *CodeDeploy) GetApplicationWithContext(ctx aws.Context, input *GetApplicationInput, opts ...request.Option) (*GetApplicationOutput, error) { + req, out := c.GetApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetApplicationRevision = "GetApplicationRevision" @@ -1510,8 +1766,23 @@ func (c *CodeDeploy) GetApplicationRevisionRequest(input *GetApplicationRevision // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/GetApplicationRevision func (c *CodeDeploy) GetApplicationRevision(input *GetApplicationRevisionInput) (*GetApplicationRevisionOutput, error) { req, out := c.GetApplicationRevisionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetApplicationRevisionWithContext is the same as GetApplicationRevision with the addition of +// the ability to pass a context and additional request options. +// +// See GetApplicationRevision 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 *CodeDeploy) GetApplicationRevisionWithContext(ctx aws.Context, input *GetApplicationRevisionInput, opts ...request.Option) (*GetApplicationRevisionOutput, error) { + req, out := c.GetApplicationRevisionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDeployment = "GetDeployment" @@ -1581,8 +1852,23 @@ func (c *CodeDeploy) GetDeploymentRequest(input *GetDeploymentInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/GetDeployment func (c *CodeDeploy) GetDeployment(input *GetDeploymentInput) (*GetDeploymentOutput, error) { req, out := c.GetDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDeploymentWithContext is the same as GetDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeployment 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 *CodeDeploy) GetDeploymentWithContext(ctx aws.Context, input *GetDeploymentInput, opts ...request.Option) (*GetDeploymentOutput, error) { + req, out := c.GetDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDeploymentConfig = "GetDeploymentConfig" @@ -1653,8 +1939,23 @@ func (c *CodeDeploy) GetDeploymentConfigRequest(input *GetDeploymentConfigInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/GetDeploymentConfig func (c *CodeDeploy) GetDeploymentConfig(input *GetDeploymentConfigInput) (*GetDeploymentConfigOutput, error) { req, out := c.GetDeploymentConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDeploymentConfigWithContext is the same as GetDeploymentConfig with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeploymentConfig 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 *CodeDeploy) GetDeploymentConfigWithContext(ctx aws.Context, input *GetDeploymentConfigInput, opts ...request.Option) (*GetDeploymentConfigOutput, error) { + req, out := c.GetDeploymentConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDeploymentGroup = "GetDeploymentGroup" @@ -1734,8 +2035,23 @@ func (c *CodeDeploy) GetDeploymentGroupRequest(input *GetDeploymentGroupInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/GetDeploymentGroup func (c *CodeDeploy) GetDeploymentGroup(input *GetDeploymentGroupInput) (*GetDeploymentGroupOutput, error) { req, out := c.GetDeploymentGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDeploymentGroupWithContext is the same as GetDeploymentGroup with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeploymentGroup 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 *CodeDeploy) GetDeploymentGroupWithContext(ctx aws.Context, input *GetDeploymentGroupInput, opts ...request.Option) (*GetDeploymentGroupOutput, error) { + req, out := c.GetDeploymentGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDeploymentInstance = "GetDeploymentInstance" @@ -1814,8 +2130,23 @@ func (c *CodeDeploy) GetDeploymentInstanceRequest(input *GetDeploymentInstanceIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/GetDeploymentInstance func (c *CodeDeploy) GetDeploymentInstance(input *GetDeploymentInstanceInput) (*GetDeploymentInstanceOutput, error) { req, out := c.GetDeploymentInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDeploymentInstanceWithContext is the same as GetDeploymentInstance with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeploymentInstance 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 *CodeDeploy) GetDeploymentInstanceWithContext(ctx aws.Context, input *GetDeploymentInstanceInput, opts ...request.Option) (*GetDeploymentInstanceOutput, error) { + req, out := c.GetDeploymentInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetOnPremisesInstance = "GetOnPremisesInstance" @@ -1885,8 +2216,23 @@ func (c *CodeDeploy) GetOnPremisesInstanceRequest(input *GetOnPremisesInstanceIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/GetOnPremisesInstance func (c *CodeDeploy) GetOnPremisesInstance(input *GetOnPremisesInstanceInput) (*GetOnPremisesInstanceOutput, error) { req, out := c.GetOnPremisesInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetOnPremisesInstanceWithContext is the same as GetOnPremisesInstance with the addition of +// the ability to pass a context and additional request options. +// +// See GetOnPremisesInstance 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 *CodeDeploy) GetOnPremisesInstanceWithContext(ctx aws.Context, input *GetOnPremisesInstanceInput, opts ...request.Option) (*GetOnPremisesInstanceOutput, error) { + req, out := c.GetOnPremisesInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListApplicationRevisions = "ListApplicationRevisions" @@ -1921,6 +2267,12 @@ func (c *CodeDeploy) ListApplicationRevisionsRequest(input *ListApplicationRevis Name: opListApplicationRevisions, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -1978,8 +2330,73 @@ func (c *CodeDeploy) ListApplicationRevisionsRequest(input *ListApplicationRevis // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListApplicationRevisions func (c *CodeDeploy) ListApplicationRevisions(input *ListApplicationRevisionsInput) (*ListApplicationRevisionsOutput, error) { req, out := c.ListApplicationRevisionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListApplicationRevisionsWithContext is the same as ListApplicationRevisions with the addition of +// the ability to pass a context and additional request options. +// +// See ListApplicationRevisions 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 *CodeDeploy) ListApplicationRevisionsWithContext(ctx aws.Context, input *ListApplicationRevisionsInput, opts ...request.Option) (*ListApplicationRevisionsOutput, error) { + req, out := c.ListApplicationRevisionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListApplicationRevisionsPages iterates over the pages of a ListApplicationRevisions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListApplicationRevisions 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 ListApplicationRevisions operation. +// pageNum := 0 +// err := client.ListApplicationRevisionsPages(params, +// func(page *ListApplicationRevisionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CodeDeploy) ListApplicationRevisionsPages(input *ListApplicationRevisionsInput, fn func(*ListApplicationRevisionsOutput, bool) bool) error { + return c.ListApplicationRevisionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListApplicationRevisionsPagesWithContext same as ListApplicationRevisionsPages 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 *CodeDeploy) ListApplicationRevisionsPagesWithContext(ctx aws.Context, input *ListApplicationRevisionsInput, fn func(*ListApplicationRevisionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListApplicationRevisionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListApplicationRevisionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListApplicationRevisionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListApplications = "ListApplications" @@ -2014,6 +2431,12 @@ func (c *CodeDeploy) ListApplicationsRequest(input *ListApplicationsInput) (req Name: opListApplications, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -2043,8 +2466,73 @@ func (c *CodeDeploy) ListApplicationsRequest(input *ListApplicationsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListApplications func (c *CodeDeploy) ListApplications(input *ListApplicationsInput) (*ListApplicationsOutput, error) { req, out := c.ListApplicationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListApplicationsWithContext is the same as ListApplications with the addition of +// the ability to pass a context and additional request options. +// +// See ListApplications 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 *CodeDeploy) ListApplicationsWithContext(ctx aws.Context, input *ListApplicationsInput, opts ...request.Option) (*ListApplicationsOutput, error) { + req, out := c.ListApplicationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListApplicationsPages iterates over the pages of a ListApplications operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListApplications 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 ListApplications operation. +// pageNum := 0 +// err := client.ListApplicationsPages(params, +// func(page *ListApplicationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CodeDeploy) ListApplicationsPages(input *ListApplicationsInput, fn func(*ListApplicationsOutput, bool) bool) error { + return c.ListApplicationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListApplicationsPagesWithContext same as ListApplicationsPages 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 *CodeDeploy) ListApplicationsPagesWithContext(ctx aws.Context, input *ListApplicationsInput, fn func(*ListApplicationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListApplicationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListApplicationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListApplicationsOutput), !p.HasNextPage()) + } + return p.Err() } const opListDeploymentConfigs = "ListDeploymentConfigs" @@ -2079,6 +2567,12 @@ func (c *CodeDeploy) ListDeploymentConfigsRequest(input *ListDeploymentConfigsIn Name: opListDeploymentConfigs, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -2108,8 +2602,73 @@ func (c *CodeDeploy) ListDeploymentConfigsRequest(input *ListDeploymentConfigsIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListDeploymentConfigs func (c *CodeDeploy) ListDeploymentConfigs(input *ListDeploymentConfigsInput) (*ListDeploymentConfigsOutput, error) { req, out := c.ListDeploymentConfigsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDeploymentConfigsWithContext is the same as ListDeploymentConfigs with the addition of +// the ability to pass a context and additional request options. +// +// See ListDeploymentConfigs 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 *CodeDeploy) ListDeploymentConfigsWithContext(ctx aws.Context, input *ListDeploymentConfigsInput, opts ...request.Option) (*ListDeploymentConfigsOutput, error) { + req, out := c.ListDeploymentConfigsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListDeploymentConfigsPages iterates over the pages of a ListDeploymentConfigs operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListDeploymentConfigs 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 ListDeploymentConfigs operation. +// pageNum := 0 +// err := client.ListDeploymentConfigsPages(params, +// func(page *ListDeploymentConfigsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CodeDeploy) ListDeploymentConfigsPages(input *ListDeploymentConfigsInput, fn func(*ListDeploymentConfigsOutput, bool) bool) error { + return c.ListDeploymentConfigsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDeploymentConfigsPagesWithContext same as ListDeploymentConfigsPages 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 *CodeDeploy) ListDeploymentConfigsPagesWithContext(ctx aws.Context, input *ListDeploymentConfigsInput, fn func(*ListDeploymentConfigsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDeploymentConfigsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDeploymentConfigsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDeploymentConfigsOutput), !p.HasNextPage()) + } + return p.Err() } const opListDeploymentGroups = "ListDeploymentGroups" @@ -2144,6 +2703,12 @@ func (c *CodeDeploy) ListDeploymentGroupsRequest(input *ListDeploymentGroupsInpu Name: opListDeploymentGroups, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -2183,8 +2748,73 @@ func (c *CodeDeploy) ListDeploymentGroupsRequest(input *ListDeploymentGroupsInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListDeploymentGroups func (c *CodeDeploy) ListDeploymentGroups(input *ListDeploymentGroupsInput) (*ListDeploymentGroupsOutput, error) { req, out := c.ListDeploymentGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDeploymentGroupsWithContext is the same as ListDeploymentGroups with the addition of +// the ability to pass a context and additional request options. +// +// See ListDeploymentGroups 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 *CodeDeploy) ListDeploymentGroupsWithContext(ctx aws.Context, input *ListDeploymentGroupsInput, opts ...request.Option) (*ListDeploymentGroupsOutput, error) { + req, out := c.ListDeploymentGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListDeploymentGroupsPages iterates over the pages of a ListDeploymentGroups operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListDeploymentGroups 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 ListDeploymentGroups operation. +// pageNum := 0 +// err := client.ListDeploymentGroupsPages(params, +// func(page *ListDeploymentGroupsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CodeDeploy) ListDeploymentGroupsPages(input *ListDeploymentGroupsInput, fn func(*ListDeploymentGroupsOutput, bool) bool) error { + return c.ListDeploymentGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDeploymentGroupsPagesWithContext same as ListDeploymentGroupsPages 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 *CodeDeploy) ListDeploymentGroupsPagesWithContext(ctx aws.Context, input *ListDeploymentGroupsInput, fn func(*ListDeploymentGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDeploymentGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDeploymentGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDeploymentGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opListDeploymentInstances = "ListDeploymentInstances" @@ -2219,6 +2849,12 @@ func (c *CodeDeploy) ListDeploymentInstancesRequest(input *ListDeploymentInstanc Name: opListDeploymentInstances, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -2269,8 +2905,73 @@ func (c *CodeDeploy) ListDeploymentInstancesRequest(input *ListDeploymentInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListDeploymentInstances func (c *CodeDeploy) ListDeploymentInstances(input *ListDeploymentInstancesInput) (*ListDeploymentInstancesOutput, error) { req, out := c.ListDeploymentInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDeploymentInstancesWithContext is the same as ListDeploymentInstances with the addition of +// the ability to pass a context and additional request options. +// +// See ListDeploymentInstances 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 *CodeDeploy) ListDeploymentInstancesWithContext(ctx aws.Context, input *ListDeploymentInstancesInput, opts ...request.Option) (*ListDeploymentInstancesOutput, error) { + req, out := c.ListDeploymentInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListDeploymentInstancesPages iterates over the pages of a ListDeploymentInstances operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListDeploymentInstances 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 ListDeploymentInstances operation. +// pageNum := 0 +// err := client.ListDeploymentInstancesPages(params, +// func(page *ListDeploymentInstancesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CodeDeploy) ListDeploymentInstancesPages(input *ListDeploymentInstancesInput, fn func(*ListDeploymentInstancesOutput, bool) bool) error { + return c.ListDeploymentInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDeploymentInstancesPagesWithContext same as ListDeploymentInstancesPages 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 *CodeDeploy) ListDeploymentInstancesPagesWithContext(ctx aws.Context, input *ListDeploymentInstancesInput, fn func(*ListDeploymentInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDeploymentInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDeploymentInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDeploymentInstancesOutput), !p.HasNextPage()) + } + return p.Err() } const opListDeployments = "ListDeployments" @@ -2305,6 +3006,12 @@ func (c *CodeDeploy) ListDeploymentsRequest(input *ListDeploymentsInput) (req *r Name: opListDeployments, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -2360,8 +3067,73 @@ func (c *CodeDeploy) ListDeploymentsRequest(input *ListDeploymentsInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListDeployments func (c *CodeDeploy) ListDeployments(input *ListDeploymentsInput) (*ListDeploymentsOutput, error) { req, out := c.ListDeploymentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDeploymentsWithContext is the same as ListDeployments with the addition of +// the ability to pass a context and additional request options. +// +// See ListDeployments 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 *CodeDeploy) ListDeploymentsWithContext(ctx aws.Context, input *ListDeploymentsInput, opts ...request.Option) (*ListDeploymentsOutput, error) { + req, out := c.ListDeploymentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListDeploymentsPages iterates over the pages of a ListDeployments operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListDeployments 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 ListDeployments operation. +// pageNum := 0 +// err := client.ListDeploymentsPages(params, +// func(page *ListDeploymentsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *CodeDeploy) ListDeploymentsPages(input *ListDeploymentsInput, fn func(*ListDeploymentsOutput, bool) bool) error { + return c.ListDeploymentsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDeploymentsPagesWithContext same as ListDeploymentsPages 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 *CodeDeploy) ListDeploymentsPagesWithContext(ctx aws.Context, input *ListDeploymentsInput, fn func(*ListDeploymentsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDeploymentsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDeploymentsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDeploymentsOutput), !p.HasNextPage()) + } + return p.Err() } const opListOnPremisesInstances = "ListOnPremisesInstances" @@ -2435,8 +3207,23 @@ func (c *CodeDeploy) ListOnPremisesInstancesRequest(input *ListOnPremisesInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListOnPremisesInstances func (c *CodeDeploy) ListOnPremisesInstances(input *ListOnPremisesInstancesInput) (*ListOnPremisesInstancesOutput, error) { req, out := c.ListOnPremisesInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListOnPremisesInstancesWithContext is the same as ListOnPremisesInstances with the addition of +// the ability to pass a context and additional request options. +// +// See ListOnPremisesInstances 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 *CodeDeploy) ListOnPremisesInstancesWithContext(ctx aws.Context, input *ListOnPremisesInstancesInput, opts ...request.Option) (*ListOnPremisesInstancesOutput, error) { + req, out := c.ListOnPremisesInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterApplicationRevision = "RegisterApplicationRevision" @@ -2517,8 +3304,23 @@ func (c *CodeDeploy) RegisterApplicationRevisionRequest(input *RegisterApplicati // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RegisterApplicationRevision func (c *CodeDeploy) RegisterApplicationRevision(input *RegisterApplicationRevisionInput) (*RegisterApplicationRevisionOutput, error) { req, out := c.RegisterApplicationRevisionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterApplicationRevisionWithContext is the same as RegisterApplicationRevision with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterApplicationRevision 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 *CodeDeploy) RegisterApplicationRevisionWithContext(ctx aws.Context, input *RegisterApplicationRevisionInput, opts ...request.Option) (*RegisterApplicationRevisionOutput, error) { + req, out := c.RegisterApplicationRevisionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterOnPremisesInstance = "RegisterOnPremisesInstance" @@ -2617,8 +3419,23 @@ func (c *CodeDeploy) RegisterOnPremisesInstanceRequest(input *RegisterOnPremises // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RegisterOnPremisesInstance func (c *CodeDeploy) RegisterOnPremisesInstance(input *RegisterOnPremisesInstanceInput) (*RegisterOnPremisesInstanceOutput, error) { req, out := c.RegisterOnPremisesInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterOnPremisesInstanceWithContext is the same as RegisterOnPremisesInstance with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterOnPremisesInstance 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 *CodeDeploy) RegisterOnPremisesInstanceWithContext(ctx aws.Context, input *RegisterOnPremisesInstanceInput, opts ...request.Option) (*RegisterOnPremisesInstanceOutput, error) { + req, out := c.RegisterOnPremisesInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromOnPremisesInstances = "RemoveTagsFromOnPremisesInstances" @@ -2700,8 +3517,23 @@ func (c *CodeDeploy) RemoveTagsFromOnPremisesInstancesRequest(input *RemoveTagsF // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RemoveTagsFromOnPremisesInstances func (c *CodeDeploy) RemoveTagsFromOnPremisesInstances(input *RemoveTagsFromOnPremisesInstancesInput) (*RemoveTagsFromOnPremisesInstancesOutput, error) { req, out := c.RemoveTagsFromOnPremisesInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromOnPremisesInstancesWithContext is the same as RemoveTagsFromOnPremisesInstances with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromOnPremisesInstances 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 *CodeDeploy) RemoveTagsFromOnPremisesInstancesWithContext(ctx aws.Context, input *RemoveTagsFromOnPremisesInstancesInput, opts ...request.Option) (*RemoveTagsFromOnPremisesInstancesOutput, error) { + req, out := c.RemoveTagsFromOnPremisesInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSkipWaitTimeForInstanceTermination = "SkipWaitTimeForInstanceTermination" @@ -2783,8 +3615,23 @@ func (c *CodeDeploy) SkipWaitTimeForInstanceTerminationRequest(input *SkipWaitTi // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/SkipWaitTimeForInstanceTermination func (c *CodeDeploy) SkipWaitTimeForInstanceTermination(input *SkipWaitTimeForInstanceTerminationInput) (*SkipWaitTimeForInstanceTerminationOutput, error) { req, out := c.SkipWaitTimeForInstanceTerminationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SkipWaitTimeForInstanceTerminationWithContext is the same as SkipWaitTimeForInstanceTermination with the addition of +// the ability to pass a context and additional request options. +// +// See SkipWaitTimeForInstanceTermination 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 *CodeDeploy) SkipWaitTimeForInstanceTerminationWithContext(ctx aws.Context, input *SkipWaitTimeForInstanceTerminationInput, opts ...request.Option) (*SkipWaitTimeForInstanceTerminationOutput, error) { + req, out := c.SkipWaitTimeForInstanceTerminationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopDeployment = "StopDeployment" @@ -2857,8 +3704,23 @@ func (c *CodeDeploy) StopDeploymentRequest(input *StopDeploymentInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/StopDeployment func (c *CodeDeploy) StopDeployment(input *StopDeploymentInput) (*StopDeploymentOutput, error) { req, out := c.StopDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopDeploymentWithContext is the same as StopDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See StopDeployment 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 *CodeDeploy) StopDeploymentWithContext(ctx aws.Context, input *StopDeploymentInput, opts ...request.Option) (*StopDeploymentOutput, error) { + req, out := c.StopDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateApplication = "UpdateApplication" @@ -2934,8 +3796,23 @@ func (c *CodeDeploy) UpdateApplicationRequest(input *UpdateApplicationInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/UpdateApplication func (c *CodeDeploy) UpdateApplication(input *UpdateApplicationInput) (*UpdateApplicationOutput, error) { req, out := c.UpdateApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateApplicationWithContext is the same as UpdateApplication with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateApplication 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 *CodeDeploy) UpdateApplicationWithContext(ctx aws.Context, input *UpdateApplicationInput, opts ...request.Option) (*UpdateApplicationOutput, error) { + req, out := c.UpdateApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDeploymentGroup = "UpdateDeploymentGroup" @@ -3083,8 +3960,23 @@ func (c *CodeDeploy) UpdateDeploymentGroupRequest(input *UpdateDeploymentGroupIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/UpdateDeploymentGroup func (c *CodeDeploy) UpdateDeploymentGroup(input *UpdateDeploymentGroupInput) (*UpdateDeploymentGroupOutput, error) { req, out := c.UpdateDeploymentGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDeploymentGroupWithContext is the same as UpdateDeploymentGroup with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDeploymentGroup 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 *CodeDeploy) UpdateDeploymentGroupWithContext(ctx aws.Context, input *UpdateDeploymentGroupInput, opts ...request.Option) (*UpdateDeploymentGroupOutput, error) { + req, out := c.UpdateDeploymentGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents the input of, and adds tags to, an on-premises instance operation. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go index 6eebf73159..1f8c6a96da 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codedeploy diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/service.go index 5b20f2a457..87e0264560 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codedeploy diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/waiters.go index 3d605b11bf..8b885e8527 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codedeploy/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codedeploy import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilDeploymentSuccessful uses the CodeDeploy API operation @@ -11,36 +14,53 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *CodeDeploy) WaitUntilDeploymentSuccessful(input *GetDeploymentInput) error { - waiterCfg := waiter.Config{ - Operation: "GetDeployment", - Delay: 15, + return c.WaitUntilDeploymentSuccessfulWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilDeploymentSuccessfulWithContext is an extended version of WaitUntilDeploymentSuccessful. +// 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 *CodeDeploy) WaitUntilDeploymentSuccessfulWithContext(ctx aws.Context, input *GetDeploymentInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilDeploymentSuccessful", MaxAttempts: 120, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "deploymentInfo.status", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "deploymentInfo.status", Expected: "Succeeded", }, { - State: "failure", - Matcher: "path", - Argument: "deploymentInfo.status", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "deploymentInfo.status", Expected: "Failed", }, { - State: "failure", - Matcher: "path", - Argument: "deploymentInfo.status", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "deploymentInfo.status", Expected: "Stopped", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetDeploymentInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetDeploymentRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/api.go index 0320007aae..1e4ce3cc12 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package codepipeline provides a client for AWS CodePipeline. package codepipeline @@ -7,6 +7,7 @@ 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" @@ -81,8 +82,23 @@ func (c *CodePipeline) AcknowledgeJobRequest(input *AcknowledgeJobInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/AcknowledgeJob func (c *CodePipeline) AcknowledgeJob(input *AcknowledgeJobInput) (*AcknowledgeJobOutput, error) { req, out := c.AcknowledgeJobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AcknowledgeJobWithContext is the same as AcknowledgeJob with the addition of +// the ability to pass a context and additional request options. +// +// See AcknowledgeJob 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 *CodePipeline) AcknowledgeJobWithContext(ctx aws.Context, input *AcknowledgeJobInput, opts ...request.Option) (*AcknowledgeJobOutput, error) { + req, out := c.AcknowledgeJobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAcknowledgeThirdPartyJob = "AcknowledgeThirdPartyJob" @@ -156,8 +172,23 @@ func (c *CodePipeline) AcknowledgeThirdPartyJobRequest(input *AcknowledgeThirdPa // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/AcknowledgeThirdPartyJob func (c *CodePipeline) AcknowledgeThirdPartyJob(input *AcknowledgeThirdPartyJobInput) (*AcknowledgeThirdPartyJobOutput, error) { req, out := c.AcknowledgeThirdPartyJobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AcknowledgeThirdPartyJobWithContext is the same as AcknowledgeThirdPartyJob with the addition of +// the ability to pass a context and additional request options. +// +// See AcknowledgeThirdPartyJob 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 *CodePipeline) AcknowledgeThirdPartyJobWithContext(ctx aws.Context, input *AcknowledgeThirdPartyJobInput, opts ...request.Option) (*AcknowledgeThirdPartyJobOutput, error) { + req, out := c.AcknowledgeThirdPartyJobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateCustomActionType = "CreateCustomActionType" @@ -226,8 +257,23 @@ func (c *CodePipeline) CreateCustomActionTypeRequest(input *CreateCustomActionTy // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/CreateCustomActionType func (c *CodePipeline) CreateCustomActionType(input *CreateCustomActionTypeInput) (*CreateCustomActionTypeOutput, error) { req, out := c.CreateCustomActionTypeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateCustomActionTypeWithContext is the same as CreateCustomActionType with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCustomActionType 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 *CodePipeline) CreateCustomActionTypeWithContext(ctx aws.Context, input *CreateCustomActionTypeInput, opts ...request.Option) (*CreateCustomActionTypeOutput, error) { + req, out := c.CreateCustomActionTypeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePipeline = "CreatePipeline" @@ -310,8 +356,23 @@ func (c *CodePipeline) CreatePipelineRequest(input *CreatePipelineInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/CreatePipeline func (c *CodePipeline) CreatePipeline(input *CreatePipelineInput) (*CreatePipelineOutput, error) { req, out := c.CreatePipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePipelineWithContext is the same as CreatePipeline with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePipeline 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 *CodePipeline) CreatePipelineWithContext(ctx aws.Context, input *CreatePipelineInput, opts ...request.Option) (*CreatePipelineOutput, error) { + req, out := c.CreatePipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCustomActionType = "DeleteCustomActionType" @@ -381,8 +442,23 @@ func (c *CodePipeline) DeleteCustomActionTypeRequest(input *DeleteCustomActionTy // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/DeleteCustomActionType func (c *CodePipeline) DeleteCustomActionType(input *DeleteCustomActionTypeInput) (*DeleteCustomActionTypeOutput, error) { req, out := c.DeleteCustomActionTypeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCustomActionTypeWithContext is the same as DeleteCustomActionType with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCustomActionType 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 *CodePipeline) DeleteCustomActionTypeWithContext(ctx aws.Context, input *DeleteCustomActionTypeInput, opts ...request.Option) (*DeleteCustomActionTypeOutput, error) { + req, out := c.DeleteCustomActionTypeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeletePipeline = "DeletePipeline" @@ -448,8 +524,23 @@ func (c *CodePipeline) DeletePipelineRequest(input *DeletePipelineInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/DeletePipeline func (c *CodePipeline) DeletePipeline(input *DeletePipelineInput) (*DeletePipelineOutput, error) { req, out := c.DeletePipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeletePipelineWithContext is the same as DeletePipeline with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePipeline 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 *CodePipeline) DeletePipelineWithContext(ctx aws.Context, input *DeletePipelineInput, opts ...request.Option) (*DeletePipelineOutput, error) { + req, out := c.DeletePipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableStageTransition = "DisableStageTransition" @@ -522,8 +613,23 @@ func (c *CodePipeline) DisableStageTransitionRequest(input *DisableStageTransiti // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/DisableStageTransition func (c *CodePipeline) DisableStageTransition(input *DisableStageTransitionInput) (*DisableStageTransitionOutput, error) { req, out := c.DisableStageTransitionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableStageTransitionWithContext is the same as DisableStageTransition with the addition of +// the ability to pass a context and additional request options. +// +// See DisableStageTransition 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 *CodePipeline) DisableStageTransitionWithContext(ctx aws.Context, input *DisableStageTransitionInput, opts ...request.Option) (*DisableStageTransitionOutput, error) { + req, out := c.DisableStageTransitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableStageTransition = "EnableStageTransition" @@ -595,8 +701,23 @@ func (c *CodePipeline) EnableStageTransitionRequest(input *EnableStageTransition // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/EnableStageTransition func (c *CodePipeline) EnableStageTransition(input *EnableStageTransitionInput) (*EnableStageTransitionOutput, error) { req, out := c.EnableStageTransitionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableStageTransitionWithContext is the same as EnableStageTransition with the addition of +// the ability to pass a context and additional request options. +// +// See EnableStageTransition 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 *CodePipeline) EnableStageTransitionWithContext(ctx aws.Context, input *EnableStageTransitionInput, opts ...request.Option) (*EnableStageTransitionOutput, error) { + req, out := c.EnableStageTransitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetJobDetails = "GetJobDetails" @@ -668,8 +789,23 @@ func (c *CodePipeline) GetJobDetailsRequest(input *GetJobDetailsInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/GetJobDetails func (c *CodePipeline) GetJobDetails(input *GetJobDetailsInput) (*GetJobDetailsOutput, error) { req, out := c.GetJobDetailsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetJobDetailsWithContext is the same as GetJobDetails with the addition of +// the ability to pass a context and additional request options. +// +// See GetJobDetails 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 *CodePipeline) GetJobDetailsWithContext(ctx aws.Context, input *GetJobDetailsInput, opts ...request.Option) (*GetJobDetailsOutput, error) { + req, out := c.GetJobDetailsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPipeline = "GetPipeline" @@ -742,8 +878,23 @@ func (c *CodePipeline) GetPipelineRequest(input *GetPipelineInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/GetPipeline func (c *CodePipeline) GetPipeline(input *GetPipelineInput) (*GetPipelineOutput, error) { req, out := c.GetPipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPipelineWithContext is the same as GetPipeline with the addition of +// the ability to pass a context and additional request options. +// +// See GetPipeline 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 *CodePipeline) GetPipelineWithContext(ctx aws.Context, input *GetPipelineInput, opts ...request.Option) (*GetPipelineOutput, error) { + req, out := c.GetPipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPipelineExecution = "GetPipelineExecution" @@ -816,8 +967,23 @@ func (c *CodePipeline) GetPipelineExecutionRequest(input *GetPipelineExecutionIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/GetPipelineExecution func (c *CodePipeline) GetPipelineExecution(input *GetPipelineExecutionInput) (*GetPipelineExecutionOutput, error) { req, out := c.GetPipelineExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPipelineExecutionWithContext is the same as GetPipelineExecution with the addition of +// the ability to pass a context and additional request options. +// +// See GetPipelineExecution 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 *CodePipeline) GetPipelineExecutionWithContext(ctx aws.Context, input *GetPipelineExecutionInput, opts ...request.Option) (*GetPipelineExecutionOutput, error) { + req, out := c.GetPipelineExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPipelineState = "GetPipelineState" @@ -885,8 +1051,23 @@ func (c *CodePipeline) GetPipelineStateRequest(input *GetPipelineStateInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/GetPipelineState func (c *CodePipeline) GetPipelineState(input *GetPipelineStateInput) (*GetPipelineStateOutput, error) { req, out := c.GetPipelineStateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPipelineStateWithContext is the same as GetPipelineState with the addition of +// the ability to pass a context and additional request options. +// +// See GetPipelineState 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 *CodePipeline) GetPipelineStateWithContext(ctx aws.Context, input *GetPipelineStateInput, opts ...request.Option) (*GetPipelineStateOutput, error) { + req, out := c.GetPipelineStateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetThirdPartyJobDetails = "GetThirdPartyJobDetails" @@ -965,8 +1146,23 @@ func (c *CodePipeline) GetThirdPartyJobDetailsRequest(input *GetThirdPartyJobDet // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/GetThirdPartyJobDetails func (c *CodePipeline) GetThirdPartyJobDetails(input *GetThirdPartyJobDetailsInput) (*GetThirdPartyJobDetailsOutput, error) { req, out := c.GetThirdPartyJobDetailsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetThirdPartyJobDetailsWithContext is the same as GetThirdPartyJobDetails with the addition of +// the ability to pass a context and additional request options. +// +// See GetThirdPartyJobDetails 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 *CodePipeline) GetThirdPartyJobDetailsWithContext(ctx aws.Context, input *GetThirdPartyJobDetailsInput, opts ...request.Option) (*GetThirdPartyJobDetailsOutput, error) { + req, out := c.GetThirdPartyJobDetailsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListActionTypes = "ListActionTypes" @@ -1035,8 +1231,23 @@ func (c *CodePipeline) ListActionTypesRequest(input *ListActionTypesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/ListActionTypes func (c *CodePipeline) ListActionTypes(input *ListActionTypesInput) (*ListActionTypesOutput, error) { req, out := c.ListActionTypesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListActionTypesWithContext is the same as ListActionTypes with the addition of +// the ability to pass a context and additional request options. +// +// See ListActionTypes 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 *CodePipeline) ListActionTypesWithContext(ctx aws.Context, input *ListActionTypesInput, opts ...request.Option) (*ListActionTypesOutput, error) { + req, out := c.ListActionTypesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListPipelines = "ListPipelines" @@ -1101,8 +1312,23 @@ func (c *CodePipeline) ListPipelinesRequest(input *ListPipelinesInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/ListPipelines func (c *CodePipeline) ListPipelines(input *ListPipelinesInput) (*ListPipelinesOutput, error) { req, out := c.ListPipelinesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPipelinesWithContext is the same as ListPipelines with the addition of +// the ability to pass a context and additional request options. +// +// See ListPipelines 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 *CodePipeline) ListPipelinesWithContext(ctx aws.Context, input *ListPipelinesInput, opts ...request.Option) (*ListPipelinesOutput, error) { + req, out := c.ListPipelinesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPollForJobs = "PollForJobs" @@ -1174,8 +1400,23 @@ func (c *CodePipeline) PollForJobsRequest(input *PollForJobsInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PollForJobs func (c *CodePipeline) PollForJobs(input *PollForJobsInput) (*PollForJobsOutput, error) { req, out := c.PollForJobsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PollForJobsWithContext is the same as PollForJobs with the addition of +// the ability to pass a context and additional request options. +// +// See PollForJobs 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 *CodePipeline) PollForJobsWithContext(ctx aws.Context, input *PollForJobsInput, opts ...request.Option) (*PollForJobsOutput, error) { + req, out := c.PollForJobsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPollForThirdPartyJobs = "PollForThirdPartyJobs" @@ -1247,8 +1488,23 @@ func (c *CodePipeline) PollForThirdPartyJobsRequest(input *PollForThirdPartyJobs // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PollForThirdPartyJobs func (c *CodePipeline) PollForThirdPartyJobs(input *PollForThirdPartyJobsInput) (*PollForThirdPartyJobsOutput, error) { req, out := c.PollForThirdPartyJobsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PollForThirdPartyJobsWithContext is the same as PollForThirdPartyJobs with the addition of +// the ability to pass a context and additional request options. +// +// See PollForThirdPartyJobs 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 *CodePipeline) PollForThirdPartyJobsWithContext(ctx aws.Context, input *PollForThirdPartyJobsInput, opts ...request.Option) (*PollForThirdPartyJobsOutput, error) { + req, out := c.PollForThirdPartyJobsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutActionRevision = "PutActionRevision" @@ -1321,8 +1577,23 @@ func (c *CodePipeline) PutActionRevisionRequest(input *PutActionRevisionInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PutActionRevision func (c *CodePipeline) PutActionRevision(input *PutActionRevisionInput) (*PutActionRevisionOutput, error) { req, out := c.PutActionRevisionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutActionRevisionWithContext is the same as PutActionRevision with the addition of +// the ability to pass a context and additional request options. +// +// See PutActionRevision 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 *CodePipeline) PutActionRevisionWithContext(ctx aws.Context, input *PutActionRevisionInput, opts ...request.Option) (*PutActionRevisionOutput, error) { + req, out := c.PutActionRevisionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutApprovalResult = "PutApprovalResult" @@ -1402,8 +1673,23 @@ func (c *CodePipeline) PutApprovalResultRequest(input *PutApprovalResultInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PutApprovalResult func (c *CodePipeline) PutApprovalResult(input *PutApprovalResultInput) (*PutApprovalResultOutput, error) { req, out := c.PutApprovalResultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutApprovalResultWithContext is the same as PutApprovalResult with the addition of +// the ability to pass a context and additional request options. +// +// See PutApprovalResult 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 *CodePipeline) PutApprovalResultWithContext(ctx aws.Context, input *PutApprovalResultInput, opts ...request.Option) (*PutApprovalResultOutput, error) { + req, out := c.PutApprovalResultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutJobFailureResult = "PutJobFailureResult" @@ -1476,8 +1762,23 @@ func (c *CodePipeline) PutJobFailureResultRequest(input *PutJobFailureResultInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PutJobFailureResult func (c *CodePipeline) PutJobFailureResult(input *PutJobFailureResultInput) (*PutJobFailureResultOutput, error) { req, out := c.PutJobFailureResultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutJobFailureResultWithContext is the same as PutJobFailureResult with the addition of +// the ability to pass a context and additional request options. +// +// See PutJobFailureResult 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 *CodePipeline) PutJobFailureResultWithContext(ctx aws.Context, input *PutJobFailureResultInput, opts ...request.Option) (*PutJobFailureResultOutput, error) { + req, out := c.PutJobFailureResultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutJobSuccessResult = "PutJobSuccessResult" @@ -1550,8 +1851,23 @@ func (c *CodePipeline) PutJobSuccessResultRequest(input *PutJobSuccessResultInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PutJobSuccessResult func (c *CodePipeline) PutJobSuccessResult(input *PutJobSuccessResultInput) (*PutJobSuccessResultOutput, error) { req, out := c.PutJobSuccessResultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutJobSuccessResultWithContext is the same as PutJobSuccessResult with the addition of +// the ability to pass a context and additional request options. +// +// See PutJobSuccessResult 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 *CodePipeline) PutJobSuccessResultWithContext(ctx aws.Context, input *PutJobSuccessResultInput, opts ...request.Option) (*PutJobSuccessResultOutput, error) { + req, out := c.PutJobSuccessResultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutThirdPartyJobFailureResult = "PutThirdPartyJobFailureResult" @@ -1627,8 +1943,23 @@ func (c *CodePipeline) PutThirdPartyJobFailureResultRequest(input *PutThirdParty // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PutThirdPartyJobFailureResult func (c *CodePipeline) PutThirdPartyJobFailureResult(input *PutThirdPartyJobFailureResultInput) (*PutThirdPartyJobFailureResultOutput, error) { req, out := c.PutThirdPartyJobFailureResultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutThirdPartyJobFailureResultWithContext is the same as PutThirdPartyJobFailureResult with the addition of +// the ability to pass a context and additional request options. +// +// See PutThirdPartyJobFailureResult 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 *CodePipeline) PutThirdPartyJobFailureResultWithContext(ctx aws.Context, input *PutThirdPartyJobFailureResultInput, opts ...request.Option) (*PutThirdPartyJobFailureResultOutput, error) { + req, out := c.PutThirdPartyJobFailureResultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutThirdPartyJobSuccessResult = "PutThirdPartyJobSuccessResult" @@ -1704,8 +2035,23 @@ func (c *CodePipeline) PutThirdPartyJobSuccessResultRequest(input *PutThirdParty // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/PutThirdPartyJobSuccessResult func (c *CodePipeline) PutThirdPartyJobSuccessResult(input *PutThirdPartyJobSuccessResultInput) (*PutThirdPartyJobSuccessResultOutput, error) { req, out := c.PutThirdPartyJobSuccessResultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutThirdPartyJobSuccessResultWithContext is the same as PutThirdPartyJobSuccessResult with the addition of +// the ability to pass a context and additional request options. +// +// See PutThirdPartyJobSuccessResult 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 *CodePipeline) PutThirdPartyJobSuccessResultWithContext(ctx aws.Context, input *PutThirdPartyJobSuccessResultInput, opts ...request.Option) (*PutThirdPartyJobSuccessResultOutput, error) { + req, out := c.PutThirdPartyJobSuccessResultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRetryStageExecution = "RetryStageExecution" @@ -1785,8 +2131,23 @@ func (c *CodePipeline) RetryStageExecutionRequest(input *RetryStageExecutionInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/RetryStageExecution func (c *CodePipeline) RetryStageExecution(input *RetryStageExecutionInput) (*RetryStageExecutionOutput, error) { req, out := c.RetryStageExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RetryStageExecutionWithContext is the same as RetryStageExecution with the addition of +// the ability to pass a context and additional request options. +// +// See RetryStageExecution 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 *CodePipeline) RetryStageExecutionWithContext(ctx aws.Context, input *RetryStageExecutionInput, opts ...request.Option) (*RetryStageExecutionOutput, error) { + req, out := c.RetryStageExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartPipelineExecution = "StartPipelineExecution" @@ -1854,8 +2215,23 @@ func (c *CodePipeline) StartPipelineExecutionRequest(input *StartPipelineExecuti // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/StartPipelineExecution func (c *CodePipeline) StartPipelineExecution(input *StartPipelineExecutionInput) (*StartPipelineExecutionOutput, error) { req, out := c.StartPipelineExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartPipelineExecutionWithContext is the same as StartPipelineExecution with the addition of +// the ability to pass a context and additional request options. +// +// See StartPipelineExecution 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 *CodePipeline) StartPipelineExecutionWithContext(ctx aws.Context, input *StartPipelineExecutionInput, opts ...request.Option) (*StartPipelineExecutionOutput, error) { + req, out := c.StartPipelineExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdatePipeline = "UpdatePipeline" @@ -1934,8 +2310,23 @@ func (c *CodePipeline) UpdatePipelineRequest(input *UpdatePipelineInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/UpdatePipeline func (c *CodePipeline) UpdatePipeline(input *UpdatePipelineInput) (*UpdatePipelineOutput, error) { req, out := c.UpdatePipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdatePipelineWithContext is the same as UpdatePipeline with the addition of +// the ability to pass a context and additional request options. +// +// See UpdatePipeline 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 *CodePipeline) UpdatePipelineWithContext(ctx aws.Context, input *UpdatePipelineInput, opts ...request.Option) (*UpdatePipelineOutput, error) { + req, out := c.UpdatePipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents an AWS session credentials object. These credentials are temporary diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/errors.go index 7e664c0e74..ca160b26a8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codepipeline diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/service.go index 960d8f52a6..9f18b1d342 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/codepipeline/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package codepipeline diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/api.go new file mode 100644 index 0000000000..cd24651443 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/api.go @@ -0,0 +1,4113 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package cognitoidentity provides a client for Amazon Cognito Identity. +package cognitoidentity + +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 opCreateIdentityPool = "CreateIdentityPool" + +// CreateIdentityPoolRequest generates a "aws/request.Request" representing the +// client's request for the CreateIdentityPool operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See CreateIdentityPool for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateIdentityPool method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateIdentityPoolRequest method. +// req, resp := client.CreateIdentityPoolRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/CreateIdentityPool +func (c *CognitoIdentity) CreateIdentityPoolRequest(input *CreateIdentityPoolInput) (req *request.Request, output *IdentityPool) { + op := &request.Operation{ + Name: opCreateIdentityPool, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateIdentityPoolInput{} + } + + output = &IdentityPool{} + req = c.newRequest(op, input, output) + return +} + +// CreateIdentityPool API operation for Amazon Cognito Identity. +// +// Creates a new identity pool. The identity pool is a store of user identity +// information that is specific to your AWS account. The limit on identity pools +// is 60 per account. The keys for SupportedLoginProviders are as follows: +// +// * Facebook: graph.facebook.com +// +// * Google: accounts.google.com +// +// * Amazon: www.amazon.com +// +// * Twitter: api.twitter.com +// +// * Digits: www.digits.com +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation CreateIdentityPool for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// Thrown when the total number of user pools has exceeded a preset limit. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/CreateIdentityPool +func (c *CognitoIdentity) CreateIdentityPool(input *CreateIdentityPoolInput) (*IdentityPool, error) { + req, out := c.CreateIdentityPoolRequest(input) + return out, req.Send() +} + +// CreateIdentityPoolWithContext is the same as CreateIdentityPool with the addition of +// the ability to pass a context and additional request options. +// +// See CreateIdentityPool 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 *CognitoIdentity) CreateIdentityPoolWithContext(ctx aws.Context, input *CreateIdentityPoolInput, opts ...request.Option) (*IdentityPool, error) { + req, out := c.CreateIdentityPoolRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteIdentities = "DeleteIdentities" + +// DeleteIdentitiesRequest generates a "aws/request.Request" representing the +// client's request for the DeleteIdentities operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DeleteIdentities for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteIdentities method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteIdentitiesRequest method. +// req, resp := client.DeleteIdentitiesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentities +func (c *CognitoIdentity) DeleteIdentitiesRequest(input *DeleteIdentitiesInput) (req *request.Request, output *DeleteIdentitiesOutput) { + op := &request.Operation{ + Name: opDeleteIdentities, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteIdentitiesInput{} + } + + output = &DeleteIdentitiesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteIdentities API operation for Amazon Cognito Identity. +// +// Deletes identities from an identity pool. You can specify a list of 1-60 +// identities that you want to delete. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation DeleteIdentities for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentities +func (c *CognitoIdentity) DeleteIdentities(input *DeleteIdentitiesInput) (*DeleteIdentitiesOutput, error) { + req, out := c.DeleteIdentitiesRequest(input) + return out, req.Send() +} + +// DeleteIdentitiesWithContext is the same as DeleteIdentities with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteIdentities 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 *CognitoIdentity) DeleteIdentitiesWithContext(ctx aws.Context, input *DeleteIdentitiesInput, opts ...request.Option) (*DeleteIdentitiesOutput, error) { + req, out := c.DeleteIdentitiesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteIdentityPool = "DeleteIdentityPool" + +// DeleteIdentityPoolRequest generates a "aws/request.Request" representing the +// client's request for the DeleteIdentityPool operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DeleteIdentityPool for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteIdentityPool method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteIdentityPoolRequest method. +// req, resp := client.DeleteIdentityPoolRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentityPool +func (c *CognitoIdentity) DeleteIdentityPoolRequest(input *DeleteIdentityPoolInput) (req *request.Request, output *DeleteIdentityPoolOutput) { + op := &request.Operation{ + Name: opDeleteIdentityPool, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteIdentityPoolInput{} + } + + output = &DeleteIdentityPoolOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteIdentityPool API operation for Amazon Cognito Identity. +// +// Deletes a user pool. Once a pool is deleted, users will not be able to authenticate +// with the pool. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation DeleteIdentityPool for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentityPool +func (c *CognitoIdentity) DeleteIdentityPool(input *DeleteIdentityPoolInput) (*DeleteIdentityPoolOutput, error) { + req, out := c.DeleteIdentityPoolRequest(input) + return out, req.Send() +} + +// DeleteIdentityPoolWithContext is the same as DeleteIdentityPool with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteIdentityPool 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 *CognitoIdentity) DeleteIdentityPoolWithContext(ctx aws.Context, input *DeleteIdentityPoolInput, opts ...request.Option) (*DeleteIdentityPoolOutput, error) { + req, out := c.DeleteIdentityPoolRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeIdentity = "DescribeIdentity" + +// DescribeIdentityRequest generates a "aws/request.Request" representing the +// client's request for the DescribeIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DescribeIdentity for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeIdentityRequest method. +// req, resp := client.DescribeIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DescribeIdentity +func (c *CognitoIdentity) DescribeIdentityRequest(input *DescribeIdentityInput) (req *request.Request, output *IdentityDescription) { + op := &request.Operation{ + Name: opDescribeIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeIdentityInput{} + } + + output = &IdentityDescription{} + req = c.newRequest(op, input, output) + return +} + +// DescribeIdentity API operation for Amazon Cognito Identity. +// +// Returns metadata related to the given identity, including when the identity +// was created and any associated linked logins. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation DescribeIdentity for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DescribeIdentity +func (c *CognitoIdentity) DescribeIdentity(input *DescribeIdentityInput) (*IdentityDescription, error) { + req, out := c.DescribeIdentityRequest(input) + return out, req.Send() +} + +// DescribeIdentityWithContext is the same as DescribeIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeIdentity 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 *CognitoIdentity) DescribeIdentityWithContext(ctx aws.Context, input *DescribeIdentityInput, opts ...request.Option) (*IdentityDescription, error) { + req, out := c.DescribeIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeIdentityPool = "DescribeIdentityPool" + +// DescribeIdentityPoolRequest generates a "aws/request.Request" representing the +// client's request for the DescribeIdentityPool operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DescribeIdentityPool for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeIdentityPool method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeIdentityPoolRequest method. +// req, resp := client.DescribeIdentityPoolRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DescribeIdentityPool +func (c *CognitoIdentity) DescribeIdentityPoolRequest(input *DescribeIdentityPoolInput) (req *request.Request, output *IdentityPool) { + op := &request.Operation{ + Name: opDescribeIdentityPool, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeIdentityPoolInput{} + } + + output = &IdentityPool{} + req = c.newRequest(op, input, output) + return +} + +// DescribeIdentityPool API operation for Amazon Cognito Identity. +// +// Gets details about a particular identity pool, including the pool name, ID +// description, creation date, and current number of users. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation DescribeIdentityPool for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DescribeIdentityPool +func (c *CognitoIdentity) DescribeIdentityPool(input *DescribeIdentityPoolInput) (*IdentityPool, error) { + req, out := c.DescribeIdentityPoolRequest(input) + return out, req.Send() +} + +// DescribeIdentityPoolWithContext is the same as DescribeIdentityPool with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeIdentityPool 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 *CognitoIdentity) DescribeIdentityPoolWithContext(ctx aws.Context, input *DescribeIdentityPoolInput, opts ...request.Option) (*IdentityPool, error) { + req, out := c.DescribeIdentityPoolRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetCredentialsForIdentity = "GetCredentialsForIdentity" + +// GetCredentialsForIdentityRequest generates a "aws/request.Request" representing the +// client's request for the GetCredentialsForIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetCredentialsForIdentity for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetCredentialsForIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetCredentialsForIdentityRequest method. +// req, resp := client.GetCredentialsForIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetCredentialsForIdentity +func (c *CognitoIdentity) GetCredentialsForIdentityRequest(input *GetCredentialsForIdentityInput) (req *request.Request, output *GetCredentialsForIdentityOutput) { + op := &request.Operation{ + Name: opGetCredentialsForIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetCredentialsForIdentityInput{} + } + + output = &GetCredentialsForIdentityOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetCredentialsForIdentity API operation for Amazon Cognito Identity. +// +// Returns credentials for the provided identity ID. Any provided logins will +// be validated against supported login providers. If the token is for cognito-identity.amazonaws.com, +// it will be passed through to AWS Security Token Service with the appropriate +// role for the token. +// +// This is a public API. You do not need any credentials to call this 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 Amazon Cognito Identity's +// API operation GetCredentialsForIdentity for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInvalidIdentityPoolConfigurationException "InvalidIdentityPoolConfigurationException" +// Thrown if the identity pool has no role associated for the given auth type +// (auth/unauth) or if the AssumeRole fails. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeExternalServiceException "ExternalServiceException" +// An exception thrown when a dependent service such as Facebook or Twitter +// is not responding +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetCredentialsForIdentity +func (c *CognitoIdentity) GetCredentialsForIdentity(input *GetCredentialsForIdentityInput) (*GetCredentialsForIdentityOutput, error) { + req, out := c.GetCredentialsForIdentityRequest(input) + return out, req.Send() +} + +// GetCredentialsForIdentityWithContext is the same as GetCredentialsForIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See GetCredentialsForIdentity 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 *CognitoIdentity) GetCredentialsForIdentityWithContext(ctx aws.Context, input *GetCredentialsForIdentityInput, opts ...request.Option) (*GetCredentialsForIdentityOutput, error) { + req, out := c.GetCredentialsForIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetId = "GetId" + +// GetIdRequest generates a "aws/request.Request" representing the +// client's request for the GetId operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetId for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetId method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetIdRequest method. +// req, resp := client.GetIdRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetId +func (c *CognitoIdentity) GetIdRequest(input *GetIdInput) (req *request.Request, output *GetIdOutput) { + op := &request.Operation{ + Name: opGetId, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetIdInput{} + } + + output = &GetIdOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetId API operation for Amazon Cognito Identity. +// +// Generates (or retrieves) a Cognito ID. Supplying multiple logins will create +// an implicit linked account. +// +// This is a public API. You do not need any credentials to call this 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 Amazon Cognito Identity's +// API operation GetId for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// Thrown when the total number of user pools has exceeded a preset limit. +// +// * ErrCodeExternalServiceException "ExternalServiceException" +// An exception thrown when a dependent service such as Facebook or Twitter +// is not responding +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetId +func (c *CognitoIdentity) GetId(input *GetIdInput) (*GetIdOutput, error) { + req, out := c.GetIdRequest(input) + return out, req.Send() +} + +// GetIdWithContext is the same as GetId with the addition of +// the ability to pass a context and additional request options. +// +// See GetId 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 *CognitoIdentity) GetIdWithContext(ctx aws.Context, input *GetIdInput, opts ...request.Option) (*GetIdOutput, error) { + req, out := c.GetIdRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetIdentityPoolRoles = "GetIdentityPoolRoles" + +// GetIdentityPoolRolesRequest generates a "aws/request.Request" representing the +// client's request for the GetIdentityPoolRoles operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetIdentityPoolRoles for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetIdentityPoolRoles method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetIdentityPoolRolesRequest method. +// req, resp := client.GetIdentityPoolRolesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetIdentityPoolRoles +func (c *CognitoIdentity) GetIdentityPoolRolesRequest(input *GetIdentityPoolRolesInput) (req *request.Request, output *GetIdentityPoolRolesOutput) { + op := &request.Operation{ + Name: opGetIdentityPoolRoles, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetIdentityPoolRolesInput{} + } + + output = &GetIdentityPoolRolesOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetIdentityPoolRoles API operation for Amazon Cognito Identity. +// +// Gets the roles for an identity pool. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation GetIdentityPoolRoles for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetIdentityPoolRoles +func (c *CognitoIdentity) GetIdentityPoolRoles(input *GetIdentityPoolRolesInput) (*GetIdentityPoolRolesOutput, error) { + req, out := c.GetIdentityPoolRolesRequest(input) + return out, req.Send() +} + +// GetIdentityPoolRolesWithContext is the same as GetIdentityPoolRoles with the addition of +// the ability to pass a context and additional request options. +// +// See GetIdentityPoolRoles 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 *CognitoIdentity) GetIdentityPoolRolesWithContext(ctx aws.Context, input *GetIdentityPoolRolesInput, opts ...request.Option) (*GetIdentityPoolRolesOutput, error) { + req, out := c.GetIdentityPoolRolesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetOpenIdToken = "GetOpenIdToken" + +// GetOpenIdTokenRequest generates a "aws/request.Request" representing the +// client's request for the GetOpenIdToken operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetOpenIdToken for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetOpenIdToken method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetOpenIdTokenRequest method. +// req, resp := client.GetOpenIdTokenRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdToken +func (c *CognitoIdentity) GetOpenIdTokenRequest(input *GetOpenIdTokenInput) (req *request.Request, output *GetOpenIdTokenOutput) { + op := &request.Operation{ + Name: opGetOpenIdToken, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetOpenIdTokenInput{} + } + + output = &GetOpenIdTokenOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetOpenIdToken API operation for Amazon Cognito Identity. +// +// Gets an OpenID token, using a known Cognito ID. This known Cognito ID is +// returned by GetId. You can optionally add additional logins for the identity. +// Supplying multiple logins creates an implicit link. +// +// The OpenId token is valid for 15 minutes. +// +// This is a public API. You do not need any credentials to call this 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 Amazon Cognito Identity's +// API operation GetOpenIdToken for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeExternalServiceException "ExternalServiceException" +// An exception thrown when a dependent service such as Facebook or Twitter +// is not responding +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdToken +func (c *CognitoIdentity) GetOpenIdToken(input *GetOpenIdTokenInput) (*GetOpenIdTokenOutput, error) { + req, out := c.GetOpenIdTokenRequest(input) + return out, req.Send() +} + +// GetOpenIdTokenWithContext is the same as GetOpenIdToken with the addition of +// the ability to pass a context and additional request options. +// +// See GetOpenIdToken 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 *CognitoIdentity) GetOpenIdTokenWithContext(ctx aws.Context, input *GetOpenIdTokenInput, opts ...request.Option) (*GetOpenIdTokenOutput, error) { + req, out := c.GetOpenIdTokenRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetOpenIdTokenForDeveloperIdentity = "GetOpenIdTokenForDeveloperIdentity" + +// GetOpenIdTokenForDeveloperIdentityRequest generates a "aws/request.Request" representing the +// client's request for the GetOpenIdTokenForDeveloperIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetOpenIdTokenForDeveloperIdentity for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetOpenIdTokenForDeveloperIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetOpenIdTokenForDeveloperIdentityRequest method. +// req, resp := client.GetOpenIdTokenForDeveloperIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenForDeveloperIdentity +func (c *CognitoIdentity) GetOpenIdTokenForDeveloperIdentityRequest(input *GetOpenIdTokenForDeveloperIdentityInput) (req *request.Request, output *GetOpenIdTokenForDeveloperIdentityOutput) { + op := &request.Operation{ + Name: opGetOpenIdTokenForDeveloperIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetOpenIdTokenForDeveloperIdentityInput{} + } + + output = &GetOpenIdTokenForDeveloperIdentityOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetOpenIdTokenForDeveloperIdentity API operation for Amazon Cognito Identity. +// +// Registers (or retrieves) a Cognito IdentityId and an OpenID Connect token +// for a user authenticated by your backend authentication process. Supplying +// multiple logins will create an implicit linked account. You can only specify +// one developer provider as part of the Logins map, which is linked to the +// identity pool. The developer provider is the "domain" by which Cognito will +// refer to your users. +// +// You can use GetOpenIdTokenForDeveloperIdentity to create a new identity and +// to link new logins (that is, user credentials issued by a public provider +// or developer provider) to an existing identity. When you want to create a +// new identity, the IdentityId should be null. When you want to associate a +// new login with an existing authenticated/unauthenticated identity, you can +// do so by providing the existing IdentityId. This API will create the identity +// in the specified IdentityPoolId. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation GetOpenIdTokenForDeveloperIdentity for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeDeveloperUserAlreadyRegisteredException "DeveloperUserAlreadyRegisteredException" +// The provided developer user identifier is already registered with Cognito +// under a different identity ID. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenForDeveloperIdentity +func (c *CognitoIdentity) GetOpenIdTokenForDeveloperIdentity(input *GetOpenIdTokenForDeveloperIdentityInput) (*GetOpenIdTokenForDeveloperIdentityOutput, error) { + req, out := c.GetOpenIdTokenForDeveloperIdentityRequest(input) + return out, req.Send() +} + +// GetOpenIdTokenForDeveloperIdentityWithContext is the same as GetOpenIdTokenForDeveloperIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See GetOpenIdTokenForDeveloperIdentity 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 *CognitoIdentity) GetOpenIdTokenForDeveloperIdentityWithContext(ctx aws.Context, input *GetOpenIdTokenForDeveloperIdentityInput, opts ...request.Option) (*GetOpenIdTokenForDeveloperIdentityOutput, error) { + req, out := c.GetOpenIdTokenForDeveloperIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListIdentities = "ListIdentities" + +// ListIdentitiesRequest generates a "aws/request.Request" representing the +// client's request for the ListIdentities operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListIdentities for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListIdentities method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListIdentitiesRequest method. +// req, resp := client.ListIdentitiesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentities +func (c *CognitoIdentity) ListIdentitiesRequest(input *ListIdentitiesInput) (req *request.Request, output *ListIdentitiesOutput) { + op := &request.Operation{ + Name: opListIdentities, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListIdentitiesInput{} + } + + output = &ListIdentitiesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListIdentities API operation for Amazon Cognito Identity. +// +// Lists the identities in a pool. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation ListIdentities for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentities +func (c *CognitoIdentity) ListIdentities(input *ListIdentitiesInput) (*ListIdentitiesOutput, error) { + req, out := c.ListIdentitiesRequest(input) + return out, req.Send() +} + +// ListIdentitiesWithContext is the same as ListIdentities with the addition of +// the ability to pass a context and additional request options. +// +// See ListIdentities 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 *CognitoIdentity) ListIdentitiesWithContext(ctx aws.Context, input *ListIdentitiesInput, opts ...request.Option) (*ListIdentitiesOutput, error) { + req, out := c.ListIdentitiesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListIdentityPools = "ListIdentityPools" + +// ListIdentityPoolsRequest generates a "aws/request.Request" representing the +// client's request for the ListIdentityPools operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListIdentityPools for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListIdentityPools method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListIdentityPoolsRequest method. +// req, resp := client.ListIdentityPoolsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentityPools +func (c *CognitoIdentity) ListIdentityPoolsRequest(input *ListIdentityPoolsInput) (req *request.Request, output *ListIdentityPoolsOutput) { + op := &request.Operation{ + Name: opListIdentityPools, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListIdentityPoolsInput{} + } + + output = &ListIdentityPoolsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListIdentityPools API operation for Amazon Cognito Identity. +// +// Lists all of the Cognito identity pools registered for your account. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation ListIdentityPools for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentityPools +func (c *CognitoIdentity) ListIdentityPools(input *ListIdentityPoolsInput) (*ListIdentityPoolsOutput, error) { + req, out := c.ListIdentityPoolsRequest(input) + return out, req.Send() +} + +// ListIdentityPoolsWithContext is the same as ListIdentityPools with the addition of +// the ability to pass a context and additional request options. +// +// See ListIdentityPools 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 *CognitoIdentity) ListIdentityPoolsWithContext(ctx aws.Context, input *ListIdentityPoolsInput, opts ...request.Option) (*ListIdentityPoolsOutput, error) { + req, out := c.ListIdentityPoolsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opLookupDeveloperIdentity = "LookupDeveloperIdentity" + +// LookupDeveloperIdentityRequest generates a "aws/request.Request" representing the +// client's request for the LookupDeveloperIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See LookupDeveloperIdentity for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the LookupDeveloperIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the LookupDeveloperIdentityRequest method. +// req, resp := client.LookupDeveloperIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/LookupDeveloperIdentity +func (c *CognitoIdentity) LookupDeveloperIdentityRequest(input *LookupDeveloperIdentityInput) (req *request.Request, output *LookupDeveloperIdentityOutput) { + op := &request.Operation{ + Name: opLookupDeveloperIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &LookupDeveloperIdentityInput{} + } + + output = &LookupDeveloperIdentityOutput{} + req = c.newRequest(op, input, output) + return +} + +// LookupDeveloperIdentity API operation for Amazon Cognito Identity. +// +// Retrieves the IdentityID associated with a DeveloperUserIdentifier or the +// list of DeveloperUserIdentifiers associated with an IdentityId for an existing +// identity. Either IdentityID or DeveloperUserIdentifier must not be null. +// If you supply only one of these values, the other value will be searched +// in the database and returned as a part of the response. If you supply both, +// DeveloperUserIdentifier will be matched against IdentityID. If the values +// are verified against the database, the response returns both values and is +// the same as the request. Otherwise a ResourceConflictException is thrown. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation LookupDeveloperIdentity for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/LookupDeveloperIdentity +func (c *CognitoIdentity) LookupDeveloperIdentity(input *LookupDeveloperIdentityInput) (*LookupDeveloperIdentityOutput, error) { + req, out := c.LookupDeveloperIdentityRequest(input) + return out, req.Send() +} + +// LookupDeveloperIdentityWithContext is the same as LookupDeveloperIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See LookupDeveloperIdentity 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 *CognitoIdentity) LookupDeveloperIdentityWithContext(ctx aws.Context, input *LookupDeveloperIdentityInput, opts ...request.Option) (*LookupDeveloperIdentityOutput, error) { + req, out := c.LookupDeveloperIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opMergeDeveloperIdentities = "MergeDeveloperIdentities" + +// MergeDeveloperIdentitiesRequest generates a "aws/request.Request" representing the +// client's request for the MergeDeveloperIdentities operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See MergeDeveloperIdentities for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the MergeDeveloperIdentities method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the MergeDeveloperIdentitiesRequest method. +// req, resp := client.MergeDeveloperIdentitiesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/MergeDeveloperIdentities +func (c *CognitoIdentity) MergeDeveloperIdentitiesRequest(input *MergeDeveloperIdentitiesInput) (req *request.Request, output *MergeDeveloperIdentitiesOutput) { + op := &request.Operation{ + Name: opMergeDeveloperIdentities, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &MergeDeveloperIdentitiesInput{} + } + + output = &MergeDeveloperIdentitiesOutput{} + req = c.newRequest(op, input, output) + return +} + +// MergeDeveloperIdentities API operation for Amazon Cognito Identity. +// +// Merges two users having different IdentityIds, existing in the same identity +// pool, and identified by the same developer provider. You can use this action +// to request that discrete users be merged and identified as a single user +// in the Cognito environment. Cognito associates the given source user (SourceUserIdentifier) +// with the IdentityId of the DestinationUserIdentifier. Only developer-authenticated +// users can be merged. If the users to be merged are associated with the same +// public provider, but as two different users, an exception will be thrown. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation MergeDeveloperIdentities for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/MergeDeveloperIdentities +func (c *CognitoIdentity) MergeDeveloperIdentities(input *MergeDeveloperIdentitiesInput) (*MergeDeveloperIdentitiesOutput, error) { + req, out := c.MergeDeveloperIdentitiesRequest(input) + return out, req.Send() +} + +// MergeDeveloperIdentitiesWithContext is the same as MergeDeveloperIdentities with the addition of +// the ability to pass a context and additional request options. +// +// See MergeDeveloperIdentities 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 *CognitoIdentity) MergeDeveloperIdentitiesWithContext(ctx aws.Context, input *MergeDeveloperIdentitiesInput, opts ...request.Option) (*MergeDeveloperIdentitiesOutput, error) { + req, out := c.MergeDeveloperIdentitiesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opSetIdentityPoolRoles = "SetIdentityPoolRoles" + +// SetIdentityPoolRolesRequest generates a "aws/request.Request" representing the +// client's request for the SetIdentityPoolRoles operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See SetIdentityPoolRoles for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the SetIdentityPoolRoles method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the SetIdentityPoolRolesRequest method. +// req, resp := client.SetIdentityPoolRolesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/SetIdentityPoolRoles +func (c *CognitoIdentity) SetIdentityPoolRolesRequest(input *SetIdentityPoolRolesInput) (req *request.Request, output *SetIdentityPoolRolesOutput) { + op := &request.Operation{ + Name: opSetIdentityPoolRoles, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &SetIdentityPoolRolesInput{} + } + + output = &SetIdentityPoolRolesOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// SetIdentityPoolRoles API operation for Amazon Cognito Identity. +// +// Sets the roles for an identity pool. These roles are used when making calls +// to GetCredentialsForIdentity action. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation SetIdentityPoolRoles for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// Thrown if there are parallel requests to modify a resource. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/SetIdentityPoolRoles +func (c *CognitoIdentity) SetIdentityPoolRoles(input *SetIdentityPoolRolesInput) (*SetIdentityPoolRolesOutput, error) { + req, out := c.SetIdentityPoolRolesRequest(input) + return out, req.Send() +} + +// SetIdentityPoolRolesWithContext is the same as SetIdentityPoolRoles with the addition of +// the ability to pass a context and additional request options. +// +// See SetIdentityPoolRoles 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 *CognitoIdentity) SetIdentityPoolRolesWithContext(ctx aws.Context, input *SetIdentityPoolRolesInput, opts ...request.Option) (*SetIdentityPoolRolesOutput, error) { + req, out := c.SetIdentityPoolRolesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUnlinkDeveloperIdentity = "UnlinkDeveloperIdentity" + +// UnlinkDeveloperIdentityRequest generates a "aws/request.Request" representing the +// client's request for the UnlinkDeveloperIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See UnlinkDeveloperIdentity for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UnlinkDeveloperIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UnlinkDeveloperIdentityRequest method. +// req, resp := client.UnlinkDeveloperIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkDeveloperIdentity +func (c *CognitoIdentity) UnlinkDeveloperIdentityRequest(input *UnlinkDeveloperIdentityInput) (req *request.Request, output *UnlinkDeveloperIdentityOutput) { + op := &request.Operation{ + Name: opUnlinkDeveloperIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UnlinkDeveloperIdentityInput{} + } + + output = &UnlinkDeveloperIdentityOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// UnlinkDeveloperIdentity API operation for Amazon Cognito Identity. +// +// Unlinks a DeveloperUserIdentifier from an existing identity. Unlinked developer +// users will be considered new identities next time they are seen. If, for +// a given Cognito identity, you remove all federated identities as well as +// the developer user identifier, the Cognito identity becomes inaccessible. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation UnlinkDeveloperIdentity for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkDeveloperIdentity +func (c *CognitoIdentity) UnlinkDeveloperIdentity(input *UnlinkDeveloperIdentityInput) (*UnlinkDeveloperIdentityOutput, error) { + req, out := c.UnlinkDeveloperIdentityRequest(input) + return out, req.Send() +} + +// UnlinkDeveloperIdentityWithContext is the same as UnlinkDeveloperIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See UnlinkDeveloperIdentity 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 *CognitoIdentity) UnlinkDeveloperIdentityWithContext(ctx aws.Context, input *UnlinkDeveloperIdentityInput, opts ...request.Option) (*UnlinkDeveloperIdentityOutput, error) { + req, out := c.UnlinkDeveloperIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUnlinkIdentity = "UnlinkIdentity" + +// UnlinkIdentityRequest generates a "aws/request.Request" representing the +// client's request for the UnlinkIdentity operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See UnlinkIdentity for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UnlinkIdentity method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UnlinkIdentityRequest method. +// req, resp := client.UnlinkIdentityRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkIdentity +func (c *CognitoIdentity) UnlinkIdentityRequest(input *UnlinkIdentityInput) (req *request.Request, output *UnlinkIdentityOutput) { + op := &request.Operation{ + Name: opUnlinkIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UnlinkIdentityInput{} + } + + output = &UnlinkIdentityOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// UnlinkIdentity API operation for Amazon Cognito Identity. +// +// Unlinks a federated identity from an existing account. Unlinked logins will +// be considered new identities next time they are seen. Removing the last linked +// login will make this identity inaccessible. +// +// This is a public API. You do not need any credentials to call this 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 Amazon Cognito Identity's +// API operation UnlinkIdentity for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeExternalServiceException "ExternalServiceException" +// An exception thrown when a dependent service such as Facebook or Twitter +// is not responding +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkIdentity +func (c *CognitoIdentity) UnlinkIdentity(input *UnlinkIdentityInput) (*UnlinkIdentityOutput, error) { + req, out := c.UnlinkIdentityRequest(input) + return out, req.Send() +} + +// UnlinkIdentityWithContext is the same as UnlinkIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See UnlinkIdentity 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 *CognitoIdentity) UnlinkIdentityWithContext(ctx aws.Context, input *UnlinkIdentityInput, opts ...request.Option) (*UnlinkIdentityOutput, error) { + req, out := c.UnlinkIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateIdentityPool = "UpdateIdentityPool" + +// UpdateIdentityPoolRequest generates a "aws/request.Request" representing the +// client's request for the UpdateIdentityPool operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See UpdateIdentityPool for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UpdateIdentityPool method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UpdateIdentityPoolRequest method. +// req, resp := client.UpdateIdentityPoolRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UpdateIdentityPool +func (c *CognitoIdentity) UpdateIdentityPoolRequest(input *IdentityPool) (req *request.Request, output *IdentityPool) { + op := &request.Operation{ + Name: opUpdateIdentityPool, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &IdentityPool{} + } + + output = &IdentityPool{} + req = c.newRequest(op, input, output) + return +} + +// UpdateIdentityPool API operation for Amazon Cognito Identity. +// +// Updates a user pool. +// +// You must use AWS Developer credentials to call this 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 Amazon Cognito Identity's +// API operation UpdateIdentityPool for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParameterException "InvalidParameterException" +// Thrown for missing or bad input parameter(s). +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Thrown when the requested resource (for example, a dataset or record) does +// not exist. +// +// * ErrCodeNotAuthorizedException "NotAuthorizedException" +// Thrown when a user is not authorized to access the requested resource. +// +// * ErrCodeResourceConflictException "ResourceConflictException" +// Thrown when a user tries to use a login which is already linked to another +// account. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Thrown when a request is throttled. +// +// * ErrCodeInternalErrorException "InternalErrorException" +// Thrown when the service encounters an error during processing the request. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// Thrown if there are parallel requests to modify a resource. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// Thrown when the total number of user pools has exceeded a preset limit. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UpdateIdentityPool +func (c *CognitoIdentity) UpdateIdentityPool(input *IdentityPool) (*IdentityPool, error) { + req, out := c.UpdateIdentityPoolRequest(input) + return out, req.Send() +} + +// UpdateIdentityPoolWithContext is the same as UpdateIdentityPool with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateIdentityPool 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 *CognitoIdentity) UpdateIdentityPoolWithContext(ctx aws.Context, input *IdentityPool, opts ...request.Option) (*IdentityPool, error) { + req, out := c.UpdateIdentityPoolRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// Input to the CreateIdentityPool action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/CreateIdentityPoolInput +type CreateIdentityPoolInput struct { + _ struct{} `type:"structure"` + + // TRUE if the identity pool supports unauthenticated logins. + // + // AllowUnauthenticatedIdentities is a required field + AllowUnauthenticatedIdentities *bool `type:"boolean" required:"true"` + + // An array of Amazon Cognito Identity user pools and their client IDs. + CognitoIdentityProviders []*Provider `type:"list"` + + // The "domain" by which Cognito will refer to your users. This name acts as + // a placeholder that allows your backend and the Cognito service to communicate + // about the developer provider. For the DeveloperProviderName, you can use + // letters as well as period (.), underscore (_), and dash (-). + // + // Once you have set a developer provider name, you cannot change it. Please + // take care in setting this parameter. + DeveloperProviderName *string `min:"1" type:"string"` + + // A string that you provide. + // + // IdentityPoolName is a required field + IdentityPoolName *string `min:"1" type:"string" required:"true"` + + // A list of OpendID Connect provider ARNs. + OpenIdConnectProviderARNs []*string `type:"list"` + + // An array of Amazon Resource Names (ARNs) of the SAML provider for your identity + // pool. + SamlProviderARNs []*string `type:"list"` + + // Optional key:value pairs mapping provider names to provider app IDs. + SupportedLoginProviders map[string]*string `type:"map"` +} + +// String returns the string representation +func (s CreateIdentityPoolInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateIdentityPoolInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateIdentityPoolInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateIdentityPoolInput"} + if s.AllowUnauthenticatedIdentities == nil { + invalidParams.Add(request.NewErrParamRequired("AllowUnauthenticatedIdentities")) + } + if s.DeveloperProviderName != nil && len(*s.DeveloperProviderName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeveloperProviderName", 1)) + } + if s.IdentityPoolName == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolName")) + } + if s.IdentityPoolName != nil && len(*s.IdentityPoolName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolName", 1)) + } + if s.CognitoIdentityProviders != nil { + for i, v := range s.CognitoIdentityProviders { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CognitoIdentityProviders", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAllowUnauthenticatedIdentities sets the AllowUnauthenticatedIdentities field's value. +func (s *CreateIdentityPoolInput) SetAllowUnauthenticatedIdentities(v bool) *CreateIdentityPoolInput { + s.AllowUnauthenticatedIdentities = &v + return s +} + +// SetCognitoIdentityProviders sets the CognitoIdentityProviders field's value. +func (s *CreateIdentityPoolInput) SetCognitoIdentityProviders(v []*Provider) *CreateIdentityPoolInput { + s.CognitoIdentityProviders = v + return s +} + +// SetDeveloperProviderName sets the DeveloperProviderName field's value. +func (s *CreateIdentityPoolInput) SetDeveloperProviderName(v string) *CreateIdentityPoolInput { + s.DeveloperProviderName = &v + return s +} + +// SetIdentityPoolName sets the IdentityPoolName field's value. +func (s *CreateIdentityPoolInput) SetIdentityPoolName(v string) *CreateIdentityPoolInput { + s.IdentityPoolName = &v + return s +} + +// SetOpenIdConnectProviderARNs sets the OpenIdConnectProviderARNs field's value. +func (s *CreateIdentityPoolInput) SetOpenIdConnectProviderARNs(v []*string) *CreateIdentityPoolInput { + s.OpenIdConnectProviderARNs = v + return s +} + +// SetSamlProviderARNs sets the SamlProviderARNs field's value. +func (s *CreateIdentityPoolInput) SetSamlProviderARNs(v []*string) *CreateIdentityPoolInput { + s.SamlProviderARNs = v + return s +} + +// SetSupportedLoginProviders sets the SupportedLoginProviders field's value. +func (s *CreateIdentityPoolInput) SetSupportedLoginProviders(v map[string]*string) *CreateIdentityPoolInput { + s.SupportedLoginProviders = v + return s +} + +// Credentials for the provided identity ID. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/Credentials +type Credentials struct { + _ struct{} `type:"structure"` + + // The Access Key portion of the credentials. + AccessKeyId *string `type:"string"` + + // The date at which these credentials will expire. + Expiration *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The Secret Access Key portion of the credentials + SecretKey *string `type:"string"` + + // The Session Token portion of the credentials + SessionToken *string `type:"string"` +} + +// String returns the string representation +func (s Credentials) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Credentials) GoString() string { + return s.String() +} + +// SetAccessKeyId sets the AccessKeyId field's value. +func (s *Credentials) SetAccessKeyId(v string) *Credentials { + s.AccessKeyId = &v + return s +} + +// SetExpiration sets the Expiration field's value. +func (s *Credentials) SetExpiration(v time.Time) *Credentials { + s.Expiration = &v + return s +} + +// SetSecretKey sets the SecretKey field's value. +func (s *Credentials) SetSecretKey(v string) *Credentials { + s.SecretKey = &v + return s +} + +// SetSessionToken sets the SessionToken field's value. +func (s *Credentials) SetSessionToken(v string) *Credentials { + s.SessionToken = &v + return s +} + +// Input to the DeleteIdentities action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentitiesInput +type DeleteIdentitiesInput struct { + _ struct{} `type:"structure"` + + // A list of 1-60 identities that you want to delete. + // + // IdentityIdsToDelete is a required field + IdentityIdsToDelete []*string `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s DeleteIdentitiesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteIdentitiesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteIdentitiesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteIdentitiesInput"} + if s.IdentityIdsToDelete == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityIdsToDelete")) + } + if s.IdentityIdsToDelete != nil && len(s.IdentityIdsToDelete) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityIdsToDelete", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityIdsToDelete sets the IdentityIdsToDelete field's value. +func (s *DeleteIdentitiesInput) SetIdentityIdsToDelete(v []*string) *DeleteIdentitiesInput { + s.IdentityIdsToDelete = v + return s +} + +// Returned in response to a successful DeleteIdentities operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentitiesResponse +type DeleteIdentitiesOutput struct { + _ struct{} `type:"structure"` + + // An array of UnprocessedIdentityId objects, each of which contains an ErrorCode + // and IdentityId. + UnprocessedIdentityIds []*UnprocessedIdentityId `type:"list"` +} + +// String returns the string representation +func (s DeleteIdentitiesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteIdentitiesOutput) GoString() string { + return s.String() +} + +// SetUnprocessedIdentityIds sets the UnprocessedIdentityIds field's value. +func (s *DeleteIdentitiesOutput) SetUnprocessedIdentityIds(v []*UnprocessedIdentityId) *DeleteIdentitiesOutput { + s.UnprocessedIdentityIds = v + return s +} + +// Input to the DeleteIdentityPool action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentityPoolInput +type DeleteIdentityPoolInput struct { + _ struct{} `type:"structure"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteIdentityPoolInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteIdentityPoolInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteIdentityPoolInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteIdentityPoolInput"} + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *DeleteIdentityPoolInput) SetIdentityPoolId(v string) *DeleteIdentityPoolInput { + s.IdentityPoolId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DeleteIdentityPoolOutput +type DeleteIdentityPoolOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteIdentityPoolOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteIdentityPoolOutput) GoString() string { + return s.String() +} + +// Input to the DescribeIdentity action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DescribeIdentityInput +type DescribeIdentityInput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. + // + // IdentityId is a required field + IdentityId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeIdentityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeIdentityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeIdentityInput"} + if s.IdentityId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityId")) + } + if s.IdentityId != nil && len(*s.IdentityId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityId sets the IdentityId field's value. +func (s *DescribeIdentityInput) SetIdentityId(v string) *DescribeIdentityInput { + s.IdentityId = &v + return s +} + +// Input to the DescribeIdentityPool action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/DescribeIdentityPoolInput +type DescribeIdentityPoolInput struct { + _ struct{} `type:"structure"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeIdentityPoolInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeIdentityPoolInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeIdentityPoolInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeIdentityPoolInput"} + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *DescribeIdentityPoolInput) SetIdentityPoolId(v string) *DescribeIdentityPoolInput { + s.IdentityPoolId = &v + return s +} + +// Input to the GetCredentialsForIdentity action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetCredentialsForIdentityInput +type GetCredentialsForIdentityInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the role to be assumed when multiple roles + // were received in the token from the identity provider. For example, a SAML-based + // identity provider. This parameter is optional for identity providers that + // do not support role customization. + CustomRoleArn *string `min:"20" type:"string"` + + // A unique identifier in the format REGION:GUID. + // + // IdentityId is a required field + IdentityId *string `min:"1" type:"string" required:"true"` + + // A set of optional name-value pairs that map provider names to provider tokens. + Logins map[string]*string `type:"map"` +} + +// String returns the string representation +func (s GetCredentialsForIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCredentialsForIdentityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetCredentialsForIdentityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetCredentialsForIdentityInput"} + if s.CustomRoleArn != nil && len(*s.CustomRoleArn) < 20 { + invalidParams.Add(request.NewErrParamMinLen("CustomRoleArn", 20)) + } + if s.IdentityId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityId")) + } + if s.IdentityId != nil && len(*s.IdentityId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCustomRoleArn sets the CustomRoleArn field's value. +func (s *GetCredentialsForIdentityInput) SetCustomRoleArn(v string) *GetCredentialsForIdentityInput { + s.CustomRoleArn = &v + return s +} + +// SetIdentityId sets the IdentityId field's value. +func (s *GetCredentialsForIdentityInput) SetIdentityId(v string) *GetCredentialsForIdentityInput { + s.IdentityId = &v + return s +} + +// SetLogins sets the Logins field's value. +func (s *GetCredentialsForIdentityInput) SetLogins(v map[string]*string) *GetCredentialsForIdentityInput { + s.Logins = v + return s +} + +// Returned in response to a successful GetCredentialsForIdentity operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetCredentialsForIdentityResponse +type GetCredentialsForIdentityOutput struct { + _ struct{} `type:"structure"` + + // Credentials for the provided identity ID. + Credentials *Credentials `type:"structure"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s GetCredentialsForIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCredentialsForIdentityOutput) GoString() string { + return s.String() +} + +// SetCredentials sets the Credentials field's value. +func (s *GetCredentialsForIdentityOutput) SetCredentials(v *Credentials) *GetCredentialsForIdentityOutput { + s.Credentials = v + return s +} + +// SetIdentityId sets the IdentityId field's value. +func (s *GetCredentialsForIdentityOutput) SetIdentityId(v string) *GetCredentialsForIdentityOutput { + s.IdentityId = &v + return s +} + +// Input to the GetId action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetIdInput +type GetIdInput struct { + _ struct{} `type:"structure"` + + // A standard AWS account ID (9+ digits). + AccountId *string `min:"1" type:"string"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` + + // A set of optional name-value pairs that map provider names to provider tokens. + // The available provider names for Logins are as follows: + // + // * Facebook: graph.facebook.com + // + // * Amazon Cognito Identity Provider: cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789 + // + // * Google: accounts.google.com + // + // * Amazon: www.amazon.com + // + // * Twitter: api.twitter.com + // + // * Digits: www.digits.com + Logins map[string]*string `type:"map"` +} + +// String returns the string representation +func (s GetIdInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetIdInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetIdInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetIdInput"} + if s.AccountId != nil && len(*s.AccountId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AccountId", 1)) + } + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccountId sets the AccountId field's value. +func (s *GetIdInput) SetAccountId(v string) *GetIdInput { + s.AccountId = &v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *GetIdInput) SetIdentityPoolId(v string) *GetIdInput { + s.IdentityPoolId = &v + return s +} + +// SetLogins sets the Logins field's value. +func (s *GetIdInput) SetLogins(v map[string]*string) *GetIdInput { + s.Logins = v + return s +} + +// Returned in response to a GetId request. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetIdResponse +type GetIdOutput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s GetIdOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetIdOutput) GoString() string { + return s.String() +} + +// SetIdentityId sets the IdentityId field's value. +func (s *GetIdOutput) SetIdentityId(v string) *GetIdOutput { + s.IdentityId = &v + return s +} + +// Input to the GetIdentityPoolRoles action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetIdentityPoolRolesInput +type GetIdentityPoolRolesInput struct { + _ struct{} `type:"structure"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetIdentityPoolRolesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetIdentityPoolRolesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetIdentityPoolRolesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetIdentityPoolRolesInput"} + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *GetIdentityPoolRolesInput) SetIdentityPoolId(v string) *GetIdentityPoolRolesInput { + s.IdentityPoolId = &v + return s +} + +// Returned in response to a successful GetIdentityPoolRoles operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetIdentityPoolRolesResponse +type GetIdentityPoolRolesOutput struct { + _ struct{} `type:"structure"` + + // An identity pool ID in the format REGION:GUID. + IdentityPoolId *string `min:"1" type:"string"` + + // How users for a specific identity provider are to mapped to roles. This is + // a String-to-RoleMapping object map. The string identifies the identity provider, + // for example, "graph.facebook.com" or "cognito-idp-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id". + RoleMappings map[string]*RoleMapping `type:"map"` + + // The map of roles associated with this pool. Currently only authenticated + // and unauthenticated roles are supported. + Roles map[string]*string `type:"map"` +} + +// String returns the string representation +func (s GetIdentityPoolRolesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetIdentityPoolRolesOutput) GoString() string { + return s.String() +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *GetIdentityPoolRolesOutput) SetIdentityPoolId(v string) *GetIdentityPoolRolesOutput { + s.IdentityPoolId = &v + return s +} + +// SetRoleMappings sets the RoleMappings field's value. +func (s *GetIdentityPoolRolesOutput) SetRoleMappings(v map[string]*RoleMapping) *GetIdentityPoolRolesOutput { + s.RoleMappings = v + return s +} + +// SetRoles sets the Roles field's value. +func (s *GetIdentityPoolRolesOutput) SetRoles(v map[string]*string) *GetIdentityPoolRolesOutput { + s.Roles = v + return s +} + +// Input to the GetOpenIdTokenForDeveloperIdentity action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenForDeveloperIdentityInput +type GetOpenIdTokenForDeveloperIdentityInput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` + + // A set of optional name-value pairs that map provider names to provider tokens. + // Each name-value pair represents a user from a public provider or developer + // provider. If the user is from a developer provider, the name-value pair will + // follow the syntax "developer_provider_name": "developer_user_identifier". + // The developer provider is the "domain" by which Cognito will refer to your + // users; you provided this domain while creating/updating the identity pool. + // The developer user identifier is an identifier from your backend that uniquely + // identifies a user. When you create an identity pool, you can specify the + // supported logins. + // + // Logins is a required field + Logins map[string]*string `type:"map" required:"true"` + + // The expiration time of the token, in seconds. You can specify a custom expiration + // time for the token so that you can cache it. If you don't provide an expiration + // time, the token is valid for 15 minutes. You can exchange the token with + // Amazon STS for temporary AWS credentials, which are valid for a maximum of + // one hour. The maximum token duration you can set is 24 hours. You should + // take care in setting the expiration time for a token, as there are significant + // security implications: an attacker could use a leaked token to access your + // AWS resources for the token's duration. + TokenDuration *int64 `min:"1" type:"long"` +} + +// String returns the string representation +func (s GetOpenIdTokenForDeveloperIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetOpenIdTokenForDeveloperIdentityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetOpenIdTokenForDeveloperIdentityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetOpenIdTokenForDeveloperIdentityInput"} + if s.IdentityId != nil && len(*s.IdentityId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityId", 1)) + } + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + if s.Logins == nil { + invalidParams.Add(request.NewErrParamRequired("Logins")) + } + if s.TokenDuration != nil && *s.TokenDuration < 1 { + invalidParams.Add(request.NewErrParamMinValue("TokenDuration", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityId sets the IdentityId field's value. +func (s *GetOpenIdTokenForDeveloperIdentityInput) SetIdentityId(v string) *GetOpenIdTokenForDeveloperIdentityInput { + s.IdentityId = &v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *GetOpenIdTokenForDeveloperIdentityInput) SetIdentityPoolId(v string) *GetOpenIdTokenForDeveloperIdentityInput { + s.IdentityPoolId = &v + return s +} + +// SetLogins sets the Logins field's value. +func (s *GetOpenIdTokenForDeveloperIdentityInput) SetLogins(v map[string]*string) *GetOpenIdTokenForDeveloperIdentityInput { + s.Logins = v + return s +} + +// SetTokenDuration sets the TokenDuration field's value. +func (s *GetOpenIdTokenForDeveloperIdentityInput) SetTokenDuration(v int64) *GetOpenIdTokenForDeveloperIdentityInput { + s.TokenDuration = &v + return s +} + +// Returned in response to a successful GetOpenIdTokenForDeveloperIdentity request. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenForDeveloperIdentityResponse +type GetOpenIdTokenForDeveloperIdentityOutput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` + + // An OpenID token. + Token *string `type:"string"` +} + +// String returns the string representation +func (s GetOpenIdTokenForDeveloperIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetOpenIdTokenForDeveloperIdentityOutput) GoString() string { + return s.String() +} + +// SetIdentityId sets the IdentityId field's value. +func (s *GetOpenIdTokenForDeveloperIdentityOutput) SetIdentityId(v string) *GetOpenIdTokenForDeveloperIdentityOutput { + s.IdentityId = &v + return s +} + +// SetToken sets the Token field's value. +func (s *GetOpenIdTokenForDeveloperIdentityOutput) SetToken(v string) *GetOpenIdTokenForDeveloperIdentityOutput { + s.Token = &v + return s +} + +// Input to the GetOpenIdToken action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenInput +type GetOpenIdTokenInput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. + // + // IdentityId is a required field + IdentityId *string `min:"1" type:"string" required:"true"` + + // A set of optional name-value pairs that map provider names to provider tokens. + // When using graph.facebook.com and www.amazon.com, supply the access_token + // returned from the provider's authflow. For accounts.google.com, an Amazon + // Cognito Identity Provider, or any other OpenId Connect provider, always include + // the id_token. + Logins map[string]*string `type:"map"` +} + +// String returns the string representation +func (s GetOpenIdTokenInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetOpenIdTokenInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetOpenIdTokenInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetOpenIdTokenInput"} + if s.IdentityId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityId")) + } + if s.IdentityId != nil && len(*s.IdentityId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityId sets the IdentityId field's value. +func (s *GetOpenIdTokenInput) SetIdentityId(v string) *GetOpenIdTokenInput { + s.IdentityId = &v + return s +} + +// SetLogins sets the Logins field's value. +func (s *GetOpenIdTokenInput) SetLogins(v map[string]*string) *GetOpenIdTokenInput { + s.Logins = v + return s +} + +// Returned in response to a successful GetOpenIdToken request. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenResponse +type GetOpenIdTokenOutput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. Note that the IdentityId returned + // may not match the one passed on input. + IdentityId *string `min:"1" type:"string"` + + // An OpenID token, valid for 15 minutes. + Token *string `type:"string"` +} + +// String returns the string representation +func (s GetOpenIdTokenOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetOpenIdTokenOutput) GoString() string { + return s.String() +} + +// SetIdentityId sets the IdentityId field's value. +func (s *GetOpenIdTokenOutput) SetIdentityId(v string) *GetOpenIdTokenOutput { + s.IdentityId = &v + return s +} + +// SetToken sets the Token field's value. +func (s *GetOpenIdTokenOutput) SetToken(v string) *GetOpenIdTokenOutput { + s.Token = &v + return s +} + +// A description of the identity. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/IdentityDescription +type IdentityDescription struct { + _ struct{} `type:"structure"` + + // Date on which the identity was created. + CreationDate *time.Time `type:"timestamp" timestampFormat:"unix"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` + + // Date on which the identity was last modified. + LastModifiedDate *time.Time `type:"timestamp" timestampFormat:"unix"` + + // A set of optional name-value pairs that map provider names to provider tokens. + Logins []*string `type:"list"` +} + +// String returns the string representation +func (s IdentityDescription) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s IdentityDescription) GoString() string { + return s.String() +} + +// SetCreationDate sets the CreationDate field's value. +func (s *IdentityDescription) SetCreationDate(v time.Time) *IdentityDescription { + s.CreationDate = &v + return s +} + +// SetIdentityId sets the IdentityId field's value. +func (s *IdentityDescription) SetIdentityId(v string) *IdentityDescription { + s.IdentityId = &v + return s +} + +// SetLastModifiedDate sets the LastModifiedDate field's value. +func (s *IdentityDescription) SetLastModifiedDate(v time.Time) *IdentityDescription { + s.LastModifiedDate = &v + return s +} + +// SetLogins sets the Logins field's value. +func (s *IdentityDescription) SetLogins(v []*string) *IdentityDescription { + s.Logins = v + return s +} + +// An object representing an Amazon Cognito identity pool. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/IdentityPool +type IdentityPool struct { + _ struct{} `type:"structure"` + + // TRUE if the identity pool supports unauthenticated logins. + // + // AllowUnauthenticatedIdentities is a required field + AllowUnauthenticatedIdentities *bool `type:"boolean" required:"true"` + + // A list representing an Amazon Cognito Identity User Pool and its client ID. + CognitoIdentityProviders []*Provider `type:"list"` + + // The "domain" by which Cognito will refer to your users. + DeveloperProviderName *string `min:"1" type:"string"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` + + // A string that you provide. + // + // IdentityPoolName is a required field + IdentityPoolName *string `min:"1" type:"string" required:"true"` + + // A list of OpendID Connect provider ARNs. + OpenIdConnectProviderARNs []*string `type:"list"` + + // An array of Amazon Resource Names (ARNs) of the SAML provider for your identity + // pool. + SamlProviderARNs []*string `type:"list"` + + // Optional key:value pairs mapping provider names to provider app IDs. + SupportedLoginProviders map[string]*string `type:"map"` +} + +// String returns the string representation +func (s IdentityPool) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s IdentityPool) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *IdentityPool) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "IdentityPool"} + if s.AllowUnauthenticatedIdentities == nil { + invalidParams.Add(request.NewErrParamRequired("AllowUnauthenticatedIdentities")) + } + if s.DeveloperProviderName != nil && len(*s.DeveloperProviderName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeveloperProviderName", 1)) + } + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + if s.IdentityPoolName == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolName")) + } + if s.IdentityPoolName != nil && len(*s.IdentityPoolName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolName", 1)) + } + if s.CognitoIdentityProviders != nil { + for i, v := range s.CognitoIdentityProviders { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CognitoIdentityProviders", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAllowUnauthenticatedIdentities sets the AllowUnauthenticatedIdentities field's value. +func (s *IdentityPool) SetAllowUnauthenticatedIdentities(v bool) *IdentityPool { + s.AllowUnauthenticatedIdentities = &v + return s +} + +// SetCognitoIdentityProviders sets the CognitoIdentityProviders field's value. +func (s *IdentityPool) SetCognitoIdentityProviders(v []*Provider) *IdentityPool { + s.CognitoIdentityProviders = v + return s +} + +// SetDeveloperProviderName sets the DeveloperProviderName field's value. +func (s *IdentityPool) SetDeveloperProviderName(v string) *IdentityPool { + s.DeveloperProviderName = &v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *IdentityPool) SetIdentityPoolId(v string) *IdentityPool { + s.IdentityPoolId = &v + return s +} + +// SetIdentityPoolName sets the IdentityPoolName field's value. +func (s *IdentityPool) SetIdentityPoolName(v string) *IdentityPool { + s.IdentityPoolName = &v + return s +} + +// SetOpenIdConnectProviderARNs sets the OpenIdConnectProviderARNs field's value. +func (s *IdentityPool) SetOpenIdConnectProviderARNs(v []*string) *IdentityPool { + s.OpenIdConnectProviderARNs = v + return s +} + +// SetSamlProviderARNs sets the SamlProviderARNs field's value. +func (s *IdentityPool) SetSamlProviderARNs(v []*string) *IdentityPool { + s.SamlProviderARNs = v + return s +} + +// SetSupportedLoginProviders sets the SupportedLoginProviders field's value. +func (s *IdentityPool) SetSupportedLoginProviders(v map[string]*string) *IdentityPool { + s.SupportedLoginProviders = v + return s +} + +// A description of the identity pool. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/IdentityPoolShortDescription +type IdentityPoolShortDescription struct { + _ struct{} `type:"structure"` + + // An identity pool ID in the format REGION:GUID. + IdentityPoolId *string `min:"1" type:"string"` + + // A string that you provide. + IdentityPoolName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s IdentityPoolShortDescription) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s IdentityPoolShortDescription) GoString() string { + return s.String() +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *IdentityPoolShortDescription) SetIdentityPoolId(v string) *IdentityPoolShortDescription { + s.IdentityPoolId = &v + return s +} + +// SetIdentityPoolName sets the IdentityPoolName field's value. +func (s *IdentityPoolShortDescription) SetIdentityPoolName(v string) *IdentityPoolShortDescription { + s.IdentityPoolName = &v + return s +} + +// Input to the ListIdentities action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentitiesInput +type ListIdentitiesInput struct { + _ struct{} `type:"structure"` + + // An optional boolean parameter that allows you to hide disabled identities. + // If omitted, the ListIdentities API will include disabled identities in the + // response. + HideDisabled *bool `type:"boolean"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` + + // The maximum number of identities to return. + // + // MaxResults is a required field + MaxResults *int64 `min:"1" type:"integer" required:"true"` + + // A pagination token. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListIdentitiesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListIdentitiesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListIdentitiesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListIdentitiesInput"} + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + if s.MaxResults == nil { + invalidParams.Add(request.NewErrParamRequired("MaxResults")) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetHideDisabled sets the HideDisabled field's value. +func (s *ListIdentitiesInput) SetHideDisabled(v bool) *ListIdentitiesInput { + s.HideDisabled = &v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *ListIdentitiesInput) SetIdentityPoolId(v string) *ListIdentitiesInput { + s.IdentityPoolId = &v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *ListIdentitiesInput) SetMaxResults(v int64) *ListIdentitiesInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListIdentitiesInput) SetNextToken(v string) *ListIdentitiesInput { + s.NextToken = &v + return s +} + +// The response to a ListIdentities request. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentitiesResponse +type ListIdentitiesOutput struct { + _ struct{} `type:"structure"` + + // An object containing a set of identities and associated mappings. + Identities []*IdentityDescription `type:"list"` + + // An identity pool ID in the format REGION:GUID. + IdentityPoolId *string `min:"1" type:"string"` + + // A pagination token. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListIdentitiesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListIdentitiesOutput) GoString() string { + return s.String() +} + +// SetIdentities sets the Identities field's value. +func (s *ListIdentitiesOutput) SetIdentities(v []*IdentityDescription) *ListIdentitiesOutput { + s.Identities = v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *ListIdentitiesOutput) SetIdentityPoolId(v string) *ListIdentitiesOutput { + s.IdentityPoolId = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListIdentitiesOutput) SetNextToken(v string) *ListIdentitiesOutput { + s.NextToken = &v + return s +} + +// Input to the ListIdentityPools action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentityPoolsInput +type ListIdentityPoolsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of identities to return. + // + // MaxResults is a required field + MaxResults *int64 `min:"1" type:"integer" required:"true"` + + // A pagination token. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListIdentityPoolsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListIdentityPoolsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListIdentityPoolsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListIdentityPoolsInput"} + if s.MaxResults == nil { + invalidParams.Add(request.NewErrParamRequired("MaxResults")) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMaxResults sets the MaxResults field's value. +func (s *ListIdentityPoolsInput) SetMaxResults(v int64) *ListIdentityPoolsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListIdentityPoolsInput) SetNextToken(v string) *ListIdentityPoolsInput { + s.NextToken = &v + return s +} + +// The result of a successful ListIdentityPools action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/ListIdentityPoolsResponse +type ListIdentityPoolsOutput struct { + _ struct{} `type:"structure"` + + // The identity pools returned by the ListIdentityPools action. + IdentityPools []*IdentityPoolShortDescription `type:"list"` + + // A pagination token. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListIdentityPoolsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListIdentityPoolsOutput) GoString() string { + return s.String() +} + +// SetIdentityPools sets the IdentityPools field's value. +func (s *ListIdentityPoolsOutput) SetIdentityPools(v []*IdentityPoolShortDescription) *ListIdentityPoolsOutput { + s.IdentityPools = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListIdentityPoolsOutput) SetNextToken(v string) *ListIdentityPoolsOutput { + s.NextToken = &v + return s +} + +// Input to the LookupDeveloperIdentityInput action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/LookupDeveloperIdentityInput +type LookupDeveloperIdentityInput struct { + _ struct{} `type:"structure"` + + // A unique ID used by your backend authentication process to identify a user. + // Typically, a developer identity provider would issue many developer user + // identifiers, in keeping with the number of users. + DeveloperUserIdentifier *string `min:"1" type:"string"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` + + // The maximum number of identities to return. + MaxResults *int64 `min:"1" type:"integer"` + + // A pagination token. The first call you make will have NextToken set to null. + // After that the service will return NextToken values as needed. For example, + // let's say you make a request with MaxResults set to 10, and there are 20 + // matches in the database. The service will return a pagination token as a + // part of the response. This token can be used to call the API again and get + // results starting from the 11th match. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s LookupDeveloperIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LookupDeveloperIdentityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *LookupDeveloperIdentityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "LookupDeveloperIdentityInput"} + if s.DeveloperUserIdentifier != nil && len(*s.DeveloperUserIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeveloperUserIdentifier", 1)) + } + if s.IdentityId != nil && len(*s.IdentityId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityId", 1)) + } + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDeveloperUserIdentifier sets the DeveloperUserIdentifier field's value. +func (s *LookupDeveloperIdentityInput) SetDeveloperUserIdentifier(v string) *LookupDeveloperIdentityInput { + s.DeveloperUserIdentifier = &v + return s +} + +// SetIdentityId sets the IdentityId field's value. +func (s *LookupDeveloperIdentityInput) SetIdentityId(v string) *LookupDeveloperIdentityInput { + s.IdentityId = &v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *LookupDeveloperIdentityInput) SetIdentityPoolId(v string) *LookupDeveloperIdentityInput { + s.IdentityPoolId = &v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *LookupDeveloperIdentityInput) SetMaxResults(v int64) *LookupDeveloperIdentityInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *LookupDeveloperIdentityInput) SetNextToken(v string) *LookupDeveloperIdentityInput { + s.NextToken = &v + return s +} + +// Returned in response to a successful LookupDeveloperIdentity action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/LookupDeveloperIdentityResponse +type LookupDeveloperIdentityOutput struct { + _ struct{} `type:"structure"` + + // This is the list of developer user identifiers associated with an identity + // ID. Cognito supports the association of multiple developer user identifiers + // with an identity ID. + DeveloperUserIdentifierList []*string `type:"list"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` + + // A pagination token. The first call you make will have NextToken set to null. + // After that the service will return NextToken values as needed. For example, + // let's say you make a request with MaxResults set to 10, and there are 20 + // matches in the database. The service will return a pagination token as a + // part of the response. This token can be used to call the API again and get + // results starting from the 11th match. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s LookupDeveloperIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LookupDeveloperIdentityOutput) GoString() string { + return s.String() +} + +// SetDeveloperUserIdentifierList sets the DeveloperUserIdentifierList field's value. +func (s *LookupDeveloperIdentityOutput) SetDeveloperUserIdentifierList(v []*string) *LookupDeveloperIdentityOutput { + s.DeveloperUserIdentifierList = v + return s +} + +// SetIdentityId sets the IdentityId field's value. +func (s *LookupDeveloperIdentityOutput) SetIdentityId(v string) *LookupDeveloperIdentityOutput { + s.IdentityId = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *LookupDeveloperIdentityOutput) SetNextToken(v string) *LookupDeveloperIdentityOutput { + s.NextToken = &v + return s +} + +// A rule that maps a claim name, a claim value, and a match type to a role +// ARN. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/MappingRule +type MappingRule struct { + _ struct{} `type:"structure"` + + // The claim name that must be present in the token, for example, "isAdmin" + // or "paid". + // + // Claim is a required field + Claim *string `min:"1" type:"string" required:"true"` + + // The match condition that specifies how closely the claim value in the IdP + // token must match Value. + // + // MatchType is a required field + MatchType *string `type:"string" required:"true" enum:"MappingRuleMatchType"` + + // The role ARN. + // + // RoleARN is a required field + RoleARN *string `min:"20" type:"string" required:"true"` + + // A brief string that the claim must match, for example, "paid" or "yes". + // + // Value is a required field + Value *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s MappingRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MappingRule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MappingRule) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MappingRule"} + if s.Claim == nil { + invalidParams.Add(request.NewErrParamRequired("Claim")) + } + if s.Claim != nil && len(*s.Claim) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Claim", 1)) + } + if s.MatchType == nil { + invalidParams.Add(request.NewErrParamRequired("MatchType")) + } + if s.RoleARN == nil { + invalidParams.Add(request.NewErrParamRequired("RoleARN")) + } + if s.RoleARN != nil && len(*s.RoleARN) < 20 { + invalidParams.Add(request.NewErrParamMinLen("RoleARN", 20)) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClaim sets the Claim field's value. +func (s *MappingRule) SetClaim(v string) *MappingRule { + s.Claim = &v + return s +} + +// SetMatchType sets the MatchType field's value. +func (s *MappingRule) SetMatchType(v string) *MappingRule { + s.MatchType = &v + return s +} + +// SetRoleARN sets the RoleARN field's value. +func (s *MappingRule) SetRoleARN(v string) *MappingRule { + s.RoleARN = &v + return s +} + +// SetValue sets the Value field's value. +func (s *MappingRule) SetValue(v string) *MappingRule { + s.Value = &v + return s +} + +// Input to the MergeDeveloperIdentities action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/MergeDeveloperIdentitiesInput +type MergeDeveloperIdentitiesInput struct { + _ struct{} `type:"structure"` + + // User identifier for the destination user. The value should be a DeveloperUserIdentifier. + // + // DestinationUserIdentifier is a required field + DestinationUserIdentifier *string `min:"1" type:"string" required:"true"` + + // The "domain" by which Cognito will refer to your users. This is a (pseudo) + // domain name that you provide while creating an identity pool. This name acts + // as a placeholder that allows your backend and the Cognito service to communicate + // about the developer provider. For the DeveloperProviderName, you can use + // letters as well as period (.), underscore (_), and dash (-). + // + // DeveloperProviderName is a required field + DeveloperProviderName *string `min:"1" type:"string" required:"true"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` + + // User identifier for the source user. The value should be a DeveloperUserIdentifier. + // + // SourceUserIdentifier is a required field + SourceUserIdentifier *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s MergeDeveloperIdentitiesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MergeDeveloperIdentitiesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MergeDeveloperIdentitiesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MergeDeveloperIdentitiesInput"} + if s.DestinationUserIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationUserIdentifier")) + } + if s.DestinationUserIdentifier != nil && len(*s.DestinationUserIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DestinationUserIdentifier", 1)) + } + if s.DeveloperProviderName == nil { + invalidParams.Add(request.NewErrParamRequired("DeveloperProviderName")) + } + if s.DeveloperProviderName != nil && len(*s.DeveloperProviderName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeveloperProviderName", 1)) + } + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + if s.SourceUserIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("SourceUserIdentifier")) + } + if s.SourceUserIdentifier != nil && len(*s.SourceUserIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("SourceUserIdentifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDestinationUserIdentifier sets the DestinationUserIdentifier field's value. +func (s *MergeDeveloperIdentitiesInput) SetDestinationUserIdentifier(v string) *MergeDeveloperIdentitiesInput { + s.DestinationUserIdentifier = &v + return s +} + +// SetDeveloperProviderName sets the DeveloperProviderName field's value. +func (s *MergeDeveloperIdentitiesInput) SetDeveloperProviderName(v string) *MergeDeveloperIdentitiesInput { + s.DeveloperProviderName = &v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *MergeDeveloperIdentitiesInput) SetIdentityPoolId(v string) *MergeDeveloperIdentitiesInput { + s.IdentityPoolId = &v + return s +} + +// SetSourceUserIdentifier sets the SourceUserIdentifier field's value. +func (s *MergeDeveloperIdentitiesInput) SetSourceUserIdentifier(v string) *MergeDeveloperIdentitiesInput { + s.SourceUserIdentifier = &v + return s +} + +// Returned in response to a successful MergeDeveloperIdentities action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/MergeDeveloperIdentitiesResponse +type MergeDeveloperIdentitiesOutput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s MergeDeveloperIdentitiesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MergeDeveloperIdentitiesOutput) GoString() string { + return s.String() +} + +// SetIdentityId sets the IdentityId field's value. +func (s *MergeDeveloperIdentitiesOutput) SetIdentityId(v string) *MergeDeveloperIdentitiesOutput { + s.IdentityId = &v + return s +} + +// A provider representing an Amazon Cognito Identity User Pool and its client +// ID. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/CognitoIdentityProvider +type Provider struct { + _ struct{} `type:"structure"` + + // The client ID for the Amazon Cognito Identity User Pool. + ClientId *string `min:"1" type:"string"` + + // The provider name for an Amazon Cognito Identity User Pool. For example, + // cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789. + ProviderName *string `min:"1" type:"string"` + + // TRUE if server-side token validation is enabled for the identity provider’s + // token. + ServerSideTokenCheck *bool `type:"boolean"` +} + +// String returns the string representation +func (s Provider) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Provider) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Provider) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Provider"} + if s.ClientId != nil && len(*s.ClientId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ClientId", 1)) + } + if s.ProviderName != nil && len(*s.ProviderName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ProviderName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientId sets the ClientId field's value. +func (s *Provider) SetClientId(v string) *Provider { + s.ClientId = &v + return s +} + +// SetProviderName sets the ProviderName field's value. +func (s *Provider) SetProviderName(v string) *Provider { + s.ProviderName = &v + return s +} + +// SetServerSideTokenCheck sets the ServerSideTokenCheck field's value. +func (s *Provider) SetServerSideTokenCheck(v bool) *Provider { + s.ServerSideTokenCheck = &v + return s +} + +// A role mapping. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/RoleMapping +type RoleMapping struct { + _ struct{} `type:"structure"` + + // If you specify Token or Rules as the Type, AmbiguousRoleResolution is required. + // + // Specifies the action to be taken if either no rules match the claim value + // for the Rules type, or there is no cognito:preferred_role claim and there + // are multiple cognito:roles matches for the Token type. + AmbiguousRoleResolution *string `type:"string" enum:"AmbiguousRoleResolutionType"` + + // The rules to be used for mapping users to roles. + // + // If you specify Rules as the role mapping type, RulesConfiguration is required. + RulesConfiguration *RulesConfigurationType `type:"structure"` + + // The role mapping type. Token will use cognito:roles and cognito:preferred_role + // claims from the Cognito identity provider token to map groups to roles. Rules + // will attempt to match claims from the token to map to a role. + // + // Type is a required field + Type *string `type:"string" required:"true" enum:"RoleMappingType"` +} + +// String returns the string representation +func (s RoleMapping) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RoleMapping) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RoleMapping) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RoleMapping"} + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + if s.RulesConfiguration != nil { + if err := s.RulesConfiguration.Validate(); err != nil { + invalidParams.AddNested("RulesConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAmbiguousRoleResolution sets the AmbiguousRoleResolution field's value. +func (s *RoleMapping) SetAmbiguousRoleResolution(v string) *RoleMapping { + s.AmbiguousRoleResolution = &v + return s +} + +// SetRulesConfiguration sets the RulesConfiguration field's value. +func (s *RoleMapping) SetRulesConfiguration(v *RulesConfigurationType) *RoleMapping { + s.RulesConfiguration = v + return s +} + +// SetType sets the Type field's value. +func (s *RoleMapping) SetType(v string) *RoleMapping { + s.Type = &v + return s +} + +// A container for rules. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/RulesConfigurationType +type RulesConfigurationType struct { + _ struct{} `type:"structure"` + + // An array of rules. You can specify up to 25 rules per identity provider. + // + // Rules are evaluated in order. The first one to match specifies the role. + // + // Rules is a required field + Rules []*MappingRule `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s RulesConfigurationType) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RulesConfigurationType) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RulesConfigurationType) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RulesConfigurationType"} + if s.Rules == nil { + invalidParams.Add(request.NewErrParamRequired("Rules")) + } + if s.Rules != nil && len(s.Rules) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Rules", 1)) + } + if s.Rules != nil { + for i, v := range s.Rules { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRules sets the Rules field's value. +func (s *RulesConfigurationType) SetRules(v []*MappingRule) *RulesConfigurationType { + s.Rules = v + return s +} + +// Input to the SetIdentityPoolRoles action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/SetIdentityPoolRolesInput +type SetIdentityPoolRolesInput struct { + _ struct{} `type:"structure"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` + + // How users for a specific identity provider are to mapped to roles. This is + // a string to RoleMapping object map. The string identifies the identity provider, + // for example, "graph.facebook.com" or "cognito-idp-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id". + // + // Up to 25 rules can be specified per identity provider. + RoleMappings map[string]*RoleMapping `type:"map"` + + // The map of roles associated with this pool. For a given role, the key will + // be either "authenticated" or "unauthenticated" and the value will be the + // Role ARN. + // + // Roles is a required field + Roles map[string]*string `type:"map" required:"true"` +} + +// String returns the string representation +func (s SetIdentityPoolRolesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SetIdentityPoolRolesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SetIdentityPoolRolesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SetIdentityPoolRolesInput"} + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + if s.Roles == nil { + invalidParams.Add(request.NewErrParamRequired("Roles")) + } + if s.RoleMappings != nil { + for i, v := range s.RoleMappings { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RoleMappings", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *SetIdentityPoolRolesInput) SetIdentityPoolId(v string) *SetIdentityPoolRolesInput { + s.IdentityPoolId = &v + return s +} + +// SetRoleMappings sets the RoleMappings field's value. +func (s *SetIdentityPoolRolesInput) SetRoleMappings(v map[string]*RoleMapping) *SetIdentityPoolRolesInput { + s.RoleMappings = v + return s +} + +// SetRoles sets the Roles field's value. +func (s *SetIdentityPoolRolesInput) SetRoles(v map[string]*string) *SetIdentityPoolRolesInput { + s.Roles = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/SetIdentityPoolRolesOutput +type SetIdentityPoolRolesOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s SetIdentityPoolRolesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SetIdentityPoolRolesOutput) GoString() string { + return s.String() +} + +// Input to the UnlinkDeveloperIdentity action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkDeveloperIdentityInput +type UnlinkDeveloperIdentityInput struct { + _ struct{} `type:"structure"` + + // The "domain" by which Cognito will refer to your users. + // + // DeveloperProviderName is a required field + DeveloperProviderName *string `min:"1" type:"string" required:"true"` + + // A unique ID used by your backend authentication process to identify a user. + // + // DeveloperUserIdentifier is a required field + DeveloperUserIdentifier *string `min:"1" type:"string" required:"true"` + + // A unique identifier in the format REGION:GUID. + // + // IdentityId is a required field + IdentityId *string `min:"1" type:"string" required:"true"` + + // An identity pool ID in the format REGION:GUID. + // + // IdentityPoolId is a required field + IdentityPoolId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s UnlinkDeveloperIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UnlinkDeveloperIdentityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UnlinkDeveloperIdentityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UnlinkDeveloperIdentityInput"} + if s.DeveloperProviderName == nil { + invalidParams.Add(request.NewErrParamRequired("DeveloperProviderName")) + } + if s.DeveloperProviderName != nil && len(*s.DeveloperProviderName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeveloperProviderName", 1)) + } + if s.DeveloperUserIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("DeveloperUserIdentifier")) + } + if s.DeveloperUserIdentifier != nil && len(*s.DeveloperUserIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeveloperUserIdentifier", 1)) + } + if s.IdentityId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityId")) + } + if s.IdentityId != nil && len(*s.IdentityId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityId", 1)) + } + if s.IdentityPoolId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityPoolId")) + } + if s.IdentityPoolId != nil && len(*s.IdentityPoolId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityPoolId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDeveloperProviderName sets the DeveloperProviderName field's value. +func (s *UnlinkDeveloperIdentityInput) SetDeveloperProviderName(v string) *UnlinkDeveloperIdentityInput { + s.DeveloperProviderName = &v + return s +} + +// SetDeveloperUserIdentifier sets the DeveloperUserIdentifier field's value. +func (s *UnlinkDeveloperIdentityInput) SetDeveloperUserIdentifier(v string) *UnlinkDeveloperIdentityInput { + s.DeveloperUserIdentifier = &v + return s +} + +// SetIdentityId sets the IdentityId field's value. +func (s *UnlinkDeveloperIdentityInput) SetIdentityId(v string) *UnlinkDeveloperIdentityInput { + s.IdentityId = &v + return s +} + +// SetIdentityPoolId sets the IdentityPoolId field's value. +func (s *UnlinkDeveloperIdentityInput) SetIdentityPoolId(v string) *UnlinkDeveloperIdentityInput { + s.IdentityPoolId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkDeveloperIdentityOutput +type UnlinkDeveloperIdentityOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s UnlinkDeveloperIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UnlinkDeveloperIdentityOutput) GoString() string { + return s.String() +} + +// Input to the UnlinkIdentity action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkIdentityInput +type UnlinkIdentityInput struct { + _ struct{} `type:"structure"` + + // A unique identifier in the format REGION:GUID. + // + // IdentityId is a required field + IdentityId *string `min:"1" type:"string" required:"true"` + + // A set of optional name-value pairs that map provider names to provider tokens. + // + // Logins is a required field + Logins map[string]*string `type:"map" required:"true"` + + // Provider names to unlink from this identity. + // + // LoginsToRemove is a required field + LoginsToRemove []*string `type:"list" required:"true"` +} + +// String returns the string representation +func (s UnlinkIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UnlinkIdentityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UnlinkIdentityInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UnlinkIdentityInput"} + if s.IdentityId == nil { + invalidParams.Add(request.NewErrParamRequired("IdentityId")) + } + if s.IdentityId != nil && len(*s.IdentityId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("IdentityId", 1)) + } + if s.Logins == nil { + invalidParams.Add(request.NewErrParamRequired("Logins")) + } + if s.LoginsToRemove == nil { + invalidParams.Add(request.NewErrParamRequired("LoginsToRemove")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetIdentityId sets the IdentityId field's value. +func (s *UnlinkIdentityInput) SetIdentityId(v string) *UnlinkIdentityInput { + s.IdentityId = &v + return s +} + +// SetLogins sets the Logins field's value. +func (s *UnlinkIdentityInput) SetLogins(v map[string]*string) *UnlinkIdentityInput { + s.Logins = v + return s +} + +// SetLoginsToRemove sets the LoginsToRemove field's value. +func (s *UnlinkIdentityInput) SetLoginsToRemove(v []*string) *UnlinkIdentityInput { + s.LoginsToRemove = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnlinkIdentityOutput +type UnlinkIdentityOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s UnlinkIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UnlinkIdentityOutput) GoString() string { + return s.String() +} + +// An array of UnprocessedIdentityId objects, each of which contains an ErrorCode +// and IdentityId. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/UnprocessedIdentityId +type UnprocessedIdentityId struct { + _ struct{} `type:"structure"` + + // The error code indicating the type of error that occurred. + ErrorCode *string `type:"string" enum:"ErrorCode"` + + // A unique identifier in the format REGION:GUID. + IdentityId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s UnprocessedIdentityId) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UnprocessedIdentityId) GoString() string { + return s.String() +} + +// SetErrorCode sets the ErrorCode field's value. +func (s *UnprocessedIdentityId) SetErrorCode(v string) *UnprocessedIdentityId { + s.ErrorCode = &v + return s +} + +// SetIdentityId sets the IdentityId field's value. +func (s *UnprocessedIdentityId) SetIdentityId(v string) *UnprocessedIdentityId { + s.IdentityId = &v + return s +} + +const ( + // AmbiguousRoleResolutionTypeAuthenticatedRole is a AmbiguousRoleResolutionType enum value + AmbiguousRoleResolutionTypeAuthenticatedRole = "AuthenticatedRole" + + // AmbiguousRoleResolutionTypeDeny is a AmbiguousRoleResolutionType enum value + AmbiguousRoleResolutionTypeDeny = "Deny" +) + +const ( + // ErrorCodeAccessDenied is a ErrorCode enum value + ErrorCodeAccessDenied = "AccessDenied" + + // ErrorCodeInternalServerError is a ErrorCode enum value + ErrorCodeInternalServerError = "InternalServerError" +) + +const ( + // MappingRuleMatchTypeEquals is a MappingRuleMatchType enum value + MappingRuleMatchTypeEquals = "Equals" + + // MappingRuleMatchTypeContains is a MappingRuleMatchType enum value + MappingRuleMatchTypeContains = "Contains" + + // MappingRuleMatchTypeStartsWith is a MappingRuleMatchType enum value + MappingRuleMatchTypeStartsWith = "StartsWith" + + // MappingRuleMatchTypeNotEqual is a MappingRuleMatchType enum value + MappingRuleMatchTypeNotEqual = "NotEqual" +) + +const ( + // RoleMappingTypeToken is a RoleMappingType enum value + RoleMappingTypeToken = "Token" + + // RoleMappingTypeRules is a RoleMappingType enum value + RoleMappingTypeRules = "Rules" +) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/customizations.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/customizations.go new file mode 100644 index 0000000000..4bf243c35d --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/customizations.go @@ -0,0 +1,12 @@ +package cognitoidentity + +import "github.com/aws/aws-sdk-go/aws/request" + +func init() { + initRequest = func(r *request.Request) { + switch r.Operation.Name { + case opGetOpenIdToken, opGetId, opGetCredentialsForIdentity: + r.Handlers.Sign.Clear() // these operations are unsigned + } + } +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/errors.go new file mode 100644 index 0000000000..9094d135b1 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/errors.go @@ -0,0 +1,77 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cognitoidentity + +const ( + + // ErrCodeConcurrentModificationException for service response error code + // "ConcurrentModificationException". + // + // Thrown if there are parallel requests to modify a resource. + ErrCodeConcurrentModificationException = "ConcurrentModificationException" + + // ErrCodeDeveloperUserAlreadyRegisteredException for service response error code + // "DeveloperUserAlreadyRegisteredException". + // + // The provided developer user identifier is already registered with Cognito + // under a different identity ID. + ErrCodeDeveloperUserAlreadyRegisteredException = "DeveloperUserAlreadyRegisteredException" + + // ErrCodeExternalServiceException for service response error code + // "ExternalServiceException". + // + // An exception thrown when a dependent service such as Facebook or Twitter + // is not responding + ErrCodeExternalServiceException = "ExternalServiceException" + + // ErrCodeInternalErrorException for service response error code + // "InternalErrorException". + // + // Thrown when the service encounters an error during processing the request. + ErrCodeInternalErrorException = "InternalErrorException" + + // ErrCodeInvalidIdentityPoolConfigurationException for service response error code + // "InvalidIdentityPoolConfigurationException". + // + // Thrown if the identity pool has no role associated for the given auth type + // (auth/unauth) or if the AssumeRole fails. + ErrCodeInvalidIdentityPoolConfigurationException = "InvalidIdentityPoolConfigurationException" + + // ErrCodeInvalidParameterException for service response error code + // "InvalidParameterException". + // + // Thrown for missing or bad input parameter(s). + ErrCodeInvalidParameterException = "InvalidParameterException" + + // ErrCodeLimitExceededException for service response error code + // "LimitExceededException". + // + // Thrown when the total number of user pools has exceeded a preset limit. + ErrCodeLimitExceededException = "LimitExceededException" + + // ErrCodeNotAuthorizedException for service response error code + // "NotAuthorizedException". + // + // Thrown when a user is not authorized to access the requested resource. + ErrCodeNotAuthorizedException = "NotAuthorizedException" + + // ErrCodeResourceConflictException for service response error code + // "ResourceConflictException". + // + // Thrown when a user tries to use a login which is already linked to another + // account. + ErrCodeResourceConflictException = "ResourceConflictException" + + // ErrCodeResourceNotFoundException for service response error code + // "ResourceNotFoundException". + // + // Thrown when the requested resource (for example, a dataset or record) does + // not exist. + ErrCodeResourceNotFoundException = "ResourceNotFoundException" + + // ErrCodeTooManyRequestsException for service response error code + // "TooManyRequestsException". + // + // Thrown when a request is throttled. + ErrCodeTooManyRequestsException = "TooManyRequestsException" +) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/service.go new file mode 100644 index 0000000000..8461c6bfb8 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/cognitoidentity/service.go @@ -0,0 +1,124 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cognitoidentity + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +// Amazon Cognito is a web service that delivers scoped temporary credentials +// to mobile devices and other untrusted environments. Amazon Cognito uniquely +// identifies a device and supplies the user with a consistent identity over +// the lifetime of an application. +// +// Using Amazon Cognito, you can enable authentication with one or more third-party +// identity providers (Facebook, Google, or Login with Amazon), and you can +// also choose to support unauthenticated access from your app. Cognito delivers +// a unique identifier for each user and acts as an OpenID token provider trusted +// by AWS Security Token Service (STS) to access temporary, limited-privilege +// AWS credentials. +// +// To provide end-user credentials, first make an unsigned call to GetId. If +// the end user is authenticated with one of the supported identity providers, +// set the Logins map with the identity provider token. GetId returns a unique +// identifier for the user. +// +// Next, make an unsigned call to GetCredentialsForIdentity. This call expects +// the same Logins map as the GetId call, as well as the IdentityID originally +// returned by GetId. Assuming your identity pool has been configured via the +// SetIdentityPoolRoles operation, GetCredentialsForIdentity will return AWS +// credentials for your use. If your pool has not been configured with SetIdentityPoolRoles, +// or if you want to follow legacy flow, make an unsigned call to GetOpenIdToken, +// which returns the OpenID token necessary to call STS and retrieve AWS credentials. +// This call expects the same Logins map as the GetId call, as well as the IdentityID +// originally returned by GetId. The token returned by GetOpenIdToken can be +// passed to the STS operation AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html) +// to retrieve AWS credentials. +// +// If you want to use Amazon Cognito in an Android, iOS, or Unity application, +// you will probably want to make API calls via the AWS Mobile SDK. To learn +// more, see the AWS Mobile SDK Developer Guide (http://docs.aws.amazon.com/mobile/index.html). +// The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30 +type CognitoIdentity 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 = "cognito-identity" // Service endpoint prefix API calls made to. + EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. +) + +// New creates a new instance of the CognitoIdentity client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a CognitoIdentity client from just a session. +// svc := cognitoidentity.New(mySession) +// +// // Create a CognitoIdentity client with additional configuration +// svc := cognitoidentity.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *CognitoIdentity { + c := p.ClientConfig(EndpointsID, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *CognitoIdentity { + svc := &CognitoIdentity{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningName: signingName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2014-06-30", + JSONVersion: "1.1", + TargetPrefix: "AWSCognitoIdentityService", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a CognitoIdentity operation and runs any +// custom request initialization. +func (c *CognitoIdentity) 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/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go index c5b4467cee..02498a86d8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package configservice provides a client for AWS Config. package configservice @@ -7,6 +7,7 @@ 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" @@ -87,8 +88,23 @@ func (c *ConfigService) DeleteConfigRuleRequest(input *DeleteConfigRuleInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteConfigRule func (c *ConfigService) DeleteConfigRule(input *DeleteConfigRuleInput) (*DeleteConfigRuleOutput, error) { req, out := c.DeleteConfigRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteConfigRuleWithContext is the same as DeleteConfigRule with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteConfigRule 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 *ConfigService) DeleteConfigRuleWithContext(ctx aws.Context, input *DeleteConfigRuleInput, opts ...request.Option) (*DeleteConfigRuleOutput, error) { + req, out := c.DeleteConfigRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteConfigurationRecorder = "DeleteConfigurationRecorder" @@ -163,8 +179,23 @@ func (c *ConfigService) DeleteConfigurationRecorderRequest(input *DeleteConfigur // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteConfigurationRecorder func (c *ConfigService) DeleteConfigurationRecorder(input *DeleteConfigurationRecorderInput) (*DeleteConfigurationRecorderOutput, error) { req, out := c.DeleteConfigurationRecorderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteConfigurationRecorderWithContext is the same as DeleteConfigurationRecorder with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteConfigurationRecorder 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 *ConfigService) DeleteConfigurationRecorderWithContext(ctx aws.Context, input *DeleteConfigurationRecorderInput, opts ...request.Option) (*DeleteConfigurationRecorderOutput, error) { + req, out := c.DeleteConfigurationRecorderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDeliveryChannel = "DeleteDeliveryChannel" @@ -237,8 +268,23 @@ func (c *ConfigService) DeleteDeliveryChannelRequest(input *DeleteDeliveryChanne // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteDeliveryChannel func (c *ConfigService) DeleteDeliveryChannel(input *DeleteDeliveryChannelInput) (*DeleteDeliveryChannelOutput, error) { req, out := c.DeleteDeliveryChannelRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDeliveryChannelWithContext is the same as DeleteDeliveryChannel with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeliveryChannel 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 *ConfigService) DeleteDeliveryChannelWithContext(ctx aws.Context, input *DeleteDeliveryChannelInput, opts ...request.Option) (*DeleteDeliveryChannelOutput, error) { + req, out := c.DeleteDeliveryChannelRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteEvaluationResults = "DeleteEvaluationResults" @@ -310,8 +356,23 @@ func (c *ConfigService) DeleteEvaluationResultsRequest(input *DeleteEvaluationRe // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteEvaluationResults func (c *ConfigService) DeleteEvaluationResults(input *DeleteEvaluationResultsInput) (*DeleteEvaluationResultsOutput, error) { req, out := c.DeleteEvaluationResultsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEvaluationResultsWithContext is the same as DeleteEvaluationResults with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEvaluationResults 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 *ConfigService) DeleteEvaluationResultsWithContext(ctx aws.Context, input *DeleteEvaluationResultsInput, opts ...request.Option) (*DeleteEvaluationResultsOutput, error) { + req, out := c.DeleteEvaluationResultsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeliverConfigSnapshot = "DeliverConfigSnapshot" @@ -391,8 +452,23 @@ func (c *ConfigService) DeliverConfigSnapshotRequest(input *DeliverConfigSnapsho // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeliverConfigSnapshot func (c *ConfigService) DeliverConfigSnapshot(input *DeliverConfigSnapshotInput) (*DeliverConfigSnapshotOutput, error) { req, out := c.DeliverConfigSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeliverConfigSnapshotWithContext is the same as DeliverConfigSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeliverConfigSnapshot 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 *ConfigService) DeliverConfigSnapshotWithContext(ctx aws.Context, input *DeliverConfigSnapshotInput, opts ...request.Option) (*DeliverConfigSnapshotOutput, error) { + req, out := c.DeliverConfigSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeComplianceByConfigRule = "DescribeComplianceByConfigRule" @@ -487,8 +563,23 @@ func (c *ConfigService) DescribeComplianceByConfigRuleRequest(input *DescribeCom // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeComplianceByConfigRule func (c *ConfigService) DescribeComplianceByConfigRule(input *DescribeComplianceByConfigRuleInput) (*DescribeComplianceByConfigRuleOutput, error) { req, out := c.DescribeComplianceByConfigRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeComplianceByConfigRuleWithContext is the same as DescribeComplianceByConfigRule with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeComplianceByConfigRule 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 *ConfigService) DescribeComplianceByConfigRuleWithContext(ctx aws.Context, input *DescribeComplianceByConfigRuleInput, opts ...request.Option) (*DescribeComplianceByConfigRuleOutput, error) { + req, out := c.DescribeComplianceByConfigRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeComplianceByResource = "DescribeComplianceByResource" @@ -581,8 +672,23 @@ func (c *ConfigService) DescribeComplianceByResourceRequest(input *DescribeCompl // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeComplianceByResource func (c *ConfigService) DescribeComplianceByResource(input *DescribeComplianceByResourceInput) (*DescribeComplianceByResourceOutput, error) { req, out := c.DescribeComplianceByResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeComplianceByResourceWithContext is the same as DescribeComplianceByResource with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeComplianceByResource 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 *ConfigService) DescribeComplianceByResourceWithContext(ctx aws.Context, input *DescribeComplianceByResourceInput, opts ...request.Option) (*DescribeComplianceByResourceOutput, error) { + req, out := c.DescribeComplianceByResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConfigRuleEvaluationStatus = "DescribeConfigRuleEvaluationStatus" @@ -658,8 +764,23 @@ func (c *ConfigService) DescribeConfigRuleEvaluationStatusRequest(input *Describ // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeConfigRuleEvaluationStatus func (c *ConfigService) DescribeConfigRuleEvaluationStatus(input *DescribeConfigRuleEvaluationStatusInput) (*DescribeConfigRuleEvaluationStatusOutput, error) { req, out := c.DescribeConfigRuleEvaluationStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConfigRuleEvaluationStatusWithContext is the same as DescribeConfigRuleEvaluationStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConfigRuleEvaluationStatus 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 *ConfigService) DescribeConfigRuleEvaluationStatusWithContext(ctx aws.Context, input *DescribeConfigRuleEvaluationStatusInput, opts ...request.Option) (*DescribeConfigRuleEvaluationStatusOutput, error) { + req, out := c.DescribeConfigRuleEvaluationStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConfigRules = "DescribeConfigRules" @@ -728,8 +849,23 @@ func (c *ConfigService) DescribeConfigRulesRequest(input *DescribeConfigRulesInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeConfigRules func (c *ConfigService) DescribeConfigRules(input *DescribeConfigRulesInput) (*DescribeConfigRulesOutput, error) { req, out := c.DescribeConfigRulesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConfigRulesWithContext is the same as DescribeConfigRules with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConfigRules 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 *ConfigService) DescribeConfigRulesWithContext(ctx aws.Context, input *DescribeConfigRulesInput, opts ...request.Option) (*DescribeConfigRulesOutput, error) { + req, out := c.DescribeConfigRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConfigurationRecorderStatus = "DescribeConfigurationRecorderStatus" @@ -798,8 +934,23 @@ func (c *ConfigService) DescribeConfigurationRecorderStatusRequest(input *Descri // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeConfigurationRecorderStatus func (c *ConfigService) DescribeConfigurationRecorderStatus(input *DescribeConfigurationRecorderStatusInput) (*DescribeConfigurationRecorderStatusOutput, error) { req, out := c.DescribeConfigurationRecorderStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConfigurationRecorderStatusWithContext is the same as DescribeConfigurationRecorderStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConfigurationRecorderStatus 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 *ConfigService) DescribeConfigurationRecorderStatusWithContext(ctx aws.Context, input *DescribeConfigurationRecorderStatusInput, opts ...request.Option) (*DescribeConfigurationRecorderStatusOutput, error) { + req, out := c.DescribeConfigurationRecorderStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConfigurationRecorders = "DescribeConfigurationRecorders" @@ -868,8 +1019,23 @@ func (c *ConfigService) DescribeConfigurationRecordersRequest(input *DescribeCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeConfigurationRecorders func (c *ConfigService) DescribeConfigurationRecorders(input *DescribeConfigurationRecordersInput) (*DescribeConfigurationRecordersOutput, error) { req, out := c.DescribeConfigurationRecordersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConfigurationRecordersWithContext is the same as DescribeConfigurationRecorders with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConfigurationRecorders 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 *ConfigService) DescribeConfigurationRecordersWithContext(ctx aws.Context, input *DescribeConfigurationRecordersInput, opts ...request.Option) (*DescribeConfigurationRecordersOutput, error) { + req, out := c.DescribeConfigurationRecordersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDeliveryChannelStatus = "DescribeDeliveryChannelStatus" @@ -937,8 +1103,23 @@ func (c *ConfigService) DescribeDeliveryChannelStatusRequest(input *DescribeDeli // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeDeliveryChannelStatus func (c *ConfigService) DescribeDeliveryChannelStatus(input *DescribeDeliveryChannelStatusInput) (*DescribeDeliveryChannelStatusOutput, error) { req, out := c.DescribeDeliveryChannelStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDeliveryChannelStatusWithContext is the same as DescribeDeliveryChannelStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDeliveryChannelStatus 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 *ConfigService) DescribeDeliveryChannelStatusWithContext(ctx aws.Context, input *DescribeDeliveryChannelStatusInput, opts ...request.Option) (*DescribeDeliveryChannelStatusOutput, error) { + req, out := c.DescribeDeliveryChannelStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDeliveryChannels = "DescribeDeliveryChannels" @@ -1006,8 +1187,23 @@ func (c *ConfigService) DescribeDeliveryChannelsRequest(input *DescribeDeliveryC // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeDeliveryChannels func (c *ConfigService) DescribeDeliveryChannels(input *DescribeDeliveryChannelsInput) (*DescribeDeliveryChannelsOutput, error) { req, out := c.DescribeDeliveryChannelsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDeliveryChannelsWithContext is the same as DescribeDeliveryChannels with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDeliveryChannels 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 *ConfigService) DescribeDeliveryChannelsWithContext(ctx aws.Context, input *DescribeDeliveryChannelsInput, opts ...request.Option) (*DescribeDeliveryChannelsOutput, error) { + req, out := c.DescribeDeliveryChannelsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetComplianceDetailsByConfigRule = "GetComplianceDetailsByConfigRule" @@ -1082,8 +1278,23 @@ func (c *ConfigService) GetComplianceDetailsByConfigRuleRequest(input *GetCompli // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetComplianceDetailsByConfigRule func (c *ConfigService) GetComplianceDetailsByConfigRule(input *GetComplianceDetailsByConfigRuleInput) (*GetComplianceDetailsByConfigRuleOutput, error) { req, out := c.GetComplianceDetailsByConfigRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetComplianceDetailsByConfigRuleWithContext is the same as GetComplianceDetailsByConfigRule with the addition of +// the ability to pass a context and additional request options. +// +// See GetComplianceDetailsByConfigRule 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 *ConfigService) GetComplianceDetailsByConfigRuleWithContext(ctx aws.Context, input *GetComplianceDetailsByConfigRuleInput, opts ...request.Option) (*GetComplianceDetailsByConfigRuleOutput, error) { + req, out := c.GetComplianceDetailsByConfigRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetComplianceDetailsByResource = "GetComplianceDetailsByResource" @@ -1150,8 +1361,23 @@ func (c *ConfigService) GetComplianceDetailsByResourceRequest(input *GetComplian // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetComplianceDetailsByResource func (c *ConfigService) GetComplianceDetailsByResource(input *GetComplianceDetailsByResourceInput) (*GetComplianceDetailsByResourceOutput, error) { req, out := c.GetComplianceDetailsByResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetComplianceDetailsByResourceWithContext is the same as GetComplianceDetailsByResource with the addition of +// the ability to pass a context and additional request options. +// +// See GetComplianceDetailsByResource 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 *ConfigService) GetComplianceDetailsByResourceWithContext(ctx aws.Context, input *GetComplianceDetailsByResourceInput, opts ...request.Option) (*GetComplianceDetailsByResourceOutput, error) { + req, out := c.GetComplianceDetailsByResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetComplianceSummaryByConfigRule = "GetComplianceSummaryByConfigRule" @@ -1211,8 +1437,23 @@ func (c *ConfigService) GetComplianceSummaryByConfigRuleRequest(input *GetCompli // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetComplianceSummaryByConfigRule func (c *ConfigService) GetComplianceSummaryByConfigRule(input *GetComplianceSummaryByConfigRuleInput) (*GetComplianceSummaryByConfigRuleOutput, error) { req, out := c.GetComplianceSummaryByConfigRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetComplianceSummaryByConfigRuleWithContext is the same as GetComplianceSummaryByConfigRule with the addition of +// the ability to pass a context and additional request options. +// +// See GetComplianceSummaryByConfigRule 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 *ConfigService) GetComplianceSummaryByConfigRuleWithContext(ctx aws.Context, input *GetComplianceSummaryByConfigRuleInput, opts ...request.Option) (*GetComplianceSummaryByConfigRuleOutput, error) { + req, out := c.GetComplianceSummaryByConfigRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetComplianceSummaryByResourceType = "GetComplianceSummaryByResourceType" @@ -1279,8 +1520,23 @@ func (c *ConfigService) GetComplianceSummaryByResourceTypeRequest(input *GetComp // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetComplianceSummaryByResourceType func (c *ConfigService) GetComplianceSummaryByResourceType(input *GetComplianceSummaryByResourceTypeInput) (*GetComplianceSummaryByResourceTypeOutput, error) { req, out := c.GetComplianceSummaryByResourceTypeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetComplianceSummaryByResourceTypeWithContext is the same as GetComplianceSummaryByResourceType with the addition of +// the ability to pass a context and additional request options. +// +// See GetComplianceSummaryByResourceType 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 *ConfigService) GetComplianceSummaryByResourceTypeWithContext(ctx aws.Context, input *GetComplianceSummaryByResourceTypeInput, opts ...request.Option) (*GetComplianceSummaryByResourceTypeOutput, error) { + req, out := c.GetComplianceSummaryByResourceTypeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetResourceConfigHistory = "GetResourceConfigHistory" @@ -1380,8 +1636,23 @@ func (c *ConfigService) GetResourceConfigHistoryRequest(input *GetResourceConfig // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetResourceConfigHistory func (c *ConfigService) GetResourceConfigHistory(input *GetResourceConfigHistoryInput) (*GetResourceConfigHistoryOutput, error) { req, out := c.GetResourceConfigHistoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetResourceConfigHistoryWithContext is the same as GetResourceConfigHistory with the addition of +// the ability to pass a context and additional request options. +// +// See GetResourceConfigHistory 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 *ConfigService) GetResourceConfigHistoryWithContext(ctx aws.Context, input *GetResourceConfigHistoryInput, opts ...request.Option) (*GetResourceConfigHistoryOutput, error) { + req, out := c.GetResourceConfigHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetResourceConfigHistoryPages iterates over the pages of a GetResourceConfigHistory operation, @@ -1401,12 +1672,37 @@ func (c *ConfigService) GetResourceConfigHistory(input *GetResourceConfigHistory // return pageNum <= 3 // }) // -func (c *ConfigService) GetResourceConfigHistoryPages(input *GetResourceConfigHistoryInput, fn func(p *GetResourceConfigHistoryOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetResourceConfigHistoryRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetResourceConfigHistoryOutput), lastPage) - }) +func (c *ConfigService) GetResourceConfigHistoryPages(input *GetResourceConfigHistoryInput, fn func(*GetResourceConfigHistoryOutput, bool) bool) error { + return c.GetResourceConfigHistoryPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetResourceConfigHistoryPagesWithContext same as GetResourceConfigHistoryPages 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 *ConfigService) GetResourceConfigHistoryPagesWithContext(ctx aws.Context, input *GetResourceConfigHistoryInput, fn func(*GetResourceConfigHistoryOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetResourceConfigHistoryInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetResourceConfigHistoryRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetResourceConfigHistoryOutput), !p.HasNextPage()) + } + return p.Err() } const opListDiscoveredResources = "ListDiscoveredResources" @@ -1494,8 +1790,23 @@ func (c *ConfigService) ListDiscoveredResourcesRequest(input *ListDiscoveredReso // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/ListDiscoveredResources func (c *ConfigService) ListDiscoveredResources(input *ListDiscoveredResourcesInput) (*ListDiscoveredResourcesOutput, error) { req, out := c.ListDiscoveredResourcesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDiscoveredResourcesWithContext is the same as ListDiscoveredResources with the addition of +// the ability to pass a context and additional request options. +// +// See ListDiscoveredResources 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 *ConfigService) ListDiscoveredResourcesWithContext(ctx aws.Context, input *ListDiscoveredResourcesInput, opts ...request.Option) (*ListDiscoveredResourcesOutput, error) { + req, out := c.ListDiscoveredResourcesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutConfigRule = "PutConfigRule" @@ -1559,9 +1870,9 @@ func (c *ConfigService) PutConfigRuleRequest(input *PutConfigRuleInput) (req *re // the ARN for the SourceIdentifier key. This key is part of the Source object, // which is part of the ConfigRule object. // -// If you are adding a new AWS managed Config rule, specify the rule's identifier +// If you are adding an AWS managed Config rule, specify the rule's identifier // for the SourceIdentifier key. To reference AWS managed Config rule identifiers, -// see Using AWS Managed Config Rules (http://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html). +// see About AWS Managed Config Rules (http://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html). // // For any new rule that you add, specify the ConfigRuleName in the ConfigRule // object. Do not specify the ConfigRuleArn or the ConfigRuleId. These values @@ -1618,8 +1929,23 @@ func (c *ConfigService) PutConfigRuleRequest(input *PutConfigRuleInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutConfigRule func (c *ConfigService) PutConfigRule(input *PutConfigRuleInput) (*PutConfigRuleOutput, error) { req, out := c.PutConfigRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutConfigRuleWithContext is the same as PutConfigRule with the addition of +// the ability to pass a context and additional request options. +// +// See PutConfigRule 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 *ConfigService) PutConfigRuleWithContext(ctx aws.Context, input *PutConfigRuleInput, opts ...request.Option) (*PutConfigRuleOutput, error) { + req, out := c.PutConfigRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutConfigurationRecorder = "PutConfigurationRecorder" @@ -1705,8 +2031,23 @@ func (c *ConfigService) PutConfigurationRecorderRequest(input *PutConfigurationR // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutConfigurationRecorder func (c *ConfigService) PutConfigurationRecorder(input *PutConfigurationRecorderInput) (*PutConfigurationRecorderOutput, error) { req, out := c.PutConfigurationRecorderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutConfigurationRecorderWithContext is the same as PutConfigurationRecorder with the addition of +// the ability to pass a context and additional request options. +// +// See PutConfigurationRecorder 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 *ConfigService) PutConfigurationRecorderWithContext(ctx aws.Context, input *PutConfigurationRecorderInput, opts ...request.Option) (*PutConfigurationRecorderOutput, error) { + req, out := c.PutConfigurationRecorderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutDeliveryChannel = "PutDeliveryChannel" @@ -1804,8 +2145,23 @@ func (c *ConfigService) PutDeliveryChannelRequest(input *PutDeliveryChannelInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutDeliveryChannel func (c *ConfigService) PutDeliveryChannel(input *PutDeliveryChannelInput) (*PutDeliveryChannelOutput, error) { req, out := c.PutDeliveryChannelRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutDeliveryChannelWithContext is the same as PutDeliveryChannel with the addition of +// the ability to pass a context and additional request options. +// +// See PutDeliveryChannel 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 *ConfigService) PutDeliveryChannelWithContext(ctx aws.Context, input *PutDeliveryChannelInput, opts ...request.Option) (*PutDeliveryChannelOutput, error) { + req, out := c.PutDeliveryChannelRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutEvaluations = "PutEvaluations" @@ -1879,8 +2235,23 @@ func (c *ConfigService) PutEvaluationsRequest(input *PutEvaluationsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutEvaluations func (c *ConfigService) PutEvaluations(input *PutEvaluationsInput) (*PutEvaluationsOutput, error) { req, out := c.PutEvaluationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutEvaluationsWithContext is the same as PutEvaluations with the addition of +// the ability to pass a context and additional request options. +// +// See PutEvaluations 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 *ConfigService) PutEvaluationsWithContext(ctx aws.Context, input *PutEvaluationsInput, opts ...request.Option) (*PutEvaluationsOutput, error) { + req, out := c.PutEvaluationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartConfigRulesEvaluation = "StartConfigRulesEvaluation" @@ -1986,8 +2357,23 @@ func (c *ConfigService) StartConfigRulesEvaluationRequest(input *StartConfigRule // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/StartConfigRulesEvaluation func (c *ConfigService) StartConfigRulesEvaluation(input *StartConfigRulesEvaluationInput) (*StartConfigRulesEvaluationOutput, error) { req, out := c.StartConfigRulesEvaluationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartConfigRulesEvaluationWithContext is the same as StartConfigRulesEvaluation with the addition of +// the ability to pass a context and additional request options. +// +// See StartConfigRulesEvaluation 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 *ConfigService) StartConfigRulesEvaluationWithContext(ctx aws.Context, input *StartConfigRulesEvaluationInput, opts ...request.Option) (*StartConfigRulesEvaluationOutput, error) { + req, out := c.StartConfigRulesEvaluationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartConfigurationRecorder = "StartConfigurationRecorder" @@ -2060,8 +2446,23 @@ func (c *ConfigService) StartConfigurationRecorderRequest(input *StartConfigurat // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/StartConfigurationRecorder func (c *ConfigService) StartConfigurationRecorder(input *StartConfigurationRecorderInput) (*StartConfigurationRecorderOutput, error) { req, out := c.StartConfigurationRecorderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartConfigurationRecorderWithContext is the same as StartConfigurationRecorder with the addition of +// the ability to pass a context and additional request options. +// +// See StartConfigurationRecorder 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 *ConfigService) StartConfigurationRecorderWithContext(ctx aws.Context, input *StartConfigurationRecorderInput, opts ...request.Option) (*StartConfigurationRecorderOutput, error) { + req, out := c.StartConfigurationRecorderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopConfigurationRecorder = "StopConfigurationRecorder" @@ -2128,8 +2529,23 @@ func (c *ConfigService) StopConfigurationRecorderRequest(input *StopConfiguratio // Please also see https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/StopConfigurationRecorder func (c *ConfigService) StopConfigurationRecorder(input *StopConfigurationRecorderInput) (*StopConfigurationRecorderOutput, error) { req, out := c.StopConfigurationRecorderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopConfigurationRecorderWithContext is the same as StopConfigurationRecorder with the addition of +// the ability to pass a context and additional request options. +// +// See StopConfigurationRecorder 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 *ConfigService) StopConfigurationRecorderWithContext(ctx aws.Context, input *StopConfigurationRecorderInput, opts ...request.Option) (*StopConfigurationRecorderOutput, error) { + req, out := c.StopConfigurationRecorderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Indicates whether an AWS resource or AWS Config rule is compliant and provides @@ -2511,9 +2927,11 @@ type ConfigRule struct { // * You are using an AWS managed rule that is triggered at a periodic frequency. // // * Your custom rule is triggered when AWS Config delivers the configuration - // snapshot. + // snapshot. For more information, see ConfigSnapshotDeliveryProperties. // - // For more information, see ConfigSnapshotDeliveryProperties. + // By default, rules with a periodic trigger are evaluated every 24 hours. To + // change the frequency, specify a valid value for the MaximumExecutionFrequency + // parameter. MaximumExecutionFrequency *string `type:"string" enum:"MaximumExecutionFrequency"` // Defines which resources can trigger an evaluation for the rule. The scope @@ -3522,45 +3940,8 @@ func (s *DeliverConfigSnapshotOutput) SetConfigSnapshotId(v string) *DeliverConf type DeliveryChannel struct { _ struct{} `type:"structure"` - // Provides options for how often AWS Config delivers configuration snapshots - // to the Amazon S3 bucket in your delivery channel. - // - // If you want to create a rule that triggers evaluations for your resources - // when AWS Config delivers the configuration snapshot, see the following: - // - // The frequency for a rule that triggers evaluations for your resources when - // AWS Config delivers the configuration snapshot is set by one of two values, - // depending on which is less frequent: - // - // * The value for the deliveryFrequency parameter within the delivery channel - // configuration, which sets how often AWS Config delivers configuration - // snapshots. This value also sets how often AWS Config invokes evaluations - // for Config rules. - // - // * The value for the MaximumExecutionFrequency parameter, which sets the - // maximum frequency with which AWS Config invokes evaluations for the rule. - // For more information, see ConfigRule. - // - // If the deliveryFrequency value is less frequent than the MaximumExecutionFrequency - // value for a rule, AWS Config invokes the rule only as often as the deliveryFrequency - // value. - // - // For example, you want your rule to run evaluations when AWS Config delivers - // the configuration snapshot. - // - // You specify the MaximumExecutionFrequency value for Six_Hours. - // - // You then specify the delivery channel deliveryFrequency value for TwentyFour_Hours. - // - // Because the value for deliveryFrequency is less frequent than MaximumExecutionFrequency, - // AWS Config invokes evaluations for the rule every 24 hours. - // - // You should set the MaximumExecutionFrequency value to be at least as frequent - // as the deliveryFrequency value. You can view the deliveryFrequency value - // by using the DescribeDeliveryChannnels action. - // - // To update the deliveryFrequency with which AWS Config delivers your configuration - // snapshots, use the PutDeliveryChannel action. + // The options for how often AWS Config delivers configuration snapshots to + // the Amazon S3 bucket. ConfigSnapshotDeliveryProperties *ConfigSnapshotDeliveryProperties `locationName:"configSnapshotDeliveryProperties" type:"structure"` // The name of the delivery channel. By default, AWS Config assigns the name @@ -5124,20 +5505,7 @@ func (s *ListDiscoveredResourcesOutput) SetResourceIdentifiers(v []*ResourceIden type PutConfigRuleInput struct { _ struct{} `type:"structure"` - // An AWS Config rule represents an AWS Lambda function that you create for - // a custom rule or a predefined function for an AWS managed rule. The function - // evaluates configuration items to assess whether your AWS resources comply - // with your desired configurations. This function can run when AWS Config detects - // a configuration change to an AWS resource and at a periodic frequency that - // you choose (for example, every 24 hours). - // - // You can use the AWS CLI and AWS SDKs if you want to create a rule that triggers - // evaluations for your resources when AWS Config delivers the configuration - // snapshot. For more information, see ConfigSnapshotDeliveryProperties. - // - // For more information about developing and using AWS Config rules, see Evaluating - // AWS Resource Configurations with AWS Config (http://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html) - // in the AWS Config Developer Guide. + // The rule that you want to add to your account. // // ConfigRule is a required field ConfigRule *ConfigRule `type:"structure" required:"true"` @@ -5790,9 +6158,13 @@ type SourceDetail struct { // to evaluate your AWS resources. EventSource *string `type:"string" enum:"EventSource"` - // The frequency that you want AWS Config to run evaluations for a rule that - // is triggered periodically. If you specify a value for MaximumExecutionFrequency, + // The frequency that you want AWS Config to run evaluations for a custom rule + // with a periodic trigger. If you specify a value for MaximumExecutionFrequency, // then MessageType must use the ScheduledNotification value. + // + // By default, rules with a periodic trigger are evaluated every 24 hours. To + // change the frequency, specify a valid value for the MaximumExecutionFrequency + // parameter. MaximumExecutionFrequency *string `type:"string" enum:"MaximumExecutionFrequency"` // The type of notification that triggers AWS Config to run an evaluation for diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go index abe7294e3b..cc1554087e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package configservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/service.go index b27bfb5a58..4eefd3463a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/configservice/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package configservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go index 06ceb9495c..7dc62e7515 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package databasemigrationservice provides a client for AWS Database Migration Service. package databasemigrationservice @@ -7,6 +7,7 @@ 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" ) @@ -75,8 +76,23 @@ func (c *DatabaseMigrationService) AddTagsToResourceRequest(input *AddTagsToReso // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/AddTagsToResource func (c *DatabaseMigrationService) AddTagsToResource(input *AddTagsToResourceInput) (*AddTagsToResourceOutput, error) { req, out := c.AddTagsToResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToResourceWithContext is the same as AddTagsToResource with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToResource 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 *DatabaseMigrationService) AddTagsToResourceWithContext(ctx aws.Context, input *AddTagsToResourceInput, opts ...request.Option) (*AddTagsToResourceOutput, error) { + req, out := c.AddTagsToResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateEndpoint = "CreateEndpoint" @@ -156,8 +172,23 @@ func (c *DatabaseMigrationService) CreateEndpointRequest(input *CreateEndpointIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/CreateEndpoint func (c *DatabaseMigrationService) CreateEndpoint(input *CreateEndpointInput) (*CreateEndpointOutput, error) { req, out := c.CreateEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateEndpointWithContext is the same as CreateEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See CreateEndpoint 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 *DatabaseMigrationService) CreateEndpointWithContext(ctx aws.Context, input *CreateEndpointInput, opts ...request.Option) (*CreateEndpointOutput, error) { + req, out := c.CreateEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReplicationInstance = "CreateReplicationInstance" @@ -250,8 +281,23 @@ func (c *DatabaseMigrationService) CreateReplicationInstanceRequest(input *Creat // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/CreateReplicationInstance func (c *DatabaseMigrationService) CreateReplicationInstance(input *CreateReplicationInstanceInput) (*CreateReplicationInstanceOutput, error) { req, out := c.CreateReplicationInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReplicationInstanceWithContext is the same as CreateReplicationInstance with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReplicationInstance 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 *DatabaseMigrationService) CreateReplicationInstanceWithContext(ctx aws.Context, input *CreateReplicationInstanceInput, opts ...request.Option) (*CreateReplicationInstanceOutput, error) { + req, out := c.CreateReplicationInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReplicationSubnetGroup = "CreateReplicationSubnetGroup" @@ -331,8 +377,23 @@ func (c *DatabaseMigrationService) CreateReplicationSubnetGroupRequest(input *Cr // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/CreateReplicationSubnetGroup func (c *DatabaseMigrationService) CreateReplicationSubnetGroup(input *CreateReplicationSubnetGroupInput) (*CreateReplicationSubnetGroupOutput, error) { req, out := c.CreateReplicationSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReplicationSubnetGroupWithContext is the same as CreateReplicationSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReplicationSubnetGroup 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 *DatabaseMigrationService) CreateReplicationSubnetGroupWithContext(ctx aws.Context, input *CreateReplicationSubnetGroupInput, opts ...request.Option) (*CreateReplicationSubnetGroupOutput, error) { + req, out := c.CreateReplicationSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReplicationTask = "CreateReplicationTask" @@ -409,8 +470,23 @@ func (c *DatabaseMigrationService) CreateReplicationTaskRequest(input *CreateRep // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/CreateReplicationTask func (c *DatabaseMigrationService) CreateReplicationTask(input *CreateReplicationTaskInput) (*CreateReplicationTaskOutput, error) { req, out := c.CreateReplicationTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReplicationTaskWithContext is the same as CreateReplicationTask with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReplicationTask 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 *DatabaseMigrationService) CreateReplicationTaskWithContext(ctx aws.Context, input *CreateReplicationTaskInput, opts ...request.Option) (*CreateReplicationTaskOutput, error) { + req, out := c.CreateReplicationTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCertificate = "DeleteCertificate" @@ -478,8 +554,23 @@ func (c *DatabaseMigrationService) DeleteCertificateRequest(input *DeleteCertifi // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DeleteCertificate func (c *DatabaseMigrationService) DeleteCertificate(input *DeleteCertificateInput) (*DeleteCertificateOutput, error) { req, out := c.DeleteCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCertificateWithContext is the same as DeleteCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCertificate 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 *DatabaseMigrationService) DeleteCertificateWithContext(ctx aws.Context, input *DeleteCertificateInput, opts ...request.Option) (*DeleteCertificateOutput, error) { + req, out := c.DeleteCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteEndpoint = "DeleteEndpoint" @@ -550,8 +641,23 @@ func (c *DatabaseMigrationService) DeleteEndpointRequest(input *DeleteEndpointIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DeleteEndpoint func (c *DatabaseMigrationService) DeleteEndpoint(input *DeleteEndpointInput) (*DeleteEndpointOutput, error) { req, out := c.DeleteEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEndpointWithContext is the same as DeleteEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEndpoint 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 *DatabaseMigrationService) DeleteEndpointWithContext(ctx aws.Context, input *DeleteEndpointInput, opts ...request.Option) (*DeleteEndpointOutput, error) { + req, out := c.DeleteEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReplicationInstance = "DeleteReplicationInstance" @@ -622,8 +728,23 @@ func (c *DatabaseMigrationService) DeleteReplicationInstanceRequest(input *Delet // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DeleteReplicationInstance func (c *DatabaseMigrationService) DeleteReplicationInstance(input *DeleteReplicationInstanceInput) (*DeleteReplicationInstanceOutput, error) { req, out := c.DeleteReplicationInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReplicationInstanceWithContext is the same as DeleteReplicationInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReplicationInstance 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 *DatabaseMigrationService) DeleteReplicationInstanceWithContext(ctx aws.Context, input *DeleteReplicationInstanceInput, opts ...request.Option) (*DeleteReplicationInstanceOutput, error) { + req, out := c.DeleteReplicationInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReplicationSubnetGroup = "DeleteReplicationSubnetGroup" @@ -691,8 +812,23 @@ func (c *DatabaseMigrationService) DeleteReplicationSubnetGroupRequest(input *De // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DeleteReplicationSubnetGroup func (c *DatabaseMigrationService) DeleteReplicationSubnetGroup(input *DeleteReplicationSubnetGroupInput) (*DeleteReplicationSubnetGroupOutput, error) { req, out := c.DeleteReplicationSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReplicationSubnetGroupWithContext is the same as DeleteReplicationSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReplicationSubnetGroup 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 *DatabaseMigrationService) DeleteReplicationSubnetGroupWithContext(ctx aws.Context, input *DeleteReplicationSubnetGroupInput, opts ...request.Option) (*DeleteReplicationSubnetGroupOutput, error) { + req, out := c.DeleteReplicationSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReplicationTask = "DeleteReplicationTask" @@ -760,8 +896,23 @@ func (c *DatabaseMigrationService) DeleteReplicationTaskRequest(input *DeleteRep // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DeleteReplicationTask func (c *DatabaseMigrationService) DeleteReplicationTask(input *DeleteReplicationTaskInput) (*DeleteReplicationTaskOutput, error) { req, out := c.DeleteReplicationTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReplicationTaskWithContext is the same as DeleteReplicationTask with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReplicationTask 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 *DatabaseMigrationService) DeleteReplicationTaskWithContext(ctx aws.Context, input *DeleteReplicationTaskInput, opts ...request.Option) (*DeleteReplicationTaskOutput, error) { + req, out := c.DeleteReplicationTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAccountAttributes = "DescribeAccountAttributes" @@ -825,8 +976,23 @@ func (c *DatabaseMigrationService) DescribeAccountAttributesRequest(input *Descr // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeAccountAttributes func (c *DatabaseMigrationService) DescribeAccountAttributes(input *DescribeAccountAttributesInput) (*DescribeAccountAttributesOutput, error) { req, out := c.DescribeAccountAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAccountAttributesWithContext is the same as DescribeAccountAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAccountAttributes 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 *DatabaseMigrationService) DescribeAccountAttributesWithContext(ctx aws.Context, input *DescribeAccountAttributesInput, opts ...request.Option) (*DescribeAccountAttributesOutput, error) { + req, out := c.DescribeAccountAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCertificates = "DescribeCertificates" @@ -890,8 +1056,23 @@ func (c *DatabaseMigrationService) DescribeCertificatesRequest(input *DescribeCe // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeCertificates func (c *DatabaseMigrationService) DescribeCertificates(input *DescribeCertificatesInput) (*DescribeCertificatesOutput, error) { req, out := c.DescribeCertificatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCertificatesWithContext is the same as DescribeCertificates with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCertificates 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 *DatabaseMigrationService) DescribeCertificatesWithContext(ctx aws.Context, input *DescribeCertificatesInput, opts ...request.Option) (*DescribeCertificatesOutput, error) { + req, out := c.DescribeCertificatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConnections = "DescribeConnections" @@ -956,8 +1137,23 @@ func (c *DatabaseMigrationService) DescribeConnectionsRequest(input *DescribeCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeConnections func (c *DatabaseMigrationService) DescribeConnections(input *DescribeConnectionsInput) (*DescribeConnectionsOutput, error) { req, out := c.DescribeConnectionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConnectionsWithContext is the same as DescribeConnections with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConnections 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 *DatabaseMigrationService) DescribeConnectionsWithContext(ctx aws.Context, input *DescribeConnectionsInput, opts ...request.Option) (*DescribeConnectionsOutput, error) { + req, out := c.DescribeConnectionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEndpointTypes = "DescribeEndpointTypes" @@ -1016,8 +1212,23 @@ func (c *DatabaseMigrationService) DescribeEndpointTypesRequest(input *DescribeE // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeEndpointTypes func (c *DatabaseMigrationService) DescribeEndpointTypes(input *DescribeEndpointTypesInput) (*DescribeEndpointTypesOutput, error) { req, out := c.DescribeEndpointTypesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEndpointTypesWithContext is the same as DescribeEndpointTypes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEndpointTypes 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 *DatabaseMigrationService) DescribeEndpointTypesWithContext(ctx aws.Context, input *DescribeEndpointTypesInput, opts ...request.Option) (*DescribeEndpointTypesOutput, error) { + req, out := c.DescribeEndpointTypesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEndpoints = "DescribeEndpoints" @@ -1081,8 +1292,23 @@ func (c *DatabaseMigrationService) DescribeEndpointsRequest(input *DescribeEndpo // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeEndpoints func (c *DatabaseMigrationService) DescribeEndpoints(input *DescribeEndpointsInput) (*DescribeEndpointsOutput, error) { req, out := c.DescribeEndpointsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEndpointsWithContext is the same as DescribeEndpoints with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEndpoints 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 *DatabaseMigrationService) DescribeEndpointsWithContext(ctx aws.Context, input *DescribeEndpointsInput, opts ...request.Option) (*DescribeEndpointsOutput, error) { + req, out := c.DescribeEndpointsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeOrderableReplicationInstances = "DescribeOrderableReplicationInstances" @@ -1142,8 +1368,23 @@ func (c *DatabaseMigrationService) DescribeOrderableReplicationInstancesRequest( // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeOrderableReplicationInstances func (c *DatabaseMigrationService) DescribeOrderableReplicationInstances(input *DescribeOrderableReplicationInstancesInput) (*DescribeOrderableReplicationInstancesOutput, error) { req, out := c.DescribeOrderableReplicationInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeOrderableReplicationInstancesWithContext is the same as DescribeOrderableReplicationInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeOrderableReplicationInstances 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 *DatabaseMigrationService) DescribeOrderableReplicationInstancesWithContext(ctx aws.Context, input *DescribeOrderableReplicationInstancesInput, opts ...request.Option) (*DescribeOrderableReplicationInstancesOutput, error) { + req, out := c.DescribeOrderableReplicationInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeRefreshSchemasStatus = "DescribeRefreshSchemasStatus" @@ -1211,8 +1452,23 @@ func (c *DatabaseMigrationService) DescribeRefreshSchemasStatusRequest(input *De // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeRefreshSchemasStatus func (c *DatabaseMigrationService) DescribeRefreshSchemasStatus(input *DescribeRefreshSchemasStatusInput) (*DescribeRefreshSchemasStatusOutput, error) { req, out := c.DescribeRefreshSchemasStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRefreshSchemasStatusWithContext is the same as DescribeRefreshSchemasStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRefreshSchemasStatus 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 *DatabaseMigrationService) DescribeRefreshSchemasStatusWithContext(ctx aws.Context, input *DescribeRefreshSchemasStatusInput, opts ...request.Option) (*DescribeRefreshSchemasStatusOutput, error) { + req, out := c.DescribeRefreshSchemasStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReplicationInstances = "DescribeReplicationInstances" @@ -1277,8 +1533,23 @@ func (c *DatabaseMigrationService) DescribeReplicationInstancesRequest(input *De // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeReplicationInstances func (c *DatabaseMigrationService) DescribeReplicationInstances(input *DescribeReplicationInstancesInput) (*DescribeReplicationInstancesOutput, error) { req, out := c.DescribeReplicationInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReplicationInstancesWithContext is the same as DescribeReplicationInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReplicationInstances 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 *DatabaseMigrationService) DescribeReplicationInstancesWithContext(ctx aws.Context, input *DescribeReplicationInstancesInput, opts ...request.Option) (*DescribeReplicationInstancesOutput, error) { + req, out := c.DescribeReplicationInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReplicationSubnetGroups = "DescribeReplicationSubnetGroups" @@ -1342,8 +1613,23 @@ func (c *DatabaseMigrationService) DescribeReplicationSubnetGroupsRequest(input // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeReplicationSubnetGroups func (c *DatabaseMigrationService) DescribeReplicationSubnetGroups(input *DescribeReplicationSubnetGroupsInput) (*DescribeReplicationSubnetGroupsOutput, error) { req, out := c.DescribeReplicationSubnetGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReplicationSubnetGroupsWithContext is the same as DescribeReplicationSubnetGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReplicationSubnetGroups 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 *DatabaseMigrationService) DescribeReplicationSubnetGroupsWithContext(ctx aws.Context, input *DescribeReplicationSubnetGroupsInput, opts ...request.Option) (*DescribeReplicationSubnetGroupsOutput, error) { + req, out := c.DescribeReplicationSubnetGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReplicationTasks = "DescribeReplicationTasks" @@ -1408,8 +1694,23 @@ func (c *DatabaseMigrationService) DescribeReplicationTasksRequest(input *Descri // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeReplicationTasks func (c *DatabaseMigrationService) DescribeReplicationTasks(input *DescribeReplicationTasksInput) (*DescribeReplicationTasksOutput, error) { req, out := c.DescribeReplicationTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReplicationTasksWithContext is the same as DescribeReplicationTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReplicationTasks 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 *DatabaseMigrationService) DescribeReplicationTasksWithContext(ctx aws.Context, input *DescribeReplicationTasksInput, opts ...request.Option) (*DescribeReplicationTasksOutput, error) { + req, out := c.DescribeReplicationTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSchemas = "DescribeSchemas" @@ -1477,8 +1778,23 @@ func (c *DatabaseMigrationService) DescribeSchemasRequest(input *DescribeSchemas // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeSchemas func (c *DatabaseMigrationService) DescribeSchemas(input *DescribeSchemasInput) (*DescribeSchemasOutput, error) { req, out := c.DescribeSchemasRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSchemasWithContext is the same as DescribeSchemas with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSchemas 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 *DatabaseMigrationService) DescribeSchemasWithContext(ctx aws.Context, input *DescribeSchemasInput, opts ...request.Option) (*DescribeSchemasOutput, error) { + req, out := c.DescribeSchemasRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTableStatistics = "DescribeTableStatistics" @@ -1547,8 +1863,23 @@ func (c *DatabaseMigrationService) DescribeTableStatisticsRequest(input *Describ // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/DescribeTableStatistics func (c *DatabaseMigrationService) DescribeTableStatistics(input *DescribeTableStatisticsInput) (*DescribeTableStatisticsOutput, error) { req, out := c.DescribeTableStatisticsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTableStatisticsWithContext is the same as DescribeTableStatistics with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTableStatistics 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 *DatabaseMigrationService) DescribeTableStatisticsWithContext(ctx aws.Context, input *DescribeTableStatisticsInput, opts ...request.Option) (*DescribeTableStatisticsOutput, error) { + req, out := c.DescribeTableStatisticsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportCertificate = "ImportCertificate" @@ -1615,8 +1946,23 @@ func (c *DatabaseMigrationService) ImportCertificateRequest(input *ImportCertifi // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ImportCertificate func (c *DatabaseMigrationService) ImportCertificate(input *ImportCertificateInput) (*ImportCertificateOutput, error) { req, out := c.ImportCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportCertificateWithContext is the same as ImportCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See ImportCertificate 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 *DatabaseMigrationService) ImportCertificateWithContext(ctx aws.Context, input *ImportCertificateInput, opts ...request.Option) (*ImportCertificateOutput, error) { + req, out := c.ImportCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResource = "ListTagsForResource" @@ -1680,8 +2026,23 @@ func (c *DatabaseMigrationService) ListTagsForResourceRequest(input *ListTagsFor // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ListTagsForResource func (c *DatabaseMigrationService) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *DatabaseMigrationService) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyEndpoint = "ModifyEndpoint" @@ -1755,8 +2116,23 @@ func (c *DatabaseMigrationService) ModifyEndpointRequest(input *ModifyEndpointIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ModifyEndpoint func (c *DatabaseMigrationService) ModifyEndpoint(input *ModifyEndpointInput) (*ModifyEndpointOutput, error) { req, out := c.ModifyEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyEndpointWithContext is the same as ModifyEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyEndpoint 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 *DatabaseMigrationService) ModifyEndpointWithContext(ctx aws.Context, input *ModifyEndpointInput, opts ...request.Option) (*ModifyEndpointOutput, error) { + req, out := c.ModifyEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyReplicationInstance = "ModifyReplicationInstance" @@ -1840,8 +2216,23 @@ func (c *DatabaseMigrationService) ModifyReplicationInstanceRequest(input *Modif // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ModifyReplicationInstance func (c *DatabaseMigrationService) ModifyReplicationInstance(input *ModifyReplicationInstanceInput) (*ModifyReplicationInstanceOutput, error) { req, out := c.ModifyReplicationInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyReplicationInstanceWithContext is the same as ModifyReplicationInstance with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyReplicationInstance 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 *DatabaseMigrationService) ModifyReplicationInstanceWithContext(ctx aws.Context, input *ModifyReplicationInstanceInput, opts ...request.Option) (*ModifyReplicationInstanceOutput, error) { + req, out := c.ModifyReplicationInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyReplicationSubnetGroup = "ModifyReplicationSubnetGroup" @@ -1921,8 +2312,23 @@ func (c *DatabaseMigrationService) ModifyReplicationSubnetGroupRequest(input *Mo // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ModifyReplicationSubnetGroup func (c *DatabaseMigrationService) ModifyReplicationSubnetGroup(input *ModifyReplicationSubnetGroupInput) (*ModifyReplicationSubnetGroupOutput, error) { req, out := c.ModifyReplicationSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyReplicationSubnetGroupWithContext is the same as ModifyReplicationSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyReplicationSubnetGroup 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 *DatabaseMigrationService) ModifyReplicationSubnetGroupWithContext(ctx aws.Context, input *ModifyReplicationSubnetGroupInput, opts ...request.Option) (*ModifyReplicationSubnetGroupOutput, error) { + req, out := c.ModifyReplicationSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyReplicationTask = "ModifyReplicationTask" @@ -1999,8 +2405,23 @@ func (c *DatabaseMigrationService) ModifyReplicationTaskRequest(input *ModifyRep // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ModifyReplicationTask func (c *DatabaseMigrationService) ModifyReplicationTask(input *ModifyReplicationTaskInput) (*ModifyReplicationTaskOutput, error) { req, out := c.ModifyReplicationTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyReplicationTaskWithContext is the same as ModifyReplicationTask with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyReplicationTask 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 *DatabaseMigrationService) ModifyReplicationTaskWithContext(ctx aws.Context, input *ModifyReplicationTaskInput, opts ...request.Option) (*ModifyReplicationTaskOutput, error) { + req, out := c.ModifyReplicationTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRefreshSchemas = "RefreshSchemas" @@ -2076,8 +2497,23 @@ func (c *DatabaseMigrationService) RefreshSchemasRequest(input *RefreshSchemasIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/RefreshSchemas func (c *DatabaseMigrationService) RefreshSchemas(input *RefreshSchemasInput) (*RefreshSchemasOutput, error) { req, out := c.RefreshSchemasRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RefreshSchemasWithContext is the same as RefreshSchemas with the addition of +// the ability to pass a context and additional request options. +// +// See RefreshSchemas 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 *DatabaseMigrationService) RefreshSchemasWithContext(ctx aws.Context, input *RefreshSchemasInput, opts ...request.Option) (*RefreshSchemasOutput, error) { + req, out := c.RefreshSchemasRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromResource = "RemoveTagsFromResource" @@ -2141,8 +2577,23 @@ func (c *DatabaseMigrationService) RemoveTagsFromResourceRequest(input *RemoveTa // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/RemoveTagsFromResource func (c *DatabaseMigrationService) RemoveTagsFromResource(input *RemoveTagsFromResourceInput) (*RemoveTagsFromResourceOutput, error) { req, out := c.RemoveTagsFromResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromResourceWithContext is the same as RemoveTagsFromResource with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromResource 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 *DatabaseMigrationService) RemoveTagsFromResourceWithContext(ctx aws.Context, input *RemoveTagsFromResourceInput, opts ...request.Option) (*RemoveTagsFromResourceOutput, error) { + req, out := c.RemoveTagsFromResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartReplicationTask = "StartReplicationTask" @@ -2210,8 +2661,23 @@ func (c *DatabaseMigrationService) StartReplicationTaskRequest(input *StartRepli // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/StartReplicationTask func (c *DatabaseMigrationService) StartReplicationTask(input *StartReplicationTaskInput) (*StartReplicationTaskOutput, error) { req, out := c.StartReplicationTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartReplicationTaskWithContext is the same as StartReplicationTask with the addition of +// the ability to pass a context and additional request options. +// +// See StartReplicationTask 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 *DatabaseMigrationService) StartReplicationTaskWithContext(ctx aws.Context, input *StartReplicationTaskInput, opts ...request.Option) (*StartReplicationTaskOutput, error) { + req, out := c.StartReplicationTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopReplicationTask = "StopReplicationTask" @@ -2279,8 +2745,23 @@ func (c *DatabaseMigrationService) StopReplicationTaskRequest(input *StopReplica // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/StopReplicationTask func (c *DatabaseMigrationService) StopReplicationTask(input *StopReplicationTaskInput) (*StopReplicationTaskOutput, error) { req, out := c.StopReplicationTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopReplicationTaskWithContext is the same as StopReplicationTask with the addition of +// the ability to pass a context and additional request options. +// +// See StopReplicationTask 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 *DatabaseMigrationService) StopReplicationTaskWithContext(ctx aws.Context, input *StopReplicationTaskInput, opts ...request.Option) (*StopReplicationTaskOutput, error) { + req, out := c.StopReplicationTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestConnection = "TestConnection" @@ -2354,8 +2835,23 @@ func (c *DatabaseMigrationService) TestConnectionRequest(input *TestConnectionIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/TestConnection func (c *DatabaseMigrationService) TestConnection(input *TestConnectionInput) (*TestConnectionOutput, error) { req, out := c.TestConnectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestConnectionWithContext is the same as TestConnection with the addition of +// the ability to pass a context and additional request options. +// +// See TestConnection 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 *DatabaseMigrationService) TestConnectionWithContext(ctx aws.Context, input *TestConnectionInput, opts ...request.Option) (*TestConnectionOutput, error) { + req, out := c.TestConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Describes a quota for an AWS account, for example, the number of replication diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go index 11d19d7a7e..01d12048af 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package databasemigrationservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/service.go index cbb36fd34e..212f2fc402 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package databasemigrationservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/api.go index 436175a5af..3367557da7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package directoryservice provides a client for AWS Directory Service. package directoryservice @@ -7,6 +7,7 @@ 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" ) @@ -100,8 +101,23 @@ func (c *DirectoryService) AddIpRoutesRequest(input *AddIpRoutesInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/AddIpRoutes func (c *DirectoryService) AddIpRoutes(input *AddIpRoutesInput) (*AddIpRoutesOutput, error) { req, out := c.AddIpRoutesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddIpRoutesWithContext is the same as AddIpRoutes with the addition of +// the ability to pass a context and additional request options. +// +// See AddIpRoutes 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 *DirectoryService) AddIpRoutesWithContext(ctx aws.Context, input *AddIpRoutesInput, opts ...request.Option) (*AddIpRoutesOutput, error) { + req, out := c.AddIpRoutesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddTagsToResource = "AddTagsToResource" @@ -179,8 +195,23 @@ func (c *DirectoryService) AddTagsToResourceRequest(input *AddTagsToResourceInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/AddTagsToResource func (c *DirectoryService) AddTagsToResource(input *AddTagsToResourceInput) (*AddTagsToResourceOutput, error) { req, out := c.AddTagsToResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToResourceWithContext is the same as AddTagsToResource with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToResource 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 *DirectoryService) AddTagsToResourceWithContext(ctx aws.Context, input *AddTagsToResourceInput, opts ...request.Option) (*AddTagsToResourceOutput, error) { + req, out := c.AddTagsToResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelSchemaExtension = "CancelSchemaExtension" @@ -253,8 +284,23 @@ func (c *DirectoryService) CancelSchemaExtensionRequest(input *CancelSchemaExten // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CancelSchemaExtension func (c *DirectoryService) CancelSchemaExtension(input *CancelSchemaExtensionInput) (*CancelSchemaExtensionOutput, error) { req, out := c.CancelSchemaExtensionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelSchemaExtensionWithContext is the same as CancelSchemaExtension with the addition of +// the ability to pass a context and additional request options. +// +// See CancelSchemaExtension 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 *DirectoryService) CancelSchemaExtensionWithContext(ctx aws.Context, input *CancelSchemaExtensionInput, opts ...request.Option) (*CancelSchemaExtensionOutput, error) { + req, out := c.CancelSchemaExtensionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opConnectDirectory = "ConnectDirectory" @@ -334,8 +380,23 @@ func (c *DirectoryService) ConnectDirectoryRequest(input *ConnectDirectoryInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/ConnectDirectory func (c *DirectoryService) ConnectDirectory(input *ConnectDirectoryInput) (*ConnectDirectoryOutput, error) { req, out := c.ConnectDirectoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ConnectDirectoryWithContext is the same as ConnectDirectory with the addition of +// the ability to pass a context and additional request options. +// +// See ConnectDirectory 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 *DirectoryService) ConnectDirectoryWithContext(ctx aws.Context, input *ConnectDirectoryInput, opts ...request.Option) (*ConnectDirectoryOutput, error) { + req, out := c.ConnectDirectoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAlias = "CreateAlias" @@ -416,8 +477,23 @@ func (c *DirectoryService) CreateAliasRequest(input *CreateAliasInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateAlias func (c *DirectoryService) CreateAlias(input *CreateAliasInput) (*CreateAliasOutput, error) { req, out := c.CreateAliasRequest(input) - err := req.Send() - return out, err + 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 *DirectoryService) 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 opCreateComputer = "CreateComputer" @@ -503,8 +579,23 @@ func (c *DirectoryService) CreateComputerRequest(input *CreateComputerInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateComputer func (c *DirectoryService) CreateComputer(input *CreateComputerInput) (*CreateComputerOutput, error) { req, out := c.CreateComputerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateComputerWithContext is the same as CreateComputer with the addition of +// the ability to pass a context and additional request options. +// +// See CreateComputer 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 *DirectoryService) CreateComputerWithContext(ctx aws.Context, input *CreateComputerInput, opts ...request.Option) (*CreateComputerOutput, error) { + req, out := c.CreateComputerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateConditionalForwarder = "CreateConditionalForwarder" @@ -588,8 +679,23 @@ func (c *DirectoryService) CreateConditionalForwarderRequest(input *CreateCondit // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateConditionalForwarder func (c *DirectoryService) CreateConditionalForwarder(input *CreateConditionalForwarderInput) (*CreateConditionalForwarderOutput, error) { req, out := c.CreateConditionalForwarderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateConditionalForwarderWithContext is the same as CreateConditionalForwarder with the addition of +// the ability to pass a context and additional request options. +// +// See CreateConditionalForwarder 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 *DirectoryService) CreateConditionalForwarderWithContext(ctx aws.Context, input *CreateConditionalForwarderInput, opts ...request.Option) (*CreateConditionalForwarderOutput, error) { + req, out := c.CreateConditionalForwarderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDirectory = "CreateDirectory" @@ -669,8 +775,23 @@ func (c *DirectoryService) CreateDirectoryRequest(input *CreateDirectoryInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateDirectory func (c *DirectoryService) CreateDirectory(input *CreateDirectoryInput) (*CreateDirectoryOutput, error) { req, out := c.CreateDirectoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDirectoryWithContext is the same as CreateDirectory with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDirectory 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 *DirectoryService) CreateDirectoryWithContext(ctx aws.Context, input *CreateDirectoryInput, opts ...request.Option) (*CreateDirectoryOutput, error) { + req, out := c.CreateDirectoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateMicrosoftAD = "CreateMicrosoftAD" @@ -753,8 +874,23 @@ func (c *DirectoryService) CreateMicrosoftADRequest(input *CreateMicrosoftADInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateMicrosoftAD func (c *DirectoryService) CreateMicrosoftAD(input *CreateMicrosoftADInput) (*CreateMicrosoftADOutput, error) { req, out := c.CreateMicrosoftADRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateMicrosoftADWithContext is the same as CreateMicrosoftAD with the addition of +// the ability to pass a context and additional request options. +// +// See CreateMicrosoftAD 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 *DirectoryService) CreateMicrosoftADWithContext(ctx aws.Context, input *CreateMicrosoftADInput, opts ...request.Option) (*CreateMicrosoftADOutput, error) { + req, out := c.CreateMicrosoftADRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSnapshot = "CreateSnapshot" @@ -834,8 +970,23 @@ func (c *DirectoryService) CreateSnapshotRequest(input *CreateSnapshotInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateSnapshot func (c *DirectoryService) CreateSnapshot(input *CreateSnapshotInput) (*CreateSnapshotOutput, error) { req, out := c.CreateSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSnapshotWithContext is the same as CreateSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSnapshot 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 *DirectoryService) CreateSnapshotWithContext(ctx aws.Context, input *CreateSnapshotInput, opts ...request.Option) (*CreateSnapshotOutput, error) { + req, out := c.CreateSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTrust = "CreateTrust" @@ -921,8 +1072,23 @@ func (c *DirectoryService) CreateTrustRequest(input *CreateTrustInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/CreateTrust func (c *DirectoryService) CreateTrust(input *CreateTrustInput) (*CreateTrustOutput, error) { req, out := c.CreateTrustRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTrustWithContext is the same as CreateTrust with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrust 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 *DirectoryService) CreateTrustWithContext(ctx aws.Context, input *CreateTrustInput, opts ...request.Option) (*CreateTrustOutput, error) { + req, out := c.CreateTrustRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteConditionalForwarder = "DeleteConditionalForwarder" @@ -1001,8 +1167,23 @@ func (c *DirectoryService) DeleteConditionalForwarderRequest(input *DeleteCondit // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DeleteConditionalForwarder func (c *DirectoryService) DeleteConditionalForwarder(input *DeleteConditionalForwarderInput) (*DeleteConditionalForwarderOutput, error) { req, out := c.DeleteConditionalForwarderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteConditionalForwarderWithContext is the same as DeleteConditionalForwarder with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteConditionalForwarder 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 *DirectoryService) DeleteConditionalForwarderWithContext(ctx aws.Context, input *DeleteConditionalForwarderInput, opts ...request.Option) (*DeleteConditionalForwarderOutput, error) { + req, out := c.DeleteConditionalForwarderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDirectory = "DeleteDirectory" @@ -1077,8 +1258,23 @@ func (c *DirectoryService) DeleteDirectoryRequest(input *DeleteDirectoryInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DeleteDirectory func (c *DirectoryService) DeleteDirectory(input *DeleteDirectoryInput) (*DeleteDirectoryOutput, error) { req, out := c.DeleteDirectoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDirectoryWithContext is the same as DeleteDirectory with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDirectory 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 *DirectoryService) DeleteDirectoryWithContext(ctx aws.Context, input *DeleteDirectoryInput, opts ...request.Option) (*DeleteDirectoryOutput, error) { + req, out := c.DeleteDirectoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSnapshot = "DeleteSnapshot" @@ -1151,8 +1347,23 @@ func (c *DirectoryService) DeleteSnapshotRequest(input *DeleteSnapshotInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DeleteSnapshot func (c *DirectoryService) DeleteSnapshot(input *DeleteSnapshotInput) (*DeleteSnapshotOutput, error) { req, out := c.DeleteSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSnapshotWithContext is the same as DeleteSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSnapshot 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 *DirectoryService) DeleteSnapshotWithContext(ctx aws.Context, input *DeleteSnapshotInput, opts ...request.Option) (*DeleteSnapshotOutput, error) { + req, out := c.DeleteSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTrust = "DeleteTrust" @@ -1229,8 +1440,23 @@ func (c *DirectoryService) DeleteTrustRequest(input *DeleteTrustInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DeleteTrust func (c *DirectoryService) DeleteTrust(input *DeleteTrustInput) (*DeleteTrustOutput, error) { req, out := c.DeleteTrustRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteTrustWithContext is the same as DeleteTrust with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrust 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 *DirectoryService) DeleteTrustWithContext(ctx aws.Context, input *DeleteTrustInput, opts ...request.Option) (*DeleteTrustOutput, error) { + req, out := c.DeleteTrustRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterEventTopic = "DeregisterEventTopic" @@ -1303,8 +1529,23 @@ func (c *DirectoryService) DeregisterEventTopicRequest(input *DeregisterEventTop // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DeregisterEventTopic func (c *DirectoryService) DeregisterEventTopic(input *DeregisterEventTopicInput) (*DeregisterEventTopicOutput, error) { req, out := c.DeregisterEventTopicRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterEventTopicWithContext is the same as DeregisterEventTopic with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterEventTopic 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 *DirectoryService) DeregisterEventTopicWithContext(ctx aws.Context, input *DeregisterEventTopicInput, opts ...request.Option) (*DeregisterEventTopicOutput, error) { + req, out := c.DeregisterEventTopicRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConditionalForwarders = "DescribeConditionalForwarders" @@ -1386,8 +1627,23 @@ func (c *DirectoryService) DescribeConditionalForwardersRequest(input *DescribeC // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DescribeConditionalForwarders func (c *DirectoryService) DescribeConditionalForwarders(input *DescribeConditionalForwardersInput) (*DescribeConditionalForwardersOutput, error) { req, out := c.DescribeConditionalForwardersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConditionalForwardersWithContext is the same as DescribeConditionalForwarders with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConditionalForwarders 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 *DirectoryService) DescribeConditionalForwardersWithContext(ctx aws.Context, input *DescribeConditionalForwardersInput, opts ...request.Option) (*DescribeConditionalForwardersOutput, error) { + req, out := c.DescribeConditionalForwardersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDirectories = "DescribeDirectories" @@ -1474,8 +1730,23 @@ func (c *DirectoryService) DescribeDirectoriesRequest(input *DescribeDirectories // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DescribeDirectories func (c *DirectoryService) DescribeDirectories(input *DescribeDirectoriesInput) (*DescribeDirectoriesOutput, error) { req, out := c.DescribeDirectoriesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDirectoriesWithContext is the same as DescribeDirectories with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDirectories 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 *DirectoryService) DescribeDirectoriesWithContext(ctx aws.Context, input *DescribeDirectoriesInput, opts ...request.Option) (*DescribeDirectoriesOutput, error) { + req, out := c.DescribeDirectoriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEventTopics = "DescribeEventTopics" @@ -1552,8 +1823,23 @@ func (c *DirectoryService) DescribeEventTopicsRequest(input *DescribeEventTopics // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DescribeEventTopics func (c *DirectoryService) DescribeEventTopics(input *DescribeEventTopicsInput) (*DescribeEventTopicsOutput, error) { req, out := c.DescribeEventTopicsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventTopicsWithContext is the same as DescribeEventTopics with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEventTopics 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 *DirectoryService) DescribeEventTopicsWithContext(ctx aws.Context, input *DescribeEventTopicsInput, opts ...request.Option) (*DescribeEventTopicsOutput, error) { + req, out := c.DescribeEventTopicsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSnapshots = "DescribeSnapshots" @@ -1636,8 +1922,23 @@ func (c *DirectoryService) DescribeSnapshotsRequest(input *DescribeSnapshotsInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DescribeSnapshots func (c *DirectoryService) DescribeSnapshots(input *DescribeSnapshotsInput) (*DescribeSnapshotsOutput, error) { req, out := c.DescribeSnapshotsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSnapshotsWithContext is the same as DescribeSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSnapshots 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 *DirectoryService) DescribeSnapshotsWithContext(ctx aws.Context, input *DescribeSnapshotsInput, opts ...request.Option) (*DescribeSnapshotsOutput, error) { + req, out := c.DescribeSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTrusts = "DescribeTrusts" @@ -1719,8 +2020,23 @@ func (c *DirectoryService) DescribeTrustsRequest(input *DescribeTrustsInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DescribeTrusts func (c *DirectoryService) DescribeTrusts(input *DescribeTrustsInput) (*DescribeTrustsOutput, error) { req, out := c.DescribeTrustsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTrustsWithContext is the same as DescribeTrusts with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTrusts 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 *DirectoryService) DescribeTrustsWithContext(ctx aws.Context, input *DescribeTrustsInput, opts ...request.Option) (*DescribeTrustsOutput, error) { + req, out := c.DescribeTrustsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableRadius = "DisableRadius" @@ -1791,8 +2107,23 @@ func (c *DirectoryService) DisableRadiusRequest(input *DisableRadiusInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DisableRadius func (c *DirectoryService) DisableRadius(input *DisableRadiusInput) (*DisableRadiusOutput, error) { req, out := c.DisableRadiusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableRadiusWithContext is the same as DisableRadius with the addition of +// the ability to pass a context and additional request options. +// +// See DisableRadius 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 *DirectoryService) DisableRadiusWithContext(ctx aws.Context, input *DisableRadiusInput, opts ...request.Option) (*DisableRadiusOutput, error) { + req, out := c.DisableRadiusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableSso = "DisableSso" @@ -1868,8 +2199,23 @@ func (c *DirectoryService) DisableSsoRequest(input *DisableSsoInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/DisableSso func (c *DirectoryService) DisableSso(input *DisableSsoInput) (*DisableSsoOutput, error) { req, out := c.DisableSsoRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableSsoWithContext is the same as DisableSso with the addition of +// the ability to pass a context and additional request options. +// +// See DisableSso 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 *DirectoryService) DisableSsoWithContext(ctx aws.Context, input *DisableSsoInput, opts ...request.Option) (*DisableSsoOutput, error) { + req, out := c.DisableSsoRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableRadius = "EnableRadius" @@ -1946,8 +2292,23 @@ func (c *DirectoryService) EnableRadiusRequest(input *EnableRadiusInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/EnableRadius func (c *DirectoryService) EnableRadius(input *EnableRadiusInput) (*EnableRadiusOutput, error) { req, out := c.EnableRadiusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableRadiusWithContext is the same as EnableRadius with the addition of +// the ability to pass a context and additional request options. +// +// See EnableRadius 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 *DirectoryService) EnableRadiusWithContext(ctx aws.Context, input *EnableRadiusInput, opts ...request.Option) (*EnableRadiusOutput, error) { + req, out := c.EnableRadiusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableSso = "EnableSso" @@ -2023,8 +2384,23 @@ func (c *DirectoryService) EnableSsoRequest(input *EnableSsoInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/EnableSso func (c *DirectoryService) EnableSso(input *EnableSsoInput) (*EnableSsoOutput, error) { req, out := c.EnableSsoRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableSsoWithContext is the same as EnableSso with the addition of +// the ability to pass a context and additional request options. +// +// See EnableSso 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 *DirectoryService) EnableSsoWithContext(ctx aws.Context, input *EnableSsoInput, opts ...request.Option) (*EnableSsoOutput, error) { + req, out := c.EnableSsoRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDirectoryLimits = "GetDirectoryLimits" @@ -2094,8 +2470,23 @@ func (c *DirectoryService) GetDirectoryLimitsRequest(input *GetDirectoryLimitsIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/GetDirectoryLimits func (c *DirectoryService) GetDirectoryLimits(input *GetDirectoryLimitsInput) (*GetDirectoryLimitsOutput, error) { req, out := c.GetDirectoryLimitsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDirectoryLimitsWithContext is the same as GetDirectoryLimits with the addition of +// the ability to pass a context and additional request options. +// +// See GetDirectoryLimits 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 *DirectoryService) GetDirectoryLimitsWithContext(ctx aws.Context, input *GetDirectoryLimitsInput, opts ...request.Option) (*GetDirectoryLimitsOutput, error) { + req, out := c.GetDirectoryLimitsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSnapshotLimits = "GetSnapshotLimits" @@ -2165,8 +2556,23 @@ func (c *DirectoryService) GetSnapshotLimitsRequest(input *GetSnapshotLimitsInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/GetSnapshotLimits func (c *DirectoryService) GetSnapshotLimits(input *GetSnapshotLimitsInput) (*GetSnapshotLimitsOutput, error) { req, out := c.GetSnapshotLimitsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSnapshotLimitsWithContext is the same as GetSnapshotLimits with the addition of +// the ability to pass a context and additional request options. +// +// See GetSnapshotLimits 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 *DirectoryService) GetSnapshotLimitsWithContext(ctx aws.Context, input *GetSnapshotLimitsInput, opts ...request.Option) (*GetSnapshotLimitsOutput, error) { + req, out := c.GetSnapshotLimitsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListIpRoutes = "ListIpRoutes" @@ -2242,8 +2648,23 @@ func (c *DirectoryService) ListIpRoutesRequest(input *ListIpRoutesInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/ListIpRoutes func (c *DirectoryService) ListIpRoutes(input *ListIpRoutesInput) (*ListIpRoutesOutput, error) { req, out := c.ListIpRoutesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListIpRoutesWithContext is the same as ListIpRoutes with the addition of +// the ability to pass a context and additional request options. +// +// See ListIpRoutes 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 *DirectoryService) ListIpRoutesWithContext(ctx aws.Context, input *ListIpRoutesInput, opts ...request.Option) (*ListIpRoutesOutput, error) { + req, out := c.ListIpRoutesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListSchemaExtensions = "ListSchemaExtensions" @@ -2316,8 +2737,23 @@ func (c *DirectoryService) ListSchemaExtensionsRequest(input *ListSchemaExtensio // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/ListSchemaExtensions func (c *DirectoryService) ListSchemaExtensions(input *ListSchemaExtensionsInput) (*ListSchemaExtensionsOutput, error) { req, out := c.ListSchemaExtensionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSchemaExtensionsWithContext is the same as ListSchemaExtensions with the addition of +// the ability to pass a context and additional request options. +// +// See ListSchemaExtensions 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 *DirectoryService) ListSchemaExtensionsWithContext(ctx aws.Context, input *ListSchemaExtensionsInput, opts ...request.Option) (*ListSchemaExtensionsOutput, error) { + req, out := c.ListSchemaExtensionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResource = "ListTagsForResource" @@ -2393,8 +2829,23 @@ func (c *DirectoryService) ListTagsForResourceRequest(input *ListTagsForResource // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/ListTagsForResource func (c *DirectoryService) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *DirectoryService) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterEventTopic = "RegisterEventTopic" @@ -2472,8 +2923,23 @@ func (c *DirectoryService) RegisterEventTopicRequest(input *RegisterEventTopicIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/RegisterEventTopic func (c *DirectoryService) RegisterEventTopic(input *RegisterEventTopicInput) (*RegisterEventTopicOutput, error) { req, out := c.RegisterEventTopicRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterEventTopicWithContext is the same as RegisterEventTopic with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterEventTopic 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 *DirectoryService) RegisterEventTopicWithContext(ctx aws.Context, input *RegisterEventTopicInput, opts ...request.Option) (*RegisterEventTopicOutput, error) { + req, out := c.RegisterEventTopicRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveIpRoutes = "RemoveIpRoutes" @@ -2549,8 +3015,23 @@ func (c *DirectoryService) RemoveIpRoutesRequest(input *RemoveIpRoutesInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/RemoveIpRoutes func (c *DirectoryService) RemoveIpRoutes(input *RemoveIpRoutesInput) (*RemoveIpRoutesOutput, error) { req, out := c.RemoveIpRoutesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveIpRoutesWithContext is the same as RemoveIpRoutes with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveIpRoutes 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 *DirectoryService) RemoveIpRoutesWithContext(ctx aws.Context, input *RemoveIpRoutesInput, opts ...request.Option) (*RemoveIpRoutesOutput, error) { + req, out := c.RemoveIpRoutesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromResource = "RemoveTagsFromResource" @@ -2623,8 +3104,23 @@ func (c *DirectoryService) RemoveTagsFromResourceRequest(input *RemoveTagsFromRe // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/RemoveTagsFromResource func (c *DirectoryService) RemoveTagsFromResource(input *RemoveTagsFromResourceInput) (*RemoveTagsFromResourceOutput, error) { req, out := c.RemoveTagsFromResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromResourceWithContext is the same as RemoveTagsFromResource with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromResource 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 *DirectoryService) RemoveTagsFromResourceWithContext(ctx aws.Context, input *RemoveTagsFromResourceInput, opts ...request.Option) (*RemoveTagsFromResourceOutput, error) { + req, out := c.RemoveTagsFromResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreFromSnapshot = "RestoreFromSnapshot" @@ -2705,8 +3201,23 @@ func (c *DirectoryService) RestoreFromSnapshotRequest(input *RestoreFromSnapshot // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/RestoreFromSnapshot func (c *DirectoryService) RestoreFromSnapshot(input *RestoreFromSnapshotInput) (*RestoreFromSnapshotOutput, error) { req, out := c.RestoreFromSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreFromSnapshotWithContext is the same as RestoreFromSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreFromSnapshot 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 *DirectoryService) RestoreFromSnapshotWithContext(ctx aws.Context, input *RestoreFromSnapshotInput, opts ...request.Option) (*RestoreFromSnapshotOutput, error) { + req, out := c.RestoreFromSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartSchemaExtension = "StartSchemaExtension" @@ -2787,8 +3298,23 @@ func (c *DirectoryService) StartSchemaExtensionRequest(input *StartSchemaExtensi // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/StartSchemaExtension func (c *DirectoryService) StartSchemaExtension(input *StartSchemaExtensionInput) (*StartSchemaExtensionOutput, error) { req, out := c.StartSchemaExtensionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartSchemaExtensionWithContext is the same as StartSchemaExtension with the addition of +// the ability to pass a context and additional request options. +// +// See StartSchemaExtension 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 *DirectoryService) StartSchemaExtensionWithContext(ctx aws.Context, input *StartSchemaExtensionInput, opts ...request.Option) (*StartSchemaExtensionOutput, error) { + req, out := c.StartSchemaExtensionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateConditionalForwarder = "UpdateConditionalForwarder" @@ -2867,8 +3393,23 @@ func (c *DirectoryService) UpdateConditionalForwarderRequest(input *UpdateCondit // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/UpdateConditionalForwarder func (c *DirectoryService) UpdateConditionalForwarder(input *UpdateConditionalForwarderInput) (*UpdateConditionalForwarderOutput, error) { req, out := c.UpdateConditionalForwarderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateConditionalForwarderWithContext is the same as UpdateConditionalForwarder with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateConditionalForwarder 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 *DirectoryService) UpdateConditionalForwarderWithContext(ctx aws.Context, input *UpdateConditionalForwarderInput, opts ...request.Option) (*UpdateConditionalForwarderOutput, error) { + req, out := c.UpdateConditionalForwarderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateRadius = "UpdateRadius" @@ -2942,8 +3483,23 @@ func (c *DirectoryService) UpdateRadiusRequest(input *UpdateRadiusInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/UpdateRadius func (c *DirectoryService) UpdateRadius(input *UpdateRadiusInput) (*UpdateRadiusOutput, error) { req, out := c.UpdateRadiusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateRadiusWithContext is the same as UpdateRadius with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRadius 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 *DirectoryService) UpdateRadiusWithContext(ctx aws.Context, input *UpdateRadiusInput, opts ...request.Option) (*UpdateRadiusOutput, error) { + req, out := c.UpdateRadiusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opVerifyTrust = "VerifyTrust" @@ -3023,8 +3579,23 @@ func (c *DirectoryService) VerifyTrustRequest(input *VerifyTrustInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/VerifyTrust func (c *DirectoryService) VerifyTrust(input *VerifyTrustInput) (*VerifyTrustOutput, error) { req, out := c.VerifyTrustRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// VerifyTrustWithContext is the same as VerifyTrust with the addition of +// the ability to pass a context and additional request options. +// +// See VerifyTrust 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 *DirectoryService) VerifyTrustWithContext(ctx aws.Context, input *VerifyTrustInput, opts ...request.Option) (*VerifyTrustOutput, error) { + req, out := c.VerifyTrustRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/ds-2015-04-16/AddIpRoutesRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/errors.go index d8d9fa52ac..64ba6fd0a2 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package directoryservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/service.go index 950ed3befb..ba14d2cf0d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/directoryservice/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package directoryservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go index b43a399be1..95b35ba4f8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package dynamodb provides a client for Amazon DynamoDB. package dynamodb @@ -7,6 +7,7 @@ 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" @@ -140,8 +141,23 @@ func (c *DynamoDB) BatchGetItemRequest(input *BatchGetItemInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/BatchGetItem func (c *DynamoDB) BatchGetItem(input *BatchGetItemInput) (*BatchGetItemOutput, error) { req, out := c.BatchGetItemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetItemWithContext is the same as BatchGetItem with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetItem 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 *DynamoDB) BatchGetItemWithContext(ctx aws.Context, input *BatchGetItemInput, opts ...request.Option) (*BatchGetItemOutput, error) { + req, out := c.BatchGetItemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // BatchGetItemPages iterates over the pages of a BatchGetItem operation, @@ -161,12 +177,37 @@ func (c *DynamoDB) BatchGetItem(input *BatchGetItemInput) (*BatchGetItemOutput, // return pageNum <= 3 // }) // -func (c *DynamoDB) BatchGetItemPages(input *BatchGetItemInput, fn func(p *BatchGetItemOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.BatchGetItemRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*BatchGetItemOutput), lastPage) - }) +func (c *DynamoDB) BatchGetItemPages(input *BatchGetItemInput, fn func(*BatchGetItemOutput, bool) bool) error { + return c.BatchGetItemPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// BatchGetItemPagesWithContext same as BatchGetItemPages 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 *DynamoDB) BatchGetItemPagesWithContext(ctx aws.Context, input *BatchGetItemInput, fn func(*BatchGetItemOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *BatchGetItemInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.BatchGetItemRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*BatchGetItemOutput), !p.HasNextPage()) + } + return p.Err() } const opBatchWriteItem = "BatchWriteItem" @@ -314,8 +355,23 @@ func (c *DynamoDB) BatchWriteItemRequest(input *BatchWriteItemInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/BatchWriteItem func (c *DynamoDB) BatchWriteItem(input *BatchWriteItemInput) (*BatchWriteItemOutput, error) { req, out := c.BatchWriteItemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchWriteItemWithContext is the same as BatchWriteItem with the addition of +// the ability to pass a context and additional request options. +// +// See BatchWriteItem 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 *DynamoDB) BatchWriteItemWithContext(ctx aws.Context, input *BatchWriteItemInput, opts ...request.Option) (*BatchWriteItemOutput, error) { + req, out := c.BatchWriteItemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTable = "CreateTable" @@ -408,8 +464,23 @@ func (c *DynamoDB) CreateTableRequest(input *CreateTableInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/CreateTable func (c *DynamoDB) CreateTable(input *CreateTableInput) (*CreateTableOutput, error) { req, out := c.CreateTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTableWithContext is the same as CreateTable with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTable 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 *DynamoDB) CreateTableWithContext(ctx aws.Context, input *CreateTableInput, opts ...request.Option) (*CreateTableOutput, error) { + req, out := c.CreateTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteItem = "DeleteItem" @@ -505,8 +576,23 @@ func (c *DynamoDB) DeleteItemRequest(input *DeleteItemInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DeleteItem func (c *DynamoDB) DeleteItem(input *DeleteItemInput) (*DeleteItemOutput, error) { req, out := c.DeleteItemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteItemWithContext is the same as DeleteItem with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteItem 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 *DynamoDB) DeleteItemWithContext(ctx aws.Context, input *DeleteItemInput, opts ...request.Option) (*DeleteItemOutput, error) { + req, out := c.DeleteItemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTable = "DeleteTable" @@ -606,8 +692,23 @@ func (c *DynamoDB) DeleteTableRequest(input *DeleteTableInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DeleteTable func (c *DynamoDB) DeleteTable(input *DeleteTableInput) (*DeleteTableOutput, error) { req, out := c.DeleteTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteTableWithContext is the same as DeleteTable with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTable 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 *DynamoDB) DeleteTableWithContext(ctx aws.Context, input *DeleteTableInput, opts ...request.Option) (*DeleteTableOutput, error) { + req, out := c.DeleteTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeLimits = "DescribeLimits" @@ -727,8 +828,23 @@ func (c *DynamoDB) DescribeLimitsRequest(input *DescribeLimitsInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DescribeLimits func (c *DynamoDB) DescribeLimits(input *DescribeLimitsInput) (*DescribeLimitsOutput, error) { req, out := c.DescribeLimitsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeLimitsWithContext is the same as DescribeLimits with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLimits 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 *DynamoDB) DescribeLimitsWithContext(ctx aws.Context, input *DescribeLimitsInput, opts ...request.Option) (*DescribeLimitsOutput, error) { + req, out := c.DescribeLimitsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTable = "DescribeTable" @@ -804,8 +920,107 @@ func (c *DynamoDB) DescribeTableRequest(input *DescribeTableInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DescribeTable func (c *DynamoDB) DescribeTable(input *DescribeTableInput) (*DescribeTableOutput, error) { req, out := c.DescribeTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTableWithContext is the same as DescribeTable with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTable 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 *DynamoDB) DescribeTableWithContext(ctx aws.Context, input *DescribeTableInput, opts ...request.Option) (*DescribeTableOutput, error) { + req, out := c.DescribeTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeTimeToLive = "DescribeTimeToLive" + +// DescribeTimeToLiveRequest generates a "aws/request.Request" representing the +// client's request for the DescribeTimeToLive operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DescribeTimeToLive for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeTimeToLive method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeTimeToLiveRequest method. +// req, resp := client.DescribeTimeToLiveRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DescribeTimeToLive +func (c *DynamoDB) DescribeTimeToLiveRequest(input *DescribeTimeToLiveInput) (req *request.Request, output *DescribeTimeToLiveOutput) { + op := &request.Operation{ + Name: opDescribeTimeToLive, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeTimeToLiveInput{} + } + + output = &DescribeTimeToLiveOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeTimeToLive API operation for Amazon DynamoDB. +// +// Gives a description of the Time to Live (TTL) status on the specified table. +// +// 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 Amazon DynamoDB's +// API operation DescribeTimeToLive for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The operation tried to access a nonexistent table or index. The resource +// might not be specified correctly, or its status might not be ACTIVE. +// +// * ErrCodeInternalServerError "InternalServerError" +// An error occurred on the server side. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DescribeTimeToLive +func (c *DynamoDB) DescribeTimeToLive(input *DescribeTimeToLiveInput) (*DescribeTimeToLiveOutput, error) { + req, out := c.DescribeTimeToLiveRequest(input) + return out, req.Send() +} + +// DescribeTimeToLiveWithContext is the same as DescribeTimeToLive with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTimeToLive 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 *DynamoDB) DescribeTimeToLiveWithContext(ctx aws.Context, input *DescribeTimeToLiveInput, opts ...request.Option) (*DescribeTimeToLiveOutput, error) { + req, out := c.DescribeTimeToLiveRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetItem = "GetItem" @@ -888,8 +1103,23 @@ func (c *DynamoDB) GetItemRequest(input *GetItemInput) (req *request.Request, ou // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/GetItem func (c *DynamoDB) GetItem(input *GetItemInput) (*GetItemOutput, error) { req, out := c.GetItemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetItemWithContext is the same as GetItem with the addition of +// the ability to pass a context and additional request options. +// +// See GetItem 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 *DynamoDB) GetItemWithContext(ctx aws.Context, input *GetItemInput, opts ...request.Option) (*GetItemOutput, error) { + req, out := c.GetItemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTables = "ListTables" @@ -961,8 +1191,23 @@ func (c *DynamoDB) ListTablesRequest(input *ListTablesInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/ListTables func (c *DynamoDB) ListTables(input *ListTablesInput) (*ListTablesOutput, error) { req, out := c.ListTablesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTablesWithContext is the same as ListTables with the addition of +// the ability to pass a context and additional request options. +// +// See ListTables 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 *DynamoDB) ListTablesWithContext(ctx aws.Context, input *ListTablesInput, opts ...request.Option) (*ListTablesOutput, error) { + req, out := c.ListTablesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListTablesPages iterates over the pages of a ListTables operation, @@ -982,12 +1227,37 @@ func (c *DynamoDB) ListTables(input *ListTablesInput) (*ListTablesOutput, error) // return pageNum <= 3 // }) // -func (c *DynamoDB) ListTablesPages(input *ListTablesInput, fn func(p *ListTablesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListTablesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListTablesOutput), lastPage) - }) +func (c *DynamoDB) ListTablesPages(input *ListTablesInput, fn func(*ListTablesOutput, bool) bool) error { + return c.ListTablesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListTablesPagesWithContext same as ListTablesPages 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 *DynamoDB) ListTablesPagesWithContext(ctx aws.Context, input *ListTablesInput, fn func(*ListTablesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListTablesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListTablesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListTablesOutput), !p.HasNextPage()) + } + return p.Err() } const opListTagsOfResource = "ListTagsOfResource" @@ -1059,8 +1329,23 @@ func (c *DynamoDB) ListTagsOfResourceRequest(input *ListTagsOfResourceInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/ListTagsOfResource func (c *DynamoDB) ListTagsOfResource(input *ListTagsOfResourceInput) (*ListTagsOfResourceOutput, error) { req, out := c.ListTagsOfResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsOfResourceWithContext is the same as ListTagsOfResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsOfResource 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 *DynamoDB) ListTagsOfResourceWithContext(ctx aws.Context, input *ListTagsOfResourceInput, opts ...request.Option) (*ListTagsOfResourceOutput, error) { + req, out := c.ListTagsOfResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutItem = "PutItem" @@ -1165,8 +1450,23 @@ func (c *DynamoDB) PutItemRequest(input *PutItemInput) (req *request.Request, ou // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/PutItem func (c *DynamoDB) PutItem(input *PutItemInput) (*PutItemOutput, error) { req, out := c.PutItemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutItemWithContext is the same as PutItem with the addition of +// the ability to pass a context and additional request options. +// +// See PutItem 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 *DynamoDB) PutItemWithContext(ctx aws.Context, input *PutItemInput, opts ...request.Option) (*PutItemOutput, error) { + req, out := c.PutItemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opQuery = "Query" @@ -1273,8 +1573,23 @@ func (c *DynamoDB) QueryRequest(input *QueryInput) (req *request.Request, output // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/Query func (c *DynamoDB) Query(input *QueryInput) (*QueryOutput, error) { req, out := c.QueryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// QueryWithContext is the same as Query with the addition of +// the ability to pass a context and additional request options. +// +// See Query 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 *DynamoDB) QueryWithContext(ctx aws.Context, input *QueryInput, opts ...request.Option) (*QueryOutput, error) { + req, out := c.QueryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // QueryPages iterates over the pages of a Query operation, @@ -1294,12 +1609,37 @@ func (c *DynamoDB) Query(input *QueryInput) (*QueryOutput, error) { // return pageNum <= 3 // }) // -func (c *DynamoDB) QueryPages(input *QueryInput, fn func(p *QueryOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.QueryRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*QueryOutput), lastPage) - }) +func (c *DynamoDB) QueryPages(input *QueryInput, fn func(*QueryOutput, bool) bool) error { + return c.QueryPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// QueryPagesWithContext same as QueryPages 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 *DynamoDB) QueryPagesWithContext(ctx aws.Context, input *QueryInput, fn func(*QueryOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *QueryInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.QueryRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*QueryOutput), !p.HasNextPage()) + } + return p.Err() } const opScan = "Scan" @@ -1401,8 +1741,23 @@ func (c *DynamoDB) ScanRequest(input *ScanInput) (req *request.Request, output * // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/Scan func (c *DynamoDB) Scan(input *ScanInput) (*ScanOutput, error) { req, out := c.ScanRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ScanWithContext is the same as Scan with the addition of +// the ability to pass a context and additional request options. +// +// See Scan 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 *DynamoDB) ScanWithContext(ctx aws.Context, input *ScanInput, opts ...request.Option) (*ScanOutput, error) { + req, out := c.ScanRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ScanPages iterates over the pages of a Scan operation, @@ -1422,12 +1777,37 @@ func (c *DynamoDB) Scan(input *ScanInput) (*ScanOutput, error) { // return pageNum <= 3 // }) // -func (c *DynamoDB) ScanPages(input *ScanInput, fn func(p *ScanOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ScanRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ScanOutput), lastPage) - }) +func (c *DynamoDB) ScanPages(input *ScanInput, fn func(*ScanOutput, bool) bool) error { + return c.ScanPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ScanPagesWithContext same as ScanPages 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 *DynamoDB) ScanPagesWithContext(ctx aws.Context, input *ScanInput, fn func(*ScanOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ScanInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ScanRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ScanOutput), !p.HasNextPage()) + } + return p.Err() } const opTagResource = "TagResource" @@ -1518,8 +1898,23 @@ func (c *DynamoDB) TagResourceRequest(input *TagResourceInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/TagResource func (c *DynamoDB) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { req, out := c.TagResourceRequest(input) - err := req.Send() - return out, err + 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 *DynamoDB) 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" @@ -1608,8 +2003,23 @@ func (c *DynamoDB) UntagResourceRequest(input *UntagResourceInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UntagResource func (c *DynamoDB) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { req, out := c.UntagResourceRequest(input) - err := req.Send() - return out, err + 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 *DynamoDB) 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 opUpdateItem = "UpdateItem" @@ -1699,8 +2109,23 @@ func (c *DynamoDB) UpdateItemRequest(input *UpdateItemInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UpdateItem func (c *DynamoDB) UpdateItem(input *UpdateItemInput) (*UpdateItemOutput, error) { req, out := c.UpdateItemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateItemWithContext is the same as UpdateItem with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateItem 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 *DynamoDB) UpdateItemWithContext(ctx aws.Context, input *UpdateItemInput, opts ...request.Option) (*UpdateItemOutput, error) { + req, out := c.UpdateItemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateTable = "UpdateTable" @@ -1800,8 +2225,149 @@ func (c *DynamoDB) UpdateTableRequest(input *UpdateTableInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UpdateTable func (c *DynamoDB) UpdateTable(input *UpdateTableInput) (*UpdateTableOutput, error) { req, out := c.UpdateTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateTableWithContext is the same as UpdateTable with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateTable 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 *DynamoDB) UpdateTableWithContext(ctx aws.Context, input *UpdateTableInput, opts ...request.Option) (*UpdateTableOutput, error) { + req, out := c.UpdateTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateTimeToLive = "UpdateTimeToLive" + +// UpdateTimeToLiveRequest generates a "aws/request.Request" representing the +// client's request for the UpdateTimeToLive operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See UpdateTimeToLive for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UpdateTimeToLive method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the UpdateTimeToLiveRequest method. +// req, resp := client.UpdateTimeToLiveRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UpdateTimeToLive +func (c *DynamoDB) UpdateTimeToLiveRequest(input *UpdateTimeToLiveInput) (req *request.Request, output *UpdateTimeToLiveOutput) { + op := &request.Operation{ + Name: opUpdateTimeToLive, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateTimeToLiveInput{} + } + + output = &UpdateTimeToLiveOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateTimeToLive API operation for Amazon DynamoDB. +// +// Specify the lifetime of individual table items. The database automatically +// removes the item at the expiration of the item. The UpdateTimeToLive method +// will enable or disable TTL for the specified table. A successful UpdateTimeToLive +// call returns the current TimeToLiveSpecification; it may take up to one hour +// for the change to fully process. +// +// TTL compares the current time in epoch time format to the time stored in +// the TTL attribute of an item. If the epoch time value stored in the attribute +// is less than the current time, the item is marked as expired and subsequently +// deleted. +// +// The epoch time format is the number of seconds elapsed since 12:00:00 AM +// January 1st, 1970 UTC. +// +// DynamoDB deletes expired items on a best-effort basis to ensure availability +// of throughput for other data operations. +// +// DynamoDB typically deletes expired items within two days of expiration. The +// exact duration within which an item gets deleted after expiration is specific +// to the nature of the workload. Items that have expired and not been deleted +// will still show up in reads, queries, and scans. +// +// As items are deleted, they are removed from any Local Secondary Index and +// Global Secondary Index immediately in the same eventually consistent way +// as a standard delete operation. +// +// For more information, see Time To Live (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html) +// in the Amazon DynamoDB Developer 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 Amazon DynamoDB's +// API operation UpdateTimeToLive for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceInUseException "ResourceInUseException" +// The operation conflicts with the resource's availability. For example, you +// attempted to recreate an existing table, or tried to delete a table currently +// in the CREATING state. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The operation tried to access a nonexistent table or index. The resource +// might not be specified correctly, or its status might not be ACTIVE. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// The number of concurrent table requests (cumulative number of tables in the +// CREATING, DELETING or UPDATING state) exceeds the maximum allowed of 10. +// +// Also, for tables with secondary indexes, only one of those tables can be +// in the CREATING state at any point in time. Do not attempt to create more +// than one such table simultaneously. +// +// The total limit of tables in the ACTIVE state is 250. +// +// * ErrCodeInternalServerError "InternalServerError" +// An error occurred on the server side. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UpdateTimeToLive +func (c *DynamoDB) UpdateTimeToLive(input *UpdateTimeToLiveInput) (*UpdateTimeToLiveOutput, error) { + req, out := c.UpdateTimeToLiveRequest(input) + return out, req.Send() +} + +// UpdateTimeToLiveWithContext is the same as UpdateTimeToLive with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateTimeToLive 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 *DynamoDB) UpdateTimeToLiveWithContext(ctx aws.Context, input *UpdateTimeToLiveInput, opts ...request.Option) (*UpdateTimeToLiveOutput, error) { + req, out := c.UpdateTimeToLiveRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents an attribute for describing the key schema for the table and indexes. @@ -3207,7 +3773,7 @@ type DeleteItemInput struct { // // These function names are case-sensitive. // - // * Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN + // * Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN // // * Logical operators: AND | OR | NOT // @@ -3733,6 +4299,71 @@ func (s *DescribeTableOutput) SetTable(v *TableDescription) *DescribeTableOutput return s } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DescribeTimeToLiveInput +type DescribeTimeToLiveInput struct { + _ struct{} `type:"structure"` + + // The name of the table to be described. + // + // TableName is a required field + TableName *string `min:"3" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeTimeToLiveInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTimeToLiveInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeTimeToLiveInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeTimeToLiveInput"} + if s.TableName == nil { + invalidParams.Add(request.NewErrParamRequired("TableName")) + } + if s.TableName != nil && len(*s.TableName) < 3 { + invalidParams.Add(request.NewErrParamMinLen("TableName", 3)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetTableName sets the TableName field's value. +func (s *DescribeTimeToLiveInput) SetTableName(v string) *DescribeTimeToLiveInput { + s.TableName = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/DescribeTimeToLiveOutput +type DescribeTimeToLiveOutput struct { + _ struct{} `type:"structure"` + + TimeToLiveDescription *TimeToLiveDescription `type:"structure"` +} + +// String returns the string representation +func (s DescribeTimeToLiveOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeTimeToLiveOutput) GoString() string { + return s.String() +} + +// SetTimeToLiveDescription sets the TimeToLiveDescription field's value. +func (s *DescribeTimeToLiveOutput) SetTimeToLiveDescription(v *TimeToLiveDescription) *DescribeTimeToLiveOutput { + s.TimeToLiveDescription = v + return s +} + // Represents a condition to be compared with an attribute value. This condition // can be used with DeleteItem, PutItem or UpdateItem operations; if the comparison // evaluates to true, the operation succeeds; if not, the operation fails. You @@ -5308,7 +5939,7 @@ type PutItemInput struct { // // These function names are case-sensitive. // - // * Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN + // * Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN // // * Logical operators: AND | OR | NOT // @@ -7151,6 +7782,100 @@ func (s TagResourceOutput) GoString() string { return s.String() } +// The description of the Time to Live (TTL) status on the specified table. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/TimeToLiveDescription +type TimeToLiveDescription struct { + _ struct{} `type:"structure"` + + // The name of the Time to Live attribute for items in the table. + AttributeName *string `min:"1" type:"string"` + + // The Time to Live status for the table. + TimeToLiveStatus *string `type:"string" enum:"TimeToLiveStatus"` +} + +// String returns the string representation +func (s TimeToLiveDescription) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TimeToLiveDescription) GoString() string { + return s.String() +} + +// SetAttributeName sets the AttributeName field's value. +func (s *TimeToLiveDescription) SetAttributeName(v string) *TimeToLiveDescription { + s.AttributeName = &v + return s +} + +// SetTimeToLiveStatus sets the TimeToLiveStatus field's value. +func (s *TimeToLiveDescription) SetTimeToLiveStatus(v string) *TimeToLiveDescription { + s.TimeToLiveStatus = &v + return s +} + +// Represents the settings used to enable or disable Time to Live for the specified +// table. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/TimeToLiveSpecification +type TimeToLiveSpecification struct { + _ struct{} `type:"structure"` + + // The name of the Time to Live attribute used to store the expiration time + // for items in the table. + // + // AttributeName is a required field + AttributeName *string `min:"1" type:"string" required:"true"` + + // Indicates whether Time To Live is to be enabled (true) or disabled (false) + // on the table. + // + // Enabled is a required field + Enabled *bool `type:"boolean" required:"true"` +} + +// String returns the string representation +func (s TimeToLiveSpecification) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TimeToLiveSpecification) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TimeToLiveSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TimeToLiveSpecification"} + if s.AttributeName == nil { + invalidParams.Add(request.NewErrParamRequired("AttributeName")) + } + if s.AttributeName != nil && len(*s.AttributeName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AttributeName", 1)) + } + if s.Enabled == nil { + invalidParams.Add(request.NewErrParamRequired("Enabled")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAttributeName sets the AttributeName field's value. +func (s *TimeToLiveSpecification) SetAttributeName(v string) *TimeToLiveSpecification { + s.AttributeName = &v + return s +} + +// SetEnabled sets the Enabled field's value. +func (s *TimeToLiveSpecification) SetEnabled(v bool) *TimeToLiveSpecification { + s.Enabled = &v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UntagResourceInput type UntagResourceInput struct { _ struct{} `type:"structure"` @@ -7311,7 +8036,7 @@ type UpdateItemInput struct { // // These function names are case-sensitive. // - // * Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN + // * Comparison operators: = | <> | < | > | <= | >= | BETWEEN | IN // // * Logical operators: AND | OR | NOT // @@ -7430,14 +8155,17 @@ type UpdateItemInput struct { // * NONE - If ReturnValues is not specified, or if its value is NONE, then // nothing is returned. (This setting is the default for ReturnValues.) // - // * ALL_OLD - If UpdateItem overwrote an attribute name-value pair, then - // the content of the old item is returned. + // * ALL_OLD - Returns all of the attributes of the item, as they appeared + // before the UpdateItem operation. // - // * UPDATED_OLD - The old versions of only the updated attributes are returned. + // * UPDATED_OLD - Returns only the updated attributes, as they appeared + // before the UpdateItem operation. // - // * ALL_NEW - All of the attributes of the new version of the item are returned. + // * ALL_NEW - Returns all of the attributes of the item, as they appear + // after the UpdateItem operation. // - // * UPDATED_NEW - The new versions of only the updated attributes are returned. + // * UPDATED_NEW - Returns only the updated attributes, as they appear after + // the UpdateItem operation. // // There is no additional cost associated with requesting a return value aside // from the small network and processing overhead of receiving a larger response. @@ -7842,6 +8570,93 @@ func (s *UpdateTableOutput) SetTableDescription(v *TableDescription) *UpdateTabl return s } +// Represents the input of an UpdateTimeToLive operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UpdateTimeToLiveInput +type UpdateTimeToLiveInput struct { + _ struct{} `type:"structure"` + + // The name of the table to be configured. + // + // TableName is a required field + TableName *string `min:"3" type:"string" required:"true"` + + // Represents the settings used to enable or disable Time to Live for the specified + // table. + // + // TimeToLiveSpecification is a required field + TimeToLiveSpecification *TimeToLiveSpecification `type:"structure" required:"true"` +} + +// String returns the string representation +func (s UpdateTimeToLiveInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateTimeToLiveInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateTimeToLiveInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateTimeToLiveInput"} + if s.TableName == nil { + invalidParams.Add(request.NewErrParamRequired("TableName")) + } + if s.TableName != nil && len(*s.TableName) < 3 { + invalidParams.Add(request.NewErrParamMinLen("TableName", 3)) + } + if s.TimeToLiveSpecification == nil { + invalidParams.Add(request.NewErrParamRequired("TimeToLiveSpecification")) + } + if s.TimeToLiveSpecification != nil { + if err := s.TimeToLiveSpecification.Validate(); err != nil { + invalidParams.AddNested("TimeToLiveSpecification", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetTableName sets the TableName field's value. +func (s *UpdateTimeToLiveInput) SetTableName(v string) *UpdateTimeToLiveInput { + s.TableName = &v + return s +} + +// SetTimeToLiveSpecification sets the TimeToLiveSpecification field's value. +func (s *UpdateTimeToLiveInput) SetTimeToLiveSpecification(v *TimeToLiveSpecification) *UpdateTimeToLiveInput { + s.TimeToLiveSpecification = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UpdateTimeToLiveOutput +type UpdateTimeToLiveOutput struct { + _ struct{} `type:"structure"` + + // Represents the output of an UpdateTimeToLive operation. + TimeToLiveSpecification *TimeToLiveSpecification `type:"structure"` +} + +// String returns the string representation +func (s UpdateTimeToLiveOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateTimeToLiveOutput) GoString() string { + return s.String() +} + +// SetTimeToLiveSpecification sets the TimeToLiveSpecification field's value. +func (s *UpdateTimeToLiveOutput) SetTimeToLiveSpecification(v *TimeToLiveSpecification) *UpdateTimeToLiveOutput { + s.TimeToLiveSpecification = v + return s +} + // Represents an operation to perform - either DeleteItem or PutItem. You can // only request one of these operations, not both, in a single WriteRequest. // If you do need to perform both of these operations, you will need to provide @@ -8075,3 +8890,17 @@ const ( // TableStatusActive is a TableStatus enum value TableStatusActive = "ACTIVE" ) + +const ( + // TimeToLiveStatusEnabling is a TimeToLiveStatus enum value + TimeToLiveStatusEnabling = "ENABLING" + + // TimeToLiveStatusDisabling is a TimeToLiveStatus enum value + TimeToLiveStatusDisabling = "DISABLING" + + // TimeToLiveStatusEnabled is a TimeToLiveStatus enum value + TimeToLiveStatusEnabled = "ENABLED" + + // TimeToLiveStatusDisabled is a TimeToLiveStatus enum value + TimeToLiveStatusDisabled = "DISABLED" +) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations.go b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations.go index 51843cd7a8..333e61bfcb 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/customizations.go @@ -26,19 +26,30 @@ func (d retryer) RetryRules(r *request.Request) time.Duration { func init() { initClient = func(c *client.Client) { - r := retryer{} - if c.Config.MaxRetries == nil || aws.IntValue(c.Config.MaxRetries) == aws.UseServiceDefaultRetries { - r.NumMaxRetries = 10 - } else { - r.NumMaxRetries = *c.Config.MaxRetries + if c.Config.Retryer == nil { + // Only override the retryer with a custom one if the config + // does not already contain a retryer + setCustomRetryer(c) } - c.Retryer = r c.Handlers.Build.PushBack(disableCompression) c.Handlers.Unmarshal.PushFront(validateCRC32) } } +func setCustomRetryer(c *client.Client) { + maxRetries := aws.IntValue(c.Config.MaxRetries) + if c.Config.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries { + maxRetries = 10 + } + + c.Retryer = retryer{ + DefaultRetryer: client.DefaultRetryer{ + NumMaxRetries: maxRetries, + }, + } +} + func drainBody(b io.ReadCloser, length int64) (out *bytes.Buffer, err error) { if length < 0 { length = 0 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/errors.go index 05a9ee84cd..d47a10486f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package dynamodb diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go index b8765f0336..7782769675 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package dynamodb diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/waiters.go index 57e1264b71..07c75c4288 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/dynamodb/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package dynamodb import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilTableExists uses the DynamoDB API operation @@ -11,32 +14,50 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *DynamoDB) WaitUntilTableExists(input *DescribeTableInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeTable", - Delay: 20, + return c.WaitUntilTableExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilTableExistsWithContext is an extended version of WaitUntilTableExists. +// 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 *DynamoDB) WaitUntilTableExistsWithContext(ctx aws.Context, input *DescribeTableInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilTableExists", MaxAttempts: 25, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(20 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "Table.TableStatus", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Table.TableStatus", Expected: "ACTIVE", }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ResourceNotFoundException", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeTableInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTableRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilTableNotExists uses the DynamoDB API operation @@ -44,24 +65,43 @@ func (c *DynamoDB) WaitUntilTableExists(input *DescribeTableInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *DynamoDB) WaitUntilTableNotExists(input *DescribeTableInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeTable", - Delay: 20, + return c.WaitUntilTableNotExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilTableNotExistsWithContext is an extended version of WaitUntilTableNotExists. +// 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 *DynamoDB) WaitUntilTableNotExistsWithContext(ctx aws.Context, input *DescribeTableInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilTableNotExists", MaxAttempts: 25, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(20 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ResourceNotFoundException", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeTableInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTableRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go index cb4ded4bce..63e7dbc70c 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package ec2 provides a client for Amazon Elastic Compute Cloud. package ec2 @@ -7,6 +7,7 @@ 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" @@ -70,8 +71,23 @@ func (c *EC2) AcceptReservedInstancesExchangeQuoteRequest(input *AcceptReservedI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AcceptReservedInstancesExchangeQuote func (c *EC2) AcceptReservedInstancesExchangeQuote(input *AcceptReservedInstancesExchangeQuoteInput) (*AcceptReservedInstancesExchangeQuoteOutput, error) { req, out := c.AcceptReservedInstancesExchangeQuoteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AcceptReservedInstancesExchangeQuoteWithContext is the same as AcceptReservedInstancesExchangeQuote with the addition of +// the ability to pass a context and additional request options. +// +// See AcceptReservedInstancesExchangeQuote 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 *EC2) AcceptReservedInstancesExchangeQuoteWithContext(ctx aws.Context, input *AcceptReservedInstancesExchangeQuoteInput, opts ...request.Option) (*AcceptReservedInstancesExchangeQuoteOutput, error) { + req, out := c.AcceptReservedInstancesExchangeQuoteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAcceptVpcPeeringConnection = "AcceptVpcPeeringConnection" @@ -133,8 +149,23 @@ func (c *EC2) AcceptVpcPeeringConnectionRequest(input *AcceptVpcPeeringConnectio // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AcceptVpcPeeringConnection func (c *EC2) AcceptVpcPeeringConnection(input *AcceptVpcPeeringConnectionInput) (*AcceptVpcPeeringConnectionOutput, error) { req, out := c.AcceptVpcPeeringConnectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AcceptVpcPeeringConnectionWithContext is the same as AcceptVpcPeeringConnection with the addition of +// the ability to pass a context and additional request options. +// +// See AcceptVpcPeeringConnection 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 *EC2) AcceptVpcPeeringConnectionWithContext(ctx aws.Context, input *AcceptVpcPeeringConnectionInput, opts ...request.Option) (*AcceptVpcPeeringConnectionOutput, error) { + req, out := c.AcceptVpcPeeringConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAllocateAddress = "AllocateAddress" @@ -197,8 +228,23 @@ func (c *EC2) AllocateAddressRequest(input *AllocateAddressInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AllocateAddress func (c *EC2) AllocateAddress(input *AllocateAddressInput) (*AllocateAddressOutput, error) { req, out := c.AllocateAddressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AllocateAddressWithContext is the same as AllocateAddress with the addition of +// the ability to pass a context and additional request options. +// +// See AllocateAddress 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 *EC2) AllocateAddressWithContext(ctx aws.Context, input *AllocateAddressInput, opts ...request.Option) (*AllocateAddressOutput, error) { + req, out := c.AllocateAddressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAllocateHosts = "AllocateHosts" @@ -259,8 +305,23 @@ func (c *EC2) AllocateHostsRequest(input *AllocateHostsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AllocateHosts func (c *EC2) AllocateHosts(input *AllocateHostsInput) (*AllocateHostsOutput, error) { req, out := c.AllocateHostsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AllocateHostsWithContext is the same as AllocateHosts with the addition of +// the ability to pass a context and additional request options. +// +// See AllocateHosts 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 *EC2) AllocateHostsWithContext(ctx aws.Context, input *AllocateHostsInput, opts ...request.Option) (*AllocateHostsOutput, error) { + req, out := c.AllocateHostsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssignIpv6Addresses = "AssignIpv6Addresses" @@ -326,8 +387,23 @@ func (c *EC2) AssignIpv6AddressesRequest(input *AssignIpv6AddressesInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssignIpv6Addresses func (c *EC2) AssignIpv6Addresses(input *AssignIpv6AddressesInput) (*AssignIpv6AddressesOutput, error) { req, out := c.AssignIpv6AddressesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssignIpv6AddressesWithContext is the same as AssignIpv6Addresses with the addition of +// the ability to pass a context and additional request options. +// +// See AssignIpv6Addresses 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 *EC2) AssignIpv6AddressesWithContext(ctx aws.Context, input *AssignIpv6AddressesInput, opts ...request.Option) (*AssignIpv6AddressesOutput, error) { + req, out := c.AssignIpv6AddressesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssignPrivateIpAddresses = "AssignPrivateIpAddresses" @@ -398,8 +474,23 @@ func (c *EC2) AssignPrivateIpAddressesRequest(input *AssignPrivateIpAddressesInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssignPrivateIpAddresses func (c *EC2) AssignPrivateIpAddresses(input *AssignPrivateIpAddressesInput) (*AssignPrivateIpAddressesOutput, error) { req, out := c.AssignPrivateIpAddressesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssignPrivateIpAddressesWithContext is the same as AssignPrivateIpAddresses with the addition of +// the ability to pass a context and additional request options. +// +// See AssignPrivateIpAddresses 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 *EC2) AssignPrivateIpAddressesWithContext(ctx aws.Context, input *AssignPrivateIpAddressesInput, opts ...request.Option) (*AssignPrivateIpAddressesOutput, error) { + req, out := c.AssignPrivateIpAddressesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssociateAddress = "AssociateAddress" @@ -476,8 +567,23 @@ func (c *EC2) AssociateAddressRequest(input *AssociateAddressInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssociateAddress func (c *EC2) AssociateAddress(input *AssociateAddressInput) (*AssociateAddressOutput, error) { req, out := c.AssociateAddressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateAddressWithContext is the same as AssociateAddress with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateAddress 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 *EC2) AssociateAddressWithContext(ctx aws.Context, input *AssociateAddressInput, opts ...request.Option) (*AssociateAddressOutput, error) { + req, out := c.AssociateAddressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssociateDhcpOptions = "AssociateDhcpOptions" @@ -549,8 +655,23 @@ func (c *EC2) AssociateDhcpOptionsRequest(input *AssociateDhcpOptionsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssociateDhcpOptions func (c *EC2) AssociateDhcpOptions(input *AssociateDhcpOptionsInput) (*AssociateDhcpOptionsOutput, error) { req, out := c.AssociateDhcpOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateDhcpOptionsWithContext is the same as AssociateDhcpOptions with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateDhcpOptions 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 *EC2) AssociateDhcpOptionsWithContext(ctx aws.Context, input *AssociateDhcpOptionsInput, opts ...request.Option) (*AssociateDhcpOptionsOutput, error) { + req, out := c.AssociateDhcpOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssociateIamInstanceProfile = "AssociateIamInstanceProfile" @@ -610,8 +731,23 @@ func (c *EC2) AssociateIamInstanceProfileRequest(input *AssociateIamInstanceProf // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssociateIamInstanceProfile func (c *EC2) AssociateIamInstanceProfile(input *AssociateIamInstanceProfileInput) (*AssociateIamInstanceProfileOutput, error) { req, out := c.AssociateIamInstanceProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateIamInstanceProfileWithContext is the same as AssociateIamInstanceProfile with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateIamInstanceProfile 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 *EC2) AssociateIamInstanceProfileWithContext(ctx aws.Context, input *AssociateIamInstanceProfileInput, opts ...request.Option) (*AssociateIamInstanceProfileOutput, error) { + req, out := c.AssociateIamInstanceProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssociateRouteTable = "AssociateRouteTable" @@ -677,8 +813,23 @@ func (c *EC2) AssociateRouteTableRequest(input *AssociateRouteTableInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssociateRouteTable func (c *EC2) AssociateRouteTable(input *AssociateRouteTableInput) (*AssociateRouteTableOutput, error) { req, out := c.AssociateRouteTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateRouteTableWithContext is the same as AssociateRouteTable with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateRouteTable 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 *EC2) AssociateRouteTableWithContext(ctx aws.Context, input *AssociateRouteTableInput, opts ...request.Option) (*AssociateRouteTableOutput, error) { + req, out := c.AssociateRouteTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssociateSubnetCidrBlock = "AssociateSubnetCidrBlock" @@ -739,8 +890,23 @@ func (c *EC2) AssociateSubnetCidrBlockRequest(input *AssociateSubnetCidrBlockInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssociateSubnetCidrBlock func (c *EC2) AssociateSubnetCidrBlock(input *AssociateSubnetCidrBlockInput) (*AssociateSubnetCidrBlockOutput, error) { req, out := c.AssociateSubnetCidrBlockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateSubnetCidrBlockWithContext is the same as AssociateSubnetCidrBlock with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateSubnetCidrBlock 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 *EC2) AssociateSubnetCidrBlockWithContext(ctx aws.Context, input *AssociateSubnetCidrBlockInput, opts ...request.Option) (*AssociateSubnetCidrBlockOutput, error) { + req, out := c.AssociateSubnetCidrBlockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssociateVpcCidrBlock = "AssociateVpcCidrBlock" @@ -800,8 +966,23 @@ func (c *EC2) AssociateVpcCidrBlockRequest(input *AssociateVpcCidrBlockInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AssociateVpcCidrBlock func (c *EC2) AssociateVpcCidrBlock(input *AssociateVpcCidrBlockInput) (*AssociateVpcCidrBlockOutput, error) { req, out := c.AssociateVpcCidrBlockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateVpcCidrBlockWithContext is the same as AssociateVpcCidrBlock with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateVpcCidrBlock 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 *EC2) AssociateVpcCidrBlockWithContext(ctx aws.Context, input *AssociateVpcCidrBlockInput, opts ...request.Option) (*AssociateVpcCidrBlockOutput, error) { + req, out := c.AssociateVpcCidrBlockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachClassicLinkVpc = "AttachClassicLinkVpc" @@ -871,8 +1052,23 @@ func (c *EC2) AttachClassicLinkVpcRequest(input *AttachClassicLinkVpcInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AttachClassicLinkVpc func (c *EC2) AttachClassicLinkVpc(input *AttachClassicLinkVpcInput) (*AttachClassicLinkVpcOutput, error) { req, out := c.AttachClassicLinkVpcRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachClassicLinkVpcWithContext is the same as AttachClassicLinkVpc with the addition of +// the ability to pass a context and additional request options. +// +// See AttachClassicLinkVpc 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 *EC2) AttachClassicLinkVpcWithContext(ctx aws.Context, input *AttachClassicLinkVpcInput, opts ...request.Option) (*AttachClassicLinkVpcOutput, error) { + req, out := c.AttachClassicLinkVpcRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachInternetGateway = "AttachInternetGateway" @@ -935,8 +1131,23 @@ func (c *EC2) AttachInternetGatewayRequest(input *AttachInternetGatewayInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AttachInternetGateway func (c *EC2) AttachInternetGateway(input *AttachInternetGatewayInput) (*AttachInternetGatewayOutput, error) { req, out := c.AttachInternetGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachInternetGatewayWithContext is the same as AttachInternetGateway with the addition of +// the ability to pass a context and additional request options. +// +// See AttachInternetGateway 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 *EC2) AttachInternetGatewayWithContext(ctx aws.Context, input *AttachInternetGatewayInput, opts ...request.Option) (*AttachInternetGatewayOutput, error) { + req, out := c.AttachInternetGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachNetworkInterface = "AttachNetworkInterface" @@ -995,8 +1206,23 @@ func (c *EC2) AttachNetworkInterfaceRequest(input *AttachNetworkInterfaceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AttachNetworkInterface func (c *EC2) AttachNetworkInterface(input *AttachNetworkInterfaceInput) (*AttachNetworkInterfaceOutput, error) { req, out := c.AttachNetworkInterfaceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachNetworkInterfaceWithContext is the same as AttachNetworkInterface with the addition of +// the ability to pass a context and additional request options. +// +// See AttachNetworkInterface 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 *EC2) AttachNetworkInterfaceWithContext(ctx aws.Context, input *AttachNetworkInterfaceInput, opts ...request.Option) (*AttachNetworkInterfaceOutput, error) { + req, out := c.AttachNetworkInterfaceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachVolume = "AttachVolume" @@ -1084,8 +1310,23 @@ func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AttachVolume func (c *EC2) AttachVolume(input *AttachVolumeInput) (*VolumeAttachment, error) { req, out := c.AttachVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachVolumeWithContext is the same as AttachVolume with the addition of +// the ability to pass a context and additional request options. +// +// See AttachVolume 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 *EC2) AttachVolumeWithContext(ctx aws.Context, input *AttachVolumeInput, opts ...request.Option) (*VolumeAttachment, error) { + req, out := c.AttachVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachVpnGateway = "AttachVpnGateway" @@ -1133,8 +1374,11 @@ func (c *EC2) AttachVpnGatewayRequest(input *AttachVpnGatewayInput) (req *reques // AttachVpnGateway API operation for Amazon Elastic Compute Cloud. // -// Attaches a virtual private gateway to a VPC. For more information, see Adding -// a Hardware Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// Attaches a virtual private gateway to a VPC. You can attach one virtual private +// gateway to one VPC at a time. +// +// For more information, see Adding a Hardware Virtual Private Gateway to Your +// VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) // in the Amazon Virtual Private Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1146,8 +1390,23 @@ func (c *EC2) AttachVpnGatewayRequest(input *AttachVpnGatewayInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AttachVpnGateway func (c *EC2) AttachVpnGateway(input *AttachVpnGatewayInput) (*AttachVpnGatewayOutput, error) { req, out := c.AttachVpnGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachVpnGatewayWithContext is the same as AttachVpnGateway with the addition of +// the ability to pass a context and additional request options. +// +// See AttachVpnGateway 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 *EC2) AttachVpnGatewayWithContext(ctx aws.Context, input *AttachVpnGatewayInput, opts ...request.Option) (*AttachVpnGatewayOutput, error) { + req, out := c.AttachVpnGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAuthorizeSecurityGroupEgress = "AuthorizeSecurityGroupEgress" @@ -1224,8 +1483,23 @@ func (c *EC2) AuthorizeSecurityGroupEgressRequest(input *AuthorizeSecurityGroupE // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AuthorizeSecurityGroupEgress func (c *EC2) AuthorizeSecurityGroupEgress(input *AuthorizeSecurityGroupEgressInput) (*AuthorizeSecurityGroupEgressOutput, error) { req, out := c.AuthorizeSecurityGroupEgressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AuthorizeSecurityGroupEgressWithContext is the same as AuthorizeSecurityGroupEgress with the addition of +// the ability to pass a context and additional request options. +// +// See AuthorizeSecurityGroupEgress 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 *EC2) AuthorizeSecurityGroupEgressWithContext(ctx aws.Context, input *AuthorizeSecurityGroupEgressInput, opts ...request.Option) (*AuthorizeSecurityGroupEgressOutput, error) { + req, out := c.AuthorizeSecurityGroupEgressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAuthorizeSecurityGroupIngress = "AuthorizeSecurityGroupIngress" @@ -1302,8 +1576,23 @@ func (c *EC2) AuthorizeSecurityGroupIngressRequest(input *AuthorizeSecurityGroup // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AuthorizeSecurityGroupIngress func (c *EC2) AuthorizeSecurityGroupIngress(input *AuthorizeSecurityGroupIngressInput) (*AuthorizeSecurityGroupIngressOutput, error) { req, out := c.AuthorizeSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AuthorizeSecurityGroupIngressWithContext is the same as AuthorizeSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See AuthorizeSecurityGroupIngress 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 *EC2) AuthorizeSecurityGroupIngressWithContext(ctx aws.Context, input *AuthorizeSecurityGroupIngressInput, opts ...request.Option) (*AuthorizeSecurityGroupIngressOutput, error) { + req, out := c.AuthorizeSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBundleInstance = "BundleInstance" @@ -1370,8 +1659,23 @@ func (c *EC2) BundleInstanceRequest(input *BundleInstanceInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/BundleInstance func (c *EC2) BundleInstance(input *BundleInstanceInput) (*BundleInstanceOutput, error) { req, out := c.BundleInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BundleInstanceWithContext is the same as BundleInstance with the addition of +// the ability to pass a context and additional request options. +// +// See BundleInstance 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 *EC2) BundleInstanceWithContext(ctx aws.Context, input *BundleInstanceInput, opts ...request.Option) (*BundleInstanceOutput, error) { + req, out := c.BundleInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelBundleTask = "CancelBundleTask" @@ -1430,8 +1734,23 @@ func (c *EC2) CancelBundleTaskRequest(input *CancelBundleTaskInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelBundleTask func (c *EC2) CancelBundleTask(input *CancelBundleTaskInput) (*CancelBundleTaskOutput, error) { req, out := c.CancelBundleTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelBundleTaskWithContext is the same as CancelBundleTask with the addition of +// the ability to pass a context and additional request options. +// +// See CancelBundleTask 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 *EC2) CancelBundleTaskWithContext(ctx aws.Context, input *CancelBundleTaskInput, opts ...request.Option) (*CancelBundleTaskOutput, error) { + req, out := c.CancelBundleTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelConversionTask = "CancelConversionTask" @@ -1499,8 +1818,23 @@ func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelConversionTask func (c *EC2) CancelConversionTask(input *CancelConversionTaskInput) (*CancelConversionTaskOutput, error) { req, out := c.CancelConversionTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelConversionTaskWithContext is the same as CancelConversionTask with the addition of +// the ability to pass a context and additional request options. +// +// See CancelConversionTask 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 *EC2) CancelConversionTaskWithContext(ctx aws.Context, input *CancelConversionTaskInput, opts ...request.Option) (*CancelConversionTaskOutput, error) { + req, out := c.CancelConversionTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelExportTask = "CancelExportTask" @@ -1564,8 +1898,23 @@ func (c *EC2) CancelExportTaskRequest(input *CancelExportTaskInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelExportTask func (c *EC2) CancelExportTask(input *CancelExportTaskInput) (*CancelExportTaskOutput, error) { req, out := c.CancelExportTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelExportTaskWithContext is the same as CancelExportTask with the addition of +// the ability to pass a context and additional request options. +// +// See CancelExportTask 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 *EC2) CancelExportTaskWithContext(ctx aws.Context, input *CancelExportTaskInput, opts ...request.Option) (*CancelExportTaskOutput, error) { + req, out := c.CancelExportTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelImportTask = "CancelImportTask" @@ -1624,8 +1973,23 @@ func (c *EC2) CancelImportTaskRequest(input *CancelImportTaskInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelImportTask func (c *EC2) CancelImportTask(input *CancelImportTaskInput) (*CancelImportTaskOutput, error) { req, out := c.CancelImportTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelImportTaskWithContext is the same as CancelImportTask with the addition of +// the ability to pass a context and additional request options. +// +// See CancelImportTask 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 *EC2) CancelImportTaskWithContext(ctx aws.Context, input *CancelImportTaskInput, opts ...request.Option) (*CancelImportTaskOutput, error) { + req, out := c.CancelImportTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelReservedInstancesListing = "CancelReservedInstancesListing" @@ -1688,8 +2052,23 @@ func (c *EC2) CancelReservedInstancesListingRequest(input *CancelReservedInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelReservedInstancesListing func (c *EC2) CancelReservedInstancesListing(input *CancelReservedInstancesListingInput) (*CancelReservedInstancesListingOutput, error) { req, out := c.CancelReservedInstancesListingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelReservedInstancesListingWithContext is the same as CancelReservedInstancesListing with the addition of +// the ability to pass a context and additional request options. +// +// See CancelReservedInstancesListing 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 *EC2) CancelReservedInstancesListingWithContext(ctx aws.Context, input *CancelReservedInstancesListingInput, opts ...request.Option) (*CancelReservedInstancesListingOutput, error) { + req, out := c.CancelReservedInstancesListingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelSpotFleetRequests = "CancelSpotFleetRequests" @@ -1755,8 +2134,23 @@ func (c *EC2) CancelSpotFleetRequestsRequest(input *CancelSpotFleetRequestsInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelSpotFleetRequests func (c *EC2) CancelSpotFleetRequests(input *CancelSpotFleetRequestsInput) (*CancelSpotFleetRequestsOutput, error) { req, out := c.CancelSpotFleetRequestsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelSpotFleetRequestsWithContext is the same as CancelSpotFleetRequests with the addition of +// the ability to pass a context and additional request options. +// +// See CancelSpotFleetRequests 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 *EC2) CancelSpotFleetRequestsWithContext(ctx aws.Context, input *CancelSpotFleetRequestsInput, opts ...request.Option) (*CancelSpotFleetRequestsOutput, error) { + req, out := c.CancelSpotFleetRequestsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelSpotInstanceRequests = "CancelSpotInstanceRequests" @@ -1823,8 +2217,23 @@ func (c *EC2) CancelSpotInstanceRequestsRequest(input *CancelSpotInstanceRequest // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CancelSpotInstanceRequests func (c *EC2) CancelSpotInstanceRequests(input *CancelSpotInstanceRequestsInput) (*CancelSpotInstanceRequestsOutput, error) { req, out := c.CancelSpotInstanceRequestsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelSpotInstanceRequestsWithContext is the same as CancelSpotInstanceRequests with the addition of +// the ability to pass a context and additional request options. +// +// See CancelSpotInstanceRequests 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 *EC2) CancelSpotInstanceRequestsWithContext(ctx aws.Context, input *CancelSpotInstanceRequestsInput, opts ...request.Option) (*CancelSpotInstanceRequestsOutput, error) { + req, out := c.CancelSpotInstanceRequestsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opConfirmProductInstance = "ConfirmProductInstance" @@ -1886,8 +2295,23 @@ func (c *EC2) ConfirmProductInstanceRequest(input *ConfirmProductInstanceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ConfirmProductInstance func (c *EC2) ConfirmProductInstance(input *ConfirmProductInstanceInput) (*ConfirmProductInstanceOutput, error) { req, out := c.ConfirmProductInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ConfirmProductInstanceWithContext is the same as ConfirmProductInstance with the addition of +// the ability to pass a context and additional request options. +// +// See ConfirmProductInstance 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 *EC2) ConfirmProductInstanceWithContext(ctx aws.Context, input *ConfirmProductInstanceInput, opts ...request.Option) (*ConfirmProductInstanceOutput, error) { + req, out := c.ConfirmProductInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyImage = "CopyImage" @@ -1951,8 +2375,23 @@ func (c *EC2) CopyImageRequest(input *CopyImageInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CopyImage func (c *EC2) CopyImage(input *CopyImageInput) (*CopyImageOutput, error) { req, out := c.CopyImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyImageWithContext is the same as CopyImage with the addition of +// the ability to pass a context and additional request options. +// +// See CopyImage 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 *EC2) CopyImageWithContext(ctx aws.Context, input *CopyImageInput, opts ...request.Option) (*CopyImageOutput, error) { + req, out := c.CopyImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopySnapshot = "CopySnapshot" @@ -2030,8 +2469,23 @@ func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CopySnapshot func (c *EC2) CopySnapshot(input *CopySnapshotInput) (*CopySnapshotOutput, error) { req, out := c.CopySnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopySnapshotWithContext is the same as CopySnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CopySnapshot 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 *EC2) CopySnapshotWithContext(ctx aws.Context, input *CopySnapshotInput, opts ...request.Option) (*CopySnapshotOutput, error) { + req, out := c.CopySnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateCustomerGateway = "CreateCustomerGateway" @@ -2114,8 +2568,23 @@ func (c *EC2) CreateCustomerGatewayRequest(input *CreateCustomerGatewayInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateCustomerGateway func (c *EC2) CreateCustomerGateway(input *CreateCustomerGatewayInput) (*CreateCustomerGatewayOutput, error) { req, out := c.CreateCustomerGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateCustomerGatewayWithContext is the same as CreateCustomerGateway with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCustomerGateway 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 *EC2) CreateCustomerGatewayWithContext(ctx aws.Context, input *CreateCustomerGatewayInput, opts ...request.Option) (*CreateCustomerGatewayOutput, error) { + req, out := c.CreateCustomerGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDhcpOptions = "CreateDhcpOptions" @@ -2213,8 +2682,23 @@ func (c *EC2) CreateDhcpOptionsRequest(input *CreateDhcpOptionsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateDhcpOptions func (c *EC2) CreateDhcpOptions(input *CreateDhcpOptionsInput) (*CreateDhcpOptionsOutput, error) { req, out := c.CreateDhcpOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDhcpOptionsWithContext is the same as CreateDhcpOptions with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDhcpOptions 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 *EC2) CreateDhcpOptionsWithContext(ctx aws.Context, input *CreateDhcpOptionsInput, opts ...request.Option) (*CreateDhcpOptionsOutput, error) { + req, out := c.CreateDhcpOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateEgressOnlyInternetGateway = "CreateEgressOnlyInternetGateway" @@ -2276,8 +2760,23 @@ func (c *EC2) CreateEgressOnlyInternetGatewayRequest(input *CreateEgressOnlyInte // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateEgressOnlyInternetGateway func (c *EC2) CreateEgressOnlyInternetGateway(input *CreateEgressOnlyInternetGatewayInput) (*CreateEgressOnlyInternetGatewayOutput, error) { req, out := c.CreateEgressOnlyInternetGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateEgressOnlyInternetGatewayWithContext is the same as CreateEgressOnlyInternetGateway with the addition of +// the ability to pass a context and additional request options. +// +// See CreateEgressOnlyInternetGateway 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 *EC2) CreateEgressOnlyInternetGatewayWithContext(ctx aws.Context, input *CreateEgressOnlyInternetGatewayInput, opts ...request.Option) (*CreateEgressOnlyInternetGatewayOutput, error) { + req, out := c.CreateEgressOnlyInternetGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateFlowLogs = "CreateFlowLogs" @@ -2345,8 +2844,23 @@ func (c *EC2) CreateFlowLogsRequest(input *CreateFlowLogsInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateFlowLogs func (c *EC2) CreateFlowLogs(input *CreateFlowLogsInput) (*CreateFlowLogsOutput, error) { req, out := c.CreateFlowLogsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateFlowLogsWithContext is the same as CreateFlowLogs with the addition of +// the ability to pass a context and additional request options. +// +// See CreateFlowLogs 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 *EC2) CreateFlowLogsWithContext(ctx aws.Context, input *CreateFlowLogsInput, opts ...request.Option) (*CreateFlowLogsOutput, error) { + req, out := c.CreateFlowLogsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateImage = "CreateImage" @@ -2414,8 +2928,23 @@ func (c *EC2) CreateImageRequest(input *CreateImageInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateImage func (c *EC2) CreateImage(input *CreateImageInput) (*CreateImageOutput, error) { req, out := c.CreateImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateImageWithContext is the same as CreateImage with the addition of +// the ability to pass a context and additional request options. +// +// See CreateImage 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 *EC2) CreateImageWithContext(ctx aws.Context, input *CreateImageInput, opts ...request.Option) (*CreateImageOutput, error) { + req, out := c.CreateImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateInstanceExportTask = "CreateInstanceExportTask" @@ -2479,8 +3008,23 @@ func (c *EC2) CreateInstanceExportTaskRequest(input *CreateInstanceExportTaskInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateInstanceExportTask func (c *EC2) CreateInstanceExportTask(input *CreateInstanceExportTaskInput) (*CreateInstanceExportTaskOutput, error) { req, out := c.CreateInstanceExportTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInstanceExportTaskWithContext is the same as CreateInstanceExportTask with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInstanceExportTask 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 *EC2) CreateInstanceExportTaskWithContext(ctx aws.Context, input *CreateInstanceExportTaskInput, opts ...request.Option) (*CreateInstanceExportTaskOutput, error) { + req, out := c.CreateInstanceExportTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateInternetGateway = "CreateInternetGateway" @@ -2543,8 +3087,23 @@ func (c *EC2) CreateInternetGatewayRequest(input *CreateInternetGatewayInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateInternetGateway func (c *EC2) CreateInternetGateway(input *CreateInternetGatewayInput) (*CreateInternetGatewayOutput, error) { req, out := c.CreateInternetGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInternetGatewayWithContext is the same as CreateInternetGateway with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInternetGateway 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 *EC2) CreateInternetGatewayWithContext(ctx aws.Context, input *CreateInternetGatewayInput, opts ...request.Option) (*CreateInternetGatewayOutput, error) { + req, out := c.CreateInternetGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateKeyPair = "CreateKeyPair" @@ -2614,8 +3173,23 @@ func (c *EC2) CreateKeyPairRequest(input *CreateKeyPairInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateKeyPair func (c *EC2) CreateKeyPair(input *CreateKeyPairInput) (*CreateKeyPairOutput, error) { req, out := c.CreateKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateKeyPairWithContext is the same as CreateKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See CreateKeyPair 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 *EC2) CreateKeyPairWithContext(ctx aws.Context, input *CreateKeyPairInput, opts ...request.Option) (*CreateKeyPairOutput, error) { + req, out := c.CreateKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateNatGateway = "CreateNatGateway" @@ -2679,8 +3253,23 @@ func (c *EC2) CreateNatGatewayRequest(input *CreateNatGatewayInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateNatGateway func (c *EC2) CreateNatGateway(input *CreateNatGatewayInput) (*CreateNatGatewayOutput, error) { req, out := c.CreateNatGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateNatGatewayWithContext is the same as CreateNatGateway with the addition of +// the ability to pass a context and additional request options. +// +// See CreateNatGateway 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 *EC2) CreateNatGatewayWithContext(ctx aws.Context, input *CreateNatGatewayInput, opts ...request.Option) (*CreateNatGatewayOutput, error) { + req, out := c.CreateNatGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateNetworkAcl = "CreateNetworkAcl" @@ -2743,8 +3332,23 @@ func (c *EC2) CreateNetworkAclRequest(input *CreateNetworkAclInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateNetworkAcl func (c *EC2) CreateNetworkAcl(input *CreateNetworkAclInput) (*CreateNetworkAclOutput, error) { req, out := c.CreateNetworkAclRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateNetworkAclWithContext is the same as CreateNetworkAcl with the addition of +// the ability to pass a context and additional request options. +// +// See CreateNetworkAcl 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 *EC2) CreateNetworkAclWithContext(ctx aws.Context, input *CreateNetworkAclInput, opts ...request.Option) (*CreateNetworkAclOutput, error) { + req, out := c.CreateNetworkAclRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateNetworkAclEntry = "CreateNetworkAclEntry" @@ -2821,8 +3425,23 @@ func (c *EC2) CreateNetworkAclEntryRequest(input *CreateNetworkAclEntryInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateNetworkAclEntry func (c *EC2) CreateNetworkAclEntry(input *CreateNetworkAclEntryInput) (*CreateNetworkAclEntryOutput, error) { req, out := c.CreateNetworkAclEntryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateNetworkAclEntryWithContext is the same as CreateNetworkAclEntry with the addition of +// the ability to pass a context and additional request options. +// +// See CreateNetworkAclEntry 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 *EC2) CreateNetworkAclEntryWithContext(ctx aws.Context, input *CreateNetworkAclEntryInput, opts ...request.Option) (*CreateNetworkAclEntryOutput, error) { + req, out := c.CreateNetworkAclEntryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateNetworkInterface = "CreateNetworkInterface" @@ -2885,8 +3504,23 @@ func (c *EC2) CreateNetworkInterfaceRequest(input *CreateNetworkInterfaceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateNetworkInterface func (c *EC2) CreateNetworkInterface(input *CreateNetworkInterfaceInput) (*CreateNetworkInterfaceOutput, error) { req, out := c.CreateNetworkInterfaceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateNetworkInterfaceWithContext is the same as CreateNetworkInterface with the addition of +// the ability to pass a context and additional request options. +// +// See CreateNetworkInterface 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 *EC2) CreateNetworkInterfaceWithContext(ctx aws.Context, input *CreateNetworkInterfaceInput, opts ...request.Option) (*CreateNetworkInterfaceOutput, error) { + req, out := c.CreateNetworkInterfaceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePlacementGroup = "CreatePlacementGroup" @@ -2952,8 +3586,23 @@ func (c *EC2) CreatePlacementGroupRequest(input *CreatePlacementGroupInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreatePlacementGroup func (c *EC2) CreatePlacementGroup(input *CreatePlacementGroupInput) (*CreatePlacementGroupOutput, error) { req, out := c.CreatePlacementGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePlacementGroupWithContext is the same as CreatePlacementGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePlacementGroup 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 *EC2) CreatePlacementGroupWithContext(ctx aws.Context, input *CreatePlacementGroupInput, opts ...request.Option) (*CreatePlacementGroupOutput, error) { + req, out := c.CreatePlacementGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReservedInstancesListing = "CreateReservedInstancesListing" @@ -3035,8 +3684,23 @@ func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateReservedInstancesListing func (c *EC2) CreateReservedInstancesListing(input *CreateReservedInstancesListingInput) (*CreateReservedInstancesListingOutput, error) { req, out := c.CreateReservedInstancesListingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReservedInstancesListingWithContext is the same as CreateReservedInstancesListing with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReservedInstancesListing 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 *EC2) CreateReservedInstancesListingWithContext(ctx aws.Context, input *CreateReservedInstancesListingInput, opts ...request.Option) (*CreateReservedInstancesListingOutput, error) { + req, out := c.CreateReservedInstancesListingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateRoute = "CreateRoute" @@ -3114,8 +3778,23 @@ func (c *EC2) CreateRouteRequest(input *CreateRouteInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateRoute func (c *EC2) CreateRoute(input *CreateRouteInput) (*CreateRouteOutput, error) { req, out := c.CreateRouteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateRouteWithContext is the same as CreateRoute with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRoute 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 *EC2) CreateRouteWithContext(ctx aws.Context, input *CreateRouteInput, opts ...request.Option) (*CreateRouteOutput, error) { + req, out := c.CreateRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateRouteTable = "CreateRouteTable" @@ -3178,8 +3857,23 @@ func (c *EC2) CreateRouteTableRequest(input *CreateRouteTableInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateRouteTable func (c *EC2) CreateRouteTable(input *CreateRouteTableInput) (*CreateRouteTableOutput, error) { req, out := c.CreateRouteTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateRouteTableWithContext is the same as CreateRouteTable with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRouteTable 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 *EC2) CreateRouteTableWithContext(ctx aws.Context, input *CreateRouteTableInput, opts ...request.Option) (*CreateRouteTableOutput, error) { + req, out := c.CreateRouteTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSecurityGroup = "CreateSecurityGroup" @@ -3264,8 +3958,23 @@ func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateSecurityGroup func (c *EC2) CreateSecurityGroup(input *CreateSecurityGroupInput) (*CreateSecurityGroupOutput, error) { req, out := c.CreateSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSecurityGroupWithContext is the same as CreateSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSecurityGroup 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 *EC2) CreateSecurityGroupWithContext(ctx aws.Context, input *CreateSecurityGroupInput, opts ...request.Option) (*CreateSecurityGroupOutput, error) { + req, out := c.CreateSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSnapshot = "CreateSnapshot" @@ -3351,8 +4060,23 @@ func (c *EC2) CreateSnapshotRequest(input *CreateSnapshotInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateSnapshot func (c *EC2) CreateSnapshot(input *CreateSnapshotInput) (*Snapshot, error) { req, out := c.CreateSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSnapshotWithContext is the same as CreateSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSnapshot 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 *EC2) CreateSnapshotWithContext(ctx aws.Context, input *CreateSnapshotInput, opts ...request.Option) (*Snapshot, error) { + req, out := c.CreateSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSpotDatafeedSubscription = "CreateSpotDatafeedSubscription" @@ -3414,8 +4138,23 @@ func (c *EC2) CreateSpotDatafeedSubscriptionRequest(input *CreateSpotDatafeedSub // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateSpotDatafeedSubscription func (c *EC2) CreateSpotDatafeedSubscription(input *CreateSpotDatafeedSubscriptionInput) (*CreateSpotDatafeedSubscriptionOutput, error) { req, out := c.CreateSpotDatafeedSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSpotDatafeedSubscriptionWithContext is the same as CreateSpotDatafeedSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSpotDatafeedSubscription 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 *EC2) CreateSpotDatafeedSubscriptionWithContext(ctx aws.Context, input *CreateSpotDatafeedSubscriptionInput, opts ...request.Option) (*CreateSpotDatafeedSubscriptionOutput, error) { + req, out := c.CreateSpotDatafeedSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSubnet = "CreateSubnet" @@ -3501,8 +4240,23 @@ func (c *EC2) CreateSubnetRequest(input *CreateSubnetInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateSubnet func (c *EC2) CreateSubnet(input *CreateSubnetInput) (*CreateSubnetOutput, error) { req, out := c.CreateSubnetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSubnetWithContext is the same as CreateSubnet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSubnet 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 *EC2) CreateSubnetWithContext(ctx aws.Context, input *CreateSubnetInput, opts ...request.Option) (*CreateSubnetOutput, error) { + req, out := c.CreateSubnetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTags = "CreateTags" @@ -3571,8 +4325,23 @@ func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateTags func (c *EC2) CreateTags(input *CreateTagsInput) (*CreateTagsOutput, error) { req, out := c.CreateTagsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTagsWithContext is the same as CreateTags with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTags 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 *EC2) CreateTagsWithContext(ctx aws.Context, input *CreateTagsInput, opts ...request.Option) (*CreateTagsOutput, error) { + req, out := c.CreateTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVolume = "CreateVolume" @@ -3634,7 +4403,10 @@ func (c *EC2) CreateVolumeRequest(input *CreateVolumeInput) (req *request.Reques // encrypted. For more information, see Amazon EBS Encryption (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) // in the Amazon Elastic Compute Cloud User Guide. // -// For more information, see Creating or Restoring an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-volume.html) +// You can tag your volumes during creation. For more information, see Tagging +// Your Amazon EC2 Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html). +// +// For more information, see Creating an Amazon EBS Volume (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-volume.html) // in the Amazon Elastic Compute Cloud User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3646,8 +4418,23 @@ func (c *EC2) CreateVolumeRequest(input *CreateVolumeInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateVolume func (c *EC2) CreateVolume(input *CreateVolumeInput) (*Volume, error) { req, out := c.CreateVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVolumeWithContext is the same as CreateVolume with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVolume 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 *EC2) CreateVolumeWithContext(ctx aws.Context, input *CreateVolumeInput, opts ...request.Option) (*Volume, error) { + req, out := c.CreateVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVpc = "CreateVpc" @@ -3724,8 +4511,23 @@ func (c *EC2) CreateVpcRequest(input *CreateVpcInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateVpc func (c *EC2) CreateVpc(input *CreateVpcInput) (*CreateVpcOutput, error) { req, out := c.CreateVpcRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVpcWithContext is the same as CreateVpc with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVpc 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 *EC2) CreateVpcWithContext(ctx aws.Context, input *CreateVpcInput, opts ...request.Option) (*CreateVpcOutput, error) { + req, out := c.CreateVpcRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVpcEndpoint = "CreateVpcEndpoint" @@ -3790,8 +4592,23 @@ func (c *EC2) CreateVpcEndpointRequest(input *CreateVpcEndpointInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateVpcEndpoint func (c *EC2) CreateVpcEndpoint(input *CreateVpcEndpointInput) (*CreateVpcEndpointOutput, error) { req, out := c.CreateVpcEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVpcEndpointWithContext is the same as CreateVpcEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVpcEndpoint 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 *EC2) CreateVpcEndpointWithContext(ctx aws.Context, input *CreateVpcEndpointInput, opts ...request.Option) (*CreateVpcEndpointOutput, error) { + req, out := c.CreateVpcEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVpcPeeringConnection = "CreateVpcPeeringConnection" @@ -3860,8 +4677,23 @@ func (c *EC2) CreateVpcPeeringConnectionRequest(input *CreateVpcPeeringConnectio // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateVpcPeeringConnection func (c *EC2) CreateVpcPeeringConnection(input *CreateVpcPeeringConnectionInput) (*CreateVpcPeeringConnectionOutput, error) { req, out := c.CreateVpcPeeringConnectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVpcPeeringConnectionWithContext is the same as CreateVpcPeeringConnection with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVpcPeeringConnection 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 *EC2) CreateVpcPeeringConnectionWithContext(ctx aws.Context, input *CreateVpcPeeringConnectionInput, opts ...request.Option) (*CreateVpcPeeringConnectionOutput, error) { + req, out := c.CreateVpcPeeringConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVpnConnection = "CreateVpnConnection" @@ -3939,8 +4771,23 @@ func (c *EC2) CreateVpnConnectionRequest(input *CreateVpnConnectionInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateVpnConnection func (c *EC2) CreateVpnConnection(input *CreateVpnConnectionInput) (*CreateVpnConnectionOutput, error) { req, out := c.CreateVpnConnectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVpnConnectionWithContext is the same as CreateVpnConnection with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVpnConnection 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 *EC2) CreateVpnConnectionWithContext(ctx aws.Context, input *CreateVpnConnectionInput, opts ...request.Option) (*CreateVpnConnectionOutput, error) { + req, out := c.CreateVpnConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVpnConnectionRoute = "CreateVpnConnectionRoute" @@ -4008,8 +4855,23 @@ func (c *EC2) CreateVpnConnectionRouteRequest(input *CreateVpnConnectionRouteInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateVpnConnectionRoute func (c *EC2) CreateVpnConnectionRoute(input *CreateVpnConnectionRouteInput) (*CreateVpnConnectionRouteOutput, error) { req, out := c.CreateVpnConnectionRouteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVpnConnectionRouteWithContext is the same as CreateVpnConnectionRoute with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVpnConnectionRoute 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 *EC2) CreateVpnConnectionRouteWithContext(ctx aws.Context, input *CreateVpnConnectionRouteInput, opts ...request.Option) (*CreateVpnConnectionRouteOutput, error) { + req, out := c.CreateVpnConnectionRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVpnGateway = "CreateVpnGateway" @@ -4074,8 +4936,23 @@ func (c *EC2) CreateVpnGatewayRequest(input *CreateVpnGatewayInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/CreateVpnGateway func (c *EC2) CreateVpnGateway(input *CreateVpnGatewayInput) (*CreateVpnGatewayOutput, error) { req, out := c.CreateVpnGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVpnGatewayWithContext is the same as CreateVpnGateway with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVpnGateway 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 *EC2) CreateVpnGatewayWithContext(ctx aws.Context, input *CreateVpnGatewayInput, opts ...request.Option) (*CreateVpnGatewayOutput, error) { + req, out := c.CreateVpnGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCustomerGateway = "DeleteCustomerGateway" @@ -4137,8 +5014,23 @@ func (c *EC2) DeleteCustomerGatewayRequest(input *DeleteCustomerGatewayInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteCustomerGateway func (c *EC2) DeleteCustomerGateway(input *DeleteCustomerGatewayInput) (*DeleteCustomerGatewayOutput, error) { req, out := c.DeleteCustomerGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCustomerGatewayWithContext is the same as DeleteCustomerGateway with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCustomerGateway 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 *EC2) DeleteCustomerGatewayWithContext(ctx aws.Context, input *DeleteCustomerGatewayInput, opts ...request.Option) (*DeleteCustomerGatewayOutput, error) { + req, out := c.DeleteCustomerGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDhcpOptions = "DeleteDhcpOptions" @@ -4202,8 +5094,23 @@ func (c *EC2) DeleteDhcpOptionsRequest(input *DeleteDhcpOptionsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteDhcpOptions func (c *EC2) DeleteDhcpOptions(input *DeleteDhcpOptionsInput) (*DeleteDhcpOptionsOutput, error) { req, out := c.DeleteDhcpOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDhcpOptionsWithContext is the same as DeleteDhcpOptions with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDhcpOptions 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 *EC2) DeleteDhcpOptionsWithContext(ctx aws.Context, input *DeleteDhcpOptionsInput, opts ...request.Option) (*DeleteDhcpOptionsOutput, error) { + req, out := c.DeleteDhcpOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteEgressOnlyInternetGateway = "DeleteEgressOnlyInternetGateway" @@ -4262,8 +5169,23 @@ func (c *EC2) DeleteEgressOnlyInternetGatewayRequest(input *DeleteEgressOnlyInte // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteEgressOnlyInternetGateway func (c *EC2) DeleteEgressOnlyInternetGateway(input *DeleteEgressOnlyInternetGatewayInput) (*DeleteEgressOnlyInternetGatewayOutput, error) { req, out := c.DeleteEgressOnlyInternetGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEgressOnlyInternetGatewayWithContext is the same as DeleteEgressOnlyInternetGateway with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEgressOnlyInternetGateway 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 *EC2) DeleteEgressOnlyInternetGatewayWithContext(ctx aws.Context, input *DeleteEgressOnlyInternetGatewayInput, opts ...request.Option) (*DeleteEgressOnlyInternetGatewayOutput, error) { + req, out := c.DeleteEgressOnlyInternetGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteFlowLogs = "DeleteFlowLogs" @@ -4322,8 +5244,23 @@ func (c *EC2) DeleteFlowLogsRequest(input *DeleteFlowLogsInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteFlowLogs func (c *EC2) DeleteFlowLogs(input *DeleteFlowLogsInput) (*DeleteFlowLogsOutput, error) { req, out := c.DeleteFlowLogsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteFlowLogsWithContext is the same as DeleteFlowLogs with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteFlowLogs 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 *EC2) DeleteFlowLogsWithContext(ctx aws.Context, input *DeleteFlowLogsInput, opts ...request.Option) (*DeleteFlowLogsOutput, error) { + req, out := c.DeleteFlowLogsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteInternetGateway = "DeleteInternetGateway" @@ -4385,8 +5322,23 @@ func (c *EC2) DeleteInternetGatewayRequest(input *DeleteInternetGatewayInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteInternetGateway func (c *EC2) DeleteInternetGateway(input *DeleteInternetGatewayInput) (*DeleteInternetGatewayOutput, error) { req, out := c.DeleteInternetGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteInternetGatewayWithContext is the same as DeleteInternetGateway with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteInternetGateway 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 *EC2) DeleteInternetGatewayWithContext(ctx aws.Context, input *DeleteInternetGatewayInput, opts ...request.Option) (*DeleteInternetGatewayOutput, error) { + req, out := c.DeleteInternetGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteKeyPair = "DeleteKeyPair" @@ -4447,8 +5399,23 @@ func (c *EC2) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteKeyPair func (c *EC2) DeleteKeyPair(input *DeleteKeyPairInput) (*DeleteKeyPairOutput, error) { req, out := c.DeleteKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteKeyPairWithContext is the same as DeleteKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteKeyPair 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 *EC2) DeleteKeyPairWithContext(ctx aws.Context, input *DeleteKeyPairInput, opts ...request.Option) (*DeleteKeyPairOutput, error) { + req, out := c.DeleteKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteNatGateway = "DeleteNatGateway" @@ -4509,8 +5476,23 @@ func (c *EC2) DeleteNatGatewayRequest(input *DeleteNatGatewayInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteNatGateway func (c *EC2) DeleteNatGateway(input *DeleteNatGatewayInput) (*DeleteNatGatewayOutput, error) { req, out := c.DeleteNatGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteNatGatewayWithContext is the same as DeleteNatGateway with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteNatGateway 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 *EC2) DeleteNatGatewayWithContext(ctx aws.Context, input *DeleteNatGatewayInput, opts ...request.Option) (*DeleteNatGatewayOutput, error) { + req, out := c.DeleteNatGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteNetworkAcl = "DeleteNetworkAcl" @@ -4572,8 +5554,23 @@ func (c *EC2) DeleteNetworkAclRequest(input *DeleteNetworkAclInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteNetworkAcl func (c *EC2) DeleteNetworkAcl(input *DeleteNetworkAclInput) (*DeleteNetworkAclOutput, error) { req, out := c.DeleteNetworkAclRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteNetworkAclWithContext is the same as DeleteNetworkAcl with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteNetworkAcl 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 *EC2) DeleteNetworkAclWithContext(ctx aws.Context, input *DeleteNetworkAclInput, opts ...request.Option) (*DeleteNetworkAclOutput, error) { + req, out := c.DeleteNetworkAclRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteNetworkAclEntry = "DeleteNetworkAclEntry" @@ -4635,8 +5632,23 @@ func (c *EC2) DeleteNetworkAclEntryRequest(input *DeleteNetworkAclEntryInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteNetworkAclEntry func (c *EC2) DeleteNetworkAclEntry(input *DeleteNetworkAclEntryInput) (*DeleteNetworkAclEntryOutput, error) { req, out := c.DeleteNetworkAclEntryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteNetworkAclEntryWithContext is the same as DeleteNetworkAclEntry with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteNetworkAclEntry 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 *EC2) DeleteNetworkAclEntryWithContext(ctx aws.Context, input *DeleteNetworkAclEntryInput, opts ...request.Option) (*DeleteNetworkAclEntryOutput, error) { + req, out := c.DeleteNetworkAclEntryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteNetworkInterface = "DeleteNetworkInterface" @@ -4698,8 +5710,23 @@ func (c *EC2) DeleteNetworkInterfaceRequest(input *DeleteNetworkInterfaceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteNetworkInterface func (c *EC2) DeleteNetworkInterface(input *DeleteNetworkInterfaceInput) (*DeleteNetworkInterfaceOutput, error) { req, out := c.DeleteNetworkInterfaceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteNetworkInterfaceWithContext is the same as DeleteNetworkInterface with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteNetworkInterface 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 *EC2) DeleteNetworkInterfaceWithContext(ctx aws.Context, input *DeleteNetworkInterfaceInput, opts ...request.Option) (*DeleteNetworkInterfaceOutput, error) { + req, out := c.DeleteNetworkInterfaceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeletePlacementGroup = "DeletePlacementGroup" @@ -4763,8 +5790,23 @@ func (c *EC2) DeletePlacementGroupRequest(input *DeletePlacementGroupInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeletePlacementGroup func (c *EC2) DeletePlacementGroup(input *DeletePlacementGroupInput) (*DeletePlacementGroupOutput, error) { req, out := c.DeletePlacementGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeletePlacementGroupWithContext is the same as DeletePlacementGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePlacementGroup 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 *EC2) DeletePlacementGroupWithContext(ctx aws.Context, input *DeletePlacementGroupInput, opts ...request.Option) (*DeletePlacementGroupOutput, error) { + req, out := c.DeletePlacementGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRoute = "DeleteRoute" @@ -4825,8 +5867,23 @@ func (c *EC2) DeleteRouteRequest(input *DeleteRouteInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteRoute func (c *EC2) DeleteRoute(input *DeleteRouteInput) (*DeleteRouteOutput, error) { req, out := c.DeleteRouteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRouteWithContext is the same as DeleteRoute with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRoute 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 *EC2) DeleteRouteWithContext(ctx aws.Context, input *DeleteRouteInput, opts ...request.Option) (*DeleteRouteOutput, error) { + req, out := c.DeleteRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRouteTable = "DeleteRouteTable" @@ -4889,8 +5946,23 @@ func (c *EC2) DeleteRouteTableRequest(input *DeleteRouteTableInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteRouteTable func (c *EC2) DeleteRouteTable(input *DeleteRouteTableInput) (*DeleteRouteTableOutput, error) { req, out := c.DeleteRouteTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRouteTableWithContext is the same as DeleteRouteTable with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRouteTable 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 *EC2) DeleteRouteTableWithContext(ctx aws.Context, input *DeleteRouteTableInput, opts ...request.Option) (*DeleteRouteTableOutput, error) { + req, out := c.DeleteRouteTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSecurityGroup = "DeleteSecurityGroup" @@ -4955,8 +6027,23 @@ func (c *EC2) DeleteSecurityGroupRequest(input *DeleteSecurityGroupInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteSecurityGroup func (c *EC2) DeleteSecurityGroup(input *DeleteSecurityGroupInput) (*DeleteSecurityGroupOutput, error) { req, out := c.DeleteSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSecurityGroupWithContext is the same as DeleteSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSecurityGroup 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 *EC2) DeleteSecurityGroupWithContext(ctx aws.Context, input *DeleteSecurityGroupInput, opts ...request.Option) (*DeleteSecurityGroupOutput, error) { + req, out := c.DeleteSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSnapshot = "DeleteSnapshot" @@ -5031,8 +6118,23 @@ func (c *EC2) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteSnapshot func (c *EC2) DeleteSnapshot(input *DeleteSnapshotInput) (*DeleteSnapshotOutput, error) { req, out := c.DeleteSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSnapshotWithContext is the same as DeleteSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSnapshot 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 *EC2) DeleteSnapshotWithContext(ctx aws.Context, input *DeleteSnapshotInput, opts ...request.Option) (*DeleteSnapshotOutput, error) { + req, out := c.DeleteSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSpotDatafeedSubscription = "DeleteSpotDatafeedSubscription" @@ -5093,8 +6195,23 @@ func (c *EC2) DeleteSpotDatafeedSubscriptionRequest(input *DeleteSpotDatafeedSub // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteSpotDatafeedSubscription func (c *EC2) DeleteSpotDatafeedSubscription(input *DeleteSpotDatafeedSubscriptionInput) (*DeleteSpotDatafeedSubscriptionOutput, error) { req, out := c.DeleteSpotDatafeedSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSpotDatafeedSubscriptionWithContext is the same as DeleteSpotDatafeedSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSpotDatafeedSubscription 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 *EC2) DeleteSpotDatafeedSubscriptionWithContext(ctx aws.Context, input *DeleteSpotDatafeedSubscriptionInput, opts ...request.Option) (*DeleteSpotDatafeedSubscriptionOutput, error) { + req, out := c.DeleteSpotDatafeedSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSubnet = "DeleteSubnet" @@ -5156,8 +6273,23 @@ func (c *EC2) DeleteSubnetRequest(input *DeleteSubnetInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteSubnet func (c *EC2) DeleteSubnet(input *DeleteSubnetInput) (*DeleteSubnetOutput, error) { req, out := c.DeleteSubnetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSubnetWithContext is the same as DeleteSubnet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSubnet 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 *EC2) DeleteSubnetWithContext(ctx aws.Context, input *DeleteSubnetInput, opts ...request.Option) (*DeleteSubnetOutput, error) { + req, out := c.DeleteSubnetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTags = "DeleteTags" @@ -5222,8 +6354,23 @@ func (c *EC2) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteTags func (c *EC2) DeleteTags(input *DeleteTagsInput) (*DeleteTagsOutput, error) { req, out := c.DeleteTagsRequest(input) - err := req.Send() - return out, err + 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 *EC2) 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 opDeleteVolume = "DeleteVolume" @@ -5290,8 +6437,23 @@ func (c *EC2) DeleteVolumeRequest(input *DeleteVolumeInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteVolume func (c *EC2) DeleteVolume(input *DeleteVolumeInput) (*DeleteVolumeOutput, error) { req, out := c.DeleteVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVolumeWithContext is the same as DeleteVolume with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVolume 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 *EC2) DeleteVolumeWithContext(ctx aws.Context, input *DeleteVolumeInput, opts ...request.Option) (*DeleteVolumeOutput, error) { + req, out := c.DeleteVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVpc = "DeleteVpc" @@ -5356,8 +6518,23 @@ func (c *EC2) DeleteVpcRequest(input *DeleteVpcInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteVpc func (c *EC2) DeleteVpc(input *DeleteVpcInput) (*DeleteVpcOutput, error) { req, out := c.DeleteVpcRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVpcWithContext is the same as DeleteVpc with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVpc 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 *EC2) DeleteVpcWithContext(ctx aws.Context, input *DeleteVpcInput, opts ...request.Option) (*DeleteVpcOutput, error) { + req, out := c.DeleteVpcRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVpcEndpoints = "DeleteVpcEndpoints" @@ -5417,8 +6594,23 @@ func (c *EC2) DeleteVpcEndpointsRequest(input *DeleteVpcEndpointsInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteVpcEndpoints func (c *EC2) DeleteVpcEndpoints(input *DeleteVpcEndpointsInput) (*DeleteVpcEndpointsOutput, error) { req, out := c.DeleteVpcEndpointsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVpcEndpointsWithContext is the same as DeleteVpcEndpoints with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVpcEndpoints 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 *EC2) DeleteVpcEndpointsWithContext(ctx aws.Context, input *DeleteVpcEndpointsInput, opts ...request.Option) (*DeleteVpcEndpointsOutput, error) { + req, out := c.DeleteVpcEndpointsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVpcPeeringConnection = "DeleteVpcPeeringConnection" @@ -5480,8 +6672,23 @@ func (c *EC2) DeleteVpcPeeringConnectionRequest(input *DeleteVpcPeeringConnectio // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteVpcPeeringConnection func (c *EC2) DeleteVpcPeeringConnection(input *DeleteVpcPeeringConnectionInput) (*DeleteVpcPeeringConnectionOutput, error) { req, out := c.DeleteVpcPeeringConnectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVpcPeeringConnectionWithContext is the same as DeleteVpcPeeringConnection with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVpcPeeringConnection 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 *EC2) DeleteVpcPeeringConnectionWithContext(ctx aws.Context, input *DeleteVpcPeeringConnectionInput, opts ...request.Option) (*DeleteVpcPeeringConnectionOutput, error) { + req, out := c.DeleteVpcPeeringConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVpnConnection = "DeleteVpnConnection" @@ -5551,8 +6758,23 @@ func (c *EC2) DeleteVpnConnectionRequest(input *DeleteVpnConnectionInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteVpnConnection func (c *EC2) DeleteVpnConnection(input *DeleteVpnConnectionInput) (*DeleteVpnConnectionOutput, error) { req, out := c.DeleteVpnConnectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVpnConnectionWithContext is the same as DeleteVpnConnection with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVpnConnection 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 *EC2) DeleteVpnConnectionWithContext(ctx aws.Context, input *DeleteVpnConnectionInput, opts ...request.Option) (*DeleteVpnConnectionOutput, error) { + req, out := c.DeleteVpnConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVpnConnectionRoute = "DeleteVpnConnectionRoute" @@ -5616,8 +6838,23 @@ func (c *EC2) DeleteVpnConnectionRouteRequest(input *DeleteVpnConnectionRouteInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteVpnConnectionRoute func (c *EC2) DeleteVpnConnectionRoute(input *DeleteVpnConnectionRouteInput) (*DeleteVpnConnectionRouteOutput, error) { req, out := c.DeleteVpnConnectionRouteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVpnConnectionRouteWithContext is the same as DeleteVpnConnectionRoute with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVpnConnectionRoute 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 *EC2) DeleteVpnConnectionRouteWithContext(ctx aws.Context, input *DeleteVpnConnectionRouteInput, opts ...request.Option) (*DeleteVpnConnectionRouteOutput, error) { + req, out := c.DeleteVpnConnectionRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVpnGateway = "DeleteVpnGateway" @@ -5682,8 +6919,23 @@ func (c *EC2) DeleteVpnGatewayRequest(input *DeleteVpnGatewayInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteVpnGateway func (c *EC2) DeleteVpnGateway(input *DeleteVpnGatewayInput) (*DeleteVpnGatewayOutput, error) { req, out := c.DeleteVpnGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVpnGatewayWithContext is the same as DeleteVpnGateway with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVpnGateway 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 *EC2) DeleteVpnGatewayWithContext(ctx aws.Context, input *DeleteVpnGatewayInput, opts ...request.Option) (*DeleteVpnGatewayOutput, error) { + req, out := c.DeleteVpnGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterImage = "DeregisterImage" @@ -5747,8 +6999,23 @@ func (c *EC2) DeregisterImageRequest(input *DeregisterImageInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeregisterImage func (c *EC2) DeregisterImage(input *DeregisterImageInput) (*DeregisterImageOutput, error) { req, out := c.DeregisterImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterImageWithContext is the same as DeregisterImage with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterImage 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 *EC2) DeregisterImageWithContext(ctx aws.Context, input *DeregisterImageInput, opts ...request.Option) (*DeregisterImageOutput, error) { + req, out := c.DeregisterImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAccountAttributes = "DescribeAccountAttributes" @@ -5825,8 +7092,23 @@ func (c *EC2) DescribeAccountAttributesRequest(input *DescribeAccountAttributesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeAccountAttributes func (c *EC2) DescribeAccountAttributes(input *DescribeAccountAttributesInput) (*DescribeAccountAttributesOutput, error) { req, out := c.DescribeAccountAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAccountAttributesWithContext is the same as DescribeAccountAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAccountAttributes 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 *EC2) DescribeAccountAttributesWithContext(ctx aws.Context, input *DescribeAccountAttributesInput, opts ...request.Option) (*DescribeAccountAttributesOutput, error) { + req, out := c.DescribeAccountAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAddresses = "DescribeAddresses" @@ -5889,8 +7171,23 @@ func (c *EC2) DescribeAddressesRequest(input *DescribeAddressesInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeAddresses func (c *EC2) DescribeAddresses(input *DescribeAddressesInput) (*DescribeAddressesOutput, error) { req, out := c.DescribeAddressesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAddressesWithContext is the same as DescribeAddresses with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAddresses 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 *EC2) DescribeAddressesWithContext(ctx aws.Context, input *DescribeAddressesInput, opts ...request.Option) (*DescribeAddressesOutput, error) { + req, out := c.DescribeAddressesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAvailabilityZones = "DescribeAvailabilityZones" @@ -5955,8 +7252,23 @@ func (c *EC2) DescribeAvailabilityZonesRequest(input *DescribeAvailabilityZonesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeAvailabilityZones func (c *EC2) DescribeAvailabilityZones(input *DescribeAvailabilityZonesInput) (*DescribeAvailabilityZonesOutput, error) { req, out := c.DescribeAvailabilityZonesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAvailabilityZonesWithContext is the same as DescribeAvailabilityZones with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAvailabilityZones 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 *EC2) DescribeAvailabilityZonesWithContext(ctx aws.Context, input *DescribeAvailabilityZonesInput, opts ...request.Option) (*DescribeAvailabilityZonesOutput, error) { + req, out := c.DescribeAvailabilityZonesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeBundleTasks = "DescribeBundleTasks" @@ -6020,8 +7332,23 @@ func (c *EC2) DescribeBundleTasksRequest(input *DescribeBundleTasksInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeBundleTasks func (c *EC2) DescribeBundleTasks(input *DescribeBundleTasksInput) (*DescribeBundleTasksOutput, error) { req, out := c.DescribeBundleTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeBundleTasksWithContext is the same as DescribeBundleTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeBundleTasks 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 *EC2) DescribeBundleTasksWithContext(ctx aws.Context, input *DescribeBundleTasksInput, opts ...request.Option) (*DescribeBundleTasksOutput, error) { + req, out := c.DescribeBundleTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeClassicLinkInstances = "DescribeClassicLinkInstances" @@ -6083,8 +7410,23 @@ func (c *EC2) DescribeClassicLinkInstancesRequest(input *DescribeClassicLinkInst // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeClassicLinkInstances func (c *EC2) DescribeClassicLinkInstances(input *DescribeClassicLinkInstancesInput) (*DescribeClassicLinkInstancesOutput, error) { req, out := c.DescribeClassicLinkInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClassicLinkInstancesWithContext is the same as DescribeClassicLinkInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClassicLinkInstances 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 *EC2) DescribeClassicLinkInstancesWithContext(ctx aws.Context, input *DescribeClassicLinkInstancesInput, opts ...request.Option) (*DescribeClassicLinkInstancesOutput, error) { + req, out := c.DescribeClassicLinkInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConversionTasks = "DescribeConversionTasks" @@ -6147,8 +7489,23 @@ func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeConversionTasks func (c *EC2) DescribeConversionTasks(input *DescribeConversionTasksInput) (*DescribeConversionTasksOutput, error) { req, out := c.DescribeConversionTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConversionTasksWithContext is the same as DescribeConversionTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConversionTasks 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 *EC2) DescribeConversionTasksWithContext(ctx aws.Context, input *DescribeConversionTasksInput, opts ...request.Option) (*DescribeConversionTasksOutput, error) { + req, out := c.DescribeConversionTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCustomerGateways = "DescribeCustomerGateways" @@ -6211,8 +7568,23 @@ func (c *EC2) DescribeCustomerGatewaysRequest(input *DescribeCustomerGatewaysInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeCustomerGateways func (c *EC2) DescribeCustomerGateways(input *DescribeCustomerGatewaysInput) (*DescribeCustomerGatewaysOutput, error) { req, out := c.DescribeCustomerGatewaysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCustomerGatewaysWithContext is the same as DescribeCustomerGateways with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCustomerGateways 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 *EC2) DescribeCustomerGatewaysWithContext(ctx aws.Context, input *DescribeCustomerGatewaysInput, opts ...request.Option) (*DescribeCustomerGatewaysOutput, error) { + req, out := c.DescribeCustomerGatewaysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDhcpOptions = "DescribeDhcpOptions" @@ -6274,8 +7646,23 @@ func (c *EC2) DescribeDhcpOptionsRequest(input *DescribeDhcpOptionsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeDhcpOptions func (c *EC2) DescribeDhcpOptions(input *DescribeDhcpOptionsInput) (*DescribeDhcpOptionsOutput, error) { req, out := c.DescribeDhcpOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDhcpOptionsWithContext is the same as DescribeDhcpOptions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDhcpOptions 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 *EC2) DescribeDhcpOptionsWithContext(ctx aws.Context, input *DescribeDhcpOptionsInput, opts ...request.Option) (*DescribeDhcpOptionsOutput, error) { + req, out := c.DescribeDhcpOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEgressOnlyInternetGateways = "DescribeEgressOnlyInternetGateways" @@ -6334,8 +7721,23 @@ func (c *EC2) DescribeEgressOnlyInternetGatewaysRequest(input *DescribeEgressOnl // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeEgressOnlyInternetGateways func (c *EC2) DescribeEgressOnlyInternetGateways(input *DescribeEgressOnlyInternetGatewaysInput) (*DescribeEgressOnlyInternetGatewaysOutput, error) { req, out := c.DescribeEgressOnlyInternetGatewaysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEgressOnlyInternetGatewaysWithContext is the same as DescribeEgressOnlyInternetGateways with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEgressOnlyInternetGateways 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 *EC2) DescribeEgressOnlyInternetGatewaysWithContext(ctx aws.Context, input *DescribeEgressOnlyInternetGatewaysInput, opts ...request.Option) (*DescribeEgressOnlyInternetGatewaysOutput, error) { + req, out := c.DescribeEgressOnlyInternetGatewaysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeExportTasks = "DescribeExportTasks" @@ -6394,8 +7796,23 @@ func (c *EC2) DescribeExportTasksRequest(input *DescribeExportTasksInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeExportTasks func (c *EC2) DescribeExportTasks(input *DescribeExportTasksInput) (*DescribeExportTasksOutput, error) { req, out := c.DescribeExportTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeExportTasksWithContext is the same as DescribeExportTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeExportTasks 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 *EC2) DescribeExportTasksWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.Option) (*DescribeExportTasksOutput, error) { + req, out := c.DescribeExportTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeFlowLogs = "DescribeFlowLogs" @@ -6456,8 +7873,23 @@ func (c *EC2) DescribeFlowLogsRequest(input *DescribeFlowLogsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeFlowLogs func (c *EC2) DescribeFlowLogs(input *DescribeFlowLogsInput) (*DescribeFlowLogsOutput, error) { req, out := c.DescribeFlowLogsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeFlowLogsWithContext is the same as DescribeFlowLogs with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeFlowLogs 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 *EC2) DescribeFlowLogsWithContext(ctx aws.Context, input *DescribeFlowLogsInput, opts ...request.Option) (*DescribeFlowLogsOutput, error) { + req, out := c.DescribeFlowLogsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeHostReservationOfferings = "DescribeHostReservationOfferings" @@ -6524,8 +7956,23 @@ func (c *EC2) DescribeHostReservationOfferingsRequest(input *DescribeHostReserva // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeHostReservationOfferings func (c *EC2) DescribeHostReservationOfferings(input *DescribeHostReservationOfferingsInput) (*DescribeHostReservationOfferingsOutput, error) { req, out := c.DescribeHostReservationOfferingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeHostReservationOfferingsWithContext is the same as DescribeHostReservationOfferings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeHostReservationOfferings 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 *EC2) DescribeHostReservationOfferingsWithContext(ctx aws.Context, input *DescribeHostReservationOfferingsInput, opts ...request.Option) (*DescribeHostReservationOfferingsOutput, error) { + req, out := c.DescribeHostReservationOfferingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeHostReservations = "DescribeHostReservations" @@ -6585,8 +8032,23 @@ func (c *EC2) DescribeHostReservationsRequest(input *DescribeHostReservationsInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeHostReservations func (c *EC2) DescribeHostReservations(input *DescribeHostReservationsInput) (*DescribeHostReservationsOutput, error) { req, out := c.DescribeHostReservationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeHostReservationsWithContext is the same as DescribeHostReservations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeHostReservations 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 *EC2) DescribeHostReservationsWithContext(ctx aws.Context, input *DescribeHostReservationsInput, opts ...request.Option) (*DescribeHostReservationsOutput, error) { + req, out := c.DescribeHostReservationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeHosts = "DescribeHosts" @@ -6649,8 +8111,23 @@ func (c *EC2) DescribeHostsRequest(input *DescribeHostsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeHosts func (c *EC2) DescribeHosts(input *DescribeHostsInput) (*DescribeHostsOutput, error) { req, out := c.DescribeHostsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeHostsWithContext is the same as DescribeHosts with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeHosts 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 *EC2) DescribeHostsWithContext(ctx aws.Context, input *DescribeHostsInput, opts ...request.Option) (*DescribeHostsOutput, error) { + req, out := c.DescribeHostsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeIamInstanceProfileAssociations = "DescribeIamInstanceProfileAssociations" @@ -6709,8 +8186,23 @@ func (c *EC2) DescribeIamInstanceProfileAssociationsRequest(input *DescribeIamIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeIamInstanceProfileAssociations func (c *EC2) DescribeIamInstanceProfileAssociations(input *DescribeIamInstanceProfileAssociationsInput) (*DescribeIamInstanceProfileAssociationsOutput, error) { req, out := c.DescribeIamInstanceProfileAssociationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeIamInstanceProfileAssociationsWithContext is the same as DescribeIamInstanceProfileAssociations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeIamInstanceProfileAssociations 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 *EC2) DescribeIamInstanceProfileAssociationsWithContext(ctx aws.Context, input *DescribeIamInstanceProfileAssociationsInput, opts ...request.Option) (*DescribeIamInstanceProfileAssociationsOutput, error) { + req, out := c.DescribeIamInstanceProfileAssociationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeIdFormat = "DescribeIdFormat" @@ -6782,8 +8274,23 @@ func (c *EC2) DescribeIdFormatRequest(input *DescribeIdFormatInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeIdFormat func (c *EC2) DescribeIdFormat(input *DescribeIdFormatInput) (*DescribeIdFormatOutput, error) { req, out := c.DescribeIdFormatRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeIdFormatWithContext is the same as DescribeIdFormat with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeIdFormat 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 *EC2) DescribeIdFormatWithContext(ctx aws.Context, input *DescribeIdFormatInput, opts ...request.Option) (*DescribeIdFormatOutput, error) { + req, out := c.DescribeIdFormatRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeIdentityIdFormat = "DescribeIdentityIdFormat" @@ -6853,8 +8360,23 @@ func (c *EC2) DescribeIdentityIdFormatRequest(input *DescribeIdentityIdFormatInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeIdentityIdFormat func (c *EC2) DescribeIdentityIdFormat(input *DescribeIdentityIdFormatInput) (*DescribeIdentityIdFormatOutput, error) { req, out := c.DescribeIdentityIdFormatRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeIdentityIdFormatWithContext is the same as DescribeIdentityIdFormat with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeIdentityIdFormat 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 *EC2) DescribeIdentityIdFormatWithContext(ctx aws.Context, input *DescribeIdentityIdFormatInput, opts ...request.Option) (*DescribeIdentityIdFormatOutput, error) { + req, out := c.DescribeIdentityIdFormatRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeImageAttribute = "DescribeImageAttribute" @@ -6914,8 +8436,23 @@ func (c *EC2) DescribeImageAttributeRequest(input *DescribeImageAttributeInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeImageAttribute func (c *EC2) DescribeImageAttribute(input *DescribeImageAttributeInput) (*DescribeImageAttributeOutput, error) { req, out := c.DescribeImageAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeImageAttributeWithContext is the same as DescribeImageAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeImageAttribute 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 *EC2) DescribeImageAttributeWithContext(ctx aws.Context, input *DescribeImageAttributeInput, opts ...request.Option) (*DescribeImageAttributeOutput, error) { + req, out := c.DescribeImageAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeImages = "DescribeImages" @@ -6980,8 +8517,23 @@ func (c *EC2) DescribeImagesRequest(input *DescribeImagesInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeImages func (c *EC2) DescribeImages(input *DescribeImagesInput) (*DescribeImagesOutput, error) { req, out := c.DescribeImagesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeImagesWithContext is the same as DescribeImages with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeImages 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 *EC2) DescribeImagesWithContext(ctx aws.Context, input *DescribeImagesInput, opts ...request.Option) (*DescribeImagesOutput, error) { + req, out := c.DescribeImagesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeImportImageTasks = "DescribeImportImageTasks" @@ -7041,8 +8593,23 @@ func (c *EC2) DescribeImportImageTasksRequest(input *DescribeImportImageTasksInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeImportImageTasks func (c *EC2) DescribeImportImageTasks(input *DescribeImportImageTasksInput) (*DescribeImportImageTasksOutput, error) { req, out := c.DescribeImportImageTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeImportImageTasksWithContext is the same as DescribeImportImageTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeImportImageTasks 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 *EC2) DescribeImportImageTasksWithContext(ctx aws.Context, input *DescribeImportImageTasksInput, opts ...request.Option) (*DescribeImportImageTasksOutput, error) { + req, out := c.DescribeImportImageTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeImportSnapshotTasks = "DescribeImportSnapshotTasks" @@ -7101,8 +8668,23 @@ func (c *EC2) DescribeImportSnapshotTasksRequest(input *DescribeImportSnapshotTa // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeImportSnapshotTasks func (c *EC2) DescribeImportSnapshotTasks(input *DescribeImportSnapshotTasksInput) (*DescribeImportSnapshotTasksOutput, error) { req, out := c.DescribeImportSnapshotTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeImportSnapshotTasksWithContext is the same as DescribeImportSnapshotTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeImportSnapshotTasks 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 *EC2) DescribeImportSnapshotTasksWithContext(ctx aws.Context, input *DescribeImportSnapshotTasksInput, opts ...request.Option) (*DescribeImportSnapshotTasksOutput, error) { + req, out := c.DescribeImportSnapshotTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeInstanceAttribute = "DescribeInstanceAttribute" @@ -7165,8 +8747,23 @@ func (c *EC2) DescribeInstanceAttributeRequest(input *DescribeInstanceAttributeI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeInstanceAttribute func (c *EC2) DescribeInstanceAttribute(input *DescribeInstanceAttributeInput) (*DescribeInstanceAttributeOutput, error) { req, out := c.DescribeInstanceAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstanceAttributeWithContext is the same as DescribeInstanceAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstanceAttribute 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 *EC2) DescribeInstanceAttributeWithContext(ctx aws.Context, input *DescribeInstanceAttributeInput, opts ...request.Option) (*DescribeInstanceAttributeOutput, error) { + req, out := c.DescribeInstanceAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeInstanceStatus = "DescribeInstanceStatus" @@ -7251,8 +8848,23 @@ func (c *EC2) DescribeInstanceStatusRequest(input *DescribeInstanceStatusInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeInstanceStatus func (c *EC2) DescribeInstanceStatus(input *DescribeInstanceStatusInput) (*DescribeInstanceStatusOutput, error) { req, out := c.DescribeInstanceStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstanceStatusWithContext is the same as DescribeInstanceStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstanceStatus 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 *EC2) DescribeInstanceStatusWithContext(ctx aws.Context, input *DescribeInstanceStatusInput, opts ...request.Option) (*DescribeInstanceStatusOutput, error) { + req, out := c.DescribeInstanceStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeInstanceStatusPages iterates over the pages of a DescribeInstanceStatus operation, @@ -7272,12 +8884,37 @@ func (c *EC2) DescribeInstanceStatus(input *DescribeInstanceStatusInput) (*Descr // return pageNum <= 3 // }) // -func (c *EC2) DescribeInstanceStatusPages(input *DescribeInstanceStatusInput, fn func(p *DescribeInstanceStatusOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeInstanceStatusRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeInstanceStatusOutput), lastPage) - }) +func (c *EC2) DescribeInstanceStatusPages(input *DescribeInstanceStatusInput, fn func(*DescribeInstanceStatusOutput, bool) bool) error { + return c.DescribeInstanceStatusPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeInstanceStatusPagesWithContext same as DescribeInstanceStatusPages 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 *EC2) DescribeInstanceStatusPagesWithContext(ctx aws.Context, input *DescribeInstanceStatusInput, fn func(*DescribeInstanceStatusOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeInstanceStatusInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstanceStatusRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeInstanceStatusOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeInstances = "DescribeInstances" @@ -7357,8 +8994,23 @@ func (c *EC2) DescribeInstancesRequest(input *DescribeInstancesInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeInstances func (c *EC2) DescribeInstances(input *DescribeInstancesInput) (*DescribeInstancesOutput, error) { req, out := c.DescribeInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstancesWithContext is the same as DescribeInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstances 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 *EC2) DescribeInstancesWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.Option) (*DescribeInstancesOutput, error) { + req, out := c.DescribeInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeInstancesPages iterates over the pages of a DescribeInstances operation, @@ -7378,12 +9030,37 @@ func (c *EC2) DescribeInstances(input *DescribeInstancesInput) (*DescribeInstanc // return pageNum <= 3 // }) // -func (c *EC2) DescribeInstancesPages(input *DescribeInstancesInput, fn func(p *DescribeInstancesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeInstancesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeInstancesOutput), lastPage) - }) +func (c *EC2) DescribeInstancesPages(input *DescribeInstancesInput, fn func(*DescribeInstancesOutput, bool) bool) error { + return c.DescribeInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeInstancesPagesWithContext same as DescribeInstancesPages 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 *EC2) DescribeInstancesPagesWithContext(ctx aws.Context, input *DescribeInstancesInput, fn func(*DescribeInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeInstancesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeInternetGateways = "DescribeInternetGateways" @@ -7442,8 +9119,23 @@ func (c *EC2) DescribeInternetGatewaysRequest(input *DescribeInternetGatewaysInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeInternetGateways func (c *EC2) DescribeInternetGateways(input *DescribeInternetGatewaysInput) (*DescribeInternetGatewaysOutput, error) { req, out := c.DescribeInternetGatewaysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInternetGatewaysWithContext is the same as DescribeInternetGateways with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInternetGateways 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 *EC2) DescribeInternetGatewaysWithContext(ctx aws.Context, input *DescribeInternetGatewaysInput, opts ...request.Option) (*DescribeInternetGatewaysOutput, error) { + req, out := c.DescribeInternetGatewaysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeKeyPairs = "DescribeKeyPairs" @@ -7505,8 +9197,23 @@ func (c *EC2) DescribeKeyPairsRequest(input *DescribeKeyPairsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeKeyPairs func (c *EC2) DescribeKeyPairs(input *DescribeKeyPairsInput) (*DescribeKeyPairsOutput, error) { req, out := c.DescribeKeyPairsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeKeyPairsWithContext is the same as DescribeKeyPairs with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeKeyPairs 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 *EC2) DescribeKeyPairsWithContext(ctx aws.Context, input *DescribeKeyPairsInput, opts ...request.Option) (*DescribeKeyPairsOutput, error) { + req, out := c.DescribeKeyPairsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMovingAddresses = "DescribeMovingAddresses" @@ -7567,8 +9274,23 @@ func (c *EC2) DescribeMovingAddressesRequest(input *DescribeMovingAddressesInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeMovingAddresses func (c *EC2) DescribeMovingAddresses(input *DescribeMovingAddressesInput) (*DescribeMovingAddressesOutput, error) { req, out := c.DescribeMovingAddressesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMovingAddressesWithContext is the same as DescribeMovingAddresses with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMovingAddresses 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 *EC2) DescribeMovingAddressesWithContext(ctx aws.Context, input *DescribeMovingAddressesInput, opts ...request.Option) (*DescribeMovingAddressesOutput, error) { + req, out := c.DescribeMovingAddressesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeNatGateways = "DescribeNatGateways" @@ -7633,8 +9355,23 @@ func (c *EC2) DescribeNatGatewaysRequest(input *DescribeNatGatewaysInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeNatGateways func (c *EC2) DescribeNatGateways(input *DescribeNatGatewaysInput) (*DescribeNatGatewaysOutput, error) { req, out := c.DescribeNatGatewaysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeNatGatewaysWithContext is the same as DescribeNatGateways with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeNatGateways 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 *EC2) DescribeNatGatewaysWithContext(ctx aws.Context, input *DescribeNatGatewaysInput, opts ...request.Option) (*DescribeNatGatewaysOutput, error) { + req, out := c.DescribeNatGatewaysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeNatGatewaysPages iterates over the pages of a DescribeNatGateways operation, @@ -7654,12 +9391,37 @@ func (c *EC2) DescribeNatGateways(input *DescribeNatGatewaysInput) (*DescribeNat // return pageNum <= 3 // }) // -func (c *EC2) DescribeNatGatewaysPages(input *DescribeNatGatewaysInput, fn func(p *DescribeNatGatewaysOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeNatGatewaysRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeNatGatewaysOutput), lastPage) - }) +func (c *EC2) DescribeNatGatewaysPages(input *DescribeNatGatewaysInput, fn func(*DescribeNatGatewaysOutput, bool) bool) error { + return c.DescribeNatGatewaysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeNatGatewaysPagesWithContext same as DescribeNatGatewaysPages 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 *EC2) DescribeNatGatewaysPagesWithContext(ctx aws.Context, input *DescribeNatGatewaysInput, fn func(*DescribeNatGatewaysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeNatGatewaysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeNatGatewaysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeNatGatewaysOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeNetworkAcls = "DescribeNetworkAcls" @@ -7721,8 +9483,23 @@ func (c *EC2) DescribeNetworkAclsRequest(input *DescribeNetworkAclsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeNetworkAcls func (c *EC2) DescribeNetworkAcls(input *DescribeNetworkAclsInput) (*DescribeNetworkAclsOutput, error) { req, out := c.DescribeNetworkAclsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeNetworkAclsWithContext is the same as DescribeNetworkAcls with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeNetworkAcls 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 *EC2) DescribeNetworkAclsWithContext(ctx aws.Context, input *DescribeNetworkAclsInput, opts ...request.Option) (*DescribeNetworkAclsOutput, error) { + req, out := c.DescribeNetworkAclsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeNetworkInterfaceAttribute = "DescribeNetworkInterfaceAttribute" @@ -7782,8 +9559,23 @@ func (c *EC2) DescribeNetworkInterfaceAttributeRequest(input *DescribeNetworkInt // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeNetworkInterfaceAttribute func (c *EC2) DescribeNetworkInterfaceAttribute(input *DescribeNetworkInterfaceAttributeInput) (*DescribeNetworkInterfaceAttributeOutput, error) { req, out := c.DescribeNetworkInterfaceAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeNetworkInterfaceAttributeWithContext is the same as DescribeNetworkInterfaceAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeNetworkInterfaceAttribute 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 *EC2) DescribeNetworkInterfaceAttributeWithContext(ctx aws.Context, input *DescribeNetworkInterfaceAttributeInput, opts ...request.Option) (*DescribeNetworkInterfaceAttributeOutput, error) { + req, out := c.DescribeNetworkInterfaceAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeNetworkInterfaces = "DescribeNetworkInterfaces" @@ -7842,8 +9634,23 @@ func (c *EC2) DescribeNetworkInterfacesRequest(input *DescribeNetworkInterfacesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeNetworkInterfaces func (c *EC2) DescribeNetworkInterfaces(input *DescribeNetworkInterfacesInput) (*DescribeNetworkInterfacesOutput, error) { req, out := c.DescribeNetworkInterfacesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeNetworkInterfacesWithContext is the same as DescribeNetworkInterfaces with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeNetworkInterfaces 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 *EC2) DescribeNetworkInterfacesWithContext(ctx aws.Context, input *DescribeNetworkInterfacesInput, opts ...request.Option) (*DescribeNetworkInterfacesOutput, error) { + req, out := c.DescribeNetworkInterfacesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribePlacementGroups = "DescribePlacementGroups" @@ -7904,8 +9711,23 @@ func (c *EC2) DescribePlacementGroupsRequest(input *DescribePlacementGroupsInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribePlacementGroups func (c *EC2) DescribePlacementGroups(input *DescribePlacementGroupsInput) (*DescribePlacementGroupsOutput, error) { req, out := c.DescribePlacementGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribePlacementGroupsWithContext is the same as DescribePlacementGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePlacementGroups 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 *EC2) DescribePlacementGroupsWithContext(ctx aws.Context, input *DescribePlacementGroupsInput, opts ...request.Option) (*DescribePlacementGroupsOutput, error) { + req, out := c.DescribePlacementGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribePrefixLists = "DescribePrefixLists" @@ -7968,8 +9790,23 @@ func (c *EC2) DescribePrefixListsRequest(input *DescribePrefixListsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribePrefixLists func (c *EC2) DescribePrefixLists(input *DescribePrefixListsInput) (*DescribePrefixListsOutput, error) { req, out := c.DescribePrefixListsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribePrefixListsWithContext is the same as DescribePrefixLists with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePrefixLists 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 *EC2) DescribePrefixListsWithContext(ctx aws.Context, input *DescribePrefixListsInput, opts ...request.Option) (*DescribePrefixListsOutput, error) { + req, out := c.DescribePrefixListsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeRegions = "DescribeRegions" @@ -8031,8 +9868,23 @@ func (c *EC2) DescribeRegionsRequest(input *DescribeRegionsInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeRegions func (c *EC2) DescribeRegions(input *DescribeRegionsInput) (*DescribeRegionsOutput, error) { req, out := c.DescribeRegionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRegionsWithContext is the same as DescribeRegions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRegions 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 *EC2) DescribeRegionsWithContext(ctx aws.Context, input *DescribeRegionsInput, opts ...request.Option) (*DescribeRegionsOutput, error) { + req, out := c.DescribeRegionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReservedInstances = "DescribeReservedInstances" @@ -8094,8 +9946,23 @@ func (c *EC2) DescribeReservedInstancesRequest(input *DescribeReservedInstancesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeReservedInstances func (c *EC2) DescribeReservedInstances(input *DescribeReservedInstancesInput) (*DescribeReservedInstancesOutput, error) { req, out := c.DescribeReservedInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedInstancesWithContext is the same as DescribeReservedInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedInstances 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 *EC2) DescribeReservedInstancesWithContext(ctx aws.Context, input *DescribeReservedInstancesInput, opts ...request.Option) (*DescribeReservedInstancesOutput, error) { + req, out := c.DescribeReservedInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReservedInstancesListings = "DescribeReservedInstancesListings" @@ -8175,8 +10042,23 @@ func (c *EC2) DescribeReservedInstancesListingsRequest(input *DescribeReservedIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeReservedInstancesListings func (c *EC2) DescribeReservedInstancesListings(input *DescribeReservedInstancesListingsInput) (*DescribeReservedInstancesListingsOutput, error) { req, out := c.DescribeReservedInstancesListingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedInstancesListingsWithContext is the same as DescribeReservedInstancesListings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedInstancesListings 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 *EC2) DescribeReservedInstancesListingsWithContext(ctx aws.Context, input *DescribeReservedInstancesListingsInput, opts ...request.Option) (*DescribeReservedInstancesListingsOutput, error) { + req, out := c.DescribeReservedInstancesListingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReservedInstancesModifications = "DescribeReservedInstancesModifications" @@ -8247,8 +10129,23 @@ func (c *EC2) DescribeReservedInstancesModificationsRequest(input *DescribeReser // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeReservedInstancesModifications func (c *EC2) DescribeReservedInstancesModifications(input *DescribeReservedInstancesModificationsInput) (*DescribeReservedInstancesModificationsOutput, error) { req, out := c.DescribeReservedInstancesModificationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedInstancesModificationsWithContext is the same as DescribeReservedInstancesModifications with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedInstancesModifications 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 *EC2) DescribeReservedInstancesModificationsWithContext(ctx aws.Context, input *DescribeReservedInstancesModificationsInput, opts ...request.Option) (*DescribeReservedInstancesModificationsOutput, error) { + req, out := c.DescribeReservedInstancesModificationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedInstancesModificationsPages iterates over the pages of a DescribeReservedInstancesModifications operation, @@ -8268,12 +10165,37 @@ func (c *EC2) DescribeReservedInstancesModifications(input *DescribeReservedInst // return pageNum <= 3 // }) // -func (c *EC2) DescribeReservedInstancesModificationsPages(input *DescribeReservedInstancesModificationsInput, fn func(p *DescribeReservedInstancesModificationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedInstancesModificationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedInstancesModificationsOutput), lastPage) - }) +func (c *EC2) DescribeReservedInstancesModificationsPages(input *DescribeReservedInstancesModificationsInput, fn func(*DescribeReservedInstancesModificationsOutput, bool) bool) error { + return c.DescribeReservedInstancesModificationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedInstancesModificationsPagesWithContext same as DescribeReservedInstancesModificationsPages 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 *EC2) DescribeReservedInstancesModificationsPagesWithContext(ctx aws.Context, input *DescribeReservedInstancesModificationsInput, fn func(*DescribeReservedInstancesModificationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedInstancesModificationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedInstancesModificationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedInstancesModificationsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeReservedInstancesOfferings = "DescribeReservedInstancesOfferings" @@ -8349,8 +10271,23 @@ func (c *EC2) DescribeReservedInstancesOfferingsRequest(input *DescribeReservedI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeReservedInstancesOfferings func (c *EC2) DescribeReservedInstancesOfferings(input *DescribeReservedInstancesOfferingsInput) (*DescribeReservedInstancesOfferingsOutput, error) { req, out := c.DescribeReservedInstancesOfferingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedInstancesOfferingsWithContext is the same as DescribeReservedInstancesOfferings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedInstancesOfferings 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 *EC2) DescribeReservedInstancesOfferingsWithContext(ctx aws.Context, input *DescribeReservedInstancesOfferingsInput, opts ...request.Option) (*DescribeReservedInstancesOfferingsOutput, error) { + req, out := c.DescribeReservedInstancesOfferingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedInstancesOfferingsPages iterates over the pages of a DescribeReservedInstancesOfferings operation, @@ -8370,12 +10307,37 @@ func (c *EC2) DescribeReservedInstancesOfferings(input *DescribeReservedInstance // return pageNum <= 3 // }) // -func (c *EC2) DescribeReservedInstancesOfferingsPages(input *DescribeReservedInstancesOfferingsInput, fn func(p *DescribeReservedInstancesOfferingsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedInstancesOfferingsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedInstancesOfferingsOutput), lastPage) - }) +func (c *EC2) DescribeReservedInstancesOfferingsPages(input *DescribeReservedInstancesOfferingsInput, fn func(*DescribeReservedInstancesOfferingsOutput, bool) bool) error { + return c.DescribeReservedInstancesOfferingsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedInstancesOfferingsPagesWithContext same as DescribeReservedInstancesOfferingsPages 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 *EC2) DescribeReservedInstancesOfferingsPagesWithContext(ctx aws.Context, input *DescribeReservedInstancesOfferingsInput, fn func(*DescribeReservedInstancesOfferingsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedInstancesOfferingsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedInstancesOfferingsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedInstancesOfferingsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeRouteTables = "DescribeRouteTables" @@ -8442,8 +10404,23 @@ func (c *EC2) DescribeRouteTablesRequest(input *DescribeRouteTablesInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeRouteTables func (c *EC2) DescribeRouteTables(input *DescribeRouteTablesInput) (*DescribeRouteTablesOutput, error) { req, out := c.DescribeRouteTablesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRouteTablesWithContext is the same as DescribeRouteTables with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRouteTables 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 *EC2) DescribeRouteTablesWithContext(ctx aws.Context, input *DescribeRouteTablesInput, opts ...request.Option) (*DescribeRouteTablesOutput, error) { + req, out := c.DescribeRouteTablesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeScheduledInstanceAvailability = "DescribeScheduledInstanceAvailability" @@ -8510,8 +10487,23 @@ func (c *EC2) DescribeScheduledInstanceAvailabilityRequest(input *DescribeSchedu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeScheduledInstanceAvailability func (c *EC2) DescribeScheduledInstanceAvailability(input *DescribeScheduledInstanceAvailabilityInput) (*DescribeScheduledInstanceAvailabilityOutput, error) { req, out := c.DescribeScheduledInstanceAvailabilityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeScheduledInstanceAvailabilityWithContext is the same as DescribeScheduledInstanceAvailability with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeScheduledInstanceAvailability 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 *EC2) DescribeScheduledInstanceAvailabilityWithContext(ctx aws.Context, input *DescribeScheduledInstanceAvailabilityInput, opts ...request.Option) (*DescribeScheduledInstanceAvailabilityOutput, error) { + req, out := c.DescribeScheduledInstanceAvailabilityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeScheduledInstances = "DescribeScheduledInstances" @@ -8570,8 +10562,23 @@ func (c *EC2) DescribeScheduledInstancesRequest(input *DescribeScheduledInstance // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeScheduledInstances func (c *EC2) DescribeScheduledInstances(input *DescribeScheduledInstancesInput) (*DescribeScheduledInstancesOutput, error) { req, out := c.DescribeScheduledInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeScheduledInstancesWithContext is the same as DescribeScheduledInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeScheduledInstances 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 *EC2) DescribeScheduledInstancesWithContext(ctx aws.Context, input *DescribeScheduledInstancesInput, opts ...request.Option) (*DescribeScheduledInstancesOutput, error) { + req, out := c.DescribeScheduledInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSecurityGroupReferences = "DescribeSecurityGroupReferences" @@ -8631,8 +10638,23 @@ func (c *EC2) DescribeSecurityGroupReferencesRequest(input *DescribeSecurityGrou // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSecurityGroupReferences func (c *EC2) DescribeSecurityGroupReferences(input *DescribeSecurityGroupReferencesInput) (*DescribeSecurityGroupReferencesOutput, error) { req, out := c.DescribeSecurityGroupReferencesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSecurityGroupReferencesWithContext is the same as DescribeSecurityGroupReferences with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSecurityGroupReferences 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 *EC2) DescribeSecurityGroupReferencesWithContext(ctx aws.Context, input *DescribeSecurityGroupReferencesInput, opts ...request.Option) (*DescribeSecurityGroupReferencesOutput, error) { + req, out := c.DescribeSecurityGroupReferencesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSecurityGroups = "DescribeSecurityGroups" @@ -8698,8 +10720,23 @@ func (c *EC2) DescribeSecurityGroupsRequest(input *DescribeSecurityGroupsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSecurityGroups func (c *EC2) DescribeSecurityGroups(input *DescribeSecurityGroupsInput) (*DescribeSecurityGroupsOutput, error) { req, out := c.DescribeSecurityGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSecurityGroupsWithContext is the same as DescribeSecurityGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSecurityGroups 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 *EC2) DescribeSecurityGroupsWithContext(ctx aws.Context, input *DescribeSecurityGroupsInput, opts ...request.Option) (*DescribeSecurityGroupsOutput, error) { + req, out := c.DescribeSecurityGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSnapshotAttribute = "DescribeSnapshotAttribute" @@ -8762,8 +10799,23 @@ func (c *EC2) DescribeSnapshotAttributeRequest(input *DescribeSnapshotAttributeI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSnapshotAttribute func (c *EC2) DescribeSnapshotAttribute(input *DescribeSnapshotAttributeInput) (*DescribeSnapshotAttributeOutput, error) { req, out := c.DescribeSnapshotAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSnapshotAttributeWithContext is the same as DescribeSnapshotAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSnapshotAttribute 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 *EC2) DescribeSnapshotAttributeWithContext(ctx aws.Context, input *DescribeSnapshotAttributeInput, opts ...request.Option) (*DescribeSnapshotAttributeOutput, error) { + req, out := c.DescribeSnapshotAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSnapshots = "DescribeSnapshots" @@ -8873,8 +10925,23 @@ func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSnapshots func (c *EC2) DescribeSnapshots(input *DescribeSnapshotsInput) (*DescribeSnapshotsOutput, error) { req, out := c.DescribeSnapshotsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSnapshotsWithContext is the same as DescribeSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSnapshots 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 *EC2) DescribeSnapshotsWithContext(ctx aws.Context, input *DescribeSnapshotsInput, opts ...request.Option) (*DescribeSnapshotsOutput, error) { + req, out := c.DescribeSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeSnapshotsPages iterates over the pages of a DescribeSnapshots operation, @@ -8894,12 +10961,37 @@ func (c *EC2) DescribeSnapshots(input *DescribeSnapshotsInput) (*DescribeSnapsho // return pageNum <= 3 // }) // -func (c *EC2) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(p *DescribeSnapshotsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeSnapshotsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeSnapshotsOutput), lastPage) - }) +func (c *EC2) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(*DescribeSnapshotsOutput, bool) bool) error { + return c.DescribeSnapshotsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSnapshotsPagesWithContext same as DescribeSnapshotsPages 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 *EC2) DescribeSnapshotsPagesWithContext(ctx aws.Context, input *DescribeSnapshotsInput, fn func(*DescribeSnapshotsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSnapshotsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSnapshotsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeSnapshotsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeSpotDatafeedSubscription = "DescribeSpotDatafeedSubscription" @@ -8960,8 +11052,23 @@ func (c *EC2) DescribeSpotDatafeedSubscriptionRequest(input *DescribeSpotDatafee // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSpotDatafeedSubscription func (c *EC2) DescribeSpotDatafeedSubscription(input *DescribeSpotDatafeedSubscriptionInput) (*DescribeSpotDatafeedSubscriptionOutput, error) { req, out := c.DescribeSpotDatafeedSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSpotDatafeedSubscriptionWithContext is the same as DescribeSpotDatafeedSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSpotDatafeedSubscription 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 *EC2) DescribeSpotDatafeedSubscriptionWithContext(ctx aws.Context, input *DescribeSpotDatafeedSubscriptionInput, opts ...request.Option) (*DescribeSpotDatafeedSubscriptionOutput, error) { + req, out := c.DescribeSpotDatafeedSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSpotFleetInstances = "DescribeSpotFleetInstances" @@ -9020,8 +11127,23 @@ func (c *EC2) DescribeSpotFleetInstancesRequest(input *DescribeSpotFleetInstance // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSpotFleetInstances func (c *EC2) DescribeSpotFleetInstances(input *DescribeSpotFleetInstancesInput) (*DescribeSpotFleetInstancesOutput, error) { req, out := c.DescribeSpotFleetInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSpotFleetInstancesWithContext is the same as DescribeSpotFleetInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSpotFleetInstances 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 *EC2) DescribeSpotFleetInstancesWithContext(ctx aws.Context, input *DescribeSpotFleetInstancesInput, opts ...request.Option) (*DescribeSpotFleetInstancesOutput, error) { + req, out := c.DescribeSpotFleetInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSpotFleetRequestHistory = "DescribeSpotFleetRequestHistory" @@ -9085,8 +11207,23 @@ func (c *EC2) DescribeSpotFleetRequestHistoryRequest(input *DescribeSpotFleetReq // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSpotFleetRequestHistory func (c *EC2) DescribeSpotFleetRequestHistory(input *DescribeSpotFleetRequestHistoryInput) (*DescribeSpotFleetRequestHistoryOutput, error) { req, out := c.DescribeSpotFleetRequestHistoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSpotFleetRequestHistoryWithContext is the same as DescribeSpotFleetRequestHistory with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSpotFleetRequestHistory 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 *EC2) DescribeSpotFleetRequestHistoryWithContext(ctx aws.Context, input *DescribeSpotFleetRequestHistoryInput, opts ...request.Option) (*DescribeSpotFleetRequestHistoryOutput, error) { + req, out := c.DescribeSpotFleetRequestHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSpotFleetRequests = "DescribeSpotFleetRequests" @@ -9154,8 +11291,23 @@ func (c *EC2) DescribeSpotFleetRequestsRequest(input *DescribeSpotFleetRequestsI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSpotFleetRequests func (c *EC2) DescribeSpotFleetRequests(input *DescribeSpotFleetRequestsInput) (*DescribeSpotFleetRequestsOutput, error) { req, out := c.DescribeSpotFleetRequestsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSpotFleetRequestsWithContext is the same as DescribeSpotFleetRequests with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSpotFleetRequests 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 *EC2) DescribeSpotFleetRequestsWithContext(ctx aws.Context, input *DescribeSpotFleetRequestsInput, opts ...request.Option) (*DescribeSpotFleetRequestsOutput, error) { + req, out := c.DescribeSpotFleetRequestsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeSpotFleetRequestsPages iterates over the pages of a DescribeSpotFleetRequests operation, @@ -9175,12 +11327,37 @@ func (c *EC2) DescribeSpotFleetRequests(input *DescribeSpotFleetRequestsInput) ( // return pageNum <= 3 // }) // -func (c *EC2) DescribeSpotFleetRequestsPages(input *DescribeSpotFleetRequestsInput, fn func(p *DescribeSpotFleetRequestsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeSpotFleetRequestsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeSpotFleetRequestsOutput), lastPage) - }) +func (c *EC2) DescribeSpotFleetRequestsPages(input *DescribeSpotFleetRequestsInput, fn func(*DescribeSpotFleetRequestsOutput, bool) bool) error { + return c.DescribeSpotFleetRequestsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSpotFleetRequestsPagesWithContext same as DescribeSpotFleetRequestsPages 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 *EC2) DescribeSpotFleetRequestsPagesWithContext(ctx aws.Context, input *DescribeSpotFleetRequestsInput, fn func(*DescribeSpotFleetRequestsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSpotFleetRequestsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSpotFleetRequestsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeSpotFleetRequestsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeSpotInstanceRequests = "DescribeSpotInstanceRequests" @@ -9253,8 +11430,23 @@ func (c *EC2) DescribeSpotInstanceRequestsRequest(input *DescribeSpotInstanceReq // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSpotInstanceRequests func (c *EC2) DescribeSpotInstanceRequests(input *DescribeSpotInstanceRequestsInput) (*DescribeSpotInstanceRequestsOutput, error) { req, out := c.DescribeSpotInstanceRequestsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSpotInstanceRequestsWithContext is the same as DescribeSpotInstanceRequests with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSpotInstanceRequests 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 *EC2) DescribeSpotInstanceRequestsWithContext(ctx aws.Context, input *DescribeSpotInstanceRequestsInput, opts ...request.Option) (*DescribeSpotInstanceRequestsOutput, error) { + req, out := c.DescribeSpotInstanceRequestsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSpotPriceHistory = "DescribeSpotPriceHistory" @@ -9326,8 +11518,23 @@ func (c *EC2) DescribeSpotPriceHistoryRequest(input *DescribeSpotPriceHistoryInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSpotPriceHistory func (c *EC2) DescribeSpotPriceHistory(input *DescribeSpotPriceHistoryInput) (*DescribeSpotPriceHistoryOutput, error) { req, out := c.DescribeSpotPriceHistoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSpotPriceHistoryWithContext is the same as DescribeSpotPriceHistory with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSpotPriceHistory 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 *EC2) DescribeSpotPriceHistoryWithContext(ctx aws.Context, input *DescribeSpotPriceHistoryInput, opts ...request.Option) (*DescribeSpotPriceHistoryOutput, error) { + req, out := c.DescribeSpotPriceHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeSpotPriceHistoryPages iterates over the pages of a DescribeSpotPriceHistory operation, @@ -9347,12 +11554,37 @@ func (c *EC2) DescribeSpotPriceHistory(input *DescribeSpotPriceHistoryInput) (*D // return pageNum <= 3 // }) // -func (c *EC2) DescribeSpotPriceHistoryPages(input *DescribeSpotPriceHistoryInput, fn func(p *DescribeSpotPriceHistoryOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeSpotPriceHistoryRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeSpotPriceHistoryOutput), lastPage) - }) +func (c *EC2) DescribeSpotPriceHistoryPages(input *DescribeSpotPriceHistoryInput, fn func(*DescribeSpotPriceHistoryOutput, bool) bool) error { + return c.DescribeSpotPriceHistoryPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSpotPriceHistoryPagesWithContext same as DescribeSpotPriceHistoryPages 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 *EC2) DescribeSpotPriceHistoryPagesWithContext(ctx aws.Context, input *DescribeSpotPriceHistoryInput, fn func(*DescribeSpotPriceHistoryOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSpotPriceHistoryInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSpotPriceHistoryRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeSpotPriceHistoryOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeStaleSecurityGroups = "DescribeStaleSecurityGroups" @@ -9414,8 +11646,23 @@ func (c *EC2) DescribeStaleSecurityGroupsRequest(input *DescribeStaleSecurityGro // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeStaleSecurityGroups func (c *EC2) DescribeStaleSecurityGroups(input *DescribeStaleSecurityGroupsInput) (*DescribeStaleSecurityGroupsOutput, error) { req, out := c.DescribeStaleSecurityGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStaleSecurityGroupsWithContext is the same as DescribeStaleSecurityGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStaleSecurityGroups 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 *EC2) DescribeStaleSecurityGroupsWithContext(ctx aws.Context, input *DescribeStaleSecurityGroupsInput, opts ...request.Option) (*DescribeStaleSecurityGroupsOutput, error) { + req, out := c.DescribeStaleSecurityGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSubnets = "DescribeSubnets" @@ -9477,8 +11724,23 @@ func (c *EC2) DescribeSubnetsRequest(input *DescribeSubnetsInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeSubnets func (c *EC2) DescribeSubnets(input *DescribeSubnetsInput) (*DescribeSubnetsOutput, error) { req, out := c.DescribeSubnetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSubnetsWithContext is the same as DescribeSubnets with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSubnets 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 *EC2) DescribeSubnetsWithContext(ctx aws.Context, input *DescribeSubnetsInput, opts ...request.Option) (*DescribeSubnetsOutput, error) { + req, out := c.DescribeSubnetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTags = "DescribeTags" @@ -9546,8 +11808,23 @@ func (c *EC2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeTags func (c *EC2) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error) { req, out := c.DescribeTagsRequest(input) - err := req.Send() - return out, err + 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 *EC2) 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, @@ -9567,12 +11844,37 @@ func (c *EC2) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error // return pageNum <= 3 // }) // -func (c *EC2) DescribeTagsPages(input *DescribeTagsInput, fn func(p *DescribeTagsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeTagsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeTagsOutput), lastPage) - }) +func (c *EC2) 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 *EC2) 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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTagsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeVolumeAttribute = "DescribeVolumeAttribute" @@ -9635,8 +11937,23 @@ func (c *EC2) DescribeVolumeAttributeRequest(input *DescribeVolumeAttributeInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVolumeAttribute func (c *EC2) DescribeVolumeAttribute(input *DescribeVolumeAttributeInput) (*DescribeVolumeAttributeOutput, error) { req, out := c.DescribeVolumeAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVolumeAttributeWithContext is the same as DescribeVolumeAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVolumeAttribute 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 *EC2) DescribeVolumeAttributeWithContext(ctx aws.Context, input *DescribeVolumeAttributeInput, opts ...request.Option) (*DescribeVolumeAttributeOutput, error) { + req, out := c.DescribeVolumeAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVolumeStatus = "DescribeVolumeStatus" @@ -9735,8 +12052,23 @@ func (c *EC2) DescribeVolumeStatusRequest(input *DescribeVolumeStatusInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVolumeStatus func (c *EC2) DescribeVolumeStatus(input *DescribeVolumeStatusInput) (*DescribeVolumeStatusOutput, error) { req, out := c.DescribeVolumeStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVolumeStatusWithContext is the same as DescribeVolumeStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVolumeStatus 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 *EC2) DescribeVolumeStatusWithContext(ctx aws.Context, input *DescribeVolumeStatusInput, opts ...request.Option) (*DescribeVolumeStatusOutput, error) { + req, out := c.DescribeVolumeStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeVolumeStatusPages iterates over the pages of a DescribeVolumeStatus operation, @@ -9756,12 +12088,37 @@ func (c *EC2) DescribeVolumeStatus(input *DescribeVolumeStatusInput) (*DescribeV // return pageNum <= 3 // }) // -func (c *EC2) DescribeVolumeStatusPages(input *DescribeVolumeStatusInput, fn func(p *DescribeVolumeStatusOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeVolumeStatusRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeVolumeStatusOutput), lastPage) - }) +func (c *EC2) DescribeVolumeStatusPages(input *DescribeVolumeStatusInput, fn func(*DescribeVolumeStatusOutput, bool) bool) error { + return c.DescribeVolumeStatusPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVolumeStatusPagesWithContext same as DescribeVolumeStatusPages 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 *EC2) DescribeVolumeStatusPagesWithContext(ctx aws.Context, input *DescribeVolumeStatusInput, fn func(*DescribeVolumeStatusOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVolumeStatusInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVolumeStatusRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVolumeStatusOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeVolumes = "DescribeVolumes" @@ -9836,8 +12193,23 @@ func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVolumes func (c *EC2) DescribeVolumes(input *DescribeVolumesInput) (*DescribeVolumesOutput, error) { req, out := c.DescribeVolumesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVolumesWithContext is the same as DescribeVolumes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVolumes 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 *EC2) DescribeVolumesWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.Option) (*DescribeVolumesOutput, error) { + req, out := c.DescribeVolumesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeVolumesPages iterates over the pages of a DescribeVolumes operation, @@ -9857,12 +12229,37 @@ func (c *EC2) DescribeVolumes(input *DescribeVolumesInput) (*DescribeVolumesOutp // return pageNum <= 3 // }) // -func (c *EC2) DescribeVolumesPages(input *DescribeVolumesInput, fn func(p *DescribeVolumesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeVolumesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeVolumesOutput), lastPage) - }) +func (c *EC2) DescribeVolumesPages(input *DescribeVolumesInput, fn func(*DescribeVolumesOutput, bool) bool) error { + return c.DescribeVolumesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeVolumesPagesWithContext same as DescribeVolumesPages 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 *EC2) DescribeVolumesPagesWithContext(ctx aws.Context, input *DescribeVolumesInput, fn func(*DescribeVolumesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeVolumesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVolumesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeVolumesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeVolumesModifications = "DescribeVolumesModifications" @@ -9921,7 +12318,7 @@ func (c *EC2) DescribeVolumesModificationsRequest(input *DescribeVolumesModifica // // You can also use CloudWatch Events to check the status of a modification // to an EBS volume. For information about CloudWatch Events, see the Amazon -// CloudWatch Events User Guide (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html). +// CloudWatch Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). // For more information, see Monitoring Volume Modifications" (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -9933,8 +12330,23 @@ func (c *EC2) DescribeVolumesModificationsRequest(input *DescribeVolumesModifica // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVolumesModifications func (c *EC2) DescribeVolumesModifications(input *DescribeVolumesModificationsInput) (*DescribeVolumesModificationsOutput, error) { req, out := c.DescribeVolumesModificationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVolumesModificationsWithContext is the same as DescribeVolumesModifications with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVolumesModifications 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 *EC2) DescribeVolumesModificationsWithContext(ctx aws.Context, input *DescribeVolumesModificationsInput, opts ...request.Option) (*DescribeVolumesModificationsOutput, error) { + req, out := c.DescribeVolumesModificationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpcAttribute = "DescribeVpcAttribute" @@ -9994,8 +12406,23 @@ func (c *EC2) DescribeVpcAttributeRequest(input *DescribeVpcAttributeInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpcAttribute func (c *EC2) DescribeVpcAttribute(input *DescribeVpcAttributeInput) (*DescribeVpcAttributeOutput, error) { req, out := c.DescribeVpcAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpcAttributeWithContext is the same as DescribeVpcAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpcAttribute 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 *EC2) DescribeVpcAttributeWithContext(ctx aws.Context, input *DescribeVpcAttributeInput, opts ...request.Option) (*DescribeVpcAttributeOutput, error) { + req, out := c.DescribeVpcAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpcClassicLink = "DescribeVpcClassicLink" @@ -10054,8 +12481,23 @@ func (c *EC2) DescribeVpcClassicLinkRequest(input *DescribeVpcClassicLinkInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpcClassicLink func (c *EC2) DescribeVpcClassicLink(input *DescribeVpcClassicLinkInput) (*DescribeVpcClassicLinkOutput, error) { req, out := c.DescribeVpcClassicLinkRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpcClassicLinkWithContext is the same as DescribeVpcClassicLink with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpcClassicLink 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 *EC2) DescribeVpcClassicLinkWithContext(ctx aws.Context, input *DescribeVpcClassicLinkInput, opts ...request.Option) (*DescribeVpcClassicLinkOutput, error) { + req, out := c.DescribeVpcClassicLinkRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpcClassicLinkDnsSupport = "DescribeVpcClassicLinkDnsSupport" @@ -10120,8 +12562,23 @@ func (c *EC2) DescribeVpcClassicLinkDnsSupportRequest(input *DescribeVpcClassicL // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpcClassicLinkDnsSupport func (c *EC2) DescribeVpcClassicLinkDnsSupport(input *DescribeVpcClassicLinkDnsSupportInput) (*DescribeVpcClassicLinkDnsSupportOutput, error) { req, out := c.DescribeVpcClassicLinkDnsSupportRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpcClassicLinkDnsSupportWithContext is the same as DescribeVpcClassicLinkDnsSupport with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpcClassicLinkDnsSupport 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 *EC2) DescribeVpcClassicLinkDnsSupportWithContext(ctx aws.Context, input *DescribeVpcClassicLinkDnsSupportInput, opts ...request.Option) (*DescribeVpcClassicLinkDnsSupportOutput, error) { + req, out := c.DescribeVpcClassicLinkDnsSupportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpcEndpointServices = "DescribeVpcEndpointServices" @@ -10181,8 +12638,23 @@ func (c *EC2) DescribeVpcEndpointServicesRequest(input *DescribeVpcEndpointServi // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpcEndpointServices func (c *EC2) DescribeVpcEndpointServices(input *DescribeVpcEndpointServicesInput) (*DescribeVpcEndpointServicesOutput, error) { req, out := c.DescribeVpcEndpointServicesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpcEndpointServicesWithContext is the same as DescribeVpcEndpointServices with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpcEndpointServices 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 *EC2) DescribeVpcEndpointServicesWithContext(ctx aws.Context, input *DescribeVpcEndpointServicesInput, opts ...request.Option) (*DescribeVpcEndpointServicesOutput, error) { + req, out := c.DescribeVpcEndpointServicesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpcEndpoints = "DescribeVpcEndpoints" @@ -10241,8 +12713,23 @@ func (c *EC2) DescribeVpcEndpointsRequest(input *DescribeVpcEndpointsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpcEndpoints func (c *EC2) DescribeVpcEndpoints(input *DescribeVpcEndpointsInput) (*DescribeVpcEndpointsOutput, error) { req, out := c.DescribeVpcEndpointsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpcEndpointsWithContext is the same as DescribeVpcEndpoints with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpcEndpoints 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 *EC2) DescribeVpcEndpointsWithContext(ctx aws.Context, input *DescribeVpcEndpointsInput, opts ...request.Option) (*DescribeVpcEndpointsOutput, error) { + req, out := c.DescribeVpcEndpointsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpcPeeringConnections = "DescribeVpcPeeringConnections" @@ -10301,8 +12788,23 @@ func (c *EC2) DescribeVpcPeeringConnectionsRequest(input *DescribeVpcPeeringConn // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpcPeeringConnections func (c *EC2) DescribeVpcPeeringConnections(input *DescribeVpcPeeringConnectionsInput) (*DescribeVpcPeeringConnectionsOutput, error) { req, out := c.DescribeVpcPeeringConnectionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpcPeeringConnectionsWithContext is the same as DescribeVpcPeeringConnections with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpcPeeringConnections 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 *EC2) DescribeVpcPeeringConnectionsWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, opts ...request.Option) (*DescribeVpcPeeringConnectionsOutput, error) { + req, out := c.DescribeVpcPeeringConnectionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpcs = "DescribeVpcs" @@ -10361,8 +12863,23 @@ func (c *EC2) DescribeVpcsRequest(input *DescribeVpcsInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpcs func (c *EC2) DescribeVpcs(input *DescribeVpcsInput) (*DescribeVpcsOutput, error) { req, out := c.DescribeVpcsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpcsWithContext is the same as DescribeVpcs with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpcs 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 *EC2) DescribeVpcsWithContext(ctx aws.Context, input *DescribeVpcsInput, opts ...request.Option) (*DescribeVpcsOutput, error) { + req, out := c.DescribeVpcsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpnConnections = "DescribeVpnConnections" @@ -10425,8 +12942,23 @@ func (c *EC2) DescribeVpnConnectionsRequest(input *DescribeVpnConnectionsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpnConnections func (c *EC2) DescribeVpnConnections(input *DescribeVpnConnectionsInput) (*DescribeVpnConnectionsOutput, error) { req, out := c.DescribeVpnConnectionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpnConnectionsWithContext is the same as DescribeVpnConnections with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpnConnections 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 *EC2) DescribeVpnConnectionsWithContext(ctx aws.Context, input *DescribeVpnConnectionsInput, opts ...request.Option) (*DescribeVpnConnectionsOutput, error) { + req, out := c.DescribeVpnConnectionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVpnGateways = "DescribeVpnGateways" @@ -10489,8 +13021,23 @@ func (c *EC2) DescribeVpnGatewaysRequest(input *DescribeVpnGatewaysInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DescribeVpnGateways func (c *EC2) DescribeVpnGateways(input *DescribeVpnGatewaysInput) (*DescribeVpnGatewaysOutput, error) { req, out := c.DescribeVpnGatewaysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVpnGatewaysWithContext is the same as DescribeVpnGateways with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVpnGateways 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 *EC2) DescribeVpnGatewaysWithContext(ctx aws.Context, input *DescribeVpnGatewaysInput, opts ...request.Option) (*DescribeVpnGatewaysOutput, error) { + req, out := c.DescribeVpnGatewaysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachClassicLinkVpc = "DetachClassicLinkVpc" @@ -10551,8 +13098,23 @@ func (c *EC2) DetachClassicLinkVpcRequest(input *DetachClassicLinkVpcInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DetachClassicLinkVpc func (c *EC2) DetachClassicLinkVpc(input *DetachClassicLinkVpcInput) (*DetachClassicLinkVpcOutput, error) { req, out := c.DetachClassicLinkVpcRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachClassicLinkVpcWithContext is the same as DetachClassicLinkVpc with the addition of +// the ability to pass a context and additional request options. +// +// See DetachClassicLinkVpc 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 *EC2) DetachClassicLinkVpcWithContext(ctx aws.Context, input *DetachClassicLinkVpcInput, opts ...request.Option) (*DetachClassicLinkVpcOutput, error) { + req, out := c.DetachClassicLinkVpcRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachInternetGateway = "DetachInternetGateway" @@ -10615,8 +13177,23 @@ func (c *EC2) DetachInternetGatewayRequest(input *DetachInternetGatewayInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DetachInternetGateway func (c *EC2) DetachInternetGateway(input *DetachInternetGatewayInput) (*DetachInternetGatewayOutput, error) { req, out := c.DetachInternetGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachInternetGatewayWithContext is the same as DetachInternetGateway with the addition of +// the ability to pass a context and additional request options. +// +// See DetachInternetGateway 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 *EC2) DetachInternetGatewayWithContext(ctx aws.Context, input *DetachInternetGatewayInput, opts ...request.Option) (*DetachInternetGatewayOutput, error) { + req, out := c.DetachInternetGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachNetworkInterface = "DetachNetworkInterface" @@ -10677,8 +13254,23 @@ func (c *EC2) DetachNetworkInterfaceRequest(input *DetachNetworkInterfaceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DetachNetworkInterface func (c *EC2) DetachNetworkInterface(input *DetachNetworkInterfaceInput) (*DetachNetworkInterfaceOutput, error) { req, out := c.DetachNetworkInterfaceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachNetworkInterfaceWithContext is the same as DetachNetworkInterface with the addition of +// the ability to pass a context and additional request options. +// +// See DetachNetworkInterface 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 *EC2) DetachNetworkInterfaceWithContext(ctx aws.Context, input *DetachNetworkInterfaceInput, opts ...request.Option) (*DetachNetworkInterfaceOutput, error) { + req, out := c.DetachNetworkInterfaceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachVolume = "DetachVolume" @@ -10750,8 +13342,23 @@ func (c *EC2) DetachVolumeRequest(input *DetachVolumeInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DetachVolume func (c *EC2) DetachVolume(input *DetachVolumeInput) (*VolumeAttachment, error) { req, out := c.DetachVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachVolumeWithContext is the same as DetachVolume with the addition of +// the ability to pass a context and additional request options. +// +// See DetachVolume 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 *EC2) DetachVolumeWithContext(ctx aws.Context, input *DetachVolumeInput, opts ...request.Option) (*VolumeAttachment, error) { + req, out := c.DetachVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachVpnGateway = "DetachVpnGateway" @@ -10819,8 +13426,23 @@ func (c *EC2) DetachVpnGatewayRequest(input *DetachVpnGatewayInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DetachVpnGateway func (c *EC2) DetachVpnGateway(input *DetachVpnGatewayInput) (*DetachVpnGatewayOutput, error) { req, out := c.DetachVpnGatewayRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachVpnGatewayWithContext is the same as DetachVpnGateway with the addition of +// the ability to pass a context and additional request options. +// +// See DetachVpnGateway 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 *EC2) DetachVpnGatewayWithContext(ctx aws.Context, input *DetachVpnGatewayInput, opts ...request.Option) (*DetachVpnGatewayOutput, error) { + req, out := c.DetachVpnGatewayRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableVgwRoutePropagation = "DisableVgwRoutePropagation" @@ -10882,8 +13504,23 @@ func (c *EC2) DisableVgwRoutePropagationRequest(input *DisableVgwRoutePropagatio // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisableVgwRoutePropagation func (c *EC2) DisableVgwRoutePropagation(input *DisableVgwRoutePropagationInput) (*DisableVgwRoutePropagationOutput, error) { req, out := c.DisableVgwRoutePropagationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableVgwRoutePropagationWithContext is the same as DisableVgwRoutePropagation with the addition of +// the ability to pass a context and additional request options. +// +// See DisableVgwRoutePropagation 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 *EC2) DisableVgwRoutePropagationWithContext(ctx aws.Context, input *DisableVgwRoutePropagationInput, opts ...request.Option) (*DisableVgwRoutePropagationOutput, error) { + req, out := c.DisableVgwRoutePropagationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableVpcClassicLink = "DisableVpcClassicLink" @@ -10943,8 +13580,23 @@ func (c *EC2) DisableVpcClassicLinkRequest(input *DisableVpcClassicLinkInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisableVpcClassicLink func (c *EC2) DisableVpcClassicLink(input *DisableVpcClassicLinkInput) (*DisableVpcClassicLinkOutput, error) { req, out := c.DisableVpcClassicLinkRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableVpcClassicLinkWithContext is the same as DisableVpcClassicLink with the addition of +// the ability to pass a context and additional request options. +// +// See DisableVpcClassicLink 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 *EC2) DisableVpcClassicLinkWithContext(ctx aws.Context, input *DisableVpcClassicLinkInput, opts ...request.Option) (*DisableVpcClassicLinkOutput, error) { + req, out := c.DisableVpcClassicLinkRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableVpcClassicLinkDnsSupport = "DisableVpcClassicLinkDnsSupport" @@ -11007,8 +13659,23 @@ func (c *EC2) DisableVpcClassicLinkDnsSupportRequest(input *DisableVpcClassicLin // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisableVpcClassicLinkDnsSupport func (c *EC2) DisableVpcClassicLinkDnsSupport(input *DisableVpcClassicLinkDnsSupportInput) (*DisableVpcClassicLinkDnsSupportOutput, error) { req, out := c.DisableVpcClassicLinkDnsSupportRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableVpcClassicLinkDnsSupportWithContext is the same as DisableVpcClassicLinkDnsSupport with the addition of +// the ability to pass a context and additional request options. +// +// See DisableVpcClassicLinkDnsSupport 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 *EC2) DisableVpcClassicLinkDnsSupportWithContext(ctx aws.Context, input *DisableVpcClassicLinkDnsSupportInput, opts ...request.Option) (*DisableVpcClassicLinkDnsSupportOutput, error) { + req, out := c.DisableVpcClassicLinkDnsSupportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisassociateAddress = "DisassociateAddress" @@ -11077,8 +13744,23 @@ func (c *EC2) DisassociateAddressRequest(input *DisassociateAddressInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisassociateAddress func (c *EC2) DisassociateAddress(input *DisassociateAddressInput) (*DisassociateAddressOutput, error) { req, out := c.DisassociateAddressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisassociateAddressWithContext is the same as DisassociateAddress with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateAddress 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 *EC2) DisassociateAddressWithContext(ctx aws.Context, input *DisassociateAddressInput, opts ...request.Option) (*DisassociateAddressOutput, error) { + req, out := c.DisassociateAddressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisassociateIamInstanceProfile = "DisassociateIamInstanceProfile" @@ -11139,8 +13821,23 @@ func (c *EC2) DisassociateIamInstanceProfileRequest(input *DisassociateIamInstan // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisassociateIamInstanceProfile func (c *EC2) DisassociateIamInstanceProfile(input *DisassociateIamInstanceProfileInput) (*DisassociateIamInstanceProfileOutput, error) { req, out := c.DisassociateIamInstanceProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisassociateIamInstanceProfileWithContext is the same as DisassociateIamInstanceProfile with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateIamInstanceProfile 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 *EC2) DisassociateIamInstanceProfileWithContext(ctx aws.Context, input *DisassociateIamInstanceProfileInput, opts ...request.Option) (*DisassociateIamInstanceProfileOutput, error) { + req, out := c.DisassociateIamInstanceProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisassociateRouteTable = "DisassociateRouteTable" @@ -11206,8 +13903,23 @@ func (c *EC2) DisassociateRouteTableRequest(input *DisassociateRouteTableInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisassociateRouteTable func (c *EC2) DisassociateRouteTable(input *DisassociateRouteTableInput) (*DisassociateRouteTableOutput, error) { req, out := c.DisassociateRouteTableRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisassociateRouteTableWithContext is the same as DisassociateRouteTable with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateRouteTable 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 *EC2) DisassociateRouteTableWithContext(ctx aws.Context, input *DisassociateRouteTableInput, opts ...request.Option) (*DisassociateRouteTableOutput, error) { + req, out := c.DisassociateRouteTableRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisassociateSubnetCidrBlock = "DisassociateSubnetCidrBlock" @@ -11268,8 +13980,23 @@ func (c *EC2) DisassociateSubnetCidrBlockRequest(input *DisassociateSubnetCidrBl // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisassociateSubnetCidrBlock func (c *EC2) DisassociateSubnetCidrBlock(input *DisassociateSubnetCidrBlockInput) (*DisassociateSubnetCidrBlockOutput, error) { req, out := c.DisassociateSubnetCidrBlockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisassociateSubnetCidrBlockWithContext is the same as DisassociateSubnetCidrBlock with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateSubnetCidrBlock 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 *EC2) DisassociateSubnetCidrBlockWithContext(ctx aws.Context, input *DisassociateSubnetCidrBlockInput, opts ...request.Option) (*DisassociateSubnetCidrBlockOutput, error) { + req, out := c.DisassociateSubnetCidrBlockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisassociateVpcCidrBlock = "DisassociateVpcCidrBlock" @@ -11330,8 +14057,23 @@ func (c *EC2) DisassociateVpcCidrBlockRequest(input *DisassociateVpcCidrBlockInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DisassociateVpcCidrBlock func (c *EC2) DisassociateVpcCidrBlock(input *DisassociateVpcCidrBlockInput) (*DisassociateVpcCidrBlockOutput, error) { req, out := c.DisassociateVpcCidrBlockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisassociateVpcCidrBlockWithContext is the same as DisassociateVpcCidrBlock with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateVpcCidrBlock 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 *EC2) DisassociateVpcCidrBlockWithContext(ctx aws.Context, input *DisassociateVpcCidrBlockInput, opts ...request.Option) (*DisassociateVpcCidrBlockOutput, error) { + req, out := c.DisassociateVpcCidrBlockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableVgwRoutePropagation = "EnableVgwRoutePropagation" @@ -11393,8 +14135,23 @@ func (c *EC2) EnableVgwRoutePropagationRequest(input *EnableVgwRoutePropagationI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EnableVgwRoutePropagation func (c *EC2) EnableVgwRoutePropagation(input *EnableVgwRoutePropagationInput) (*EnableVgwRoutePropagationOutput, error) { req, out := c.EnableVgwRoutePropagationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableVgwRoutePropagationWithContext is the same as EnableVgwRoutePropagation with the addition of +// the ability to pass a context and additional request options. +// +// See EnableVgwRoutePropagation 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 *EC2) EnableVgwRoutePropagationWithContext(ctx aws.Context, input *EnableVgwRoutePropagationInput, opts ...request.Option) (*EnableVgwRoutePropagationOutput, error) { + req, out := c.EnableVgwRoutePropagationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableVolumeIO = "EnableVolumeIO" @@ -11456,8 +14213,23 @@ func (c *EC2) EnableVolumeIORequest(input *EnableVolumeIOInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EnableVolumeIO func (c *EC2) EnableVolumeIO(input *EnableVolumeIOInput) (*EnableVolumeIOOutput, error) { req, out := c.EnableVolumeIORequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableVolumeIOWithContext is the same as EnableVolumeIO with the addition of +// the ability to pass a context and additional request options. +// +// See EnableVolumeIO 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 *EC2) EnableVolumeIOWithContext(ctx aws.Context, input *EnableVolumeIOInput, opts ...request.Option) (*EnableVolumeIOOutput, error) { + req, out := c.EnableVolumeIORequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableVpcClassicLink = "EnableVpcClassicLink" @@ -11522,8 +14294,23 @@ func (c *EC2) EnableVpcClassicLinkRequest(input *EnableVpcClassicLinkInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EnableVpcClassicLink func (c *EC2) EnableVpcClassicLink(input *EnableVpcClassicLinkInput) (*EnableVpcClassicLinkOutput, error) { req, out := c.EnableVpcClassicLinkRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableVpcClassicLinkWithContext is the same as EnableVpcClassicLink with the addition of +// the ability to pass a context and additional request options. +// +// See EnableVpcClassicLink 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 *EC2) EnableVpcClassicLinkWithContext(ctx aws.Context, input *EnableVpcClassicLinkInput, opts ...request.Option) (*EnableVpcClassicLinkOutput, error) { + req, out := c.EnableVpcClassicLinkRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableVpcClassicLinkDnsSupport = "EnableVpcClassicLinkDnsSupport" @@ -11588,8 +14375,23 @@ func (c *EC2) EnableVpcClassicLinkDnsSupportRequest(input *EnableVpcClassicLinkD // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EnableVpcClassicLinkDnsSupport func (c *EC2) EnableVpcClassicLinkDnsSupport(input *EnableVpcClassicLinkDnsSupportInput) (*EnableVpcClassicLinkDnsSupportOutput, error) { req, out := c.EnableVpcClassicLinkDnsSupportRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableVpcClassicLinkDnsSupportWithContext is the same as EnableVpcClassicLinkDnsSupport with the addition of +// the ability to pass a context and additional request options. +// +// See EnableVpcClassicLinkDnsSupport 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 *EC2) EnableVpcClassicLinkDnsSupportWithContext(ctx aws.Context, input *EnableVpcClassicLinkDnsSupportInput, opts ...request.Option) (*EnableVpcClassicLinkDnsSupportOutput, error) { + req, out := c.EnableVpcClassicLinkDnsSupportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetConsoleOutput = "GetConsoleOutput" @@ -11665,8 +14467,23 @@ func (c *EC2) GetConsoleOutputRequest(input *GetConsoleOutputInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetConsoleOutput func (c *EC2) GetConsoleOutput(input *GetConsoleOutputInput) (*GetConsoleOutputOutput, error) { req, out := c.GetConsoleOutputRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetConsoleOutputWithContext is the same as GetConsoleOutput with the addition of +// the ability to pass a context and additional request options. +// +// See GetConsoleOutput 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 *EC2) GetConsoleOutputWithContext(ctx aws.Context, input *GetConsoleOutputInput, opts ...request.Option) (*GetConsoleOutputOutput, error) { + req, out := c.GetConsoleOutputRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetConsoleScreenshot = "GetConsoleScreenshot" @@ -11727,8 +14544,23 @@ func (c *EC2) GetConsoleScreenshotRequest(input *GetConsoleScreenshotInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetConsoleScreenshot func (c *EC2) GetConsoleScreenshot(input *GetConsoleScreenshotInput) (*GetConsoleScreenshotOutput, error) { req, out := c.GetConsoleScreenshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetConsoleScreenshotWithContext is the same as GetConsoleScreenshot with the addition of +// the ability to pass a context and additional request options. +// +// See GetConsoleScreenshot 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 *EC2) GetConsoleScreenshotWithContext(ctx aws.Context, input *GetConsoleScreenshotInput, opts ...request.Option) (*GetConsoleScreenshotOutput, error) { + req, out := c.GetConsoleScreenshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHostReservationPurchasePreview = "GetHostReservationPurchasePreview" @@ -11792,8 +14624,23 @@ func (c *EC2) GetHostReservationPurchasePreviewRequest(input *GetHostReservation // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetHostReservationPurchasePreview func (c *EC2) GetHostReservationPurchasePreview(input *GetHostReservationPurchasePreviewInput) (*GetHostReservationPurchasePreviewOutput, error) { req, out := c.GetHostReservationPurchasePreviewRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHostReservationPurchasePreviewWithContext is the same as GetHostReservationPurchasePreview with the addition of +// the ability to pass a context and additional request options. +// +// See GetHostReservationPurchasePreview 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 *EC2) GetHostReservationPurchasePreviewWithContext(ctx aws.Context, input *GetHostReservationPurchasePreviewInput, opts ...request.Option) (*GetHostReservationPurchasePreviewOutput, error) { + req, out := c.GetHostReservationPurchasePreviewRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPasswordData = "GetPasswordData" @@ -11865,8 +14712,23 @@ func (c *EC2) GetPasswordDataRequest(input *GetPasswordDataInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetPasswordData func (c *EC2) GetPasswordData(input *GetPasswordDataInput) (*GetPasswordDataOutput, error) { req, out := c.GetPasswordDataRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPasswordDataWithContext is the same as GetPasswordData with the addition of +// the ability to pass a context and additional request options. +// +// See GetPasswordData 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 *EC2) GetPasswordDataWithContext(ctx aws.Context, input *GetPasswordDataInput, opts ...request.Option) (*GetPasswordDataOutput, error) { + req, out := c.GetPasswordDataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetReservedInstancesExchangeQuote = "GetReservedInstancesExchangeQuote" @@ -11927,8 +14789,23 @@ func (c *EC2) GetReservedInstancesExchangeQuoteRequest(input *GetReservedInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/GetReservedInstancesExchangeQuote func (c *EC2) GetReservedInstancesExchangeQuote(input *GetReservedInstancesExchangeQuoteInput) (*GetReservedInstancesExchangeQuoteOutput, error) { req, out := c.GetReservedInstancesExchangeQuoteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetReservedInstancesExchangeQuoteWithContext is the same as GetReservedInstancesExchangeQuote with the addition of +// the ability to pass a context and additional request options. +// +// See GetReservedInstancesExchangeQuote 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 *EC2) GetReservedInstancesExchangeQuoteWithContext(ctx aws.Context, input *GetReservedInstancesExchangeQuoteInput, opts ...request.Option) (*GetReservedInstancesExchangeQuoteOutput, error) { + req, out := c.GetReservedInstancesExchangeQuoteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportImage = "ImportImage" @@ -11990,8 +14867,23 @@ func (c *EC2) ImportImageRequest(input *ImportImageInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ImportImage func (c *EC2) ImportImage(input *ImportImageInput) (*ImportImageOutput, error) { req, out := c.ImportImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportImageWithContext is the same as ImportImage with the addition of +// the ability to pass a context and additional request options. +// +// See ImportImage 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 *EC2) ImportImageWithContext(ctx aws.Context, input *ImportImageInput, opts ...request.Option) (*ImportImageOutput, error) { + req, out := c.ImportImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportInstance = "ImportInstance" @@ -12056,8 +14948,23 @@ func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ImportInstance func (c *EC2) ImportInstance(input *ImportInstanceInput) (*ImportInstanceOutput, error) { req, out := c.ImportInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportInstanceWithContext is the same as ImportInstance with the addition of +// the ability to pass a context and additional request options. +// +// See ImportInstance 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 *EC2) ImportInstanceWithContext(ctx aws.Context, input *ImportInstanceInput, opts ...request.Option) (*ImportInstanceOutput, error) { + req, out := c.ImportInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportKeyPair = "ImportKeyPair" @@ -12123,8 +15030,23 @@ func (c *EC2) ImportKeyPairRequest(input *ImportKeyPairInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ImportKeyPair func (c *EC2) ImportKeyPair(input *ImportKeyPairInput) (*ImportKeyPairOutput, error) { req, out := c.ImportKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportKeyPairWithContext is the same as ImportKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See ImportKeyPair 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 *EC2) ImportKeyPairWithContext(ctx aws.Context, input *ImportKeyPairInput, opts ...request.Option) (*ImportKeyPairOutput, error) { + req, out := c.ImportKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportSnapshot = "ImportSnapshot" @@ -12183,8 +15105,23 @@ func (c *EC2) ImportSnapshotRequest(input *ImportSnapshotInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ImportSnapshot func (c *EC2) ImportSnapshot(input *ImportSnapshotInput) (*ImportSnapshotOutput, error) { req, out := c.ImportSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportSnapshotWithContext is the same as ImportSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See ImportSnapshot 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 *EC2) ImportSnapshotWithContext(ctx aws.Context, input *ImportSnapshotInput, opts ...request.Option) (*ImportSnapshotOutput, error) { + req, out := c.ImportSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportVolume = "ImportVolume" @@ -12247,8 +15184,23 @@ func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ImportVolume func (c *EC2) ImportVolume(input *ImportVolumeInput) (*ImportVolumeOutput, error) { req, out := c.ImportVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportVolumeWithContext is the same as ImportVolume with the addition of +// the ability to pass a context and additional request options. +// +// See ImportVolume 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 *EC2) ImportVolumeWithContext(ctx aws.Context, input *ImportVolumeInput, opts ...request.Option) (*ImportVolumeOutput, error) { + req, out := c.ImportVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyHosts = "ModifyHosts" @@ -12313,8 +15265,23 @@ func (c *EC2) ModifyHostsRequest(input *ModifyHostsInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyHosts func (c *EC2) ModifyHosts(input *ModifyHostsInput) (*ModifyHostsOutput, error) { req, out := c.ModifyHostsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyHostsWithContext is the same as ModifyHosts with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyHosts 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 *EC2) ModifyHostsWithContext(ctx aws.Context, input *ModifyHostsInput, opts ...request.Option) (*ModifyHostsOutput, error) { + req, out := c.ModifyHostsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyIdFormat = "ModifyIdFormat" @@ -12389,8 +15356,23 @@ func (c *EC2) ModifyIdFormatRequest(input *ModifyIdFormatInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyIdFormat func (c *EC2) ModifyIdFormat(input *ModifyIdFormatInput) (*ModifyIdFormatOutput, error) { req, out := c.ModifyIdFormatRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyIdFormatWithContext is the same as ModifyIdFormat with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyIdFormat 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 *EC2) ModifyIdFormatWithContext(ctx aws.Context, input *ModifyIdFormatInput, opts ...request.Option) (*ModifyIdFormatOutput, error) { + req, out := c.ModifyIdFormatRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyIdentityIdFormat = "ModifyIdentityIdFormat" @@ -12465,8 +15447,23 @@ func (c *EC2) ModifyIdentityIdFormatRequest(input *ModifyIdentityIdFormatInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyIdentityIdFormat func (c *EC2) ModifyIdentityIdFormat(input *ModifyIdentityIdFormatInput) (*ModifyIdentityIdFormatOutput, error) { req, out := c.ModifyIdentityIdFormatRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyIdentityIdFormatWithContext is the same as ModifyIdentityIdFormat with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyIdentityIdFormat 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 *EC2) ModifyIdentityIdFormatWithContext(ctx aws.Context, input *ModifyIdentityIdFormatInput, opts ...request.Option) (*ModifyIdentityIdFormatOutput, error) { + req, out := c.ModifyIdentityIdFormatRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyImageAttribute = "ModifyImageAttribute" @@ -12536,8 +15533,23 @@ func (c *EC2) ModifyImageAttributeRequest(input *ModifyImageAttributeInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyImageAttribute func (c *EC2) ModifyImageAttribute(input *ModifyImageAttributeInput) (*ModifyImageAttributeOutput, error) { req, out := c.ModifyImageAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyImageAttributeWithContext is the same as ModifyImageAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyImageAttribute 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 *EC2) ModifyImageAttributeWithContext(ctx aws.Context, input *ModifyImageAttributeInput, opts ...request.Option) (*ModifyImageAttributeOutput, error) { + req, out := c.ModifyImageAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyInstanceAttribute = "ModifyInstanceAttribute" @@ -12603,8 +15615,23 @@ func (c *EC2) ModifyInstanceAttributeRequest(input *ModifyInstanceAttributeInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyInstanceAttribute func (c *EC2) ModifyInstanceAttribute(input *ModifyInstanceAttributeInput) (*ModifyInstanceAttributeOutput, error) { req, out := c.ModifyInstanceAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyInstanceAttributeWithContext is the same as ModifyInstanceAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyInstanceAttribute 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 *EC2) ModifyInstanceAttributeWithContext(ctx aws.Context, input *ModifyInstanceAttributeInput, opts ...request.Option) (*ModifyInstanceAttributeOutput, error) { + req, out := c.ModifyInstanceAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyInstancePlacement = "ModifyInstancePlacement" @@ -12681,8 +15708,23 @@ func (c *EC2) ModifyInstancePlacementRequest(input *ModifyInstancePlacementInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyInstancePlacement func (c *EC2) ModifyInstancePlacement(input *ModifyInstancePlacementInput) (*ModifyInstancePlacementOutput, error) { req, out := c.ModifyInstancePlacementRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyInstancePlacementWithContext is the same as ModifyInstancePlacement with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyInstancePlacement 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 *EC2) ModifyInstancePlacementWithContext(ctx aws.Context, input *ModifyInstancePlacementInput, opts ...request.Option) (*ModifyInstancePlacementOutput, error) { + req, out := c.ModifyInstancePlacementRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyNetworkInterfaceAttribute = "ModifyNetworkInterfaceAttribute" @@ -12744,8 +15786,23 @@ func (c *EC2) ModifyNetworkInterfaceAttributeRequest(input *ModifyNetworkInterfa // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyNetworkInterfaceAttribute func (c *EC2) ModifyNetworkInterfaceAttribute(input *ModifyNetworkInterfaceAttributeInput) (*ModifyNetworkInterfaceAttributeOutput, error) { req, out := c.ModifyNetworkInterfaceAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyNetworkInterfaceAttributeWithContext is the same as ModifyNetworkInterfaceAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyNetworkInterfaceAttribute 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 *EC2) ModifyNetworkInterfaceAttributeWithContext(ctx aws.Context, input *ModifyNetworkInterfaceAttributeInput, opts ...request.Option) (*ModifyNetworkInterfaceAttributeOutput, error) { + req, out := c.ModifyNetworkInterfaceAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyReservedInstances = "ModifyReservedInstances" @@ -12810,8 +15867,23 @@ func (c *EC2) ModifyReservedInstancesRequest(input *ModifyReservedInstancesInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyReservedInstances func (c *EC2) ModifyReservedInstances(input *ModifyReservedInstancesInput) (*ModifyReservedInstancesOutput, error) { req, out := c.ModifyReservedInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyReservedInstancesWithContext is the same as ModifyReservedInstances with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyReservedInstances 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 *EC2) ModifyReservedInstancesWithContext(ctx aws.Context, input *ModifyReservedInstancesInput, opts ...request.Option) (*ModifyReservedInstancesOutput, error) { + req, out := c.ModifyReservedInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifySnapshotAttribute = "ModifySnapshotAttribute" @@ -12884,8 +15956,23 @@ func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifySnapshotAttribute func (c *EC2) ModifySnapshotAttribute(input *ModifySnapshotAttributeInput) (*ModifySnapshotAttributeOutput, error) { req, out := c.ModifySnapshotAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifySnapshotAttributeWithContext is the same as ModifySnapshotAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifySnapshotAttribute 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 *EC2) ModifySnapshotAttributeWithContext(ctx aws.Context, input *ModifySnapshotAttributeInput, opts ...request.Option) (*ModifySnapshotAttributeOutput, error) { + req, out := c.ModifySnapshotAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifySpotFleetRequest = "ModifySpotFleetRequest" @@ -12963,8 +16050,23 @@ func (c *EC2) ModifySpotFleetRequestRequest(input *ModifySpotFleetRequestInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifySpotFleetRequest func (c *EC2) ModifySpotFleetRequest(input *ModifySpotFleetRequestInput) (*ModifySpotFleetRequestOutput, error) { req, out := c.ModifySpotFleetRequestRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifySpotFleetRequestWithContext is the same as ModifySpotFleetRequest with the addition of +// the ability to pass a context and additional request options. +// +// See ModifySpotFleetRequest 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 *EC2) ModifySpotFleetRequestWithContext(ctx aws.Context, input *ModifySpotFleetRequestInput, opts ...request.Option) (*ModifySpotFleetRequestOutput, error) { + req, out := c.ModifySpotFleetRequestRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifySubnetAttribute = "ModifySubnetAttribute" @@ -13025,8 +16127,23 @@ func (c *EC2) ModifySubnetAttributeRequest(input *ModifySubnetAttributeInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifySubnetAttribute func (c *EC2) ModifySubnetAttribute(input *ModifySubnetAttributeInput) (*ModifySubnetAttributeOutput, error) { req, out := c.ModifySubnetAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifySubnetAttributeWithContext is the same as ModifySubnetAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifySubnetAttribute 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 *EC2) ModifySubnetAttributeWithContext(ctx aws.Context, input *ModifySubnetAttributeInput, opts ...request.Option) (*ModifySubnetAttributeOutput, error) { + req, out := c.ModifySubnetAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyVolume = "ModifyVolume" @@ -13080,30 +16197,29 @@ func (c *EC2) ModifyVolumeRequest(input *ModifyVolumeInput) (req *request.Reques // without stopping the instance or detaching the volume from it. For more information // about modifying an EBS volume running Linux, see Modifying the Size, IOPS, // or Type of an EBS Volume on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). -// For more information about modifying an EBS volume running Windows, see Expanding -// the Storage Space of an EBS Volume on Windows (http://docs.aws.amazon.com/docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). +// For more information about modifying an EBS volume running Windows, see Modifying +// the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). // // When you complete a resize operation on your volume, you need to extend the // volume's file-system size to take advantage of the new storage capacity. // For information about extending a Linux file system, see Extending a Linux // File System (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#recognize-expanded-volume-linux). // For information about extending a Windows file system, see Extending a Windows -// File System (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html#recognize-expanded-volume-windows). +// File System (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html#recognize-expanded-volume-windows). // // You can use CloudWatch Events to check the status of a modification to an // EBS volume. For information about CloudWatch Events, see the Amazon CloudWatch -// Events User Guide (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html). +// Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/). // You can also track the status of a modification using the DescribeVolumesModifications -// (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVolumesModifications.html) // API. For information about tracking status changes using either method, see -// Monitoring Volume Modifications" (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). +// Monitoring Volume Modifications (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html#monitoring_mods). // -// With previous-generation volumes and instance types, resizing an EBS volume -// may require detaching and reattaching the volume or stopping and restarting -// the instance. For more information about modifying an EBS volume running -// Linux, see Modifying the Size, IOPS, or Type of an EBS Volume on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). +// With previous-generation instance types, resizing an EBS volume may require +// detaching and reattaching the volume or stopping and restarting the instance. +// For more information about modifying an EBS volume running Linux, see Modifying +// the Size, IOPS, or Type of an EBS Volume on Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html). // For more information about modifying an EBS volume running Windows, see Modifying -// the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). +// the Size, IOPS, or Type of an EBS Volume on Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-expand-volume.html). // // If you reach the maximum volume modification rate per volume limit, you will // need to wait at least six hours before applying further modifications to @@ -13118,8 +16234,23 @@ func (c *EC2) ModifyVolumeRequest(input *ModifyVolumeInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVolume func (c *EC2) ModifyVolume(input *ModifyVolumeInput) (*ModifyVolumeOutput, error) { req, out := c.ModifyVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyVolumeWithContext is the same as ModifyVolume with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyVolume 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 *EC2) ModifyVolumeWithContext(ctx aws.Context, input *ModifyVolumeInput, opts ...request.Option) (*ModifyVolumeOutput, error) { + req, out := c.ModifyVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyVolumeAttribute = "ModifyVolumeAttribute" @@ -13189,8 +16320,23 @@ func (c *EC2) ModifyVolumeAttributeRequest(input *ModifyVolumeAttributeInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVolumeAttribute func (c *EC2) ModifyVolumeAttribute(input *ModifyVolumeAttributeInput) (*ModifyVolumeAttributeOutput, error) { req, out := c.ModifyVolumeAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyVolumeAttributeWithContext is the same as ModifyVolumeAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyVolumeAttribute 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 *EC2) ModifyVolumeAttributeWithContext(ctx aws.Context, input *ModifyVolumeAttributeInput, opts ...request.Option) (*ModifyVolumeAttributeOutput, error) { + req, out := c.ModifyVolumeAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyVpcAttribute = "ModifyVpcAttribute" @@ -13251,8 +16397,23 @@ func (c *EC2) ModifyVpcAttributeRequest(input *ModifyVpcAttributeInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVpcAttribute func (c *EC2) ModifyVpcAttribute(input *ModifyVpcAttributeInput) (*ModifyVpcAttributeOutput, error) { req, out := c.ModifyVpcAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyVpcAttributeWithContext is the same as ModifyVpcAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyVpcAttribute 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 *EC2) ModifyVpcAttributeWithContext(ctx aws.Context, input *ModifyVpcAttributeInput, opts ...request.Option) (*ModifyVpcAttributeOutput, error) { + req, out := c.ModifyVpcAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyVpcEndpoint = "ModifyVpcEndpoint" @@ -13313,8 +16474,23 @@ func (c *EC2) ModifyVpcEndpointRequest(input *ModifyVpcEndpointInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVpcEndpoint func (c *EC2) ModifyVpcEndpoint(input *ModifyVpcEndpointInput) (*ModifyVpcEndpointOutput, error) { req, out := c.ModifyVpcEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyVpcEndpointWithContext is the same as ModifyVpcEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyVpcEndpoint 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 *EC2) ModifyVpcEndpointWithContext(ctx aws.Context, input *ModifyVpcEndpointInput, opts ...request.Option) (*ModifyVpcEndpointOutput, error) { + req, out := c.ModifyVpcEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyVpcPeeringConnectionOptions = "ModifyVpcPeeringConnectionOptions" @@ -13392,8 +16568,23 @@ func (c *EC2) ModifyVpcPeeringConnectionOptionsRequest(input *ModifyVpcPeeringCo // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVpcPeeringConnectionOptions func (c *EC2) ModifyVpcPeeringConnectionOptions(input *ModifyVpcPeeringConnectionOptionsInput) (*ModifyVpcPeeringConnectionOptionsOutput, error) { req, out := c.ModifyVpcPeeringConnectionOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyVpcPeeringConnectionOptionsWithContext is the same as ModifyVpcPeeringConnectionOptions with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyVpcPeeringConnectionOptions 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 *EC2) ModifyVpcPeeringConnectionOptionsWithContext(ctx aws.Context, input *ModifyVpcPeeringConnectionOptionsInput, opts ...request.Option) (*ModifyVpcPeeringConnectionOptionsOutput, error) { + req, out := c.ModifyVpcPeeringConnectionOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opMonitorInstances = "MonitorInstances" @@ -13457,8 +16648,23 @@ func (c *EC2) MonitorInstancesRequest(input *MonitorInstancesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MonitorInstances func (c *EC2) MonitorInstances(input *MonitorInstancesInput) (*MonitorInstancesOutput, error) { req, out := c.MonitorInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// MonitorInstancesWithContext is the same as MonitorInstances with the addition of +// the ability to pass a context and additional request options. +// +// See MonitorInstances 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 *EC2) MonitorInstancesWithContext(ctx aws.Context, input *MonitorInstancesInput, opts ...request.Option) (*MonitorInstancesOutput, error) { + req, out := c.MonitorInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opMoveAddressToVpc = "MoveAddressToVpc" @@ -13523,8 +16729,23 @@ func (c *EC2) MoveAddressToVpcRequest(input *MoveAddressToVpcInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MoveAddressToVpc func (c *EC2) MoveAddressToVpc(input *MoveAddressToVpcInput) (*MoveAddressToVpcOutput, error) { req, out := c.MoveAddressToVpcRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// MoveAddressToVpcWithContext is the same as MoveAddressToVpc with the addition of +// the ability to pass a context and additional request options. +// +// See MoveAddressToVpc 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 *EC2) MoveAddressToVpcWithContext(ctx aws.Context, input *MoveAddressToVpcInput, opts ...request.Option) (*MoveAddressToVpcOutput, error) { + req, out := c.MoveAddressToVpcRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPurchaseHostReservation = "PurchaseHostReservation" @@ -13586,8 +16807,23 @@ func (c *EC2) PurchaseHostReservationRequest(input *PurchaseHostReservationInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/PurchaseHostReservation func (c *EC2) PurchaseHostReservation(input *PurchaseHostReservationInput) (*PurchaseHostReservationOutput, error) { req, out := c.PurchaseHostReservationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurchaseHostReservationWithContext is the same as PurchaseHostReservation with the addition of +// the ability to pass a context and additional request options. +// +// See PurchaseHostReservation 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 *EC2) PurchaseHostReservationWithContext(ctx aws.Context, input *PurchaseHostReservationInput, opts ...request.Option) (*PurchaseHostReservationOutput, error) { + req, out := c.PurchaseHostReservationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPurchaseReservedInstancesOffering = "PurchaseReservedInstancesOffering" @@ -13655,8 +16891,23 @@ func (c *EC2) PurchaseReservedInstancesOfferingRequest(input *PurchaseReservedIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/PurchaseReservedInstancesOffering func (c *EC2) PurchaseReservedInstancesOffering(input *PurchaseReservedInstancesOfferingInput) (*PurchaseReservedInstancesOfferingOutput, error) { req, out := c.PurchaseReservedInstancesOfferingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurchaseReservedInstancesOfferingWithContext is the same as PurchaseReservedInstancesOffering with the addition of +// the ability to pass a context and additional request options. +// +// See PurchaseReservedInstancesOffering 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 *EC2) PurchaseReservedInstancesOfferingWithContext(ctx aws.Context, input *PurchaseReservedInstancesOfferingInput, opts ...request.Option) (*PurchaseReservedInstancesOfferingOutput, error) { + req, out := c.PurchaseReservedInstancesOfferingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPurchaseScheduledInstances = "PurchaseScheduledInstances" @@ -13724,8 +16975,23 @@ func (c *EC2) PurchaseScheduledInstancesRequest(input *PurchaseScheduledInstance // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/PurchaseScheduledInstances func (c *EC2) PurchaseScheduledInstances(input *PurchaseScheduledInstancesInput) (*PurchaseScheduledInstancesOutput, error) { req, out := c.PurchaseScheduledInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurchaseScheduledInstancesWithContext is the same as PurchaseScheduledInstances with the addition of +// the ability to pass a context and additional request options. +// +// See PurchaseScheduledInstances 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 *EC2) PurchaseScheduledInstancesWithContext(ctx aws.Context, input *PurchaseScheduledInstancesInput, opts ...request.Option) (*PurchaseScheduledInstancesOutput, error) { + req, out := c.PurchaseScheduledInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRebootInstances = "RebootInstances" @@ -13796,8 +17062,23 @@ func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RebootInstances func (c *EC2) RebootInstances(input *RebootInstancesInput) (*RebootInstancesOutput, error) { req, out := c.RebootInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RebootInstancesWithContext is the same as RebootInstances with the addition of +// the ability to pass a context and additional request options. +// +// See RebootInstances 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 *EC2) RebootInstancesWithContext(ctx aws.Context, input *RebootInstancesInput, opts ...request.Option) (*RebootInstancesOutput, error) { + req, out := c.RebootInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterImage = "RegisterImage" @@ -13854,31 +17135,27 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Requ // in a single request, so you don't have to register the AMI yourself. // // You can also use RegisterImage to create an Amazon EBS-backed Linux AMI from -// a snapshot of a root device volume. For more information, see Launching an -// Instance from a Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_LaunchingInstanceFromSnapshot.html) +// a snapshot of a root device volume. You specify the snapshot using the block +// device mapping. For more information, see Launching a Linux Instance from +// a Backup (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-launch-snapshot.html) // in the Amazon Elastic Compute Cloud User Guide. // +// You can't register an image where a secondary (non-root) snapshot has AWS +// Marketplace product codes. +// // Some Linux distributions, such as Red Hat Enterprise Linux (RHEL) and SUSE -// Linux Enterprise Server (SLES), use the EC2 billingProduct code associated -// with an AMI to verify subscription status for package updates. Creating an -// AMI from an EBS snapshot does not maintain this billing code, and subsequent +// Linux Enterprise Server (SLES), use the EC2 billing product code associated +// with an AMI to verify the subscription status for package updates. Creating +// an AMI from an EBS snapshot does not maintain this billing code, and subsequent // instances launched from such an AMI will not be able to connect to package -// update infrastructure. -// -// Similarly, although you can create a Windows AMI from a snapshot, you can't -// successfully launch an instance from the AMI. -// -// To create Windows AMIs or to create AMIs for Linux operating systems that -// must retain AMI billing codes to work properly, see CreateImage. +// update infrastructure. To create an AMI that must retain billing codes, see +// CreateImage. // // If needed, you can deregister an AMI at any time. Any modifications you make // to an AMI backed by an instance store volume invalidates its registration. // If you make changes to an image, deregister the previous image and register // the new image. // -// You can't register an image where a secondary (non-root) snapshot has AWS -// Marketplace product codes. -// // 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. @@ -13888,8 +17165,23 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RegisterImage func (c *EC2) RegisterImage(input *RegisterImageInput) (*RegisterImageOutput, error) { req, out := c.RegisterImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterImageWithContext is the same as RegisterImage with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterImage 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 *EC2) RegisterImageWithContext(ctx aws.Context, input *RegisterImageInput, opts ...request.Option) (*RegisterImageOutput, error) { + req, out := c.RegisterImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRejectVpcPeeringConnection = "RejectVpcPeeringConnection" @@ -13952,8 +17244,23 @@ func (c *EC2) RejectVpcPeeringConnectionRequest(input *RejectVpcPeeringConnectio // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RejectVpcPeeringConnection func (c *EC2) RejectVpcPeeringConnection(input *RejectVpcPeeringConnectionInput) (*RejectVpcPeeringConnectionOutput, error) { req, out := c.RejectVpcPeeringConnectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RejectVpcPeeringConnectionWithContext is the same as RejectVpcPeeringConnection with the addition of +// the ability to pass a context and additional request options. +// +// See RejectVpcPeeringConnection 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 *EC2) RejectVpcPeeringConnectionWithContext(ctx aws.Context, input *RejectVpcPeeringConnectionInput, opts ...request.Option) (*RejectVpcPeeringConnectionOutput, error) { + req, out := c.RejectVpcPeeringConnectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReleaseAddress = "ReleaseAddress" @@ -14028,8 +17335,23 @@ func (c *EC2) ReleaseAddressRequest(input *ReleaseAddressInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReleaseAddress func (c *EC2) ReleaseAddress(input *ReleaseAddressInput) (*ReleaseAddressOutput, error) { req, out := c.ReleaseAddressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReleaseAddressWithContext is the same as ReleaseAddress with the addition of +// the ability to pass a context and additional request options. +// +// See ReleaseAddress 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 *EC2) ReleaseAddressWithContext(ctx aws.Context, input *ReleaseAddressInput, opts ...request.Option) (*ReleaseAddressOutput, error) { + req, out := c.ReleaseAddressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReleaseHosts = "ReleaseHosts" @@ -14099,8 +17421,23 @@ func (c *EC2) ReleaseHostsRequest(input *ReleaseHostsInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReleaseHosts func (c *EC2) ReleaseHosts(input *ReleaseHostsInput) (*ReleaseHostsOutput, error) { req, out := c.ReleaseHostsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReleaseHostsWithContext is the same as ReleaseHosts with the addition of +// the ability to pass a context and additional request options. +// +// See ReleaseHosts 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 *EC2) ReleaseHostsWithContext(ctx aws.Context, input *ReleaseHostsInput, opts ...request.Option) (*ReleaseHostsOutput, error) { + req, out := c.ReleaseHostsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReplaceIamInstanceProfileAssociation = "ReplaceIamInstanceProfileAssociation" @@ -14164,8 +17501,23 @@ func (c *EC2) ReplaceIamInstanceProfileAssociationRequest(input *ReplaceIamInsta // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReplaceIamInstanceProfileAssociation func (c *EC2) ReplaceIamInstanceProfileAssociation(input *ReplaceIamInstanceProfileAssociationInput) (*ReplaceIamInstanceProfileAssociationOutput, error) { req, out := c.ReplaceIamInstanceProfileAssociationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReplaceIamInstanceProfileAssociationWithContext is the same as ReplaceIamInstanceProfileAssociation with the addition of +// the ability to pass a context and additional request options. +// +// See ReplaceIamInstanceProfileAssociation 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 *EC2) ReplaceIamInstanceProfileAssociationWithContext(ctx aws.Context, input *ReplaceIamInstanceProfileAssociationInput, opts ...request.Option) (*ReplaceIamInstanceProfileAssociationOutput, error) { + req, out := c.ReplaceIamInstanceProfileAssociationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReplaceNetworkAclAssociation = "ReplaceNetworkAclAssociation" @@ -14227,8 +17579,23 @@ func (c *EC2) ReplaceNetworkAclAssociationRequest(input *ReplaceNetworkAclAssoci // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReplaceNetworkAclAssociation func (c *EC2) ReplaceNetworkAclAssociation(input *ReplaceNetworkAclAssociationInput) (*ReplaceNetworkAclAssociationOutput, error) { req, out := c.ReplaceNetworkAclAssociationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReplaceNetworkAclAssociationWithContext is the same as ReplaceNetworkAclAssociation with the addition of +// the ability to pass a context and additional request options. +// +// See ReplaceNetworkAclAssociation 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 *EC2) ReplaceNetworkAclAssociationWithContext(ctx aws.Context, input *ReplaceNetworkAclAssociationInput, opts ...request.Option) (*ReplaceNetworkAclAssociationOutput, error) { + req, out := c.ReplaceNetworkAclAssociationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReplaceNetworkAclEntry = "ReplaceNetworkAclEntry" @@ -14291,8 +17658,23 @@ func (c *EC2) ReplaceNetworkAclEntryRequest(input *ReplaceNetworkAclEntryInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReplaceNetworkAclEntry func (c *EC2) ReplaceNetworkAclEntry(input *ReplaceNetworkAclEntryInput) (*ReplaceNetworkAclEntryOutput, error) { req, out := c.ReplaceNetworkAclEntryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReplaceNetworkAclEntryWithContext is the same as ReplaceNetworkAclEntry with the addition of +// the ability to pass a context and additional request options. +// +// See ReplaceNetworkAclEntry 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 *EC2) ReplaceNetworkAclEntryWithContext(ctx aws.Context, input *ReplaceNetworkAclEntryInput, opts ...request.Option) (*ReplaceNetworkAclEntryOutput, error) { + req, out := c.ReplaceNetworkAclEntryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReplaceRoute = "ReplaceRoute" @@ -14359,8 +17741,23 @@ func (c *EC2) ReplaceRouteRequest(input *ReplaceRouteInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReplaceRoute func (c *EC2) ReplaceRoute(input *ReplaceRouteInput) (*ReplaceRouteOutput, error) { req, out := c.ReplaceRouteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReplaceRouteWithContext is the same as ReplaceRoute with the addition of +// the ability to pass a context and additional request options. +// +// See ReplaceRoute 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 *EC2) ReplaceRouteWithContext(ctx aws.Context, input *ReplaceRouteInput, opts ...request.Option) (*ReplaceRouteOutput, error) { + req, out := c.ReplaceRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReplaceRouteTableAssociation = "ReplaceRouteTableAssociation" @@ -14427,8 +17824,23 @@ func (c *EC2) ReplaceRouteTableAssociationRequest(input *ReplaceRouteTableAssoci // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReplaceRouteTableAssociation func (c *EC2) ReplaceRouteTableAssociation(input *ReplaceRouteTableAssociationInput) (*ReplaceRouteTableAssociationOutput, error) { req, out := c.ReplaceRouteTableAssociationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReplaceRouteTableAssociationWithContext is the same as ReplaceRouteTableAssociation with the addition of +// the ability to pass a context and additional request options. +// +// See ReplaceRouteTableAssociation 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 *EC2) ReplaceRouteTableAssociationWithContext(ctx aws.Context, input *ReplaceRouteTableAssociationInput, opts ...request.Option) (*ReplaceRouteTableAssociationOutput, error) { + req, out := c.ReplaceRouteTableAssociationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReportInstanceStatus = "ReportInstanceStatus" @@ -14495,8 +17907,23 @@ func (c *EC2) ReportInstanceStatusRequest(input *ReportInstanceStatusInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReportInstanceStatus func (c *EC2) ReportInstanceStatus(input *ReportInstanceStatusInput) (*ReportInstanceStatusOutput, error) { req, out := c.ReportInstanceStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReportInstanceStatusWithContext is the same as ReportInstanceStatus with the addition of +// the ability to pass a context and additional request options. +// +// See ReportInstanceStatus 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 *EC2) ReportInstanceStatusWithContext(ctx aws.Context, input *ReportInstanceStatusInput, opts ...request.Option) (*ReportInstanceStatusOutput, error) { + req, out := c.ReportInstanceStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRequestSpotFleet = "RequestSpotFleet" @@ -14571,8 +17998,23 @@ func (c *EC2) RequestSpotFleetRequest(input *RequestSpotFleetInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RequestSpotFleet func (c *EC2) RequestSpotFleet(input *RequestSpotFleetInput) (*RequestSpotFleetOutput, error) { req, out := c.RequestSpotFleetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RequestSpotFleetWithContext is the same as RequestSpotFleet with the addition of +// the ability to pass a context and additional request options. +// +// See RequestSpotFleet 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 *EC2) RequestSpotFleetWithContext(ctx aws.Context, input *RequestSpotFleetInput, opts ...request.Option) (*RequestSpotFleetOutput, error) { + req, out := c.RequestSpotFleetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRequestSpotInstances = "RequestSpotInstances" @@ -14636,8 +18078,23 @@ func (c *EC2) RequestSpotInstancesRequest(input *RequestSpotInstancesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RequestSpotInstances func (c *EC2) RequestSpotInstances(input *RequestSpotInstancesInput) (*RequestSpotInstancesOutput, error) { req, out := c.RequestSpotInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RequestSpotInstancesWithContext is the same as RequestSpotInstances with the addition of +// the ability to pass a context and additional request options. +// +// See RequestSpotInstances 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 *EC2) RequestSpotInstancesWithContext(ctx aws.Context, input *RequestSpotInstancesInput, opts ...request.Option) (*RequestSpotInstancesOutput, error) { + req, out := c.RequestSpotInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetImageAttribute = "ResetImageAttribute" @@ -14700,8 +18157,23 @@ func (c *EC2) ResetImageAttributeRequest(input *ResetImageAttributeInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ResetImageAttribute func (c *EC2) ResetImageAttribute(input *ResetImageAttributeInput) (*ResetImageAttributeOutput, error) { req, out := c.ResetImageAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetImageAttributeWithContext is the same as ResetImageAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ResetImageAttribute 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 *EC2) ResetImageAttributeWithContext(ctx aws.Context, input *ResetImageAttributeInput, opts ...request.Option) (*ResetImageAttributeOutput, error) { + req, out := c.ResetImageAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetInstanceAttribute = "ResetInstanceAttribute" @@ -14770,8 +18242,23 @@ func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ResetInstanceAttribute func (c *EC2) ResetInstanceAttribute(input *ResetInstanceAttributeInput) (*ResetInstanceAttributeOutput, error) { req, out := c.ResetInstanceAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetInstanceAttributeWithContext is the same as ResetInstanceAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ResetInstanceAttribute 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 *EC2) ResetInstanceAttributeWithContext(ctx aws.Context, input *ResetInstanceAttributeInput, opts ...request.Option) (*ResetInstanceAttributeOutput, error) { + req, out := c.ResetInstanceAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetNetworkInterfaceAttribute = "ResetNetworkInterfaceAttribute" @@ -14833,8 +18320,23 @@ func (c *EC2) ResetNetworkInterfaceAttributeRequest(input *ResetNetworkInterface // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ResetNetworkInterfaceAttribute func (c *EC2) ResetNetworkInterfaceAttribute(input *ResetNetworkInterfaceAttributeInput) (*ResetNetworkInterfaceAttributeOutput, error) { req, out := c.ResetNetworkInterfaceAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetNetworkInterfaceAttributeWithContext is the same as ResetNetworkInterfaceAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ResetNetworkInterfaceAttribute 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 *EC2) ResetNetworkInterfaceAttributeWithContext(ctx aws.Context, input *ResetNetworkInterfaceAttributeInput, opts ...request.Option) (*ResetNetworkInterfaceAttributeOutput, error) { + req, out := c.ResetNetworkInterfaceAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetSnapshotAttribute = "ResetSnapshotAttribute" @@ -14899,8 +18401,23 @@ func (c *EC2) ResetSnapshotAttributeRequest(input *ResetSnapshotAttributeInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ResetSnapshotAttribute func (c *EC2) ResetSnapshotAttribute(input *ResetSnapshotAttributeInput) (*ResetSnapshotAttributeOutput, error) { req, out := c.ResetSnapshotAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetSnapshotAttributeWithContext is the same as ResetSnapshotAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ResetSnapshotAttribute 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 *EC2) ResetSnapshotAttributeWithContext(ctx aws.Context, input *ResetSnapshotAttributeInput, opts ...request.Option) (*ResetSnapshotAttributeOutput, error) { + req, out := c.ResetSnapshotAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreAddressToClassic = "RestoreAddressToClassic" @@ -14962,8 +18479,23 @@ func (c *EC2) RestoreAddressToClassicRequest(input *RestoreAddressToClassicInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RestoreAddressToClassic func (c *EC2) RestoreAddressToClassic(input *RestoreAddressToClassicInput) (*RestoreAddressToClassicOutput, error) { req, out := c.RestoreAddressToClassicRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreAddressToClassicWithContext is the same as RestoreAddressToClassic with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreAddressToClassic 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 *EC2) RestoreAddressToClassicWithContext(ctx aws.Context, input *RestoreAddressToClassicInput, opts ...request.Option) (*RestoreAddressToClassicOutput, error) { + req, out := c.RestoreAddressToClassicRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRevokeSecurityGroupEgress = "RevokeSecurityGroupEgress" @@ -15035,8 +18567,23 @@ func (c *EC2) RevokeSecurityGroupEgressRequest(input *RevokeSecurityGroupEgressI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RevokeSecurityGroupEgress func (c *EC2) RevokeSecurityGroupEgress(input *RevokeSecurityGroupEgressInput) (*RevokeSecurityGroupEgressOutput, error) { req, out := c.RevokeSecurityGroupEgressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RevokeSecurityGroupEgressWithContext is the same as RevokeSecurityGroupEgress with the addition of +// the ability to pass a context and additional request options. +// +// See RevokeSecurityGroupEgress 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 *EC2) RevokeSecurityGroupEgressWithContext(ctx aws.Context, input *RevokeSecurityGroupEgressInput, opts ...request.Option) (*RevokeSecurityGroupEgressOutput, error) { + req, out := c.RevokeSecurityGroupEgressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRevokeSecurityGroupIngress = "RevokeSecurityGroupIngress" @@ -15107,8 +18654,23 @@ func (c *EC2) RevokeSecurityGroupIngressRequest(input *RevokeSecurityGroupIngres // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RevokeSecurityGroupIngress func (c *EC2) RevokeSecurityGroupIngress(input *RevokeSecurityGroupIngressInput) (*RevokeSecurityGroupIngressOutput, error) { req, out := c.RevokeSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RevokeSecurityGroupIngressWithContext is the same as RevokeSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See RevokeSecurityGroupIngress 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 *EC2) RevokeSecurityGroupIngressWithContext(ctx aws.Context, input *RevokeSecurityGroupIngressInput, opts ...request.Option) (*RevokeSecurityGroupIngressOutput, error) { + req, out := c.RevokeSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRunInstances = "RunInstances" @@ -15191,9 +18753,9 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // each instead of 1 launch request for 500 instances. // // An instance is ready for you to use when it's in the running state. You can -// check the state of your instance using DescribeInstances. After launch, you -// can apply tags to your running instance (requires a resource ID). For more -// information, see CreateTags and Tagging Your Amazon EC2 Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html). +// check the state of your instance using DescribeInstances. You can tag instances +// and EBS volumes during launch, after launch, or both. For more information, +// see CreateTags and Tagging Your Amazon EC2 Resources (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html). // // Linux instances have access to the public key of the key pair at boot. You // can use this key to provide secure access to the instance. Amazon EC2 public @@ -15215,8 +18777,23 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RunInstances func (c *EC2) RunInstances(input *RunInstancesInput) (*Reservation, error) { req, out := c.RunInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RunInstancesWithContext is the same as RunInstances with the addition of +// the ability to pass a context and additional request options. +// +// See RunInstances 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 *EC2) RunInstancesWithContext(ctx aws.Context, input *RunInstancesInput, opts ...request.Option) (*Reservation, error) { + req, out := c.RunInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRunScheduledInstances = "RunScheduledInstances" @@ -15285,8 +18862,23 @@ func (c *EC2) RunScheduledInstancesRequest(input *RunScheduledInstancesInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/RunScheduledInstances func (c *EC2) RunScheduledInstances(input *RunScheduledInstancesInput) (*RunScheduledInstancesOutput, error) { req, out := c.RunScheduledInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RunScheduledInstancesWithContext is the same as RunScheduledInstances with the addition of +// the ability to pass a context and additional request options. +// +// See RunScheduledInstances 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 *EC2) RunScheduledInstancesWithContext(ctx aws.Context, input *RunScheduledInstancesInput, opts ...request.Option) (*RunScheduledInstancesOutput, error) { + req, out := c.RunScheduledInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartInstances = "StartInstances" @@ -15363,8 +18955,23 @@ func (c *EC2) StartInstancesRequest(input *StartInstancesInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/StartInstances func (c *EC2) StartInstances(input *StartInstancesInput) (*StartInstancesOutput, error) { req, out := c.StartInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartInstancesWithContext is the same as StartInstances with the addition of +// the ability to pass a context and additional request options. +// +// See StartInstances 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 *EC2) StartInstancesWithContext(ctx aws.Context, input *StartInstancesInput, opts ...request.Option) (*StartInstancesOutput, error) { + req, out := c.StartInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopInstances = "StopInstances" @@ -15452,8 +19059,23 @@ func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/StopInstances func (c *EC2) StopInstances(input *StopInstancesInput) (*StopInstancesOutput, error) { req, out := c.StopInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopInstancesWithContext is the same as StopInstances with the addition of +// the ability to pass a context and additional request options. +// +// See StopInstances 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 *EC2) StopInstancesWithContext(ctx aws.Context, input *StopInstancesInput, opts ...request.Option) (*StopInstancesOutput, error) { + req, out := c.StopInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTerminateInstances = "TerminateInstances" @@ -15536,8 +19158,23 @@ func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/TerminateInstances func (c *EC2) TerminateInstances(input *TerminateInstancesInput) (*TerminateInstancesOutput, error) { req, out := c.TerminateInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TerminateInstancesWithContext is the same as TerminateInstances with the addition of +// the ability to pass a context and additional request options. +// +// See TerminateInstances 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 *EC2) TerminateInstancesWithContext(ctx aws.Context, input *TerminateInstancesInput, opts ...request.Option) (*TerminateInstancesOutput, error) { + req, out := c.TerminateInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnassignIpv6Addresses = "UnassignIpv6Addresses" @@ -15596,8 +19233,23 @@ func (c *EC2) UnassignIpv6AddressesRequest(input *UnassignIpv6AddressesInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/UnassignIpv6Addresses func (c *EC2) UnassignIpv6Addresses(input *UnassignIpv6AddressesInput) (*UnassignIpv6AddressesOutput, error) { req, out := c.UnassignIpv6AddressesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnassignIpv6AddressesWithContext is the same as UnassignIpv6Addresses with the addition of +// the ability to pass a context and additional request options. +// +// See UnassignIpv6Addresses 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 *EC2) UnassignIpv6AddressesWithContext(ctx aws.Context, input *UnassignIpv6AddressesInput, opts ...request.Option) (*UnassignIpv6AddressesOutput, error) { + req, out := c.UnassignIpv6AddressesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnassignPrivateIpAddresses = "UnassignPrivateIpAddresses" @@ -15658,8 +19310,23 @@ func (c *EC2) UnassignPrivateIpAddressesRequest(input *UnassignPrivateIpAddresse // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/UnassignPrivateIpAddresses func (c *EC2) UnassignPrivateIpAddresses(input *UnassignPrivateIpAddressesInput) (*UnassignPrivateIpAddressesOutput, error) { req, out := c.UnassignPrivateIpAddressesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnassignPrivateIpAddressesWithContext is the same as UnassignPrivateIpAddresses with the addition of +// the ability to pass a context and additional request options. +// +// See UnassignPrivateIpAddresses 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 *EC2) UnassignPrivateIpAddressesWithContext(ctx aws.Context, input *UnassignPrivateIpAddressesInput, opts ...request.Option) (*UnassignPrivateIpAddressesOutput, error) { + req, out := c.UnassignPrivateIpAddressesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnmonitorInstances = "UnmonitorInstances" @@ -15720,8 +19387,23 @@ func (c *EC2) UnmonitorInstancesRequest(input *UnmonitorInstancesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/UnmonitorInstances func (c *EC2) UnmonitorInstances(input *UnmonitorInstancesInput) (*UnmonitorInstancesOutput, error) { req, out := c.UnmonitorInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnmonitorInstancesWithContext is the same as UnmonitorInstances with the addition of +// the ability to pass a context and additional request options. +// +// See UnmonitorInstances 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 *EC2) UnmonitorInstancesWithContext(ctx aws.Context, input *UnmonitorInstancesInput, opts ...request.Option) (*UnmonitorInstancesOutput, error) { + req, out := c.UnmonitorInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Contains the parameters for accepting the quote. @@ -15948,8 +19630,8 @@ func (s *AccountAttributeValue) SetAttributeValue(v string) *AccountAttributeVal type ActiveInstance struct { _ struct{} `type:"structure"` - // The health status of the instance. If the status of both the instance status - // check and the system status check is impaired, the health status of the instance + // The health status of the instance. If the status of either the instance status + // check or the system status check is impaired, the health status of the instance // is unhealthy. Otherwise, the health status is healthy. InstanceHealth *string `locationName:"instanceHealth" type:"string" enum:"InstanceHealthStatus"` @@ -21829,6 +25511,9 @@ type CreateVolumeInput struct { // The snapshot from which to create the volume. SnapshotId *string `type:"string"` + // The tags to apply to the volume during creation. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` + // The volume type. This can be gp2 for General Purpose SSD, io1 for Provisioned // IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard // for Magnetic volumes. @@ -21902,6 +25587,12 @@ func (s *CreateVolumeInput) SetSnapshotId(v string) *CreateVolumeInput { return s } +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *CreateVolumeInput) SetTagSpecifications(v []*TagSpecification) *CreateVolumeInput { + s.TagSpecifications = v + return s +} + // SetVolumeType sets the VolumeType field's value. func (s *CreateVolumeInput) SetVolumeType(v string) *CreateVolumeInput { s.VolumeType = &v @@ -40467,6 +44158,8 @@ type ModifyVolumeInput struct { // Only valid for Provisioned IOPS SSD (io1) volumes. For more information about // io1 IOPS configuration, see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html#EBSVolumeTypes_piops // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html#EBSVolumeTypes_piops). + // + // Default: If no IOPS value is specified, the existing value is retained. Iops *int64 `type:"integer"` // Target size in GiB of the volume to be modified. Target volume size must @@ -40482,10 +44175,10 @@ type ModifyVolumeInput struct { // Target EBS volume type of the volume to be modified // - // Valid values are io1 | gp2 | sc1 | st1 - // // The API does not support modifications for volume type standard. You also // cannot change the type of a volume to standard. + // + // Default: If no type is specified, the existing type is retained. VolumeType *string `type:"string" enum:"VolumeType"` } @@ -43248,6 +46941,11 @@ type RegisterImageInput struct { // the architecture specified in the manifest file. Architecture *string `locationName:"architecture" type:"string" enum:"ArchitectureValues"` + // The billing product codes. Your account must be authorized to specify billing + // product codes. Otherwise, you can use the AWS Marketplace to bill for the + // use of an AMI. + BillingProducts []*string `locationName:"BillingProduct" locationNameList:"item" type:"list"` + // One or more block device mapping entries. BlockDeviceMappings []*BlockDeviceMapping `locationName:"BlockDeviceMapping" locationNameList:"BlockDeviceMapping" type:"list"` @@ -43333,6 +47031,12 @@ func (s *RegisterImageInput) SetArchitecture(v string) *RegisterImageInput { return s } +// SetBillingProducts sets the BillingProducts field's value. +func (s *RegisterImageInput) SetBillingProducts(v []*string) *RegisterImageInput { + s.BillingProducts = v + return s +} + // SetBlockDeviceMappings sets the BlockDeviceMappings field's value. func (s *RegisterImageInput) SetBlockDeviceMappings(v []*BlockDeviceMapping) *RegisterImageInput { s.BlockDeviceMappings = v @@ -46788,6 +50492,11 @@ type RunInstancesInput struct { // [EC2-VPC] The ID of the subnet to launch the instance into. SubnetId *string `type:"string"` + // The tags to apply to the resources during launch. You can tag instances and + // volumes. The specified tags are applied to all instances or volumes that + // are created during launch. + TagSpecifications []*TagSpecification `locationName:"TagSpecification" locationNameList:"item" type:"list"` + // The user data to make available to the instance. For more information, see // Running Commands on Your Linux Instance at Launch (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) // (Linux) and Adding User Data (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) @@ -46985,6 +50694,12 @@ func (s *RunInstancesInput) SetSubnetId(v string) *RunInstancesInput { return s } +// SetTagSpecifications sets the TagSpecifications field's value. +func (s *RunInstancesInput) SetTagSpecifications(v []*TagSpecification) *RunInstancesInput { + s.TagSpecifications = v + return s +} + // SetUserData sets the UserData field's value. func (s *RunInstancesInput) SetUserData(v string) *RunInstancesInput { s.UserData = &v @@ -50525,6 +54240,41 @@ func (s *TagDescription) SetValue(v string) *TagDescription { return s } +// The tags to apply to a resource when the resource is being created. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/TagSpecification +type TagSpecification struct { + _ struct{} `type:"structure"` + + // The type of resource to tag. Currently, the resource types that support tagging + // on creation are instance and volume. + ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` + + // The tags to apply to the resource. + Tags []*Tag `locationName:"Tag" locationNameList:"item" type:"list"` +} + +// String returns the string representation +func (s TagSpecification) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagSpecification) GoString() string { + return s.String() +} + +// SetResourceType sets the ResourceType field's value. +func (s *TagSpecification) SetResourceType(v string) *TagSpecification { + s.ResourceType = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagSpecification) SetTags(v []*Tag) *TagSpecification { + s.Tags = v + return s +} + // Information about the Convertible Reserved Instance offering. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/TargetConfiguration type TargetConfiguration struct { @@ -51527,8 +55277,8 @@ type VolumeModification struct { // Modification completion or failure time. EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"iso8601"` - // Current state of modification. Possible values are modifying | optimizing - // | complete | failed. Modification state is null for unmodified volumes. + // Current state of modification. Modification state is null for unmodified + // volumes. ModificationState *string `locationName:"modificationState" type:"string" enum:"VolumeModificationState"` // Original IOPS rate of the volume being modified. @@ -53314,6 +57064,24 @@ const ( // InstanceTypeI28xlarge is a InstanceType enum value InstanceTypeI28xlarge = "i2.8xlarge" + // InstanceTypeI3Large is a InstanceType enum value + InstanceTypeI3Large = "i3.large" + + // InstanceTypeI3Xlarge is a InstanceType enum value + InstanceTypeI3Xlarge = "i3.xlarge" + + // InstanceTypeI32xlarge is a InstanceType enum value + InstanceTypeI32xlarge = "i3.2xlarge" + + // InstanceTypeI34xlarge is a InstanceType enum value + InstanceTypeI34xlarge = "i3.4xlarge" + + // InstanceTypeI38xlarge is a InstanceType enum value + InstanceTypeI38xlarge = "i3.8xlarge" + + // InstanceTypeI316xlarge is a InstanceType enum value + InstanceTypeI316xlarge = "i3.16xlarge" + // InstanceTypeHi14xlarge is a InstanceType enum value InstanceTypeHi14xlarge = "hi1.4xlarge" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go index f90fa6ec54..3d61d7e357 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go @@ -1,3 +1,3 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ec2 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go index c289b5b04d..e04220546f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ec2 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go index 7917cbdaf9..c0a655fa0f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ec2 import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilBundleTaskComplete uses the Amazon EC2 API operation @@ -11,32 +14,50 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilBundleTaskComplete(input *DescribeBundleTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeBundleTasks", - Delay: 15, + return c.WaitUntilBundleTaskCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilBundleTaskCompleteWithContext is an extended version of WaitUntilBundleTaskComplete. +// 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 *EC2) WaitUntilBundleTaskCompleteWithContext(ctx aws.Context, input *DescribeBundleTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilBundleTaskComplete", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "BundleTasks[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "BundleTasks[].State", Expected: "complete", }, { - State: "failure", - Matcher: "pathAny", - Argument: "BundleTasks[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "BundleTasks[].State", Expected: "failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeBundleTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeBundleTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilConversionTaskCancelled uses the Amazon EC2 API operation @@ -44,26 +65,45 @@ func (c *EC2) WaitUntilBundleTaskComplete(input *DescribeBundleTasksInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilConversionTaskCancelled(input *DescribeConversionTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeConversionTasks", - Delay: 15, + return c.WaitUntilConversionTaskCancelledWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilConversionTaskCancelledWithContext is an extended version of WaitUntilConversionTaskCancelled. +// 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 *EC2) WaitUntilConversionTaskCancelledWithContext(ctx aws.Context, input *DescribeConversionTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilConversionTaskCancelled", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "ConversionTasks[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "ConversionTasks[].State", Expected: "cancelled", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeConversionTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeConversionTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilConversionTaskCompleted uses the Amazon EC2 API operation @@ -71,38 +111,55 @@ func (c *EC2) WaitUntilConversionTaskCancelled(input *DescribeConversionTasksInp // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilConversionTaskCompleted(input *DescribeConversionTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeConversionTasks", - Delay: 15, + return c.WaitUntilConversionTaskCompletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilConversionTaskCompletedWithContext is an extended version of WaitUntilConversionTaskCompleted. +// 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 *EC2) WaitUntilConversionTaskCompletedWithContext(ctx aws.Context, input *DescribeConversionTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilConversionTaskCompleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "ConversionTasks[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "ConversionTasks[].State", Expected: "completed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "ConversionTasks[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "ConversionTasks[].State", Expected: "cancelled", }, { - State: "failure", - Matcher: "pathAny", - Argument: "ConversionTasks[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "ConversionTasks[].State", Expected: "cancelling", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeConversionTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeConversionTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilConversionTaskDeleted uses the Amazon EC2 API operation @@ -110,26 +167,45 @@ func (c *EC2) WaitUntilConversionTaskCompleted(input *DescribeConversionTasksInp // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilConversionTaskDeleted(input *DescribeConversionTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeConversionTasks", - Delay: 15, + return c.WaitUntilConversionTaskDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilConversionTaskDeletedWithContext is an extended version of WaitUntilConversionTaskDeleted. +// 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 *EC2) WaitUntilConversionTaskDeletedWithContext(ctx aws.Context, input *DescribeConversionTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilConversionTaskDeleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "ConversionTasks[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "ConversionTasks[].State", Expected: "deleted", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeConversionTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeConversionTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilCustomerGatewayAvailable uses the Amazon EC2 API operation @@ -137,38 +213,55 @@ func (c *EC2) WaitUntilConversionTaskDeleted(input *DescribeConversionTasksInput // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilCustomerGatewayAvailable(input *DescribeCustomerGatewaysInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeCustomerGateways", - Delay: 15, + return c.WaitUntilCustomerGatewayAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilCustomerGatewayAvailableWithContext is an extended version of WaitUntilCustomerGatewayAvailable. +// 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 *EC2) WaitUntilCustomerGatewayAvailableWithContext(ctx aws.Context, input *DescribeCustomerGatewaysInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilCustomerGatewayAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "CustomerGateways[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "CustomerGateways[].State", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CustomerGateways[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CustomerGateways[].State", Expected: "deleted", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CustomerGateways[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CustomerGateways[].State", Expected: "deleting", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeCustomerGatewaysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCustomerGatewaysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilExportTaskCancelled uses the Amazon EC2 API operation @@ -176,26 +269,45 @@ func (c *EC2) WaitUntilCustomerGatewayAvailable(input *DescribeCustomerGatewaysI // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilExportTaskCancelled(input *DescribeExportTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeExportTasks", - Delay: 15, + return c.WaitUntilExportTaskCancelledWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilExportTaskCancelledWithContext is an extended version of WaitUntilExportTaskCancelled. +// 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 *EC2) WaitUntilExportTaskCancelledWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilExportTaskCancelled", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "ExportTasks[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "ExportTasks[].State", Expected: "cancelled", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeExportTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeExportTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilExportTaskCompleted uses the Amazon EC2 API operation @@ -203,26 +315,45 @@ func (c *EC2) WaitUntilExportTaskCancelled(input *DescribeExportTasksInput) erro // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilExportTaskCompleted(input *DescribeExportTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeExportTasks", - Delay: 15, + return c.WaitUntilExportTaskCompletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilExportTaskCompletedWithContext is an extended version of WaitUntilExportTaskCompleted. +// 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 *EC2) WaitUntilExportTaskCompletedWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilExportTaskCompleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "ExportTasks[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "ExportTasks[].State", Expected: "completed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeExportTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeExportTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilImageAvailable uses the Amazon EC2 API operation @@ -230,32 +361,50 @@ func (c *EC2) WaitUntilExportTaskCompleted(input *DescribeExportTasksInput) erro // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilImageAvailable(input *DescribeImagesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeImages", - Delay: 15, + return c.WaitUntilImageAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilImageAvailableWithContext is an extended version of WaitUntilImageAvailable. +// 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 *EC2) WaitUntilImageAvailableWithContext(ctx aws.Context, input *DescribeImagesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilImageAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Images[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Images[].State", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Images[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Images[].State", Expected: "failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeImagesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeImagesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilImageExists uses the Amazon EC2 API operation @@ -263,32 +412,50 @@ func (c *EC2) WaitUntilImageAvailable(input *DescribeImagesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilImageExists(input *DescribeImagesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeImages", - Delay: 15, + return c.WaitUntilImageExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilImageExistsWithContext is an extended version of WaitUntilImageExists. +// 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 *EC2) WaitUntilImageExistsWithContext(ctx aws.Context, input *DescribeImagesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilImageExists", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "length(Images[]) > `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(Images[]) > `0`", Expected: true, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidAMIID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeImagesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeImagesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceExists uses the Amazon EC2 API operation @@ -296,32 +463,50 @@ func (c *EC2) WaitUntilImageExists(input *DescribeImagesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 5, + return c.WaitUntilInstanceExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceExistsWithContext is an extended version of WaitUntilInstanceExists. +// 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 *EC2) WaitUntilInstanceExistsWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceExists", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "length(Reservations[]) > `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(Reservations[]) > `0`", Expected: true, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidInstanceID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceRunning uses the Amazon EC2 API operation @@ -329,50 +514,65 @@ func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilInstanceRunning(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 15, + return c.WaitUntilInstanceRunningWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceRunningWithContext is an extended version of WaitUntilInstanceRunning. +// 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 *EC2) WaitUntilInstanceRunningWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceRunning", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Reservations[].Instances[].State.Name", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "running", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Reservations[].Instances[].State.Name", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "shutting-down", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Reservations[].Instances[].State.Name", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "terminated", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Reservations[].Instances[].State.Name", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "stopping", }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidInstanceID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceStatusOk uses the Amazon EC2 API operation @@ -380,32 +580,50 @@ func (c *EC2) WaitUntilInstanceRunning(input *DescribeInstancesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilInstanceStatusOk(input *DescribeInstanceStatusInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstanceStatus", - Delay: 15, + return c.WaitUntilInstanceStatusOkWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceStatusOkWithContext is an extended version of WaitUntilInstanceStatusOk. +// 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 *EC2) WaitUntilInstanceStatusOkWithContext(ctx aws.Context, input *DescribeInstanceStatusInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceStatusOk", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "InstanceStatuses[].InstanceStatus.Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "InstanceStatuses[].InstanceStatus.Status", Expected: "ok", }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidInstanceID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstanceStatusInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstanceStatusRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceStopped uses the Amazon EC2 API operation @@ -413,38 +631,55 @@ func (c *EC2) WaitUntilInstanceStatusOk(input *DescribeInstanceStatusInput) erro // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilInstanceStopped(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 15, + return c.WaitUntilInstanceStoppedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceStoppedWithContext is an extended version of WaitUntilInstanceStopped. +// 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 *EC2) WaitUntilInstanceStoppedWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceStopped", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Reservations[].Instances[].State.Name", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "stopped", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Reservations[].Instances[].State.Name", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "pending", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Reservations[].Instances[].State.Name", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "terminated", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceTerminated uses the Amazon EC2 API operation @@ -452,38 +687,55 @@ func (c *EC2) WaitUntilInstanceStopped(input *DescribeInstancesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilInstanceTerminated(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 15, + return c.WaitUntilInstanceTerminatedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceTerminatedWithContext is an extended version of WaitUntilInstanceTerminated. +// 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 *EC2) WaitUntilInstanceTerminatedWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceTerminated", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Reservations[].Instances[].State.Name", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "terminated", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Reservations[].Instances[].State.Name", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "pending", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Reservations[].Instances[].State.Name", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Reservations[].Instances[].State.Name", Expected: "stopping", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilKeyPairExists uses the Amazon EC2 API operation @@ -491,32 +743,50 @@ func (c *EC2) WaitUntilInstanceTerminated(input *DescribeInstancesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilKeyPairExists(input *DescribeKeyPairsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeKeyPairs", - Delay: 5, + return c.WaitUntilKeyPairExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilKeyPairExistsWithContext is an extended version of WaitUntilKeyPairExists. +// 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 *EC2) WaitUntilKeyPairExistsWithContext(ctx aws.Context, input *DescribeKeyPairsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilKeyPairExists", MaxAttempts: 6, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "length(KeyPairs[].KeyName) > `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(KeyPairs[].KeyName) > `0`", Expected: true, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidKeyPair.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeKeyPairsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeKeyPairsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilNatGatewayAvailable uses the Amazon EC2 API operation @@ -524,50 +794,65 @@ func (c *EC2) WaitUntilKeyPairExists(input *DescribeKeyPairsInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilNatGatewayAvailable(input *DescribeNatGatewaysInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeNatGateways", - Delay: 15, + return c.WaitUntilNatGatewayAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilNatGatewayAvailableWithContext is an extended version of WaitUntilNatGatewayAvailable. +// 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 *EC2) WaitUntilNatGatewayAvailableWithContext(ctx aws.Context, input *DescribeNatGatewaysInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilNatGatewayAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "NatGateways[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "NatGateways[].State", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "NatGateways[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "NatGateways[].State", Expected: "failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "NatGateways[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "NatGateways[].State", Expected: "deleting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "NatGateways[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "NatGateways[].State", Expected: "deleted", }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "NatGatewayNotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeNatGatewaysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeNatGatewaysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilNetworkInterfaceAvailable uses the Amazon EC2 API operation @@ -575,32 +860,50 @@ func (c *EC2) WaitUntilNatGatewayAvailable(input *DescribeNatGatewaysInput) erro // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilNetworkInterfaceAvailable(input *DescribeNetworkInterfacesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeNetworkInterfaces", - Delay: 20, + return c.WaitUntilNetworkInterfaceAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilNetworkInterfaceAvailableWithContext is an extended version of WaitUntilNetworkInterfaceAvailable. +// 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 *EC2) WaitUntilNetworkInterfaceAvailableWithContext(ctx aws.Context, input *DescribeNetworkInterfacesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilNetworkInterfaceAvailable", MaxAttempts: 10, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(20 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "NetworkInterfaces[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "NetworkInterfaces[].Status", Expected: "available", }, { - State: "failure", - Matcher: "error", - Argument: "", + State: request.FailureWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidNetworkInterfaceID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeNetworkInterfacesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeNetworkInterfacesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilPasswordDataAvailable uses the Amazon EC2 API operation @@ -608,26 +911,45 @@ func (c *EC2) WaitUntilNetworkInterfaceAvailable(input *DescribeNetworkInterface // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilPasswordDataAvailable(input *GetPasswordDataInput) error { - waiterCfg := waiter.Config{ - Operation: "GetPasswordData", - Delay: 15, + return c.WaitUntilPasswordDataAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilPasswordDataAvailableWithContext is an extended version of WaitUntilPasswordDataAvailable. +// 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 *EC2) WaitUntilPasswordDataAvailableWithContext(ctx aws.Context, input *GetPasswordDataInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilPasswordDataAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "length(PasswordData) > `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(PasswordData) > `0`", Expected: true, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetPasswordDataInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetPasswordDataRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilSnapshotCompleted uses the Amazon EC2 API operation @@ -635,26 +957,45 @@ func (c *EC2) WaitUntilPasswordDataAvailable(input *GetPasswordDataInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilSnapshotCompleted(input *DescribeSnapshotsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeSnapshots", - Delay: 15, + return c.WaitUntilSnapshotCompletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilSnapshotCompletedWithContext is an extended version of WaitUntilSnapshotCompleted. +// 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 *EC2) WaitUntilSnapshotCompletedWithContext(ctx aws.Context, input *DescribeSnapshotsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilSnapshotCompleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Snapshots[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Snapshots[].State", Expected: "completed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeSnapshotsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSnapshotsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilSpotInstanceRequestFulfilled uses the Amazon EC2 API operation @@ -662,50 +1003,65 @@ func (c *EC2) WaitUntilSnapshotCompleted(input *DescribeSnapshotsInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilSpotInstanceRequestFulfilled(input *DescribeSpotInstanceRequestsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeSpotInstanceRequests", - Delay: 15, + return c.WaitUntilSpotInstanceRequestFulfilledWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilSpotInstanceRequestFulfilledWithContext is an extended version of WaitUntilSpotInstanceRequestFulfilled. +// 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 *EC2) WaitUntilSpotInstanceRequestFulfilledWithContext(ctx aws.Context, input *DescribeSpotInstanceRequestsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilSpotInstanceRequestFulfilled", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "SpotInstanceRequests[].Status.Code", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code", Expected: "fulfilled", }, { - State: "failure", - Matcher: "pathAny", - Argument: "SpotInstanceRequests[].Status.Code", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code", Expected: "schedule-expired", }, { - State: "failure", - Matcher: "pathAny", - Argument: "SpotInstanceRequests[].Status.Code", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code", Expected: "canceled-before-fulfillment", }, { - State: "failure", - Matcher: "pathAny", - Argument: "SpotInstanceRequests[].Status.Code", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code", Expected: "bad-parameters", }, { - State: "failure", - Matcher: "pathAny", - Argument: "SpotInstanceRequests[].Status.Code", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "SpotInstanceRequests[].Status.Code", Expected: "system-error", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeSpotInstanceRequestsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSpotInstanceRequestsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilSubnetAvailable uses the Amazon EC2 API operation @@ -713,26 +1069,45 @@ func (c *EC2) WaitUntilSpotInstanceRequestFulfilled(input *DescribeSpotInstanceR // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilSubnetAvailable(input *DescribeSubnetsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeSubnets", - Delay: 15, + return c.WaitUntilSubnetAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilSubnetAvailableWithContext is an extended version of WaitUntilSubnetAvailable. +// 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 *EC2) WaitUntilSubnetAvailableWithContext(ctx aws.Context, input *DescribeSubnetsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilSubnetAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Subnets[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Subnets[].State", Expected: "available", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeSubnetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSubnetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilSystemStatusOk uses the Amazon EC2 API operation @@ -740,26 +1115,45 @@ func (c *EC2) WaitUntilSubnetAvailable(input *DescribeSubnetsInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilSystemStatusOk(input *DescribeInstanceStatusInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstanceStatus", - Delay: 15, + return c.WaitUntilSystemStatusOkWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilSystemStatusOkWithContext is an extended version of WaitUntilSystemStatusOk. +// 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 *EC2) WaitUntilSystemStatusOkWithContext(ctx aws.Context, input *DescribeInstanceStatusInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilSystemStatusOk", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "InstanceStatuses[].SystemStatus.Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "InstanceStatuses[].SystemStatus.Status", Expected: "ok", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstanceStatusInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstanceStatusRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVolumeAvailable uses the Amazon EC2 API operation @@ -767,32 +1161,50 @@ func (c *EC2) WaitUntilSystemStatusOk(input *DescribeInstanceStatusInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVolumeAvailable(input *DescribeVolumesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVolumes", - Delay: 15, + return c.WaitUntilVolumeAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVolumeAvailableWithContext is an extended version of WaitUntilVolumeAvailable. +// 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 *EC2) WaitUntilVolumeAvailableWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVolumeAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Volumes[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Volumes[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Volumes[].State", Expected: "deleted", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVolumesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVolumesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVolumeDeleted uses the Amazon EC2 API operation @@ -800,32 +1212,50 @@ func (c *EC2) WaitUntilVolumeAvailable(input *DescribeVolumesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVolumes", - Delay: 15, + return c.WaitUntilVolumeDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVolumeDeletedWithContext is an extended version of WaitUntilVolumeDeleted. +// 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 *EC2) WaitUntilVolumeDeletedWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVolumeDeleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Volumes[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State", Expected: "deleted", }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidVolume.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVolumesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVolumesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVolumeInUse uses the Amazon EC2 API operation @@ -833,32 +1263,50 @@ func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVolumeInUse(input *DescribeVolumesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVolumes", - Delay: 15, + return c.WaitUntilVolumeInUseWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVolumeInUseWithContext is an extended version of WaitUntilVolumeInUse. +// 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 *EC2) WaitUntilVolumeInUseWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVolumeInUse", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Volumes[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Volumes[].State", Expected: "in-use", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Volumes[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Volumes[].State", Expected: "deleted", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVolumesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVolumesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVpcAvailable uses the Amazon EC2 API operation @@ -866,26 +1314,45 @@ func (c *EC2) WaitUntilVolumeInUse(input *DescribeVolumesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVpcAvailable(input *DescribeVpcsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVpcs", - Delay: 15, + return c.WaitUntilVpcAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVpcAvailableWithContext is an extended version of WaitUntilVpcAvailable. +// 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 *EC2) WaitUntilVpcAvailableWithContext(ctx aws.Context, input *DescribeVpcsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVpcAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Vpcs[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Vpcs[].State", Expected: "available", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVpcsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVpcExists uses the Amazon EC2 API operation @@ -893,32 +1360,50 @@ func (c *EC2) WaitUntilVpcAvailable(input *DescribeVpcsInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVpcExists(input *DescribeVpcsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVpcs", - Delay: 1, + return c.WaitUntilVpcExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVpcExistsWithContext is an extended version of WaitUntilVpcExists. +// 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 *EC2) WaitUntilVpcExistsWithContext(ctx aws.Context, input *DescribeVpcsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVpcExists", MaxAttempts: 5, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(1 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidVpcID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVpcsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVpcPeeringConnectionDeleted uses the Amazon EC2 API operation @@ -926,32 +1411,50 @@ func (c *EC2) WaitUntilVpcExists(input *DescribeVpcsInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVpcPeeringConnectionDeleted(input *DescribeVpcPeeringConnectionsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVpcPeeringConnections", - Delay: 15, + return c.WaitUntilVpcPeeringConnectionDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVpcPeeringConnectionDeletedWithContext is an extended version of WaitUntilVpcPeeringConnectionDeleted. +// 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 *EC2) WaitUntilVpcPeeringConnectionDeletedWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVpcPeeringConnectionDeleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "VpcPeeringConnections[].Status.Code", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "VpcPeeringConnections[].Status.Code", Expected: "deleted", }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidVpcPeeringConnectionID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVpcPeeringConnectionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcPeeringConnectionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVpcPeeringConnectionExists uses the Amazon EC2 API operation @@ -959,32 +1462,50 @@ func (c *EC2) WaitUntilVpcPeeringConnectionDeleted(input *DescribeVpcPeeringConn // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVpcPeeringConnectionExists(input *DescribeVpcPeeringConnectionsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVpcPeeringConnections", - Delay: 15, + return c.WaitUntilVpcPeeringConnectionExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVpcPeeringConnectionExistsWithContext is an extended version of WaitUntilVpcPeeringConnectionExists. +// 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 *EC2) WaitUntilVpcPeeringConnectionExistsWithContext(ctx aws.Context, input *DescribeVpcPeeringConnectionsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVpcPeeringConnectionExists", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "InvalidVpcPeeringConnectionID.NotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVpcPeeringConnectionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpcPeeringConnectionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVpnConnectionAvailable uses the Amazon EC2 API operation @@ -992,38 +1513,55 @@ func (c *EC2) WaitUntilVpcPeeringConnectionExists(input *DescribeVpcPeeringConne // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVpnConnectionAvailable(input *DescribeVpnConnectionsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVpnConnections", - Delay: 15, + return c.WaitUntilVpnConnectionAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVpnConnectionAvailableWithContext is an extended version of WaitUntilVpnConnectionAvailable. +// 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 *EC2) WaitUntilVpnConnectionAvailableWithContext(ctx aws.Context, input *DescribeVpnConnectionsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVpnConnectionAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "VpnConnections[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "VpnConnections[].State", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "VpnConnections[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State", Expected: "deleting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "VpnConnections[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State", Expected: "deleted", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVpnConnectionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpnConnectionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVpnConnectionDeleted uses the Amazon EC2 API operation @@ -1031,30 +1569,48 @@ func (c *EC2) WaitUntilVpnConnectionAvailable(input *DescribeVpnConnectionsInput // If the condition is not meet within the max attempt window an error will // be returned. func (c *EC2) WaitUntilVpnConnectionDeleted(input *DescribeVpnConnectionsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVpnConnections", - Delay: 15, + return c.WaitUntilVpnConnectionDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVpnConnectionDeletedWithContext is an extended version of WaitUntilVpnConnectionDeleted. +// 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 *EC2) WaitUntilVpnConnectionDeletedWithContext(ctx aws.Context, input *DescribeVpnConnectionsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVpnConnectionDeleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "VpnConnections[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "VpnConnections[].State", Expected: "deleted", }, { - State: "failure", - Matcher: "pathAny", - Argument: "VpnConnections[].State", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "VpnConnections[].State", Expected: "pending", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVpnConnectionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVpnConnectionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go index fc46f51459..d0e62e3a12 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package ecr provides a client for Amazon EC2 Container Registry. package ecr @@ -6,6 +6,7 @@ package ecr import ( "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" ) @@ -84,8 +85,23 @@ func (c *ECR) BatchCheckLayerAvailabilityRequest(input *BatchCheckLayerAvailabil // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/BatchCheckLayerAvailability func (c *ECR) BatchCheckLayerAvailability(input *BatchCheckLayerAvailabilityInput) (*BatchCheckLayerAvailabilityOutput, error) { req, out := c.BatchCheckLayerAvailabilityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchCheckLayerAvailabilityWithContext is the same as BatchCheckLayerAvailability with the addition of +// the ability to pass a context and additional request options. +// +// See BatchCheckLayerAvailability 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 *ECR) BatchCheckLayerAvailabilityWithContext(ctx aws.Context, input *BatchCheckLayerAvailabilityInput, opts ...request.Option) (*BatchCheckLayerAvailabilityOutput, error) { + req, out := c.BatchCheckLayerAvailabilityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchDeleteImage = "BatchDeleteImage" @@ -165,8 +181,23 @@ func (c *ECR) BatchDeleteImageRequest(input *BatchDeleteImageInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/BatchDeleteImage func (c *ECR) BatchDeleteImage(input *BatchDeleteImageInput) (*BatchDeleteImageOutput, error) { req, out := c.BatchDeleteImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchDeleteImageWithContext is the same as BatchDeleteImage with the addition of +// the ability to pass a context and additional request options. +// +// See BatchDeleteImage 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 *ECR) BatchDeleteImageWithContext(ctx aws.Context, input *BatchDeleteImageInput, opts ...request.Option) (*BatchDeleteImageOutput, error) { + req, out := c.BatchDeleteImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchGetImage = "BatchGetImage" @@ -239,8 +270,23 @@ func (c *ECR) BatchGetImageRequest(input *BatchGetImageInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/BatchGetImage func (c *ECR) BatchGetImage(input *BatchGetImageInput) (*BatchGetImageOutput, error) { req, out := c.BatchGetImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchGetImageWithContext is the same as BatchGetImage with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetImage 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 *ECR) BatchGetImageWithContext(ctx aws.Context, input *BatchGetImageInput, opts ...request.Option) (*BatchGetImageOutput, error) { + req, out := c.BatchGetImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCompleteLayerUpload = "CompleteLayerUpload" @@ -335,8 +381,23 @@ func (c *ECR) CompleteLayerUploadRequest(input *CompleteLayerUploadInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/CompleteLayerUpload func (c *ECR) CompleteLayerUpload(input *CompleteLayerUploadInput) (*CompleteLayerUploadOutput, error) { req, out := c.CompleteLayerUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CompleteLayerUploadWithContext is the same as CompleteLayerUpload with the addition of +// the ability to pass a context and additional request options. +// +// See CompleteLayerUpload 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 *ECR) CompleteLayerUploadWithContext(ctx aws.Context, input *CompleteLayerUploadInput, opts ...request.Option) (*CompleteLayerUploadOutput, error) { + req, out := c.CompleteLayerUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateRepository = "CreateRepository" @@ -413,8 +474,23 @@ func (c *ECR) CreateRepositoryRequest(input *CreateRepositoryInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/CreateRepository func (c *ECR) CreateRepository(input *CreateRepositoryInput) (*CreateRepositoryOutput, error) { req, out := c.CreateRepositoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateRepositoryWithContext is the same as CreateRepository with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRepository 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 *ECR) CreateRepositoryWithContext(ctx aws.Context, input *CreateRepositoryInput, opts ...request.Option) (*CreateRepositoryOutput, error) { + req, out := c.CreateRepositoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRepository = "DeleteRepository" @@ -491,8 +567,23 @@ func (c *ECR) DeleteRepositoryRequest(input *DeleteRepositoryInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/DeleteRepository func (c *ECR) DeleteRepository(input *DeleteRepositoryInput) (*DeleteRepositoryOutput, error) { req, out := c.DeleteRepositoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRepositoryWithContext is the same as DeleteRepository with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRepository 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 *ECR) DeleteRepositoryWithContext(ctx aws.Context, input *DeleteRepositoryInput, opts ...request.Option) (*DeleteRepositoryOutput, error) { + req, out := c.DeleteRepositoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRepositoryPolicy = "DeleteRepositoryPolicy" @@ -568,8 +659,23 @@ func (c *ECR) DeleteRepositoryPolicyRequest(input *DeleteRepositoryPolicyInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/DeleteRepositoryPolicy func (c *ECR) DeleteRepositoryPolicy(input *DeleteRepositoryPolicyInput) (*DeleteRepositoryPolicyOutput, error) { req, out := c.DeleteRepositoryPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRepositoryPolicyWithContext is the same as DeleteRepositoryPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRepositoryPolicy 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 *ECR) DeleteRepositoryPolicyWithContext(ctx aws.Context, input *DeleteRepositoryPolicyInput, opts ...request.Option) (*DeleteRepositoryPolicyOutput, error) { + req, out := c.DeleteRepositoryPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeImages = "DescribeImages" @@ -656,8 +762,23 @@ func (c *ECR) DescribeImagesRequest(input *DescribeImagesInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/DescribeImages func (c *ECR) DescribeImages(input *DescribeImagesInput) (*DescribeImagesOutput, error) { req, out := c.DescribeImagesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeImagesWithContext is the same as DescribeImages with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeImages 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 *ECR) DescribeImagesWithContext(ctx aws.Context, input *DescribeImagesInput, opts ...request.Option) (*DescribeImagesOutput, error) { + req, out := c.DescribeImagesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeImagesPages iterates over the pages of a DescribeImages operation, @@ -677,12 +798,37 @@ func (c *ECR) DescribeImages(input *DescribeImagesInput) (*DescribeImagesOutput, // return pageNum <= 3 // }) // -func (c *ECR) DescribeImagesPages(input *DescribeImagesInput, fn func(p *DescribeImagesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeImagesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeImagesOutput), lastPage) - }) +func (c *ECR) DescribeImagesPages(input *DescribeImagesInput, fn func(*DescribeImagesOutput, bool) bool) error { + return c.DescribeImagesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeImagesPagesWithContext same as DescribeImagesPages 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 *ECR) DescribeImagesPagesWithContext(ctx aws.Context, input *DescribeImagesInput, fn func(*DescribeImagesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeImagesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeImagesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeImagesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeRepositories = "DescribeRepositories" @@ -760,8 +906,23 @@ func (c *ECR) DescribeRepositoriesRequest(input *DescribeRepositoriesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/DescribeRepositories func (c *ECR) DescribeRepositories(input *DescribeRepositoriesInput) (*DescribeRepositoriesOutput, error) { req, out := c.DescribeRepositoriesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRepositoriesWithContext is the same as DescribeRepositories with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRepositories 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 *ECR) DescribeRepositoriesWithContext(ctx aws.Context, input *DescribeRepositoriesInput, opts ...request.Option) (*DescribeRepositoriesOutput, error) { + req, out := c.DescribeRepositoriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeRepositoriesPages iterates over the pages of a DescribeRepositories operation, @@ -781,12 +942,37 @@ func (c *ECR) DescribeRepositories(input *DescribeRepositoriesInput) (*DescribeR // return pageNum <= 3 // }) // -func (c *ECR) DescribeRepositoriesPages(input *DescribeRepositoriesInput, fn func(p *DescribeRepositoriesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeRepositoriesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeRepositoriesOutput), lastPage) - }) +func (c *ECR) DescribeRepositoriesPages(input *DescribeRepositoriesInput, fn func(*DescribeRepositoriesOutput, bool) bool) error { + return c.DescribeRepositoriesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeRepositoriesPagesWithContext same as DescribeRepositoriesPages 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 *ECR) DescribeRepositoriesPagesWithContext(ctx aws.Context, input *DescribeRepositoriesInput, fn func(*DescribeRepositoriesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeRepositoriesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeRepositoriesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeRepositoriesOutput), !p.HasNextPage()) + } + return p.Err() } const opGetAuthorizationToken = "GetAuthorizationToken" @@ -861,8 +1047,23 @@ func (c *ECR) GetAuthorizationTokenRequest(input *GetAuthorizationTokenInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/GetAuthorizationToken func (c *ECR) GetAuthorizationToken(input *GetAuthorizationTokenInput) (*GetAuthorizationTokenOutput, error) { req, out := c.GetAuthorizationTokenRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAuthorizationTokenWithContext is the same as GetAuthorizationToken with the addition of +// the ability to pass a context and additional request options. +// +// See GetAuthorizationToken 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 *ECR) GetAuthorizationTokenWithContext(ctx aws.Context, input *GetAuthorizationTokenInput, opts ...request.Option) (*GetAuthorizationTokenOutput, error) { + req, out := c.GetAuthorizationTokenRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDownloadUrlForLayer = "GetDownloadUrlForLayer" @@ -947,8 +1148,23 @@ func (c *ECR) GetDownloadUrlForLayerRequest(input *GetDownloadUrlForLayerInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/GetDownloadUrlForLayer func (c *ECR) GetDownloadUrlForLayer(input *GetDownloadUrlForLayerInput) (*GetDownloadUrlForLayerOutput, error) { req, out := c.GetDownloadUrlForLayerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDownloadUrlForLayerWithContext is the same as GetDownloadUrlForLayer with the addition of +// the ability to pass a context and additional request options. +// +// See GetDownloadUrlForLayer 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 *ECR) GetDownloadUrlForLayerWithContext(ctx aws.Context, input *GetDownloadUrlForLayerInput, opts ...request.Option) (*GetDownloadUrlForLayerOutput, error) { + req, out := c.GetDownloadUrlForLayerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRepositoryPolicy = "GetRepositoryPolicy" @@ -1024,8 +1240,23 @@ func (c *ECR) GetRepositoryPolicyRequest(input *GetRepositoryPolicyInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/GetRepositoryPolicy func (c *ECR) GetRepositoryPolicy(input *GetRepositoryPolicyInput) (*GetRepositoryPolicyOutput, error) { req, out := c.GetRepositoryPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRepositoryPolicyWithContext is the same as GetRepositoryPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetRepositoryPolicy 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 *ECR) GetRepositoryPolicyWithContext(ctx aws.Context, input *GetRepositoryPolicyInput, opts ...request.Option) (*GetRepositoryPolicyOutput, error) { + req, out := c.GetRepositoryPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opInitiateLayerUpload = "InitiateLayerUpload" @@ -1101,8 +1332,23 @@ func (c *ECR) InitiateLayerUploadRequest(input *InitiateLayerUploadInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/InitiateLayerUpload func (c *ECR) InitiateLayerUpload(input *InitiateLayerUploadInput) (*InitiateLayerUploadOutput, error) { req, out := c.InitiateLayerUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// InitiateLayerUploadWithContext is the same as InitiateLayerUpload with the addition of +// the ability to pass a context and additional request options. +// +// See InitiateLayerUpload 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 *ECR) InitiateLayerUploadWithContext(ctx aws.Context, input *InitiateLayerUploadInput, opts ...request.Option) (*InitiateLayerUploadOutput, error) { + req, out := c.InitiateLayerUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListImages = "ListImages" @@ -1186,8 +1432,23 @@ func (c *ECR) ListImagesRequest(input *ListImagesInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/ListImages func (c *ECR) ListImages(input *ListImagesInput) (*ListImagesOutput, error) { req, out := c.ListImagesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListImagesWithContext is the same as ListImages with the addition of +// the ability to pass a context and additional request options. +// +// See ListImages 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 *ECR) ListImagesWithContext(ctx aws.Context, input *ListImagesInput, opts ...request.Option) (*ListImagesOutput, error) { + req, out := c.ListImagesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListImagesPages iterates over the pages of a ListImages operation, @@ -1207,12 +1468,37 @@ func (c *ECR) ListImages(input *ListImagesInput) (*ListImagesOutput, error) { // return pageNum <= 3 // }) // -func (c *ECR) ListImagesPages(input *ListImagesInput, fn func(p *ListImagesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListImagesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListImagesOutput), lastPage) - }) +func (c *ECR) ListImagesPages(input *ListImagesInput, fn func(*ListImagesOutput, bool) bool) error { + return c.ListImagesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListImagesPagesWithContext same as ListImagesPages 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 *ECR) ListImagesPagesWithContext(ctx aws.Context, input *ListImagesInput, fn func(*ListImagesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListImagesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListImagesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListImagesOutput), !p.HasNextPage()) + } + return p.Err() } const opPutImage = "PutImage" @@ -1302,8 +1588,23 @@ func (c *ECR) PutImageRequest(input *PutImageInput) (req *request.Request, outpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/PutImage func (c *ECR) PutImage(input *PutImageInput) (*PutImageOutput, error) { req, out := c.PutImageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutImageWithContext is the same as PutImage with the addition of +// the ability to pass a context and additional request options. +// +// See PutImage 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 *ECR) PutImageWithContext(ctx aws.Context, input *PutImageInput, opts ...request.Option) (*PutImageOutput, error) { + req, out := c.PutImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetRepositoryPolicy = "SetRepositoryPolicy" @@ -1375,8 +1676,23 @@ func (c *ECR) SetRepositoryPolicyRequest(input *SetRepositoryPolicyInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/SetRepositoryPolicy func (c *ECR) SetRepositoryPolicy(input *SetRepositoryPolicyInput) (*SetRepositoryPolicyOutput, error) { req, out := c.SetRepositoryPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetRepositoryPolicyWithContext is the same as SetRepositoryPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See SetRepositoryPolicy 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 *ECR) SetRepositoryPolicyWithContext(ctx aws.Context, input *SetRepositoryPolicyInput, opts ...request.Option) (*SetRepositoryPolicyOutput, error) { + req, out := c.SetRepositoryPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadLayerPart = "UploadLayerPart" @@ -1466,8 +1782,23 @@ func (c *ECR) UploadLayerPartRequest(input *UploadLayerPartInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21/UploadLayerPart func (c *ECR) UploadLayerPart(input *UploadLayerPartInput) (*UploadLayerPartOutput, error) { req, out := c.UploadLayerPartRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadLayerPartWithContext is the same as UploadLayerPart with the addition of +// the ability to pass a context and additional request options. +// +// See UploadLayerPart 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 *ECR) UploadLayerPartWithContext(ctx aws.Context, input *UploadLayerPartInput, opts ...request.Option) (*UploadLayerPartOutput, error) { + req, out := c.UploadLayerPartRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // An object representing authorization data for an Amazon ECR registry. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go index c51948bc77..4399e6a295 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ecr diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go index 2c7904b759..76c8fa450d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ecr/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ecr diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/api.go index 68ccbd5116..12eb794fb7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package ecs provides a client for Amazon EC2 Container Service. package ecs @@ -7,6 +7,7 @@ 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" ) @@ -83,8 +84,23 @@ func (c *ECS) CreateClusterRequest(input *CreateClusterInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateCluster func (c *ECS) CreateCluster(input *CreateClusterInput) (*CreateClusterOutput, error) { req, out := c.CreateClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateClusterWithContext is the same as CreateCluster with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCluster 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 *ECS) CreateClusterWithContext(ctx aws.Context, input *CreateClusterInput, opts ...request.Option) (*CreateClusterOutput, error) { + req, out := c.CreateClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateService = "CreateService" @@ -218,8 +234,23 @@ func (c *ECS) CreateServiceRequest(input *CreateServiceInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateService func (c *ECS) CreateService(input *CreateServiceInput) (*CreateServiceOutput, error) { req, out := c.CreateServiceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateServiceWithContext is the same as CreateService with the addition of +// the ability to pass a context and additional request options. +// +// See CreateService 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 *ECS) CreateServiceWithContext(ctx aws.Context, input *CreateServiceInput, opts ...request.Option) (*CreateServiceOutput, error) { + req, out := c.CreateServiceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAttributes = "DeleteAttributes" @@ -293,8 +324,23 @@ func (c *ECS) DeleteAttributesRequest(input *DeleteAttributesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteAttributes func (c *ECS) DeleteAttributes(input *DeleteAttributesInput) (*DeleteAttributesOutput, error) { req, out := c.DeleteAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAttributesWithContext is the same as DeleteAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAttributes 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 *ECS) DeleteAttributesWithContext(ctx aws.Context, input *DeleteAttributesInput, opts ...request.Option) (*DeleteAttributesOutput, error) { + req, out := c.DeleteAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCluster = "DeleteCluster" @@ -383,8 +429,23 @@ func (c *ECS) DeleteClusterRequest(input *DeleteClusterInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteCluster func (c *ECS) DeleteCluster(input *DeleteClusterInput) (*DeleteClusterOutput, error) { req, out := c.DeleteClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteClusterWithContext is the same as DeleteCluster with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCluster 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 *ECS) DeleteClusterWithContext(ctx aws.Context, input *DeleteClusterInput, opts ...request.Option) (*DeleteClusterOutput, error) { + req, out := c.DeleteClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteService = "DeleteService" @@ -478,8 +539,23 @@ func (c *ECS) DeleteServiceRequest(input *DeleteServiceInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteService func (c *ECS) DeleteService(input *DeleteServiceInput) (*DeleteServiceOutput, error) { req, out := c.DeleteServiceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteServiceWithContext is the same as DeleteService with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteService 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 *ECS) DeleteServiceWithContext(ctx aws.Context, input *DeleteServiceInput, opts ...request.Option) (*DeleteServiceOutput, error) { + req, out := c.DeleteServiceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterContainerInstance = "DeregisterContainerInstance" @@ -570,8 +646,23 @@ func (c *ECS) DeregisterContainerInstanceRequest(input *DeregisterContainerInsta // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterContainerInstance func (c *ECS) DeregisterContainerInstance(input *DeregisterContainerInstanceInput) (*DeregisterContainerInstanceOutput, error) { req, out := c.DeregisterContainerInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterContainerInstanceWithContext is the same as DeregisterContainerInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterContainerInstance 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 *ECS) DeregisterContainerInstanceWithContext(ctx aws.Context, input *DeregisterContainerInstanceInput, opts ...request.Option) (*DeregisterContainerInstanceOutput, error) { + req, out := c.DeregisterContainerInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterTaskDefinition = "DeregisterTaskDefinition" @@ -653,8 +744,23 @@ func (c *ECS) DeregisterTaskDefinitionRequest(input *DeregisterTaskDefinitionInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterTaskDefinition func (c *ECS) DeregisterTaskDefinition(input *DeregisterTaskDefinitionInput) (*DeregisterTaskDefinitionOutput, error) { req, out := c.DeregisterTaskDefinitionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterTaskDefinitionWithContext is the same as DeregisterTaskDefinition with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterTaskDefinition 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 *ECS) DeregisterTaskDefinitionWithContext(ctx aws.Context, input *DeregisterTaskDefinitionInput, opts ...request.Option) (*DeregisterTaskDefinitionOutput, error) { + req, out := c.DeregisterTaskDefinitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeClusters = "DescribeClusters" @@ -727,8 +833,23 @@ func (c *ECS) DescribeClustersRequest(input *DescribeClustersInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeClusters func (c *ECS) DescribeClusters(input *DescribeClustersInput) (*DescribeClustersOutput, error) { req, out := c.DescribeClustersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClustersWithContext is the same as DescribeClusters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusters 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 *ECS) DescribeClustersWithContext(ctx aws.Context, input *DescribeClustersInput, opts ...request.Option) (*DescribeClustersOutput, error) { + req, out := c.DescribeClustersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeContainerInstances = "DescribeContainerInstances" @@ -806,8 +927,23 @@ func (c *ECS) DescribeContainerInstancesRequest(input *DescribeContainerInstance // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeContainerInstances func (c *ECS) DescribeContainerInstances(input *DescribeContainerInstancesInput) (*DescribeContainerInstancesOutput, error) { req, out := c.DescribeContainerInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeContainerInstancesWithContext is the same as DescribeContainerInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeContainerInstances 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 *ECS) DescribeContainerInstancesWithContext(ctx aws.Context, input *DescribeContainerInstancesInput, opts ...request.Option) (*DescribeContainerInstancesOutput, error) { + req, out := c.DescribeContainerInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeServices = "DescribeServices" @@ -884,8 +1020,23 @@ func (c *ECS) DescribeServicesRequest(input *DescribeServicesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeServices func (c *ECS) DescribeServices(input *DescribeServicesInput) (*DescribeServicesOutput, error) { req, out := c.DescribeServicesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeServicesWithContext is the same as DescribeServices with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeServices 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 *ECS) DescribeServicesWithContext(ctx aws.Context, input *DescribeServicesInput, opts ...request.Option) (*DescribeServicesOutput, error) { + req, out := c.DescribeServicesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTaskDefinition = "DescribeTaskDefinition" @@ -963,8 +1114,23 @@ func (c *ECS) DescribeTaskDefinitionRequest(input *DescribeTaskDefinitionInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTaskDefinition func (c *ECS) DescribeTaskDefinition(input *DescribeTaskDefinitionInput) (*DescribeTaskDefinitionOutput, error) { req, out := c.DescribeTaskDefinitionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTaskDefinitionWithContext is the same as DescribeTaskDefinition with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTaskDefinition 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 *ECS) DescribeTaskDefinitionWithContext(ctx aws.Context, input *DescribeTaskDefinitionInput, opts ...request.Option) (*DescribeTaskDefinitionOutput, error) { + req, out := c.DescribeTaskDefinitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTasks = "DescribeTasks" @@ -1041,8 +1207,23 @@ func (c *ECS) DescribeTasksRequest(input *DescribeTasksInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTasks func (c *ECS) DescribeTasks(input *DescribeTasksInput) (*DescribeTasksOutput, error) { req, out := c.DescribeTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTasksWithContext is the same as DescribeTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTasks 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 *ECS) DescribeTasksWithContext(ctx aws.Context, input *DescribeTasksInput, opts ...request.Option) (*DescribeTasksOutput, error) { + req, out := c.DescribeTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDiscoverPollEndpoint = "DiscoverPollEndpoint" @@ -1115,8 +1296,23 @@ func (c *ECS) DiscoverPollEndpointRequest(input *DiscoverPollEndpointInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DiscoverPollEndpoint func (c *ECS) DiscoverPollEndpoint(input *DiscoverPollEndpointInput) (*DiscoverPollEndpointOutput, error) { req, out := c.DiscoverPollEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DiscoverPollEndpointWithContext is the same as DiscoverPollEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See DiscoverPollEndpoint 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 *ECS) DiscoverPollEndpointWithContext(ctx aws.Context, input *DiscoverPollEndpointInput, opts ...request.Option) (*DiscoverPollEndpointOutput, error) { + req, out := c.DiscoverPollEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAttributes = "ListAttributes" @@ -1191,8 +1387,23 @@ func (c *ECS) ListAttributesRequest(input *ListAttributesInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAttributes func (c *ECS) ListAttributes(input *ListAttributesInput) (*ListAttributesOutput, error) { req, out := c.ListAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAttributesWithContext is the same as ListAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See ListAttributes 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 *ECS) ListAttributesWithContext(ctx aws.Context, input *ListAttributesInput, opts ...request.Option) (*ListAttributesOutput, error) { + req, out := c.ListAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListClusters = "ListClusters" @@ -1271,8 +1482,23 @@ func (c *ECS) ListClustersRequest(input *ListClustersInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListClusters func (c *ECS) ListClusters(input *ListClustersInput) (*ListClustersOutput, error) { req, out := c.ListClustersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListClustersWithContext is the same as ListClusters with the addition of +// the ability to pass a context and additional request options. +// +// See ListClusters 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 *ECS) ListClustersWithContext(ctx aws.Context, input *ListClustersInput, opts ...request.Option) (*ListClustersOutput, error) { + req, out := c.ListClustersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListClustersPages iterates over the pages of a ListClusters operation, @@ -1292,12 +1518,37 @@ func (c *ECS) ListClusters(input *ListClustersInput) (*ListClustersOutput, error // return pageNum <= 3 // }) // -func (c *ECS) ListClustersPages(input *ListClustersInput, fn func(p *ListClustersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListClustersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListClustersOutput), lastPage) - }) +func (c *ECS) ListClustersPages(input *ListClustersInput, fn func(*ListClustersOutput, bool) bool) error { + return c.ListClustersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListClustersPagesWithContext same as ListClustersPages 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 *ECS) ListClustersPagesWithContext(ctx aws.Context, input *ListClustersInput, fn func(*ListClustersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListClustersOutput), !p.HasNextPage()) + } + return p.Err() } const opListContainerInstances = "ListContainerInstances" @@ -1384,8 +1635,23 @@ func (c *ECS) ListContainerInstancesRequest(input *ListContainerInstancesInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListContainerInstances func (c *ECS) ListContainerInstances(input *ListContainerInstancesInput) (*ListContainerInstancesOutput, error) { req, out := c.ListContainerInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListContainerInstancesWithContext is the same as ListContainerInstances with the addition of +// the ability to pass a context and additional request options. +// +// See ListContainerInstances 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 *ECS) ListContainerInstancesWithContext(ctx aws.Context, input *ListContainerInstancesInput, opts ...request.Option) (*ListContainerInstancesOutput, error) { + req, out := c.ListContainerInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListContainerInstancesPages iterates over the pages of a ListContainerInstances operation, @@ -1405,12 +1671,37 @@ func (c *ECS) ListContainerInstances(input *ListContainerInstancesInput) (*ListC // return pageNum <= 3 // }) // -func (c *ECS) ListContainerInstancesPages(input *ListContainerInstancesInput, fn func(p *ListContainerInstancesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListContainerInstancesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListContainerInstancesOutput), lastPage) - }) +func (c *ECS) ListContainerInstancesPages(input *ListContainerInstancesInput, fn func(*ListContainerInstancesOutput, bool) bool) error { + return c.ListContainerInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListContainerInstancesPagesWithContext same as ListContainerInstancesPages 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 *ECS) ListContainerInstancesPagesWithContext(ctx aws.Context, input *ListContainerInstancesInput, fn func(*ListContainerInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListContainerInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListContainerInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListContainerInstancesOutput), !p.HasNextPage()) + } + return p.Err() } const opListServices = "ListServices" @@ -1493,8 +1784,23 @@ func (c *ECS) ListServicesRequest(input *ListServicesInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListServices func (c *ECS) ListServices(input *ListServicesInput) (*ListServicesOutput, error) { req, out := c.ListServicesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListServicesWithContext is the same as ListServices with the addition of +// the ability to pass a context and additional request options. +// +// See ListServices 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 *ECS) ListServicesWithContext(ctx aws.Context, input *ListServicesInput, opts ...request.Option) (*ListServicesOutput, error) { + req, out := c.ListServicesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListServicesPages iterates over the pages of a ListServices operation, @@ -1514,12 +1820,37 @@ func (c *ECS) ListServices(input *ListServicesInput) (*ListServicesOutput, error // return pageNum <= 3 // }) // -func (c *ECS) ListServicesPages(input *ListServicesInput, fn func(p *ListServicesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListServicesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListServicesOutput), lastPage) - }) +func (c *ECS) ListServicesPages(input *ListServicesInput, fn func(*ListServicesOutput, bool) bool) error { + return c.ListServicesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListServicesPagesWithContext same as ListServicesPages 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 *ECS) ListServicesPagesWithContext(ctx aws.Context, input *ListServicesInput, fn func(*ListServicesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListServicesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListServicesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListServicesOutput), !p.HasNextPage()) + } + return p.Err() } const opListTaskDefinitionFamilies = "ListTaskDefinitionFamilies" @@ -1604,8 +1935,23 @@ func (c *ECS) ListTaskDefinitionFamiliesRequest(input *ListTaskDefinitionFamilie // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitionFamilies func (c *ECS) ListTaskDefinitionFamilies(input *ListTaskDefinitionFamiliesInput) (*ListTaskDefinitionFamiliesOutput, error) { req, out := c.ListTaskDefinitionFamiliesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTaskDefinitionFamiliesWithContext is the same as ListTaskDefinitionFamilies with the addition of +// the ability to pass a context and additional request options. +// +// See ListTaskDefinitionFamilies 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 *ECS) ListTaskDefinitionFamiliesWithContext(ctx aws.Context, input *ListTaskDefinitionFamiliesInput, opts ...request.Option) (*ListTaskDefinitionFamiliesOutput, error) { + req, out := c.ListTaskDefinitionFamiliesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListTaskDefinitionFamiliesPages iterates over the pages of a ListTaskDefinitionFamilies operation, @@ -1625,12 +1971,37 @@ func (c *ECS) ListTaskDefinitionFamilies(input *ListTaskDefinitionFamiliesInput) // return pageNum <= 3 // }) // -func (c *ECS) ListTaskDefinitionFamiliesPages(input *ListTaskDefinitionFamiliesInput, fn func(p *ListTaskDefinitionFamiliesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListTaskDefinitionFamiliesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListTaskDefinitionFamiliesOutput), lastPage) - }) +func (c *ECS) ListTaskDefinitionFamiliesPages(input *ListTaskDefinitionFamiliesInput, fn func(*ListTaskDefinitionFamiliesOutput, bool) bool) error { + return c.ListTaskDefinitionFamiliesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListTaskDefinitionFamiliesPagesWithContext same as ListTaskDefinitionFamiliesPages 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 *ECS) ListTaskDefinitionFamiliesPagesWithContext(ctx aws.Context, input *ListTaskDefinitionFamiliesInput, fn func(*ListTaskDefinitionFamiliesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListTaskDefinitionFamiliesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListTaskDefinitionFamiliesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListTaskDefinitionFamiliesOutput), !p.HasNextPage()) + } + return p.Err() } const opListTaskDefinitions = "ListTaskDefinitions" @@ -1711,8 +2082,23 @@ func (c *ECS) ListTaskDefinitionsRequest(input *ListTaskDefinitionsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitions func (c *ECS) ListTaskDefinitions(input *ListTaskDefinitionsInput) (*ListTaskDefinitionsOutput, error) { req, out := c.ListTaskDefinitionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTaskDefinitionsWithContext is the same as ListTaskDefinitions with the addition of +// the ability to pass a context and additional request options. +// +// See ListTaskDefinitions 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 *ECS) ListTaskDefinitionsWithContext(ctx aws.Context, input *ListTaskDefinitionsInput, opts ...request.Option) (*ListTaskDefinitionsOutput, error) { + req, out := c.ListTaskDefinitionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListTaskDefinitionsPages iterates over the pages of a ListTaskDefinitions operation, @@ -1732,12 +2118,37 @@ func (c *ECS) ListTaskDefinitions(input *ListTaskDefinitionsInput) (*ListTaskDef // return pageNum <= 3 // }) // -func (c *ECS) ListTaskDefinitionsPages(input *ListTaskDefinitionsInput, fn func(p *ListTaskDefinitionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListTaskDefinitionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListTaskDefinitionsOutput), lastPage) - }) +func (c *ECS) ListTaskDefinitionsPages(input *ListTaskDefinitionsInput, fn func(*ListTaskDefinitionsOutput, bool) bool) error { + return c.ListTaskDefinitionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListTaskDefinitionsPagesWithContext same as ListTaskDefinitionsPages 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 *ECS) ListTaskDefinitionsPagesWithContext(ctx aws.Context, input *ListTaskDefinitionsInput, fn func(*ListTaskDefinitionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListTaskDefinitionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListTaskDefinitionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListTaskDefinitionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListTasks = "ListTasks" @@ -1829,8 +2240,23 @@ func (c *ECS) ListTasksRequest(input *ListTasksInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTasks func (c *ECS) ListTasks(input *ListTasksInput) (*ListTasksOutput, error) { req, out := c.ListTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTasksWithContext is the same as ListTasks with the addition of +// the ability to pass a context and additional request options. +// +// See ListTasks 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 *ECS) ListTasksWithContext(ctx aws.Context, input *ListTasksInput, opts ...request.Option) (*ListTasksOutput, error) { + req, out := c.ListTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListTasksPages iterates over the pages of a ListTasks operation, @@ -1850,12 +2276,37 @@ func (c *ECS) ListTasks(input *ListTasksInput) (*ListTasksOutput, error) { // return pageNum <= 3 // }) // -func (c *ECS) ListTasksPages(input *ListTasksInput, fn func(p *ListTasksOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListTasksRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListTasksOutput), lastPage) - }) +func (c *ECS) ListTasksPages(input *ListTasksInput, fn func(*ListTasksOutput, bool) bool) error { + return c.ListTasksPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListTasksPagesWithContext same as ListTasksPages 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 *ECS) ListTasksPagesWithContext(ctx aws.Context, input *ListTasksInput, fn func(*ListTasksOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListTasksOutput), !p.HasNextPage()) + } + return p.Err() } const opPutAttributes = "PutAttributes" @@ -1938,8 +2389,23 @@ func (c *ECS) PutAttributesRequest(input *PutAttributesInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAttributes func (c *ECS) PutAttributes(input *PutAttributesInput) (*PutAttributesOutput, error) { req, out := c.PutAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutAttributesWithContext is the same as PutAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See PutAttributes 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 *ECS) PutAttributesWithContext(ctx aws.Context, input *PutAttributesInput, opts ...request.Option) (*PutAttributesOutput, error) { + req, out := c.PutAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterContainerInstance = "RegisterContainerInstance" @@ -2012,8 +2478,23 @@ func (c *ECS) RegisterContainerInstanceRequest(input *RegisterContainerInstanceI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RegisterContainerInstance func (c *ECS) RegisterContainerInstance(input *RegisterContainerInstanceInput) (*RegisterContainerInstanceOutput, error) { req, out := c.RegisterContainerInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterContainerInstanceWithContext is the same as RegisterContainerInstance with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterContainerInstance 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 *ECS) RegisterContainerInstanceWithContext(ctx aws.Context, input *RegisterContainerInstanceInput, opts ...request.Option) (*RegisterContainerInstanceOutput, error) { + req, out := c.RegisterContainerInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterTaskDefinition = "RegisterTaskDefinition" @@ -2102,8 +2583,23 @@ func (c *ECS) RegisterTaskDefinitionRequest(input *RegisterTaskDefinitionInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RegisterTaskDefinition func (c *ECS) RegisterTaskDefinition(input *RegisterTaskDefinitionInput) (*RegisterTaskDefinitionOutput, error) { req, out := c.RegisterTaskDefinitionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterTaskDefinitionWithContext is the same as RegisterTaskDefinition with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterTaskDefinition 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 *ECS) RegisterTaskDefinitionWithContext(ctx aws.Context, input *RegisterTaskDefinitionInput, opts ...request.Option) (*RegisterTaskDefinitionOutput, error) { + req, out := c.RegisterTaskDefinitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRunTask = "RunTask" @@ -2188,8 +2684,23 @@ func (c *ECS) RunTaskRequest(input *RunTaskInput) (req *request.Request, output // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RunTask func (c *ECS) RunTask(input *RunTaskInput) (*RunTaskOutput, error) { req, out := c.RunTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RunTaskWithContext is the same as RunTask with the addition of +// the ability to pass a context and additional request options. +// +// See RunTask 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 *ECS) RunTaskWithContext(ctx aws.Context, input *RunTaskInput, opts ...request.Option) (*RunTaskOutput, error) { + req, out := c.RunTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartTask = "StartTask" @@ -2271,8 +2782,23 @@ func (c *ECS) StartTaskRequest(input *StartTaskInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StartTask func (c *ECS) StartTask(input *StartTaskInput) (*StartTaskOutput, error) { req, out := c.StartTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartTaskWithContext is the same as StartTask with the addition of +// the ability to pass a context and additional request options. +// +// See StartTask 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 *ECS) StartTaskWithContext(ctx aws.Context, input *StartTaskInput, opts ...request.Option) (*StartTaskOutput, error) { + req, out := c.StartTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopTask = "StopTask" @@ -2355,8 +2881,23 @@ func (c *ECS) StopTaskRequest(input *StopTaskInput) (req *request.Request, outpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StopTask func (c *ECS) StopTask(input *StopTaskInput) (*StopTaskOutput, error) { req, out := c.StopTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopTaskWithContext is the same as StopTask with the addition of +// the ability to pass a context and additional request options. +// +// See StopTask 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 *ECS) StopTaskWithContext(ctx aws.Context, input *StopTaskInput, opts ...request.Option) (*StopTaskOutput, error) { + req, out := c.StopTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSubmitContainerStateChange = "SubmitContainerStateChange" @@ -2428,8 +2969,23 @@ func (c *ECS) SubmitContainerStateChangeRequest(input *SubmitContainerStateChang // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/SubmitContainerStateChange func (c *ECS) SubmitContainerStateChange(input *SubmitContainerStateChangeInput) (*SubmitContainerStateChangeOutput, error) { req, out := c.SubmitContainerStateChangeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SubmitContainerStateChangeWithContext is the same as SubmitContainerStateChange with the addition of +// the ability to pass a context and additional request options. +// +// See SubmitContainerStateChange 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 *ECS) SubmitContainerStateChangeWithContext(ctx aws.Context, input *SubmitContainerStateChangeInput, opts ...request.Option) (*SubmitContainerStateChangeOutput, error) { + req, out := c.SubmitContainerStateChangeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSubmitTaskStateChange = "SubmitTaskStateChange" @@ -2501,8 +3057,23 @@ func (c *ECS) SubmitTaskStateChangeRequest(input *SubmitTaskStateChangeInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/SubmitTaskStateChange func (c *ECS) SubmitTaskStateChange(input *SubmitTaskStateChangeInput) (*SubmitTaskStateChangeOutput, error) { req, out := c.SubmitTaskStateChangeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SubmitTaskStateChangeWithContext is the same as SubmitTaskStateChange with the addition of +// the ability to pass a context and additional request options. +// +// See SubmitTaskStateChange 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 *ECS) SubmitTaskStateChangeWithContext(ctx aws.Context, input *SubmitTaskStateChangeInput, opts ...request.Option) (*SubmitTaskStateChangeOutput, error) { + req, out := c.SubmitTaskStateChangeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateContainerAgent = "UpdateContainerAgent" @@ -2607,8 +3178,23 @@ func (c *ECS) UpdateContainerAgentRequest(input *UpdateContainerAgentInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerAgent func (c *ECS) UpdateContainerAgent(input *UpdateContainerAgentInput) (*UpdateContainerAgentOutput, error) { req, out := c.UpdateContainerAgentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateContainerAgentWithContext is the same as UpdateContainerAgent with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateContainerAgent 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 *ECS) UpdateContainerAgentWithContext(ctx aws.Context, input *UpdateContainerAgentInput, opts ...request.Option) (*UpdateContainerAgentOutput, error) { + req, out := c.UpdateContainerAgentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateContainerInstancesState = "UpdateContainerInstancesState" @@ -2728,8 +3314,23 @@ func (c *ECS) UpdateContainerInstancesStateRequest(input *UpdateContainerInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerInstancesState func (c *ECS) UpdateContainerInstancesState(input *UpdateContainerInstancesStateInput) (*UpdateContainerInstancesStateOutput, error) { req, out := c.UpdateContainerInstancesStateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateContainerInstancesStateWithContext is the same as UpdateContainerInstancesState with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateContainerInstancesState 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 *ECS) UpdateContainerInstancesStateWithContext(ctx aws.Context, input *UpdateContainerInstancesStateInput, opts ...request.Option) (*UpdateContainerInstancesStateOutput, error) { + req, out := c.UpdateContainerInstancesStateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateService = "UpdateService" @@ -2881,8 +3482,23 @@ func (c *ECS) UpdateServiceRequest(input *UpdateServiceInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateService func (c *ECS) UpdateService(input *UpdateServiceInput) (*UpdateServiceOutput, error) { req, out := c.UpdateServiceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateServiceWithContext is the same as UpdateService with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateService 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 *ECS) UpdateServiceWithContext(ctx aws.Context, input *UpdateServiceInput, opts ...request.Option) (*UpdateServiceOutput, error) { + req, out := c.UpdateServiceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // An attribute is a name-value pair associated with an Amazon ECS object. Attributes diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/errors.go index 02d4d4ab54..1e32412acd 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ecs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go index 4998b15fd8..67ef4953ca 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ecs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/waiters.go index cbc6f76e1e..007b21614b 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ecs/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ecs import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilServicesInactive uses the Amazon ECS API operation @@ -11,32 +14,50 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *ECS) WaitUntilServicesInactive(input *DescribeServicesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeServices", - Delay: 15, + return c.WaitUntilServicesInactiveWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilServicesInactiveWithContext is an extended version of WaitUntilServicesInactive. +// 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 *ECS) WaitUntilServicesInactiveWithContext(ctx aws.Context, input *DescribeServicesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilServicesInactive", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "failure", - Matcher: "pathAny", - Argument: "failures[].reason", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "failures[].reason", Expected: "MISSING", }, { - State: "success", - Matcher: "pathAny", - Argument: "services[].status", + State: request.SuccessWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "services[].status", Expected: "INACTIVE", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeServicesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeServicesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilServicesStable uses the Amazon ECS API operation @@ -44,44 +65,60 @@ func (c *ECS) WaitUntilServicesInactive(input *DescribeServicesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *ECS) WaitUntilServicesStable(input *DescribeServicesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeServices", - Delay: 15, + return c.WaitUntilServicesStableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilServicesStableWithContext is an extended version of WaitUntilServicesStable. +// 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 *ECS) WaitUntilServicesStableWithContext(ctx aws.Context, input *DescribeServicesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilServicesStable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "failure", - Matcher: "pathAny", - Argument: "failures[].reason", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "failures[].reason", Expected: "MISSING", }, { - State: "failure", - Matcher: "pathAny", - Argument: "services[].status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "services[].status", Expected: "DRAINING", }, { - State: "failure", - Matcher: "pathAny", - Argument: "services[].status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "services[].status", Expected: "INACTIVE", }, { - State: "success", - Matcher: "path", - Argument: "length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`", Expected: true, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeServicesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeServicesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilTasksRunning uses the Amazon ECS API operation @@ -89,38 +126,55 @@ func (c *ECS) WaitUntilServicesStable(input *DescribeServicesInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *ECS) WaitUntilTasksRunning(input *DescribeTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeTasks", - Delay: 6, + return c.WaitUntilTasksRunningWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilTasksRunningWithContext is an extended version of WaitUntilTasksRunning. +// 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 *ECS) WaitUntilTasksRunningWithContext(ctx aws.Context, input *DescribeTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilTasksRunning", MaxAttempts: 100, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(6 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "failure", - Matcher: "pathAny", - Argument: "tasks[].lastStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "tasks[].lastStatus", Expected: "STOPPED", }, { - State: "failure", - Matcher: "pathAny", - Argument: "failures[].reason", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "failures[].reason", Expected: "MISSING", }, { - State: "success", - Matcher: "pathAll", - Argument: "tasks[].lastStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "tasks[].lastStatus", Expected: "RUNNING", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilTasksStopped uses the Amazon ECS API operation @@ -128,24 +182,43 @@ func (c *ECS) WaitUntilTasksRunning(input *DescribeTasksInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *ECS) WaitUntilTasksStopped(input *DescribeTasksInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeTasks", - Delay: 6, + return c.WaitUntilTasksStoppedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilTasksStoppedWithContext is an extended version of WaitUntilTasksStopped. +// 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 *ECS) WaitUntilTasksStoppedWithContext(ctx aws.Context, input *DescribeTasksInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilTasksStopped", MaxAttempts: 100, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(6 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "tasks[].lastStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "tasks[].lastStatus", Expected: "STOPPED", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeTasksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeTasksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/efs/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/efs/api.go index f4c2ac141e..e137e30d6a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/efs/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/efs/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package efs provides a client for Amazon Elastic File System. package efs @@ -7,6 +7,7 @@ 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" @@ -131,8 +132,23 @@ func (c *EFS) CreateFileSystemRequest(input *CreateFileSystemInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/CreateFileSystem func (c *EFS) CreateFileSystem(input *CreateFileSystemInput) (*FileSystemDescription, error) { req, out := c.CreateFileSystemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateFileSystemWithContext is the same as CreateFileSystem with the addition of +// the ability to pass a context and additional request options. +// +// See CreateFileSystem 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 *EFS) CreateFileSystemWithContext(ctx aws.Context, input *CreateFileSystemInput, opts ...request.Option) (*FileSystemDescription, error) { + req, out := c.CreateFileSystemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateMountTarget = "CreateMountTarget" @@ -333,8 +349,23 @@ func (c *EFS) CreateMountTargetRequest(input *CreateMountTargetInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/CreateMountTarget func (c *EFS) CreateMountTarget(input *CreateMountTargetInput) (*MountTargetDescription, error) { req, out := c.CreateMountTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateMountTargetWithContext is the same as CreateMountTarget with the addition of +// the ability to pass a context and additional request options. +// +// See CreateMountTarget 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 *EFS) CreateMountTargetWithContext(ctx aws.Context, input *CreateMountTargetInput, opts ...request.Option) (*MountTargetDescription, error) { + req, out := c.CreateMountTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTags = "CreateTags" @@ -414,8 +445,23 @@ func (c *EFS) CreateTagsRequest(input *CreateTagsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/CreateTags func (c *EFS) CreateTags(input *CreateTagsInput) (*CreateTagsOutput, error) { req, out := c.CreateTagsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTagsWithContext is the same as CreateTags with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTags 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 *EFS) CreateTagsWithContext(ctx aws.Context, input *CreateTagsInput, opts ...request.Option) (*CreateTagsOutput, error) { + req, out := c.CreateTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteFileSystem = "DeleteFileSystem" @@ -507,8 +553,23 @@ func (c *EFS) DeleteFileSystemRequest(input *DeleteFileSystemInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/DeleteFileSystem func (c *EFS) DeleteFileSystem(input *DeleteFileSystemInput) (*DeleteFileSystemOutput, error) { req, out := c.DeleteFileSystemRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteFileSystemWithContext is the same as DeleteFileSystem with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteFileSystem 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 *EFS) DeleteFileSystemWithContext(ctx aws.Context, input *DeleteFileSystemInput, opts ...request.Option) (*DeleteFileSystemOutput, error) { + req, out := c.DeleteFileSystemRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteMountTarget = "DeleteMountTarget" @@ -610,8 +671,23 @@ func (c *EFS) DeleteMountTargetRequest(input *DeleteMountTargetInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/DeleteMountTarget func (c *EFS) DeleteMountTarget(input *DeleteMountTargetInput) (*DeleteMountTargetOutput, error) { req, out := c.DeleteMountTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteMountTargetWithContext is the same as DeleteMountTarget with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMountTarget 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 *EFS) DeleteMountTargetWithContext(ctx aws.Context, input *DeleteMountTargetInput, opts ...request.Option) (*DeleteMountTargetOutput, error) { + req, out := c.DeleteMountTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTags = "DeleteTags" @@ -692,8 +768,23 @@ func (c *EFS) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/DeleteTags func (c *EFS) DeleteTags(input *DeleteTagsInput) (*DeleteTagsOutput, error) { req, out := c.DeleteTagsRequest(input) - err := req.Send() - return out, err + 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 *EFS) 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 opDescribeFileSystems = "DescribeFileSystems" @@ -790,8 +881,23 @@ func (c *EFS) DescribeFileSystemsRequest(input *DescribeFileSystemsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/DescribeFileSystems func (c *EFS) DescribeFileSystems(input *DescribeFileSystemsInput) (*DescribeFileSystemsOutput, error) { req, out := c.DescribeFileSystemsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeFileSystemsWithContext is the same as DescribeFileSystems with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeFileSystems 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 *EFS) DescribeFileSystemsWithContext(ctx aws.Context, input *DescribeFileSystemsInput, opts ...request.Option) (*DescribeFileSystemsOutput, error) { + req, out := c.DescribeFileSystemsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMountTargetSecurityGroups = "DescribeMountTargetSecurityGroups" @@ -876,8 +982,23 @@ func (c *EFS) DescribeMountTargetSecurityGroupsRequest(input *DescribeMountTarge // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/DescribeMountTargetSecurityGroups func (c *EFS) DescribeMountTargetSecurityGroups(input *DescribeMountTargetSecurityGroupsInput) (*DescribeMountTargetSecurityGroupsOutput, error) { req, out := c.DescribeMountTargetSecurityGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMountTargetSecurityGroupsWithContext is the same as DescribeMountTargetSecurityGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMountTargetSecurityGroups 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 *EFS) DescribeMountTargetSecurityGroupsWithContext(ctx aws.Context, input *DescribeMountTargetSecurityGroupsInput, opts ...request.Option) (*DescribeMountTargetSecurityGroupsOutput, error) { + req, out := c.DescribeMountTargetSecurityGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMountTargets = "DescribeMountTargets" @@ -959,8 +1080,23 @@ func (c *EFS) DescribeMountTargetsRequest(input *DescribeMountTargetsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/DescribeMountTargets func (c *EFS) DescribeMountTargets(input *DescribeMountTargetsInput) (*DescribeMountTargetsOutput, error) { req, out := c.DescribeMountTargetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMountTargetsWithContext is the same as DescribeMountTargets with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMountTargets 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 *EFS) DescribeMountTargetsWithContext(ctx aws.Context, input *DescribeMountTargetsInput, opts ...request.Option) (*DescribeMountTargetsOutput, error) { + req, out := c.DescribeMountTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTags = "DescribeTags" @@ -1037,8 +1173,23 @@ func (c *EFS) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/DescribeTags func (c *EFS) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error) { req, out := c.DescribeTagsRequest(input) - err := req.Send() - return out, err + 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 *EFS) 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 opModifyMountTargetSecurityGroups = "ModifyMountTargetSecurityGroups" @@ -1138,8 +1289,23 @@ func (c *EFS) ModifyMountTargetSecurityGroupsRequest(input *ModifyMountTargetSec // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/ModifyMountTargetSecurityGroups func (c *EFS) ModifyMountTargetSecurityGroups(input *ModifyMountTargetSecurityGroupsInput) (*ModifyMountTargetSecurityGroupsOutput, error) { req, out := c.ModifyMountTargetSecurityGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyMountTargetSecurityGroupsWithContext is the same as ModifyMountTargetSecurityGroups with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyMountTargetSecurityGroups 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 *EFS) ModifyMountTargetSecurityGroupsWithContext(ctx aws.Context, input *ModifyMountTargetSecurityGroupsInput, opts ...request.Option) (*ModifyMountTargetSecurityGroupsOutput, error) { + req, out := c.ModifyMountTargetSecurityGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/CreateFileSystemRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/efs/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/efs/errors.go index 326ffa4b21..950e4ca5fc 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/efs/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/efs/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package efs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/efs/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/efs/service.go index 583f08d396..ae189c1977 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/efs/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/efs/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package efs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/api.go index 4eab1e4d05..f72386b36a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package elasticache provides a client for Amazon ElastiCache. package elasticache @@ -6,6 +6,7 @@ package elasticache import ( "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" @@ -57,7 +58,7 @@ func (c *ElastiCache) AddTagsToResourceRequest(input *AddTagsToResourceInput) (r // AddTagsToResource API operation for Amazon ElastiCache. // -// Adds up to 10 cost allocation tags to the named resource. A cost allocation +// Adds up to 50 cost allocation tags to the named resource. A cost allocation // tag is a key-value pair where the key and value are case-sensitive. You can // use cost allocation tags to categorize and track your AWS costs. // @@ -86,7 +87,7 @@ func (c *ElastiCache) AddTagsToResourceRequest(input *AddTagsToResourceInput) (r // * ErrCodeTagQuotaPerResourceExceeded "TagQuotaPerResourceExceeded" // The request cannot be processed because it would cause the resource to have // more than the allowed number of tags. The maximum number of tags permitted -// on a resource is 10. +// on a resource is 50. // // * ErrCodeInvalidARNFault "InvalidARN" // The requested Amazon Resource Name (ARN) does not refer to an existing resource. @@ -94,8 +95,23 @@ func (c *ElastiCache) AddTagsToResourceRequest(input *AddTagsToResourceInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/AddTagsToResource func (c *ElastiCache) AddTagsToResource(input *AddTagsToResourceInput) (*TagListMessage, error) { req, out := c.AddTagsToResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToResourceWithContext is the same as AddTagsToResource with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToResource 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 *ElastiCache) AddTagsToResourceWithContext(ctx aws.Context, input *AddTagsToResourceInput, opts ...request.Option) (*TagListMessage, error) { + req, out := c.AddTagsToResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAuthorizeCacheSecurityGroupIngress = "AuthorizeCacheSecurityGroupIngress" @@ -178,8 +194,23 @@ func (c *ElastiCache) AuthorizeCacheSecurityGroupIngressRequest(input *Authorize // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/AuthorizeCacheSecurityGroupIngress func (c *ElastiCache) AuthorizeCacheSecurityGroupIngress(input *AuthorizeCacheSecurityGroupIngressInput) (*AuthorizeCacheSecurityGroupIngressOutput, error) { req, out := c.AuthorizeCacheSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AuthorizeCacheSecurityGroupIngressWithContext is the same as AuthorizeCacheSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See AuthorizeCacheSecurityGroupIngress 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 *ElastiCache) AuthorizeCacheSecurityGroupIngressWithContext(ctx aws.Context, input *AuthorizeCacheSecurityGroupIngressInput, opts ...request.Option) (*AuthorizeCacheSecurityGroupIngressOutput, error) { + req, out := c.AuthorizeCacheSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopySnapshot = "CopySnapshot" @@ -324,8 +355,23 @@ func (c *ElastiCache) CopySnapshotRequest(input *CopySnapshotInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/CopySnapshot func (c *ElastiCache) CopySnapshot(input *CopySnapshotInput) (*CopySnapshotOutput, error) { req, out := c.CopySnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopySnapshotWithContext is the same as CopySnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CopySnapshot 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 *ElastiCache) CopySnapshotWithContext(ctx aws.Context, input *CopySnapshotInput, opts ...request.Option) (*CopySnapshotOutput, error) { + req, out := c.CopySnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateCacheCluster = "CreateCacheCluster" @@ -431,7 +477,7 @@ func (c *ElastiCache) CreateCacheClusterRequest(input *CreateCacheClusterInput) // * ErrCodeTagQuotaPerResourceExceeded "TagQuotaPerResourceExceeded" // The request cannot be processed because it would cause the resource to have // more than the allowed number of tags. The maximum number of tags permitted -// on a resource is 10. +// on a resource is 50. // // * ErrCodeInvalidParameterValueException "InvalidParameterValue" // The value for a parameter is invalid. @@ -442,8 +488,23 @@ func (c *ElastiCache) CreateCacheClusterRequest(input *CreateCacheClusterInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/CreateCacheCluster func (c *ElastiCache) CreateCacheCluster(input *CreateCacheClusterInput) (*CreateCacheClusterOutput, error) { req, out := c.CreateCacheClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateCacheClusterWithContext is the same as CreateCacheCluster with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCacheCluster 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 *ElastiCache) CreateCacheClusterWithContext(ctx aws.Context, input *CreateCacheClusterInput, opts ...request.Option) (*CreateCacheClusterOutput, error) { + req, out := c.CreateCacheClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateCacheParameterGroup = "CreateCacheParameterGroup" @@ -491,8 +552,20 @@ func (c *ElastiCache) CreateCacheParameterGroupRequest(input *CreateCacheParamet // CreateCacheParameterGroup API operation for Amazon ElastiCache. // -// Creates a new cache parameter group. A cache parameter group is a collection -// of parameters that you apply to all of the nodes in a cache cluster. +// Creates a new Amazon ElastiCache cache parameter group. An ElastiCache cache +// parameter group is a collection of parameters and their values that are applied +// to all of the nodes in any cache cluster or replication group using the CacheParameterGroup. +// +// A newly created CacheParameterGroup is an exact duplicate of the default +// parameter group for the CacheParameterGroupFamily. To customize the newly +// created CacheParameterGroup you can change the values of specific parameters. +// For more information, see: +// +// * ModifyCacheParameterGroup (http://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_ModifyCacheParameterGroup.html) +// in the ElastiCache API Reference. +// +// * Parameters and Parameter Groups (http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/ParameterGroups.html) +// in the ElastiCache 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 @@ -522,8 +595,23 @@ func (c *ElastiCache) CreateCacheParameterGroupRequest(input *CreateCacheParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/CreateCacheParameterGroup func (c *ElastiCache) CreateCacheParameterGroup(input *CreateCacheParameterGroupInput) (*CreateCacheParameterGroupOutput, error) { req, out := c.CreateCacheParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateCacheParameterGroupWithContext is the same as CreateCacheParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCacheParameterGroup 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 *ElastiCache) CreateCacheParameterGroupWithContext(ctx aws.Context, input *CreateCacheParameterGroupInput, opts ...request.Option) (*CreateCacheParameterGroupOutput, error) { + req, out := c.CreateCacheParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateCacheSecurityGroup = "CreateCacheSecurityGroup" @@ -603,8 +691,23 @@ func (c *ElastiCache) CreateCacheSecurityGroupRequest(input *CreateCacheSecurity // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/CreateCacheSecurityGroup func (c *ElastiCache) CreateCacheSecurityGroup(input *CreateCacheSecurityGroupInput) (*CreateCacheSecurityGroupOutput, error) { req, out := c.CreateCacheSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateCacheSecurityGroupWithContext is the same as CreateCacheSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCacheSecurityGroup 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 *ElastiCache) CreateCacheSecurityGroupWithContext(ctx aws.Context, input *CreateCacheSecurityGroupInput, opts ...request.Option) (*CreateCacheSecurityGroupOutput, error) { + req, out := c.CreateCacheSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateCacheSubnetGroup = "CreateCacheSubnetGroup" @@ -683,8 +786,23 @@ func (c *ElastiCache) CreateCacheSubnetGroupRequest(input *CreateCacheSubnetGrou // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/CreateCacheSubnetGroup func (c *ElastiCache) CreateCacheSubnetGroup(input *CreateCacheSubnetGroupInput) (*CreateCacheSubnetGroupOutput, error) { req, out := c.CreateCacheSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateCacheSubnetGroupWithContext is the same as CreateCacheSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCacheSubnetGroup 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 *ElastiCache) CreateCacheSubnetGroupWithContext(ctx aws.Context, input *CreateCacheSubnetGroupInput, opts ...request.Option) (*CreateCacheSubnetGroupOutput, error) { + req, out := c.CreateCacheSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReplicationGroup = "CreateReplicationGroup" @@ -749,7 +867,11 @@ func (c *ElastiCache) CreateReplicationGroupRequest(input *CreateReplicationGrou // When a Redis (cluster mode disabled) replication group has been successfully // created, you can add one or more read replicas to it, up to a total of 5 // read replicas. You cannot alter a Redis (cluster mode enabled) replication -// group after it has been created. +// group after it has been created. However, if you need to increase or decrease +// the number of node groups (console: shards), you can avail yourself of ElastiCache +// for Redis' enhanced backup and restore. For more information, see Restoring +// From a Backup with Cluster Resizing (http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/backups-restoring.html) +// in the ElastiCache User Guide. // // This operation is valid for Redis only. // @@ -804,7 +926,7 @@ func (c *ElastiCache) CreateReplicationGroupRequest(input *CreateReplicationGrou // * ErrCodeTagQuotaPerResourceExceeded "TagQuotaPerResourceExceeded" // The request cannot be processed because it would cause the resource to have // more than the allowed number of tags. The maximum number of tags permitted -// on a resource is 10. +// on a resource is 50. // // * ErrCodeNodeGroupsPerReplicationGroupQuotaExceededFault "NodeGroupsPerReplicationGroupQuotaExceeded" // The request cannot be processed because it would exceed the maximum of 15 @@ -819,8 +941,23 @@ func (c *ElastiCache) CreateReplicationGroupRequest(input *CreateReplicationGrou // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/CreateReplicationGroup func (c *ElastiCache) CreateReplicationGroup(input *CreateReplicationGroupInput) (*CreateReplicationGroupOutput, error) { req, out := c.CreateReplicationGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReplicationGroupWithContext is the same as CreateReplicationGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReplicationGroup 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 *ElastiCache) CreateReplicationGroupWithContext(ctx aws.Context, input *CreateReplicationGroupInput, opts ...request.Option) (*CreateReplicationGroupOutput, error) { + req, out := c.CreateReplicationGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSnapshot = "CreateSnapshot" @@ -920,8 +1057,23 @@ func (c *ElastiCache) CreateSnapshotRequest(input *CreateSnapshotInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/CreateSnapshot func (c *ElastiCache) CreateSnapshot(input *CreateSnapshotInput) (*CreateSnapshotOutput, error) { req, out := c.CreateSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSnapshotWithContext is the same as CreateSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSnapshot 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 *ElastiCache) CreateSnapshotWithContext(ctx aws.Context, input *CreateSnapshotInput, opts ...request.Option) (*CreateSnapshotOutput, error) { + req, out := c.CreateSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCacheCluster = "DeleteCacheCluster" @@ -1025,8 +1177,23 @@ func (c *ElastiCache) DeleteCacheClusterRequest(input *DeleteCacheClusterInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DeleteCacheCluster func (c *ElastiCache) DeleteCacheCluster(input *DeleteCacheClusterInput) (*DeleteCacheClusterOutput, error) { req, out := c.DeleteCacheClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCacheClusterWithContext is the same as DeleteCacheCluster with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCacheCluster 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 *ElastiCache) DeleteCacheClusterWithContext(ctx aws.Context, input *DeleteCacheClusterInput, opts ...request.Option) (*DeleteCacheClusterOutput, error) { + req, out := c.DeleteCacheClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCacheParameterGroup = "DeleteCacheParameterGroup" @@ -1104,8 +1271,23 @@ func (c *ElastiCache) DeleteCacheParameterGroupRequest(input *DeleteCacheParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DeleteCacheParameterGroup func (c *ElastiCache) DeleteCacheParameterGroup(input *DeleteCacheParameterGroupInput) (*DeleteCacheParameterGroupOutput, error) { req, out := c.DeleteCacheParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCacheParameterGroupWithContext is the same as DeleteCacheParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCacheParameterGroup 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 *ElastiCache) DeleteCacheParameterGroupWithContext(ctx aws.Context, input *DeleteCacheParameterGroupInput, opts ...request.Option) (*DeleteCacheParameterGroupOutput, error) { + req, out := c.DeleteCacheParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCacheSecurityGroup = "DeleteCacheSecurityGroup" @@ -1184,8 +1366,23 @@ func (c *ElastiCache) DeleteCacheSecurityGroupRequest(input *DeleteCacheSecurity // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DeleteCacheSecurityGroup func (c *ElastiCache) DeleteCacheSecurityGroup(input *DeleteCacheSecurityGroupInput) (*DeleteCacheSecurityGroupOutput, error) { req, out := c.DeleteCacheSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCacheSecurityGroupWithContext is the same as DeleteCacheSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCacheSecurityGroup 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 *ElastiCache) DeleteCacheSecurityGroupWithContext(ctx aws.Context, input *DeleteCacheSecurityGroupInput, opts ...request.Option) (*DeleteCacheSecurityGroupOutput, error) { + req, out := c.DeleteCacheSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCacheSubnetGroup = "DeleteCacheSubnetGroup" @@ -1258,8 +1455,23 @@ func (c *ElastiCache) DeleteCacheSubnetGroupRequest(input *DeleteCacheSubnetGrou // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DeleteCacheSubnetGroup func (c *ElastiCache) DeleteCacheSubnetGroup(input *DeleteCacheSubnetGroupInput) (*DeleteCacheSubnetGroupOutput, error) { req, out := c.DeleteCacheSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteCacheSubnetGroupWithContext is the same as DeleteCacheSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCacheSubnetGroup 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 *ElastiCache) DeleteCacheSubnetGroupWithContext(ctx aws.Context, input *DeleteCacheSubnetGroupInput, opts ...request.Option) (*DeleteCacheSubnetGroupOutput, error) { + req, out := c.DeleteCacheSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReplicationGroup = "DeleteReplicationGroup" @@ -1360,8 +1572,23 @@ func (c *ElastiCache) DeleteReplicationGroupRequest(input *DeleteReplicationGrou // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DeleteReplicationGroup func (c *ElastiCache) DeleteReplicationGroup(input *DeleteReplicationGroupInput) (*DeleteReplicationGroupOutput, error) { req, out := c.DeleteReplicationGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReplicationGroupWithContext is the same as DeleteReplicationGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReplicationGroup 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 *ElastiCache) DeleteReplicationGroupWithContext(ctx aws.Context, input *DeleteReplicationGroupInput, opts ...request.Option) (*DeleteReplicationGroupOutput, error) { + req, out := c.DeleteReplicationGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSnapshot = "DeleteSnapshot" @@ -1439,8 +1666,23 @@ func (c *ElastiCache) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DeleteSnapshot func (c *ElastiCache) DeleteSnapshot(input *DeleteSnapshotInput) (*DeleteSnapshotOutput, error) { req, out := c.DeleteSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSnapshotWithContext is the same as DeleteSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSnapshot 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 *ElastiCache) DeleteSnapshotWithContext(ctx aws.Context, input *DeleteSnapshotInput, opts ...request.Option) (*DeleteSnapshotOutput, error) { + req, out := c.DeleteSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCacheClusters = "DescribeCacheClusters" @@ -1498,15 +1740,15 @@ func (c *ElastiCache) DescribeCacheClustersRequest(input *DescribeCacheClustersI // identifier is specified, or about a specific cache cluster if a cache cluster // identifier is supplied. // -// By default, abbreviated information about the cache clusters are returned. -// You can use the optional ShowDetails flag to retrieve detailed information +// By default, abbreviated information about the cache clusters is returned. +// You can use the optional ShowCacheNodeInfo flag to retrieve detailed information // about the cache nodes associated with the cache clusters. These details include // the DNS address and port for the cache node endpoint. // -// If the cluster is in the CREATING state, only cluster-level information is +// If the cluster is in the creating state, only cluster-level information is // displayed until all of the nodes are successfully provisioned. // -// If the cluster is in the DELETING state, only cluster-level information is +// If the cluster is in the deleting state, only cluster-level information is // displayed. // // If cache nodes are currently being added to the cache cluster, node endpoint @@ -1537,8 +1779,23 @@ func (c *ElastiCache) DescribeCacheClustersRequest(input *DescribeCacheClustersI // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeCacheClusters func (c *ElastiCache) DescribeCacheClusters(input *DescribeCacheClustersInput) (*DescribeCacheClustersOutput, error) { req, out := c.DescribeCacheClustersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCacheClustersWithContext is the same as DescribeCacheClusters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCacheClusters 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 *ElastiCache) DescribeCacheClustersWithContext(ctx aws.Context, input *DescribeCacheClustersInput, opts ...request.Option) (*DescribeCacheClustersOutput, error) { + req, out := c.DescribeCacheClustersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeCacheClustersPages iterates over the pages of a DescribeCacheClusters operation, @@ -1558,12 +1815,37 @@ func (c *ElastiCache) DescribeCacheClusters(input *DescribeCacheClustersInput) ( // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeCacheClustersPages(input *DescribeCacheClustersInput, fn func(p *DescribeCacheClustersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeCacheClustersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeCacheClustersOutput), lastPage) - }) +func (c *ElastiCache) DescribeCacheClustersPages(input *DescribeCacheClustersInput, fn func(*DescribeCacheClustersOutput, bool) bool) error { + return c.DescribeCacheClustersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCacheClustersPagesWithContext same as DescribeCacheClustersPages 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 *ElastiCache) DescribeCacheClustersPagesWithContext(ctx aws.Context, input *DescribeCacheClustersInput, fn func(*DescribeCacheClustersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCacheClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeCacheClustersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeCacheEngineVersions = "DescribeCacheEngineVersions" @@ -1628,8 +1910,23 @@ func (c *ElastiCache) DescribeCacheEngineVersionsRequest(input *DescribeCacheEng // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeCacheEngineVersions func (c *ElastiCache) DescribeCacheEngineVersions(input *DescribeCacheEngineVersionsInput) (*DescribeCacheEngineVersionsOutput, error) { req, out := c.DescribeCacheEngineVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCacheEngineVersionsWithContext is the same as DescribeCacheEngineVersions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCacheEngineVersions 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 *ElastiCache) DescribeCacheEngineVersionsWithContext(ctx aws.Context, input *DescribeCacheEngineVersionsInput, opts ...request.Option) (*DescribeCacheEngineVersionsOutput, error) { + req, out := c.DescribeCacheEngineVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeCacheEngineVersionsPages iterates over the pages of a DescribeCacheEngineVersions operation, @@ -1649,12 +1946,37 @@ func (c *ElastiCache) DescribeCacheEngineVersions(input *DescribeCacheEngineVers // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeCacheEngineVersionsPages(input *DescribeCacheEngineVersionsInput, fn func(p *DescribeCacheEngineVersionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeCacheEngineVersionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeCacheEngineVersionsOutput), lastPage) - }) +func (c *ElastiCache) DescribeCacheEngineVersionsPages(input *DescribeCacheEngineVersionsInput, fn func(*DescribeCacheEngineVersionsOutput, bool) bool) error { + return c.DescribeCacheEngineVersionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCacheEngineVersionsPagesWithContext same as DescribeCacheEngineVersionsPages 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 *ElastiCache) DescribeCacheEngineVersionsPagesWithContext(ctx aws.Context, input *DescribeCacheEngineVersionsInput, fn func(*DescribeCacheEngineVersionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCacheEngineVersionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheEngineVersionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeCacheEngineVersionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeCacheParameterGroups = "DescribeCacheParameterGroups" @@ -1733,8 +2055,23 @@ func (c *ElastiCache) DescribeCacheParameterGroupsRequest(input *DescribeCachePa // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeCacheParameterGroups func (c *ElastiCache) DescribeCacheParameterGroups(input *DescribeCacheParameterGroupsInput) (*DescribeCacheParameterGroupsOutput, error) { req, out := c.DescribeCacheParameterGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCacheParameterGroupsWithContext is the same as DescribeCacheParameterGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCacheParameterGroups 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 *ElastiCache) DescribeCacheParameterGroupsWithContext(ctx aws.Context, input *DescribeCacheParameterGroupsInput, opts ...request.Option) (*DescribeCacheParameterGroupsOutput, error) { + req, out := c.DescribeCacheParameterGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeCacheParameterGroupsPages iterates over the pages of a DescribeCacheParameterGroups operation, @@ -1754,12 +2091,37 @@ func (c *ElastiCache) DescribeCacheParameterGroups(input *DescribeCacheParameter // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeCacheParameterGroupsPages(input *DescribeCacheParameterGroupsInput, fn func(p *DescribeCacheParameterGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeCacheParameterGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeCacheParameterGroupsOutput), lastPage) - }) +func (c *ElastiCache) DescribeCacheParameterGroupsPages(input *DescribeCacheParameterGroupsInput, fn func(*DescribeCacheParameterGroupsOutput, bool) bool) error { + return c.DescribeCacheParameterGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCacheParameterGroupsPagesWithContext same as DescribeCacheParameterGroupsPages 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 *ElastiCache) DescribeCacheParameterGroupsPagesWithContext(ctx aws.Context, input *DescribeCacheParameterGroupsInput, fn func(*DescribeCacheParameterGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCacheParameterGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheParameterGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeCacheParameterGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeCacheParameters = "DescribeCacheParameters" @@ -1836,8 +2198,23 @@ func (c *ElastiCache) DescribeCacheParametersRequest(input *DescribeCacheParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeCacheParameters func (c *ElastiCache) DescribeCacheParameters(input *DescribeCacheParametersInput) (*DescribeCacheParametersOutput, error) { req, out := c.DescribeCacheParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCacheParametersWithContext is the same as DescribeCacheParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCacheParameters 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 *ElastiCache) DescribeCacheParametersWithContext(ctx aws.Context, input *DescribeCacheParametersInput, opts ...request.Option) (*DescribeCacheParametersOutput, error) { + req, out := c.DescribeCacheParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeCacheParametersPages iterates over the pages of a DescribeCacheParameters operation, @@ -1857,12 +2234,37 @@ func (c *ElastiCache) DescribeCacheParameters(input *DescribeCacheParametersInpu // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeCacheParametersPages(input *DescribeCacheParametersInput, fn func(p *DescribeCacheParametersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeCacheParametersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeCacheParametersOutput), lastPage) - }) +func (c *ElastiCache) DescribeCacheParametersPages(input *DescribeCacheParametersInput, fn func(*DescribeCacheParametersOutput, bool) bool) error { + return c.DescribeCacheParametersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCacheParametersPagesWithContext same as DescribeCacheParametersPages 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 *ElastiCache) DescribeCacheParametersPagesWithContext(ctx aws.Context, input *DescribeCacheParametersInput, fn func(*DescribeCacheParametersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCacheParametersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheParametersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeCacheParametersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeCacheSecurityGroups = "DescribeCacheSecurityGroups" @@ -1940,8 +2342,23 @@ func (c *ElastiCache) DescribeCacheSecurityGroupsRequest(input *DescribeCacheSec // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeCacheSecurityGroups func (c *ElastiCache) DescribeCacheSecurityGroups(input *DescribeCacheSecurityGroupsInput) (*DescribeCacheSecurityGroupsOutput, error) { req, out := c.DescribeCacheSecurityGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCacheSecurityGroupsWithContext is the same as DescribeCacheSecurityGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCacheSecurityGroups 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 *ElastiCache) DescribeCacheSecurityGroupsWithContext(ctx aws.Context, input *DescribeCacheSecurityGroupsInput, opts ...request.Option) (*DescribeCacheSecurityGroupsOutput, error) { + req, out := c.DescribeCacheSecurityGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeCacheSecurityGroupsPages iterates over the pages of a DescribeCacheSecurityGroups operation, @@ -1961,12 +2378,37 @@ func (c *ElastiCache) DescribeCacheSecurityGroups(input *DescribeCacheSecurityGr // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeCacheSecurityGroupsPages(input *DescribeCacheSecurityGroupsInput, fn func(p *DescribeCacheSecurityGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeCacheSecurityGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeCacheSecurityGroupsOutput), lastPage) - }) +func (c *ElastiCache) DescribeCacheSecurityGroupsPages(input *DescribeCacheSecurityGroupsInput, fn func(*DescribeCacheSecurityGroupsOutput, bool) bool) error { + return c.DescribeCacheSecurityGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCacheSecurityGroupsPagesWithContext same as DescribeCacheSecurityGroupsPages 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 *ElastiCache) DescribeCacheSecurityGroupsPagesWithContext(ctx aws.Context, input *DescribeCacheSecurityGroupsInput, fn func(*DescribeCacheSecurityGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCacheSecurityGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheSecurityGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeCacheSecurityGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeCacheSubnetGroups = "DescribeCacheSubnetGroups" @@ -2038,8 +2480,23 @@ func (c *ElastiCache) DescribeCacheSubnetGroupsRequest(input *DescribeCacheSubne // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeCacheSubnetGroups func (c *ElastiCache) DescribeCacheSubnetGroups(input *DescribeCacheSubnetGroupsInput) (*DescribeCacheSubnetGroupsOutput, error) { req, out := c.DescribeCacheSubnetGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCacheSubnetGroupsWithContext is the same as DescribeCacheSubnetGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCacheSubnetGroups 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 *ElastiCache) DescribeCacheSubnetGroupsWithContext(ctx aws.Context, input *DescribeCacheSubnetGroupsInput, opts ...request.Option) (*DescribeCacheSubnetGroupsOutput, error) { + req, out := c.DescribeCacheSubnetGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeCacheSubnetGroupsPages iterates over the pages of a DescribeCacheSubnetGroups operation, @@ -2059,12 +2516,37 @@ func (c *ElastiCache) DescribeCacheSubnetGroups(input *DescribeCacheSubnetGroups // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeCacheSubnetGroupsPages(input *DescribeCacheSubnetGroupsInput, fn func(p *DescribeCacheSubnetGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeCacheSubnetGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeCacheSubnetGroupsOutput), lastPage) - }) +func (c *ElastiCache) DescribeCacheSubnetGroupsPages(input *DescribeCacheSubnetGroupsInput, fn func(*DescribeCacheSubnetGroupsOutput, bool) bool) error { + return c.DescribeCacheSubnetGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeCacheSubnetGroupsPagesWithContext same as DescribeCacheSubnetGroupsPages 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 *ElastiCache) DescribeCacheSubnetGroupsPagesWithContext(ctx aws.Context, input *DescribeCacheSubnetGroupsInput, fn func(*DescribeCacheSubnetGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeCacheSubnetGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheSubnetGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeCacheSubnetGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeEngineDefaultParameters = "DescribeEngineDefaultParameters" @@ -2138,8 +2620,23 @@ func (c *ElastiCache) DescribeEngineDefaultParametersRequest(input *DescribeEngi // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeEngineDefaultParameters func (c *ElastiCache) DescribeEngineDefaultParameters(input *DescribeEngineDefaultParametersInput) (*DescribeEngineDefaultParametersOutput, error) { req, out := c.DescribeEngineDefaultParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEngineDefaultParametersWithContext is the same as DescribeEngineDefaultParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEngineDefaultParameters 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 *ElastiCache) DescribeEngineDefaultParametersWithContext(ctx aws.Context, input *DescribeEngineDefaultParametersInput, opts ...request.Option) (*DescribeEngineDefaultParametersOutput, error) { + req, out := c.DescribeEngineDefaultParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEngineDefaultParametersPages iterates over the pages of a DescribeEngineDefaultParameters operation, @@ -2159,12 +2656,37 @@ func (c *ElastiCache) DescribeEngineDefaultParameters(input *DescribeEngineDefau // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeEngineDefaultParametersPages(input *DescribeEngineDefaultParametersInput, fn func(p *DescribeEngineDefaultParametersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEngineDefaultParametersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEngineDefaultParametersOutput), lastPage) - }) +func (c *ElastiCache) DescribeEngineDefaultParametersPages(input *DescribeEngineDefaultParametersInput, fn func(*DescribeEngineDefaultParametersOutput, bool) bool) error { + return c.DescribeEngineDefaultParametersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEngineDefaultParametersPagesWithContext same as DescribeEngineDefaultParametersPages 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 *ElastiCache) DescribeEngineDefaultParametersPagesWithContext(ctx aws.Context, input *DescribeEngineDefaultParametersInput, fn func(*DescribeEngineDefaultParametersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEngineDefaultParametersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEngineDefaultParametersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEngineDefaultParametersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeEvents = "DescribeEvents" @@ -2243,8 +2765,23 @@ func (c *ElastiCache) DescribeEventsRequest(input *DescribeEventsInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeEvents func (c *ElastiCache) DescribeEvents(input *DescribeEventsInput) (*DescribeEventsOutput, error) { req, out := c.DescribeEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventsWithContext is the same as DescribeEvents with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEvents 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 *ElastiCache) DescribeEventsWithContext(ctx aws.Context, input *DescribeEventsInput, opts ...request.Option) (*DescribeEventsOutput, error) { + req, out := c.DescribeEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEventsPages iterates over the pages of a DescribeEvents operation, @@ -2264,12 +2801,37 @@ func (c *ElastiCache) DescribeEvents(input *DescribeEventsInput) (*DescribeEvent // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeEventsPages(input *DescribeEventsInput, fn func(p *DescribeEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEventsOutput), lastPage) - }) +func (c *ElastiCache) DescribeEventsPages(input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool) error { + return c.DescribeEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEventsPagesWithContext same as DescribeEventsPages 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 *ElastiCache) DescribeEventsPagesWithContext(ctx aws.Context, input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeReplicationGroups = "DescribeReplicationGroups" @@ -2349,8 +2911,23 @@ func (c *ElastiCache) DescribeReplicationGroupsRequest(input *DescribeReplicatio // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeReplicationGroups func (c *ElastiCache) DescribeReplicationGroups(input *DescribeReplicationGroupsInput) (*DescribeReplicationGroupsOutput, error) { req, out := c.DescribeReplicationGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReplicationGroupsWithContext is the same as DescribeReplicationGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReplicationGroups 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 *ElastiCache) DescribeReplicationGroupsWithContext(ctx aws.Context, input *DescribeReplicationGroupsInput, opts ...request.Option) (*DescribeReplicationGroupsOutput, error) { + req, out := c.DescribeReplicationGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReplicationGroupsPages iterates over the pages of a DescribeReplicationGroups operation, @@ -2370,12 +2947,37 @@ func (c *ElastiCache) DescribeReplicationGroups(input *DescribeReplicationGroups // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeReplicationGroupsPages(input *DescribeReplicationGroupsInput, fn func(p *DescribeReplicationGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReplicationGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReplicationGroupsOutput), lastPage) - }) +func (c *ElastiCache) DescribeReplicationGroupsPages(input *DescribeReplicationGroupsInput, fn func(*DescribeReplicationGroupsOutput, bool) bool) error { + return c.DescribeReplicationGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReplicationGroupsPagesWithContext same as DescribeReplicationGroupsPages 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 *ElastiCache) DescribeReplicationGroupsPagesWithContext(ctx aws.Context, input *DescribeReplicationGroupsInput, fn func(*DescribeReplicationGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReplicationGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReplicationGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReplicationGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeReservedCacheNodes = "DescribeReservedCacheNodes" @@ -2452,8 +3054,23 @@ func (c *ElastiCache) DescribeReservedCacheNodesRequest(input *DescribeReservedC // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeReservedCacheNodes func (c *ElastiCache) DescribeReservedCacheNodes(input *DescribeReservedCacheNodesInput) (*DescribeReservedCacheNodesOutput, error) { req, out := c.DescribeReservedCacheNodesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedCacheNodesWithContext is the same as DescribeReservedCacheNodes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedCacheNodes 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 *ElastiCache) DescribeReservedCacheNodesWithContext(ctx aws.Context, input *DescribeReservedCacheNodesInput, opts ...request.Option) (*DescribeReservedCacheNodesOutput, error) { + req, out := c.DescribeReservedCacheNodesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedCacheNodesPages iterates over the pages of a DescribeReservedCacheNodes operation, @@ -2473,12 +3090,37 @@ func (c *ElastiCache) DescribeReservedCacheNodes(input *DescribeReservedCacheNod // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeReservedCacheNodesPages(input *DescribeReservedCacheNodesInput, fn func(p *DescribeReservedCacheNodesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedCacheNodesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedCacheNodesOutput), lastPage) - }) +func (c *ElastiCache) DescribeReservedCacheNodesPages(input *DescribeReservedCacheNodesInput, fn func(*DescribeReservedCacheNodesOutput, bool) bool) error { + return c.DescribeReservedCacheNodesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedCacheNodesPagesWithContext same as DescribeReservedCacheNodesPages 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 *ElastiCache) DescribeReservedCacheNodesPagesWithContext(ctx aws.Context, input *DescribeReservedCacheNodesInput, fn func(*DescribeReservedCacheNodesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedCacheNodesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedCacheNodesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedCacheNodesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeReservedCacheNodesOfferings = "DescribeReservedCacheNodesOfferings" @@ -2554,8 +3196,23 @@ func (c *ElastiCache) DescribeReservedCacheNodesOfferingsRequest(input *Describe // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeReservedCacheNodesOfferings func (c *ElastiCache) DescribeReservedCacheNodesOfferings(input *DescribeReservedCacheNodesOfferingsInput) (*DescribeReservedCacheNodesOfferingsOutput, error) { req, out := c.DescribeReservedCacheNodesOfferingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedCacheNodesOfferingsWithContext is the same as DescribeReservedCacheNodesOfferings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedCacheNodesOfferings 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 *ElastiCache) DescribeReservedCacheNodesOfferingsWithContext(ctx aws.Context, input *DescribeReservedCacheNodesOfferingsInput, opts ...request.Option) (*DescribeReservedCacheNodesOfferingsOutput, error) { + req, out := c.DescribeReservedCacheNodesOfferingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedCacheNodesOfferingsPages iterates over the pages of a DescribeReservedCacheNodesOfferings operation, @@ -2575,12 +3232,37 @@ func (c *ElastiCache) DescribeReservedCacheNodesOfferings(input *DescribeReserve // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeReservedCacheNodesOfferingsPages(input *DescribeReservedCacheNodesOfferingsInput, fn func(p *DescribeReservedCacheNodesOfferingsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedCacheNodesOfferingsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedCacheNodesOfferingsOutput), lastPage) - }) +func (c *ElastiCache) DescribeReservedCacheNodesOfferingsPages(input *DescribeReservedCacheNodesOfferingsInput, fn func(*DescribeReservedCacheNodesOfferingsOutput, bool) bool) error { + return c.DescribeReservedCacheNodesOfferingsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedCacheNodesOfferingsPagesWithContext same as DescribeReservedCacheNodesOfferingsPages 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 *ElastiCache) DescribeReservedCacheNodesOfferingsPagesWithContext(ctx aws.Context, input *DescribeReservedCacheNodesOfferingsInput, fn func(*DescribeReservedCacheNodesOfferingsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedCacheNodesOfferingsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedCacheNodesOfferingsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedCacheNodesOfferingsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeSnapshots = "DescribeSnapshots" @@ -2664,8 +3346,23 @@ func (c *ElastiCache) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/DescribeSnapshots func (c *ElastiCache) DescribeSnapshots(input *DescribeSnapshotsInput) (*DescribeSnapshotsOutput, error) { req, out := c.DescribeSnapshotsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSnapshotsWithContext is the same as DescribeSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSnapshots 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 *ElastiCache) DescribeSnapshotsWithContext(ctx aws.Context, input *DescribeSnapshotsInput, opts ...request.Option) (*DescribeSnapshotsOutput, error) { + req, out := c.DescribeSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeSnapshotsPages iterates over the pages of a DescribeSnapshots operation, @@ -2685,12 +3382,37 @@ func (c *ElastiCache) DescribeSnapshots(input *DescribeSnapshotsInput) (*Describ // return pageNum <= 3 // }) // -func (c *ElastiCache) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(p *DescribeSnapshotsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeSnapshotsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeSnapshotsOutput), lastPage) - }) +func (c *ElastiCache) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(*DescribeSnapshotsOutput, bool) bool) error { + return c.DescribeSnapshotsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSnapshotsPagesWithContext same as DescribeSnapshotsPages 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 *ElastiCache) DescribeSnapshotsPagesWithContext(ctx aws.Context, input *DescribeSnapshotsInput, fn func(*DescribeSnapshotsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSnapshotsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSnapshotsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeSnapshotsOutput), !p.HasNextPage()) + } + return p.Err() } const opListAllowedNodeTypeModifications = "ListAllowedNodeTypeModifications" @@ -2768,8 +3490,23 @@ func (c *ElastiCache) ListAllowedNodeTypeModificationsRequest(input *ListAllowed // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/ListAllowedNodeTypeModifications func (c *ElastiCache) ListAllowedNodeTypeModifications(input *ListAllowedNodeTypeModificationsInput) (*ListAllowedNodeTypeModificationsOutput, error) { req, out := c.ListAllowedNodeTypeModificationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAllowedNodeTypeModificationsWithContext is the same as ListAllowedNodeTypeModifications with the addition of +// the ability to pass a context and additional request options. +// +// See ListAllowedNodeTypeModifications 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 *ElastiCache) ListAllowedNodeTypeModificationsWithContext(ctx aws.Context, input *ListAllowedNodeTypeModificationsInput, opts ...request.Option) (*ListAllowedNodeTypeModificationsOutput, error) { + req, out := c.ListAllowedNodeTypeModificationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResource = "ListTagsForResource" @@ -2822,7 +3559,7 @@ func (c *ElastiCache) ListTagsForResourceRequest(input *ListTagsForResourceInput // optional. You can use cost allocation tags to categorize and track your AWS // costs. // -// You can have a maximum of 10 cost allocation tags on an ElastiCache resource. +// You can have a maximum of 50 cost allocation tags on an ElastiCache resource. // For more information, see Using Cost Allocation Tags in Amazon ElastiCache // (http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/BestPractices.html). // @@ -2846,8 +3583,23 @@ func (c *ElastiCache) ListTagsForResourceRequest(input *ListTagsForResourceInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/ListTagsForResource func (c *ElastiCache) ListTagsForResource(input *ListTagsForResourceInput) (*TagListMessage, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *ElastiCache) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*TagListMessage, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyCacheCluster = "ModifyCacheCluster" @@ -2948,8 +3700,23 @@ func (c *ElastiCache) ModifyCacheClusterRequest(input *ModifyCacheClusterInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/ModifyCacheCluster func (c *ElastiCache) ModifyCacheCluster(input *ModifyCacheClusterInput) (*ModifyCacheClusterOutput, error) { req, out := c.ModifyCacheClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyCacheClusterWithContext is the same as ModifyCacheCluster with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyCacheCluster 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 *ElastiCache) ModifyCacheClusterWithContext(ctx aws.Context, input *ModifyCacheClusterInput, opts ...request.Option) (*ModifyCacheClusterOutput, error) { + req, out := c.ModifyCacheClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyCacheParameterGroup = "ModifyCacheParameterGroup" @@ -3026,8 +3793,23 @@ func (c *ElastiCache) ModifyCacheParameterGroupRequest(input *ModifyCacheParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/ModifyCacheParameterGroup func (c *ElastiCache) ModifyCacheParameterGroup(input *ModifyCacheParameterGroupInput) (*CacheParameterGroupNameMessage, error) { req, out := c.ModifyCacheParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyCacheParameterGroupWithContext is the same as ModifyCacheParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyCacheParameterGroup 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 *ElastiCache) ModifyCacheParameterGroupWithContext(ctx aws.Context, input *ModifyCacheParameterGroupInput, opts ...request.Option) (*CacheParameterGroupNameMessage, error) { + req, out := c.ModifyCacheParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyCacheSubnetGroup = "ModifyCacheSubnetGroup" @@ -3102,8 +3884,23 @@ func (c *ElastiCache) ModifyCacheSubnetGroupRequest(input *ModifyCacheSubnetGrou // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/ModifyCacheSubnetGroup func (c *ElastiCache) ModifyCacheSubnetGroup(input *ModifyCacheSubnetGroupInput) (*ModifyCacheSubnetGroupOutput, error) { req, out := c.ModifyCacheSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyCacheSubnetGroupWithContext is the same as ModifyCacheSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyCacheSubnetGroup 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 *ElastiCache) ModifyCacheSubnetGroupWithContext(ctx aws.Context, input *ModifyCacheSubnetGroupInput, opts ...request.Option) (*ModifyCacheSubnetGroupOutput, error) { + req, out := c.ModifyCacheSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyReplicationGroup = "ModifyReplicationGroup" @@ -3214,8 +4011,23 @@ func (c *ElastiCache) ModifyReplicationGroupRequest(input *ModifyReplicationGrou // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/ModifyReplicationGroup func (c *ElastiCache) ModifyReplicationGroup(input *ModifyReplicationGroupInput) (*ModifyReplicationGroupOutput, error) { req, out := c.ModifyReplicationGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyReplicationGroupWithContext is the same as ModifyReplicationGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyReplicationGroup 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 *ElastiCache) ModifyReplicationGroupWithContext(ctx aws.Context, input *ModifyReplicationGroupInput, opts ...request.Option) (*ModifyReplicationGroupOutput, error) { + req, out := c.ModifyReplicationGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPurchaseReservedCacheNodesOffering = "PurchaseReservedCacheNodesOffering" @@ -3292,8 +4104,23 @@ func (c *ElastiCache) PurchaseReservedCacheNodesOfferingRequest(input *PurchaseR // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/PurchaseReservedCacheNodesOffering func (c *ElastiCache) PurchaseReservedCacheNodesOffering(input *PurchaseReservedCacheNodesOfferingInput) (*PurchaseReservedCacheNodesOfferingOutput, error) { req, out := c.PurchaseReservedCacheNodesOfferingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurchaseReservedCacheNodesOfferingWithContext is the same as PurchaseReservedCacheNodesOffering with the addition of +// the ability to pass a context and additional request options. +// +// See PurchaseReservedCacheNodesOffering 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 *ElastiCache) PurchaseReservedCacheNodesOfferingWithContext(ctx aws.Context, input *PurchaseReservedCacheNodesOfferingInput, opts ...request.Option) (*PurchaseReservedCacheNodesOfferingOutput, error) { + req, out := c.PurchaseReservedCacheNodesOfferingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRebootCacheCluster = "RebootCacheCluster" @@ -3369,8 +4196,23 @@ func (c *ElastiCache) RebootCacheClusterRequest(input *RebootCacheClusterInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/RebootCacheCluster func (c *ElastiCache) RebootCacheCluster(input *RebootCacheClusterInput) (*RebootCacheClusterOutput, error) { req, out := c.RebootCacheClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RebootCacheClusterWithContext is the same as RebootCacheCluster with the addition of +// the ability to pass a context and additional request options. +// +// See RebootCacheCluster 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 *ElastiCache) RebootCacheClusterWithContext(ctx aws.Context, input *RebootCacheClusterInput, opts ...request.Option) (*RebootCacheClusterOutput, error) { + req, out := c.RebootCacheClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromResource = "RemoveTagsFromResource" @@ -3443,8 +4285,23 @@ func (c *ElastiCache) RemoveTagsFromResourceRequest(input *RemoveTagsFromResourc // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/RemoveTagsFromResource func (c *ElastiCache) RemoveTagsFromResource(input *RemoveTagsFromResourceInput) (*TagListMessage, error) { req, out := c.RemoveTagsFromResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromResourceWithContext is the same as RemoveTagsFromResource with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromResource 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 *ElastiCache) RemoveTagsFromResourceWithContext(ctx aws.Context, input *RemoveTagsFromResourceInput, opts ...request.Option) (*TagListMessage, error) { + req, out := c.RemoveTagsFromResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetCacheParameterGroup = "ResetCacheParameterGroup" @@ -3522,8 +4379,23 @@ func (c *ElastiCache) ResetCacheParameterGroupRequest(input *ResetCacheParameter // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/ResetCacheParameterGroup func (c *ElastiCache) ResetCacheParameterGroup(input *ResetCacheParameterGroupInput) (*CacheParameterGroupNameMessage, error) { req, out := c.ResetCacheParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetCacheParameterGroupWithContext is the same as ResetCacheParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ResetCacheParameterGroup 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 *ElastiCache) ResetCacheParameterGroupWithContext(ctx aws.Context, input *ResetCacheParameterGroupInput, opts ...request.Option) (*CacheParameterGroupNameMessage, error) { + req, out := c.ResetCacheParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRevokeCacheSecurityGroupIngress = "RevokeCacheSecurityGroupIngress" @@ -3602,8 +4474,168 @@ func (c *ElastiCache) RevokeCacheSecurityGroupIngressRequest(input *RevokeCacheS // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/RevokeCacheSecurityGroupIngress func (c *ElastiCache) RevokeCacheSecurityGroupIngress(input *RevokeCacheSecurityGroupIngressInput) (*RevokeCacheSecurityGroupIngressOutput, error) { req, out := c.RevokeCacheSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RevokeCacheSecurityGroupIngressWithContext is the same as RevokeCacheSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See RevokeCacheSecurityGroupIngress 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 *ElastiCache) RevokeCacheSecurityGroupIngressWithContext(ctx aws.Context, input *RevokeCacheSecurityGroupIngressInput, opts ...request.Option) (*RevokeCacheSecurityGroupIngressOutput, error) { + req, out := c.RevokeCacheSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTestFailover = "TestFailover" + +// TestFailoverRequest generates a "aws/request.Request" representing the +// client's request for the TestFailover operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See TestFailover for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the TestFailover method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the TestFailoverRequest method. +// req, resp := client.TestFailoverRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/TestFailover +func (c *ElastiCache) TestFailoverRequest(input *TestFailoverInput) (req *request.Request, output *TestFailoverOutput) { + op := &request.Operation{ + Name: opTestFailover, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TestFailoverInput{} + } + + output = &TestFailoverOutput{} + req = c.newRequest(op, input, output) + return +} + +// TestFailover API operation for Amazon ElastiCache. +// +// Represents the input of a TestFailover operation which test automatic failover +// on a specified node group (called shard in the console) in a replication +// group (called cluster in the console). +// +// Note the following +// +// * A customer can use this operation to test automatic failover on up to +// 5 shards (called node groups in the ElastiCache API and AWS CLI) in any +// rolling 24-hour period. +// +// * If calling this operation on shards in different clusters (called replication +// groups in the API and CLI), the calls can be made concurrently. +// +// * If calling this operation multiple times on different shards in the +// same Redis (cluster mode enabled) replication group, the first node replacement +// must complete before a subsequent call can be made. +// +// * To determine whether the node replacement is complete you can check +// Events using the Amazon ElastiCache console, the AWS CLI, or the ElastiCache +// API. Look for the following automatic failover related events, listed +// here in order of occurrance: +// +// Replication group message: Test Failover API called for node group +// +// Cache cluster message: Failover from master node to replica +// node completed +// +// Replication group message: Failover from master node to +// replica node completed +// +// Cache cluster message: Recovering cache nodes +// +// Cache cluster message: Finished recovery for cache nodes +// +// For more information see: +// +// Viewing ElastiCache Events (http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/ECEvents.Viewing.html) +// in the ElastiCache User Guide +// +// DescribeEvents (http://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeEvents.html) +// in the ElastiCache API Reference +// +// Also see, Testing Multi-AZ with Automatic Failover (http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/AutoFailover.html#auto-failover-test) +// in the ElastiCache 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 Amazon ElastiCache's +// API operation TestFailover for usage and error information. +// +// Returned Error Codes: +// * ErrCodeAPICallRateForCustomerExceededFault "APICallRateForCustomerExceeded" +// The customer has exceeded the allowed rate of API calls. +// +// * ErrCodeInvalidCacheClusterStateFault "InvalidCacheClusterState" +// The requested cache cluster is not in the available state. +// +// * ErrCodeInvalidReplicationGroupStateFault "InvalidReplicationGroupState" +// The requested replication group is not in the available state. +// +// * ErrCodeNodeGroupNotFoundFault "NodeGroupNotFoundFault" +// The node group specified by the NodeGroupId parameter could not be found. +// Please verify that the node group exists and that you spelled the NodeGroupId +// value correctly. +// +// * ErrCodeReplicationGroupNotFoundFault "ReplicationGroupNotFoundFault" +// The specified replication group does not exist. +// +// * ErrCodeTestFailoverNotAvailableFault "TestFailoverNotAvailableFault" +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value for a parameter is invalid. +// +// * ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Two or more incompatible parameters were specified. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/TestFailover +func (c *ElastiCache) TestFailover(input *TestFailoverInput) (*TestFailoverOutput, error) { + req, out := c.TestFailoverRequest(input) + return out, req.Send() +} + +// TestFailoverWithContext is the same as TestFailover with the addition of +// the ability to pass a context and additional request options. +// +// See TestFailover 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 *ElastiCache) TestFailoverWithContext(ctx aws.Context, input *TestFailoverInput, opts ...request.Option) (*TestFailoverOutput, error) { + req, out := c.TestFailoverRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents the input of an AddTagsToResource operation. @@ -3868,8 +4900,11 @@ type CacheCluster struct { // library. ClientDownloadLandingPage *string `type:"string"` - // Represents the information required for client programs to connect to a cache - // node. + // Represents a Memcached cluster endpoint which, if Automatic Discovery is + // enabled on the cluster, can be used by an application to connect to any node + // in the cluster. The configuration endpoint will always have .cfg in it. + // + // Example: mem-3.9dvc4r.cfg.usw2.cache.amazonaws.com:11211 ConfigurationEndpoint *Endpoint `type:"structure"` // The name of the cache engine (memcached or redis) to be used for this cache @@ -5636,8 +6671,8 @@ type CreateReplicationGroupInput struct { // ReplicaCount. // // If you're creating a Redis (cluster mode disabled) or a Redis (cluster mode - // enabled) replication group, you can use this parameter to configure one node - // group (shard) or you can omit this parameter. + // enabled) replication group, you can use this parameter to individually configure + // each node group (shard), or you can omit this parameter. NodeGroupConfiguration []*NodeGroupConfiguration `locationNameList:"NodeGroupConfiguration" type:"list"` // The Amazon Resource Name (ARN) of the Amazon Simple Notification Service @@ -5651,7 +6686,10 @@ type CreateReplicationGroupInput struct { // This parameter is not used if there is more than one node group (shard). // You should use ReplicasPerNodeGroup instead. // - // If Multi-AZ is enabled, the value of this parameter must be at least 2. + // If AutomaticFailoverEnabled is true, the value of this parameter must be + // at least 2. If AutomaticFailoverEnabled is false you can omit this parameter + // (it will default to 1), or you can explicitly set it to a value between 2 + // and 6. // // The maximum permitted value for NumCacheClusters is 6 (primary plus 5 replicas). NumCacheClusters *int64 `type:"integer"` @@ -5749,9 +6787,11 @@ type CreateReplicationGroupInput struct { // A list of Amazon Resource Names (ARN) that uniquely identify the Redis RDB // snapshot files stored in Amazon S3. The snapshot files are used to populate - // the replication group. The Amazon S3 object name in the ARN cannot contain - // any commas. The list must match the number of node groups (shards) in the - // replication group, which means you cannot repartition. + // the new replication group. The Amazon S3 object name in the ARN cannot contain + // any commas. The new replication group will have the number of node groups + // (console: shards) specified by the parameter NumNodeGroups or the number + // of node groups configured by NodeGroupConfiguration regardless of the number + // of ARNs specified here. // // This parameter is only valid if the Engine parameter is redis. // @@ -6505,6 +7545,11 @@ type DescribeCacheClustersInput struct { // Constraints: minimum 20; maximum 100. MaxRecords *int64 `type:"integer"` + // An optional flag that can be included in the DescribeCacheCluster request + // to show only nodes (API/CLI: clusters) that are not members of a replication + // group. In practice, this mean Memcached and single node Redis clusters. + ShowCacheClustersNotInReplicationGroups *bool `type:"boolean"` + // An optional flag that can be included in the DescribeCacheCluster request // to retrieve information about the individual cache nodes. ShowCacheNodeInfo *bool `type:"boolean"` @@ -6538,6 +7583,12 @@ func (s *DescribeCacheClustersInput) SetMaxRecords(v int64) *DescribeCacheCluste return s } +// SetShowCacheClustersNotInReplicationGroups sets the ShowCacheClustersNotInReplicationGroups field's value. +func (s *DescribeCacheClustersInput) SetShowCacheClustersNotInReplicationGroups(v bool) *DescribeCacheClustersInput { + s.ShowCacheClustersNotInReplicationGroups = &v + return s +} + // SetShowCacheNodeInfo sets the ShowCacheNodeInfo field's value. func (s *DescribeCacheClustersInput) SetShowCacheNodeInfo(v bool) *DescribeCacheClustersInput { s.ShowCacheNodeInfo = &v @@ -7181,11 +8232,13 @@ func (s *DescribeEngineDefaultParametersOutput) SetEngineDefaults(v *EngineDefau type DescribeEventsInput struct { _ struct{} `type:"structure"` - // The number of minutes' worth of events to retrieve. + // The number of minutes worth of events to retrieve. Duration *int64 `type:"integer"` // The end of the time interval for which to retrieve events, specified in ISO // 8601 format. + // + // Example: 2017-03-30T07:03:49.555Z EndTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` // An optional marker returned from a prior request. Use this marker for pagination @@ -7212,6 +8265,8 @@ type DescribeEventsInput struct { // The beginning of the time interval to retrieve events for, specified in ISO // 8601 format. + // + // Example: 2017-03-30T07:03:49.555Z StartTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` } @@ -8106,10 +9161,18 @@ func (s *ListAllowedNodeTypeModificationsInput) SetReplicationGroupId(v string) return s } +// Represents the allowed node types you can use to modify your cache cluster +// or replication group. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/AllowedNodeTypeModificationsMessage type ListAllowedNodeTypeModificationsOutput struct { _ struct{} `type:"structure"` + // A string list, each element of which specifies a cache node type which you + // can use to scale your cache cluster or replication group. + // + // When scaling up a Redis cluster or replication group using ModifyCacheCluster + // or ModifyReplicationGroup, use a value from this list for the CacheNodeType + // parameter. ScaleUpModifications []*string `type:"list"` } @@ -8778,6 +9841,9 @@ type ModifyReplicationGroupInput struct { // and create it anew with the earlier engine version. EngineVersion *string `type:"string"` + // The name of the Node Group (called shard in the console). + NodeGroupId *string `type:"string"` + // The Amazon Resource Name (ARN) of the Amazon SNS topic to which notifications // are sent. // @@ -8923,6 +9989,12 @@ func (s *ModifyReplicationGroupInput) SetEngineVersion(v string) *ModifyReplicat return s } +// SetNodeGroupId sets the NodeGroupId field's value. +func (s *ModifyReplicationGroupInput) SetNodeGroupId(v string) *ModifyReplicationGroupInput { + s.NodeGroupId = &v + return s +} + // SetNotificationTopicArn sets the NotificationTopicArn field's value. func (s *ModifyReplicationGroupInput) SetNotificationTopicArn(v string) *ModifyReplicationGroupInput { s.NotificationTopicArn = &v @@ -9093,8 +10165,8 @@ type NodeGroupConfiguration struct { // The number of read replica nodes in this node group (shard). ReplicaCount *int64 `type:"integer"` - // A string that specifies the keyspaces as a series of comma separated values. - // Keyspaces are 0 to 16,383. The string is in the format startkey-endkey. + // A string that specifies the keyspace for a particular node group. Keyspaces + // range from 0 to 16,383. The string is in the format startkey-endkey. // // Example: "0-3999" Slots *string `type:"string"` @@ -9790,6 +10862,17 @@ type ReplicationGroup struct { // Redis (cluster mode enabled): T1 node types. AutomaticFailover *string `type:"string" enum:"AutomaticFailoverStatus"` + // The name of the compute and memory capacity node type for each node in the + // replication group. + CacheNodeType *string `type:"string"` + + // A flag indicating whether or not this replication group is cluster enabled; + // i.e., whether its data can be partitioned across multiple shards (API/CLI: + // node groups). + // + // Valid values: true | false + ClusterEnabled *bool `type:"boolean"` + // The configuration endpoint for this replicaiton group. Use the configuration // endpoint to connect to this replication group. ConfigurationEndpoint *Endpoint `type:"structure"` @@ -9856,6 +10939,18 @@ func (s *ReplicationGroup) SetAutomaticFailover(v string) *ReplicationGroup { return s } +// SetCacheNodeType sets the CacheNodeType field's value. +func (s *ReplicationGroup) SetCacheNodeType(v string) *ReplicationGroup { + s.CacheNodeType = &v + return s +} + +// SetClusterEnabled sets the ClusterEnabled field's value. +func (s *ReplicationGroup) SetClusterEnabled(v bool) *ReplicationGroup { + s.ClusterEnabled = &v + return s +} + // SetConfigurationEndpoint sets the ConfigurationEndpoint field's value. func (s *ReplicationGroup) SetConfigurationEndpoint(v *Endpoint) *ReplicationGroup { s.ConfigurationEndpoint = v @@ -10810,10 +11905,10 @@ func (s *Subnet) SetSubnetIdentifier(v string) *Subnet { type Tag struct { _ struct{} `type:"structure"` - // The key for the tag. + // The key for the tag. May not be null. Key *string `type:"string"` - // The tag's value. May not be null. + // The tag's value. May be null. Value *string `type:"string"` } @@ -10839,7 +11934,7 @@ func (s *Tag) SetValue(v string) *Tag { return s } -// Represents the output from the AddTagsToResource, ListTagsOnResource, and +// Represents the output from the AddTagsToResource, ListTagsForResource, and // RemoveTagsFromResource operations. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/TagListMessage type TagListMessage struct { @@ -10865,6 +11960,86 @@ func (s *TagListMessage) SetTagList(v []*Tag) *TagListMessage { return s } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/TestFailoverMessage +type TestFailoverInput struct { + _ struct{} `type:"structure"` + + // The name of the node group (called shard in the console) in this replication + // group on which automatic failover is to be tested. You may test automatic + // failover on up to 5 node groups in any rolling 24-hour period. + // + // NodeGroupId is a required field + NodeGroupId *string `type:"string" required:"true"` + + // The name of the replication group (console: cluster) whose automatic failover + // is being tested by this operation. + // + // ReplicationGroupId is a required field + ReplicationGroupId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s TestFailoverInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TestFailoverInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TestFailoverInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TestFailoverInput"} + if s.NodeGroupId == nil { + invalidParams.Add(request.NewErrParamRequired("NodeGroupId")) + } + if s.ReplicationGroupId == nil { + invalidParams.Add(request.NewErrParamRequired("ReplicationGroupId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNodeGroupId sets the NodeGroupId field's value. +func (s *TestFailoverInput) SetNodeGroupId(v string) *TestFailoverInput { + s.NodeGroupId = &v + return s +} + +// SetReplicationGroupId sets the ReplicationGroupId field's value. +func (s *TestFailoverInput) SetReplicationGroupId(v string) *TestFailoverInput { + s.ReplicationGroupId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticache-2015-02-02/TestFailoverResult +type TestFailoverOutput struct { + _ struct{} `type:"structure"` + + // Contains all of the attributes of a specific Redis replication group. + ReplicationGroup *ReplicationGroup `type:"structure"` +} + +// String returns the string representation +func (s TestFailoverOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TestFailoverOutput) GoString() string { + return s.String() +} + +// SetReplicationGroup sets the ReplicationGroup field's value. +func (s *TestFailoverOutput) SetReplicationGroup(v *ReplicationGroup) *TestFailoverOutput { + s.ReplicationGroup = v + return s +} + const ( // AZModeSingleAz is a AZMode enum value AZModeSingleAz = "single-az" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/errors.go index f5cffec0a2..668d6c52b0 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/errors.go @@ -1,9 +1,15 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elasticache const ( + // ErrCodeAPICallRateForCustomerExceededFault for service response error code + // "APICallRateForCustomerExceeded". + // + // The customer has exceeded the allowed rate of API calls. + ErrCodeAPICallRateForCustomerExceededFault = "APICallRateForCustomerExceeded" + // ErrCodeAuthorizationAlreadyExistsFault for service response error code // "AuthorizationAlreadyExists". // @@ -180,6 +186,14 @@ const ( // The VPC network is in an invalid state. ErrCodeInvalidVPCNetworkStateFault = "InvalidVPCNetworkStateFault" + // ErrCodeNodeGroupNotFoundFault for service response error code + // "NodeGroupNotFoundFault". + // + // The node group specified by the NodeGroupId parameter could not be found. + // Please verify that the node group exists and that you spelled the NodeGroupId + // value correctly. + ErrCodeNodeGroupNotFoundFault = "NodeGroupNotFoundFault" + // ErrCodeNodeGroupsPerReplicationGroupQuotaExceededFault for service response error code // "NodeGroupsPerReplicationGroupQuotaExceeded". // @@ -288,6 +302,10 @@ const ( // // The request cannot be processed because it would cause the resource to have // more than the allowed number of tags. The maximum number of tags permitted - // on a resource is 10. + // on a resource is 50. ErrCodeTagQuotaPerResourceExceeded = "TagQuotaPerResourceExceeded" + + // ErrCodeTestFailoverNotAvailableFault for service response error code + // "TestFailoverNotAvailableFault". + ErrCodeTestFailoverNotAvailableFault = "TestFailoverNotAvailableFault" ) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/service.go index 7654b3bd70..1ae97a0375 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elasticache diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/waiters.go index 2e25f84d60..d5ab1eedfa 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticache/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elasticache import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilCacheClusterAvailable uses the Amazon ElastiCache API operation @@ -11,50 +14,65 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *ElastiCache) WaitUntilCacheClusterAvailable(input *DescribeCacheClustersInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeCacheClusters", - Delay: 15, + return c.WaitUntilCacheClusterAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilCacheClusterAvailableWithContext is an extended version of WaitUntilCacheClusterAvailable. +// 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 *ElastiCache) WaitUntilCacheClusterAvailableWithContext(ctx aws.Context, input *DescribeCacheClustersInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilCacheClusterAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "deleted", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "deleting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "incompatible-network", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "restore-failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeCacheClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilCacheClusterDeleted uses the Amazon ElastiCache API operation @@ -62,68 +80,80 @@ func (c *ElastiCache) WaitUntilCacheClusterAvailable(input *DescribeCacheCluster // If the condition is not meet within the max attempt window an error will // be returned. func (c *ElastiCache) WaitUntilCacheClusterDeleted(input *DescribeCacheClustersInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeCacheClusters", - Delay: 15, + return c.WaitUntilCacheClusterDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilCacheClusterDeletedWithContext is an extended version of WaitUntilCacheClusterDeleted. +// 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 *ElastiCache) WaitUntilCacheClusterDeletedWithContext(ctx aws.Context, input *DescribeCacheClustersInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilCacheClusterDeleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "deleted", }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "CacheClusterNotFound", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "creating", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "incompatible-network", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "modifying", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "restore-failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "CacheClusters[].CacheClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "CacheClusters[].CacheClusterStatus", Expected: "snapshotting", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeCacheClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeCacheClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilReplicationGroupAvailable uses the Amazon ElastiCache API operation @@ -131,32 +161,50 @@ func (c *ElastiCache) WaitUntilCacheClusterDeleted(input *DescribeCacheClustersI // If the condition is not meet within the max attempt window an error will // be returned. func (c *ElastiCache) WaitUntilReplicationGroupAvailable(input *DescribeReplicationGroupsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeReplicationGroups", - Delay: 15, + return c.WaitUntilReplicationGroupAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilReplicationGroupAvailableWithContext is an extended version of WaitUntilReplicationGroupAvailable. +// 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 *ElastiCache) WaitUntilReplicationGroupAvailableWithContext(ctx aws.Context, input *DescribeReplicationGroupsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilReplicationGroupAvailable", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "ReplicationGroups[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "ReplicationGroups[].Status", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "ReplicationGroups[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "ReplicationGroups[].Status", Expected: "deleted", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeReplicationGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReplicationGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilReplicationGroupDeleted uses the Amazon ElastiCache API operation @@ -164,36 +212,53 @@ func (c *ElastiCache) WaitUntilReplicationGroupAvailable(input *DescribeReplicat // If the condition is not meet within the max attempt window an error will // be returned. func (c *ElastiCache) WaitUntilReplicationGroupDeleted(input *DescribeReplicationGroupsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeReplicationGroups", - Delay: 15, + return c.WaitUntilReplicationGroupDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilReplicationGroupDeletedWithContext is an extended version of WaitUntilReplicationGroupDeleted. +// 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 *ElastiCache) WaitUntilReplicationGroupDeletedWithContext(ctx aws.Context, input *DescribeReplicationGroupsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilReplicationGroupDeleted", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "ReplicationGroups[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "ReplicationGroups[].Status", Expected: "deleted", }, { - State: "failure", - Matcher: "pathAny", - Argument: "ReplicationGroups[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "ReplicationGroups[].Status", Expected: "available", }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ReplicationGroupNotFoundFault", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeReplicationGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReplicationGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/api.go index e1ea45df1c..b8db05a32e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package elasticbeanstalk provides a client for AWS Elastic Beanstalk. package elasticbeanstalk @@ -7,6 +7,7 @@ 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" @@ -78,8 +79,23 @@ func (c *ElasticBeanstalk) AbortEnvironmentUpdateRequest(input *AbortEnvironment // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/AbortEnvironmentUpdate func (c *ElasticBeanstalk) AbortEnvironmentUpdate(input *AbortEnvironmentUpdateInput) (*AbortEnvironmentUpdateOutput, error) { req, out := c.AbortEnvironmentUpdateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AbortEnvironmentUpdateWithContext is the same as AbortEnvironmentUpdate with the addition of +// the ability to pass a context and additional request options. +// +// See AbortEnvironmentUpdate 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 *ElasticBeanstalk) AbortEnvironmentUpdateWithContext(ctx aws.Context, input *AbortEnvironmentUpdateInput, opts ...request.Option) (*AbortEnvironmentUpdateOutput, error) { + req, out := c.AbortEnvironmentUpdateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opApplyEnvironmentManagedAction = "ApplyEnvironmentManagedAction" @@ -148,8 +164,23 @@ func (c *ElasticBeanstalk) ApplyEnvironmentManagedActionRequest(input *ApplyEnvi // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ApplyEnvironmentManagedAction func (c *ElasticBeanstalk) ApplyEnvironmentManagedAction(input *ApplyEnvironmentManagedActionInput) (*ApplyEnvironmentManagedActionOutput, error) { req, out := c.ApplyEnvironmentManagedActionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ApplyEnvironmentManagedActionWithContext is the same as ApplyEnvironmentManagedAction with the addition of +// the ability to pass a context and additional request options. +// +// See ApplyEnvironmentManagedAction 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 *ElasticBeanstalk) ApplyEnvironmentManagedActionWithContext(ctx aws.Context, input *ApplyEnvironmentManagedActionInput, opts ...request.Option) (*ApplyEnvironmentManagedActionOutput, error) { + req, out := c.ApplyEnvironmentManagedActionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCheckDNSAvailability = "CheckDNSAvailability" @@ -208,8 +239,23 @@ func (c *ElasticBeanstalk) CheckDNSAvailabilityRequest(input *CheckDNSAvailabili // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CheckDNSAvailability func (c *ElasticBeanstalk) CheckDNSAvailability(input *CheckDNSAvailabilityInput) (*CheckDNSAvailabilityOutput, error) { req, out := c.CheckDNSAvailabilityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CheckDNSAvailabilityWithContext is the same as CheckDNSAvailability with the addition of +// the ability to pass a context and additional request options. +// +// See CheckDNSAvailability 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 *ElasticBeanstalk) CheckDNSAvailabilityWithContext(ctx aws.Context, input *CheckDNSAvailabilityInput, opts ...request.Option) (*CheckDNSAvailabilityOutput, error) { + req, out := c.CheckDNSAvailabilityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opComposeEnvironments = "ComposeEnvironments" @@ -283,8 +329,23 @@ func (c *ElasticBeanstalk) ComposeEnvironmentsRequest(input *ComposeEnvironments // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ComposeEnvironments func (c *ElasticBeanstalk) ComposeEnvironments(input *ComposeEnvironmentsInput) (*EnvironmentDescriptionsMessage, error) { req, out := c.ComposeEnvironmentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ComposeEnvironmentsWithContext is the same as ComposeEnvironments with the addition of +// the ability to pass a context and additional request options. +// +// See ComposeEnvironments 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 *ElasticBeanstalk) ComposeEnvironmentsWithContext(ctx aws.Context, input *ComposeEnvironmentsInput, opts ...request.Option) (*EnvironmentDescriptionsMessage, error) { + req, out := c.ComposeEnvironmentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateApplication = "CreateApplication" @@ -349,8 +410,23 @@ func (c *ElasticBeanstalk) CreateApplicationRequest(input *CreateApplicationInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreateApplication func (c *ElasticBeanstalk) CreateApplication(input *CreateApplicationInput) (*ApplicationDescriptionMessage, error) { req, out := c.CreateApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateApplicationWithContext is the same as CreateApplication with the addition of +// the ability to pass a context and additional request options. +// +// See CreateApplication 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 *ElasticBeanstalk) CreateApplicationWithContext(ctx aws.Context, input *CreateApplicationInput, opts ...request.Option) (*ApplicationDescriptionMessage, error) { + req, out := c.CreateApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateApplicationVersion = "CreateApplicationVersion" @@ -450,8 +526,23 @@ func (c *ElasticBeanstalk) CreateApplicationVersionRequest(input *CreateApplicat // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreateApplicationVersion func (c *ElasticBeanstalk) CreateApplicationVersion(input *CreateApplicationVersionInput) (*ApplicationVersionDescriptionMessage, error) { req, out := c.CreateApplicationVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateApplicationVersionWithContext is the same as CreateApplicationVersion with the addition of +// the ability to pass a context and additional request options. +// +// See CreateApplicationVersion 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 *ElasticBeanstalk) CreateApplicationVersionWithContext(ctx aws.Context, input *CreateApplicationVersionInput, opts ...request.Option) (*ApplicationVersionDescriptionMessage, error) { + req, out := c.CreateApplicationVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateConfigurationTemplate = "CreateConfigurationTemplate" @@ -532,8 +623,23 @@ func (c *ElasticBeanstalk) CreateConfigurationTemplateRequest(input *CreateConfi // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreateConfigurationTemplate func (c *ElasticBeanstalk) CreateConfigurationTemplate(input *CreateConfigurationTemplateInput) (*ConfigurationSettingsDescription, error) { req, out := c.CreateConfigurationTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateConfigurationTemplateWithContext is the same as CreateConfigurationTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See CreateConfigurationTemplate 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 *ElasticBeanstalk) CreateConfigurationTemplateWithContext(ctx aws.Context, input *CreateConfigurationTemplateInput, opts ...request.Option) (*ConfigurationSettingsDescription, error) { + req, out := c.CreateConfigurationTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateEnvironment = "CreateEnvironment" @@ -602,8 +708,111 @@ func (c *ElasticBeanstalk) CreateEnvironmentRequest(input *CreateEnvironmentInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreateEnvironment func (c *ElasticBeanstalk) CreateEnvironment(input *CreateEnvironmentInput) (*EnvironmentDescription, error) { req, out := c.CreateEnvironmentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateEnvironmentWithContext is the same as CreateEnvironment with the addition of +// the ability to pass a context and additional request options. +// +// See CreateEnvironment 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 *ElasticBeanstalk) CreateEnvironmentWithContext(ctx aws.Context, input *CreateEnvironmentInput, opts ...request.Option) (*EnvironmentDescription, error) { + req, out := c.CreateEnvironmentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreatePlatformVersion = "CreatePlatformVersion" + +// CreatePlatformVersionRequest generates a "aws/request.Request" representing the +// client's request for the CreatePlatformVersion operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See CreatePlatformVersion for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreatePlatformVersion method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreatePlatformVersionRequest method. +// req, resp := client.CreatePlatformVersionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreatePlatformVersion +func (c *ElasticBeanstalk) CreatePlatformVersionRequest(input *CreatePlatformVersionInput) (req *request.Request, output *CreatePlatformVersionOutput) { + op := &request.Operation{ + Name: opCreatePlatformVersion, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreatePlatformVersionInput{} + } + + output = &CreatePlatformVersionOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreatePlatformVersion API operation for AWS Elastic Beanstalk. +// +// Create a new version of your custom platform. +// +// 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 Elastic Beanstalk's +// API operation CreatePlatformVersion for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInsufficientPrivilegesException "InsufficientPrivilegesException" +// The specified account does not have sufficient privileges for one of more +// AWS services. +// +// * ErrCodeServiceException "ServiceException" +// A generic service exception has occurred. +// +// * ErrCodeTooManyPlatformsException "TooManyPlatformsException" +// You have exceeded the maximum number of allowed platforms associated with +// the account. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreatePlatformVersion +func (c *ElasticBeanstalk) CreatePlatformVersion(input *CreatePlatformVersionInput) (*CreatePlatformVersionOutput, error) { + req, out := c.CreatePlatformVersionRequest(input) + return out, req.Send() +} + +// CreatePlatformVersionWithContext is the same as CreatePlatformVersion with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePlatformVersion 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 *ElasticBeanstalk) CreatePlatformVersionWithContext(ctx aws.Context, input *CreatePlatformVersionInput, opts ...request.Option) (*CreatePlatformVersionOutput, error) { + req, out := c.CreatePlatformVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateStorageLocation = "CreateStorageLocation" @@ -676,8 +885,23 @@ func (c *ElasticBeanstalk) CreateStorageLocationRequest(input *CreateStorageLoca // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreateStorageLocation func (c *ElasticBeanstalk) CreateStorageLocation(input *CreateStorageLocationInput) (*CreateStorageLocationOutput, error) { req, out := c.CreateStorageLocationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateStorageLocationWithContext is the same as CreateStorageLocation with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStorageLocation 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 *ElasticBeanstalk) CreateStorageLocationWithContext(ctx aws.Context, input *CreateStorageLocationInput, opts ...request.Option) (*CreateStorageLocationOutput, error) { + req, out := c.CreateStorageLocationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteApplication = "DeleteApplication" @@ -748,8 +972,23 @@ func (c *ElasticBeanstalk) DeleteApplicationRequest(input *DeleteApplicationInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeleteApplication func (c *ElasticBeanstalk) DeleteApplication(input *DeleteApplicationInput) (*DeleteApplicationOutput, error) { req, out := c.DeleteApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteApplicationWithContext is the same as DeleteApplication with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteApplication 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 *ElasticBeanstalk) DeleteApplicationWithContext(ctx aws.Context, input *DeleteApplicationInput, opts ...request.Option) (*DeleteApplicationOutput, error) { + req, out := c.DeleteApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteApplicationVersion = "DeleteApplicationVersion" @@ -837,8 +1076,23 @@ func (c *ElasticBeanstalk) DeleteApplicationVersionRequest(input *DeleteApplicat // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeleteApplicationVersion func (c *ElasticBeanstalk) DeleteApplicationVersion(input *DeleteApplicationVersionInput) (*DeleteApplicationVersionOutput, error) { req, out := c.DeleteApplicationVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteApplicationVersionWithContext is the same as DeleteApplicationVersion with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteApplicationVersion 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 *ElasticBeanstalk) DeleteApplicationVersionWithContext(ctx aws.Context, input *DeleteApplicationVersionInput, opts ...request.Option) (*DeleteApplicationVersionOutput, error) { + req, out := c.DeleteApplicationVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteConfigurationTemplate = "DeleteConfigurationTemplate" @@ -909,8 +1163,23 @@ func (c *ElasticBeanstalk) DeleteConfigurationTemplateRequest(input *DeleteConfi // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeleteConfigurationTemplate func (c *ElasticBeanstalk) DeleteConfigurationTemplate(input *DeleteConfigurationTemplateInput) (*DeleteConfigurationTemplateOutput, error) { req, out := c.DeleteConfigurationTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteConfigurationTemplateWithContext is the same as DeleteConfigurationTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteConfigurationTemplate 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 *ElasticBeanstalk) DeleteConfigurationTemplateWithContext(ctx aws.Context, input *DeleteConfigurationTemplateInput, opts ...request.Option) (*DeleteConfigurationTemplateOutput, error) { + req, out := c.DeleteConfigurationTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteEnvironmentConfiguration = "DeleteEnvironmentConfiguration" @@ -978,8 +1247,115 @@ func (c *ElasticBeanstalk) DeleteEnvironmentConfigurationRequest(input *DeleteEn // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeleteEnvironmentConfiguration func (c *ElasticBeanstalk) DeleteEnvironmentConfiguration(input *DeleteEnvironmentConfigurationInput) (*DeleteEnvironmentConfigurationOutput, error) { req, out := c.DeleteEnvironmentConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEnvironmentConfigurationWithContext is the same as DeleteEnvironmentConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEnvironmentConfiguration 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 *ElasticBeanstalk) DeleteEnvironmentConfigurationWithContext(ctx aws.Context, input *DeleteEnvironmentConfigurationInput, opts ...request.Option) (*DeleteEnvironmentConfigurationOutput, error) { + req, out := c.DeleteEnvironmentConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeletePlatformVersion = "DeletePlatformVersion" + +// DeletePlatformVersionRequest generates a "aws/request.Request" representing the +// client's request for the DeletePlatformVersion operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DeletePlatformVersion for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeletePlatformVersion method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeletePlatformVersionRequest method. +// req, resp := client.DeletePlatformVersionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeletePlatformVersion +func (c *ElasticBeanstalk) DeletePlatformVersionRequest(input *DeletePlatformVersionInput) (req *request.Request, output *DeletePlatformVersionOutput) { + op := &request.Operation{ + Name: opDeletePlatformVersion, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeletePlatformVersionInput{} + } + + output = &DeletePlatformVersionOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeletePlatformVersion API operation for AWS Elastic Beanstalk. +// +// Deletes the specified version of a custom platform. +// +// 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 Elastic Beanstalk's +// API operation DeletePlatformVersion for usage and error information. +// +// Returned Error Codes: +// * ErrCodeOperationInProgressException "OperationInProgressFailure" +// Unable to perform the specified operation because another operation that +// effects an element in this activity is already in progress. +// +// * ErrCodeInsufficientPrivilegesException "InsufficientPrivilegesException" +// The specified account does not have sufficient privileges for one of more +// AWS services. +// +// * ErrCodeServiceException "ServiceException" +// A generic service exception has occurred. +// +// * ErrCodePlatformVersionStillReferencedException "PlatformVersionStillReferencedException" +// You cannot delete the platform version because there are still environments +// running on it. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeletePlatformVersion +func (c *ElasticBeanstalk) DeletePlatformVersion(input *DeletePlatformVersionInput) (*DeletePlatformVersionOutput, error) { + req, out := c.DeletePlatformVersionRequest(input) + return out, req.Send() +} + +// DeletePlatformVersionWithContext is the same as DeletePlatformVersion with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePlatformVersion 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 *ElasticBeanstalk) DeletePlatformVersionWithContext(ctx aws.Context, input *DeletePlatformVersionInput, opts ...request.Option) (*DeletePlatformVersionOutput, error) { + req, out := c.DeletePlatformVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeApplicationVersions = "DescribeApplicationVersions" @@ -1038,8 +1414,23 @@ func (c *ElasticBeanstalk) DescribeApplicationVersionsRequest(input *DescribeApp // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeApplicationVersions func (c *ElasticBeanstalk) DescribeApplicationVersions(input *DescribeApplicationVersionsInput) (*DescribeApplicationVersionsOutput, error) { req, out := c.DescribeApplicationVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeApplicationVersionsWithContext is the same as DescribeApplicationVersions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeApplicationVersions 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 *ElasticBeanstalk) DescribeApplicationVersionsWithContext(ctx aws.Context, input *DescribeApplicationVersionsInput, opts ...request.Option) (*DescribeApplicationVersionsOutput, error) { + req, out := c.DescribeApplicationVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeApplications = "DescribeApplications" @@ -1098,8 +1489,23 @@ func (c *ElasticBeanstalk) DescribeApplicationsRequest(input *DescribeApplicatio // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeApplications func (c *ElasticBeanstalk) DescribeApplications(input *DescribeApplicationsInput) (*DescribeApplicationsOutput, error) { req, out := c.DescribeApplicationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeApplicationsWithContext is the same as DescribeApplications with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeApplications 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 *ElasticBeanstalk) DescribeApplicationsWithContext(ctx aws.Context, input *DescribeApplicationsInput, opts ...request.Option) (*DescribeApplicationsOutput, error) { + req, out := c.DescribeApplicationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConfigurationOptions = "DescribeConfigurationOptions" @@ -1167,8 +1573,23 @@ func (c *ElasticBeanstalk) DescribeConfigurationOptionsRequest(input *DescribeCo // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeConfigurationOptions func (c *ElasticBeanstalk) DescribeConfigurationOptions(input *DescribeConfigurationOptionsInput) (*DescribeConfigurationOptionsOutput, error) { req, out := c.DescribeConfigurationOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConfigurationOptionsWithContext is the same as DescribeConfigurationOptions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConfigurationOptions 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 *ElasticBeanstalk) DescribeConfigurationOptionsWithContext(ctx aws.Context, input *DescribeConfigurationOptionsInput, opts ...request.Option) (*DescribeConfigurationOptionsOutput, error) { + req, out := c.DescribeConfigurationOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConfigurationSettings = "DescribeConfigurationSettings" @@ -1244,8 +1665,23 @@ func (c *ElasticBeanstalk) DescribeConfigurationSettingsRequest(input *DescribeC // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeConfigurationSettings func (c *ElasticBeanstalk) DescribeConfigurationSettings(input *DescribeConfigurationSettingsInput) (*DescribeConfigurationSettingsOutput, error) { req, out := c.DescribeConfigurationSettingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConfigurationSettingsWithContext is the same as DescribeConfigurationSettings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConfigurationSettings 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 *ElasticBeanstalk) DescribeConfigurationSettingsWithContext(ctx aws.Context, input *DescribeConfigurationSettingsInput, opts ...request.Option) (*DescribeConfigurationSettingsOutput, error) { + req, out := c.DescribeConfigurationSettingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEnvironmentHealth = "DescribeEnvironmentHealth" @@ -1315,8 +1751,23 @@ func (c *ElasticBeanstalk) DescribeEnvironmentHealthRequest(input *DescribeEnvir // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeEnvironmentHealth func (c *ElasticBeanstalk) DescribeEnvironmentHealth(input *DescribeEnvironmentHealthInput) (*DescribeEnvironmentHealthOutput, error) { req, out := c.DescribeEnvironmentHealthRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEnvironmentHealthWithContext is the same as DescribeEnvironmentHealth with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEnvironmentHealth 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 *ElasticBeanstalk) DescribeEnvironmentHealthWithContext(ctx aws.Context, input *DescribeEnvironmentHealthInput, opts ...request.Option) (*DescribeEnvironmentHealthOutput, error) { + req, out := c.DescribeEnvironmentHealthRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEnvironmentManagedActionHistory = "DescribeEnvironmentManagedActionHistory" @@ -1380,8 +1831,23 @@ func (c *ElasticBeanstalk) DescribeEnvironmentManagedActionHistoryRequest(input // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeEnvironmentManagedActionHistory func (c *ElasticBeanstalk) DescribeEnvironmentManagedActionHistory(input *DescribeEnvironmentManagedActionHistoryInput) (*DescribeEnvironmentManagedActionHistoryOutput, error) { req, out := c.DescribeEnvironmentManagedActionHistoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEnvironmentManagedActionHistoryWithContext is the same as DescribeEnvironmentManagedActionHistory with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEnvironmentManagedActionHistory 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 *ElasticBeanstalk) DescribeEnvironmentManagedActionHistoryWithContext(ctx aws.Context, input *DescribeEnvironmentManagedActionHistoryInput, opts ...request.Option) (*DescribeEnvironmentManagedActionHistoryOutput, error) { + req, out := c.DescribeEnvironmentManagedActionHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEnvironmentManagedActions = "DescribeEnvironmentManagedActions" @@ -1445,8 +1911,23 @@ func (c *ElasticBeanstalk) DescribeEnvironmentManagedActionsRequest(input *Descr // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeEnvironmentManagedActions func (c *ElasticBeanstalk) DescribeEnvironmentManagedActions(input *DescribeEnvironmentManagedActionsInput) (*DescribeEnvironmentManagedActionsOutput, error) { req, out := c.DescribeEnvironmentManagedActionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEnvironmentManagedActionsWithContext is the same as DescribeEnvironmentManagedActions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEnvironmentManagedActions 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 *ElasticBeanstalk) DescribeEnvironmentManagedActionsWithContext(ctx aws.Context, input *DescribeEnvironmentManagedActionsInput, opts ...request.Option) (*DescribeEnvironmentManagedActionsOutput, error) { + req, out := c.DescribeEnvironmentManagedActionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEnvironmentResources = "DescribeEnvironmentResources" @@ -1511,8 +1992,23 @@ func (c *ElasticBeanstalk) DescribeEnvironmentResourcesRequest(input *DescribeEn // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeEnvironmentResources func (c *ElasticBeanstalk) DescribeEnvironmentResources(input *DescribeEnvironmentResourcesInput) (*DescribeEnvironmentResourcesOutput, error) { req, out := c.DescribeEnvironmentResourcesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEnvironmentResourcesWithContext is the same as DescribeEnvironmentResources with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEnvironmentResources 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 *ElasticBeanstalk) DescribeEnvironmentResourcesWithContext(ctx aws.Context, input *DescribeEnvironmentResourcesInput, opts ...request.Option) (*DescribeEnvironmentResourcesOutput, error) { + req, out := c.DescribeEnvironmentResourcesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEnvironments = "DescribeEnvironments" @@ -1571,8 +2067,23 @@ func (c *ElasticBeanstalk) DescribeEnvironmentsRequest(input *DescribeEnvironmen // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeEnvironments func (c *ElasticBeanstalk) DescribeEnvironments(input *DescribeEnvironmentsInput) (*EnvironmentDescriptionsMessage, error) { req, out := c.DescribeEnvironmentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEnvironmentsWithContext is the same as DescribeEnvironments with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEnvironments 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 *ElasticBeanstalk) DescribeEnvironmentsWithContext(ctx aws.Context, input *DescribeEnvironmentsInput, opts ...request.Option) (*EnvironmentDescriptionsMessage, error) { + req, out := c.DescribeEnvironmentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEvents = "DescribeEvents" @@ -1639,8 +2150,23 @@ func (c *ElasticBeanstalk) DescribeEventsRequest(input *DescribeEventsInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeEvents func (c *ElasticBeanstalk) DescribeEvents(input *DescribeEventsInput) (*DescribeEventsOutput, error) { req, out := c.DescribeEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventsWithContext is the same as DescribeEvents with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEvents 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 *ElasticBeanstalk) DescribeEventsWithContext(ctx aws.Context, input *DescribeEventsInput, opts ...request.Option) (*DescribeEventsOutput, error) { + req, out := c.DescribeEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEventsPages iterates over the pages of a DescribeEvents operation, @@ -1660,12 +2186,37 @@ func (c *ElasticBeanstalk) DescribeEvents(input *DescribeEventsInput) (*Describe // return pageNum <= 3 // }) // -func (c *ElasticBeanstalk) DescribeEventsPages(input *DescribeEventsInput, fn func(p *DescribeEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEventsOutput), lastPage) - }) +func (c *ElasticBeanstalk) DescribeEventsPages(input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool) error { + return c.DescribeEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEventsPagesWithContext same as DescribeEventsPages 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 *ElasticBeanstalk) DescribeEventsPagesWithContext(ctx aws.Context, input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeInstancesHealth = "DescribeInstancesHealth" @@ -1734,8 +2285,107 @@ func (c *ElasticBeanstalk) DescribeInstancesHealthRequest(input *DescribeInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeInstancesHealth func (c *ElasticBeanstalk) DescribeInstancesHealth(input *DescribeInstancesHealthInput) (*DescribeInstancesHealthOutput, error) { req, out := c.DescribeInstancesHealthRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstancesHealthWithContext is the same as DescribeInstancesHealth with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstancesHealth 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 *ElasticBeanstalk) DescribeInstancesHealthWithContext(ctx aws.Context, input *DescribeInstancesHealthInput, opts ...request.Option) (*DescribeInstancesHealthOutput, error) { + req, out := c.DescribeInstancesHealthRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribePlatformVersion = "DescribePlatformVersion" + +// DescribePlatformVersionRequest generates a "aws/request.Request" representing the +// client's request for the DescribePlatformVersion operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DescribePlatformVersion for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribePlatformVersion method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribePlatformVersionRequest method. +// req, resp := client.DescribePlatformVersionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribePlatformVersion +func (c *ElasticBeanstalk) DescribePlatformVersionRequest(input *DescribePlatformVersionInput) (req *request.Request, output *DescribePlatformVersionOutput) { + op := &request.Operation{ + Name: opDescribePlatformVersion, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribePlatformVersionInput{} + } + + output = &DescribePlatformVersionOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribePlatformVersion API operation for AWS Elastic Beanstalk. +// +// Describes the version of the platform. +// +// 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 Elastic Beanstalk's +// API operation DescribePlatformVersion for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInsufficientPrivilegesException "InsufficientPrivilegesException" +// The specified account does not have sufficient privileges for one of more +// AWS services. +// +// * ErrCodeServiceException "ServiceException" +// A generic service exception has occurred. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribePlatformVersion +func (c *ElasticBeanstalk) DescribePlatformVersion(input *DescribePlatformVersionInput) (*DescribePlatformVersionOutput, error) { + req, out := c.DescribePlatformVersionRequest(input) + return out, req.Send() +} + +// DescribePlatformVersionWithContext is the same as DescribePlatformVersion with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePlatformVersion 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 *ElasticBeanstalk) DescribePlatformVersionWithContext(ctx aws.Context, input *DescribePlatformVersionInput, opts ...request.Option) (*DescribePlatformVersionOutput, error) { + req, out := c.DescribePlatformVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAvailableSolutionStacks = "ListAvailableSolutionStacks" @@ -1783,7 +2433,8 @@ func (c *ElasticBeanstalk) ListAvailableSolutionStacksRequest(input *ListAvailab // ListAvailableSolutionStacks API operation for AWS Elastic Beanstalk. // -// Returns a list of the available solution stack names. +// Returns a list of the available solution stack names, with the public version +// first and then in reverse chronological order. // // 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 @@ -1794,8 +2445,107 @@ func (c *ElasticBeanstalk) ListAvailableSolutionStacksRequest(input *ListAvailab // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ListAvailableSolutionStacks func (c *ElasticBeanstalk) ListAvailableSolutionStacks(input *ListAvailableSolutionStacksInput) (*ListAvailableSolutionStacksOutput, error) { req, out := c.ListAvailableSolutionStacksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAvailableSolutionStacksWithContext is the same as ListAvailableSolutionStacks with the addition of +// the ability to pass a context and additional request options. +// +// See ListAvailableSolutionStacks 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 *ElasticBeanstalk) ListAvailableSolutionStacksWithContext(ctx aws.Context, input *ListAvailableSolutionStacksInput, opts ...request.Option) (*ListAvailableSolutionStacksOutput, error) { + req, out := c.ListAvailableSolutionStacksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListPlatformVersions = "ListPlatformVersions" + +// ListPlatformVersionsRequest generates a "aws/request.Request" representing the +// client's request for the ListPlatformVersions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListPlatformVersions for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListPlatformVersions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListPlatformVersionsRequest method. +// req, resp := client.ListPlatformVersionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ListPlatformVersions +func (c *ElasticBeanstalk) ListPlatformVersionsRequest(input *ListPlatformVersionsInput) (req *request.Request, output *ListPlatformVersionsOutput) { + op := &request.Operation{ + Name: opListPlatformVersions, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListPlatformVersionsInput{} + } + + output = &ListPlatformVersionsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListPlatformVersions API operation for AWS Elastic Beanstalk. +// +// Lists the available platforms. +// +// 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 Elastic Beanstalk's +// API operation ListPlatformVersions for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInsufficientPrivilegesException "InsufficientPrivilegesException" +// The specified account does not have sufficient privileges for one of more +// AWS services. +// +// * ErrCodeServiceException "ServiceException" +// A generic service exception has occurred. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ListPlatformVersions +func (c *ElasticBeanstalk) ListPlatformVersions(input *ListPlatformVersionsInput) (*ListPlatformVersionsOutput, error) { + req, out := c.ListPlatformVersionsRequest(input) + return out, req.Send() +} + +// ListPlatformVersionsWithContext is the same as ListPlatformVersions with the addition of +// the ability to pass a context and additional request options. +// +// See ListPlatformVersions 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 *ElasticBeanstalk) ListPlatformVersionsWithContext(ctx aws.Context, input *ListPlatformVersionsInput, opts ...request.Option) (*ListPlatformVersionsOutput, error) { + req, out := c.ListPlatformVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRebuildEnvironment = "RebuildEnvironment" @@ -1863,8 +2613,23 @@ func (c *ElasticBeanstalk) RebuildEnvironmentRequest(input *RebuildEnvironmentIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/RebuildEnvironment func (c *ElasticBeanstalk) RebuildEnvironment(input *RebuildEnvironmentInput) (*RebuildEnvironmentOutput, error) { req, out := c.RebuildEnvironmentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RebuildEnvironmentWithContext is the same as RebuildEnvironment with the addition of +// the ability to pass a context and additional request options. +// +// See RebuildEnvironment 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 *ElasticBeanstalk) RebuildEnvironmentWithContext(ctx aws.Context, input *RebuildEnvironmentInput, opts ...request.Option) (*RebuildEnvironmentOutput, error) { + req, out := c.RebuildEnvironmentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRequestEnvironmentInfo = "RequestEnvironmentInfo" @@ -1939,8 +2704,23 @@ func (c *ElasticBeanstalk) RequestEnvironmentInfoRequest(input *RequestEnvironme // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/RequestEnvironmentInfo func (c *ElasticBeanstalk) RequestEnvironmentInfo(input *RequestEnvironmentInfoInput) (*RequestEnvironmentInfoOutput, error) { req, out := c.RequestEnvironmentInfoRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RequestEnvironmentInfoWithContext is the same as RequestEnvironmentInfo with the addition of +// the ability to pass a context and additional request options. +// +// See RequestEnvironmentInfo 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 *ElasticBeanstalk) RequestEnvironmentInfoWithContext(ctx aws.Context, input *RequestEnvironmentInfoInput, opts ...request.Option) (*RequestEnvironmentInfoOutput, error) { + req, out := c.RequestEnvironmentInfoRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestartAppServer = "RestartAppServer" @@ -2002,8 +2782,23 @@ func (c *ElasticBeanstalk) RestartAppServerRequest(input *RestartAppServerInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/RestartAppServer func (c *ElasticBeanstalk) RestartAppServer(input *RestartAppServerInput) (*RestartAppServerOutput, error) { req, out := c.RestartAppServerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestartAppServerWithContext is the same as RestartAppServer with the addition of +// the ability to pass a context and additional request options. +// +// See RestartAppServer 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 *ElasticBeanstalk) RestartAppServerWithContext(ctx aws.Context, input *RestartAppServerInput, opts ...request.Option) (*RestartAppServerOutput, error) { + req, out := c.RestartAppServerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRetrieveEnvironmentInfo = "RetrieveEnvironmentInfo" @@ -2066,8 +2861,23 @@ func (c *ElasticBeanstalk) RetrieveEnvironmentInfoRequest(input *RetrieveEnviron // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/RetrieveEnvironmentInfo func (c *ElasticBeanstalk) RetrieveEnvironmentInfo(input *RetrieveEnvironmentInfoInput) (*RetrieveEnvironmentInfoOutput, error) { req, out := c.RetrieveEnvironmentInfoRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RetrieveEnvironmentInfoWithContext is the same as RetrieveEnvironmentInfo with the addition of +// the ability to pass a context and additional request options. +// +// See RetrieveEnvironmentInfo 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 *ElasticBeanstalk) RetrieveEnvironmentInfoWithContext(ctx aws.Context, input *RetrieveEnvironmentInfoInput, opts ...request.Option) (*RetrieveEnvironmentInfoOutput, error) { + req, out := c.RetrieveEnvironmentInfoRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSwapEnvironmentCNAMEs = "SwapEnvironmentCNAMEs" @@ -2128,8 +2938,23 @@ func (c *ElasticBeanstalk) SwapEnvironmentCNAMEsRequest(input *SwapEnvironmentCN // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/SwapEnvironmentCNAMEs func (c *ElasticBeanstalk) SwapEnvironmentCNAMEs(input *SwapEnvironmentCNAMEsInput) (*SwapEnvironmentCNAMEsOutput, error) { req, out := c.SwapEnvironmentCNAMEsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SwapEnvironmentCNAMEsWithContext is the same as SwapEnvironmentCNAMEs with the addition of +// the ability to pass a context and additional request options. +// +// See SwapEnvironmentCNAMEs 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 *ElasticBeanstalk) SwapEnvironmentCNAMEsWithContext(ctx aws.Context, input *SwapEnvironmentCNAMEsInput, opts ...request.Option) (*SwapEnvironmentCNAMEsOutput, error) { + req, out := c.SwapEnvironmentCNAMEsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTerminateEnvironment = "TerminateEnvironment" @@ -2194,8 +3019,23 @@ func (c *ElasticBeanstalk) TerminateEnvironmentRequest(input *TerminateEnvironme // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/TerminateEnvironment func (c *ElasticBeanstalk) TerminateEnvironment(input *TerminateEnvironmentInput) (*EnvironmentDescription, error) { req, out := c.TerminateEnvironmentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TerminateEnvironmentWithContext is the same as TerminateEnvironment with the addition of +// the ability to pass a context and additional request options. +// +// See TerminateEnvironment 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 *ElasticBeanstalk) TerminateEnvironmentWithContext(ctx aws.Context, input *TerminateEnvironmentInput, opts ...request.Option) (*EnvironmentDescription, error) { + req, out := c.TerminateEnvironmentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateApplication = "UpdateApplication" @@ -2257,8 +3097,23 @@ func (c *ElasticBeanstalk) UpdateApplicationRequest(input *UpdateApplicationInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/UpdateApplication func (c *ElasticBeanstalk) UpdateApplication(input *UpdateApplicationInput) (*ApplicationDescriptionMessage, error) { req, out := c.UpdateApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateApplicationWithContext is the same as UpdateApplication with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateApplication 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 *ElasticBeanstalk) UpdateApplicationWithContext(ctx aws.Context, input *UpdateApplicationInput, opts ...request.Option) (*ApplicationDescriptionMessage, error) { + req, out := c.UpdateApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateApplicationResourceLifecycle = "UpdateApplicationResourceLifecycle" @@ -2323,8 +3178,23 @@ func (c *ElasticBeanstalk) UpdateApplicationResourceLifecycleRequest(input *Upda // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/UpdateApplicationResourceLifecycle func (c *ElasticBeanstalk) UpdateApplicationResourceLifecycle(input *UpdateApplicationResourceLifecycleInput) (*UpdateApplicationResourceLifecycleOutput, error) { req, out := c.UpdateApplicationResourceLifecycleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateApplicationResourceLifecycleWithContext is the same as UpdateApplicationResourceLifecycle with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateApplicationResourceLifecycle 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 *ElasticBeanstalk) UpdateApplicationResourceLifecycleWithContext(ctx aws.Context, input *UpdateApplicationResourceLifecycleInput, opts ...request.Option) (*UpdateApplicationResourceLifecycleOutput, error) { + req, out := c.UpdateApplicationResourceLifecycleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateApplicationVersion = "UpdateApplicationVersion" @@ -2386,8 +3256,23 @@ func (c *ElasticBeanstalk) UpdateApplicationVersionRequest(input *UpdateApplicat // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/UpdateApplicationVersion func (c *ElasticBeanstalk) UpdateApplicationVersion(input *UpdateApplicationVersionInput) (*ApplicationVersionDescriptionMessage, error) { req, out := c.UpdateApplicationVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateApplicationVersionWithContext is the same as UpdateApplicationVersion with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateApplicationVersion 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 *ElasticBeanstalk) UpdateApplicationVersionWithContext(ctx aws.Context, input *UpdateApplicationVersionInput, opts ...request.Option) (*ApplicationVersionDescriptionMessage, error) { + req, out := c.UpdateApplicationVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateConfigurationTemplate = "UpdateConfigurationTemplate" @@ -2463,8 +3348,23 @@ func (c *ElasticBeanstalk) UpdateConfigurationTemplateRequest(input *UpdateConfi // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/UpdateConfigurationTemplate func (c *ElasticBeanstalk) UpdateConfigurationTemplate(input *UpdateConfigurationTemplateInput) (*ConfigurationSettingsDescription, error) { req, out := c.UpdateConfigurationTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateConfigurationTemplateWithContext is the same as UpdateConfigurationTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateConfigurationTemplate 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 *ElasticBeanstalk) UpdateConfigurationTemplateWithContext(ctx aws.Context, input *UpdateConfigurationTemplateInput, opts ...request.Option) (*ConfigurationSettingsDescription, error) { + req, out := c.UpdateConfigurationTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateEnvironment = "UpdateEnvironment" @@ -2542,8 +3442,23 @@ func (c *ElasticBeanstalk) UpdateEnvironmentRequest(input *UpdateEnvironmentInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/UpdateEnvironment func (c *ElasticBeanstalk) UpdateEnvironment(input *UpdateEnvironmentInput) (*EnvironmentDescription, error) { req, out := c.UpdateEnvironmentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateEnvironmentWithContext is the same as UpdateEnvironment with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateEnvironment 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 *ElasticBeanstalk) UpdateEnvironmentWithContext(ctx aws.Context, input *UpdateEnvironmentInput, opts ...request.Option) (*EnvironmentDescription, error) { + req, out := c.UpdateEnvironmentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opValidateConfigurationSettings = "ValidateConfigurationSettings" @@ -2615,8 +3530,23 @@ func (c *ElasticBeanstalk) ValidateConfigurationSettingsRequest(input *ValidateC // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ValidateConfigurationSettings func (c *ElasticBeanstalk) ValidateConfigurationSettings(input *ValidateConfigurationSettingsInput) (*ValidateConfigurationSettingsOutput, error) { req, out := c.ValidateConfigurationSettingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ValidateConfigurationSettingsWithContext is the same as ValidateConfigurationSettings with the addition of +// the ability to pass a context and additional request options. +// +// See ValidateConfigurationSettings 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 *ElasticBeanstalk) ValidateConfigurationSettingsWithContext(ctx aws.Context, input *ValidateConfigurationSettingsInput, opts ...request.Option) (*ValidateConfigurationSettingsOutput, error) { + req, out := c.ValidateConfigurationSettingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/AbortEnvironmentUpdateMessage @@ -2797,7 +3727,7 @@ type ApplicationMetrics struct { Duration *int64 `type:"integer"` // Represents the average latency for the slowest X percent of requests over - // the last 10 seconds. Latencies are in seconds with one milisecond resolution. + // the last 10 seconds. Latencies are in seconds with one millisecond resolution. Latency *Latency `type:"structure"` // Average number of requests handled by the web server per second over the @@ -3311,6 +4241,31 @@ func (s *BuildConfiguration) SetTimeoutInMinutes(v int64) *BuildConfiguration { return s } +// The builder used to build the custom platform. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/Builder +type Builder struct { + _ struct{} `type:"structure"` + + // The ARN of the builder. + ARN *string `type:"string"` +} + +// String returns the string representation +func (s Builder) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Builder) GoString() string { + return s.String() +} + +// SetARN sets the ARN field's value. +func (s *Builder) SetARN(v string) *Builder { + s.ARN = &v + return s +} + // CPU utilization metrics for an instance. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CPUUtilization type CPUUtilization struct { @@ -3806,6 +4761,9 @@ type ConfigurationSettingsDescription struct { // set. OptionSettings []*ConfigurationOptionSetting `type:"list"` + // The ARN of the custom platform. + PlatformArn *string `type:"string"` + // The name of the solution stack this configuration set uses. SolutionStackName *string `type:"string"` @@ -3866,6 +4824,12 @@ func (s *ConfigurationSettingsDescription) SetOptionSettings(v []*ConfigurationO return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *ConfigurationSettingsDescription) SetPlatformArn(v string) *ConfigurationSettingsDescription { + s.PlatformArn = &v + return s +} + // SetSolutionStackName sets the SolutionStackName field's value. func (s *ConfigurationSettingsDescription) SetSolutionStackName(v string) *ConfigurationSettingsDescription { s.SolutionStackName = &v @@ -4110,6 +5074,9 @@ type CreateConfigurationTemplateInput struct { // solution stack or the source configuration template. OptionSettings []*ConfigurationOptionSetting `type:"list"` + // The ARN of the custome platform. + PlatformArn *string `type:"string"` + // The name of the solution stack used by this configuration. The solution stack // specifies the operating system, architecture, and application server for // a configuration template. It determines the set of configuration options @@ -4221,6 +5188,12 @@ func (s *CreateConfigurationTemplateInput) SetOptionSettings(v []*ConfigurationO return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *CreateConfigurationTemplateInput) SetPlatformArn(v string) *CreateConfigurationTemplateInput { + s.PlatformArn = &v + return s +} + // SetSolutionStackName sets the SolutionStackName field's value. func (s *CreateConfigurationTemplateInput) SetSolutionStackName(v string) *CreateConfigurationTemplateInput { s.SolutionStackName = &v @@ -4287,14 +5260,12 @@ type CreateEnvironmentInput struct { // set for this new environment. OptionsToRemove []*OptionSpecification `type:"list"` + // The ARN of the custom platform. + PlatformArn *string `type:"string"` + // This is an alternative to specifying a template name. If specified, AWS Elastic // Beanstalk sets the configuration values to the default values associated // with the specified solution stack. - // - // Condition: You must specify either this or a TemplateName, but not both. - // If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination - // error. If you do not specify either, AWS Elastic Beanstalk returns a MissingRequiredParameter - // error. SolutionStackName *string `type:"string"` // This specifies the tags applied to resources in the environment. @@ -4303,11 +5274,6 @@ type CreateEnvironmentInput struct { // The name of the configuration template to use in deployment. If no configuration // template is found with this name, AWS Elastic Beanstalk returns an InvalidParameterValue // error. - // - // Condition: You must specify either this parameter or a SolutionStackName, - // but not both. If you specify both, AWS Elastic Beanstalk returns an InvalidParameterCombination - // error. If you do not specify either, AWS Elastic Beanstalk returns a MissingRequiredParameter - // error. TemplateName *string `min:"1" type:"string"` // This specifies the tier to use for creating this environment. @@ -4436,6 +5402,12 @@ func (s *CreateEnvironmentInput) SetOptionsToRemove(v []*OptionSpecification) *C return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *CreateEnvironmentInput) SetPlatformArn(v string) *CreateEnvironmentInput { + s.PlatformArn = &v + return s +} + // SetSolutionStackName sets the SolutionStackName field's value. func (s *CreateEnvironmentInput) SetSolutionStackName(v string) *CreateEnvironmentInput { s.SolutionStackName = &v @@ -4466,6 +5438,138 @@ func (s *CreateEnvironmentInput) SetVersionLabel(v string) *CreateEnvironmentInp return s } +// Request to create a new platform version. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreatePlatformVersionRequest +type CreatePlatformVersionInput struct { + _ struct{} `type:"structure"` + + // The name of the builder environment. + EnvironmentName *string `min:"4" type:"string"` + + // The configuration option settings to apply to the builder environment. + OptionSettings []*ConfigurationOptionSetting `type:"list"` + + // The location of the platform definition archive in Amazon S3. + // + // PlatformDefinitionBundle is a required field + PlatformDefinitionBundle *S3Location `type:"structure" required:"true"` + + // The name of your custom platform. + // + // PlatformName is a required field + PlatformName *string `type:"string" required:"true"` + + // The number, such as 1.0.2, for the new platform version. + // + // PlatformVersion is a required field + PlatformVersion *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s CreatePlatformVersionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreatePlatformVersionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreatePlatformVersionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreatePlatformVersionInput"} + if s.EnvironmentName != nil && len(*s.EnvironmentName) < 4 { + invalidParams.Add(request.NewErrParamMinLen("EnvironmentName", 4)) + } + if s.PlatformDefinitionBundle == nil { + invalidParams.Add(request.NewErrParamRequired("PlatformDefinitionBundle")) + } + if s.PlatformName == nil { + invalidParams.Add(request.NewErrParamRequired("PlatformName")) + } + if s.PlatformVersion == nil { + invalidParams.Add(request.NewErrParamRequired("PlatformVersion")) + } + if s.OptionSettings != nil { + for i, v := range s.OptionSettings { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "OptionSettings", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEnvironmentName sets the EnvironmentName field's value. +func (s *CreatePlatformVersionInput) SetEnvironmentName(v string) *CreatePlatformVersionInput { + s.EnvironmentName = &v + return s +} + +// SetOptionSettings sets the OptionSettings field's value. +func (s *CreatePlatformVersionInput) SetOptionSettings(v []*ConfigurationOptionSetting) *CreatePlatformVersionInput { + s.OptionSettings = v + return s +} + +// SetPlatformDefinitionBundle sets the PlatformDefinitionBundle field's value. +func (s *CreatePlatformVersionInput) SetPlatformDefinitionBundle(v *S3Location) *CreatePlatformVersionInput { + s.PlatformDefinitionBundle = v + return s +} + +// SetPlatformName sets the PlatformName field's value. +func (s *CreatePlatformVersionInput) SetPlatformName(v string) *CreatePlatformVersionInput { + s.PlatformName = &v + return s +} + +// SetPlatformVersion sets the PlatformVersion field's value. +func (s *CreatePlatformVersionInput) SetPlatformVersion(v string) *CreatePlatformVersionInput { + s.PlatformVersion = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreatePlatformVersionResult +type CreatePlatformVersionOutput struct { + _ struct{} `type:"structure"` + + // The builder used to create the custom platform. + Builder *Builder `type:"structure"` + + // Detailed information about the new version of the custom platform. + PlatformSummary *PlatformSummary `type:"structure"` +} + +// String returns the string representation +func (s CreatePlatformVersionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreatePlatformVersionOutput) GoString() string { + return s.String() +} + +// SetBuilder sets the Builder field's value. +func (s *CreatePlatformVersionOutput) SetBuilder(v *Builder) *CreatePlatformVersionOutput { + s.Builder = v + return s +} + +// SetPlatformSummary sets the PlatformSummary field's value. +func (s *CreatePlatformVersionOutput) SetPlatformSummary(v *PlatformSummary) *CreatePlatformVersionOutput { + s.PlatformSummary = v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreateStorageLocationInput type CreateStorageLocationInput struct { _ struct{} `type:"structure"` @@ -4506,6 +5610,40 @@ func (s *CreateStorageLocationOutput) SetS3Bucket(v string) *CreateStorageLocati return s } +// A custom AMI available to platforms. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CustomAmi +type CustomAmi struct { + _ struct{} `type:"structure"` + + // THe ID of the image used to create the custom AMI. + ImageId *string `type:"string"` + + // The type of virtualization used to create the custom AMI. + VirtualizationType *string `type:"string"` +} + +// String returns the string representation +func (s CustomAmi) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CustomAmi) GoString() string { + return s.String() +} + +// SetImageId sets the ImageId field's value. +func (s *CustomAmi) SetImageId(v string) *CustomAmi { + s.ImageId = &v + return s +} + +// SetVirtualizationType sets the VirtualizationType field's value. +func (s *CustomAmi) SetVirtualizationType(v string) *CustomAmi { + s.VirtualizationType = &v + return s +} + // Request to delete an application. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeleteApplicationMessage type DeleteApplicationInput struct { @@ -4810,6 +5948,54 @@ func (s DeleteEnvironmentConfigurationOutput) GoString() string { return s.String() } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeletePlatformVersionRequest +type DeletePlatformVersionInput struct { + _ struct{} `type:"structure"` + + // The ARN of the version of the custom platform. + PlatformArn *string `type:"string"` +} + +// String returns the string representation +func (s DeletePlatformVersionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeletePlatformVersionInput) GoString() string { + return s.String() +} + +// SetPlatformArn sets the PlatformArn field's value. +func (s *DeletePlatformVersionInput) SetPlatformArn(v string) *DeletePlatformVersionInput { + s.PlatformArn = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DeletePlatformVersionResult +type DeletePlatformVersionOutput struct { + _ struct{} `type:"structure"` + + // Detailed information about the version of the custom platform. + PlatformSummary *PlatformSummary `type:"structure"` +} + +// String returns the string representation +func (s DeletePlatformVersionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeletePlatformVersionOutput) GoString() string { + return s.String() +} + +// SetPlatformSummary sets the PlatformSummary field's value. +func (s *DeletePlatformVersionOutput) SetPlatformSummary(v *PlatformSummary) *DeletePlatformVersionOutput { + s.PlatformSummary = v + return s +} + // Information about an application version deployment. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/Deployment type Deployment struct { @@ -5025,7 +6211,7 @@ func (s *DescribeApplicationsOutput) SetApplications(v []*ApplicationDescription return s } -// Result message containig a list of application version descriptions. +// Result message containing a list of application version descriptions. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribeConfigurationOptionsMessage type DescribeConfigurationOptionsInput struct { _ struct{} `type:"structure"` @@ -5041,6 +6227,9 @@ type DescribeConfigurationOptionsInput struct { // If specified, restricts the descriptions to only the specified options. Options []*OptionSpecification `type:"list"` + // The ARN of the custom platform. + PlatformArn *string `type:"string"` + // The name of the solution stack whose configuration options you want to describe. SolutionStackName *string `type:"string"` @@ -5106,6 +6295,12 @@ func (s *DescribeConfigurationOptionsInput) SetOptions(v []*OptionSpecification) return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *DescribeConfigurationOptionsInput) SetPlatformArn(v string) *DescribeConfigurationOptionsInput { + s.PlatformArn = &v + return s +} + // SetSolutionStackName sets the SolutionStackName field's value. func (s *DescribeConfigurationOptionsInput) SetSolutionStackName(v string) *DescribeConfigurationOptionsInput { s.SolutionStackName = &v @@ -5126,6 +6321,9 @@ type DescribeConfigurationOptionsOutput struct { // A list of ConfigurationOptionDescription. Options []*ConfigurationOptionDescription `type:"list"` + // The ARN of the custom platform. + PlatformArn *string `type:"string"` + // The name of the solution stack these configuration options belong to. SolutionStackName *string `type:"string"` } @@ -5146,6 +6344,12 @@ func (s *DescribeConfigurationOptionsOutput) SetOptions(v []*ConfigurationOption return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *DescribeConfigurationOptionsOutput) SetPlatformArn(v string) *DescribeConfigurationOptionsOutput { + s.PlatformArn = &v + return s +} + // SetSolutionStackName sets the SolutionStackName field's value. func (s *DescribeConfigurationOptionsOutput) SetSolutionStackName(v string) *DescribeConfigurationOptionsOutput { s.SolutionStackName = &v @@ -5780,6 +6984,9 @@ type DescribeEventsInput struct { // Pagination token. If specified, the events return the next batch of results. NextToken *string `type:"string"` + // The ARN of the version of the custom platform. + PlatformArn *string `type:"string"` + // If specified, AWS Elastic Beanstalk restricts the described events to include // only those associated with this request ID. RequestId *string `type:"string"` @@ -5872,6 +7079,12 @@ func (s *DescribeEventsInput) SetNextToken(v string) *DescribeEventsInput { return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *DescribeEventsInput) SetPlatformArn(v string) *DescribeEventsInput { + s.PlatformArn = &v + return s +} + // SetRequestId sets the RequestId field's value. func (s *DescribeEventsInput) SetRequestId(v string) *DescribeEventsInput { s.RequestId = &v @@ -6050,6 +7263,54 @@ func (s *DescribeInstancesHealthOutput) SetRefreshedAt(v time.Time) *DescribeIns return s } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribePlatformVersionRequest +type DescribePlatformVersionInput struct { + _ struct{} `type:"structure"` + + // The ARN of the version of the platform. + PlatformArn *string `type:"string"` +} + +// String returns the string representation +func (s DescribePlatformVersionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribePlatformVersionInput) GoString() string { + return s.String() +} + +// SetPlatformArn sets the PlatformArn field's value. +func (s *DescribePlatformVersionInput) SetPlatformArn(v string) *DescribePlatformVersionInput { + s.PlatformArn = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/DescribePlatformVersionResult +type DescribePlatformVersionOutput struct { + _ struct{} `type:"structure"` + + // Detailed information about the version of the platform. + PlatformDescription *PlatformDescription `type:"structure"` +} + +// String returns the string representation +func (s DescribePlatformVersionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribePlatformVersionOutput) GoString() string { + return s.String() +} + +// SetPlatformDescription sets the PlatformDescription field's value. +func (s *DescribePlatformVersionOutput) SetPlatformDescription(v *PlatformDescription) *DescribePlatformVersionOutput { + s.PlatformDescription = v + return s +} + // Describes the properties of an environment. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/EnvironmentDescription type EnvironmentDescription struct { @@ -6113,6 +7374,9 @@ type EnvironmentDescription struct { // For more information, see Health Colors and Statuses (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced-status.html). HealthStatus *string `type:"string" enum:"EnvironmentHealthStatus"` + // The ARN of the custom platform. + PlatformArn *string `type:"string"` + // The description of the AWS resources used by this environment. Resources *EnvironmentResourcesDescription `type:"structure"` @@ -6226,6 +7490,12 @@ func (s *EnvironmentDescription) SetHealthStatus(v string) *EnvironmentDescripti return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *EnvironmentDescription) SetPlatformArn(v string) *EnvironmentDescription { + s.PlatformArn = &v + return s +} + // SetResources sets the Resources field's value. func (s *EnvironmentDescription) SetResources(v *EnvironmentResourcesDescription) *EnvironmentDescription { s.Resources = v @@ -6542,6 +7812,9 @@ type EventDescription struct { // The event message. Message *string `type:"string"` + // The ARN of the custom platform. + PlatformArn *string `type:"string"` + // The web service request ID for the activity of this event. RequestId *string `type:"string"` @@ -6589,6 +7862,12 @@ func (s *EventDescription) SetMessage(v string) *EventDescription { return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *EventDescription) SetPlatformArn(v string) *EventDescription { + s.PlatformArn = &v + return s +} + // SetRequestId sets the RequestId field's value. func (s *EventDescription) SetRequestId(v string) *EventDescription { s.RequestId = &v @@ -6865,42 +8144,133 @@ func (s ListAvailableSolutionStacksInput) String() string { return awsutil.Prettify(s) } -// GoString returns the string representation -func (s ListAvailableSolutionStacksInput) GoString() string { - return s.String() +// GoString returns the string representation +func (s ListAvailableSolutionStacksInput) GoString() string { + return s.String() +} + +// A list of available AWS Elastic Beanstalk solution stacks. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ListAvailableSolutionStacksResultMessage +type ListAvailableSolutionStacksOutput struct { + _ struct{} `type:"structure"` + + // A list of available solution stacks and their SolutionStackDescription. + SolutionStackDetails []*SolutionStackDescription `type:"list"` + + // A list of available solution stacks. + SolutionStacks []*string `type:"list"` +} + +// String returns the string representation +func (s ListAvailableSolutionStacksOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListAvailableSolutionStacksOutput) GoString() string { + return s.String() +} + +// SetSolutionStackDetails sets the SolutionStackDetails field's value. +func (s *ListAvailableSolutionStacksOutput) SetSolutionStackDetails(v []*SolutionStackDescription) *ListAvailableSolutionStacksOutput { + s.SolutionStackDetails = v + return s +} + +// SetSolutionStacks sets the SolutionStacks field's value. +func (s *ListAvailableSolutionStacksOutput) SetSolutionStacks(v []*string) *ListAvailableSolutionStacksOutput { + s.SolutionStacks = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ListPlatformVersionsRequest +type ListPlatformVersionsInput struct { + _ struct{} `type:"structure"` + + // List only the platforms where the platform member value relates to one of + // the supplied values. + Filters []*PlatformFilter `type:"list"` + + // The maximum number of platform values returned in one call. + MaxRecords *int64 `min:"1" type:"integer"` + + // The starting index into the remaining list of platforms. Use the NextToken + // value from a previous ListPlatformVersion call. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListPlatformVersionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListPlatformVersionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListPlatformVersionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListPlatformVersionsInput"} + if s.MaxRecords != nil && *s.MaxRecords < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxRecords", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilters sets the Filters field's value. +func (s *ListPlatformVersionsInput) SetFilters(v []*PlatformFilter) *ListPlatformVersionsInput { + s.Filters = v + return s +} + +// SetMaxRecords sets the MaxRecords field's value. +func (s *ListPlatformVersionsInput) SetMaxRecords(v int64) *ListPlatformVersionsInput { + s.MaxRecords = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListPlatformVersionsInput) SetNextToken(v string) *ListPlatformVersionsInput { + s.NextToken = &v + return s } -// A list of available AWS Elastic Beanstalk solution stacks. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ListAvailableSolutionStacksResultMessage -type ListAvailableSolutionStacksOutput struct { +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/ListPlatformVersionsResult +type ListPlatformVersionsOutput struct { _ struct{} `type:"structure"` - // A list of available solution stacks and their SolutionStackDescription. - SolutionStackDetails []*SolutionStackDescription `type:"list"` + // The starting index into the remaining list of platforms. if this value is + // not null, you can use it in a subsequent ListPlatformVersion call. + NextToken *string `type:"string"` - // A list of available solution stacks. - SolutionStacks []*string `type:"list"` + // Detailed information about the platforms. + PlatformSummaryList []*PlatformSummary `type:"list"` } // String returns the string representation -func (s ListAvailableSolutionStacksOutput) String() string { +func (s ListPlatformVersionsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s ListAvailableSolutionStacksOutput) GoString() string { +func (s ListPlatformVersionsOutput) GoString() string { return s.String() } -// SetSolutionStackDetails sets the SolutionStackDetails field's value. -func (s *ListAvailableSolutionStacksOutput) SetSolutionStackDetails(v []*SolutionStackDescription) *ListAvailableSolutionStacksOutput { - s.SolutionStackDetails = v +// SetNextToken sets the NextToken field's value. +func (s *ListPlatformVersionsOutput) SetNextToken(v string) *ListPlatformVersionsOutput { + s.NextToken = &v return s } -// SetSolutionStacks sets the SolutionStacks field's value. -func (s *ListAvailableSolutionStacksOutput) SetSolutionStacks(v []*string) *ListAvailableSolutionStacksOutput { - s.SolutionStacks = v +// SetPlatformSummaryList sets the PlatformSummaryList field's value. +func (s *ListPlatformVersionsOutput) SetPlatformSummaryList(v []*PlatformSummary) *ListPlatformVersionsOutput { + s.PlatformSummaryList = v return s } @@ -7369,6 +8739,394 @@ func (s *OptionSpecification) SetResourceName(v string) *OptionSpecification { return s } +// Detailed information about a platform. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/PlatformDescription +type PlatformDescription struct { + _ struct{} `type:"structure"` + + // The custom AMIs supported by the platform. + CustomAmiList []*CustomAmi `type:"list"` + + // The date when the platform was created. + DateCreated *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The date when the platform was last updated. + DateUpdated *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The description of the platform. + Description *string `type:"string"` + + // The frameworks supported by the platform. + Frameworks []*PlatformFramework `type:"list"` + + // Information about the maintainer of the platform. + Maintainer *string `type:"string"` + + // The operating system used by the platform. + OperatingSystemName *string `type:"string"` + + // The version of the operating system used by the platform. + OperatingSystemVersion *string `type:"string"` + + // The ARN of the platform. + PlatformArn *string `type:"string"` + + // The category of the platform. + PlatformCategory *string `type:"string"` + + // The name of the platform. + PlatformName *string `type:"string"` + + // The AWS account ID of the person who created the platform. + PlatformOwner *string `type:"string"` + + // The status of the platform. + PlatformStatus *string `type:"string" enum:"PlatformStatus"` + + // The version of the platform. + PlatformVersion *string `type:"string"` + + // The programming languages supported by the platform. + ProgrammingLanguages []*PlatformProgrammingLanguage `type:"list"` + + // The name of the solution stack used by the platform. + SolutionStackName *string `type:"string"` + + // The additions supported by the platform. + SupportedAddonList []*string `type:"list"` + + // The tiers supported by the platform. + SupportedTierList []*string `type:"list"` +} + +// String returns the string representation +func (s PlatformDescription) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PlatformDescription) GoString() string { + return s.String() +} + +// SetCustomAmiList sets the CustomAmiList field's value. +func (s *PlatformDescription) SetCustomAmiList(v []*CustomAmi) *PlatformDescription { + s.CustomAmiList = v + return s +} + +// SetDateCreated sets the DateCreated field's value. +func (s *PlatformDescription) SetDateCreated(v time.Time) *PlatformDescription { + s.DateCreated = &v + return s +} + +// SetDateUpdated sets the DateUpdated field's value. +func (s *PlatformDescription) SetDateUpdated(v time.Time) *PlatformDescription { + s.DateUpdated = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *PlatformDescription) SetDescription(v string) *PlatformDescription { + s.Description = &v + return s +} + +// SetFrameworks sets the Frameworks field's value. +func (s *PlatformDescription) SetFrameworks(v []*PlatformFramework) *PlatformDescription { + s.Frameworks = v + return s +} + +// SetMaintainer sets the Maintainer field's value. +func (s *PlatformDescription) SetMaintainer(v string) *PlatformDescription { + s.Maintainer = &v + return s +} + +// SetOperatingSystemName sets the OperatingSystemName field's value. +func (s *PlatformDescription) SetOperatingSystemName(v string) *PlatformDescription { + s.OperatingSystemName = &v + return s +} + +// SetOperatingSystemVersion sets the OperatingSystemVersion field's value. +func (s *PlatformDescription) SetOperatingSystemVersion(v string) *PlatformDescription { + s.OperatingSystemVersion = &v + return s +} + +// SetPlatformArn sets the PlatformArn field's value. +func (s *PlatformDescription) SetPlatformArn(v string) *PlatformDescription { + s.PlatformArn = &v + return s +} + +// SetPlatformCategory sets the PlatformCategory field's value. +func (s *PlatformDescription) SetPlatformCategory(v string) *PlatformDescription { + s.PlatformCategory = &v + return s +} + +// SetPlatformName sets the PlatformName field's value. +func (s *PlatformDescription) SetPlatformName(v string) *PlatformDescription { + s.PlatformName = &v + return s +} + +// SetPlatformOwner sets the PlatformOwner field's value. +func (s *PlatformDescription) SetPlatformOwner(v string) *PlatformDescription { + s.PlatformOwner = &v + return s +} + +// SetPlatformStatus sets the PlatformStatus field's value. +func (s *PlatformDescription) SetPlatformStatus(v string) *PlatformDescription { + s.PlatformStatus = &v + return s +} + +// SetPlatformVersion sets the PlatformVersion field's value. +func (s *PlatformDescription) SetPlatformVersion(v string) *PlatformDescription { + s.PlatformVersion = &v + return s +} + +// SetProgrammingLanguages sets the ProgrammingLanguages field's value. +func (s *PlatformDescription) SetProgrammingLanguages(v []*PlatformProgrammingLanguage) *PlatformDescription { + s.ProgrammingLanguages = v + return s +} + +// SetSolutionStackName sets the SolutionStackName field's value. +func (s *PlatformDescription) SetSolutionStackName(v string) *PlatformDescription { + s.SolutionStackName = &v + return s +} + +// SetSupportedAddonList sets the SupportedAddonList field's value. +func (s *PlatformDescription) SetSupportedAddonList(v []*string) *PlatformDescription { + s.SupportedAddonList = v + return s +} + +// SetSupportedTierList sets the SupportedTierList field's value. +func (s *PlatformDescription) SetSupportedTierList(v []*string) *PlatformDescription { + s.SupportedTierList = v + return s +} + +// Specify criteria to restrict the results when listing custom platforms. +// +// The filter is evaluated as the expression: +// +// TypeOperatorValues[i] +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/PlatformFilter +type PlatformFilter struct { + _ struct{} `type:"structure"` + + // The operator to apply to the Type with each of the Values. + // + // Valid Values: = (equal to) | != (not equal to) | < (less than) | <= (less + // than or equal to) | > (greater than) | >= (greater than or equal to) | contains + // | begins_with | ends_with + Operator *string `type:"string"` + + // The custom platform attribute to which the filter values are applied. + // + // Valid Values: PlatformName | PlatformVersion | PlatformStatus | PlatformOwner + Type *string `type:"string"` + + // The list of values applied to the custom platform attribute. + Values []*string `type:"list"` +} + +// String returns the string representation +func (s PlatformFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PlatformFilter) GoString() string { + return s.String() +} + +// SetOperator sets the Operator field's value. +func (s *PlatformFilter) SetOperator(v string) *PlatformFilter { + s.Operator = &v + return s +} + +// SetType sets the Type field's value. +func (s *PlatformFilter) SetType(v string) *PlatformFilter { + s.Type = &v + return s +} + +// SetValues sets the Values field's value. +func (s *PlatformFilter) SetValues(v []*string) *PlatformFilter { + s.Values = v + return s +} + +// A framework supported by the custom platform. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/PlatformFramework +type PlatformFramework struct { + _ struct{} `type:"structure"` + + // The name of the framework. + Name *string `type:"string"` + + // The version of the framework. + Version *string `type:"string"` +} + +// String returns the string representation +func (s PlatformFramework) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PlatformFramework) GoString() string { + return s.String() +} + +// SetName sets the Name field's value. +func (s *PlatformFramework) SetName(v string) *PlatformFramework { + s.Name = &v + return s +} + +// SetVersion sets the Version field's value. +func (s *PlatformFramework) SetVersion(v string) *PlatformFramework { + s.Version = &v + return s +} + +// A programming language supported by the platform. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/PlatformProgrammingLanguage +type PlatformProgrammingLanguage struct { + _ struct{} `type:"structure"` + + // The name of the programming language. + Name *string `type:"string"` + + // The version of the programming language. + Version *string `type:"string"` +} + +// String returns the string representation +func (s PlatformProgrammingLanguage) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PlatformProgrammingLanguage) GoString() string { + return s.String() +} + +// SetName sets the Name field's value. +func (s *PlatformProgrammingLanguage) SetName(v string) *PlatformProgrammingLanguage { + s.Name = &v + return s +} + +// SetVersion sets the Version field's value. +func (s *PlatformProgrammingLanguage) SetVersion(v string) *PlatformProgrammingLanguage { + s.Version = &v + return s +} + +// Detailed information about a platform. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/PlatformSummary +type PlatformSummary struct { + _ struct{} `type:"structure"` + + // The operating system used by the platform. + OperatingSystemName *string `type:"string"` + + // The version of the operating system used by the platform. + OperatingSystemVersion *string `type:"string"` + + // The ARN of the platform. + PlatformArn *string `type:"string"` + + // The category of platform. + PlatformCategory *string `type:"string"` + + // The AWS account ID of the person who created the platform. + PlatformOwner *string `type:"string"` + + // The status of the platform. You can create an environment from the platform + // once it is ready. + PlatformStatus *string `type:"string" enum:"PlatformStatus"` + + // The additions associated with the platform. + SupportedAddonList []*string `type:"list"` + + // The tiers in which the platform runs. + SupportedTierList []*string `type:"list"` +} + +// String returns the string representation +func (s PlatformSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PlatformSummary) GoString() string { + return s.String() +} + +// SetOperatingSystemName sets the OperatingSystemName field's value. +func (s *PlatformSummary) SetOperatingSystemName(v string) *PlatformSummary { + s.OperatingSystemName = &v + return s +} + +// SetOperatingSystemVersion sets the OperatingSystemVersion field's value. +func (s *PlatformSummary) SetOperatingSystemVersion(v string) *PlatformSummary { + s.OperatingSystemVersion = &v + return s +} + +// SetPlatformArn sets the PlatformArn field's value. +func (s *PlatformSummary) SetPlatformArn(v string) *PlatformSummary { + s.PlatformArn = &v + return s +} + +// SetPlatformCategory sets the PlatformCategory field's value. +func (s *PlatformSummary) SetPlatformCategory(v string) *PlatformSummary { + s.PlatformCategory = &v + return s +} + +// SetPlatformOwner sets the PlatformOwner field's value. +func (s *PlatformSummary) SetPlatformOwner(v string) *PlatformSummary { + s.PlatformOwner = &v + return s +} + +// SetPlatformStatus sets the PlatformStatus field's value. +func (s *PlatformSummary) SetPlatformStatus(v string) *PlatformSummary { + s.PlatformStatus = &v + return s +} + +// SetSupportedAddonList sets the SupportedAddonList field's value. +func (s *PlatformSummary) SetSupportedAddonList(v []*string) *PlatformSummary { + s.SupportedAddonList = v + return s +} + +// SetSupportedTierList sets the SupportedTierList field's value. +func (s *PlatformSummary) SetSupportedTierList(v []*string) *PlatformSummary { + s.SupportedTierList = v + return s +} + // Describes a queue. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/Queue type Queue struct { @@ -8210,8 +9968,8 @@ type SystemStatus struct { // CPU utilization metrics for the instance. CPUUtilization *CPUUtilization `type:"structure"` - // Load average in the last 1-minute and 5-minute periods. For more information, - // see Operating System Metrics (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced-metrics.html#health-enhanced-metrics-os). + // Load average in the last 1-minute, 5-minute, and 15-minute periods. For more + // information, see Operating System Metrics (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced-metrics.html#health-enhanced-metrics-os). LoadAverage []*float64 `type:"list"` } @@ -8785,6 +10543,9 @@ type UpdateEnvironmentInput struct { // set for this environment. OptionsToRemove []*OptionSpecification `type:"list"` + // The ARN of the platform, if used. + PlatformArn *string `type:"string"` + // This specifies the platform version that the environment will run after the // environment is updated. SolutionStackName *string `type:"string"` @@ -8903,6 +10664,12 @@ func (s *UpdateEnvironmentInput) SetOptionsToRemove(v []*OptionSpecification) *U return s } +// SetPlatformArn sets the PlatformArn field's value. +func (s *UpdateEnvironmentInput) SetPlatformArn(v string) *UpdateEnvironmentInput { + s.PlatformArn = &v + return s +} + // SetSolutionStackName sets the SolutionStackName field's value. func (s *UpdateEnvironmentInput) SetSolutionStackName(v string) *UpdateEnvironmentInput { s.SolutionStackName = &v @@ -9358,6 +11125,23 @@ const ( InstancesHealthAttributeAll = "All" ) +const ( + // PlatformStatusCreating is a PlatformStatus enum value + PlatformStatusCreating = "Creating" + + // PlatformStatusFailed is a PlatformStatus enum value + PlatformStatusFailed = "Failed" + + // PlatformStatusReady is a PlatformStatus enum value + PlatformStatusReady = "Ready" + + // PlatformStatusDeleting is a PlatformStatus enum value + PlatformStatusDeleting = "Deleting" + + // PlatformStatusDeleted is a PlatformStatus enum value + PlatformStatusDeleted = "Deleted" +) + const ( // SourceRepositoryCodeCommit is a SourceRepository enum value SourceRepositoryCodeCommit = "CodeCommit" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/errors.go index a8b13bc812..0ed1bd6335 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elasticbeanstalk @@ -37,6 +37,13 @@ const ( // effects an element in this activity is already in progress. ErrCodeOperationInProgressException = "OperationInProgressFailure" + // ErrCodePlatformVersionStillReferencedException for service response error code + // "PlatformVersionStillReferencedException". + // + // You cannot delete the platform version because there are still environments + // running on it. + ErrCodePlatformVersionStillReferencedException = "PlatformVersionStillReferencedException" + // ErrCodeS3LocationNotInServiceRegionException for service response error code // "S3LocationNotInServiceRegionException". // @@ -98,4 +105,11 @@ const ( // // The specified account has reached its limit of environments. ErrCodeTooManyEnvironmentsException = "TooManyEnvironmentsException" + + // ErrCodeTooManyPlatformsException for service response error code + // "TooManyPlatformsException". + // + // You have exceeded the maximum number of allowed platforms associated with + // the account. + ErrCodeTooManyPlatformsException = "TooManyPlatformsException" ) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/service.go index 2134341fbd..91c3b4df8b 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticbeanstalk/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elasticbeanstalk diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go index 06d58a51a2..b7d3ca20bb 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package elasticsearchservice provides a client for Amazon Elasticsearch Service. package elasticsearchservice @@ -7,6 +7,7 @@ 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" @@ -91,8 +92,23 @@ func (c *ElasticsearchService) AddTagsRequest(input *AddTagsInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/AddTags func (c *ElasticsearchService) AddTags(input *AddTagsInput) (*AddTagsOutput, error) { req, out := c.AddTagsRequest(input) - err := req.Send() - return out, err + 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 *ElasticsearchService) 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 opCreateElasticsearchDomain = "CreateElasticsearchDomain" @@ -183,8 +199,23 @@ func (c *ElasticsearchService) CreateElasticsearchDomainRequest(input *CreateEla // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/CreateElasticsearchDomain func (c *ElasticsearchService) CreateElasticsearchDomain(input *CreateElasticsearchDomainInput) (*CreateElasticsearchDomainOutput, error) { req, out := c.CreateElasticsearchDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateElasticsearchDomainWithContext is the same as CreateElasticsearchDomain with the addition of +// the ability to pass a context and additional request options. +// +// See CreateElasticsearchDomain 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 *ElasticsearchService) CreateElasticsearchDomainWithContext(ctx aws.Context, input *CreateElasticsearchDomainInput, opts ...request.Option) (*CreateElasticsearchDomainOutput, error) { + req, out := c.CreateElasticsearchDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteElasticsearchDomain = "DeleteElasticsearchDomain" @@ -262,8 +293,23 @@ func (c *ElasticsearchService) DeleteElasticsearchDomainRequest(input *DeleteEla // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DeleteElasticsearchDomain func (c *ElasticsearchService) DeleteElasticsearchDomain(input *DeleteElasticsearchDomainInput) (*DeleteElasticsearchDomainOutput, error) { req, out := c.DeleteElasticsearchDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteElasticsearchDomainWithContext is the same as DeleteElasticsearchDomain with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteElasticsearchDomain 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 *ElasticsearchService) DeleteElasticsearchDomainWithContext(ctx aws.Context, input *DeleteElasticsearchDomainInput, opts ...request.Option) (*DeleteElasticsearchDomainOutput, error) { + req, out := c.DeleteElasticsearchDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeElasticsearchDomain = "DescribeElasticsearchDomain" @@ -341,8 +387,23 @@ func (c *ElasticsearchService) DescribeElasticsearchDomainRequest(input *Describ // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchDomain func (c *ElasticsearchService) DescribeElasticsearchDomain(input *DescribeElasticsearchDomainInput) (*DescribeElasticsearchDomainOutput, error) { req, out := c.DescribeElasticsearchDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeElasticsearchDomainWithContext is the same as DescribeElasticsearchDomain with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeElasticsearchDomain 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 *ElasticsearchService) DescribeElasticsearchDomainWithContext(ctx aws.Context, input *DescribeElasticsearchDomainInput, opts ...request.Option) (*DescribeElasticsearchDomainOutput, error) { + req, out := c.DescribeElasticsearchDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeElasticsearchDomainConfig = "DescribeElasticsearchDomainConfig" @@ -421,8 +482,23 @@ func (c *ElasticsearchService) DescribeElasticsearchDomainConfigRequest(input *D // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchDomainConfig func (c *ElasticsearchService) DescribeElasticsearchDomainConfig(input *DescribeElasticsearchDomainConfigInput) (*DescribeElasticsearchDomainConfigOutput, error) { req, out := c.DescribeElasticsearchDomainConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeElasticsearchDomainConfigWithContext is the same as DescribeElasticsearchDomainConfig with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeElasticsearchDomainConfig 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 *ElasticsearchService) DescribeElasticsearchDomainConfigWithContext(ctx aws.Context, input *DescribeElasticsearchDomainConfigInput, opts ...request.Option) (*DescribeElasticsearchDomainConfigOutput, error) { + req, out := c.DescribeElasticsearchDomainConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeElasticsearchDomains = "DescribeElasticsearchDomains" @@ -496,8 +572,126 @@ func (c *ElasticsearchService) DescribeElasticsearchDomainsRequest(input *Descri // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchDomains func (c *ElasticsearchService) DescribeElasticsearchDomains(input *DescribeElasticsearchDomainsInput) (*DescribeElasticsearchDomainsOutput, error) { req, out := c.DescribeElasticsearchDomainsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeElasticsearchDomainsWithContext is the same as DescribeElasticsearchDomains with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeElasticsearchDomains 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 *ElasticsearchService) DescribeElasticsearchDomainsWithContext(ctx aws.Context, input *DescribeElasticsearchDomainsInput, opts ...request.Option) (*DescribeElasticsearchDomainsOutput, error) { + req, out := c.DescribeElasticsearchDomainsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeElasticsearchInstanceTypeLimits = "DescribeElasticsearchInstanceTypeLimits" + +// DescribeElasticsearchInstanceTypeLimitsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeElasticsearchInstanceTypeLimits operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DescribeElasticsearchInstanceTypeLimits for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DescribeElasticsearchInstanceTypeLimits method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DescribeElasticsearchInstanceTypeLimitsRequest method. +// req, resp := client.DescribeElasticsearchInstanceTypeLimitsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchInstanceTypeLimits +func (c *ElasticsearchService) DescribeElasticsearchInstanceTypeLimitsRequest(input *DescribeElasticsearchInstanceTypeLimitsInput) (req *request.Request, output *DescribeElasticsearchInstanceTypeLimitsOutput) { + op := &request.Operation{ + Name: opDescribeElasticsearchInstanceTypeLimits, + HTTPMethod: "GET", + HTTPPath: "/2015-01-01/es/instanceTypeLimits/{ElasticsearchVersion}/{InstanceType}", + } + + if input == nil { + input = &DescribeElasticsearchInstanceTypeLimitsInput{} + } + + output = &DescribeElasticsearchInstanceTypeLimitsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeElasticsearchInstanceTypeLimits API operation for Amazon Elasticsearch Service. +// +// Describe Elasticsearch Limits for a given InstanceType and ElasticsearchVersion. +// When modifying existing Domain, specify the DomainName to know what Limits +// are supported for modifying. +// +// 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 Amazon Elasticsearch Service's +// API operation DescribeElasticsearchInstanceTypeLimits for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBaseException "BaseException" +// An error occurred while processing the request. +// +// * ErrCodeInternalException "InternalException" +// The request processing has failed because of an unknown error, exception +// or failure (the failure is internal to the service) . Gives http status code +// of 500. +// +// * ErrCodeInvalidTypeException "InvalidTypeException" +// An exception for trying to create or access sub-resource that is either invalid +// or not supported. Gives http status code of 409. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// An exception for trying to create more than allowed resources or sub-resources. +// Gives http status code of 409. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An exception for accessing or deleting a resource that does not exist. Gives +// http status code of 400. +// +// * ErrCodeValidationException "ValidationException" +// An exception for missing / invalid input fields. Gives http status code of +// 400. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchInstanceTypeLimits +func (c *ElasticsearchService) DescribeElasticsearchInstanceTypeLimits(input *DescribeElasticsearchInstanceTypeLimitsInput) (*DescribeElasticsearchInstanceTypeLimitsOutput, error) { + req, out := c.DescribeElasticsearchInstanceTypeLimitsRequest(input) + return out, req.Send() +} + +// DescribeElasticsearchInstanceTypeLimitsWithContext is the same as DescribeElasticsearchInstanceTypeLimits with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeElasticsearchInstanceTypeLimits 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 *ElasticsearchService) DescribeElasticsearchInstanceTypeLimitsWithContext(ctx aws.Context, input *DescribeElasticsearchInstanceTypeLimitsInput, opts ...request.Option) (*DescribeElasticsearchInstanceTypeLimitsOutput, error) { + req, out := c.DescribeElasticsearchInstanceTypeLimitsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListDomainNames = "ListDomainNames" @@ -566,8 +760,321 @@ func (c *ElasticsearchService) ListDomainNamesRequest(input *ListDomainNamesInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListDomainNames func (c *ElasticsearchService) ListDomainNames(input *ListDomainNamesInput) (*ListDomainNamesOutput, error) { req, out := c.ListDomainNamesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDomainNamesWithContext is the same as ListDomainNames with the addition of +// the ability to pass a context and additional request options. +// +// See ListDomainNames 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 *ElasticsearchService) ListDomainNamesWithContext(ctx aws.Context, input *ListDomainNamesInput, opts ...request.Option) (*ListDomainNamesOutput, error) { + req, out := c.ListDomainNamesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListElasticsearchInstanceTypes = "ListElasticsearchInstanceTypes" + +// ListElasticsearchInstanceTypesRequest generates a "aws/request.Request" representing the +// client's request for the ListElasticsearchInstanceTypes operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListElasticsearchInstanceTypes for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListElasticsearchInstanceTypes method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListElasticsearchInstanceTypesRequest method. +// req, resp := client.ListElasticsearchInstanceTypesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchInstanceTypes +func (c *ElasticsearchService) ListElasticsearchInstanceTypesRequest(input *ListElasticsearchInstanceTypesInput) (req *request.Request, output *ListElasticsearchInstanceTypesOutput) { + op := &request.Operation{ + Name: opListElasticsearchInstanceTypes, + HTTPMethod: "GET", + HTTPPath: "/2015-01-01/es/instanceTypes/{ElasticsearchVersion}", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListElasticsearchInstanceTypesInput{} + } + + output = &ListElasticsearchInstanceTypesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListElasticsearchInstanceTypes API operation for Amazon Elasticsearch Service. +// +// List all Elasticsearch instance types that are supported for given ElasticsearchVersion +// +// 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 Amazon Elasticsearch Service's +// API operation ListElasticsearchInstanceTypes for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBaseException "BaseException" +// An error occurred while processing the request. +// +// * ErrCodeInternalException "InternalException" +// The request processing has failed because of an unknown error, exception +// or failure (the failure is internal to the service) . Gives http status code +// of 500. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An exception for accessing or deleting a resource that does not exist. Gives +// http status code of 400. +// +// * ErrCodeValidationException "ValidationException" +// An exception for missing / invalid input fields. Gives http status code of +// 400. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchInstanceTypes +func (c *ElasticsearchService) ListElasticsearchInstanceTypes(input *ListElasticsearchInstanceTypesInput) (*ListElasticsearchInstanceTypesOutput, error) { + req, out := c.ListElasticsearchInstanceTypesRequest(input) + return out, req.Send() +} + +// ListElasticsearchInstanceTypesWithContext is the same as ListElasticsearchInstanceTypes with the addition of +// the ability to pass a context and additional request options. +// +// See ListElasticsearchInstanceTypes 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 *ElasticsearchService) ListElasticsearchInstanceTypesWithContext(ctx aws.Context, input *ListElasticsearchInstanceTypesInput, opts ...request.Option) (*ListElasticsearchInstanceTypesOutput, error) { + req, out := c.ListElasticsearchInstanceTypesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListElasticsearchInstanceTypesPages iterates over the pages of a ListElasticsearchInstanceTypes operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListElasticsearchInstanceTypes 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 ListElasticsearchInstanceTypes operation. +// pageNum := 0 +// err := client.ListElasticsearchInstanceTypesPages(params, +// func(page *ListElasticsearchInstanceTypesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *ElasticsearchService) ListElasticsearchInstanceTypesPages(input *ListElasticsearchInstanceTypesInput, fn func(*ListElasticsearchInstanceTypesOutput, bool) bool) error { + return c.ListElasticsearchInstanceTypesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListElasticsearchInstanceTypesPagesWithContext same as ListElasticsearchInstanceTypesPages 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 *ElasticsearchService) ListElasticsearchInstanceTypesPagesWithContext(ctx aws.Context, input *ListElasticsearchInstanceTypesInput, fn func(*ListElasticsearchInstanceTypesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListElasticsearchInstanceTypesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListElasticsearchInstanceTypesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListElasticsearchInstanceTypesOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListElasticsearchVersions = "ListElasticsearchVersions" + +// ListElasticsearchVersionsRequest generates a "aws/request.Request" representing the +// client's request for the ListElasticsearchVersions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListElasticsearchVersions for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListElasticsearchVersions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListElasticsearchVersionsRequest method. +// req, resp := client.ListElasticsearchVersionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchVersions +func (c *ElasticsearchService) ListElasticsearchVersionsRequest(input *ListElasticsearchVersionsInput) (req *request.Request, output *ListElasticsearchVersionsOutput) { + op := &request.Operation{ + Name: opListElasticsearchVersions, + HTTPMethod: "GET", + HTTPPath: "/2015-01-01/es/versions", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListElasticsearchVersionsInput{} + } + + output = &ListElasticsearchVersionsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListElasticsearchVersions API operation for Amazon Elasticsearch Service. +// +// List all supported Elasticsearch versions +// +// 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 Amazon Elasticsearch Service's +// API operation ListElasticsearchVersions for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBaseException "BaseException" +// An error occurred while processing the request. +// +// * ErrCodeInternalException "InternalException" +// The request processing has failed because of an unknown error, exception +// or failure (the failure is internal to the service) . Gives http status code +// of 500. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An exception for accessing or deleting a resource that does not exist. Gives +// http status code of 400. +// +// * ErrCodeValidationException "ValidationException" +// An exception for missing / invalid input fields. Gives http status code of +// 400. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchVersions +func (c *ElasticsearchService) ListElasticsearchVersions(input *ListElasticsearchVersionsInput) (*ListElasticsearchVersionsOutput, error) { + req, out := c.ListElasticsearchVersionsRequest(input) + return out, req.Send() +} + +// ListElasticsearchVersionsWithContext is the same as ListElasticsearchVersions with the addition of +// the ability to pass a context and additional request options. +// +// See ListElasticsearchVersions 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 *ElasticsearchService) ListElasticsearchVersionsWithContext(ctx aws.Context, input *ListElasticsearchVersionsInput, opts ...request.Option) (*ListElasticsearchVersionsOutput, error) { + req, out := c.ListElasticsearchVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListElasticsearchVersionsPages iterates over the pages of a ListElasticsearchVersions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListElasticsearchVersions 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 ListElasticsearchVersions operation. +// pageNum := 0 +// err := client.ListElasticsearchVersionsPages(params, +// func(page *ListElasticsearchVersionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *ElasticsearchService) ListElasticsearchVersionsPages(input *ListElasticsearchVersionsInput, fn func(*ListElasticsearchVersionsOutput, bool) bool) error { + return c.ListElasticsearchVersionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListElasticsearchVersionsPagesWithContext same as ListElasticsearchVersionsPages 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 *ElasticsearchService) ListElasticsearchVersionsPagesWithContext(ctx aws.Context, input *ListElasticsearchVersionsInput, fn func(*ListElasticsearchVersionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListElasticsearchVersionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListElasticsearchVersionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListElasticsearchVersionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListTags = "ListTags" @@ -644,8 +1151,23 @@ func (c *ElasticsearchService) ListTagsRequest(input *ListTagsInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListTags func (c *ElasticsearchService) ListTags(input *ListTagsInput) (*ListTagsOutput, error) { req, out := c.ListTagsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsWithContext is the same as ListTags with the addition of +// the ability to pass a context and additional request options. +// +// See ListTags 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 *ElasticsearchService) ListTagsWithContext(ctx aws.Context, input *ListTagsInput, opts ...request.Option) (*ListTagsOutput, error) { + req, out := c.ListTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTags = "RemoveTags" @@ -720,8 +1242,23 @@ func (c *ElasticsearchService) RemoveTagsRequest(input *RemoveTagsInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/RemoveTags func (c *ElasticsearchService) RemoveTags(input *RemoveTagsInput) (*RemoveTagsOutput, error) { req, out := c.RemoveTagsRequest(input) - err := req.Send() - return out, err + 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 *ElasticsearchService) 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 opUpdateElasticsearchDomainConfig = "UpdateElasticsearchDomainConfig" @@ -807,8 +1344,23 @@ func (c *ElasticsearchService) UpdateElasticsearchDomainConfigRequest(input *Upd // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/UpdateElasticsearchDomainConfig func (c *ElasticsearchService) UpdateElasticsearchDomainConfig(input *UpdateElasticsearchDomainConfigInput) (*UpdateElasticsearchDomainConfigOutput, error) { req, out := c.UpdateElasticsearchDomainConfigRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateElasticsearchDomainConfigWithContext is the same as UpdateElasticsearchDomainConfig with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateElasticsearchDomainConfig 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 *ElasticsearchService) UpdateElasticsearchDomainConfigWithContext(ctx aws.Context, input *UpdateElasticsearchDomainConfigInput, opts ...request.Option) (*UpdateElasticsearchDomainConfigOutput, error) { + req, out := c.UpdateElasticsearchDomainConfigRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // The configured access rules for the domain's document and search endpoints, @@ -934,6 +1486,46 @@ func (s AddTagsOutput) GoString() string { return s.String() } +// List of limits that are specific to a given InstanceType and for each of +// it's InstanceRole . +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/AdditionalLimit +type AdditionalLimit struct { + _ struct{} `type:"structure"` + + // Name of Additional Limit is specific to a given InstanceType and for each + // of it's InstanceRole etc. Attributes and their details: MaximumNumberOfDataNodesSupported + // This attribute will be present in Master node only to specify how much data + // nodes upto which given ESPartitionInstanceTypecan support as master node. MaximumNumberOfDataNodesWithoutMasterNode + // This attribute will be present in Data node only to specify how much data + // nodes of given ESPartitionInstanceType + LimitName *string `type:"string"` + + // Value for given AdditionalLimit$LimitName . + LimitValues []*string `type:"list"` +} + +// String returns the string representation +func (s AdditionalLimit) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AdditionalLimit) GoString() string { + return s.String() +} + +// SetLimitName sets the LimitName field's value. +func (s *AdditionalLimit) SetLimitName(v string) *AdditionalLimit { + s.LimitName = &v + return s +} + +// SetLimitValues sets the LimitValues field's value. +func (s *AdditionalLimit) SetLimitValues(v []*string) *AdditionalLimit { + s.LimitValues = v + return s +} + // Status of the advanced options for the specified Elasticsearch domain. Currently, // the following advanced options are available: // @@ -1339,25 +1931,110 @@ type DescribeElasticsearchDomainsInput struct { // The Elasticsearch domains for which you want information. // - // DomainNames is a required field - DomainNames []*string `type:"list" required:"true"` + // DomainNames is a required field + DomainNames []*string `type:"list" required:"true"` +} + +// String returns the string representation +func (s DescribeElasticsearchDomainsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeElasticsearchDomainsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeElasticsearchDomainsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeElasticsearchDomainsInput"} + if s.DomainNames == nil { + invalidParams.Add(request.NewErrParamRequired("DomainNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDomainNames sets the DomainNames field's value. +func (s *DescribeElasticsearchDomainsInput) SetDomainNames(v []*string) *DescribeElasticsearchDomainsInput { + s.DomainNames = v + return s +} + +// The result of a DescribeElasticsearchDomains request. Contains the status +// of the specified domains or all domains owned by the account. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchDomainsResponse +type DescribeElasticsearchDomainsOutput struct { + _ struct{} `type:"structure"` + + // The status of the domains requested in the DescribeElasticsearchDomains request. + // + // DomainStatusList is a required field + DomainStatusList []*ElasticsearchDomainStatus `type:"list" required:"true"` +} + +// String returns the string representation +func (s DescribeElasticsearchDomainsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeElasticsearchDomainsOutput) GoString() string { + return s.String() +} + +// SetDomainStatusList sets the DomainStatusList field's value. +func (s *DescribeElasticsearchDomainsOutput) SetDomainStatusList(v []*ElasticsearchDomainStatus) *DescribeElasticsearchDomainsOutput { + s.DomainStatusList = v + return s +} + +// Container for the parameters to DescribeElasticsearchInstanceTypeLimits operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchInstanceTypeLimitsRequest +type DescribeElasticsearchInstanceTypeLimitsInput struct { + _ struct{} `type:"structure"` + + // DomainName represents the name of the Domain that we are trying to modify. + // This should be present only if we are querying for Elasticsearch Limits for + // existing domain. + DomainName *string `location:"querystring" locationName:"domainName" min:"3" type:"string"` + + // Version of Elasticsearch for which Limits are needed. + // + // ElasticsearchVersion is a required field + ElasticsearchVersion *string `location:"uri" locationName:"ElasticsearchVersion" type:"string" required:"true"` + + // The instance type for an Elasticsearch cluster for which Elasticsearch Limits + // are needed. + // + // InstanceType is a required field + InstanceType *string `location:"uri" locationName:"InstanceType" type:"string" required:"true" enum:"ESPartitionInstanceType"` } // String returns the string representation -func (s DescribeElasticsearchDomainsInput) String() string { +func (s DescribeElasticsearchInstanceTypeLimitsInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeElasticsearchDomainsInput) GoString() string { +func (s DescribeElasticsearchInstanceTypeLimitsInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeElasticsearchDomainsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeElasticsearchDomainsInput"} - if s.DomainNames == nil { - invalidParams.Add(request.NewErrParamRequired("DomainNames")) +func (s *DescribeElasticsearchInstanceTypeLimitsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeElasticsearchInstanceTypeLimitsInput"} + if s.DomainName != nil && len(*s.DomainName) < 3 { + invalidParams.Add(request.NewErrParamMinLen("DomainName", 3)) + } + if s.ElasticsearchVersion == nil { + invalidParams.Add(request.NewErrParamRequired("ElasticsearchVersion")) + } + if s.InstanceType == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceType")) } if invalidParams.Len() > 0 { @@ -1366,37 +2043,50 @@ func (s *DescribeElasticsearchDomainsInput) Validate() error { return nil } -// SetDomainNames sets the DomainNames field's value. -func (s *DescribeElasticsearchDomainsInput) SetDomainNames(v []*string) *DescribeElasticsearchDomainsInput { - s.DomainNames = v +// SetDomainName sets the DomainName field's value. +func (s *DescribeElasticsearchInstanceTypeLimitsInput) SetDomainName(v string) *DescribeElasticsearchInstanceTypeLimitsInput { + s.DomainName = &v return s } -// The result of a DescribeElasticsearchDomains request. Contains the status -// of the specified domains or all domains owned by the account. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchDomainsResponse -type DescribeElasticsearchDomainsOutput struct { +// SetElasticsearchVersion sets the ElasticsearchVersion field's value. +func (s *DescribeElasticsearchInstanceTypeLimitsInput) SetElasticsearchVersion(v string) *DescribeElasticsearchInstanceTypeLimitsInput { + s.ElasticsearchVersion = &v + return s +} + +// SetInstanceType sets the InstanceType field's value. +func (s *DescribeElasticsearchInstanceTypeLimitsInput) SetInstanceType(v string) *DescribeElasticsearchInstanceTypeLimitsInput { + s.InstanceType = &v + return s +} + +// Container for the parameters received from DescribeElasticsearchInstanceTypeLimits +// operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/DescribeElasticsearchInstanceTypeLimitsResponse +type DescribeElasticsearchInstanceTypeLimitsOutput struct { _ struct{} `type:"structure"` - // The status of the domains requested in the DescribeElasticsearchDomains request. - // - // DomainStatusList is a required field - DomainStatusList []*ElasticsearchDomainStatus `type:"list" required:"true"` + // Map of Role of the Instance and Limits that are applicable. Role performed + // by given Instance in Elasticsearch can be one of the following: Data: If + // the given InstanceType is used as Data node + // Master: If the given InstanceType is used as Master node + LimitsByRole map[string]*Limits `type:"map"` } // String returns the string representation -func (s DescribeElasticsearchDomainsOutput) String() string { +func (s DescribeElasticsearchInstanceTypeLimitsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeElasticsearchDomainsOutput) GoString() string { +func (s DescribeElasticsearchInstanceTypeLimitsOutput) GoString() string { return s.String() } -// SetDomainStatusList sets the DomainStatusList field's value. -func (s *DescribeElasticsearchDomainsOutput) SetDomainStatusList(v []*ElasticsearchDomainStatus) *DescribeElasticsearchDomainsOutput { - s.DomainStatusList = v +// SetLimitsByRole sets the LimitsByRole field's value. +func (s *DescribeElasticsearchInstanceTypeLimitsOutput) SetLimitsByRole(v map[string]*Limits) *DescribeElasticsearchInstanceTypeLimitsOutput { + s.LimitsByRole = v return s } @@ -1895,6 +2585,114 @@ func (s *ElasticsearchVersionStatus) SetStatus(v *OptionStatus) *ElasticsearchVe return s } +// InstanceCountLimits represents the limits on number of instances that be +// created in Amazon Elasticsearch for given InstanceType. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/InstanceCountLimits +type InstanceCountLimits struct { + _ struct{} `type:"structure"` + + // Maximum number of Instances that can be instantiated for given InstanceType. + MaximumInstanceCount *int64 `type:"integer"` + + // Minimum number of Instances that can be instantiated for given InstanceType. + MinimumInstanceCount *int64 `type:"integer"` +} + +// String returns the string representation +func (s InstanceCountLimits) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceCountLimits) GoString() string { + return s.String() +} + +// SetMaximumInstanceCount sets the MaximumInstanceCount field's value. +func (s *InstanceCountLimits) SetMaximumInstanceCount(v int64) *InstanceCountLimits { + s.MaximumInstanceCount = &v + return s +} + +// SetMinimumInstanceCount sets the MinimumInstanceCount field's value. +func (s *InstanceCountLimits) SetMinimumInstanceCount(v int64) *InstanceCountLimits { + s.MinimumInstanceCount = &v + return s +} + +// InstanceLimits represents the list of instance related attributes that are +// available for given InstanceType. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/InstanceLimits +type InstanceLimits struct { + _ struct{} `type:"structure"` + + // InstanceCountLimits represents the limits on number of instances that be + // created in Amazon Elasticsearch for given InstanceType. + InstanceCountLimits *InstanceCountLimits `type:"structure"` +} + +// String returns the string representation +func (s InstanceLimits) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceLimits) GoString() string { + return s.String() +} + +// SetInstanceCountLimits sets the InstanceCountLimits field's value. +func (s *InstanceLimits) SetInstanceCountLimits(v *InstanceCountLimits) *InstanceLimits { + s.InstanceCountLimits = v + return s +} + +// Limits for given InstanceType and for each of it's role. Limits contains following StorageTypes, InstanceLimitsand AdditionalLimits +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/Limits +type Limits struct { + _ struct{} `type:"structure"` + + // List of additional limits that are specific to a given InstanceType and for + // each of it's InstanceRole . + AdditionalLimits []*AdditionalLimit `type:"list"` + + // InstanceLimits represents the list of instance related attributes that are + // available for given InstanceType. + InstanceLimits *InstanceLimits `type:"structure"` + + // StorageType represents the list of storage related types and attributes that + // are available for given InstanceType. + StorageTypes []*StorageType `type:"list"` +} + +// String returns the string representation +func (s Limits) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Limits) GoString() string { + return s.String() +} + +// SetAdditionalLimits sets the AdditionalLimits field's value. +func (s *Limits) SetAdditionalLimits(v []*AdditionalLimit) *Limits { + s.AdditionalLimits = v + return s +} + +// SetInstanceLimits sets the InstanceLimits field's value. +func (s *Limits) SetInstanceLimits(v *InstanceLimits) *Limits { + s.InstanceLimits = v + return s +} + +// SetStorageTypes sets the StorageTypes field's value. +func (s *Limits) SetStorageTypes(v []*StorageType) *Limits { + s.StorageTypes = v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListDomainNamesInput type ListDomainNamesInput struct { _ struct{} `type:"structure"` @@ -1936,6 +2734,197 @@ func (s *ListDomainNamesOutput) SetDomainNames(v []*DomainInfo) *ListDomainNames return s } +// Container for the parameters to the ListElasticsearchInstanceTypes operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchInstanceTypesRequest +type ListElasticsearchInstanceTypesInput struct { + _ struct{} `type:"structure"` + + // DomainName represents the name of the Domain that we are trying to modify. + // This should be present only if we are querying for list of available Elasticsearch + // instance types when modifying existing domain. + DomainName *string `location:"querystring" locationName:"domainName" min:"3" type:"string"` + + // Version of Elasticsearch for which list of supported elasticsearch instance + // types are needed. + // + // ElasticsearchVersion is a required field + ElasticsearchVersion *string `location:"uri" locationName:"ElasticsearchVersion" type:"string" required:"true"` + + // Set this value to limit the number of results returned. Value provided must + // be greater than 30 else it wont be honored. + MaxResults *int64 `location:"querystring" locationName:"maxResults" type:"integer"` + + // NextToken should be sent in case if earlier API call produced result containing + // NextToken. It is used for pagination. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListElasticsearchInstanceTypesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListElasticsearchInstanceTypesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListElasticsearchInstanceTypesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListElasticsearchInstanceTypesInput"} + if s.DomainName != nil && len(*s.DomainName) < 3 { + invalidParams.Add(request.NewErrParamMinLen("DomainName", 3)) + } + if s.ElasticsearchVersion == nil { + invalidParams.Add(request.NewErrParamRequired("ElasticsearchVersion")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDomainName sets the DomainName field's value. +func (s *ListElasticsearchInstanceTypesInput) SetDomainName(v string) *ListElasticsearchInstanceTypesInput { + s.DomainName = &v + return s +} + +// SetElasticsearchVersion sets the ElasticsearchVersion field's value. +func (s *ListElasticsearchInstanceTypesInput) SetElasticsearchVersion(v string) *ListElasticsearchInstanceTypesInput { + s.ElasticsearchVersion = &v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *ListElasticsearchInstanceTypesInput) SetMaxResults(v int64) *ListElasticsearchInstanceTypesInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListElasticsearchInstanceTypesInput) SetNextToken(v string) *ListElasticsearchInstanceTypesInput { + s.NextToken = &v + return s +} + +// Container for the parameters returned by ListElasticsearchInstanceTypes operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchInstanceTypesResponse +type ListElasticsearchInstanceTypesOutput struct { + _ struct{} `type:"structure"` + + // List of instance types supported by Amazon Elasticsearch service for given + // ElasticsearchVersion + ElasticsearchInstanceTypes []*string `type:"list"` + + // In case if there are more results available NextToken would be present, make + // further request to the same API with received NextToken to paginate remaining + // results. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListElasticsearchInstanceTypesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListElasticsearchInstanceTypesOutput) GoString() string { + return s.String() +} + +// SetElasticsearchInstanceTypes sets the ElasticsearchInstanceTypes field's value. +func (s *ListElasticsearchInstanceTypesOutput) SetElasticsearchInstanceTypes(v []*string) *ListElasticsearchInstanceTypesOutput { + s.ElasticsearchInstanceTypes = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListElasticsearchInstanceTypesOutput) SetNextToken(v string) *ListElasticsearchInstanceTypesOutput { + s.NextToken = &v + return s +} + +// Container for the parameters to the ListElasticsearchVersions operation. +// Use MaxResults to control the maximum number of results to retrieve in a +// single call. +// +// Use NextToken in response to retrieve more results. If the received response +// does not contain a NextToken, then there are no more results to retrieve. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchVersionsRequest +type ListElasticsearchVersionsInput struct { + _ struct{} `type:"structure"` + + // Set this value to limit the number of results returned. Value provided must + // be greater than 10 else it wont be honored. + MaxResults *int64 `location:"querystring" locationName:"maxResults" type:"integer"` + + // Paginated APIs accepts NextToken input to returns next page results and provides + // a NextToken output in the response which can be used by the client to retrieve + // more results. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListElasticsearchVersionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListElasticsearchVersionsInput) GoString() string { + return s.String() +} + +// SetMaxResults sets the MaxResults field's value. +func (s *ListElasticsearchVersionsInput) SetMaxResults(v int64) *ListElasticsearchVersionsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListElasticsearchVersionsInput) SetNextToken(v string) *ListElasticsearchVersionsInput { + s.NextToken = &v + return s +} + +// Container for the parameters for response received from ListElasticsearchVersions +// operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/ListElasticsearchVersionsResponse +type ListElasticsearchVersionsOutput struct { + _ struct{} `type:"structure"` + + // List of supported elastic search versions. + ElasticsearchVersions []*string `type:"list"` + + // Paginated APIs accepts NextToken input to returns next page results and provides + // a NextToken output in the response which can be used by the client to retrieve + // more results. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListElasticsearchVersionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListElasticsearchVersionsOutput) GoString() string { + return s.String() +} + +// SetElasticsearchVersions sets the ElasticsearchVersions field's value. +func (s *ListElasticsearchVersionsOutput) SetElasticsearchVersions(v []*string) *ListElasticsearchVersionsOutput { + s.ElasticsearchVersions = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListElasticsearchVersionsOutput) SetNextToken(v string) *ListElasticsearchVersionsOutput { + s.NextToken = &v + return s +} + // Container for the parameters to the ListTags operation. Specify the ARN for // the Elasticsearch domain to which the tags are attached that you want to // view are attached. @@ -2210,6 +3199,100 @@ func (s *SnapshotOptionsStatus) SetStatus(v *OptionStatus) *SnapshotOptionsStatu return s } +// StorageTypes represents the list of storage related types and their attributes +// that are available for given InstanceType. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/StorageType +type StorageType struct { + _ struct{} `type:"structure"` + + // SubType of the given storage type. List of available sub-storage options: + // For "instance" storageType we wont have any storageSubType, in case of "ebs" + // storageType we will have following valid storageSubTypes standard + // gp2 + // io1 + // Refer VolumeType for more information regarding above EBS storage options. + StorageSubTypeName *string `type:"string"` + + // List of limits that are applicable for given storage type. + StorageTypeLimits []*StorageTypeLimit `type:"list"` + + // Type of the storage. List of available storage options: instance + // Inbuilt storage available for the given Instance ebs + // Elastic block storage that would be attached to the given Instance + StorageTypeName *string `type:"string"` +} + +// String returns the string representation +func (s StorageType) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StorageType) GoString() string { + return s.String() +} + +// SetStorageSubTypeName sets the StorageSubTypeName field's value. +func (s *StorageType) SetStorageSubTypeName(v string) *StorageType { + s.StorageSubTypeName = &v + return s +} + +// SetStorageTypeLimits sets the StorageTypeLimits field's value. +func (s *StorageType) SetStorageTypeLimits(v []*StorageTypeLimit) *StorageType { + s.StorageTypeLimits = v + return s +} + +// SetStorageTypeName sets the StorageTypeName field's value. +func (s *StorageType) SetStorageTypeName(v string) *StorageType { + s.StorageTypeName = &v + return s +} + +// Limits that are applicable for given storage type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/StorageTypeLimit +type StorageTypeLimit struct { + _ struct{} `type:"structure"` + + // Name of storage limits that are applicable for given storage type. If StorageType + // is ebs, following storage options are applicable MinimumVolumeSize + // Minimum amount of volume size that is applicable for given storage type.It + // can be empty if it is not applicable. MaximumVolumeSize + // Maximum amount of volume size that is applicable for given storage type.It + // can be empty if it is not applicable. MaximumIops + // Maximum amount of Iops that is applicable for given storage type.It can + // be empty if it is not applicable. MinimumIops + // Minimum amount of Iops that is applicable for given storage type.It can + // be empty if it is not applicable. + LimitName *string `type:"string"` + + // Values for the StorageTypeLimit$LimitName . + LimitValues []*string `type:"list"` +} + +// String returns the string representation +func (s StorageTypeLimit) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StorageTypeLimit) GoString() string { + return s.String() +} + +// SetLimitName sets the LimitName field's value. +func (s *StorageTypeLimit) SetLimitName(v string) *StorageTypeLimit { + s.LimitName = &v + return s +} + +// SetLimitValues sets the LimitValues field's value. +func (s *StorageTypeLimit) SetLimitValues(v []*string) *StorageTypeLimit { + s.LimitValues = v + return s +} + // Specifies a key value pair for a resource tag. // Please also see https://docs.aws.amazon.com/goto/WebAPI/es-2015-01-01/Tag type Tag struct { @@ -2449,6 +3532,51 @@ const ( // ESPartitionInstanceTypeI22xlargeElasticsearch is a ESPartitionInstanceType enum value ESPartitionInstanceTypeI22xlargeElasticsearch = "i2.2xlarge.elasticsearch" + + // ESPartitionInstanceTypeD2XlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeD2XlargeElasticsearch = "d2.xlarge.elasticsearch" + + // ESPartitionInstanceTypeD22xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeD22xlargeElasticsearch = "d2.2xlarge.elasticsearch" + + // ESPartitionInstanceTypeD24xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeD24xlargeElasticsearch = "d2.4xlarge.elasticsearch" + + // ESPartitionInstanceTypeD28xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeD28xlargeElasticsearch = "d2.8xlarge.elasticsearch" + + // ESPartitionInstanceTypeC4LargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC4LargeElasticsearch = "c4.large.elasticsearch" + + // ESPartitionInstanceTypeC4XlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC4XlargeElasticsearch = "c4.xlarge.elasticsearch" + + // ESPartitionInstanceTypeC42xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC42xlargeElasticsearch = "c4.2xlarge.elasticsearch" + + // ESPartitionInstanceTypeC44xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC44xlargeElasticsearch = "c4.4xlarge.elasticsearch" + + // ESPartitionInstanceTypeC48xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC48xlargeElasticsearch = "c4.8xlarge.elasticsearch" + + // ESPartitionInstanceTypeR4LargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR4LargeElasticsearch = "r4.large.elasticsearch" + + // ESPartitionInstanceTypeR4XlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR4XlargeElasticsearch = "r4.xlarge.elasticsearch" + + // ESPartitionInstanceTypeR42xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR42xlargeElasticsearch = "r4.2xlarge.elasticsearch" + + // ESPartitionInstanceTypeR44xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR44xlargeElasticsearch = "r4.4xlarge.elasticsearch" + + // ESPartitionInstanceTypeR48xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR48xlargeElasticsearch = "r4.8xlarge.elasticsearch" + + // ESPartitionInstanceTypeR416xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR416xlargeElasticsearch = "r4.16xlarge.elasticsearch" ) // The state of a requested change. One of the following: diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/errors.go index 66c1650b0c..332cf8d4fb 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elasticsearchservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/service.go index 8ba1f8bf54..ee2acc4951 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elasticsearchservice diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/api.go index df4a299475..a4c0d3f315 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package elastictranscoder provides a client for Amazon Elastic Transcoder. package elastictranscoder @@ -6,6 +6,7 @@ package elastictranscoder import ( "fmt" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" ) @@ -90,8 +91,23 @@ func (c *ElasticTranscoder) CancelJobRequest(input *CancelJobInput) (req *reques // func (c *ElasticTranscoder) CancelJob(input *CancelJobInput) (*CancelJobOutput, error) { req, out := c.CancelJobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelJobWithContext is the same as CancelJob with the addition of +// the ability to pass a context and additional request options. +// +// See CancelJob 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 *ElasticTranscoder) CancelJobWithContext(ctx aws.Context, input *CancelJobInput, opts ...request.Option) (*CancelJobOutput, error) { + req, out := c.CancelJobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateJob = "CreateJob" @@ -176,8 +192,23 @@ func (c *ElasticTranscoder) CreateJobRequest(input *CreateJobInput) (req *reques // func (c *ElasticTranscoder) CreateJob(input *CreateJobInput) (*CreateJobResponse, error) { req, out := c.CreateJobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateJobWithContext is the same as CreateJob with the addition of +// the ability to pass a context and additional request options. +// +// See CreateJob 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 *ElasticTranscoder) CreateJobWithContext(ctx aws.Context, input *CreateJobInput, opts ...request.Option) (*CreateJobResponse, error) { + req, out := c.CreateJobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePipeline = "CreatePipeline" @@ -256,8 +287,23 @@ func (c *ElasticTranscoder) CreatePipelineRequest(input *CreatePipelineInput) (r // func (c *ElasticTranscoder) CreatePipeline(input *CreatePipelineInput) (*CreatePipelineOutput, error) { req, out := c.CreatePipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePipelineWithContext is the same as CreatePipeline with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePipeline 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 *ElasticTranscoder) CreatePipelineWithContext(ctx aws.Context, input *CreatePipelineInput, opts ...request.Option) (*CreatePipelineOutput, error) { + req, out := c.CreatePipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePreset = "CreatePreset" @@ -345,8 +391,23 @@ func (c *ElasticTranscoder) CreatePresetRequest(input *CreatePresetInput) (req * // func (c *ElasticTranscoder) CreatePreset(input *CreatePresetInput) (*CreatePresetOutput, error) { req, out := c.CreatePresetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePresetWithContext is the same as CreatePreset with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePreset 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 *ElasticTranscoder) CreatePresetWithContext(ctx aws.Context, input *CreatePresetInput, opts ...request.Option) (*CreatePresetOutput, error) { + req, out := c.CreatePresetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeletePipeline = "DeletePipeline" @@ -429,8 +490,23 @@ func (c *ElasticTranscoder) DeletePipelineRequest(input *DeletePipelineInput) (r // func (c *ElasticTranscoder) DeletePipeline(input *DeletePipelineInput) (*DeletePipelineOutput, error) { req, out := c.DeletePipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeletePipelineWithContext is the same as DeletePipeline with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePipeline 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 *ElasticTranscoder) DeletePipelineWithContext(ctx aws.Context, input *DeletePipelineInput, opts ...request.Option) (*DeletePipelineOutput, error) { + req, out := c.DeletePipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeletePreset = "DeletePreset" @@ -507,8 +583,23 @@ func (c *ElasticTranscoder) DeletePresetRequest(input *DeletePresetInput) (req * // func (c *ElasticTranscoder) DeletePreset(input *DeletePresetInput) (*DeletePresetOutput, error) { req, out := c.DeletePresetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeletePresetWithContext is the same as DeletePreset with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePreset 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 *ElasticTranscoder) DeletePresetWithContext(ctx aws.Context, input *DeletePresetInput, opts ...request.Option) (*DeletePresetOutput, error) { + req, out := c.DeletePresetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListJobsByPipeline = "ListJobsByPipeline" @@ -593,8 +684,23 @@ func (c *ElasticTranscoder) ListJobsByPipelineRequest(input *ListJobsByPipelineI // func (c *ElasticTranscoder) ListJobsByPipeline(input *ListJobsByPipelineInput) (*ListJobsByPipelineOutput, error) { req, out := c.ListJobsByPipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListJobsByPipelineWithContext is the same as ListJobsByPipeline with the addition of +// the ability to pass a context and additional request options. +// +// See ListJobsByPipeline 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 *ElasticTranscoder) ListJobsByPipelineWithContext(ctx aws.Context, input *ListJobsByPipelineInput, opts ...request.Option) (*ListJobsByPipelineOutput, error) { + req, out := c.ListJobsByPipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListJobsByPipelinePages iterates over the pages of a ListJobsByPipeline operation, @@ -614,12 +720,37 @@ func (c *ElasticTranscoder) ListJobsByPipeline(input *ListJobsByPipelineInput) ( // return pageNum <= 3 // }) // -func (c *ElasticTranscoder) ListJobsByPipelinePages(input *ListJobsByPipelineInput, fn func(p *ListJobsByPipelineOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListJobsByPipelineRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListJobsByPipelineOutput), lastPage) - }) +func (c *ElasticTranscoder) ListJobsByPipelinePages(input *ListJobsByPipelineInput, fn func(*ListJobsByPipelineOutput, bool) bool) error { + return c.ListJobsByPipelinePagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListJobsByPipelinePagesWithContext same as ListJobsByPipelinePages 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 *ElasticTranscoder) ListJobsByPipelinePagesWithContext(ctx aws.Context, input *ListJobsByPipelineInput, fn func(*ListJobsByPipelineOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListJobsByPipelineInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListJobsByPipelineRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListJobsByPipelineOutput), !p.HasNextPage()) + } + return p.Err() } const opListJobsByStatus = "ListJobsByStatus" @@ -702,8 +833,23 @@ func (c *ElasticTranscoder) ListJobsByStatusRequest(input *ListJobsByStatusInput // func (c *ElasticTranscoder) ListJobsByStatus(input *ListJobsByStatusInput) (*ListJobsByStatusOutput, error) { req, out := c.ListJobsByStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListJobsByStatusWithContext is the same as ListJobsByStatus with the addition of +// the ability to pass a context and additional request options. +// +// See ListJobsByStatus 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 *ElasticTranscoder) ListJobsByStatusWithContext(ctx aws.Context, input *ListJobsByStatusInput, opts ...request.Option) (*ListJobsByStatusOutput, error) { + req, out := c.ListJobsByStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListJobsByStatusPages iterates over the pages of a ListJobsByStatus operation, @@ -723,12 +869,37 @@ func (c *ElasticTranscoder) ListJobsByStatus(input *ListJobsByStatusInput) (*Lis // return pageNum <= 3 // }) // -func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(p *ListJobsByStatusOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListJobsByStatusRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListJobsByStatusOutput), lastPage) - }) +func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool) error { + return c.ListJobsByStatusPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListJobsByStatusPagesWithContext same as ListJobsByStatusPages 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 *ElasticTranscoder) ListJobsByStatusPagesWithContext(ctx aws.Context, input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListJobsByStatusInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListJobsByStatusRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListJobsByStatusOutput), !p.HasNextPage()) + } + return p.Err() } const opListPipelines = "ListPipelines" @@ -805,8 +976,23 @@ func (c *ElasticTranscoder) ListPipelinesRequest(input *ListPipelinesInput) (req // func (c *ElasticTranscoder) ListPipelines(input *ListPipelinesInput) (*ListPipelinesOutput, error) { req, out := c.ListPipelinesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPipelinesWithContext is the same as ListPipelines with the addition of +// the ability to pass a context and additional request options. +// +// See ListPipelines 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 *ElasticTranscoder) ListPipelinesWithContext(ctx aws.Context, input *ListPipelinesInput, opts ...request.Option) (*ListPipelinesOutput, error) { + req, out := c.ListPipelinesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListPipelinesPages iterates over the pages of a ListPipelines operation, @@ -826,12 +1012,37 @@ func (c *ElasticTranscoder) ListPipelines(input *ListPipelinesInput) (*ListPipel // return pageNum <= 3 // }) // -func (c *ElasticTranscoder) ListPipelinesPages(input *ListPipelinesInput, fn func(p *ListPipelinesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListPipelinesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListPipelinesOutput), lastPage) - }) +func (c *ElasticTranscoder) ListPipelinesPages(input *ListPipelinesInput, fn func(*ListPipelinesOutput, bool) bool) error { + return c.ListPipelinesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListPipelinesPagesWithContext same as ListPipelinesPages 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 *ElasticTranscoder) ListPipelinesPagesWithContext(ctx aws.Context, input *ListPipelinesInput, fn func(*ListPipelinesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListPipelinesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListPipelinesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListPipelinesOutput), !p.HasNextPage()) + } + return p.Err() } const opListPresets = "ListPresets" @@ -908,8 +1119,23 @@ func (c *ElasticTranscoder) ListPresetsRequest(input *ListPresetsInput) (req *re // func (c *ElasticTranscoder) ListPresets(input *ListPresetsInput) (*ListPresetsOutput, error) { req, out := c.ListPresetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPresetsWithContext is the same as ListPresets with the addition of +// the ability to pass a context and additional request options. +// +// See ListPresets 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 *ElasticTranscoder) ListPresetsWithContext(ctx aws.Context, input *ListPresetsInput, opts ...request.Option) (*ListPresetsOutput, error) { + req, out := c.ListPresetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListPresetsPages iterates over the pages of a ListPresets operation, @@ -929,12 +1155,37 @@ func (c *ElasticTranscoder) ListPresets(input *ListPresetsInput) (*ListPresetsOu // return pageNum <= 3 // }) // -func (c *ElasticTranscoder) ListPresetsPages(input *ListPresetsInput, fn func(p *ListPresetsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListPresetsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListPresetsOutput), lastPage) - }) +func (c *ElasticTranscoder) ListPresetsPages(input *ListPresetsInput, fn func(*ListPresetsOutput, bool) bool) error { + return c.ListPresetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListPresetsPagesWithContext same as ListPresetsPages 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 *ElasticTranscoder) ListPresetsPagesWithContext(ctx aws.Context, input *ListPresetsInput, fn func(*ListPresetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListPresetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListPresetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListPresetsOutput), !p.HasNextPage()) + } + return p.Err() } const opReadJob = "ReadJob" @@ -1009,8 +1260,23 @@ func (c *ElasticTranscoder) ReadJobRequest(input *ReadJobInput) (req *request.Re // func (c *ElasticTranscoder) ReadJob(input *ReadJobInput) (*ReadJobOutput, error) { req, out := c.ReadJobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReadJobWithContext is the same as ReadJob with the addition of +// the ability to pass a context and additional request options. +// +// See ReadJob 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 *ElasticTranscoder) ReadJobWithContext(ctx aws.Context, input *ReadJobInput, opts ...request.Option) (*ReadJobOutput, error) { + req, out := c.ReadJobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReadPipeline = "ReadPipeline" @@ -1085,8 +1351,23 @@ func (c *ElasticTranscoder) ReadPipelineRequest(input *ReadPipelineInput) (req * // func (c *ElasticTranscoder) ReadPipeline(input *ReadPipelineInput) (*ReadPipelineOutput, error) { req, out := c.ReadPipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReadPipelineWithContext is the same as ReadPipeline with the addition of +// the ability to pass a context and additional request options. +// +// See ReadPipeline 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 *ElasticTranscoder) ReadPipelineWithContext(ctx aws.Context, input *ReadPipelineInput, opts ...request.Option) (*ReadPipelineOutput, error) { + req, out := c.ReadPipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReadPreset = "ReadPreset" @@ -1161,8 +1442,23 @@ func (c *ElasticTranscoder) ReadPresetRequest(input *ReadPresetInput) (req *requ // func (c *ElasticTranscoder) ReadPreset(input *ReadPresetInput) (*ReadPresetOutput, error) { req, out := c.ReadPresetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReadPresetWithContext is the same as ReadPreset with the addition of +// the ability to pass a context and additional request options. +// +// See ReadPreset 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 *ElasticTranscoder) ReadPresetWithContext(ctx aws.Context, input *ReadPresetInput, opts ...request.Option) (*ReadPresetOutput, error) { + req, out := c.ReadPresetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestRole = "TestRole" @@ -1246,8 +1542,23 @@ func (c *ElasticTranscoder) TestRoleRequest(input *TestRoleInput) (req *request. // func (c *ElasticTranscoder) TestRole(input *TestRoleInput) (*TestRoleOutput, error) { req, out := c.TestRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestRoleWithContext is the same as TestRole with the addition of +// the ability to pass a context and additional request options. +// +// See TestRole 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 *ElasticTranscoder) TestRoleWithContext(ctx aws.Context, input *TestRoleInput, opts ...request.Option) (*TestRoleOutput, error) { + req, out := c.TestRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdatePipeline = "UpdatePipeline" @@ -1331,8 +1642,23 @@ func (c *ElasticTranscoder) UpdatePipelineRequest(input *UpdatePipelineInput) (r // func (c *ElasticTranscoder) UpdatePipeline(input *UpdatePipelineInput) (*UpdatePipelineOutput, error) { req, out := c.UpdatePipelineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdatePipelineWithContext is the same as UpdatePipeline with the addition of +// the ability to pass a context and additional request options. +// +// See UpdatePipeline 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 *ElasticTranscoder) UpdatePipelineWithContext(ctx aws.Context, input *UpdatePipelineInput, opts ...request.Option) (*UpdatePipelineOutput, error) { + req, out := c.UpdatePipelineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdatePipelineNotifications = "UpdatePipelineNotifications" @@ -1415,8 +1741,23 @@ func (c *ElasticTranscoder) UpdatePipelineNotificationsRequest(input *UpdatePipe // func (c *ElasticTranscoder) UpdatePipelineNotifications(input *UpdatePipelineNotificationsInput) (*UpdatePipelineNotificationsOutput, error) { req, out := c.UpdatePipelineNotificationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdatePipelineNotificationsWithContext is the same as UpdatePipelineNotifications with the addition of +// the ability to pass a context and additional request options. +// +// See UpdatePipelineNotifications 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 *ElasticTranscoder) UpdatePipelineNotificationsWithContext(ctx aws.Context, input *UpdatePipelineNotificationsInput, opts ...request.Option) (*UpdatePipelineNotificationsOutput, error) { + req, out := c.UpdatePipelineNotificationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdatePipelineStatus = "UpdatePipelineStatus" @@ -1502,8 +1843,23 @@ func (c *ElasticTranscoder) UpdatePipelineStatusRequest(input *UpdatePipelineSta // func (c *ElasticTranscoder) UpdatePipelineStatus(input *UpdatePipelineStatusInput) (*UpdatePipelineStatusOutput, error) { req, out := c.UpdatePipelineStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdatePipelineStatusWithContext is the same as UpdatePipelineStatus with the addition of +// the ability to pass a context and additional request options. +// +// See UpdatePipelineStatus 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 *ElasticTranscoder) UpdatePipelineStatusWithContext(ctx aws.Context, input *UpdatePipelineStatusInput, opts ...request.Option) (*UpdatePipelineStatusOutput, error) { + req, out := c.UpdatePipelineStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // The file to be used as album art. There can be multiple artworks associated diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/errors.go index 18374bc248..7c670785cc 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elastictranscoder diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/service.go index bbd6e24796..7060799dd9 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elastictranscoder diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/waiters.go index 7674620415..d4e2bf2ae1 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elastictranscoder/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elastictranscoder import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilJobComplete uses the Amazon Elastic Transcoder API operation @@ -11,36 +14,53 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *ElasticTranscoder) WaitUntilJobComplete(input *ReadJobInput) error { - waiterCfg := waiter.Config{ - Operation: "ReadJob", - Delay: 30, + return c.WaitUntilJobCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilJobCompleteWithContext is an extended version of WaitUntilJobComplete. +// 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 *ElasticTranscoder) WaitUntilJobCompleteWithContext(ctx aws.Context, input *ReadJobInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilJobComplete", MaxAttempts: 120, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "Job.Status", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Job.Status", Expected: "Complete", }, { - State: "failure", - Matcher: "path", - Argument: "Job.Status", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Job.Status", Expected: "Canceled", }, { - State: "failure", - Matcher: "path", - Argument: "Job.Status", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Job.Status", Expected: "Error", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *ReadJobInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ReadJobRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/api.go index b8c6d428ea..ed376a514b 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package elb provides a client for Elastic Load Balancing. package elb @@ -7,6 +7,7 @@ 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" ) @@ -86,8 +87,23 @@ func (c *ELB) AddTagsRequest(input *AddTagsInput) (req *request.Request, output // Please also see 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) - err := req.Send() - return out, err + 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" @@ -162,8 +178,23 @@ func (c *ELB) ApplySecurityGroupsToLoadBalancerRequest(input *ApplySecurityGroup // Please also see 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) - err := req.Send() - return out, err + 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" @@ -242,8 +273,23 @@ func (c *ELB) AttachLoadBalancerToSubnetsRequest(input *AttachLoadBalancerToSubn // Please also see 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) - err := req.Send() - return out, err + 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" @@ -312,8 +358,23 @@ func (c *ELB) ConfigureHealthCheckRequest(input *ConfigureHealthCheckInput) (req // Please also see 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) - err := req.Send() - return out, err + 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" @@ -400,8 +461,23 @@ func (c *ELB) CreateAppCookieStickinessPolicyRequest(input *CreateAppCookieStick // Please also see 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) - err := req.Send() - return out, err + 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" @@ -490,8 +566,23 @@ func (c *ELB) CreateLBCookieStickinessPolicyRequest(input *CreateLBCookieStickin // Please also see 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) - err := req.Send() - return out, err + 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" @@ -601,8 +692,23 @@ func (c *ELB) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -687,8 +793,23 @@ func (c *ELB) CreateLoadBalancerListenersRequest(input *CreateLoadBalancerListen // Please also see 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) - err := req.Send() - return out, err + 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" @@ -768,8 +889,23 @@ func (c *ELB) CreateLoadBalancerPolicyRequest(input *CreateLoadBalancerPolicyInp // Please also see 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) - err := req.Send() - return out, err + 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" @@ -837,8 +973,23 @@ func (c *ELB) DeleteLoadBalancerRequest(input *DeleteLoadBalancerInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -902,8 +1053,23 @@ func (c *ELB) DeleteLoadBalancerListenersRequest(input *DeleteLoadBalancerListen // Please also see 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) - err := req.Send() - return out, err + 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" @@ -971,8 +1137,23 @@ func (c *ELB) DeleteLoadBalancerPolicyRequest(input *DeleteLoadBalancerPolicyInp // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1047,8 +1228,23 @@ func (c *ELB) DeregisterInstancesFromLoadBalancerRequest(input *DeregisterInstan // Please also see 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) - err := req.Send() - return out, err + 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 opDescribeInstanceHealth = "DescribeInstanceHealth" @@ -1120,8 +1316,23 @@ func (c *ELB) DescribeInstanceHealthRequest(input *DescribeInstanceHealthInput) // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1188,8 +1399,23 @@ func (c *ELB) DescribeLoadBalancerAttributesRequest(input *DescribeLoadBalancerA // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1263,8 +1489,23 @@ func (c *ELB) DescribeLoadBalancerPoliciesRequest(input *DescribeLoadBalancerPol // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1339,8 +1580,23 @@ func (c *ELB) DescribeLoadBalancerPolicyTypesRequest(input *DescribeLoadBalancer // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1413,8 +1669,23 @@ func (c *ELB) DescribeLoadBalancersRequest(input *DescribeLoadBalancersInput) (r // Please also see 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) - err := req.Send() - return out, err + 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, @@ -1434,12 +1705,37 @@ func (c *ELB) DescribeLoadBalancers(input *DescribeLoadBalancersInput) (*Describ // return pageNum <= 3 // }) // -func (c *ELB) DescribeLoadBalancersPages(input *DescribeLoadBalancersInput, fn func(p *DescribeLoadBalancersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeLoadBalancersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeLoadBalancersOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeLoadBalancersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeTags = "DescribeTags" @@ -1503,8 +1799,23 @@ func (c *ELB) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Reques // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1576,8 +1887,23 @@ func (c *ELB) DetachLoadBalancerFromSubnetsRequest(input *DetachLoadBalancerFrom // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1654,8 +1980,23 @@ func (c *ELB) DisableAvailabilityZonesForLoadBalancerRequest(input *DisableAvail // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1726,8 +2067,23 @@ func (c *ELB) EnableAvailabilityZonesForLoadBalancerRequest(input *EnableAvailab // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1812,8 +2168,23 @@ func (c *ELB) ModifyLoadBalancerAttributesRequest(input *ModifyLoadBalancerAttri // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1902,8 +2273,23 @@ func (c *ELB) RegisterInstancesWithLoadBalancerRequest(input *RegisterInstancesW // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1967,8 +2353,23 @@ func (c *ELB) RemoveTagsRequest(input *RemoveTagsInput) (req *request.Request, o // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2052,8 +2453,23 @@ func (c *ELB) SetLoadBalancerListenerSSLCertificateRequest(input *SetLoadBalance // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2138,8 +2554,23 @@ func (c *ELB) SetLoadBalancerPoliciesForBackendServerRequest(input *SetLoadBalan // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2221,8 +2652,23 @@ func (c *ELB) SetLoadBalancerPoliciesOfListenerRequest(input *SetLoadBalancerPol // Please also see 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) - err := req.Send() - return out, err + 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. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/errors.go index aab5399871..97042c05a1 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elb diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/service.go index 68d7e2ac01..1c83ec5e99 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elb diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go index 89fc1d85b6..aa0d7e157a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elb/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elb import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilAnyInstanceInService uses the Elastic Load Balancing API operation @@ -11,26 +14,45 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *ELB) WaitUntilAnyInstanceInService(input *DescribeInstanceHealthInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstanceHealth", - Delay: 15, + 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, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAny", - Argument: "InstanceStates[].State", + 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...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceDeregistered uses the Elastic Load Balancing API operation @@ -38,32 +60,50 @@ func (c *ELB) WaitUntilAnyInstanceInService(input *DescribeInstanceHealthInput) // If the condition is not meet within the max attempt window an error will // be returned. func (c *ELB) WaitUntilInstanceDeregistered(input *DescribeInstanceHealthInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstanceHealth", - Delay: 15, + 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, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "InstanceStates[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "InstanceStates[].State", Expected: "OutOfService", }, { - State: "success", - Matcher: "error", - Argument: "", + 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...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceInService uses the Elastic Load Balancing API operation @@ -71,24 +111,43 @@ func (c *ELB) WaitUntilInstanceDeregistered(input *DescribeInstanceHealthInput) // If the condition is not meet within the max attempt window an error will // be returned. func (c *ELB) WaitUntilInstanceInService(input *DescribeInstanceHealthInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstanceHealth", - Delay: 15, + 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, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "InstanceStates[].State", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, 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...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go index 2098550c62..5a83828b2d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package elbv2 provides a client for Elastic Load Balancing. package elbv2 @@ -7,6 +7,7 @@ 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" ) @@ -88,8 +89,23 @@ func (c *ELBV2) AddTagsRequest(input *AddTagsInput) (req *request.Request, outpu // Please also see 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) - err := req.Send() - return out, err + 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" @@ -196,8 +212,23 @@ func (c *ELBV2) CreateListenerRequest(input *CreateListenerInput) (req *request. // Please also see 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) - err := req.Send() - return out, err + 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" @@ -272,7 +303,7 @@ func (c *ELBV2) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (req * // // Returned Error Codes: // * ErrCodeDuplicateLoadBalancerNameException "DuplicateLoadBalancerName" -// A load balancer with the specified name already exists for this account. +// A load balancer with the specified name already exists. // // * ErrCodeTooManyLoadBalancersException "TooManyLoadBalancers" // You've reached the limit on the number of load balancers for your AWS account. @@ -301,8 +332,23 @@ func (c *ELBV2) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (req * // Please also see 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) - err := req.Send() - return out, err + 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" @@ -399,8 +445,23 @@ func (c *ELBV2) CreateRuleRequest(input *CreateRuleInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -480,8 +541,23 @@ func (c *ELBV2) CreateTargetGroupRequest(input *CreateTargetGroupInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -548,8 +624,23 @@ func (c *ELBV2) DeleteListenerRequest(input *DeleteListenerInput) (req *request. // Please also see 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) - err := req.Send() - return out, err + 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" @@ -624,8 +715,23 @@ func (c *ELBV2) DeleteLoadBalancerRequest(input *DeleteLoadBalancerInput) (req * // Please also see 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) - err := req.Send() - return out, err + 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" @@ -692,8 +798,23 @@ func (c *ELBV2) DeleteRuleRequest(input *DeleteRuleInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -760,8 +881,23 @@ func (c *ELBV2) DeleteTargetGroupRequest(input *DeleteTargetGroupInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -831,8 +967,23 @@ func (c *ELBV2) DeregisterTargetsRequest(input *DeregisterTargetsInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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 opDescribeListeners = "DescribeListeners" @@ -906,8 +1057,23 @@ func (c *ELBV2) DescribeListenersRequest(input *DescribeListenersInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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, @@ -927,12 +1093,37 @@ func (c *ELBV2) DescribeListeners(input *DescribeListenersInput) (*DescribeListe // return pageNum <= 3 // }) // -func (c *ELBV2) DescribeListenersPages(input *DescribeListenersInput, fn func(p *DescribeListenersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeListenersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeListenersOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeListenersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeLoadBalancerAttributes = "DescribeLoadBalancerAttributes" @@ -996,8 +1187,23 @@ func (c *ELBV2) DescribeLoadBalancerAttributesRequest(input *DescribeLoadBalance // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1071,8 +1277,23 @@ func (c *ELBV2) DescribeLoadBalancersRequest(input *DescribeLoadBalancersInput) // Please also see 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) - err := req.Send() - return out, err + 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, @@ -1092,12 +1313,37 @@ func (c *ELBV2) DescribeLoadBalancers(input *DescribeLoadBalancersInput) (*Descr // return pageNum <= 3 // }) // -func (c *ELBV2) DescribeLoadBalancersPages(input *DescribeLoadBalancersInput, fn func(p *DescribeLoadBalancersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeLoadBalancersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeLoadBalancersOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeLoadBalancersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeRules = "DescribeRules" @@ -1165,8 +1411,23 @@ func (c *ELBV2) DescribeRulesRequest(input *DescribeRulesInput) (req *request.Re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1216,7 +1477,8 @@ func (c *ELBV2) DescribeSSLPoliciesRequest(input *DescribeSSLPoliciesInput) (req // // Describes the specified policies or all policies used for SSL negotiation. // -// Note that the only supported policy at this time is ELBSecurityPolicy-2015-05. +// For more information, see Security Policies (http://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies) +// 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 @@ -1232,8 +1494,23 @@ func (c *ELBV2) DescribeSSLPoliciesRequest(input *DescribeSSLPoliciesInput) (req // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1281,7 +1558,8 @@ func (c *ELBV2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Requ // DescribeTags API operation for Elastic Load Balancing. // -// Describes the tags for the specified resources. +// Describes the tags for the specified resources. You can describe the tags +// for one or more Application Load Balancers and 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 @@ -1306,8 +1584,23 @@ func (c *ELBV2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Requ // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1371,8 +1664,23 @@ func (c *ELBV2) DescribeTargetGroupAttributesRequest(input *DescribeTargetGroupA // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1451,8 +1759,23 @@ func (c *ELBV2) DescribeTargetGroupsRequest(input *DescribeTargetGroupsInput) (r // Please also see 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) - err := req.Send() - return out, err + 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, @@ -1472,12 +1795,37 @@ func (c *ELBV2) DescribeTargetGroups(input *DescribeTargetGroupsInput) (*Describ // return pageNum <= 3 // }) // -func (c *ELBV2) DescribeTargetGroupsPages(input *DescribeTargetGroupsInput, fn func(p *DescribeTargetGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeTargetGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeTargetGroupsOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeTargetGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeTargetHealth = "DescribeTargetHealth" @@ -1549,8 +1897,23 @@ func (c *ELBV2) DescribeTargetHealthRequest(input *DescribeTargetHealthInput) (r // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1603,7 +1966,7 @@ func (c *ELBV2) ModifyListenerRequest(input *ModifyListenerInput) (req *request. // Any properties that you do not specify retain their current values. However, // changing the protocol from HTTPS to HTTP removes the security policy and // SSL certificate properties. If you change the protocol from HTTP to HTTPS, -// you must add the security policy. +// you must add the security policy and server certificate. // // 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 @@ -1653,8 +2016,23 @@ func (c *ELBV2) ModifyListenerRequest(input *ModifyListenerInput) (req *request. // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1725,8 +2103,23 @@ func (c *ELBV2) ModifyLoadBalancerAttributesRequest(input *ModifyLoadBalancerAtt // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1804,8 +2197,23 @@ func (c *ELBV2) ModifyRuleRequest(input *ModifyRuleInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1872,8 +2280,23 @@ func (c *ELBV2) ModifyTargetGroupRequest(input *ModifyTargetGroupInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1937,8 +2360,23 @@ func (c *ELBV2) ModifyTargetGroupAttributesRequest(input *ModifyTargetGroupAttri // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2023,8 +2461,23 @@ func (c *ELBV2) RegisterTargetsRequest(input *RegisterTargetsInput) (req *reques // Please also see 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) - err := req.Send() - return out, err + 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 opRemoveTags = "RemoveTags" @@ -2102,8 +2555,23 @@ func (c *ELBV2) RemoveTagsRequest(input *RemoveTagsInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2174,8 +2642,23 @@ func (c *ELBV2) SetIpAddressTypeRequest(input *SetIpAddressTypeInput) (req *requ // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2249,8 +2732,23 @@ func (c *ELBV2) SetRulePrioritiesRequest(input *SetRulePrioritiesInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2322,8 +2820,23 @@ func (c *ELBV2) SetSecurityGroupsRequest(input *SetSecurityGroupsInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2397,8 +2910,23 @@ func (c *ELBV2) SetSubnetsRequest(input *SetSubnetsInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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. @@ -2778,7 +3306,7 @@ type CreateLoadBalancerInput struct { // The name of the load balancer. // - // This name must be unique within your AWS account, can have a maximum of 32 + // 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. // @@ -2920,10 +3448,25 @@ type CreateRuleInput struct { // Actions is a required field Actions []*Action `type:"list" required:"true"` - // A condition. Each condition has the field path-pattern and specifies one - // path pattern. A path pattern is case sensitive, can be up to 128 characters - // in length, and can contain any of the following characters. Note that you - // can include up to three wildcard characters in a path pattern. + // A condition. Each condition specifies a field name and a single value. + // + // If the field name is host-header, you can specify a single host name (for + // example, my.example.com). A host name is case insensitive, can be up to 128 + // characters in length, and can contain any of the following characters. Note + // that you can include up to three wildcard characters. + // + // * A-Z, a-z, 0-9 + // + // * - . + // + // * * (matches 0 or more characters) + // + // * ? (matches exactly 1 character) + // + // If the field name is path-pattern, you can specify a single path pattern. + // A path pattern is case sensitive, can be up to 128 characters in length, + // and can contain any of the following characters. Note that you can include + // up to three wildcard characters. // // * A-Z, a-z, 0-9 // @@ -3078,6 +3621,10 @@ type CreateTargetGroupInput struct { // 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"` @@ -3714,7 +4261,8 @@ func (s *DescribeLoadBalancerAttributesOutput) SetAttributes(v []*LoadBalancerAt type DescribeLoadBalancersInput struct { _ struct{} `type:"structure"` - // The Amazon Resource Names (ARN) of the load balancers. + // 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 @@ -4580,8 +5128,9 @@ func (s *LoadBalancerState) SetReason(v string) *LoadBalancerState { type Matcher struct { _ struct{} `type:"structure"` - // The HTTP codes. The default value is 200. You can specify multiple values - // (for example, "200,202") or a range of values (for example, "200-299"). + // The HTTP codes. You can specify values between 200 and 499. The default value + // is 200. You can specify multiple values (for example, "200,202") or a range + // of values (for example, "200-299"). // // HttpCode is a required field HttpCode *string `type:"string" required:"true"` @@ -4637,7 +5186,9 @@ type ModifyListenerInput struct { // The protocol for connections from clients to the load balancer. Protocol *string `type:"string" enum:"ProtocolEnum"` - // The security policy that defines which ciphers and protocols are supported. + // The security policy that defines which protocols and ciphers are supported. + // For more information, see Security Policies (http://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies) + // in the Application Load Balancers Guide. SslPolicy *string `type:"string"` } @@ -5355,14 +5906,28 @@ func (s *Rule) SetRuleArn(v string) *Rule { type RuleCondition struct { _ struct{} `type:"structure"` - // The only possible value is path-pattern. + // The name of the field. The possible values are host-header and path-pattern. Field *string `type:"string"` - // The path pattern. You can specify a single path pattern. + // The condition value. // - // A path pattern is case sensitive, can be up to 128 characters in length, - // and can contain any of the following characters. Note that you can include - // up to three wildcard characters in a path pattern. + // If the field name is host-header, you can specify a single host name (for + // example, my.example.com). A host name is case insensitive, can be up to 128 + // characters in length, and can contain any of the following characters. Note + // that you can include up to three wildcard characters. + // + // * A-Z, a-z, 0-9 + // + // * - . + // + // * * (matches 0 or more characters) + // + // * ? (matches exactly 1 character) + // + // If the field name is path-pattern, you can specify a single path pattern + // (for example, /img/*). A path pattern is case sensitive, can be up to 128 + // characters in length, and can contain any of the following characters. Note + // that you can include up to three wildcard characters. // // * A-Z, a-z, 0-9 // diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go index 4f49c2f225..da661ba2c0 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elbv2 @@ -19,7 +19,7 @@ const ( // ErrCodeDuplicateLoadBalancerNameException for service response error code // "DuplicateLoadBalancerName". // - // A load balancer with the specified name already exists for this account. + // A load balancer with the specified name already exists. ErrCodeDuplicateLoadBalancerNameException = "DuplicateLoadBalancerName" // ErrCodeDuplicateTagKeysException for service response error code diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go index 3e2e79a89e..57e0792450 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package elbv2 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go new file mode 100644 index 0000000000..a958d8ed30 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/elbv2/waiters.go @@ -0,0 +1,117 @@ +// 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 meet 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 meet 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) +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/api.go index f036a451a7..5fa88f5640 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package emr provides a client for Amazon Elastic MapReduce. package emr @@ -7,12 +7,99 @@ 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 opAddInstanceFleet = "AddInstanceFleet" + +// AddInstanceFleetRequest generates a "aws/request.Request" representing the +// client's request for the AddInstanceFleet operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See AddInstanceFleet for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the AddInstanceFleet method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the AddInstanceFleetRequest method. +// req, resp := client.AddInstanceFleetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddInstanceFleet +func (c *EMR) AddInstanceFleetRequest(input *AddInstanceFleetInput) (req *request.Request, output *AddInstanceFleetOutput) { + op := &request.Operation{ + Name: opAddInstanceFleet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &AddInstanceFleetInput{} + } + + output = &AddInstanceFleetOutput{} + req = c.newRequest(op, input, output) + return +} + +// AddInstanceFleet API operation for Amazon Elastic MapReduce. +// +// Adds an instance fleet to a running cluster. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x. +// +// 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 Amazon Elastic MapReduce's +// API operation AddInstanceFleet for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// This exception occurs when there is an internal failure in the EMR service. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// This exception occurs when there is something wrong with user input. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddInstanceFleet +func (c *EMR) AddInstanceFleet(input *AddInstanceFleetInput) (*AddInstanceFleetOutput, error) { + req, out := c.AddInstanceFleetRequest(input) + return out, req.Send() +} + +// AddInstanceFleetWithContext is the same as AddInstanceFleet with the addition of +// the ability to pass a context and additional request options. +// +// See AddInstanceFleet 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 *EMR) AddInstanceFleetWithContext(ctx aws.Context, input *AddInstanceFleetInput, opts ...request.Option) (*AddInstanceFleetOutput, error) { + req, out := c.AddInstanceFleetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opAddInstanceGroups = "AddInstanceGroups" // AddInstanceGroupsRequest generates a "aws/request.Request" representing the @@ -75,8 +162,23 @@ func (c *EMR) AddInstanceGroupsRequest(input *AddInstanceGroupsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddInstanceGroups func (c *EMR) AddInstanceGroups(input *AddInstanceGroupsInput) (*AddInstanceGroupsOutput, error) { req, out := c.AddInstanceGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddInstanceGroupsWithContext is the same as AddInstanceGroups with the addition of +// the ability to pass a context and additional request options. +// +// See AddInstanceGroups 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 *EMR) AddInstanceGroupsWithContext(ctx aws.Context, input *AddInstanceGroupsInput, opts ...request.Option) (*AddInstanceGroupsOutput, error) { + req, out := c.AddInstanceGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddJobFlowSteps = "AddJobFlowSteps" @@ -124,19 +226,19 @@ func (c *EMR) AddJobFlowStepsRequest(input *AddJobFlowStepsInput) (req *request. // AddJobFlowSteps API operation for Amazon Elastic MapReduce. // -// AddJobFlowSteps adds new steps to a running job flow. A maximum of 256 steps +// AddJobFlowSteps adds new steps to a running cluster. A maximum of 256 steps // are allowed in each job flow. // -// If your job flow is long-running (such as a Hive data warehouse) or complex, +// If your cluster is long-running (such as a Hive data warehouse) or complex, // you may require more than 256 steps to process your data. You can bypass -// the 256-step limitation in various ways, including using the SSH shell to -// connect to the master node and submitting queries directly to the software -// running on the master node, such as Hive and Hadoop. For more information -// on how to do this, see Add More than 256 Steps to a Job Flow (http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/AddMoreThan256Steps.html) -// in the Amazon EMR Developer's Guide. +// the 256-step limitation in various ways, including using SSH to connect to +// the master node and submitting queries directly to the software running on +// the master node, such as Hive and Hadoop. For more information on how to +// do this, see Add More than 256 Steps to a Cluster (http://docs.aws.amazon.com/ElasticMapReduce/latest/ManagementGuide/AddMoreThan256Steps.html) +// in the Amazon EMR Management Guide. // // A step specifies the location of a JAR file stored either on the master node -// of the job flow or in Amazon S3. Each step is performed by the main function +// of the cluster or in Amazon S3. Each step is performed by the main function // of the main class of the JAR file. The main class can be specified either // in the manifest of the JAR or by using the MainFunction parameter of the // step. @@ -145,7 +247,7 @@ func (c *EMR) AddJobFlowStepsRequest(input *AddJobFlowStepsInput) (req *request. // complete, the main function must exit with a zero exit code and all Hadoop // jobs started while the step was running must have completed and run successfully. // -// You can only add steps to a job flow that is in one of the following states: +// You can only add steps to a cluster that is in one of the following states: // STARTING, BOOTSTRAPPING, RUNNING, or WAITING. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -163,8 +265,23 @@ func (c *EMR) AddJobFlowStepsRequest(input *AddJobFlowStepsInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddJobFlowSteps func (c *EMR) AddJobFlowSteps(input *AddJobFlowStepsInput) (*AddJobFlowStepsOutput, error) { req, out := c.AddJobFlowStepsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddJobFlowStepsWithContext is the same as AddJobFlowSteps with the addition of +// the ability to pass a context and additional request options. +// +// See AddJobFlowSteps 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 *EMR) AddJobFlowStepsWithContext(ctx aws.Context, input *AddJobFlowStepsInput, opts ...request.Option) (*AddJobFlowStepsOutput, error) { + req, out := c.AddJobFlowStepsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddTags = "AddTags" @@ -234,8 +351,23 @@ func (c *EMR) AddTagsRequest(input *AddTagsInput) (req *request.Request, output // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddTags func (c *EMR) AddTags(input *AddTagsInput) (*AddTagsOutput, error) { req, out := c.AddTagsRequest(input) - err := req.Send() - return out, err + 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 *EMR) 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 opCancelSteps = "CancelSteps" @@ -307,8 +439,23 @@ func (c *EMR) CancelStepsRequest(input *CancelStepsInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/CancelSteps func (c *EMR) CancelSteps(input *CancelStepsInput) (*CancelStepsOutput, error) { req, out := c.CancelStepsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelStepsWithContext is the same as CancelSteps with the addition of +// the ability to pass a context and additional request options. +// +// See CancelSteps 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 *EMR) CancelStepsWithContext(ctx aws.Context, input *CancelStepsInput, opts ...request.Option) (*CancelStepsOutput, error) { + req, out := c.CancelStepsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSecurityConfiguration = "CreateSecurityConfiguration" @@ -376,8 +523,23 @@ func (c *EMR) CreateSecurityConfigurationRequest(input *CreateSecurityConfigurat // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/CreateSecurityConfiguration func (c *EMR) CreateSecurityConfiguration(input *CreateSecurityConfigurationInput) (*CreateSecurityConfigurationOutput, error) { req, out := c.CreateSecurityConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSecurityConfigurationWithContext is the same as CreateSecurityConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSecurityConfiguration 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 *EMR) CreateSecurityConfigurationWithContext(ctx aws.Context, input *CreateSecurityConfigurationInput, opts ...request.Option) (*CreateSecurityConfigurationOutput, error) { + req, out := c.CreateSecurityConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSecurityConfiguration = "DeleteSecurityConfiguration" @@ -444,8 +606,23 @@ func (c *EMR) DeleteSecurityConfigurationRequest(input *DeleteSecurityConfigurat // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DeleteSecurityConfiguration func (c *EMR) DeleteSecurityConfiguration(input *DeleteSecurityConfigurationInput) (*DeleteSecurityConfigurationOutput, error) { req, out := c.DeleteSecurityConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSecurityConfigurationWithContext is the same as DeleteSecurityConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSecurityConfiguration 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 *EMR) DeleteSecurityConfigurationWithContext(ctx aws.Context, input *DeleteSecurityConfigurationInput, opts ...request.Option) (*DeleteSecurityConfigurationOutput, error) { + req, out := c.DeleteSecurityConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCluster = "DescribeCluster" @@ -513,8 +690,23 @@ func (c *EMR) DescribeClusterRequest(input *DescribeClusterInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeCluster func (c *EMR) DescribeCluster(input *DescribeClusterInput) (*DescribeClusterOutput, error) { req, out := c.DescribeClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClusterWithContext is the same as DescribeCluster with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCluster 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 *EMR) DescribeClusterWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.Option) (*DescribeClusterOutput, error) { + req, out := c.DescribeClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeJobFlows = "DescribeJobFlows" @@ -601,8 +793,23 @@ func (c *EMR) DescribeJobFlowsRequest(input *DescribeJobFlowsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeJobFlows func (c *EMR) DescribeJobFlows(input *DescribeJobFlowsInput) (*DescribeJobFlowsOutput, error) { req, out := c.DescribeJobFlowsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeJobFlowsWithContext is the same as DescribeJobFlows with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeJobFlows 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 *EMR) DescribeJobFlowsWithContext(ctx aws.Context, input *DescribeJobFlowsInput, opts ...request.Option) (*DescribeJobFlowsOutput, error) { + req, out := c.DescribeJobFlowsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSecurityConfiguration = "DescribeSecurityConfiguration" @@ -670,8 +877,23 @@ func (c *EMR) DescribeSecurityConfigurationRequest(input *DescribeSecurityConfig // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeSecurityConfiguration func (c *EMR) DescribeSecurityConfiguration(input *DescribeSecurityConfigurationInput) (*DescribeSecurityConfigurationOutput, error) { req, out := c.DescribeSecurityConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSecurityConfigurationWithContext is the same as DescribeSecurityConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSecurityConfiguration 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 *EMR) DescribeSecurityConfigurationWithContext(ctx aws.Context, input *DescribeSecurityConfigurationInput, opts ...request.Option) (*DescribeSecurityConfigurationOutput, error) { + req, out := c.DescribeSecurityConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStep = "DescribeStep" @@ -738,8 +960,23 @@ func (c *EMR) DescribeStepRequest(input *DescribeStepInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeStep func (c *EMR) DescribeStep(input *DescribeStepInput) (*DescribeStepOutput, error) { req, out := c.DescribeStepRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStepWithContext is the same as DescribeStep with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStep 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 *EMR) DescribeStepWithContext(ctx aws.Context, input *DescribeStepInput, opts ...request.Option) (*DescribeStepOutput, error) { + req, out := c.DescribeStepRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBootstrapActions = "ListBootstrapActions" @@ -812,8 +1049,23 @@ func (c *EMR) ListBootstrapActionsRequest(input *ListBootstrapActionsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListBootstrapActions func (c *EMR) ListBootstrapActions(input *ListBootstrapActionsInput) (*ListBootstrapActionsOutput, error) { req, out := c.ListBootstrapActionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBootstrapActionsWithContext is the same as ListBootstrapActions with the addition of +// the ability to pass a context and additional request options. +// +// See ListBootstrapActions 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 *EMR) ListBootstrapActionsWithContext(ctx aws.Context, input *ListBootstrapActionsInput, opts ...request.Option) (*ListBootstrapActionsOutput, error) { + req, out := c.ListBootstrapActionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListBootstrapActionsPages iterates over the pages of a ListBootstrapActions operation, @@ -833,12 +1085,37 @@ func (c *EMR) ListBootstrapActions(input *ListBootstrapActionsInput) (*ListBoots // return pageNum <= 3 // }) // -func (c *EMR) ListBootstrapActionsPages(input *ListBootstrapActionsInput, fn func(p *ListBootstrapActionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListBootstrapActionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListBootstrapActionsOutput), lastPage) - }) +func (c *EMR) ListBootstrapActionsPages(input *ListBootstrapActionsInput, fn func(*ListBootstrapActionsOutput, bool) bool) error { + return c.ListBootstrapActionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListBootstrapActionsPagesWithContext same as ListBootstrapActionsPages 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 *EMR) ListBootstrapActionsPagesWithContext(ctx aws.Context, input *ListBootstrapActionsInput, fn func(*ListBootstrapActionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListBootstrapActionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListBootstrapActionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListBootstrapActionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListClusters = "ListClusters" @@ -915,8 +1192,23 @@ func (c *EMR) ListClustersRequest(input *ListClustersInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListClusters func (c *EMR) ListClusters(input *ListClustersInput) (*ListClustersOutput, error) { req, out := c.ListClustersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListClustersWithContext is the same as ListClusters with the addition of +// the ability to pass a context and additional request options. +// +// See ListClusters 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 *EMR) ListClustersWithContext(ctx aws.Context, input *ListClustersInput, opts ...request.Option) (*ListClustersOutput, error) { + req, out := c.ListClustersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListClustersPages iterates over the pages of a ListClusters operation, @@ -936,12 +1228,179 @@ func (c *EMR) ListClusters(input *ListClustersInput) (*ListClustersOutput, error // return pageNum <= 3 // }) // -func (c *EMR) ListClustersPages(input *ListClustersInput, fn func(p *ListClustersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListClustersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListClustersOutput), lastPage) - }) +func (c *EMR) ListClustersPages(input *ListClustersInput, fn func(*ListClustersOutput, bool) bool) error { + return c.ListClustersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListClustersPagesWithContext same as ListClustersPages 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 *EMR) ListClustersPagesWithContext(ctx aws.Context, input *ListClustersInput, fn func(*ListClustersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListClustersOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListInstanceFleets = "ListInstanceFleets" + +// ListInstanceFleetsRequest generates a "aws/request.Request" representing the +// client's request for the ListInstanceFleets operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListInstanceFleets for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListInstanceFleets method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListInstanceFleetsRequest method. +// req, resp := client.ListInstanceFleetsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceFleets +func (c *EMR) ListInstanceFleetsRequest(input *ListInstanceFleetsInput) (req *request.Request, output *ListInstanceFleetsOutput) { + op := &request.Operation{ + Name: opListInstanceFleets, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"Marker"}, + OutputTokens: []string{"Marker"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListInstanceFleetsInput{} + } + + output = &ListInstanceFleetsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListInstanceFleets API operation for Amazon Elastic MapReduce. +// +// Lists all available details about the instance fleets in a cluster. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// +// 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 Amazon Elastic MapReduce's +// API operation ListInstanceFleets for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// This exception occurs when there is an internal failure in the EMR service. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// This exception occurs when there is something wrong with user input. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceFleets +func (c *EMR) ListInstanceFleets(input *ListInstanceFleetsInput) (*ListInstanceFleetsOutput, error) { + req, out := c.ListInstanceFleetsRequest(input) + return out, req.Send() +} + +// ListInstanceFleetsWithContext is the same as ListInstanceFleets with the addition of +// the ability to pass a context and additional request options. +// +// See ListInstanceFleets 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 *EMR) ListInstanceFleetsWithContext(ctx aws.Context, input *ListInstanceFleetsInput, opts ...request.Option) (*ListInstanceFleetsOutput, error) { + req, out := c.ListInstanceFleetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListInstanceFleetsPages iterates over the pages of a ListInstanceFleets operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListInstanceFleets 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 ListInstanceFleets operation. +// pageNum := 0 +// err := client.ListInstanceFleetsPages(params, +// func(page *ListInstanceFleetsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *EMR) ListInstanceFleetsPages(input *ListInstanceFleetsInput, fn func(*ListInstanceFleetsOutput, bool) bool) error { + return c.ListInstanceFleetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListInstanceFleetsPagesWithContext same as ListInstanceFleetsPages 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 *EMR) ListInstanceFleetsPagesWithContext(ctx aws.Context, input *ListInstanceFleetsInput, fn func(*ListInstanceFleetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListInstanceFleetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListInstanceFleetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListInstanceFleetsOutput), !p.HasNextPage()) + } + return p.Err() } const opListInstanceGroups = "ListInstanceGroups" @@ -1014,8 +1473,23 @@ func (c *EMR) ListInstanceGroupsRequest(input *ListInstanceGroupsInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceGroups func (c *EMR) ListInstanceGroups(input *ListInstanceGroupsInput) (*ListInstanceGroupsOutput, error) { req, out := c.ListInstanceGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListInstanceGroupsWithContext is the same as ListInstanceGroups with the addition of +// the ability to pass a context and additional request options. +// +// See ListInstanceGroups 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 *EMR) ListInstanceGroupsWithContext(ctx aws.Context, input *ListInstanceGroupsInput, opts ...request.Option) (*ListInstanceGroupsOutput, error) { + req, out := c.ListInstanceGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListInstanceGroupsPages iterates over the pages of a ListInstanceGroups operation, @@ -1035,12 +1509,37 @@ func (c *EMR) ListInstanceGroups(input *ListInstanceGroupsInput) (*ListInstanceG // return pageNum <= 3 // }) // -func (c *EMR) ListInstanceGroupsPages(input *ListInstanceGroupsInput, fn func(p *ListInstanceGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListInstanceGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListInstanceGroupsOutput), lastPage) - }) +func (c *EMR) ListInstanceGroupsPages(input *ListInstanceGroupsInput, fn func(*ListInstanceGroupsOutput, bool) bool) error { + return c.ListInstanceGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListInstanceGroupsPagesWithContext same as ListInstanceGroupsPages 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 *EMR) ListInstanceGroupsPagesWithContext(ctx aws.Context, input *ListInstanceGroupsInput, fn func(*ListInstanceGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListInstanceGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListInstanceGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListInstanceGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opListInstances = "ListInstances" @@ -1117,8 +1616,23 @@ func (c *EMR) ListInstancesRequest(input *ListInstancesInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstances func (c *EMR) ListInstances(input *ListInstancesInput) (*ListInstancesOutput, error) { req, out := c.ListInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListInstancesWithContext is the same as ListInstances with the addition of +// the ability to pass a context and additional request options. +// +// See ListInstances 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 *EMR) ListInstancesWithContext(ctx aws.Context, input *ListInstancesInput, opts ...request.Option) (*ListInstancesOutput, error) { + req, out := c.ListInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListInstancesPages iterates over the pages of a ListInstances operation, @@ -1138,12 +1652,37 @@ func (c *EMR) ListInstances(input *ListInstancesInput) (*ListInstancesOutput, er // return pageNum <= 3 // }) // -func (c *EMR) ListInstancesPages(input *ListInstancesInput, fn func(p *ListInstancesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListInstancesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListInstancesOutput), lastPage) - }) +func (c *EMR) ListInstancesPages(input *ListInstancesInput, fn func(*ListInstancesOutput, bool) bool) error { + return c.ListInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListInstancesPagesWithContext same as ListInstancesPages 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 *EMR) ListInstancesPagesWithContext(ctx aws.Context, input *ListInstancesInput, fn func(*ListInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListInstancesOutput), !p.HasNextPage()) + } + return p.Err() } const opListSecurityConfigurations = "ListSecurityConfigurations" @@ -1213,8 +1752,23 @@ func (c *EMR) ListSecurityConfigurationsRequest(input *ListSecurityConfiguration // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListSecurityConfigurations func (c *EMR) ListSecurityConfigurations(input *ListSecurityConfigurationsInput) (*ListSecurityConfigurationsOutput, error) { req, out := c.ListSecurityConfigurationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSecurityConfigurationsWithContext is the same as ListSecurityConfigurations with the addition of +// the ability to pass a context and additional request options. +// +// See ListSecurityConfigurations 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 *EMR) ListSecurityConfigurationsWithContext(ctx aws.Context, input *ListSecurityConfigurationsInput, opts ...request.Option) (*ListSecurityConfigurationsOutput, error) { + req, out := c.ListSecurityConfigurationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListSteps = "ListSteps" @@ -1288,8 +1842,23 @@ func (c *EMR) ListStepsRequest(input *ListStepsInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListSteps func (c *EMR) ListSteps(input *ListStepsInput) (*ListStepsOutput, error) { req, out := c.ListStepsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListStepsWithContext is the same as ListSteps with the addition of +// the ability to pass a context and additional request options. +// +// See ListSteps 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 *EMR) ListStepsWithContext(ctx aws.Context, input *ListStepsInput, opts ...request.Option) (*ListStepsOutput, error) { + req, out := c.ListStepsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListStepsPages iterates over the pages of a ListSteps operation, @@ -1309,20 +1878,135 @@ func (c *EMR) ListSteps(input *ListStepsInput) (*ListStepsOutput, error) { // return pageNum <= 3 // }) // -func (c *EMR) ListStepsPages(input *ListStepsInput, fn func(p *ListStepsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListStepsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListStepsOutput), lastPage) - }) +func (c *EMR) ListStepsPages(input *ListStepsInput, fn func(*ListStepsOutput, bool) bool) error { + return c.ListStepsPagesWithContext(aws.BackgroundContext(), input, fn) } -const opModifyInstanceGroups = "ModifyInstanceGroups" - -// ModifyInstanceGroupsRequest generates a "aws/request.Request" representing the -// client's request for the ModifyInstanceGroups operation. The "output" return -// value can be used to capture response data after the request's "Send" method -// is called. +// ListStepsPagesWithContext same as ListStepsPages 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 *EMR) ListStepsPagesWithContext(ctx aws.Context, input *ListStepsInput, fn func(*ListStepsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListStepsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListStepsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListStepsOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opModifyInstanceFleet = "ModifyInstanceFleet" + +// ModifyInstanceFleetRequest generates a "aws/request.Request" representing the +// client's request for the ModifyInstanceFleet operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ModifyInstanceFleet for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ModifyInstanceFleet method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ModifyInstanceFleetRequest method. +// req, resp := client.ModifyInstanceFleetRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceFleet +func (c *EMR) ModifyInstanceFleetRequest(input *ModifyInstanceFleetInput) (req *request.Request, output *ModifyInstanceFleetOutput) { + op := &request.Operation{ + Name: opModifyInstanceFleet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyInstanceFleetInput{} + } + + output = &ModifyInstanceFleetOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// ModifyInstanceFleet API operation for Amazon Elastic MapReduce. +// +// Modifies the target On-Demand and target Spot capacities for the instance +// fleet with the specified InstanceFleetID within the cluster specified using +// ClusterID. The call either succeeds or fails atomically. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// +// 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 Amazon Elastic MapReduce's +// API operation ModifyInstanceFleet for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// This exception occurs when there is an internal failure in the EMR service. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// This exception occurs when there is something wrong with user input. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceFleet +func (c *EMR) ModifyInstanceFleet(input *ModifyInstanceFleetInput) (*ModifyInstanceFleetOutput, error) { + req, out := c.ModifyInstanceFleetRequest(input) + return out, req.Send() +} + +// ModifyInstanceFleetWithContext is the same as ModifyInstanceFleet with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyInstanceFleet 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 *EMR) ModifyInstanceFleetWithContext(ctx aws.Context, input *ModifyInstanceFleetInput, opts ...request.Option) (*ModifyInstanceFleetOutput, error) { + req, out := c.ModifyInstanceFleetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opModifyInstanceGroups = "ModifyInstanceGroups" + +// ModifyInstanceGroupsRequest generates a "aws/request.Request" representing the +// client's request for the ModifyInstanceGroups operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. // // See ModifyInstanceGroups for usage and error information. // @@ -1384,8 +2068,23 @@ func (c *EMR) ModifyInstanceGroupsRequest(input *ModifyInstanceGroupsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceGroups func (c *EMR) ModifyInstanceGroups(input *ModifyInstanceGroupsInput) (*ModifyInstanceGroupsOutput, error) { req, out := c.ModifyInstanceGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyInstanceGroupsWithContext is the same as ModifyInstanceGroups with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyInstanceGroups 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 *EMR) ModifyInstanceGroupsWithContext(ctx aws.Context, input *ModifyInstanceGroupsInput, opts ...request.Option) (*ModifyInstanceGroupsOutput, error) { + req, out := c.ModifyInstanceGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutAutoScalingPolicy = "PutAutoScalingPolicy" @@ -1447,8 +2146,23 @@ func (c *EMR) PutAutoScalingPolicyRequest(input *PutAutoScalingPolicyInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/PutAutoScalingPolicy func (c *EMR) PutAutoScalingPolicy(input *PutAutoScalingPolicyInput) (*PutAutoScalingPolicyOutput, error) { req, out := c.PutAutoScalingPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutAutoScalingPolicyWithContext is the same as PutAutoScalingPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutAutoScalingPolicy 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 *EMR) PutAutoScalingPolicyWithContext(ctx aws.Context, input *PutAutoScalingPolicyInput, opts ...request.Option) (*PutAutoScalingPolicyOutput, error) { + req, out := c.PutAutoScalingPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveAutoScalingPolicy = "RemoveAutoScalingPolicy" @@ -1508,8 +2222,23 @@ func (c *EMR) RemoveAutoScalingPolicyRequest(input *RemoveAutoScalingPolicyInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/RemoveAutoScalingPolicy func (c *EMR) RemoveAutoScalingPolicy(input *RemoveAutoScalingPolicyInput) (*RemoveAutoScalingPolicyOutput, error) { req, out := c.RemoveAutoScalingPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveAutoScalingPolicyWithContext is the same as RemoveAutoScalingPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveAutoScalingPolicy 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 *EMR) RemoveAutoScalingPolicyWithContext(ctx aws.Context, input *RemoveAutoScalingPolicyInput, opts ...request.Option) (*RemoveAutoScalingPolicyOutput, error) { + req, out := c.RemoveAutoScalingPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTags = "RemoveTags" @@ -1581,8 +2310,23 @@ func (c *EMR) RemoveTagsRequest(input *RemoveTagsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/RemoveTags func (c *EMR) RemoveTags(input *RemoveTagsInput) (*RemoveTagsOutput, error) { req, out := c.RemoveTagsRequest(input) - err := req.Send() - return out, err + 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 *EMR) 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 opRunJobFlow = "RunJobFlow" @@ -1630,30 +2374,34 @@ func (c *EMR) RunJobFlowRequest(input *RunJobFlowInput) (req *request.Request, o // RunJobFlow API operation for Amazon Elastic MapReduce. // -// RunJobFlow creates and starts running a new job flow. The job flow will run -// the steps specified. After the job flow completes, the cluster is stopped -// and the HDFS partition is lost. To prevent loss of data, configure the last -// step of the job flow to store results in Amazon S3. If the JobFlowInstancesConfigKeepJobFlowAliveWhenNoSteps -// parameter is set to TRUE, the job flow will transition to the WAITING state -// rather than shutting down after the steps have completed. +// RunJobFlow creates and starts running a new cluster (job flow). The cluster +// runs the steps specified. After the steps complete, the cluster stops and +// the HDFS partition is lost. To prevent loss of data, configure the last step +// of the job flow to store results in Amazon S3. If the JobFlowInstancesConfigKeepJobFlowAliveWhenNoSteps +// parameter is set to TRUE, the cluster transitions to the WAITING state rather +// than shutting down after the steps have completed. // // For additional protection, you can set the JobFlowInstancesConfigTerminationProtected -// parameter to TRUE to lock the job flow and prevent it from being terminated +// parameter to TRUE to lock the cluster and prevent it from being terminated // by API call, user intervention, or in the event of a job flow error. // // A maximum of 256 steps are allowed in each job flow. // -// If your job flow is long-running (such as a Hive data warehouse) or complex, +// If your cluster is long-running (such as a Hive data warehouse) or complex, // you may require more than 256 steps to process your data. You can bypass // the 256-step limitation in various ways, including using the SSH shell to // connect to the master node and submitting queries directly to the software // running on the master node, such as Hive and Hadoop. For more information -// on how to do this, see Add More than 256 Steps to a Job Flow (http://docs.aws.amazon.com/ElasticMapReduce/latest/Management/Guide/AddMoreThan256Steps.html) +// on how to do this, see Add More than 256 Steps to a Cluster (http://docs.aws.amazon.com/ElasticMapReduce/latest/Management/Guide/AddMoreThan256Steps.html) // in the Amazon EMR Management Guide. // -// For long running job flows, we recommend that you periodically store your +// For long running clusters, we recommend that you periodically store your // results. // +// The instance fleets configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. The RunJobFlow request can contain +// InstanceFleets parameters or InstanceGroups parameters, but not both. +// // 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. @@ -1669,8 +2417,23 @@ func (c *EMR) RunJobFlowRequest(input *RunJobFlowInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/RunJobFlow func (c *EMR) RunJobFlow(input *RunJobFlowInput) (*RunJobFlowOutput, error) { req, out := c.RunJobFlowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RunJobFlowWithContext is the same as RunJobFlow with the addition of +// the ability to pass a context and additional request options. +// +// See RunJobFlow 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 *EMR) RunJobFlowWithContext(ctx aws.Context, input *RunJobFlowInput, opts ...request.Option) (*RunJobFlowOutput, error) { + req, out := c.RunJobFlowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetTerminationProtection = "SetTerminationProtection" @@ -1720,23 +2483,23 @@ func (c *EMR) SetTerminationProtectionRequest(input *SetTerminationProtectionInp // SetTerminationProtection API operation for Amazon Elastic MapReduce. // -// SetTerminationProtection locks a job flow so the EC2 instances in the cluster -// cannot be terminated by user intervention, an API call, or in the event of -// a job-flow error. The cluster still terminates upon successful completion -// of the job flow. Calling SetTerminationProtection on a job flow is analogous -// to calling the Amazon EC2 DisableAPITermination API on all of the EC2 instances -// in a cluster. +// SetTerminationProtection locks a cluster (job flow) so the EC2 instances +// in the cluster cannot be terminated by user intervention, an API call, or +// in the event of a job-flow error. The cluster still terminates upon successful +// completion of the job flow. Calling SetTerminationProtection on a cluster +// is similar to calling the Amazon EC2 DisableAPITermination API on all EC2 +// instances in a cluster. // -// SetTerminationProtection is used to prevent accidental termination of a job -// flow and to ensure that in the event of an error, the instances will persist -// so you can recover any data stored in their ephemeral instance storage. +// SetTerminationProtection is used to prevent accidental termination of a cluster +// and to ensure that in the event of an error, the instances persist so that +// you can recover any data stored in their ephemeral instance storage. // -// To terminate a job flow that has been locked by setting SetTerminationProtection +// To terminate a cluster that has been locked by setting SetTerminationProtection // to true, you must first unlock the job flow by a subsequent call to SetTerminationProtection // in which you set the value to false. // -// For more information, seeProtecting a Job Flow from Termination (http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_TerminationProtection.html) -// in the Amazon EMR Guide. +// For more information, seeManaging Cluster Termination (http://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html) +// in the Amazon EMR Management 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 @@ -1753,8 +2516,23 @@ func (c *EMR) SetTerminationProtectionRequest(input *SetTerminationProtectionInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/SetTerminationProtection func (c *EMR) SetTerminationProtection(input *SetTerminationProtectionInput) (*SetTerminationProtectionOutput, error) { req, out := c.SetTerminationProtectionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetTerminationProtectionWithContext is the same as SetTerminationProtection with the addition of +// the ability to pass a context and additional request options. +// +// See SetTerminationProtection 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 *EMR) SetTerminationProtectionWithContext(ctx aws.Context, input *SetTerminationProtectionInput, opts ...request.Option) (*SetTerminationProtectionOutput, error) { + req, out := c.SetTerminationProtectionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetVisibleToAllUsers = "SetVisibleToAllUsers" @@ -1805,11 +2583,11 @@ func (c *EMR) SetVisibleToAllUsersRequest(input *SetVisibleToAllUsersInput) (req // SetVisibleToAllUsers API operation for Amazon Elastic MapReduce. // // Sets whether all AWS Identity and Access Management (IAM) users under your -// account can access the specified job flows. This action works on running -// job flows. You can also set the visibility of a job flow when you launch -// it using the VisibleToAllUsers parameter of RunJobFlow. The SetVisibleToAllUsers -// action can be called only by an IAM user who created the job flow or the -// AWS account that owns the job flow. +// account can access the specified clusters (job flows). This action works +// on running clusters. You can also set the visibility of a cluster when you +// launch it using the VisibleToAllUsers parameter of RunJobFlow. The SetVisibleToAllUsers +// action can be called only by an IAM user who created the cluster or the AWS +// account that owns the cluster. // // 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 @@ -1826,8 +2604,23 @@ func (c *EMR) SetVisibleToAllUsersRequest(input *SetVisibleToAllUsersInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/SetVisibleToAllUsers func (c *EMR) SetVisibleToAllUsers(input *SetVisibleToAllUsersInput) (*SetVisibleToAllUsersOutput, error) { req, out := c.SetVisibleToAllUsersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetVisibleToAllUsersWithContext is the same as SetVisibleToAllUsers with the addition of +// the ability to pass a context and additional request options. +// +// See SetVisibleToAllUsers 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 *EMR) SetVisibleToAllUsersWithContext(ctx aws.Context, input *SetVisibleToAllUsersInput, opts ...request.Option) (*SetVisibleToAllUsersOutput, error) { + req, out := c.SetVisibleToAllUsersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTerminateJobFlows = "TerminateJobFlows" @@ -1877,14 +2670,15 @@ func (c *EMR) TerminateJobFlowsRequest(input *TerminateJobFlowsInput) (req *requ // TerminateJobFlows API operation for Amazon Elastic MapReduce. // -// TerminateJobFlows shuts a list of job flows down. When a job flow is shut -// down, any step not yet completed is canceled and the EC2 instances on which -// the job flow is running are stopped. Any log files not already saved are -// uploaded to Amazon S3 if a LogUri was specified when the job flow was created. +// TerminateJobFlows shuts a list of clusters (job flows) down. When a job flow +// is shut down, any step not yet completed is canceled and the EC2 instances +// on which the cluster is running are stopped. Any log files not already saved +// are uploaded to Amazon S3 if a LogUri was specified when the cluster was +// created. // -// The maximum number of JobFlows allowed is 10. The call to TerminateJobFlows -// is asynchronous. Depending on the configuration of the job flow, it may take -// up to 1-5 minutes for the job flow to completely terminate and release allocated +// The maximum number of clusters allowed is 10. The call to TerminateJobFlows +// is asynchronous. Depending on the configuration of the cluster, it may take +// up to 1-5 minutes for the cluster to completely terminate and release allocated // resources, such as Amazon EC2 instances. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1902,8 +2696,114 @@ func (c *EMR) TerminateJobFlowsRequest(input *TerminateJobFlowsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/TerminateJobFlows func (c *EMR) TerminateJobFlows(input *TerminateJobFlowsInput) (*TerminateJobFlowsOutput, error) { req, out := c.TerminateJobFlowsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TerminateJobFlowsWithContext is the same as TerminateJobFlows with the addition of +// the ability to pass a context and additional request options. +// +// See TerminateJobFlows 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 *EMR) TerminateJobFlowsWithContext(ctx aws.Context, input *TerminateJobFlowsInput, opts ...request.Option) (*TerminateJobFlowsOutput, error) { + req, out := c.TerminateJobFlowsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddInstanceFleetInput +type AddInstanceFleetInput struct { + _ struct{} `type:"structure"` + + // The unique identifier of the cluster. + // + // ClusterId is a required field + ClusterId *string `type:"string" required:"true"` + + // Specifies the configuration of the instance fleet. + // + // InstanceFleet is a required field + InstanceFleet *InstanceFleetConfig `type:"structure" required:"true"` +} + +// String returns the string representation +func (s AddInstanceFleetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AddInstanceFleetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AddInstanceFleetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AddInstanceFleetInput"} + if s.ClusterId == nil { + invalidParams.Add(request.NewErrParamRequired("ClusterId")) + } + if s.InstanceFleet == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceFleet")) + } + if s.InstanceFleet != nil { + if err := s.InstanceFleet.Validate(); err != nil { + invalidParams.AddNested("InstanceFleet", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClusterId sets the ClusterId field's value. +func (s *AddInstanceFleetInput) SetClusterId(v string) *AddInstanceFleetInput { + s.ClusterId = &v + return s +} + +// SetInstanceFleet sets the InstanceFleet field's value. +func (s *AddInstanceFleetInput) SetInstanceFleet(v *InstanceFleetConfig) *AddInstanceFleetInput { + s.InstanceFleet = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddInstanceFleetOutput +type AddInstanceFleetOutput struct { + _ struct{} `type:"structure"` + + // The unique identifier of the cluster. + ClusterId *string `type:"string"` + + // The unique identifier of the instance fleet. + InstanceFleetId *string `type:"string"` +} + +// String returns the string representation +func (s AddInstanceFleetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AddInstanceFleetOutput) GoString() string { + return s.String() +} + +// SetClusterId sets the ClusterId field's value. +func (s *AddInstanceFleetOutput) SetClusterId(v string) *AddInstanceFleetOutput { + s.ClusterId = &v + return s +} + +// SetInstanceFleetId sets the InstanceFleetId field's value. +func (s *AddInstanceFleetOutput) SetInstanceFleetId(v string) *AddInstanceFleetOutput { + s.InstanceFleetId = &v + return s } // Input to an AddInstanceGroups call. @@ -2172,16 +3072,16 @@ func (s AddTagsOutput) GoString() string { // the cluster. This structure contains a list of strings that indicates the // software to use with the cluster and accepts a user argument list. Amazon // EMR accepts and forwards the argument list to the corresponding installation -// script as bootstrap action argument. For more information, see Launch a Job -// Flow on the MapR Distribution for Hadoop (http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-mapr.html). +// script as bootstrap action argument. For more information, see Using the +// MapR Distribution for Hadoop (http://docs.aws.amazon.com/ElasticMapReduce/latest/ManagementGuide/emr-mapr.html). // Currently supported values are: // -// * "mapr-m3" - launch the job flow using MapR M3 Edition. +// * "mapr-m3" - launch the cluster using MapR M3 Edition. // -// * "mapr-m5" - launch the job flow using MapR M5 Edition. +// * "mapr-m5" - launch the cluster using MapR M5 Edition. // // * "mapr" with the user arguments specifying "--edition,m3" or "--edition,m5" -// - launch the job flow using MapR M3 or M5 Edition, respectively. +// - launch the cluster using MapR M3 or M5 Edition, respectively. // // In Amazon EMR releases 4.0 and greater, the only accepted parameter is the // application name. To pass arguments to applications, you supply a configuration @@ -2368,7 +3268,7 @@ type AutoScalingPolicyStateChangeReason struct { // The code indicating the reason for the change in status.USER_REQUEST indicates // that the scaling policy status was changed by a user. PROVISION_FAILURE indicates // that the status change was because the policy failed to provision. CLEANUP_FAILURE - // indicates something unclean happened.--> + // indicates an error. Code *string `type:"string" enum:"AutoScalingPolicyStateChangeReasonCode"` // A friendly, more verbose message that accompanies an automatic scaling policy @@ -2403,6 +3303,7 @@ func (s *AutoScalingPolicyStateChangeReason) SetMessage(v string) *AutoScalingPo type AutoScalingPolicyStatus struct { _ struct{} `type:"structure"` + // Indicates the status of the automatic scaling policy. State *string `type:"string" enum:"AutoScalingPolicyState"` // The reason for a change in status. @@ -2490,7 +3391,7 @@ func (s *BootstrapActionConfig) SetScriptBootstrapAction(v *ScriptBootstrapActio return s } -// Reports the configuration of a bootstrap action in a job flow. +// Reports the configuration of a bootstrap action in a cluster (job flow). // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/BootstrapActionDetail type BootstrapActionDetail struct { _ struct{} `type:"structure"` @@ -2515,14 +3416,19 @@ func (s *BootstrapActionDetail) SetBootstrapActionConfig(v *BootstrapActionConfi return s } +// Specification of the status of a CancelSteps request. Available only in Amazon +// EMR version 4.8.0 and later, excluding version 5.0.0. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/CancelStepsInfo type CancelStepsInfo struct { _ struct{} `type:"structure"` + // The reason for the failure if the CancelSteps request fails. Reason *string `type:"string"` + // The status of a CancelSteps Request. The value may be SUBMITTED or FAILED. Status *string `type:"string" enum:"CancelStepsRequestStatus"` + // The encrypted StepId of a step. StepId *string `type:"string"` } @@ -2781,6 +3687,14 @@ type Cluster struct { // The unique identifier for the cluster. Id *string `type:"string"` + // The instance fleet configuration is available only in Amazon EMR versions + // 4.8.0 and later, excluding 5.0.x versions. + // + // The instance group configuration of the cluster. A value of INSTANCE_GROUP + // indicates a uniform instance group configuration. A value of INSTANCE_FLEET + // indicates an instance fleets configuration. + InstanceCollectionType *string `type:"string" enum:"InstanceCollectionType"` + // The path to the Amazon S3 location where logs for this cluster are stored. LogUri *string `type:"string"` @@ -2790,7 +3704,7 @@ type Cluster struct { // The name of the cluster. Name *string `type:"string"` - // An approximation of the cost of the job flow, represented in m1.small/hours. + // An approximation of the cost of the cluster, represented in m1.small/hours. // This value is incremented one time for every hour an m1.small instance runs. // Larger instances are weighted more, so an EC2 instance that is roughly four // times more expensive would result in the normalized instance hours being @@ -2840,9 +3754,9 @@ type Cluster struct { // of a cluster error. TerminationProtected *bool `type:"boolean"` - // Indicates whether the job flow is visible to all IAM users of the AWS account - // associated with the job flow. If this value is set to true, all IAM users - // of that AWS account can view and manage the job flow if they have the proper + // Indicates whether the cluster is visible to all IAM users of the AWS account + // associated with the cluster. If this value is set to true, all IAM users + // of that AWS account can view and manage the cluster if they have the proper // policy permissions set. If this value is false, only the IAM user that created // the cluster can view and manage it. This value can be changed using the SetVisibleToAllUsers // action. @@ -2895,6 +3809,12 @@ func (s *Cluster) SetId(v string) *Cluster { return s } +// SetInstanceCollectionType sets the InstanceCollectionType field's value. +func (s *Cluster) SetInstanceCollectionType(v string) *Cluster { + s.InstanceCollectionType = &v + return s +} + // SetLogUri sets the LogUri field's value. func (s *Cluster) SetLogUri(v string) *Cluster { s.LogUri = &v @@ -3068,7 +3988,7 @@ type ClusterSummary struct { // The name of the cluster. Name *string `type:"string"` - // An approximation of the cost of the job flow, represented in m1.small/hours. + // An approximation of the cost of the cluster, represented in m1.small/hours. // This value is incremented one time for every hour an m1.small instance runs. // Larger instances are weighted more, so an EC2 instance that is roughly four // times more expensive would result in the normalized instance hours being @@ -3202,23 +4122,23 @@ func (s *Command) SetScriptPath(v string) *Command { // Amazon EMR releases 4.x or later. // -// Specifies a hardware and software configuration of the EMR cluster. This -// includes configurations for applications and software bundled with Amazon -// EMR. The Configuration object is a JSON object which is defined by a classification -// and a set of properties. Configurations can be nested, so a configuration -// may have its own Configuration objects listed. +// An optional configuration specification to be used when provisioning cluster +// instances, which can include configurations for applications and software +// bundled with Amazon EMR. A configuration consists of a classification, properties, +// and optional nested configurations. A classification refers to an application-specific +// configuration file. Properties are the settings you want to change in that +// file. For more information, see Configuring Applications (http://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-configure-apps.html). // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/Configuration type Configuration struct { _ struct{} `type:"structure"` - // The classification of a configuration. For more information see, Amazon EMR - // Configurations (http://docs.aws.amazon.com/ElasticMapReduce/latest/API/EmrConfigurations.html). + // The classification within a configuration. Classification *string `type:"string"` - // A list of configurations you apply to this configuration object. + // A list of additional configurations to apply within a configuration object. Configurations []*Configuration `type:"list"` - // A set of properties supplied to the Configuration object. + // A set of properties specified within a configuration classification. Properties map[string]*string `type:"map"` } @@ -3896,14 +4816,14 @@ type Ec2InstanceAttributes struct { // the master node as a user named "hadoop". Ec2KeyName *string `type:"string"` - // To launch the job flow in Amazon VPC, set this parameter to the identifier - // of the Amazon VPC subnet where you want the job flow to launch. If you do - // not specify this value, the job flow is launched in the normal AWS cloud, + // To launch the cluster in Amazon VPC, set this parameter to the identifier + // of the Amazon VPC subnet where you want the cluster to launch. If you do + // not specify this value, the cluster is launched in the normal AWS cloud, // outside of a VPC. // // Amazon VPC currently does not support cluster compute quadruple extra large // (cc1.4xlarge) instances. Thus, you cannot specify the cc1.4xlarge instance - // type for nodes of a job flow launched in a VPC. + // type for nodes of a cluster launched in a VPC. Ec2SubnetId *string `type:"string"` // The identifier of the Amazon EC2 security group for the master node. @@ -3912,10 +4832,26 @@ type Ec2InstanceAttributes struct { // The identifier of the Amazon EC2 security group for the slave nodes. EmrManagedSlaveSecurityGroup *string `type:"string"` - // The IAM role that was specified when the job flow was launched. The EC2 instances - // of the job flow assume this role. + // The IAM role that was specified when the cluster was launched. The EC2 instances + // of the cluster assume this role. IamInstanceProfile *string `type:"string"` + // Applies to clusters configured with the The list of availability zones to + // choose from. The service will choose the availability zone with the best + // mix of available capacity and lowest cost to launch the cluster. If you do + // not specify this value, the cluster is launched in any availability zone + // that the customer account has access to. + RequestedEc2AvailabilityZones []*string `type:"list"` + + // Applies to clusters configured with the instance fleets option. Specifies + // the unique identifier of one or more Amazon EC2 subnets in which to launch + // EC2 cluster instances. Amazon EMR chooses the EC2 subnet with the best performance + // and cost characteristics from among the list of RequestedEc2SubnetIds and + // launches all cluster instances within that subnet. If this value is not specified, + // and the account supports EC2-Classic networks, the cluster launches instances + // in the EC2-Classic network and uses Requested + RequestedEc2SubnetIds []*string `type:"list"` + // The identifier of the Amazon EC2 security group for the Amazon EMR service // to access clusters in VPC private subnets. ServiceAccessSecurityGroup *string `type:"string"` @@ -3979,6 +4915,18 @@ func (s *Ec2InstanceAttributes) SetIamInstanceProfile(v string) *Ec2InstanceAttr return s } +// SetRequestedEc2AvailabilityZones sets the RequestedEc2AvailabilityZones field's value. +func (s *Ec2InstanceAttributes) SetRequestedEc2AvailabilityZones(v []*string) *Ec2InstanceAttributes { + s.RequestedEc2AvailabilityZones = v + return s +} + +// SetRequestedEc2SubnetIds sets the RequestedEc2SubnetIds field's value. +func (s *Ec2InstanceAttributes) SetRequestedEc2SubnetIds(v []*string) *Ec2InstanceAttributes { + s.RequestedEc2SubnetIds = v + return s +} + // SetServiceAccessSecurityGroup sets the ServiceAccessSecurityGroup field's value. func (s *Ec2InstanceAttributes) SetServiceAccessSecurityGroup(v string) *Ec2InstanceAttributes { s.ServiceAccessSecurityGroup = &v @@ -4177,9 +5125,18 @@ type Instance struct { // The unique identifier for the instance in Amazon EMR. Id *string `type:"string"` + // The unique identifier of the instance fleet to which an EC2 instance belongs. + InstanceFleetId *string `type:"string"` + // The identifier of the instance group to which this instance belongs. InstanceGroupId *string `type:"string"` + // The EC2 instance type, for example m3.xlarge. + InstanceType *string `min:"1" type:"string"` + + // The instance purchasing option. Valid values are ON_DEMAND or SPOT. + Market *string `type:"string" enum:"MarketType"` + // The private DNS name of the instance. PrivateDnsName *string `type:"string"` @@ -4224,12 +5181,30 @@ func (s *Instance) SetId(v string) *Instance { return s } +// SetInstanceFleetId sets the InstanceFleetId field's value. +func (s *Instance) SetInstanceFleetId(v string) *Instance { + s.InstanceFleetId = &v + return s +} + // SetInstanceGroupId sets the InstanceGroupId field's value. func (s *Instance) SetInstanceGroupId(v string) *Instance { s.InstanceGroupId = &v return s } +// SetInstanceType sets the InstanceType field's value. +func (s *Instance) SetInstanceType(v string) *Instance { + s.InstanceType = &v + return s +} + +// SetMarket sets the Market field's value. +func (s *Instance) SetMarket(v string) *Instance { + s.Market = &v + return s +} + // SetPrivateDnsName sets the PrivateDnsName field's value. func (s *Instance) SetPrivateDnsName(v string) *Instance { s.PrivateDnsName = &v @@ -4260,64 +5235,594 @@ func (s *Instance) SetStatus(v *InstanceStatus) *Instance { return s } -// This entity represents an instance group, which is a group of instances that -// have common purpose. For example, CORE instance group is used for HDFS. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceGroup -type InstanceGroup struct { +// Describes an instance fleet, which is a group of EC2 instances that host +// a particular node type (master, core, or task) in an Amazon EMR cluster. +// Instance fleets can consist of a mix of instance types and On-Demand and +// Spot instances, which are provisioned to meet a defined target capacity. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceFleet +type InstanceFleet struct { _ struct{} `type:"structure"` - // An automatic scaling policy for a core instance group or task instance group - // in an Amazon EMR cluster. The automatic scaling policy defines how an instance - // group dynamically adds and terminates EC2 instances in response to the value - // of a CloudWatch metric. See PutAutoScalingPolicy. - AutoScalingPolicy *AutoScalingPolicyDescription `type:"structure"` - - // The bid price for each EC2 instance in the instance group when launching - // nodes as Spot Instances, expressed in USD. - BidPrice *string `type:"string"` - - // Amazon EMR releases 4.x or later. - // - // The list of configurations supplied for an EMR cluster instance group. You - // can specify a separate configuration for each instance group (master, core, - // and task). - Configurations []*Configuration `type:"list"` - - // The EBS block devices that are mapped to this instance group. - EbsBlockDevices []*EbsBlockDevice `type:"list"` - - // If the instance group is EBS-optimized. An Amazon EBS-optimized instance - // uses an optimized configuration stack and provides additional, dedicated - // capacity for Amazon EBS I/O. - EbsOptimized *bool `type:"boolean"` - - // The identifier of the instance group. + // The unique identifier of the instance fleet. Id *string `type:"string"` - // The type of the instance group. Valid values are MASTER, CORE or TASK. - InstanceGroupType *string `type:"string" enum:"InstanceGroupType"` + // The node type that the instance fleet hosts. Valid values are MASTER, CORE, + // or TASK. + InstanceFleetType *string `type:"string" enum:"InstanceFleetType"` - // The EC2 instance type for all instances in the instance group. - InstanceType *string `min:"1" type:"string"` + // The specification for the instance types that comprise an instance fleet. + // Up to five unique instance specifications may be defined for each instance + // fleet. + InstanceTypeSpecifications []*InstanceTypeSpecification `type:"list"` - // The marketplace to provision instances for this group. Valid values are ON_DEMAND - // or SPOT. - Market *string `type:"string" enum:"MarketType"` + // Describes the launch specification for an instance fleet. + LaunchSpecifications *InstanceFleetProvisioningSpecifications `type:"structure"` - // The name of the instance group. + // A friendly name for the instance fleet. Name *string `type:"string"` - // The target number of instances for the instance group. - RequestedInstanceCount *int64 `type:"integer"` - - // The number of instances currently running in this instance group. - RunningInstanceCount *int64 `type:"integer"` - - // Policy for customizing shrink operations. - ShrinkPolicy *ShrinkPolicy `type:"structure"` - - // The current status of the instance group. - Status *InstanceGroupStatus `type:"structure"` + // The number of On-Demand units that have been provisioned for the instance + // fleet to fulfill TargetOnDemandCapacity. This provisioned capacity might + // be less than or greater than TargetOnDemandCapacity. + ProvisionedOnDemandCapacity *int64 `type:"integer"` + + // The number of Spot units that have been provisioned for this instance fleet + // to fulfill TargetSpotCapacity. This provisioned capacity might be less than + // or greater than TargetSpotCapacity. + ProvisionedSpotCapacity *int64 `type:"integer"` + + // The current status of the instance fleet. + Status *InstanceFleetStatus `type:"structure"` + + // The target capacity of On-Demand units for the instance fleet, which determines + // how many On-Demand instances to provision. When the instance fleet launches, + // Amazon EMR tries to provision On-Demand instances as specified by InstanceTypeConfig. + // Each instance configuration has a specified WeightedCapacity. When an On-Demand + // instance is provisioned, the WeightedCapacity units count toward the target + // capacity. Amazon EMR provisions instances until the target capacity is totally + // fulfilled, even if this results in an overage. For example, if there are + // 2 units remaining to fulfill capacity, and Amazon EMR can only provision + // an instance with a WeightedCapacity of 5 units, the instance is provisioned, + // and the target capacity is exceeded by 3 units. You can use InstanceFleet$ProvisionedOnDemandCapacity + // to determine the Spot capacity units that have been provisioned for the instance + // fleet. + // + // If not specified or set to 0, only Spot instances are provisioned for the + // instance fleet using TargetSpotCapacity. At least one of TargetSpotCapacity + // and TargetOnDemandCapacity should be greater than 0. For a master instance + // fleet, only one of TargetSpotCapacity and TargetOnDemandCapacity can be specified, + // and its value must be 1. + TargetOnDemandCapacity *int64 `type:"integer"` + + // The target capacity of Spot units for the instance fleet, which determines + // how many Spot instances to provision. When the instance fleet launches, Amazon + // EMR tries to provision Spot instances as specified by InstanceTypeConfig. + // Each instance configuration has a specified WeightedCapacity. When a Spot + // instance is provisioned, the WeightedCapacity units count toward the target + // capacity. Amazon EMR provisions instances until the target capacity is totally + // fulfilled, even if this results in an overage. For example, if there are + // 2 units remaining to fulfill capacity, and Amazon EMR can only provision + // an instance with a WeightedCapacity of 5 units, the instance is provisioned, + // and the target capacity is exceeded by 3 units. You can use InstanceFleet$ProvisionedSpotCapacity + // to determine the Spot capacity units that have been provisioned for the instance + // fleet. + // + // If not specified or set to 0, only On-Demand instances are provisioned for + // the instance fleet. At least one of TargetSpotCapacity and TargetOnDemandCapacity + // should be greater than 0. For a master instance fleet, only one of TargetSpotCapacity + // and TargetOnDemandCapacity can be specified, and its value must be 1. + TargetSpotCapacity *int64 `type:"integer"` +} + +// String returns the string representation +func (s InstanceFleet) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceFleet) GoString() string { + return s.String() +} + +// SetId sets the Id field's value. +func (s *InstanceFleet) SetId(v string) *InstanceFleet { + s.Id = &v + return s +} + +// SetInstanceFleetType sets the InstanceFleetType field's value. +func (s *InstanceFleet) SetInstanceFleetType(v string) *InstanceFleet { + s.InstanceFleetType = &v + return s +} + +// SetInstanceTypeSpecifications sets the InstanceTypeSpecifications field's value. +func (s *InstanceFleet) SetInstanceTypeSpecifications(v []*InstanceTypeSpecification) *InstanceFleet { + s.InstanceTypeSpecifications = v + return s +} + +// SetLaunchSpecifications sets the LaunchSpecifications field's value. +func (s *InstanceFleet) SetLaunchSpecifications(v *InstanceFleetProvisioningSpecifications) *InstanceFleet { + s.LaunchSpecifications = v + return s +} + +// SetName sets the Name field's value. +func (s *InstanceFleet) SetName(v string) *InstanceFleet { + s.Name = &v + return s +} + +// SetProvisionedOnDemandCapacity sets the ProvisionedOnDemandCapacity field's value. +func (s *InstanceFleet) SetProvisionedOnDemandCapacity(v int64) *InstanceFleet { + s.ProvisionedOnDemandCapacity = &v + return s +} + +// SetProvisionedSpotCapacity sets the ProvisionedSpotCapacity field's value. +func (s *InstanceFleet) SetProvisionedSpotCapacity(v int64) *InstanceFleet { + s.ProvisionedSpotCapacity = &v + return s +} + +// SetStatus sets the Status field's value. +func (s *InstanceFleet) SetStatus(v *InstanceFleetStatus) *InstanceFleet { + s.Status = v + return s +} + +// SetTargetOnDemandCapacity sets the TargetOnDemandCapacity field's value. +func (s *InstanceFleet) SetTargetOnDemandCapacity(v int64) *InstanceFleet { + s.TargetOnDemandCapacity = &v + return s +} + +// SetTargetSpotCapacity sets the TargetSpotCapacity field's value. +func (s *InstanceFleet) SetTargetSpotCapacity(v int64) *InstanceFleet { + s.TargetSpotCapacity = &v + return s +} + +// The configuration that defines an instance fleet. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceFleetConfig +type InstanceFleetConfig struct { + _ struct{} `type:"structure"` + + // The node type that the instance fleet hosts. Valid values are MASTER,CORE,and + // TASK. + // + // InstanceFleetType is a required field + InstanceFleetType *string `type:"string" required:"true" enum:"InstanceFleetType"` + + // The instance type configurations that define the EC2 instances in the instance + // fleet. + InstanceTypeConfigs []*InstanceTypeConfig `type:"list"` + + // The launch specification for the instance fleet. + LaunchSpecifications *InstanceFleetProvisioningSpecifications `type:"structure"` + + // The friendly name of the instance fleet. + Name *string `type:"string"` + + // The target capacity of On-Demand units for the instance fleet, which determines + // how many On-Demand instances to provision. When the instance fleet launches, + // Amazon EMR tries to provision On-Demand instances as specified by InstanceTypeConfig. + // Each instance configuration has a specified WeightedCapacity. When an On-Demand + // instance is provisioned, the WeightedCapacity units count toward the target + // capacity. Amazon EMR provisions instances until the target capacity is totally + // fulfilled, even if this results in an overage. For example, if there are + // 2 units remaining to fulfill capacity, and Amazon EMR can only provision + // an instance with a WeightedCapacity of 5 units, the instance is provisioned, + // and the target capacity is exceeded by 3 units. + // + // If not specified or set to 0, only Spot instances are provisioned for the + // instance fleet using TargetSpotCapacity. At least one of TargetSpotCapacity + // and TargetOnDemandCapacity should be greater than 0. For a master instance + // fleet, only one of TargetSpotCapacity and TargetOnDemandCapacity can be specified, + // and its value must be 1. + TargetOnDemandCapacity *int64 `type:"integer"` + + // The target capacity of Spot units for the instance fleet, which determines + // how many Spot instances to provision. When the instance fleet launches, Amazon + // EMR tries to provision Spot instances as specified by InstanceTypeConfig. + // Each instance configuration has a specified WeightedCapacity. When a Spot + // instance is provisioned, the WeightedCapacity units count toward the target + // capacity. Amazon EMR provisions instances until the target capacity is totally + // fulfilled, even if this results in an overage. For example, if there are + // 2 units remaining to fulfill capacity, and Amazon EMR can only provision + // an instance with a WeightedCapacity of 5 units, the instance is provisioned, + // and the target capacity is exceeded by 3 units. + // + // If not specified or set to 0, only On-Demand instances are provisioned for + // the instance fleet. At least one of TargetSpotCapacity and TargetOnDemandCapacity + // should be greater than 0. For a master instance fleet, only one of TargetSpotCapacity + // and TargetOnDemandCapacity can be specified, and its value must be 1. + TargetSpotCapacity *int64 `type:"integer"` +} + +// String returns the string representation +func (s InstanceFleetConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceFleetConfig) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InstanceFleetConfig) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InstanceFleetConfig"} + if s.InstanceFleetType == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceFleetType")) + } + if s.InstanceTypeConfigs != nil { + for i, v := range s.InstanceTypeConfigs { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "InstanceTypeConfigs", i), err.(request.ErrInvalidParams)) + } + } + } + if s.LaunchSpecifications != nil { + if err := s.LaunchSpecifications.Validate(); err != nil { + invalidParams.AddNested("LaunchSpecifications", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetInstanceFleetType sets the InstanceFleetType field's value. +func (s *InstanceFleetConfig) SetInstanceFleetType(v string) *InstanceFleetConfig { + s.InstanceFleetType = &v + return s +} + +// SetInstanceTypeConfigs sets the InstanceTypeConfigs field's value. +func (s *InstanceFleetConfig) SetInstanceTypeConfigs(v []*InstanceTypeConfig) *InstanceFleetConfig { + s.InstanceTypeConfigs = v + return s +} + +// SetLaunchSpecifications sets the LaunchSpecifications field's value. +func (s *InstanceFleetConfig) SetLaunchSpecifications(v *InstanceFleetProvisioningSpecifications) *InstanceFleetConfig { + s.LaunchSpecifications = v + return s +} + +// SetName sets the Name field's value. +func (s *InstanceFleetConfig) SetName(v string) *InstanceFleetConfig { + s.Name = &v + return s +} + +// SetTargetOnDemandCapacity sets the TargetOnDemandCapacity field's value. +func (s *InstanceFleetConfig) SetTargetOnDemandCapacity(v int64) *InstanceFleetConfig { + s.TargetOnDemandCapacity = &v + return s +} + +// SetTargetSpotCapacity sets the TargetSpotCapacity field's value. +func (s *InstanceFleetConfig) SetTargetSpotCapacity(v int64) *InstanceFleetConfig { + s.TargetSpotCapacity = &v + return s +} + +// Configuration parameters for an instance fleet modification request. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceFleetModifyConfig +type InstanceFleetModifyConfig struct { + _ struct{} `type:"structure"` + + // A unique identifier for the instance fleet. + // + // InstanceFleetId is a required field + InstanceFleetId *string `type:"string" required:"true"` + + // The target capacity of On-Demand units for the instance fleet. For more information + // see InstanceFleetConfig$TargetOnDemandCapacity. + TargetOnDemandCapacity *int64 `type:"integer"` + + // The target capacity of Spot units for the instance fleet. For more information, + // see InstanceFleetConfig$TargetSpotCapacity. + TargetSpotCapacity *int64 `type:"integer"` +} + +// String returns the string representation +func (s InstanceFleetModifyConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceFleetModifyConfig) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InstanceFleetModifyConfig) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InstanceFleetModifyConfig"} + if s.InstanceFleetId == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceFleetId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetInstanceFleetId sets the InstanceFleetId field's value. +func (s *InstanceFleetModifyConfig) SetInstanceFleetId(v string) *InstanceFleetModifyConfig { + s.InstanceFleetId = &v + return s +} + +// SetTargetOnDemandCapacity sets the TargetOnDemandCapacity field's value. +func (s *InstanceFleetModifyConfig) SetTargetOnDemandCapacity(v int64) *InstanceFleetModifyConfig { + s.TargetOnDemandCapacity = &v + return s +} + +// SetTargetSpotCapacity sets the TargetSpotCapacity field's value. +func (s *InstanceFleetModifyConfig) SetTargetSpotCapacity(v int64) *InstanceFleetModifyConfig { + s.TargetSpotCapacity = &v + return s +} + +// The launch specification for Spot instances in the fleet, which determines +// the defined duration and provisioning timeout behavior. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceFleetProvisioningSpecifications +type InstanceFleetProvisioningSpecifications struct { + _ struct{} `type:"structure"` + + // The launch specification for Spot instances in the fleet, which determines + // the defined duration and provisioning timeout behavior. + // + // SpotSpecification is a required field + SpotSpecification *SpotProvisioningSpecification `type:"structure" required:"true"` +} + +// String returns the string representation +func (s InstanceFleetProvisioningSpecifications) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceFleetProvisioningSpecifications) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InstanceFleetProvisioningSpecifications) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InstanceFleetProvisioningSpecifications"} + if s.SpotSpecification == nil { + invalidParams.Add(request.NewErrParamRequired("SpotSpecification")) + } + if s.SpotSpecification != nil { + if err := s.SpotSpecification.Validate(); err != nil { + invalidParams.AddNested("SpotSpecification", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetSpotSpecification sets the SpotSpecification field's value. +func (s *InstanceFleetProvisioningSpecifications) SetSpotSpecification(v *SpotProvisioningSpecification) *InstanceFleetProvisioningSpecifications { + s.SpotSpecification = v + return s +} + +// Provides status change reason details for the instance fleet. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceFleetStateChangeReason +type InstanceFleetStateChangeReason struct { + _ struct{} `type:"structure"` + + // A code corresponding to the reason the state change occurred. + Code *string `type:"string" enum:"InstanceFleetStateChangeReasonCode"` + + // An explanatory message. + Message *string `type:"string"` +} + +// String returns the string representation +func (s InstanceFleetStateChangeReason) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceFleetStateChangeReason) GoString() string { + return s.String() +} + +// SetCode sets the Code field's value. +func (s *InstanceFleetStateChangeReason) SetCode(v string) *InstanceFleetStateChangeReason { + s.Code = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *InstanceFleetStateChangeReason) SetMessage(v string) *InstanceFleetStateChangeReason { + s.Message = &v + return s +} + +// The status of the instance fleet. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceFleetStatus +type InstanceFleetStatus struct { + _ struct{} `type:"structure"` + + // A code representing the instance fleet status. + State *string `type:"string" enum:"InstanceFleetState"` + + // Provides status change reason details for the instance fleet. + StateChangeReason *InstanceFleetStateChangeReason `type:"structure"` + + // Provides historical timestamps for the instance fleet, including the time + // of creation, the time it became ready to run jobs, and the time of termination. + Timeline *InstanceFleetTimeline `type:"structure"` +} + +// String returns the string representation +func (s InstanceFleetStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceFleetStatus) GoString() string { + return s.String() +} + +// SetState sets the State field's value. +func (s *InstanceFleetStatus) SetState(v string) *InstanceFleetStatus { + s.State = &v + return s +} + +// SetStateChangeReason sets the StateChangeReason field's value. +func (s *InstanceFleetStatus) SetStateChangeReason(v *InstanceFleetStateChangeReason) *InstanceFleetStatus { + s.StateChangeReason = v + return s +} + +// SetTimeline sets the Timeline field's value. +func (s *InstanceFleetStatus) SetTimeline(v *InstanceFleetTimeline) *InstanceFleetStatus { + s.Timeline = v + return s +} + +// Provides historical timestamps for the instance fleet, including the time +// of creation, the time it became ready to run jobs, and the time of termination. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceFleetTimeline +type InstanceFleetTimeline struct { + _ struct{} `type:"structure"` + + // The time and date the instance fleet was created. + CreationDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The time and date the instance fleet terminated. + EndDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The time and date the instance fleet was ready to run jobs. + ReadyDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` +} + +// String returns the string representation +func (s InstanceFleetTimeline) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceFleetTimeline) GoString() string { + return s.String() +} + +// SetCreationDateTime sets the CreationDateTime field's value. +func (s *InstanceFleetTimeline) SetCreationDateTime(v time.Time) *InstanceFleetTimeline { + s.CreationDateTime = &v + return s +} + +// SetEndDateTime sets the EndDateTime field's value. +func (s *InstanceFleetTimeline) SetEndDateTime(v time.Time) *InstanceFleetTimeline { + s.EndDateTime = &v + return s +} + +// SetReadyDateTime sets the ReadyDateTime field's value. +func (s *InstanceFleetTimeline) SetReadyDateTime(v time.Time) *InstanceFleetTimeline { + s.ReadyDateTime = &v + return s +} + +// This entity represents an instance group, which is a group of instances that +// have common purpose. For example, CORE instance group is used for HDFS. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceGroup +type InstanceGroup struct { + _ struct{} `type:"structure"` + + // An automatic scaling policy for a core instance group or task instance group + // in an Amazon EMR cluster. The automatic scaling policy defines how an instance + // group dynamically adds and terminates EC2 instances in response to the value + // of a CloudWatch metric. See PutAutoScalingPolicy. + AutoScalingPolicy *AutoScalingPolicyDescription `type:"structure"` + + // The bid price for each EC2 instance in the instance group when launching + // nodes as Spot Instances, expressed in USD. + BidPrice *string `type:"string"` + + // Amazon EMR releases 4.x or later. + // + // The list of configurations supplied for an EMR cluster instance group. You + // can specify a separate configuration for each instance group (master, core, + // and task). + Configurations []*Configuration `type:"list"` + + // The EBS block devices that are mapped to this instance group. + EbsBlockDevices []*EbsBlockDevice `type:"list"` + + // If the instance group is EBS-optimized. An Amazon EBS-optimized instance + // uses an optimized configuration stack and provides additional, dedicated + // capacity for Amazon EBS I/O. + EbsOptimized *bool `type:"boolean"` + + // The identifier of the instance group. + Id *string `type:"string"` + + // The type of the instance group. Valid values are MASTER, CORE or TASK. + InstanceGroupType *string `type:"string" enum:"InstanceGroupType"` + + // The EC2 instance type for all instances in the instance group. + InstanceType *string `min:"1" type:"string"` + + // The marketplace to provision instances for this group. Valid values are ON_DEMAND + // or SPOT. + Market *string `type:"string" enum:"MarketType"` + + // The name of the instance group. + Name *string `type:"string"` + + // The target number of instances for the instance group. + RequestedInstanceCount *int64 `type:"integer"` + + // The number of instances currently running in this instance group. + RunningInstanceCount *int64 `type:"integer"` + + // Policy for customizing shrink operations. + ShrinkPolicy *ShrinkPolicy `type:"structure"` + + // The current status of the instance group. + Status *InstanceGroupStatus `type:"structure"` } // String returns the string representation @@ -5037,39 +6542,240 @@ type InstanceTimeline struct { // The date and time when the instance was terminated. EndDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` - // The date and time when the instance was ready to perform tasks. - ReadyDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + // The date and time when the instance was ready to perform tasks. + ReadyDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` +} + +// String returns the string representation +func (s InstanceTimeline) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceTimeline) GoString() string { + return s.String() +} + +// SetCreationDateTime sets the CreationDateTime field's value. +func (s *InstanceTimeline) SetCreationDateTime(v time.Time) *InstanceTimeline { + s.CreationDateTime = &v + return s +} + +// SetEndDateTime sets the EndDateTime field's value. +func (s *InstanceTimeline) SetEndDateTime(v time.Time) *InstanceTimeline { + s.EndDateTime = &v + return s +} + +// SetReadyDateTime sets the ReadyDateTime field's value. +func (s *InstanceTimeline) SetReadyDateTime(v time.Time) *InstanceTimeline { + s.ReadyDateTime = &v + return s +} + +// An instance type configuration for each instance type in an instance fleet, +// which determines the EC2 instances Amazon EMR attempts to provision to fulfill +// On-Demand and Spot target capacities. There can be a maximum of 5 instance +// type configurations in a fleet. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceTypeConfig +type InstanceTypeConfig struct { + _ struct{} `type:"structure"` + + // The bid price for each EC2 Spot instance type as defined by InstanceType. + // Expressed in USD. If neither BidPrice nor BidPriceAsPercentageOfOnDemandPrice + // is provided, BidPriceAsPercentageOfOnDemandPrice defaults to 100%. + BidPrice *string `type:"string"` + + // The bid price, as a percentage of On-Demand price, for each EC2 Spot instance + // as defined by InstanceType. Expressed as a number between 0 and 1000 (for + // example, 20 specifies 20%). If neither BidPrice nor BidPriceAsPercentageOfOnDemandPrice + // is provided, BidPriceAsPercentageOfOnDemandPrice defaults to 100%. + BidPriceAsPercentageOfOnDemandPrice *float64 `type:"double"` + + // A configuration classification that applies when provisioning cluster instances, + // which can include configurations for applications and software that run on + // the cluster. + Configurations []*Configuration `type:"list"` + + // The configuration of Amazon Elastic Block Storage (EBS) attached to each + // instance as defined by InstanceType. + EbsConfiguration *EbsConfiguration `type:"structure"` + + // An EC2 instance type, such as m3.xlarge. + // + // InstanceType is a required field + InstanceType *string `min:"1" type:"string" required:"true"` + + // The number of units that a provisioned instance of this type provides toward + // fulfilling the target capacities defined in InstanceFleetConfig. This value + // is 1 for a master instance fleet, and must be greater than 0 for core and + // task instance fleets. + WeightedCapacity *int64 `type:"integer"` +} + +// String returns the string representation +func (s InstanceTypeConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceTypeConfig) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InstanceTypeConfig) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InstanceTypeConfig"} + if s.InstanceType == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceType")) + } + if s.InstanceType != nil && len(*s.InstanceType) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InstanceType", 1)) + } + if s.EbsConfiguration != nil { + if err := s.EbsConfiguration.Validate(); err != nil { + invalidParams.AddNested("EbsConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetBidPrice sets the BidPrice field's value. +func (s *InstanceTypeConfig) SetBidPrice(v string) *InstanceTypeConfig { + s.BidPrice = &v + return s +} + +// SetBidPriceAsPercentageOfOnDemandPrice sets the BidPriceAsPercentageOfOnDemandPrice field's value. +func (s *InstanceTypeConfig) SetBidPriceAsPercentageOfOnDemandPrice(v float64) *InstanceTypeConfig { + s.BidPriceAsPercentageOfOnDemandPrice = &v + return s +} + +// SetConfigurations sets the Configurations field's value. +func (s *InstanceTypeConfig) SetConfigurations(v []*Configuration) *InstanceTypeConfig { + s.Configurations = v + return s +} + +// SetEbsConfiguration sets the EbsConfiguration field's value. +func (s *InstanceTypeConfig) SetEbsConfiguration(v *EbsConfiguration) *InstanceTypeConfig { + s.EbsConfiguration = v + return s +} + +// SetInstanceType sets the InstanceType field's value. +func (s *InstanceTypeConfig) SetInstanceType(v string) *InstanceTypeConfig { + s.InstanceType = &v + return s +} + +// SetWeightedCapacity sets the WeightedCapacity field's value. +func (s *InstanceTypeConfig) SetWeightedCapacity(v int64) *InstanceTypeConfig { + s.WeightedCapacity = &v + return s +} + +// The configuration specification for each instance type in an instance fleet. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/InstanceTypeSpecification +type InstanceTypeSpecification struct { + _ struct{} `type:"structure"` + + // The bid price for each EC2 Spot instance type as defined by InstanceType. + // Expressed in USD. + BidPrice *string `type:"string"` + + // The bid price, as a percentage of On-Demand price, for each EC2 Spot instance + // as defined by InstanceType. Expressed as a number (for example, 20 specifies + // 20%). + BidPriceAsPercentageOfOnDemandPrice *float64 `type:"double"` + + // A configuration classification that applies when provisioning cluster instances, + // which can include configurations for applications and software bundled with + // Amazon EMR. + Configurations []*Configuration `type:"list"` + + // The configuration of Amazon Elastic Block Storage (EBS) attached to each + // instance as defined by InstanceType. + EbsBlockDevices []*EbsBlockDevice `type:"list"` + + // Evaluates to TRUE when the specified InstanceType is EBS-optimized. + EbsOptimized *bool `type:"boolean"` + + // The EC2 instance type, for example m3.xlarge. + InstanceType *string `min:"1" type:"string"` + + // The number of units that a provisioned instance of this type provides toward + // fulfilling the target capacities defined in InstanceFleetConfig. Capacity + // values represent performance characteristics such as vCPUs, memory, or I/O. + // If not specified, the default value is 1. + WeightedCapacity *int64 `type:"integer"` } // String returns the string representation -func (s InstanceTimeline) String() string { +func (s InstanceTypeSpecification) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s InstanceTimeline) GoString() string { +func (s InstanceTypeSpecification) GoString() string { return s.String() } -// SetCreationDateTime sets the CreationDateTime field's value. -func (s *InstanceTimeline) SetCreationDateTime(v time.Time) *InstanceTimeline { - s.CreationDateTime = &v +// SetBidPrice sets the BidPrice field's value. +func (s *InstanceTypeSpecification) SetBidPrice(v string) *InstanceTypeSpecification { + s.BidPrice = &v return s } -// SetEndDateTime sets the EndDateTime field's value. -func (s *InstanceTimeline) SetEndDateTime(v time.Time) *InstanceTimeline { - s.EndDateTime = &v +// SetBidPriceAsPercentageOfOnDemandPrice sets the BidPriceAsPercentageOfOnDemandPrice field's value. +func (s *InstanceTypeSpecification) SetBidPriceAsPercentageOfOnDemandPrice(v float64) *InstanceTypeSpecification { + s.BidPriceAsPercentageOfOnDemandPrice = &v return s } -// SetReadyDateTime sets the ReadyDateTime field's value. -func (s *InstanceTimeline) SetReadyDateTime(v time.Time) *InstanceTimeline { - s.ReadyDateTime = &v +// SetConfigurations sets the Configurations field's value. +func (s *InstanceTypeSpecification) SetConfigurations(v []*Configuration) *InstanceTypeSpecification { + s.Configurations = v + return s +} + +// SetEbsBlockDevices sets the EbsBlockDevices field's value. +func (s *InstanceTypeSpecification) SetEbsBlockDevices(v []*EbsBlockDevice) *InstanceTypeSpecification { + s.EbsBlockDevices = v + return s +} + +// SetEbsOptimized sets the EbsOptimized field's value. +func (s *InstanceTypeSpecification) SetEbsOptimized(v bool) *InstanceTypeSpecification { + s.EbsOptimized = &v + return s +} + +// SetInstanceType sets the InstanceType field's value. +func (s *InstanceTypeSpecification) SetInstanceType(v string) *InstanceTypeSpecification { + s.InstanceType = &v + return s +} + +// SetWeightedCapacity sets the WeightedCapacity field's value. +func (s *InstanceTypeSpecification) SetWeightedCapacity(v int64) *InstanceTypeSpecification { + s.WeightedCapacity = &v return s } -// A description of a job flow. +// A description of a cluster (job flow). // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/JobFlowDetail type JobFlowDetail struct { _ struct{} `type:"structure"` @@ -5142,12 +6848,12 @@ type JobFlowDetail struct { // is empty. SupportedProducts []*string `type:"list"` - // Specifies whether the job flow is visible to all IAM users of the AWS account - // associated with the job flow. If this value is set to true, all IAM users + // Specifies whether the cluster is visible to all IAM users of the AWS account + // associated with the cluster. If this value is set to true, all IAM users // of that AWS account can view and (if they have the proper policy permissions - // set) manage the job flow. If it is set to false, only the IAM user that created - // the job flow can view and manage it. This value can be changed using the - // SetVisibleToAllUsers action. + // set) manage the cluster. If it is set to false, only the IAM user that created + // the cluster can view and manage it. This value can be changed using the SetVisibleToAllUsers + // action. VisibleToAllUsers *bool `type:"boolean"` } @@ -5245,7 +6951,7 @@ func (s *JobFlowDetail) SetVisibleToAllUsers(v bool) *JobFlowDetail { return s } -// Describes the status of the job flow. +// Describes the status of the cluster (job flow). // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/JobFlowExecutionStatusDetail type JobFlowExecutionStatusDetail struct { _ struct{} `type:"structure"` @@ -5320,10 +7026,11 @@ func (s *JobFlowExecutionStatusDetail) SetState(v string) *JobFlowExecutionStatu return s } -// A description of the Amazon EC2 instance running the job flow. A valid JobFlowInstancesConfig -// must contain at least InstanceGroups, which is the recommended configuration. -// However, a valid alternative is to have MasterInstanceType, SlaveInstanceType, -// and InstanceCount (all three must be present). +// A description of the Amazon EC2 instance on which the cluster (job flow) +// runs. A valid JobFlowInstancesConfig must contain either InstanceGroups or +// InstanceFleets, which is the recommended configuration. They cannot be used +// together. You may also have MasterInstanceType, SlaveInstanceType, and InstanceCount +// (all three must be present), but we don't recommend this configuration. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/JobFlowInstancesConfig type JobFlowInstancesConfig struct { _ struct{} `type:"structure"` @@ -5338,43 +7045,61 @@ type JobFlowInstancesConfig struct { // the user called "hadoop." Ec2KeyName *string `type:"string"` - // To launch the job flow in Amazon Virtual Private Cloud (Amazon VPC), set - // this parameter to the identifier of the Amazon VPC subnet where you want - // the job flow to launch. If you do not specify this value, the job flow is - // launched in the normal Amazon Web Services cloud, outside of an Amazon VPC. + // Applies to clusters that use the uniform instance group configuration. To + // launch the cluster in Amazon Virtual Private Cloud (Amazon VPC), set this + // parameter to the identifier of the Amazon VPC subnet where you want the cluster + // to launch. If you do not specify this value, the cluster launches in the + // normal Amazon Web Services cloud, outside of an Amazon VPC, if the account + // launching the cluster supports EC2 Classic networks in the region where the + // cluster launches. // // Amazon VPC currently does not support cluster compute quadruple extra large // (cc1.4xlarge) instances. Thus you cannot specify the cc1.4xlarge instance - // type for nodes of a job flow launched in a Amazon VPC. + // type for clusters launched in an Amazon VPC. Ec2SubnetId *string `type:"string"` + // Applies to clusters that use the instance fleet configuration. When multiple + // EC2 subnet IDs are specified, Amazon EMR evaluates them and launches instances + // in the optimal subnet. + // + // The instance fleet configuration is available only in Amazon EMR versions + // 4.8.0 and later, excluding 5.0.x versions. + Ec2SubnetIds []*string `type:"list"` + // The identifier of the Amazon EC2 security group for the master node. EmrManagedMasterSecurityGroup *string `type:"string"` // The identifier of the Amazon EC2 security group for the slave nodes. EmrManagedSlaveSecurityGroup *string `type:"string"` - // The Hadoop version for the job flow. Valid inputs are "0.18" (deprecated), + // The Hadoop version for the cluster. Valid inputs are "0.18" (deprecated), // "0.20" (deprecated), "0.20.205" (deprecated), "1.0.3", "2.2.0", or "2.4.0". // If you do not set this value, the default of 0.18 is used, unless the AmiVersion // parameter is set in the RunJobFlow call, in which case the default version // of Hadoop for that AMI version is used. HadoopVersion *string `type:"string"` - // The number of EC2 instances used to execute the job flow. + // The number of EC2 instances in the cluster. InstanceCount *int64 `type:"integer"` - // Configuration for the job flow's instance groups. + // The instance fleet configuration is available only in Amazon EMR versions + // 4.8.0 and later, excluding 5.0.x versions. + // + // Describes the EC2 instances and instance configurations for clusters that + // use the instance fleet configuration. + InstanceFleets []*InstanceFleetConfig `type:"list"` + + // Configuration for the instance groups in a cluster. InstanceGroups []*InstanceGroupConfig `type:"list"` - // Specifies whether the job flow should be kept alive after completing all + // Specifies whether the cluster should remain available after completing all // steps. KeepJobFlowAliveWhenNoSteps *bool `type:"boolean"` // The EC2 instance type of the master node. MasterInstanceType *string `min:"1" type:"string"` - // The Availability Zone the job flow will run in. + // The Availability Zone in which the cluster runs. Placement *PlacementType `type:"structure"` // The identifier of the Amazon EC2 security group for the Amazon EMR service @@ -5384,9 +7109,9 @@ type JobFlowInstancesConfig struct { // The EC2 instance type of the slave nodes. SlaveInstanceType *string `min:"1" type:"string"` - // Specifies whether to lock the job flow to prevent the Amazon EC2 instances + // Specifies whether to lock the cluster to prevent the Amazon EC2 instances // from being terminated by API call, user intervention, or in the event of - // a job flow error. + // a job-flow error. TerminationProtected *bool `type:"boolean"` } @@ -5409,6 +7134,16 @@ func (s *JobFlowInstancesConfig) Validate() error { if s.SlaveInstanceType != nil && len(*s.SlaveInstanceType) < 1 { invalidParams.Add(request.NewErrParamMinLen("SlaveInstanceType", 1)) } + if s.InstanceFleets != nil { + for i, v := range s.InstanceFleets { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "InstanceFleets", i), err.(request.ErrInvalidParams)) + } + } + } if s.InstanceGroups != nil { for i, v := range s.InstanceGroups { if v == nil { @@ -5419,11 +7154,6 @@ func (s *JobFlowInstancesConfig) Validate() error { } } } - if s.Placement != nil { - if err := s.Placement.Validate(); err != nil { - invalidParams.AddNested("Placement", err.(request.ErrInvalidParams)) - } - } if invalidParams.Len() > 0 { return invalidParams @@ -5455,6 +7185,12 @@ func (s *JobFlowInstancesConfig) SetEc2SubnetId(v string) *JobFlowInstancesConfi return s } +// SetEc2SubnetIds sets the Ec2SubnetIds field's value. +func (s *JobFlowInstancesConfig) SetEc2SubnetIds(v []*string) *JobFlowInstancesConfig { + s.Ec2SubnetIds = v + return s +} + // SetEmrManagedMasterSecurityGroup sets the EmrManagedMasterSecurityGroup field's value. func (s *JobFlowInstancesConfig) SetEmrManagedMasterSecurityGroup(v string) *JobFlowInstancesConfig { s.EmrManagedMasterSecurityGroup = &v @@ -5479,6 +7215,12 @@ func (s *JobFlowInstancesConfig) SetInstanceCount(v int64) *JobFlowInstancesConf return s } +// SetInstanceFleets sets the InstanceFleets field's value. +func (s *JobFlowInstancesConfig) SetInstanceFleets(v []*InstanceFleetConfig) *JobFlowInstancesConfig { + s.InstanceFleets = v + return s +} + // SetInstanceGroups sets the InstanceGroups field's value. func (s *JobFlowInstancesConfig) SetInstanceGroups(v []*InstanceGroupConfig) *JobFlowInstancesConfig { s.InstanceGroups = v @@ -5521,20 +7263,21 @@ func (s *JobFlowInstancesConfig) SetTerminationProtected(v bool) *JobFlowInstanc return s } -// Specify the type of Amazon EC2 instances to run the job flow on. +// Specify the type of Amazon EC2 instances that the cluster (job flow) runs +// on. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/JobFlowInstancesDetail type JobFlowInstancesDetail struct { _ struct{} `type:"structure"` // The name of an Amazon EC2 key pair that can be used to ssh to the master - // node of job flow. + // node. Ec2KeyName *string `type:"string"` - // For job flows launched within Amazon Virtual Private Cloud, this value specifies - // the identifier of the subnet where the job flow was launched. + // For clusters launched within Amazon Virtual Private Cloud, this is the identifier + // of the subnet where the cluster was launched. Ec2SubnetId *string `type:"string"` - // The Hadoop version for the job flow. + // The Hadoop version for the cluster. HadoopVersion *string `type:"string"` // The number of Amazon EC2 instances in the cluster. If the value is 1, the @@ -5544,10 +7287,11 @@ type JobFlowInstancesDetail struct { // InstanceCount is a required field InstanceCount *int64 `type:"integer" required:"true"` - // Details about the job flow's instance groups. + // Details about the instance groups in a cluster. InstanceGroups []*InstanceGroupDetail `type:"list"` - // Specifies whether the job flow should terminate after completing all steps. + // Specifies whether the cluster should remain available after completing all + // steps. KeepJobFlowAliveWhenNoSteps *bool `type:"boolean"` // The Amazon EC2 instance identifier of the master node. @@ -5561,7 +7305,7 @@ type JobFlowInstancesDetail struct { // The DNS name of the master node. MasterPublicDnsName *string `type:"string"` - // An approximation of the cost of the job flow, represented in m1.small/hours. + // An approximation of the cost of the cluster, represented in m1.small/hours. // This value is incremented one time for every hour that an m1.small runs. // Larger instances are weighted more, so an Amazon EC2 instance that is roughly // four times more expensive would result in the normalized instance hours being @@ -5569,7 +7313,7 @@ type JobFlowInstancesDetail struct { // the actual billing rate. NormalizedInstanceHours *int64 `type:"integer"` - // The Amazon EC2 Availability Zone for the job flow. + // The Amazon EC2 Availability Zone for the cluster. Placement *PlacementType `type:"structure"` // The Amazon EC2 slave node instance type. @@ -5578,7 +7322,7 @@ type JobFlowInstancesDetail struct { SlaveInstanceType *string `min:"1" type:"string" required:"true"` // Specifies whether the Amazon EC2 instances in the cluster are protected from - // termination by API calls, user intervention, or in the event of a job flow + // termination by API calls, user intervention, or in the event of a job-flow // error. TerminationProtected *bool `type:"boolean"` } @@ -5876,6 +7620,87 @@ func (s *ListClustersOutput) SetMarker(v string) *ListClustersOutput { return s } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceFleetsInput +type ListInstanceFleetsInput struct { + _ struct{} `type:"structure"` + + // The unique identifier of the cluster. + // + // ClusterId is a required field + ClusterId *string `type:"string" required:"true"` + + // The pagination token that indicates the next set of results to retrieve. + Marker *string `type:"string"` +} + +// String returns the string representation +func (s ListInstanceFleetsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListInstanceFleetsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListInstanceFleetsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListInstanceFleetsInput"} + if s.ClusterId == nil { + invalidParams.Add(request.NewErrParamRequired("ClusterId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClusterId sets the ClusterId field's value. +func (s *ListInstanceFleetsInput) SetClusterId(v string) *ListInstanceFleetsInput { + s.ClusterId = &v + return s +} + +// SetMarker sets the Marker field's value. +func (s *ListInstanceFleetsInput) SetMarker(v string) *ListInstanceFleetsInput { + s.Marker = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceFleetsOutput +type ListInstanceFleetsOutput struct { + _ struct{} `type:"structure"` + + // The list of instance fleets for the cluster and given filters. + InstanceFleets []*InstanceFleet `type:"list"` + + // The pagination token that indicates the next set of results to retrieve. + Marker *string `type:"string"` +} + +// String returns the string representation +func (s ListInstanceFleetsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListInstanceFleetsOutput) GoString() string { + return s.String() +} + +// SetInstanceFleets sets the InstanceFleets field's value. +func (s *ListInstanceFleetsOutput) SetInstanceFleets(v []*InstanceFleet) *ListInstanceFleetsOutput { + s.InstanceFleets = v + return s +} + +// SetMarker sets the Marker field's value. +func (s *ListInstanceFleetsOutput) SetMarker(v string) *ListInstanceFleetsOutput { + s.Marker = &v + return s +} + // This input determines which instance groups to retrieve. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceGroupsInput type ListInstanceGroupsInput struct { @@ -5969,6 +7794,12 @@ type ListInstancesInput struct { // ClusterId is a required field ClusterId *string `type:"string" required:"true"` + // The unique identifier of the instance fleet. + InstanceFleetId *string `type:"string"` + + // The node type of the instance fleet. For example MASTER, CORE, or TASK. + InstanceFleetType *string `type:"string" enum:"InstanceFleetType"` + // The identifier of the instance group for which to list the instances. InstanceGroupId *string `type:"string"` @@ -6012,6 +7843,18 @@ func (s *ListInstancesInput) SetClusterId(v string) *ListInstancesInput { return s } +// SetInstanceFleetId sets the InstanceFleetId field's value. +func (s *ListInstancesInput) SetInstanceFleetId(v string) *ListInstancesInput { + s.InstanceFleetId = &v + return s +} + +// SetInstanceFleetType sets the InstanceFleetType field's value. +func (s *ListInstancesInput) SetInstanceFleetType(v string) *ListInstancesInput { + s.InstanceFleetType = &v + return s +} + // SetInstanceGroupId sets the InstanceGroupId field's value. func (s *ListInstancesInput) SetInstanceGroupId(v string) *ListInstancesInput { s.InstanceGroupId = &v @@ -6234,9 +8077,8 @@ func (s *ListStepsOutput) SetSteps(v []*StepSummary) *ListStepsOutput { // A CloudWatch dimension, which is specified using a Key (known as a Name in // CloudWatch), Value pair. By default, Amazon EMR uses one dimension whose // Key is JobFlowID and Value is a variable representing the cluster ID, which -// is ${emr:cluster_id}. This enables the rule to bootstrap when the cluster -// ID becomes available, and also enables a single automatic scaling policy -// to be reused for multiple clusters and instance groups. +// is ${emr.clusterId}. This enables the rule to bootstrap when the cluster +// ID becomes available. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/MetricDimension type MetricDimension struct { _ struct{} `type:"structure"` @@ -6270,6 +8112,79 @@ func (s *MetricDimension) SetValue(v string) *MetricDimension { return s } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceFleetInput +type ModifyInstanceFleetInput struct { + _ struct{} `type:"structure"` + + // The unique identifier of the cluster. + // + // ClusterId is a required field + ClusterId *string `type:"string" required:"true"` + + // The unique identifier of the instance fleet. + // + // InstanceFleet is a required field + InstanceFleet *InstanceFleetModifyConfig `type:"structure" required:"true"` +} + +// String returns the string representation +func (s ModifyInstanceFleetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyInstanceFleetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ModifyInstanceFleetInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ModifyInstanceFleetInput"} + if s.ClusterId == nil { + invalidParams.Add(request.NewErrParamRequired("ClusterId")) + } + if s.InstanceFleet == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceFleet")) + } + if s.InstanceFleet != nil { + if err := s.InstanceFleet.Validate(); err != nil { + invalidParams.AddNested("InstanceFleet", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClusterId sets the ClusterId field's value. +func (s *ModifyInstanceFleetInput) SetClusterId(v string) *ModifyInstanceFleetInput { + s.ClusterId = &v + return s +} + +// SetInstanceFleet sets the InstanceFleet field's value. +func (s *ModifyInstanceFleetInput) SetInstanceFleet(v *InstanceFleetModifyConfig) *ModifyInstanceFleetInput { + s.InstanceFleet = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceFleetOutput +type ModifyInstanceFleetOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ModifyInstanceFleetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyInstanceFleetOutput) GoString() string { + return s.String() +} + // Change the size of some instance groups. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceGroupsInput type ModifyInstanceGroupsInput struct { @@ -6339,15 +8254,24 @@ func (s ModifyInstanceGroupsOutput) GoString() string { return s.String() } -// The Amazon EC2 location for the job flow. +// The Amazon EC2 Availability Zone configuration of the cluster (job flow). // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/PlacementType type PlacementType struct { _ struct{} `type:"structure"` - // The Amazon EC2 Availability Zone for the job flow. + // The Amazon EC2 Availability Zone for the cluster. AvailabilityZone is used + // for uniform instance groups, while AvailabilityZones (plural) is used for + // instance fleets. + AvailabilityZone *string `type:"string"` + + // When multiple Availability Zones are specified, Amazon EMR evaluates them + // and launches instances in the optimal Availability Zone. AvailabilityZones + // is used for instance fleets, while AvailabilityZone (singular) is used for + // uniform instance groups. // - // AvailabilityZone is a required field - AvailabilityZone *string `type:"string" required:"true"` + // The instance fleet configuration is available only in Amazon EMR versions + // 4.8.0 and later, excluding 5.0.x versions. + AvailabilityZones []*string `type:"list"` } // String returns the string representation @@ -6360,25 +8284,18 @@ func (s PlacementType) GoString() string { return s.String() } -// Validate inspects the fields of the type to determine if they are valid. -func (s *PlacementType) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PlacementType"} - if s.AvailabilityZone == nil { - invalidParams.Add(request.NewErrParamRequired("AvailabilityZone")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - // SetAvailabilityZone sets the AvailabilityZone field's value. func (s *PlacementType) SetAvailabilityZone(v string) *PlacementType { s.AvailabilityZone = &v return s } +// SetAvailabilityZones sets the AvailabilityZones field's value. +func (s *PlacementType) SetAvailabilityZones(v []*string) *PlacementType { + s.AvailabilityZones = v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/PutAutoScalingPolicyInput type PutAutoScalingPolicyInput struct { _ struct{} `type:"structure"` @@ -6678,8 +8595,7 @@ type RunJobFlowInput struct { // to launch and terminate EC2 instances in an instance group. AutoScalingRole *string `type:"string"` - // A list of bootstrap actions that will be run before Hadoop is started on - // the cluster nodes. + // A list of bootstrap actions to run before Hadoop starts on the cluster nodes. BootstrapActions []*BootstrapActionConfig `type:"list"` // Amazon EMR releases 4.x or later. @@ -6687,8 +8603,7 @@ type RunJobFlowInput struct { // The list of configurations supplied for the EMR cluster you are creating. Configurations []*Configuration `type:"list"` - // A specification of the number and type of Amazon EC2 instances on which to - // run the job flow. + // A specification of the number and type of Amazon EC2 instances. // // Instances is a required field Instances *JobFlowInstancesConfig `type:"structure" required:"true"` @@ -6714,9 +8629,9 @@ type RunJobFlowInput struct { // A list of strings that indicates third-party software to use with the job // flow that accepts a user argument list. EMR accepts and forwards the argument // list to the corresponding installation script as bootstrap action arguments. - // For more information, see Launch a Job Flow on the MapR Distribution for - // Hadoop (http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-mapr.html). - // Currently supported values are: + // For more information, see "Launch a Job Flow on the MapR Distribution for + // Hadoop" in the Amazon EMR Developer Guide (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/emr/latest/DeveloperGuide/emr-dg.pdf). + // Supported values are: // // * "mapr-m3" - launch the cluster using MapR M3 Edition. // @@ -6763,15 +8678,14 @@ type RunJobFlowInput struct { // resources on your behalf. ServiceRole *string `type:"string"` - // A list of steps to be executed by the job flow. + // A list of steps to run. Steps []*StepConfig `type:"list"` // For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and greater, // use Applications. // - // A list of strings that indicates third-party software to use with the job - // flow. For more information, see Use Third Party Applications with Amazon - // EMR (http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-supported-products.html). + // A list of strings that indicates third-party software to use. For more information, + // see Use Third Party Applications with Amazon EMR (http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-supported-products.html). // Currently supported values are: // // * "mapr-m3" - launch the job flow using MapR M3 Edition. @@ -6782,11 +8696,11 @@ type RunJobFlowInput struct { // A list of tags to associate with a cluster and propagate to Amazon EC2 instances. Tags []*Tag `type:"list"` - // Whether the job flow is visible to all IAM users of the AWS account associated - // with the job flow. If this value is set to true, all IAM users of that AWS + // Whether the cluster is visible to all IAM users of the AWS account associated + // with the cluster. If this value is set to true, all IAM users of that AWS // account can view and (if they have the proper policy permissions set) manage - // the job flow. If it is set to false, only the IAM user that created the job - // flow can view and manage it. + // the cluster. If it is set to false, only the IAM user that created the cluster + // can view and manage it. VisibleToAllUsers *bool `type:"boolean"` } @@ -7324,16 +9238,16 @@ func (s *SecurityConfigurationSummary) SetName(v string) *SecurityConfigurationS type SetTerminationProtectionInput struct { _ struct{} `type:"structure"` - // A list of strings that uniquely identify the job flows to protect. This identifier + // A list of strings that uniquely identify the clusters to protect. This identifier // is returned by RunJobFlow and can also be obtained from DescribeJobFlows // . // // JobFlowIds is a required field JobFlowIds []*string `type:"list" required:"true"` - // A Boolean that indicates whether to protect the job flow and prevent the - // Amazon EC2 instances in the cluster from shutting down due to API calls, - // user intervention, or job-flow error. + // A Boolean that indicates whether to protect the cluster and prevent the Amazon + // EC2 instances in the cluster from shutting down due to API calls, user intervention, + // or job-flow error. // // TerminationProtected is a required field TerminationProtected *bool `type:"boolean" required:"true"` @@ -7402,11 +9316,11 @@ type SetVisibleToAllUsersInput struct { // JobFlowIds is a required field JobFlowIds []*string `type:"list" required:"true"` - // Whether the specified job flows are visible to all IAM users of the AWS account - // associated with the job flow. If this value is set to True, all IAM users + // Whether the specified clusters are visible to all IAM users of the AWS account + // associated with the cluster. If this value is set to True, all IAM users // of that AWS account can view and, if they have the proper IAM policy permissions - // set, manage the job flows. If it is set to False, only the IAM user that - // created a job flow can view and manage it. + // set, manage the clusters. If it is set to False, only the IAM user that created + // a cluster can view and manage it. // // VisibleToAllUsers is a required field VisibleToAllUsers *bool `type:"boolean" required:"true"` @@ -7515,7 +9429,7 @@ type SimpleScalingPolicyConfiguration struct { // indicates that the EC2 instance count increments or decrements by ScalingAdjustment, // which should be expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates // the instance count increments or decrements by the percentage specified by - // ScalingAdjustment, which should be expressed as a decimal, for example, 0.20 + // ScalingAdjustment, which should be expressed as a decimal. For example, 0.20 // indicates an increase in 20% increments of cluster capacity. EXACT_CAPACITY // indicates the scaling activity results in an instance group with the number // of EC2 instances specified by ScalingAdjustment, which should be expressed @@ -7580,6 +9494,86 @@ func (s *SimpleScalingPolicyConfiguration) SetScalingAdjustment(v int64) *Simple return s } +// The launch specification for Spot instances in the instance fleet, which +// determines the defined duration and provisioning timeout behavior. +// +// The instance fleet configuration is available only in Amazon EMR versions +// 4.8.0 and later, excluding 5.0.x versions. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/SpotProvisioningSpecification +type SpotProvisioningSpecification struct { + _ struct{} `type:"structure"` + + // The defined duration for Spot instances (also known as Spot blocks) in minutes. + // When specified, the Spot instance does not terminate before the defined duration + // expires, and defined duration pricing for Spot instances applies. Valid values + // are 60, 120, 180, 240, 300, or 360. The duration period starts as soon as + // a Spot instance receives its instance ID. At the end of the duration, Amazon + // EC2 marks the Spot instance for termination and provides a Spot instance + // termination notice, which gives the instance a two-minute warning before + // it terminates. + BlockDurationMinutes *int64 `type:"integer"` + + // The action to take when TargetSpotCapacity has not been fulfilled when the + // TimeoutDurationMinutes has expired. Spot instances are not uprovisioned within + // the Spot provisioining timeout. Valid values are TERMINATE_CLUSTER and SWITCH_TO_ON_DEMAND + // to fulfill the remaining capacity. + // + // TimeoutAction is a required field + TimeoutAction *string `type:"string" required:"true" enum:"SpotProvisioningTimeoutAction"` + + // The spot provisioning timeout period in minutes. If Spot instances are not + // provisioned within this time period, the TimeOutAction is taken. Minimum + // value is 5 and maximum value is 1440. The timeout applies only during initial + // provisioning, when the cluster is first created. + // + // TimeoutDurationMinutes is a required field + TimeoutDurationMinutes *int64 `type:"integer" required:"true"` +} + +// String returns the string representation +func (s SpotProvisioningSpecification) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SpotProvisioningSpecification) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SpotProvisioningSpecification) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SpotProvisioningSpecification"} + if s.TimeoutAction == nil { + invalidParams.Add(request.NewErrParamRequired("TimeoutAction")) + } + if s.TimeoutDurationMinutes == nil { + invalidParams.Add(request.NewErrParamRequired("TimeoutDurationMinutes")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetBlockDurationMinutes sets the BlockDurationMinutes field's value. +func (s *SpotProvisioningSpecification) SetBlockDurationMinutes(v int64) *SpotProvisioningSpecification { + s.BlockDurationMinutes = &v + return s +} + +// SetTimeoutAction sets the TimeoutAction field's value. +func (s *SpotProvisioningSpecification) SetTimeoutAction(v string) *SpotProvisioningSpecification { + s.TimeoutAction = &v + return s +} + +// SetTimeoutDurationMinutes sets the TimeoutDurationMinutes field's value. +func (s *SpotProvisioningSpecification) SetTimeoutDurationMinutes(v int64) *SpotProvisioningSpecification { + s.TimeoutDurationMinutes = &v + return s +} + // This represents a step in a cluster. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/Step type Step struct { @@ -7642,20 +9636,20 @@ func (s *Step) SetStatus(v *StepStatus) *Step { return s } -// Specification of a job flow step. +// Specification of a cluster (job flow) step. // Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/StepConfig type StepConfig struct { _ struct{} `type:"structure"` - // The action to take if the job flow step fails. + // The action to take if the step fails. ActionOnFailure *string `type:"string" enum:"ActionOnFailure"` - // The JAR file used for the job flow step. + // The JAR file used for the step. // // HadoopJarStep is a required field HadoopJarStep *HadoopJarStepConfig `type:"structure" required:"true"` - // The name of the job flow step. + // The name of the step. // // Name is a required field Name *string `type:"string" required:"true"` @@ -7767,7 +9761,7 @@ type StepExecutionStatusDetail struct { // The start date and time of the step. StartDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` - // The state of the job flow step. + // The state of the step. // // State is a required field State *string `type:"string" required:"true" enum:"StepExecutionState"` @@ -8326,6 +10320,62 @@ const ( ComparisonOperatorLessThanOrEqual = "LESS_THAN_OR_EQUAL" ) +const ( + // InstanceCollectionTypeInstanceFleet is a InstanceCollectionType enum value + InstanceCollectionTypeInstanceFleet = "INSTANCE_FLEET" + + // InstanceCollectionTypeInstanceGroup is a InstanceCollectionType enum value + InstanceCollectionTypeInstanceGroup = "INSTANCE_GROUP" +) + +const ( + // InstanceFleetStateProvisioning is a InstanceFleetState enum value + InstanceFleetStateProvisioning = "PROVISIONING" + + // InstanceFleetStateBootstrapping is a InstanceFleetState enum value + InstanceFleetStateBootstrapping = "BOOTSTRAPPING" + + // InstanceFleetStateRunning is a InstanceFleetState enum value + InstanceFleetStateRunning = "RUNNING" + + // InstanceFleetStateResizing is a InstanceFleetState enum value + InstanceFleetStateResizing = "RESIZING" + + // InstanceFleetStateSuspended is a InstanceFleetState enum value + InstanceFleetStateSuspended = "SUSPENDED" + + // InstanceFleetStateTerminating is a InstanceFleetState enum value + InstanceFleetStateTerminating = "TERMINATING" + + // InstanceFleetStateTerminated is a InstanceFleetState enum value + InstanceFleetStateTerminated = "TERMINATED" +) + +const ( + // InstanceFleetStateChangeReasonCodeInternalError is a InstanceFleetStateChangeReasonCode enum value + InstanceFleetStateChangeReasonCodeInternalError = "INTERNAL_ERROR" + + // InstanceFleetStateChangeReasonCodeValidationError is a InstanceFleetStateChangeReasonCode enum value + InstanceFleetStateChangeReasonCodeValidationError = "VALIDATION_ERROR" + + // InstanceFleetStateChangeReasonCodeInstanceFailure is a InstanceFleetStateChangeReasonCode enum value + InstanceFleetStateChangeReasonCodeInstanceFailure = "INSTANCE_FAILURE" + + // InstanceFleetStateChangeReasonCodeClusterTerminated is a InstanceFleetStateChangeReasonCode enum value + InstanceFleetStateChangeReasonCodeClusterTerminated = "CLUSTER_TERMINATED" +) + +const ( + // InstanceFleetTypeMaster is a InstanceFleetType enum value + InstanceFleetTypeMaster = "MASTER" + + // InstanceFleetTypeCore is a InstanceFleetType enum value + InstanceFleetTypeCore = "CORE" + + // InstanceFleetTypeTask is a InstanceFleetType enum value + InstanceFleetTypeTask = "TASK" +) + const ( // InstanceGroupStateProvisioning is a InstanceGroupState enum value InstanceGroupStateProvisioning = "PROVISIONING" @@ -8471,6 +10521,14 @@ const ( ScaleDownBehaviorTerminateAtTaskCompletion = "TERMINATE_AT_TASK_COMPLETION" ) +const ( + // SpotProvisioningTimeoutActionSwitchToOnDemand is a SpotProvisioningTimeoutAction enum value + SpotProvisioningTimeoutActionSwitchToOnDemand = "SWITCH_TO_ON_DEMAND" + + // SpotProvisioningTimeoutActionTerminateCluster is a SpotProvisioningTimeoutAction enum value + SpotProvisioningTimeoutActionTerminateCluster = "TERMINATE_CLUSTER" +) + const ( // StatisticSampleCount is a Statistic enum value StatisticSampleCount = "SAMPLE_COUNT" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/errors.go index 7621ae6620..b4bf33708e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package emr diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/service.go index 610c465801..04d982bc86 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package emr diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/waiters.go index ccf17eb963..6e1b7ddec5 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/emr/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/emr/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package emr import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilClusterRunning uses the Amazon EMR API operation @@ -11,50 +14,116 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *EMR) WaitUntilClusterRunning(input *DescribeClusterInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeCluster", - Delay: 30, + return c.WaitUntilClusterRunningWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilClusterRunningWithContext is an extended version of WaitUntilClusterRunning. +// 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 *EMR) WaitUntilClusterRunningWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilClusterRunning", MaxAttempts: 60, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "Cluster.Status.State", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State", Expected: "RUNNING", }, { - State: "success", - Matcher: "path", - Argument: "Cluster.Status.State", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State", Expected: "WAITING", }, { - State: "failure", - Matcher: "path", - Argument: "Cluster.Status.State", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State", Expected: "TERMINATING", }, { - State: "failure", - Matcher: "path", - Argument: "Cluster.Status.State", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State", Expected: "TERMINATED", }, { - State: "failure", - Matcher: "path", - Argument: "Cluster.Status.State", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State", Expected: "TERMINATED_WITH_ERRORS", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeClusterInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, + return w.WaitWithContext(ctx) +} + +// WaitUntilClusterTerminated uses the Amazon EMR API operation +// DescribeCluster to wait for a condition to be met before returning. +// If the condition is not meet within the max attempt window an error will +// be returned. +func (c *EMR) WaitUntilClusterTerminated(input *DescribeClusterInput) error { + return c.WaitUntilClusterTerminatedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilClusterTerminatedWithContext is an extended version of WaitUntilClusterTerminated. +// 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 *EMR) WaitUntilClusterTerminatedWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilClusterTerminated", + MaxAttempts: 60, + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State", + Expected: "TERMINATED", + }, + { + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Cluster.Status.State", + Expected: "TERMINATED_WITH_ERRORS", + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeClusterInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } - return w.Wait() + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) } // WaitUntilStepComplete uses the Amazon EMR API operation @@ -62,36 +131,53 @@ func (c *EMR) WaitUntilClusterRunning(input *DescribeClusterInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *EMR) WaitUntilStepComplete(input *DescribeStepInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeStep", - Delay: 30, + return c.WaitUntilStepCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStepCompleteWithContext is an extended version of WaitUntilStepComplete. +// 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 *EMR) WaitUntilStepCompleteWithContext(ctx aws.Context, input *DescribeStepInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilStepComplete", MaxAttempts: 60, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "Step.Status.State", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Step.Status.State", Expected: "COMPLETED", }, { - State: "failure", - Matcher: "path", - Argument: "Step.Status.State", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Step.Status.State", Expected: "FAILED", }, { - State: "failure", - Matcher: "path", - Argument: "Step.Status.State", + State: request.FailureWaiterState, + Matcher: request.PathWaiterMatch, Argument: "Step.Status.State", Expected: "CANCELLED", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeStepInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStepRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/api.go index b22bb85d60..0a4eb541eb 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package firehose provides a client for Amazon Kinesis Firehose. package firehose @@ -7,6 +7,7 @@ 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" ) @@ -122,8 +123,23 @@ func (c *Firehose) CreateDeliveryStreamRequest(input *CreateDeliveryStreamInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/CreateDeliveryStream func (c *Firehose) CreateDeliveryStream(input *CreateDeliveryStreamInput) (*CreateDeliveryStreamOutput, error) { req, out := c.CreateDeliveryStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDeliveryStreamWithContext is the same as CreateDeliveryStream with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDeliveryStream 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 *Firehose) CreateDeliveryStreamWithContext(ctx aws.Context, input *CreateDeliveryStreamInput, opts ...request.Option) (*CreateDeliveryStreamOutput, error) { + req, out := c.CreateDeliveryStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDeliveryStream = "DeleteDeliveryStream" @@ -201,8 +217,23 @@ func (c *Firehose) DeleteDeliveryStreamRequest(input *DeleteDeliveryStreamInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/DeleteDeliveryStream func (c *Firehose) DeleteDeliveryStream(input *DeleteDeliveryStreamInput) (*DeleteDeliveryStreamOutput, error) { req, out := c.DeleteDeliveryStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDeliveryStreamWithContext is the same as DeleteDeliveryStream with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeliveryStream 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 *Firehose) DeleteDeliveryStreamWithContext(ctx aws.Context, input *DeleteDeliveryStreamInput, opts ...request.Option) (*DeleteDeliveryStreamOutput, error) { + req, out := c.DeleteDeliveryStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDeliveryStream = "DescribeDeliveryStream" @@ -269,8 +300,23 @@ func (c *Firehose) DescribeDeliveryStreamRequest(input *DescribeDeliveryStreamIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/DescribeDeliveryStream func (c *Firehose) DescribeDeliveryStream(input *DescribeDeliveryStreamInput) (*DescribeDeliveryStreamOutput, error) { req, out := c.DescribeDeliveryStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDeliveryStreamWithContext is the same as DescribeDeliveryStream with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDeliveryStream 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 *Firehose) DescribeDeliveryStreamWithContext(ctx aws.Context, input *DescribeDeliveryStreamInput, opts ...request.Option) (*DescribeDeliveryStreamOutput, error) { + req, out := c.DescribeDeliveryStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListDeliveryStreams = "ListDeliveryStreams" @@ -337,8 +383,23 @@ func (c *Firehose) ListDeliveryStreamsRequest(input *ListDeliveryStreamsInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/ListDeliveryStreams func (c *Firehose) ListDeliveryStreams(input *ListDeliveryStreamsInput) (*ListDeliveryStreamsOutput, error) { req, out := c.ListDeliveryStreamsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDeliveryStreamsWithContext is the same as ListDeliveryStreams with the addition of +// the ability to pass a context and additional request options. +// +// See ListDeliveryStreams 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 *Firehose) ListDeliveryStreamsWithContext(ctx aws.Context, input *ListDeliveryStreamsInput, opts ...request.Option) (*ListDeliveryStreamsOutput, error) { + req, out := c.ListDeliveryStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRecord = "PutRecord" @@ -443,8 +504,23 @@ func (c *Firehose) PutRecordRequest(input *PutRecordInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/PutRecord func (c *Firehose) PutRecord(input *PutRecordInput) (*PutRecordOutput, error) { req, out := c.PutRecordRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRecordWithContext is the same as PutRecord with the addition of +// the ability to pass a context and additional request options. +// +// See PutRecord 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 *Firehose) PutRecordWithContext(ctx aws.Context, input *PutRecordInput, opts ...request.Option) (*PutRecordOutput, error) { + req, out := c.PutRecordRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRecordBatch = "PutRecordBatch" @@ -573,8 +649,23 @@ func (c *Firehose) PutRecordBatchRequest(input *PutRecordBatchInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/PutRecordBatch func (c *Firehose) PutRecordBatch(input *PutRecordBatchInput) (*PutRecordBatchOutput, error) { req, out := c.PutRecordBatchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRecordBatchWithContext is the same as PutRecordBatch with the addition of +// the ability to pass a context and additional request options. +// +// See PutRecordBatch 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 *Firehose) PutRecordBatchWithContext(ctx aws.Context, input *PutRecordBatchInput, opts ...request.Option) (*PutRecordBatchOutput, error) { + req, out := c.PutRecordBatchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDestination = "UpdateDestination" @@ -677,8 +768,23 @@ func (c *Firehose) UpdateDestinationRequest(input *UpdateDestinationInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/UpdateDestination func (c *Firehose) UpdateDestination(input *UpdateDestinationInput) (*UpdateDestinationOutput, error) { req, out := c.UpdateDestinationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDestinationWithContext is the same as UpdateDestination with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDestination 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 *Firehose) UpdateDestinationWithContext(ctx aws.Context, input *UpdateDestinationInput, opts ...request.Option) (*UpdateDestinationOutput, error) { + req, out := c.UpdateDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Describes hints for the buffering to perform before delivering data to the diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/errors.go index f541053f07..82bdcca243 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package firehose diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/service.go index 930a4d4284..08350cf627 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/firehose/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package firehose diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go index e48809ed05..2fc06cc137 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package glacier provides a client for Amazon Glacier. package glacier @@ -6,6 +6,7 @@ package glacier import ( "io" + "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" @@ -101,8 +102,23 @@ func (c *Glacier) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) // func (c *Glacier) AbortMultipartUpload(input *AbortMultipartUploadInput) (*AbortMultipartUploadOutput, error) { req, out := c.AbortMultipartUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AbortMultipartUploadWithContext is the same as AbortMultipartUpload with the addition of +// the ability to pass a context and additional request options. +// +// See AbortMultipartUpload 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 *Glacier) AbortMultipartUploadWithContext(ctx aws.Context, input *AbortMultipartUploadInput, opts ...request.Option) (*AbortMultipartUploadOutput, error) { + req, out := c.AbortMultipartUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAbortVaultLock = "AbortVaultLock" @@ -190,8 +206,23 @@ func (c *Glacier) AbortVaultLockRequest(input *AbortVaultLockInput) (req *reques // func (c *Glacier) AbortVaultLock(input *AbortVaultLockInput) (*AbortVaultLockOutput, error) { req, out := c.AbortVaultLockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AbortVaultLockWithContext is the same as AbortVaultLock with the addition of +// the ability to pass a context and additional request options. +// +// See AbortVaultLock 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 *Glacier) AbortVaultLockWithContext(ctx aws.Context, input *AbortVaultLockInput, opts ...request.Option) (*AbortVaultLockOutput, error) { + req, out := c.AbortVaultLockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddTagsToVault = "AddTagsToVault" @@ -272,8 +303,23 @@ func (c *Glacier) AddTagsToVaultRequest(input *AddTagsToVaultInput) (req *reques // func (c *Glacier) AddTagsToVault(input *AddTagsToVaultInput) (*AddTagsToVaultOutput, error) { req, out := c.AddTagsToVaultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToVaultWithContext is the same as AddTagsToVault with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToVault 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 *Glacier) AddTagsToVaultWithContext(ctx aws.Context, input *AddTagsToVaultInput, opts ...request.Option) (*AddTagsToVaultOutput, error) { + req, out := c.AddTagsToVaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCompleteMultipartUpload = "CompleteMultipartUpload" @@ -387,8 +433,23 @@ func (c *Glacier) CompleteMultipartUploadRequest(input *CompleteMultipartUploadI // func (c *Glacier) CompleteMultipartUpload(input *CompleteMultipartUploadInput) (*ArchiveCreationOutput, error) { req, out := c.CompleteMultipartUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CompleteMultipartUploadWithContext is the same as CompleteMultipartUpload with the addition of +// the ability to pass a context and additional request options. +// +// See CompleteMultipartUpload 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 *Glacier) CompleteMultipartUploadWithContext(ctx aws.Context, input *CompleteMultipartUploadInput, opts ...request.Option) (*ArchiveCreationOutput, error) { + req, out := c.CompleteMultipartUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCompleteVaultLock = "CompleteVaultLock" @@ -475,8 +536,23 @@ func (c *Glacier) CompleteVaultLockRequest(input *CompleteVaultLockInput) (req * // func (c *Glacier) CompleteVaultLock(input *CompleteVaultLockInput) (*CompleteVaultLockOutput, error) { req, out := c.CompleteVaultLockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CompleteVaultLockWithContext is the same as CompleteVaultLock with the addition of +// the ability to pass a context and additional request options. +// +// See CompleteVaultLock 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 *Glacier) CompleteVaultLockWithContext(ctx aws.Context, input *CompleteVaultLockInput, opts ...request.Option) (*CompleteVaultLockOutput, error) { + req, out := c.CompleteVaultLockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVault = "CreateVault" @@ -569,8 +645,23 @@ func (c *Glacier) CreateVaultRequest(input *CreateVaultInput) (req *request.Requ // func (c *Glacier) CreateVault(input *CreateVaultInput) (*CreateVaultOutput, error) { req, out := c.CreateVaultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVaultWithContext is the same as CreateVault with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVault 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 *Glacier) CreateVaultWithContext(ctx aws.Context, input *CreateVaultInput, opts ...request.Option) (*CreateVaultOutput, error) { + req, out := c.CreateVaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteArchive = "DeleteArchive" @@ -667,8 +758,23 @@ func (c *Glacier) DeleteArchiveRequest(input *DeleteArchiveInput) (req *request. // func (c *Glacier) DeleteArchive(input *DeleteArchiveInput) (*DeleteArchiveOutput, error) { req, out := c.DeleteArchiveRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteArchiveWithContext is the same as DeleteArchive with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteArchive 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 *Glacier) DeleteArchiveWithContext(ctx aws.Context, input *DeleteArchiveInput, opts ...request.Option) (*DeleteArchiveOutput, error) { + req, out := c.DeleteArchiveRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVault = "DeleteVault" @@ -763,8 +869,23 @@ func (c *Glacier) DeleteVaultRequest(input *DeleteVaultInput) (req *request.Requ // func (c *Glacier) DeleteVault(input *DeleteVaultInput) (*DeleteVaultOutput, error) { req, out := c.DeleteVaultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVaultWithContext is the same as DeleteVault with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVault 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 *Glacier) DeleteVaultWithContext(ctx aws.Context, input *DeleteVaultInput, opts ...request.Option) (*DeleteVaultOutput, error) { + req, out := c.DeleteVaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVaultAccessPolicy = "DeleteVaultAccessPolicy" @@ -846,8 +967,23 @@ func (c *Glacier) DeleteVaultAccessPolicyRequest(input *DeleteVaultAccessPolicyI // func (c *Glacier) DeleteVaultAccessPolicy(input *DeleteVaultAccessPolicyInput) (*DeleteVaultAccessPolicyOutput, error) { req, out := c.DeleteVaultAccessPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVaultAccessPolicyWithContext is the same as DeleteVaultAccessPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVaultAccessPolicy 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 *Glacier) DeleteVaultAccessPolicyWithContext(ctx aws.Context, input *DeleteVaultAccessPolicyInput, opts ...request.Option) (*DeleteVaultAccessPolicyOutput, error) { + req, out := c.DeleteVaultAccessPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVaultNotifications = "DeleteVaultNotifications" @@ -934,8 +1070,23 @@ func (c *Glacier) DeleteVaultNotificationsRequest(input *DeleteVaultNotification // func (c *Glacier) DeleteVaultNotifications(input *DeleteVaultNotificationsInput) (*DeleteVaultNotificationsOutput, error) { req, out := c.DeleteVaultNotificationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVaultNotificationsWithContext is the same as DeleteVaultNotifications with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVaultNotifications 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 *Glacier) DeleteVaultNotificationsWithContext(ctx aws.Context, input *DeleteVaultNotificationsInput, opts ...request.Option) (*DeleteVaultNotificationsOutput, error) { + req, out := c.DeleteVaultNotificationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeJob = "DescribeJob" @@ -1027,8 +1178,23 @@ func (c *Glacier) DescribeJobRequest(input *DescribeJobInput) (req *request.Requ // func (c *Glacier) DescribeJob(input *DescribeJobInput) (*JobDescription, error) { req, out := c.DescribeJobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeJobWithContext is the same as DescribeJob with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeJob 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 *Glacier) DescribeJobWithContext(ctx aws.Context, input *DescribeJobInput, opts ...request.Option) (*JobDescription, error) { + req, out := c.DescribeJobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVault = "DescribeVault" @@ -1118,8 +1284,23 @@ func (c *Glacier) DescribeVaultRequest(input *DescribeVaultInput) (req *request. // func (c *Glacier) DescribeVault(input *DescribeVaultInput) (*DescribeVaultOutput, error) { req, out := c.DescribeVaultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVaultWithContext is the same as DescribeVault with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVault 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 *Glacier) DescribeVaultWithContext(ctx aws.Context, input *DescribeVaultInput, opts ...request.Option) (*DescribeVaultOutput, error) { + req, out := c.DescribeVaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDataRetrievalPolicy = "GetDataRetrievalPolicy" @@ -1188,8 +1369,23 @@ func (c *Glacier) GetDataRetrievalPolicyRequest(input *GetDataRetrievalPolicyInp // func (c *Glacier) GetDataRetrievalPolicy(input *GetDataRetrievalPolicyInput) (*GetDataRetrievalPolicyOutput, error) { req, out := c.GetDataRetrievalPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDataRetrievalPolicyWithContext is the same as GetDataRetrievalPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetDataRetrievalPolicy 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 *Glacier) GetDataRetrievalPolicyWithContext(ctx aws.Context, input *GetDataRetrievalPolicyInput, opts ...request.Option) (*GetDataRetrievalPolicyOutput, error) { + req, out := c.GetDataRetrievalPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetJobOutput = "GetJobOutput" @@ -1303,8 +1499,23 @@ func (c *Glacier) GetJobOutputRequest(input *GetJobOutputInput) (req *request.Re // func (c *Glacier) GetJobOutput(input *GetJobOutputInput) (*GetJobOutputOutput, error) { req, out := c.GetJobOutputRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetJobOutputWithContext is the same as GetJobOutput with the addition of +// the ability to pass a context and additional request options. +// +// See GetJobOutput 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 *Glacier) GetJobOutputWithContext(ctx aws.Context, input *GetJobOutputInput, opts ...request.Option) (*GetJobOutputOutput, error) { + req, out := c.GetJobOutputRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetVaultAccessPolicy = "GetVaultAccessPolicy" @@ -1380,8 +1591,23 @@ func (c *Glacier) GetVaultAccessPolicyRequest(input *GetVaultAccessPolicyInput) // func (c *Glacier) GetVaultAccessPolicy(input *GetVaultAccessPolicyInput) (*GetVaultAccessPolicyOutput, error) { req, out := c.GetVaultAccessPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetVaultAccessPolicyWithContext is the same as GetVaultAccessPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetVaultAccessPolicy 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 *Glacier) GetVaultAccessPolicyWithContext(ctx aws.Context, input *GetVaultAccessPolicyInput, opts ...request.Option) (*GetVaultAccessPolicyOutput, error) { + req, out := c.GetVaultAccessPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetVaultLock = "GetVaultLock" @@ -1471,8 +1697,23 @@ func (c *Glacier) GetVaultLockRequest(input *GetVaultLockInput) (req *request.Re // func (c *Glacier) GetVaultLock(input *GetVaultLockInput) (*GetVaultLockOutput, error) { req, out := c.GetVaultLockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetVaultLockWithContext is the same as GetVaultLock with the addition of +// the ability to pass a context and additional request options. +// +// See GetVaultLock 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 *Glacier) GetVaultLockWithContext(ctx aws.Context, input *GetVaultLockInput, opts ...request.Option) (*GetVaultLockOutput, error) { + req, out := c.GetVaultLockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetVaultNotifications = "GetVaultNotifications" @@ -1561,8 +1802,23 @@ func (c *Glacier) GetVaultNotificationsRequest(input *GetVaultNotificationsInput // func (c *Glacier) GetVaultNotifications(input *GetVaultNotificationsInput) (*GetVaultNotificationsOutput, error) { req, out := c.GetVaultNotificationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetVaultNotificationsWithContext is the same as GetVaultNotifications with the addition of +// the ability to pass a context and additional request options. +// +// See GetVaultNotifications 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 *Glacier) GetVaultNotificationsWithContext(ctx aws.Context, input *GetVaultNotificationsInput, opts ...request.Option) (*GetVaultNotificationsOutput, error) { + req, out := c.GetVaultNotificationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opInitiateJob = "InitiateJob" @@ -1777,8 +2033,23 @@ func (c *Glacier) InitiateJobRequest(input *InitiateJobInput) (req *request.Requ // func (c *Glacier) InitiateJob(input *InitiateJobInput) (*InitiateJobOutput, error) { req, out := c.InitiateJobRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// InitiateJobWithContext is the same as InitiateJob with the addition of +// the ability to pass a context and additional request options. +// +// See InitiateJob 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 *Glacier) InitiateJobWithContext(ctx aws.Context, input *InitiateJobInput, opts ...request.Option) (*InitiateJobOutput, error) { + req, out := c.InitiateJobRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opInitiateMultipartUpload = "InitiateMultipartUpload" @@ -1883,8 +2154,23 @@ func (c *Glacier) InitiateMultipartUploadRequest(input *InitiateMultipartUploadI // func (c *Glacier) InitiateMultipartUpload(input *InitiateMultipartUploadInput) (*InitiateMultipartUploadOutput, error) { req, out := c.InitiateMultipartUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// InitiateMultipartUploadWithContext is the same as InitiateMultipartUpload with the addition of +// the ability to pass a context and additional request options. +// +// See InitiateMultipartUpload 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 *Glacier) InitiateMultipartUploadWithContext(ctx aws.Context, input *InitiateMultipartUploadInput, opts ...request.Option) (*InitiateMultipartUploadOutput, error) { + req, out := c.InitiateMultipartUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opInitiateVaultLock = "InitiateVaultLock" @@ -1983,8 +2269,23 @@ func (c *Glacier) InitiateVaultLockRequest(input *InitiateVaultLockInput) (req * // func (c *Glacier) InitiateVaultLock(input *InitiateVaultLockInput) (*InitiateVaultLockOutput, error) { req, out := c.InitiateVaultLockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// InitiateVaultLockWithContext is the same as InitiateVaultLock with the addition of +// the ability to pass a context and additional request options. +// +// See InitiateVaultLock 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 *Glacier) InitiateVaultLockWithContext(ctx aws.Context, input *InitiateVaultLockInput, opts ...request.Option) (*InitiateVaultLockOutput, error) { + req, out := c.InitiateVaultLockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListJobs = "ListJobs" @@ -2100,8 +2401,23 @@ func (c *Glacier) ListJobsRequest(input *ListJobsInput) (req *request.Request, o // func (c *Glacier) ListJobs(input *ListJobsInput) (*ListJobsOutput, error) { req, out := c.ListJobsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListJobsWithContext is the same as ListJobs with the addition of +// the ability to pass a context and additional request options. +// +// See ListJobs 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 *Glacier) ListJobsWithContext(ctx aws.Context, input *ListJobsInput, opts ...request.Option) (*ListJobsOutput, error) { + req, out := c.ListJobsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListJobsPages iterates over the pages of a ListJobs operation, @@ -2121,12 +2437,37 @@ func (c *Glacier) ListJobs(input *ListJobsInput) (*ListJobsOutput, error) { // return pageNum <= 3 // }) // -func (c *Glacier) ListJobsPages(input *ListJobsInput, fn func(p *ListJobsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListJobsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListJobsOutput), lastPage) - }) +func (c *Glacier) ListJobsPages(input *ListJobsInput, fn func(*ListJobsOutput, bool) bool) error { + return c.ListJobsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListJobsPagesWithContext same as ListJobsPages 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 *Glacier) ListJobsPagesWithContext(ctx aws.Context, input *ListJobsInput, fn func(*ListJobsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListJobsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListJobsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListJobsOutput), !p.HasNextPage()) + } + return p.Err() } const opListMultipartUploads = "ListMultipartUploads" @@ -2232,8 +2573,23 @@ func (c *Glacier) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) // func (c *Glacier) ListMultipartUploads(input *ListMultipartUploadsInput) (*ListMultipartUploadsOutput, error) { req, out := c.ListMultipartUploadsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListMultipartUploadsWithContext is the same as ListMultipartUploads with the addition of +// the ability to pass a context and additional request options. +// +// See ListMultipartUploads 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 *Glacier) ListMultipartUploadsWithContext(ctx aws.Context, input *ListMultipartUploadsInput, opts ...request.Option) (*ListMultipartUploadsOutput, error) { + req, out := c.ListMultipartUploadsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListMultipartUploadsPages iterates over the pages of a ListMultipartUploads operation, @@ -2253,12 +2609,37 @@ func (c *Glacier) ListMultipartUploads(input *ListMultipartUploadsInput) (*ListM // return pageNum <= 3 // }) // -func (c *Glacier) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func(p *ListMultipartUploadsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListMultipartUploadsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListMultipartUploadsOutput), lastPage) - }) +func (c *Glacier) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool) error { + return c.ListMultipartUploadsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListMultipartUploadsPagesWithContext same as ListMultipartUploadsPages 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 *Glacier) ListMultipartUploadsPagesWithContext(ctx aws.Context, input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListMultipartUploadsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListMultipartUploadsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListMultipartUploadsOutput), !p.HasNextPage()) + } + return p.Err() } const opListParts = "ListParts" @@ -2358,8 +2739,23 @@ func (c *Glacier) ListPartsRequest(input *ListPartsInput) (req *request.Request, // func (c *Glacier) ListParts(input *ListPartsInput) (*ListPartsOutput, error) { req, out := c.ListPartsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPartsWithContext is the same as ListParts with the addition of +// the ability to pass a context and additional request options. +// +// See ListParts 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 *Glacier) ListPartsWithContext(ctx aws.Context, input *ListPartsInput, opts ...request.Option) (*ListPartsOutput, error) { + req, out := c.ListPartsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListPartsPages iterates over the pages of a ListParts operation, @@ -2379,12 +2775,37 @@ func (c *Glacier) ListParts(input *ListPartsInput) (*ListPartsOutput, error) { // return pageNum <= 3 // }) // -func (c *Glacier) ListPartsPages(input *ListPartsInput, fn func(p *ListPartsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListPartsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListPartsOutput), lastPage) - }) +func (c *Glacier) ListPartsPages(input *ListPartsInput, fn func(*ListPartsOutput, bool) bool) error { + return c.ListPartsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListPartsPagesWithContext same as ListPartsPages 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 *Glacier) ListPartsPagesWithContext(ctx aws.Context, input *ListPartsInput, fn func(*ListPartsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListPartsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListPartsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListPartsOutput), !p.HasNextPage()) + } + return p.Err() } const opListProvisionedCapacity = "ListProvisionedCapacity" @@ -2451,8 +2872,23 @@ func (c *Glacier) ListProvisionedCapacityRequest(input *ListProvisionedCapacityI // func (c *Glacier) ListProvisionedCapacity(input *ListProvisionedCapacityInput) (*ListProvisionedCapacityOutput, error) { req, out := c.ListProvisionedCapacityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListProvisionedCapacityWithContext is the same as ListProvisionedCapacity with the addition of +// the ability to pass a context and additional request options. +// +// See ListProvisionedCapacity 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 *Glacier) ListProvisionedCapacityWithContext(ctx aws.Context, input *ListProvisionedCapacityInput, opts ...request.Option) (*ListProvisionedCapacityOutput, error) { + req, out := c.ListProvisionedCapacityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForVault = "ListTagsForVault" @@ -2525,8 +2961,23 @@ func (c *Glacier) ListTagsForVaultRequest(input *ListTagsForVaultInput) (req *re // func (c *Glacier) ListTagsForVault(input *ListTagsForVaultInput) (*ListTagsForVaultOutput, error) { req, out := c.ListTagsForVaultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForVaultWithContext is the same as ListTagsForVault with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForVault 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 *Glacier) ListTagsForVaultWithContext(ctx aws.Context, input *ListTagsForVaultInput, opts ...request.Option) (*ListTagsForVaultOutput, error) { + req, out := c.ListTagsForVaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListVaults = "ListVaults" @@ -2623,8 +3074,23 @@ func (c *Glacier) ListVaultsRequest(input *ListVaultsInput) (req *request.Reques // func (c *Glacier) ListVaults(input *ListVaultsInput) (*ListVaultsOutput, error) { req, out := c.ListVaultsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListVaultsWithContext is the same as ListVaults with the addition of +// the ability to pass a context and additional request options. +// +// See ListVaults 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 *Glacier) ListVaultsWithContext(ctx aws.Context, input *ListVaultsInput, opts ...request.Option) (*ListVaultsOutput, error) { + req, out := c.ListVaultsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListVaultsPages iterates over the pages of a ListVaults operation, @@ -2644,12 +3110,37 @@ func (c *Glacier) ListVaults(input *ListVaultsInput) (*ListVaultsOutput, error) // return pageNum <= 3 // }) // -func (c *Glacier) ListVaultsPages(input *ListVaultsInput, fn func(p *ListVaultsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListVaultsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListVaultsOutput), lastPage) - }) +func (c *Glacier) ListVaultsPages(input *ListVaultsInput, fn func(*ListVaultsOutput, bool) bool) error { + return c.ListVaultsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListVaultsPagesWithContext same as ListVaultsPages 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 *Glacier) ListVaultsPagesWithContext(ctx aws.Context, input *ListVaultsInput, fn func(*ListVaultsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListVaultsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListVaultsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListVaultsOutput), !p.HasNextPage()) + } + return p.Err() } const opPurchaseProvisionedCapacity = "PurchaseProvisionedCapacity" @@ -2719,8 +3210,23 @@ func (c *Glacier) PurchaseProvisionedCapacityRequest(input *PurchaseProvisionedC // func (c *Glacier) PurchaseProvisionedCapacity(input *PurchaseProvisionedCapacityInput) (*PurchaseProvisionedCapacityOutput, error) { req, out := c.PurchaseProvisionedCapacityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurchaseProvisionedCapacityWithContext is the same as PurchaseProvisionedCapacity with the addition of +// the ability to pass a context and additional request options. +// +// See PurchaseProvisionedCapacity 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 *Glacier) PurchaseProvisionedCapacityWithContext(ctx aws.Context, input *PurchaseProvisionedCapacityInput, opts ...request.Option) (*PurchaseProvisionedCapacityOutput, error) { + req, out := c.PurchaseProvisionedCapacityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromVault = "RemoveTagsFromVault" @@ -2797,8 +3303,23 @@ func (c *Glacier) RemoveTagsFromVaultRequest(input *RemoveTagsFromVaultInput) (r // func (c *Glacier) RemoveTagsFromVault(input *RemoveTagsFromVaultInput) (*RemoveTagsFromVaultOutput, error) { req, out := c.RemoveTagsFromVaultRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromVaultWithContext is the same as RemoveTagsFromVault with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromVault 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 *Glacier) RemoveTagsFromVaultWithContext(ctx aws.Context, input *RemoveTagsFromVaultInput, opts ...request.Option) (*RemoveTagsFromVaultOutput, error) { + req, out := c.RemoveTagsFromVaultRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetDataRetrievalPolicy = "SetDataRetrievalPolicy" @@ -2873,8 +3394,23 @@ func (c *Glacier) SetDataRetrievalPolicyRequest(input *SetDataRetrievalPolicyInp // func (c *Glacier) SetDataRetrievalPolicy(input *SetDataRetrievalPolicyInput) (*SetDataRetrievalPolicyOutput, error) { req, out := c.SetDataRetrievalPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetDataRetrievalPolicyWithContext is the same as SetDataRetrievalPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See SetDataRetrievalPolicy 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 *Glacier) SetDataRetrievalPolicyWithContext(ctx aws.Context, input *SetDataRetrievalPolicyInput, opts ...request.Option) (*SetDataRetrievalPolicyOutput, error) { + req, out := c.SetDataRetrievalPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetVaultAccessPolicy = "SetVaultAccessPolicy" @@ -2953,8 +3489,23 @@ func (c *Glacier) SetVaultAccessPolicyRequest(input *SetVaultAccessPolicyInput) // func (c *Glacier) SetVaultAccessPolicy(input *SetVaultAccessPolicyInput) (*SetVaultAccessPolicyOutput, error) { req, out := c.SetVaultAccessPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetVaultAccessPolicyWithContext is the same as SetVaultAccessPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See SetVaultAccessPolicy 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 *Glacier) SetVaultAccessPolicyWithContext(ctx aws.Context, input *SetVaultAccessPolicyInput, opts ...request.Option) (*SetVaultAccessPolicyOutput, error) { + req, out := c.SetVaultAccessPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetVaultNotifications = "SetVaultNotifications" @@ -3058,8 +3609,23 @@ func (c *Glacier) SetVaultNotificationsRequest(input *SetVaultNotificationsInput // func (c *Glacier) SetVaultNotifications(input *SetVaultNotificationsInput) (*SetVaultNotificationsOutput, error) { req, out := c.SetVaultNotificationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetVaultNotificationsWithContext is the same as SetVaultNotifications with the addition of +// the ability to pass a context and additional request options. +// +// See SetVaultNotifications 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 *Glacier) SetVaultNotificationsWithContext(ctx aws.Context, input *SetVaultNotificationsInput, opts ...request.Option) (*SetVaultNotificationsOutput, error) { + req, out := c.SetVaultNotificationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadArchive = "UploadArchive" @@ -3169,8 +3735,23 @@ func (c *Glacier) UploadArchiveRequest(input *UploadArchiveInput) (req *request. // func (c *Glacier) UploadArchive(input *UploadArchiveInput) (*ArchiveCreationOutput, error) { req, out := c.UploadArchiveRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadArchiveWithContext is the same as UploadArchive with the addition of +// the ability to pass a context and additional request options. +// +// See UploadArchive 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 *Glacier) UploadArchiveWithContext(ctx aws.Context, input *UploadArchiveInput, opts ...request.Option) (*ArchiveCreationOutput, error) { + req, out := c.UploadArchiveRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadMultipartPart = "UploadMultipartPart" @@ -3290,8 +3871,23 @@ func (c *Glacier) UploadMultipartPartRequest(input *UploadMultipartPartInput) (r // func (c *Glacier) UploadMultipartPart(input *UploadMultipartPartInput) (*UploadMultipartPartOutput, error) { req, out := c.UploadMultipartPartRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadMultipartPartWithContext is the same as UploadMultipartPart with the addition of +// the ability to pass a context and additional request options. +// +// See UploadMultipartPart 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 *Glacier) UploadMultipartPartWithContext(ctx aws.Context, input *UploadMultipartPartInput, opts ...request.Option) (*UploadMultipartPartOutput, error) { + req, out := c.UploadMultipartPartRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Provides options to abort a multipart upload identified by the upload ID. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go index 9ce95315a8..c47e3bb305 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package glacier diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/service.go index d668dde263..7caefefddd 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package glacier diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/treehash.go b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/treehash.go index dac44baf5a..e1ee0aa5b7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/treehash.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/treehash.go @@ -15,6 +15,8 @@ type Hash struct { } // ComputeHashes computes the tree-hash and linear hash of a seekable reader r. +// +// See http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html for more information. func ComputeHashes(r io.ReadSeeker) Hash { r.Seek(0, 0) // Read the whole stream defer r.Seek(0, 0) // Rewind stream at end @@ -41,12 +43,16 @@ func ComputeHashes(r io.ReadSeeker) Hash { return Hash{ LinearHash: hsh.Sum(nil), - TreeHash: buildHashTree(hashes), + TreeHash: ComputeTreeHash(hashes), } } -// buildHashTree builds a hash tree root node given a set of hashes. -func buildHashTree(hashes [][]byte) []byte { +// ComputeTreeHash builds a tree hash root node given a slice of +// hashes. Glacier tree hash to be derived from SHA256 hashes of 1MB +// chucks of the data. +// +// See http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html for more information. +func ComputeTreeHash(hashes [][]byte) []byte { if hashes == nil || len(hashes) == 0 { return nil } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/waiters.go index fd33dc977f..342fe25e76 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/glacier/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package glacier import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilVaultExists uses the Amazon Glacier API operation @@ -11,32 +14,50 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *Glacier) WaitUntilVaultExists(input *DescribeVaultInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVault", - Delay: 3, + return c.WaitUntilVaultExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVaultExistsWithContext is an extended version of WaitUntilVaultExists. +// 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 *Glacier) WaitUntilVaultExistsWithContext(ctx aws.Context, input *DescribeVaultInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVaultExists", MaxAttempts: 15, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(3 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ResourceNotFoundException", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVaultInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVaultRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilVaultNotExists uses the Amazon Glacier API operation @@ -44,30 +65,48 @@ func (c *Glacier) WaitUntilVaultExists(input *DescribeVaultInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *Glacier) WaitUntilVaultNotExists(input *DescribeVaultInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeVault", - Delay: 3, + return c.WaitUntilVaultNotExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilVaultNotExistsWithContext is an extended version of WaitUntilVaultNotExists. +// 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 *Glacier) WaitUntilVaultNotExistsWithContext(ctx aws.Context, input *DescribeVaultInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilVaultNotExists", MaxAttempts: 15, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(3 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "retry", - Matcher: "status", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ResourceNotFoundException", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeVaultInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeVaultRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/api.go index 1364f78c5b..7bf68ca830 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package iam provides a client for AWS Identity and Access Management. package iam @@ -7,6 +7,7 @@ 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" @@ -93,8 +94,23 @@ func (c *IAM) AddClientIDToOpenIDConnectProviderRequest(input *AddClientIDToOpen // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/AddClientIDToOpenIDConnectProvider func (c *IAM) AddClientIDToOpenIDConnectProvider(input *AddClientIDToOpenIDConnectProviderInput) (*AddClientIDToOpenIDConnectProviderOutput, error) { req, out := c.AddClientIDToOpenIDConnectProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddClientIDToOpenIDConnectProviderWithContext is the same as AddClientIDToOpenIDConnectProvider with the addition of +// the ability to pass a context and additional request options. +// +// See AddClientIDToOpenIDConnectProvider 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 *IAM) AddClientIDToOpenIDConnectProviderWithContext(ctx aws.Context, input *AddClientIDToOpenIDConnectProviderInput, opts ...request.Option) (*AddClientIDToOpenIDConnectProviderOutput, error) { + req, out := c.AddClientIDToOpenIDConnectProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddRoleToInstanceProfile = "AddRoleToInstanceProfile" @@ -180,8 +196,23 @@ func (c *IAM) AddRoleToInstanceProfileRequest(input *AddRoleToInstanceProfileInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/AddRoleToInstanceProfile func (c *IAM) AddRoleToInstanceProfile(input *AddRoleToInstanceProfileInput) (*AddRoleToInstanceProfileOutput, error) { req, out := c.AddRoleToInstanceProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddRoleToInstanceProfileWithContext is the same as AddRoleToInstanceProfile with the addition of +// the ability to pass a context and additional request options. +// +// See AddRoleToInstanceProfile 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 *IAM) AddRoleToInstanceProfileWithContext(ctx aws.Context, input *AddRoleToInstanceProfileInput, opts ...request.Option) (*AddRoleToInstanceProfileOutput, error) { + req, out := c.AddRoleToInstanceProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddUserToGroup = "AddUserToGroup" @@ -256,8 +287,23 @@ func (c *IAM) AddUserToGroupRequest(input *AddUserToGroupInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/AddUserToGroup func (c *IAM) AddUserToGroup(input *AddUserToGroupInput) (*AddUserToGroupOutput, error) { req, out := c.AddUserToGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddUserToGroupWithContext is the same as AddUserToGroup with the addition of +// the ability to pass a context and additional request options. +// +// See AddUserToGroup 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 *IAM) AddUserToGroupWithContext(ctx aws.Context, input *AddUserToGroupInput, opts ...request.Option) (*AddUserToGroupOutput, error) { + req, out := c.AddUserToGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachGroupPolicy = "AttachGroupPolicy" @@ -343,8 +389,23 @@ func (c *IAM) AttachGroupPolicyRequest(input *AttachGroupPolicyInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/AttachGroupPolicy func (c *IAM) AttachGroupPolicy(input *AttachGroupPolicyInput) (*AttachGroupPolicyOutput, error) { req, out := c.AttachGroupPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachGroupPolicyWithContext is the same as AttachGroupPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See AttachGroupPolicy 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 *IAM) AttachGroupPolicyWithContext(ctx aws.Context, input *AttachGroupPolicyInput, opts ...request.Option) (*AttachGroupPolicyOutput, error) { + req, out := c.AttachGroupPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachRolePolicy = "AttachRolePolicy" @@ -434,8 +495,23 @@ func (c *IAM) AttachRolePolicyRequest(input *AttachRolePolicyInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/AttachRolePolicy func (c *IAM) AttachRolePolicy(input *AttachRolePolicyInput) (*AttachRolePolicyOutput, error) { req, out := c.AttachRolePolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachRolePolicyWithContext is the same as AttachRolePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See AttachRolePolicy 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 *IAM) AttachRolePolicyWithContext(ctx aws.Context, input *AttachRolePolicyInput, opts ...request.Option) (*AttachRolePolicyOutput, error) { + req, out := c.AttachRolePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachUserPolicy = "AttachUserPolicy" @@ -521,8 +597,23 @@ func (c *IAM) AttachUserPolicyRequest(input *AttachUserPolicyInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/AttachUserPolicy func (c *IAM) AttachUserPolicy(input *AttachUserPolicyInput) (*AttachUserPolicyOutput, error) { req, out := c.AttachUserPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachUserPolicyWithContext is the same as AttachUserPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See AttachUserPolicy 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 *IAM) AttachUserPolicyWithContext(ctx aws.Context, input *AttachUserPolicyInput, opts ...request.Option) (*AttachUserPolicyOutput, error) { + req, out := c.AttachUserPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opChangePassword = "ChangePassword" @@ -616,8 +707,23 @@ func (c *IAM) ChangePasswordRequest(input *ChangePasswordInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ChangePassword func (c *IAM) ChangePassword(input *ChangePasswordInput) (*ChangePasswordOutput, error) { req, out := c.ChangePasswordRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ChangePasswordWithContext is the same as ChangePassword with the addition of +// the ability to pass a context and additional request options. +// +// See ChangePassword 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 *IAM) ChangePasswordWithContext(ctx aws.Context, input *ChangePasswordInput, opts ...request.Option) (*ChangePasswordOutput, error) { + req, out := c.ChangePasswordRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAccessKey = "CreateAccessKey" @@ -706,8 +812,23 @@ func (c *IAM) CreateAccessKeyRequest(input *CreateAccessKeyInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateAccessKey func (c *IAM) CreateAccessKey(input *CreateAccessKeyInput) (*CreateAccessKeyOutput, error) { req, out := c.CreateAccessKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAccessKeyWithContext is the same as CreateAccessKey with the addition of +// the ability to pass a context and additional request options. +// +// See CreateAccessKey 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 *IAM) CreateAccessKeyWithContext(ctx aws.Context, input *CreateAccessKeyInput, opts ...request.Option) (*CreateAccessKeyOutput, error) { + req, out := c.CreateAccessKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAccountAlias = "CreateAccountAlias" @@ -784,8 +905,23 @@ func (c *IAM) CreateAccountAliasRequest(input *CreateAccountAliasInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateAccountAlias func (c *IAM) CreateAccountAlias(input *CreateAccountAliasInput) (*CreateAccountAliasOutput, error) { req, out := c.CreateAccountAliasRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAccountAliasWithContext is the same as CreateAccountAlias with the addition of +// the ability to pass a context and additional request options. +// +// See CreateAccountAlias 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 *IAM) CreateAccountAliasWithContext(ctx aws.Context, input *CreateAccountAliasInput, opts ...request.Option) (*CreateAccountAliasOutput, error) { + req, out := c.CreateAccountAliasRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateGroup = "CreateGroup" @@ -866,8 +1002,23 @@ func (c *IAM) CreateGroupRequest(input *CreateGroupInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateGroup func (c *IAM) CreateGroup(input *CreateGroupInput) (*CreateGroupOutput, error) { req, out := c.CreateGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateGroupWithContext is the same as CreateGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateGroup 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 *IAM) CreateGroupWithContext(ctx aws.Context, input *CreateGroupInput, opts ...request.Option) (*CreateGroupOutput, error) { + req, out := c.CreateGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateInstanceProfile = "CreateInstanceProfile" @@ -945,8 +1096,23 @@ func (c *IAM) CreateInstanceProfileRequest(input *CreateInstanceProfileInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateInstanceProfile func (c *IAM) CreateInstanceProfile(input *CreateInstanceProfileInput) (*CreateInstanceProfileOutput, error) { req, out := c.CreateInstanceProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInstanceProfileWithContext is the same as CreateInstanceProfile with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInstanceProfile 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 *IAM) CreateInstanceProfileWithContext(ctx aws.Context, input *CreateInstanceProfileInput, opts ...request.Option) (*CreateInstanceProfileOutput, error) { + req, out := c.CreateInstanceProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateLoginProfile = "CreateLoginProfile" @@ -1030,8 +1196,23 @@ func (c *IAM) CreateLoginProfileRequest(input *CreateLoginProfileInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateLoginProfile func (c *IAM) CreateLoginProfile(input *CreateLoginProfileInput) (*CreateLoginProfileOutput, error) { req, out := c.CreateLoginProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateLoginProfileWithContext is the same as CreateLoginProfile with the addition of +// the ability to pass a context and additional request options. +// +// See CreateLoginProfile 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 *IAM) CreateLoginProfileWithContext(ctx aws.Context, input *CreateLoginProfileInput, opts ...request.Option) (*CreateLoginProfileOutput, error) { + req, out := c.CreateLoginProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateOpenIDConnectProvider = "CreateOpenIDConnectProvider" @@ -1124,8 +1305,23 @@ func (c *IAM) CreateOpenIDConnectProviderRequest(input *CreateOpenIDConnectProvi // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateOpenIDConnectProvider func (c *IAM) CreateOpenIDConnectProvider(input *CreateOpenIDConnectProviderInput) (*CreateOpenIDConnectProviderOutput, error) { req, out := c.CreateOpenIDConnectProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateOpenIDConnectProviderWithContext is the same as CreateOpenIDConnectProvider with the addition of +// the ability to pass a context and additional request options. +// +// See CreateOpenIDConnectProvider 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 *IAM) CreateOpenIDConnectProviderWithContext(ctx aws.Context, input *CreateOpenIDConnectProviderInput, opts ...request.Option) (*CreateOpenIDConnectProviderOutput, error) { + req, out := c.CreateOpenIDConnectProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePolicy = "CreatePolicy" @@ -1215,8 +1411,23 @@ func (c *IAM) CreatePolicyRequest(input *CreatePolicyInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreatePolicy func (c *IAM) CreatePolicy(input *CreatePolicyInput) (*CreatePolicyOutput, error) { req, out := c.CreatePolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePolicyWithContext is the same as CreatePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePolicy 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 *IAM) CreatePolicyWithContext(ctx aws.Context, input *CreatePolicyInput, opts ...request.Option) (*CreatePolicyOutput, error) { + req, out := c.CreatePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePolicyVersion = "CreatePolicyVersion" @@ -1308,8 +1519,23 @@ func (c *IAM) CreatePolicyVersionRequest(input *CreatePolicyVersionInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreatePolicyVersion func (c *IAM) CreatePolicyVersion(input *CreatePolicyVersionInput) (*CreatePolicyVersionOutput, error) { req, out := c.CreatePolicyVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePolicyVersionWithContext is the same as CreatePolicyVersion with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePolicyVersion 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 *IAM) CreatePolicyVersionWithContext(ctx aws.Context, input *CreatePolicyVersionInput, opts ...request.Option) (*CreatePolicyVersionOutput, error) { + req, out := c.CreatePolicyVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateRole = "CreateRole" @@ -1390,8 +1616,23 @@ func (c *IAM) CreateRoleRequest(input *CreateRoleInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateRole func (c *IAM) CreateRole(input *CreateRoleInput) (*CreateRoleOutput, error) { req, out := c.CreateRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateRoleWithContext is the same as CreateRole with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRole 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 *IAM) CreateRoleWithContext(ctx aws.Context, input *CreateRoleInput, opts ...request.Option) (*CreateRoleOutput, error) { + req, out := c.CreateRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSAMLProvider = "CreateSAMLProvider" @@ -1489,8 +1730,23 @@ func (c *IAM) CreateSAMLProviderRequest(input *CreateSAMLProviderInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateSAMLProvider func (c *IAM) CreateSAMLProvider(input *CreateSAMLProviderInput) (*CreateSAMLProviderOutput, error) { req, out := c.CreateSAMLProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSAMLProviderWithContext is the same as CreateSAMLProvider with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSAMLProvider 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 *IAM) CreateSAMLProviderWithContext(ctx aws.Context, input *CreateSAMLProviderInput, opts ...request.Option) (*CreateSAMLProviderOutput, error) { + req, out := c.CreateSAMLProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateServiceSpecificCredential = "CreateServiceSpecificCredential" @@ -1575,8 +1831,23 @@ func (c *IAM) CreateServiceSpecificCredentialRequest(input *CreateServiceSpecifi // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateServiceSpecificCredential func (c *IAM) CreateServiceSpecificCredential(input *CreateServiceSpecificCredentialInput) (*CreateServiceSpecificCredentialOutput, error) { req, out := c.CreateServiceSpecificCredentialRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateServiceSpecificCredentialWithContext is the same as CreateServiceSpecificCredential with the addition of +// the ability to pass a context and additional request options. +// +// See CreateServiceSpecificCredential 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 *IAM) CreateServiceSpecificCredentialWithContext(ctx aws.Context, input *CreateServiceSpecificCredentialInput, opts ...request.Option) (*CreateServiceSpecificCredentialOutput, error) { + req, out := c.CreateServiceSpecificCredentialRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateUser = "CreateUser" @@ -1657,8 +1928,23 @@ func (c *IAM) CreateUserRequest(input *CreateUserInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateUser func (c *IAM) CreateUser(input *CreateUserInput) (*CreateUserOutput, error) { req, out := c.CreateUserRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateUserWithContext is the same as CreateUser with the addition of +// the ability to pass a context and additional request options. +// +// See CreateUser 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 *IAM) CreateUserWithContext(ctx aws.Context, input *CreateUserInput, opts ...request.Option) (*CreateUserOutput, error) { + req, out := c.CreateUserRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVirtualMFADevice = "CreateVirtualMFADevice" @@ -1744,8 +2030,23 @@ func (c *IAM) CreateVirtualMFADeviceRequest(input *CreateVirtualMFADeviceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/CreateVirtualMFADevice func (c *IAM) CreateVirtualMFADevice(input *CreateVirtualMFADeviceInput) (*CreateVirtualMFADeviceOutput, error) { req, out := c.CreateVirtualMFADeviceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVirtualMFADeviceWithContext is the same as CreateVirtualMFADevice with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVirtualMFADevice 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 *IAM) CreateVirtualMFADeviceWithContext(ctx aws.Context, input *CreateVirtualMFADeviceInput, opts ...request.Option) (*CreateVirtualMFADeviceOutput, error) { + req, out := c.CreateVirtualMFADeviceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeactivateMFADevice = "DeactivateMFADevice" @@ -1831,8 +2132,23 @@ func (c *IAM) DeactivateMFADeviceRequest(input *DeactivateMFADeviceInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeactivateMFADevice func (c *IAM) DeactivateMFADevice(input *DeactivateMFADeviceInput) (*DeactivateMFADeviceOutput, error) { req, out := c.DeactivateMFADeviceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeactivateMFADeviceWithContext is the same as DeactivateMFADevice with the addition of +// the ability to pass a context and additional request options. +// +// See DeactivateMFADevice 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 *IAM) DeactivateMFADeviceWithContext(ctx aws.Context, input *DeactivateMFADeviceInput, opts ...request.Option) (*DeactivateMFADeviceOutput, error) { + req, out := c.DeactivateMFADeviceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAccessKey = "DeleteAccessKey" @@ -1912,8 +2228,23 @@ func (c *IAM) DeleteAccessKeyRequest(input *DeleteAccessKeyInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteAccessKey func (c *IAM) DeleteAccessKey(input *DeleteAccessKeyInput) (*DeleteAccessKeyOutput, error) { req, out := c.DeleteAccessKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAccessKeyWithContext is the same as DeleteAccessKey with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAccessKey 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 *IAM) DeleteAccessKeyWithContext(ctx aws.Context, input *DeleteAccessKeyInput, opts ...request.Option) (*DeleteAccessKeyOutput, error) { + req, out := c.DeleteAccessKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAccountAlias = "DeleteAccountAlias" @@ -1990,8 +2321,23 @@ func (c *IAM) DeleteAccountAliasRequest(input *DeleteAccountAliasInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteAccountAlias func (c *IAM) DeleteAccountAlias(input *DeleteAccountAliasInput) (*DeleteAccountAliasOutput, error) { req, out := c.DeleteAccountAliasRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAccountAliasWithContext is the same as DeleteAccountAlias with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAccountAlias 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 *IAM) DeleteAccountAliasWithContext(ctx aws.Context, input *DeleteAccountAliasInput, opts ...request.Option) (*DeleteAccountAliasOutput, error) { + req, out := c.DeleteAccountAliasRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAccountPasswordPolicy = "DeleteAccountPasswordPolicy" @@ -2066,8 +2412,23 @@ func (c *IAM) DeleteAccountPasswordPolicyRequest(input *DeleteAccountPasswordPol // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteAccountPasswordPolicy func (c *IAM) DeleteAccountPasswordPolicy(input *DeleteAccountPasswordPolicyInput) (*DeleteAccountPasswordPolicyOutput, error) { req, out := c.DeleteAccountPasswordPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAccountPasswordPolicyWithContext is the same as DeleteAccountPasswordPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAccountPasswordPolicy 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 *IAM) DeleteAccountPasswordPolicyWithContext(ctx aws.Context, input *DeleteAccountPasswordPolicyInput, opts ...request.Option) (*DeleteAccountPasswordPolicyOutput, error) { + req, out := c.DeleteAccountPasswordPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteGroup = "DeleteGroup" @@ -2147,8 +2508,23 @@ func (c *IAM) DeleteGroupRequest(input *DeleteGroupInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteGroup func (c *IAM) DeleteGroup(input *DeleteGroupInput) (*DeleteGroupOutput, error) { req, out := c.DeleteGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteGroupWithContext is the same as DeleteGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteGroup 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 *IAM) DeleteGroupWithContext(ctx aws.Context, input *DeleteGroupInput, opts ...request.Option) (*DeleteGroupOutput, error) { + req, out := c.DeleteGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteGroupPolicy = "DeleteGroupPolicy" @@ -2229,8 +2605,23 @@ func (c *IAM) DeleteGroupPolicyRequest(input *DeleteGroupPolicyInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteGroupPolicy func (c *IAM) DeleteGroupPolicy(input *DeleteGroupPolicyInput) (*DeleteGroupPolicyOutput, error) { req, out := c.DeleteGroupPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteGroupPolicyWithContext is the same as DeleteGroupPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteGroupPolicy 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 *IAM) DeleteGroupPolicyWithContext(ctx aws.Context, input *DeleteGroupPolicyInput, opts ...request.Option) (*DeleteGroupPolicyOutput, error) { + req, out := c.DeleteGroupPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteInstanceProfile = "DeleteInstanceProfile" @@ -2318,8 +2709,23 @@ func (c *IAM) DeleteInstanceProfileRequest(input *DeleteInstanceProfileInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteInstanceProfile func (c *IAM) DeleteInstanceProfile(input *DeleteInstanceProfileInput) (*DeleteInstanceProfileOutput, error) { req, out := c.DeleteInstanceProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteInstanceProfileWithContext is the same as DeleteInstanceProfile with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteInstanceProfile 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 *IAM) DeleteInstanceProfileWithContext(ctx aws.Context, input *DeleteInstanceProfileInput, opts ...request.Option) (*DeleteInstanceProfileOutput, error) { + req, out := c.DeleteInstanceProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteLoginProfile = "DeleteLoginProfile" @@ -2406,8 +2812,23 @@ func (c *IAM) DeleteLoginProfileRequest(input *DeleteLoginProfileInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteLoginProfile func (c *IAM) DeleteLoginProfile(input *DeleteLoginProfileInput) (*DeleteLoginProfileOutput, error) { req, out := c.DeleteLoginProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteLoginProfileWithContext is the same as DeleteLoginProfile with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteLoginProfile 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 *IAM) DeleteLoginProfileWithContext(ctx aws.Context, input *DeleteLoginProfileInput, opts ...request.Option) (*DeleteLoginProfileOutput, error) { + req, out := c.DeleteLoginProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteOpenIDConnectProvider = "DeleteOpenIDConnectProvider" @@ -2489,8 +2910,23 @@ func (c *IAM) DeleteOpenIDConnectProviderRequest(input *DeleteOpenIDConnectProvi // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteOpenIDConnectProvider func (c *IAM) DeleteOpenIDConnectProvider(input *DeleteOpenIDConnectProviderInput) (*DeleteOpenIDConnectProviderOutput, error) { req, out := c.DeleteOpenIDConnectProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteOpenIDConnectProviderWithContext is the same as DeleteOpenIDConnectProvider with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteOpenIDConnectProvider 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 *IAM) DeleteOpenIDConnectProviderWithContext(ctx aws.Context, input *DeleteOpenIDConnectProviderInput, opts ...request.Option) (*DeleteOpenIDConnectProviderOutput, error) { + req, out := c.DeleteOpenIDConnectProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeletePolicy = "DeletePolicy" @@ -2595,8 +3031,23 @@ func (c *IAM) DeletePolicyRequest(input *DeletePolicyInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeletePolicy func (c *IAM) DeletePolicy(input *DeletePolicyInput) (*DeletePolicyOutput, error) { req, out := c.DeletePolicyRequest(input) - err := req.Send() - return out, err + 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 *IAM) 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 opDeletePolicyVersion = "DeletePolicyVersion" @@ -2687,8 +3138,23 @@ func (c *IAM) DeletePolicyVersionRequest(input *DeletePolicyVersionInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeletePolicyVersion func (c *IAM) DeletePolicyVersion(input *DeletePolicyVersionInput) (*DeletePolicyVersionOutput, error) { req, out := c.DeletePolicyVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeletePolicyVersionWithContext is the same as DeletePolicyVersion with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePolicyVersion 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 *IAM) DeletePolicyVersionWithContext(ctx aws.Context, input *DeletePolicyVersionInput, opts ...request.Option) (*DeletePolicyVersionOutput, error) { + req, out := c.DeletePolicyVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRole = "DeleteRole" @@ -2772,8 +3238,23 @@ func (c *IAM) DeleteRoleRequest(input *DeleteRoleInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteRole func (c *IAM) DeleteRole(input *DeleteRoleInput) (*DeleteRoleOutput, error) { req, out := c.DeleteRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRoleWithContext is the same as DeleteRole with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRole 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 *IAM) DeleteRoleWithContext(ctx aws.Context, input *DeleteRoleInput, opts ...request.Option) (*DeleteRoleOutput, error) { + req, out := c.DeleteRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRolePolicy = "DeleteRolePolicy" @@ -2854,8 +3335,23 @@ func (c *IAM) DeleteRolePolicyRequest(input *DeleteRolePolicyInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteRolePolicy func (c *IAM) DeleteRolePolicy(input *DeleteRolePolicyInput) (*DeleteRolePolicyOutput, error) { req, out := c.DeleteRolePolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteRolePolicyWithContext is the same as DeleteRolePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRolePolicy 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 *IAM) DeleteRolePolicyWithContext(ctx aws.Context, input *DeleteRolePolicyInput, opts ...request.Option) (*DeleteRolePolicyOutput, error) { + req, out := c.DeleteRolePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSAMLProvider = "DeleteSAMLProvider" @@ -2941,8 +3437,23 @@ func (c *IAM) DeleteSAMLProviderRequest(input *DeleteSAMLProviderInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteSAMLProvider func (c *IAM) DeleteSAMLProvider(input *DeleteSAMLProviderInput) (*DeleteSAMLProviderOutput, error) { req, out := c.DeleteSAMLProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSAMLProviderWithContext is the same as DeleteSAMLProvider with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSAMLProvider 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 *IAM) DeleteSAMLProviderWithContext(ctx aws.Context, input *DeleteSAMLProviderInput, opts ...request.Option) (*DeleteSAMLProviderOutput, error) { + req, out := c.DeleteSAMLProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSSHPublicKey = "DeleteSSHPublicKey" @@ -3015,8 +3526,23 @@ func (c *IAM) DeleteSSHPublicKeyRequest(input *DeleteSSHPublicKeyInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteSSHPublicKey func (c *IAM) DeleteSSHPublicKey(input *DeleteSSHPublicKeyInput) (*DeleteSSHPublicKeyOutput, error) { req, out := c.DeleteSSHPublicKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSSHPublicKeyWithContext is the same as DeleteSSHPublicKey with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSSHPublicKey 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 *IAM) DeleteSSHPublicKeyWithContext(ctx aws.Context, input *DeleteSSHPublicKeyInput, opts ...request.Option) (*DeleteSSHPublicKeyOutput, error) { + req, out := c.DeleteSSHPublicKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteServerCertificate = "DeleteServerCertificate" @@ -3110,8 +3636,23 @@ func (c *IAM) DeleteServerCertificateRequest(input *DeleteServerCertificateInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteServerCertificate func (c *IAM) DeleteServerCertificate(input *DeleteServerCertificateInput) (*DeleteServerCertificateOutput, error) { req, out := c.DeleteServerCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteServerCertificateWithContext is the same as DeleteServerCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteServerCertificate 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 *IAM) DeleteServerCertificateWithContext(ctx aws.Context, input *DeleteServerCertificateInput, opts ...request.Option) (*DeleteServerCertificateOutput, error) { + req, out := c.DeleteServerCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteServiceSpecificCredential = "DeleteServiceSpecificCredential" @@ -3178,8 +3719,23 @@ func (c *IAM) DeleteServiceSpecificCredentialRequest(input *DeleteServiceSpecifi // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteServiceSpecificCredential func (c *IAM) DeleteServiceSpecificCredential(input *DeleteServiceSpecificCredentialInput) (*DeleteServiceSpecificCredentialOutput, error) { req, out := c.DeleteServiceSpecificCredentialRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteServiceSpecificCredentialWithContext is the same as DeleteServiceSpecificCredential with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteServiceSpecificCredential 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 *IAM) DeleteServiceSpecificCredentialWithContext(ctx aws.Context, input *DeleteServiceSpecificCredentialInput, opts ...request.Option) (*DeleteServiceSpecificCredentialOutput, error) { + req, out := c.DeleteServiceSpecificCredentialRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSigningCertificate = "DeleteSigningCertificate" @@ -3259,8 +3815,23 @@ func (c *IAM) DeleteSigningCertificateRequest(input *DeleteSigningCertificateInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteSigningCertificate func (c *IAM) DeleteSigningCertificate(input *DeleteSigningCertificateInput) (*DeleteSigningCertificateOutput, error) { req, out := c.DeleteSigningCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSigningCertificateWithContext is the same as DeleteSigningCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSigningCertificate 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 *IAM) DeleteSigningCertificateWithContext(ctx aws.Context, input *DeleteSigningCertificateInput, opts ...request.Option) (*DeleteSigningCertificateOutput, error) { + req, out := c.DeleteSigningCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteUser = "DeleteUser" @@ -3340,8 +3911,23 @@ func (c *IAM) DeleteUserRequest(input *DeleteUserInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteUser func (c *IAM) DeleteUser(input *DeleteUserInput) (*DeleteUserOutput, error) { req, out := c.DeleteUserRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteUserWithContext is the same as DeleteUser with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteUser 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 *IAM) DeleteUserWithContext(ctx aws.Context, input *DeleteUserInput, opts ...request.Option) (*DeleteUserOutput, error) { + req, out := c.DeleteUserRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteUserPolicy = "DeleteUserPolicy" @@ -3422,8 +4008,23 @@ func (c *IAM) DeleteUserPolicyRequest(input *DeleteUserPolicyInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteUserPolicy func (c *IAM) DeleteUserPolicy(input *DeleteUserPolicyInput) (*DeleteUserPolicyOutput, error) { req, out := c.DeleteUserPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteUserPolicyWithContext is the same as DeleteUserPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteUserPolicy 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 *IAM) DeleteUserPolicyWithContext(ctx aws.Context, input *DeleteUserPolicyInput, opts ...request.Option) (*DeleteUserPolicyOutput, error) { + req, out := c.DeleteUserPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVirtualMFADevice = "DeleteVirtualMFADevice" @@ -3505,8 +4106,23 @@ func (c *IAM) DeleteVirtualMFADeviceRequest(input *DeleteVirtualMFADeviceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteVirtualMFADevice func (c *IAM) DeleteVirtualMFADevice(input *DeleteVirtualMFADeviceInput) (*DeleteVirtualMFADeviceOutput, error) { req, out := c.DeleteVirtualMFADeviceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVirtualMFADeviceWithContext is the same as DeleteVirtualMFADevice with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVirtualMFADevice 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 *IAM) DeleteVirtualMFADeviceWithContext(ctx aws.Context, input *DeleteVirtualMFADeviceInput, opts ...request.Option) (*DeleteVirtualMFADeviceOutput, error) { + req, out := c.DeleteVirtualMFADeviceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachGroupPolicy = "DetachGroupPolicy" @@ -3590,8 +4206,23 @@ func (c *IAM) DetachGroupPolicyRequest(input *DetachGroupPolicyInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DetachGroupPolicy func (c *IAM) DetachGroupPolicy(input *DetachGroupPolicyInput) (*DetachGroupPolicyOutput, error) { req, out := c.DetachGroupPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachGroupPolicyWithContext is the same as DetachGroupPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DetachGroupPolicy 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 *IAM) DetachGroupPolicyWithContext(ctx aws.Context, input *DetachGroupPolicyInput, opts ...request.Option) (*DetachGroupPolicyOutput, error) { + req, out := c.DetachGroupPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachRolePolicy = "DetachRolePolicy" @@ -3675,8 +4306,23 @@ func (c *IAM) DetachRolePolicyRequest(input *DetachRolePolicyInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DetachRolePolicy func (c *IAM) DetachRolePolicy(input *DetachRolePolicyInput) (*DetachRolePolicyOutput, error) { req, out := c.DetachRolePolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachRolePolicyWithContext is the same as DetachRolePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DetachRolePolicy 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 *IAM) DetachRolePolicyWithContext(ctx aws.Context, input *DetachRolePolicyInput, opts ...request.Option) (*DetachRolePolicyOutput, error) { + req, out := c.DetachRolePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachUserPolicy = "DetachUserPolicy" @@ -3760,8 +4406,23 @@ func (c *IAM) DetachUserPolicyRequest(input *DetachUserPolicyInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DetachUserPolicy func (c *IAM) DetachUserPolicy(input *DetachUserPolicyInput) (*DetachUserPolicyOutput, error) { req, out := c.DetachUserPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachUserPolicyWithContext is the same as DetachUserPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DetachUserPolicy 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 *IAM) DetachUserPolicyWithContext(ctx aws.Context, input *DetachUserPolicyInput, opts ...request.Option) (*DetachUserPolicyOutput, error) { + req, out := c.DetachUserPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableMFADevice = "EnableMFADevice" @@ -3852,8 +4513,23 @@ func (c *IAM) EnableMFADeviceRequest(input *EnableMFADeviceInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/EnableMFADevice func (c *IAM) EnableMFADevice(input *EnableMFADeviceInput) (*EnableMFADeviceOutput, error) { req, out := c.EnableMFADeviceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableMFADeviceWithContext is the same as EnableMFADevice with the addition of +// the ability to pass a context and additional request options. +// +// See EnableMFADevice 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 *IAM) EnableMFADeviceWithContext(ctx aws.Context, input *EnableMFADeviceInput, opts ...request.Option) (*EnableMFADeviceOutput, error) { + req, out := c.EnableMFADeviceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGenerateCredentialReport = "GenerateCredentialReport" @@ -3924,8 +4600,23 @@ func (c *IAM) GenerateCredentialReportRequest(input *GenerateCredentialReportInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GenerateCredentialReport func (c *IAM) GenerateCredentialReport(input *GenerateCredentialReportInput) (*GenerateCredentialReportOutput, error) { req, out := c.GenerateCredentialReportRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GenerateCredentialReportWithContext is the same as GenerateCredentialReport with the addition of +// the ability to pass a context and additional request options. +// +// See GenerateCredentialReport 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 *IAM) GenerateCredentialReportWithContext(ctx aws.Context, input *GenerateCredentialReportInput, opts ...request.Option) (*GenerateCredentialReportOutput, error) { + req, out := c.GenerateCredentialReportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAccessKeyLastUsed = "GetAccessKeyLastUsed" @@ -3993,8 +4684,23 @@ func (c *IAM) GetAccessKeyLastUsedRequest(input *GetAccessKeyLastUsedInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetAccessKeyLastUsed func (c *IAM) GetAccessKeyLastUsed(input *GetAccessKeyLastUsedInput) (*GetAccessKeyLastUsedOutput, error) { req, out := c.GetAccessKeyLastUsedRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAccessKeyLastUsedWithContext is the same as GetAccessKeyLastUsed with the addition of +// the ability to pass a context and additional request options. +// +// See GetAccessKeyLastUsed 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 *IAM) GetAccessKeyLastUsedWithContext(ctx aws.Context, input *GetAccessKeyLastUsedInput, opts ...request.Option) (*GetAccessKeyLastUsedOutput, error) { + req, out := c.GetAccessKeyLastUsedRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAccountAuthorizationDetails = "GetAccountAuthorizationDetails" @@ -4071,8 +4777,23 @@ func (c *IAM) GetAccountAuthorizationDetailsRequest(input *GetAccountAuthorizati // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetAccountAuthorizationDetails func (c *IAM) GetAccountAuthorizationDetails(input *GetAccountAuthorizationDetailsInput) (*GetAccountAuthorizationDetailsOutput, error) { req, out := c.GetAccountAuthorizationDetailsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAccountAuthorizationDetailsWithContext is the same as GetAccountAuthorizationDetails with the addition of +// the ability to pass a context and additional request options. +// +// See GetAccountAuthorizationDetails 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 *IAM) GetAccountAuthorizationDetailsWithContext(ctx aws.Context, input *GetAccountAuthorizationDetailsInput, opts ...request.Option) (*GetAccountAuthorizationDetailsOutput, error) { + req, out := c.GetAccountAuthorizationDetailsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetAccountAuthorizationDetailsPages iterates over the pages of a GetAccountAuthorizationDetails operation, @@ -4092,12 +4813,37 @@ func (c *IAM) GetAccountAuthorizationDetails(input *GetAccountAuthorizationDetai // return pageNum <= 3 // }) // -func (c *IAM) GetAccountAuthorizationDetailsPages(input *GetAccountAuthorizationDetailsInput, fn func(p *GetAccountAuthorizationDetailsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetAccountAuthorizationDetailsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetAccountAuthorizationDetailsOutput), lastPage) - }) +func (c *IAM) GetAccountAuthorizationDetailsPages(input *GetAccountAuthorizationDetailsInput, fn func(*GetAccountAuthorizationDetailsOutput, bool) bool) error { + return c.GetAccountAuthorizationDetailsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetAccountAuthorizationDetailsPagesWithContext same as GetAccountAuthorizationDetailsPages 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 *IAM) GetAccountAuthorizationDetailsPagesWithContext(ctx aws.Context, input *GetAccountAuthorizationDetailsInput, fn func(*GetAccountAuthorizationDetailsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetAccountAuthorizationDetailsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetAccountAuthorizationDetailsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetAccountAuthorizationDetailsOutput), !p.HasNextPage()) + } + return p.Err() } const opGetAccountPasswordPolicy = "GetAccountPasswordPolicy" @@ -4167,8 +4913,23 @@ func (c *IAM) GetAccountPasswordPolicyRequest(input *GetAccountPasswordPolicyInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetAccountPasswordPolicy func (c *IAM) GetAccountPasswordPolicy(input *GetAccountPasswordPolicyInput) (*GetAccountPasswordPolicyOutput, error) { req, out := c.GetAccountPasswordPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAccountPasswordPolicyWithContext is the same as GetAccountPasswordPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetAccountPasswordPolicy 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 *IAM) GetAccountPasswordPolicyWithContext(ctx aws.Context, input *GetAccountPasswordPolicyInput, opts ...request.Option) (*GetAccountPasswordPolicyOutput, error) { + req, out := c.GetAccountPasswordPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAccountSummary = "GetAccountSummary" @@ -4237,13 +4998,28 @@ func (c *IAM) GetAccountSummaryRequest(input *GetAccountSummaryInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetAccountSummary func (c *IAM) GetAccountSummary(input *GetAccountSummaryInput) (*GetAccountSummaryOutput, error) { req, out := c.GetAccountSummaryRequest(input) - err := req.Send() - return out, err + return out, req.Send() } -const opGetContextKeysForCustomPolicy = "GetContextKeysForCustomPolicy" - -// GetContextKeysForCustomPolicyRequest generates a "aws/request.Request" representing the +// GetAccountSummaryWithContext is the same as GetAccountSummary with the addition of +// the ability to pass a context and additional request options. +// +// See GetAccountSummary 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 *IAM) GetAccountSummaryWithContext(ctx aws.Context, input *GetAccountSummaryInput, opts ...request.Option) (*GetAccountSummaryOutput, error) { + req, out := c.GetAccountSummaryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetContextKeysForCustomPolicy = "GetContextKeysForCustomPolicy" + +// GetContextKeysForCustomPolicyRequest generates a "aws/request.Request" representing the // client's request for the GetContextKeysForCustomPolicy operation. The "output" return // value can be used to capture response data after the request's "Send" method // is called. @@ -4312,8 +5088,23 @@ func (c *IAM) GetContextKeysForCustomPolicyRequest(input *GetContextKeysForCusto // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetContextKeysForCustomPolicy func (c *IAM) GetContextKeysForCustomPolicy(input *GetContextKeysForCustomPolicyInput) (*GetContextKeysForPolicyResponse, error) { req, out := c.GetContextKeysForCustomPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetContextKeysForCustomPolicyWithContext is the same as GetContextKeysForCustomPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetContextKeysForCustomPolicy 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 *IAM) GetContextKeysForCustomPolicyWithContext(ctx aws.Context, input *GetContextKeysForCustomPolicyInput, opts ...request.Option) (*GetContextKeysForPolicyResponse, error) { + req, out := c.GetContextKeysForCustomPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetContextKeysForPrincipalPolicy = "GetContextKeysForPrincipalPolicy" @@ -4398,8 +5189,23 @@ func (c *IAM) GetContextKeysForPrincipalPolicyRequest(input *GetContextKeysForPr // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetContextKeysForPrincipalPolicy func (c *IAM) GetContextKeysForPrincipalPolicy(input *GetContextKeysForPrincipalPolicyInput) (*GetContextKeysForPolicyResponse, error) { req, out := c.GetContextKeysForPrincipalPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetContextKeysForPrincipalPolicyWithContext is the same as GetContextKeysForPrincipalPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetContextKeysForPrincipalPolicy 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 *IAM) GetContextKeysForPrincipalPolicyWithContext(ctx aws.Context, input *GetContextKeysForPrincipalPolicyInput, opts ...request.Option) (*GetContextKeysForPolicyResponse, error) { + req, out := c.GetContextKeysForPrincipalPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetCredentialReport = "GetCredentialReport" @@ -4480,8 +5286,23 @@ func (c *IAM) GetCredentialReportRequest(input *GetCredentialReportInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetCredentialReport func (c *IAM) GetCredentialReport(input *GetCredentialReportInput) (*GetCredentialReportOutput, error) { req, out := c.GetCredentialReportRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCredentialReportWithContext is the same as GetCredentialReport with the addition of +// the ability to pass a context and additional request options. +// +// See GetCredentialReport 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 *IAM) GetCredentialReportWithContext(ctx aws.Context, input *GetCredentialReportInput, opts ...request.Option) (*GetCredentialReportOutput, error) { + req, out := c.GetCredentialReportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetGroup = "GetGroup" @@ -4557,8 +5378,23 @@ func (c *IAM) GetGroupRequest(input *GetGroupInput) (req *request.Request, outpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetGroup func (c *IAM) GetGroup(input *GetGroupInput) (*GetGroupOutput, error) { req, out := c.GetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetGroupWithContext is the same as GetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See GetGroup 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 *IAM) GetGroupWithContext(ctx aws.Context, input *GetGroupInput, opts ...request.Option) (*GetGroupOutput, error) { + req, out := c.GetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetGroupPages iterates over the pages of a GetGroup operation, @@ -4578,12 +5414,37 @@ func (c *IAM) GetGroup(input *GetGroupInput) (*GetGroupOutput, error) { // return pageNum <= 3 // }) // -func (c *IAM) GetGroupPages(input *GetGroupInput, fn func(p *GetGroupOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetGroupRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetGroupOutput), lastPage) - }) +func (c *IAM) GetGroupPages(input *GetGroupInput, fn func(*GetGroupOutput, bool) bool) error { + return c.GetGroupPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetGroupPagesWithContext same as GetGroupPages 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 *IAM) GetGroupPagesWithContext(ctx aws.Context, input *GetGroupInput, fn func(*GetGroupOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetGroupInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetGroupRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetGroupOutput), !p.HasNextPage()) + } + return p.Err() } const opGetGroupPolicy = "GetGroupPolicy" @@ -4668,8 +5529,23 @@ func (c *IAM) GetGroupPolicyRequest(input *GetGroupPolicyInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetGroupPolicy func (c *IAM) GetGroupPolicy(input *GetGroupPolicyInput) (*GetGroupPolicyOutput, error) { req, out := c.GetGroupPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetGroupPolicyWithContext is the same as GetGroupPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetGroupPolicy 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 *IAM) GetGroupPolicyWithContext(ctx aws.Context, input *GetGroupPolicyInput, opts ...request.Option) (*GetGroupPolicyOutput, error) { + req, out := c.GetGroupPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstanceProfile = "GetInstanceProfile" @@ -4741,8 +5617,23 @@ func (c *IAM) GetInstanceProfileRequest(input *GetInstanceProfileInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetInstanceProfile func (c *IAM) GetInstanceProfile(input *GetInstanceProfileInput) (*GetInstanceProfileOutput, error) { req, out := c.GetInstanceProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstanceProfileWithContext is the same as GetInstanceProfile with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstanceProfile 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 *IAM) GetInstanceProfileWithContext(ctx aws.Context, input *GetInstanceProfileInput, opts ...request.Option) (*GetInstanceProfileOutput, error) { + req, out := c.GetInstanceProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetLoginProfile = "GetLoginProfile" @@ -4813,8 +5704,23 @@ func (c *IAM) GetLoginProfileRequest(input *GetLoginProfileInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetLoginProfile func (c *IAM) GetLoginProfile(input *GetLoginProfileInput) (*GetLoginProfileOutput, error) { req, out := c.GetLoginProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetLoginProfileWithContext is the same as GetLoginProfile with the addition of +// the ability to pass a context and additional request options. +// +// See GetLoginProfile 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 *IAM) GetLoginProfileWithContext(ctx aws.Context, input *GetLoginProfileInput, opts ...request.Option) (*GetLoginProfileOutput, error) { + req, out := c.GetLoginProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetOpenIDConnectProvider = "GetOpenIDConnectProvider" @@ -4888,8 +5794,23 @@ func (c *IAM) GetOpenIDConnectProviderRequest(input *GetOpenIDConnectProviderInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetOpenIDConnectProvider func (c *IAM) GetOpenIDConnectProvider(input *GetOpenIDConnectProviderInput) (*GetOpenIDConnectProviderOutput, error) { req, out := c.GetOpenIDConnectProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetOpenIDConnectProviderWithContext is the same as GetOpenIDConnectProvider with the addition of +// the ability to pass a context and additional request options. +// +// See GetOpenIDConnectProvider 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 *IAM) GetOpenIDConnectProviderWithContext(ctx aws.Context, input *GetOpenIDConnectProviderInput, opts ...request.Option) (*GetOpenIDConnectProviderOutput, error) { + req, out := c.GetOpenIDConnectProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPolicy = "GetPolicy" @@ -4975,8 +5896,23 @@ func (c *IAM) GetPolicyRequest(input *GetPolicyInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetPolicy func (c *IAM) GetPolicy(input *GetPolicyInput) (*GetPolicyOutput, error) { req, out := c.GetPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPolicyWithContext is the same as GetPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetPolicy 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 *IAM) GetPolicyWithContext(ctx aws.Context, input *GetPolicyInput, opts ...request.Option) (*GetPolicyOutput, error) { + req, out := c.GetPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPolicyVersion = "GetPolicyVersion" @@ -5070,8 +6006,23 @@ func (c *IAM) GetPolicyVersionRequest(input *GetPolicyVersionInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetPolicyVersion func (c *IAM) GetPolicyVersion(input *GetPolicyVersionInput) (*GetPolicyVersionOutput, error) { req, out := c.GetPolicyVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPolicyVersionWithContext is the same as GetPolicyVersion with the addition of +// the ability to pass a context and additional request options. +// +// See GetPolicyVersion 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 *IAM) GetPolicyVersionWithContext(ctx aws.Context, input *GetPolicyVersionInput, opts ...request.Option) (*GetPolicyVersionOutput, error) { + req, out := c.GetPolicyVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRole = "GetRole" @@ -5148,8 +6099,23 @@ func (c *IAM) GetRoleRequest(input *GetRoleInput) (req *request.Request, output // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetRole func (c *IAM) GetRole(input *GetRoleInput) (*GetRoleOutput, error) { req, out := c.GetRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRoleWithContext is the same as GetRole with the addition of +// the ability to pass a context and additional request options. +// +// See GetRole 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 *IAM) GetRoleWithContext(ctx aws.Context, input *GetRoleInput, opts ...request.Option) (*GetRoleOutput, error) { + req, out := c.GetRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRolePolicy = "GetRolePolicy" @@ -5237,8 +6203,23 @@ func (c *IAM) GetRolePolicyRequest(input *GetRolePolicyInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetRolePolicy func (c *IAM) GetRolePolicy(input *GetRolePolicyInput) (*GetRolePolicyOutput, error) { req, out := c.GetRolePolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRolePolicyWithContext is the same as GetRolePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetRolePolicy 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 *IAM) GetRolePolicyWithContext(ctx aws.Context, input *GetRolePolicyInput, opts ...request.Option) (*GetRolePolicyOutput, error) { + req, out := c.GetRolePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSAMLProvider = "GetSAMLProvider" @@ -5314,8 +6295,23 @@ func (c *IAM) GetSAMLProviderRequest(input *GetSAMLProviderInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetSAMLProvider func (c *IAM) GetSAMLProvider(input *GetSAMLProviderInput) (*GetSAMLProviderOutput, error) { req, out := c.GetSAMLProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSAMLProviderWithContext is the same as GetSAMLProvider with the addition of +// the ability to pass a context and additional request options. +// +// See GetSAMLProvider 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 *IAM) GetSAMLProviderWithContext(ctx aws.Context, input *GetSAMLProviderInput, opts ...request.Option) (*GetSAMLProviderOutput, error) { + req, out := c.GetSAMLProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSSHPublicKey = "GetSSHPublicKey" @@ -5390,8 +6386,23 @@ func (c *IAM) GetSSHPublicKeyRequest(input *GetSSHPublicKeyInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetSSHPublicKey func (c *IAM) GetSSHPublicKey(input *GetSSHPublicKeyInput) (*GetSSHPublicKeyOutput, error) { req, out := c.GetSSHPublicKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSSHPublicKeyWithContext is the same as GetSSHPublicKey with the addition of +// the ability to pass a context and additional request options. +// +// See GetSSHPublicKey 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 *IAM) GetSSHPublicKeyWithContext(ctx aws.Context, input *GetSSHPublicKeyInput, opts ...request.Option) (*GetSSHPublicKeyOutput, error) { + req, out := c.GetSSHPublicKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetServerCertificate = "GetServerCertificate" @@ -5465,8 +6476,23 @@ func (c *IAM) GetServerCertificateRequest(input *GetServerCertificateInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetServerCertificate func (c *IAM) GetServerCertificate(input *GetServerCertificateInput) (*GetServerCertificateOutput, error) { req, out := c.GetServerCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetServerCertificateWithContext is the same as GetServerCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See GetServerCertificate 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 *IAM) GetServerCertificateWithContext(ctx aws.Context, input *GetServerCertificateInput, opts ...request.Option) (*GetServerCertificateOutput, error) { + req, out := c.GetServerCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetUser = "GetUser" @@ -5539,8 +6565,23 @@ func (c *IAM) GetUserRequest(input *GetUserInput) (req *request.Request, output // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetUser func (c *IAM) GetUser(input *GetUserInput) (*GetUserOutput, error) { req, out := c.GetUserRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetUserWithContext is the same as GetUser with the addition of +// the ability to pass a context and additional request options. +// +// See GetUser 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 *IAM) GetUserWithContext(ctx aws.Context, input *GetUserInput, opts ...request.Option) (*GetUserOutput, error) { + req, out := c.GetUserRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetUserPolicy = "GetUserPolicy" @@ -5625,8 +6666,23 @@ func (c *IAM) GetUserPolicyRequest(input *GetUserPolicyInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetUserPolicy func (c *IAM) GetUserPolicy(input *GetUserPolicyInput) (*GetUserPolicyOutput, error) { req, out := c.GetUserPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetUserPolicyWithContext is the same as GetUserPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetUserPolicy 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 *IAM) GetUserPolicyWithContext(ctx aws.Context, input *GetUserPolicyInput, opts ...request.Option) (*GetUserPolicyOutput, error) { + req, out := c.GetUserPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAccessKeys = "ListAccessKeys" @@ -5713,8 +6769,23 @@ func (c *IAM) ListAccessKeysRequest(input *ListAccessKeysInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListAccessKeys func (c *IAM) ListAccessKeys(input *ListAccessKeysInput) (*ListAccessKeysOutput, error) { req, out := c.ListAccessKeysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAccessKeysWithContext is the same as ListAccessKeys with the addition of +// the ability to pass a context and additional request options. +// +// See ListAccessKeys 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 *IAM) ListAccessKeysWithContext(ctx aws.Context, input *ListAccessKeysInput, opts ...request.Option) (*ListAccessKeysOutput, error) { + req, out := c.ListAccessKeysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListAccessKeysPages iterates over the pages of a ListAccessKeys operation, @@ -5734,12 +6805,37 @@ func (c *IAM) ListAccessKeys(input *ListAccessKeysInput) (*ListAccessKeysOutput, // return pageNum <= 3 // }) // -func (c *IAM) ListAccessKeysPages(input *ListAccessKeysInput, fn func(p *ListAccessKeysOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListAccessKeysRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListAccessKeysOutput), lastPage) - }) +func (c *IAM) ListAccessKeysPages(input *ListAccessKeysInput, fn func(*ListAccessKeysOutput, bool) bool) error { + return c.ListAccessKeysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListAccessKeysPagesWithContext same as ListAccessKeysPages 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 *IAM) ListAccessKeysPagesWithContext(ctx aws.Context, input *ListAccessKeysInput, fn func(*ListAccessKeysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListAccessKeysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListAccessKeysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListAccessKeysOutput), !p.HasNextPage()) + } + return p.Err() } const opListAccountAliases = "ListAccountAliases" @@ -5813,8 +6909,23 @@ func (c *IAM) ListAccountAliasesRequest(input *ListAccountAliasesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListAccountAliases func (c *IAM) ListAccountAliases(input *ListAccountAliasesInput) (*ListAccountAliasesOutput, error) { req, out := c.ListAccountAliasesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAccountAliasesWithContext is the same as ListAccountAliases with the addition of +// the ability to pass a context and additional request options. +// +// See ListAccountAliases 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 *IAM) ListAccountAliasesWithContext(ctx aws.Context, input *ListAccountAliasesInput, opts ...request.Option) (*ListAccountAliasesOutput, error) { + req, out := c.ListAccountAliasesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListAccountAliasesPages iterates over the pages of a ListAccountAliases operation, @@ -5834,12 +6945,37 @@ func (c *IAM) ListAccountAliases(input *ListAccountAliasesInput) (*ListAccountAl // return pageNum <= 3 // }) // -func (c *IAM) ListAccountAliasesPages(input *ListAccountAliasesInput, fn func(p *ListAccountAliasesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListAccountAliasesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListAccountAliasesOutput), lastPage) - }) +func (c *IAM) ListAccountAliasesPages(input *ListAccountAliasesInput, fn func(*ListAccountAliasesOutput, bool) bool) error { + return c.ListAccountAliasesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListAccountAliasesPagesWithContext same as ListAccountAliasesPages 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 *IAM) ListAccountAliasesPagesWithContext(ctx aws.Context, input *ListAccountAliasesInput, fn func(*ListAccountAliasesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListAccountAliasesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListAccountAliasesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListAccountAliasesOutput), !p.HasNextPage()) + } + return p.Err() } const opListAttachedGroupPolicies = "ListAttachedGroupPolicies" @@ -5929,8 +7065,23 @@ func (c *IAM) ListAttachedGroupPoliciesRequest(input *ListAttachedGroupPoliciesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListAttachedGroupPolicies func (c *IAM) ListAttachedGroupPolicies(input *ListAttachedGroupPoliciesInput) (*ListAttachedGroupPoliciesOutput, error) { req, out := c.ListAttachedGroupPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAttachedGroupPoliciesWithContext is the same as ListAttachedGroupPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListAttachedGroupPolicies 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 *IAM) ListAttachedGroupPoliciesWithContext(ctx aws.Context, input *ListAttachedGroupPoliciesInput, opts ...request.Option) (*ListAttachedGroupPoliciesOutput, error) { + req, out := c.ListAttachedGroupPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListAttachedGroupPoliciesPages iterates over the pages of a ListAttachedGroupPolicies operation, @@ -5950,12 +7101,37 @@ func (c *IAM) ListAttachedGroupPolicies(input *ListAttachedGroupPoliciesInput) ( // return pageNum <= 3 // }) // -func (c *IAM) ListAttachedGroupPoliciesPages(input *ListAttachedGroupPoliciesInput, fn func(p *ListAttachedGroupPoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListAttachedGroupPoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListAttachedGroupPoliciesOutput), lastPage) - }) +func (c *IAM) ListAttachedGroupPoliciesPages(input *ListAttachedGroupPoliciesInput, fn func(*ListAttachedGroupPoliciesOutput, bool) bool) error { + return c.ListAttachedGroupPoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListAttachedGroupPoliciesPagesWithContext same as ListAttachedGroupPoliciesPages 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 *IAM) ListAttachedGroupPoliciesPagesWithContext(ctx aws.Context, input *ListAttachedGroupPoliciesInput, fn func(*ListAttachedGroupPoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListAttachedGroupPoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListAttachedGroupPoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListAttachedGroupPoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListAttachedRolePolicies = "ListAttachedRolePolicies" @@ -6045,8 +7221,23 @@ func (c *IAM) ListAttachedRolePoliciesRequest(input *ListAttachedRolePoliciesInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListAttachedRolePolicies func (c *IAM) ListAttachedRolePolicies(input *ListAttachedRolePoliciesInput) (*ListAttachedRolePoliciesOutput, error) { req, out := c.ListAttachedRolePoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAttachedRolePoliciesWithContext is the same as ListAttachedRolePolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListAttachedRolePolicies 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 *IAM) ListAttachedRolePoliciesWithContext(ctx aws.Context, input *ListAttachedRolePoliciesInput, opts ...request.Option) (*ListAttachedRolePoliciesOutput, error) { + req, out := c.ListAttachedRolePoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListAttachedRolePoliciesPages iterates over the pages of a ListAttachedRolePolicies operation, @@ -6066,12 +7257,37 @@ func (c *IAM) ListAttachedRolePolicies(input *ListAttachedRolePoliciesInput) (*L // return pageNum <= 3 // }) // -func (c *IAM) ListAttachedRolePoliciesPages(input *ListAttachedRolePoliciesInput, fn func(p *ListAttachedRolePoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListAttachedRolePoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListAttachedRolePoliciesOutput), lastPage) - }) +func (c *IAM) ListAttachedRolePoliciesPages(input *ListAttachedRolePoliciesInput, fn func(*ListAttachedRolePoliciesOutput, bool) bool) error { + return c.ListAttachedRolePoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListAttachedRolePoliciesPagesWithContext same as ListAttachedRolePoliciesPages 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 *IAM) ListAttachedRolePoliciesPagesWithContext(ctx aws.Context, input *ListAttachedRolePoliciesInput, fn func(*ListAttachedRolePoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListAttachedRolePoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListAttachedRolePoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListAttachedRolePoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListAttachedUserPolicies = "ListAttachedUserPolicies" @@ -6161,8 +7377,23 @@ func (c *IAM) ListAttachedUserPoliciesRequest(input *ListAttachedUserPoliciesInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListAttachedUserPolicies func (c *IAM) ListAttachedUserPolicies(input *ListAttachedUserPoliciesInput) (*ListAttachedUserPoliciesOutput, error) { req, out := c.ListAttachedUserPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAttachedUserPoliciesWithContext is the same as ListAttachedUserPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListAttachedUserPolicies 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 *IAM) ListAttachedUserPoliciesWithContext(ctx aws.Context, input *ListAttachedUserPoliciesInput, opts ...request.Option) (*ListAttachedUserPoliciesOutput, error) { + req, out := c.ListAttachedUserPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListAttachedUserPoliciesPages iterates over the pages of a ListAttachedUserPolicies operation, @@ -6182,12 +7413,37 @@ func (c *IAM) ListAttachedUserPolicies(input *ListAttachedUserPoliciesInput) (*L // return pageNum <= 3 // }) // -func (c *IAM) ListAttachedUserPoliciesPages(input *ListAttachedUserPoliciesInput, fn func(p *ListAttachedUserPoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListAttachedUserPoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListAttachedUserPoliciesOutput), lastPage) - }) +func (c *IAM) ListAttachedUserPoliciesPages(input *ListAttachedUserPoliciesInput, fn func(*ListAttachedUserPoliciesOutput, bool) bool) error { + return c.ListAttachedUserPoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListAttachedUserPoliciesPagesWithContext same as ListAttachedUserPoliciesPages 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 *IAM) ListAttachedUserPoliciesPagesWithContext(ctx aws.Context, input *ListAttachedUserPoliciesInput, fn func(*ListAttachedUserPoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListAttachedUserPoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListAttachedUserPoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListAttachedUserPoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListEntitiesForPolicy = "ListEntitiesForPolicy" @@ -6274,8 +7530,23 @@ func (c *IAM) ListEntitiesForPolicyRequest(input *ListEntitiesForPolicyInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListEntitiesForPolicy func (c *IAM) ListEntitiesForPolicy(input *ListEntitiesForPolicyInput) (*ListEntitiesForPolicyOutput, error) { req, out := c.ListEntitiesForPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListEntitiesForPolicyWithContext is the same as ListEntitiesForPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See ListEntitiesForPolicy 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 *IAM) ListEntitiesForPolicyWithContext(ctx aws.Context, input *ListEntitiesForPolicyInput, opts ...request.Option) (*ListEntitiesForPolicyOutput, error) { + req, out := c.ListEntitiesForPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListEntitiesForPolicyPages iterates over the pages of a ListEntitiesForPolicy operation, @@ -6295,12 +7566,37 @@ func (c *IAM) ListEntitiesForPolicy(input *ListEntitiesForPolicyInput) (*ListEnt // return pageNum <= 3 // }) // -func (c *IAM) ListEntitiesForPolicyPages(input *ListEntitiesForPolicyInput, fn func(p *ListEntitiesForPolicyOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListEntitiesForPolicyRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListEntitiesForPolicyOutput), lastPage) - }) +func (c *IAM) ListEntitiesForPolicyPages(input *ListEntitiesForPolicyInput, fn func(*ListEntitiesForPolicyOutput, bool) bool) error { + return c.ListEntitiesForPolicyPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListEntitiesForPolicyPagesWithContext same as ListEntitiesForPolicyPages 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 *IAM) ListEntitiesForPolicyPagesWithContext(ctx aws.Context, input *ListEntitiesForPolicyInput, fn func(*ListEntitiesForPolicyOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListEntitiesForPolicyInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListEntitiesForPolicyRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListEntitiesForPolicyOutput), !p.HasNextPage()) + } + return p.Err() } const opListGroupPolicies = "ListGroupPolicies" @@ -6386,8 +7682,23 @@ func (c *IAM) ListGroupPoliciesRequest(input *ListGroupPoliciesInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListGroupPolicies func (c *IAM) ListGroupPolicies(input *ListGroupPoliciesInput) (*ListGroupPoliciesOutput, error) { req, out := c.ListGroupPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListGroupPoliciesWithContext is the same as ListGroupPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListGroupPolicies 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 *IAM) ListGroupPoliciesWithContext(ctx aws.Context, input *ListGroupPoliciesInput, opts ...request.Option) (*ListGroupPoliciesOutput, error) { + req, out := c.ListGroupPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListGroupPoliciesPages iterates over the pages of a ListGroupPolicies operation, @@ -6407,12 +7718,37 @@ func (c *IAM) ListGroupPolicies(input *ListGroupPoliciesInput) (*ListGroupPolici // return pageNum <= 3 // }) // -func (c *IAM) ListGroupPoliciesPages(input *ListGroupPoliciesInput, fn func(p *ListGroupPoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListGroupPoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListGroupPoliciesOutput), lastPage) - }) +func (c *IAM) ListGroupPoliciesPages(input *ListGroupPoliciesInput, fn func(*ListGroupPoliciesOutput, bool) bool) error { + return c.ListGroupPoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListGroupPoliciesPagesWithContext same as ListGroupPoliciesPages 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 *IAM) ListGroupPoliciesPagesWithContext(ctx aws.Context, input *ListGroupPoliciesInput, fn func(*ListGroupPoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListGroupPoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListGroupPoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListGroupPoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListGroups = "ListGroups" @@ -6485,8 +7821,23 @@ func (c *IAM) ListGroupsRequest(input *ListGroupsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListGroups func (c *IAM) ListGroups(input *ListGroupsInput) (*ListGroupsOutput, error) { req, out := c.ListGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListGroupsWithContext is the same as ListGroups with the addition of +// the ability to pass a context and additional request options. +// +// See ListGroups 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 *IAM) ListGroupsWithContext(ctx aws.Context, input *ListGroupsInput, opts ...request.Option) (*ListGroupsOutput, error) { + req, out := c.ListGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListGroupsPages iterates over the pages of a ListGroups operation, @@ -6506,12 +7857,37 @@ func (c *IAM) ListGroups(input *ListGroupsInput) (*ListGroupsOutput, error) { // return pageNum <= 3 // }) // -func (c *IAM) ListGroupsPages(input *ListGroupsInput, fn func(p *ListGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListGroupsOutput), lastPage) - }) +func (c *IAM) ListGroupsPages(input *ListGroupsInput, fn func(*ListGroupsOutput, bool) bool) error { + return c.ListGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListGroupsPagesWithContext same as ListGroupsPages 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 *IAM) ListGroupsPagesWithContext(ctx aws.Context, input *ListGroupsInput, fn func(*ListGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opListGroupsForUser = "ListGroupsForUser" @@ -6588,8 +7964,23 @@ func (c *IAM) ListGroupsForUserRequest(input *ListGroupsForUserInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListGroupsForUser func (c *IAM) ListGroupsForUser(input *ListGroupsForUserInput) (*ListGroupsForUserOutput, error) { req, out := c.ListGroupsForUserRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListGroupsForUserWithContext is the same as ListGroupsForUser with the addition of +// the ability to pass a context and additional request options. +// +// See ListGroupsForUser 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 *IAM) ListGroupsForUserWithContext(ctx aws.Context, input *ListGroupsForUserInput, opts ...request.Option) (*ListGroupsForUserOutput, error) { + req, out := c.ListGroupsForUserRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListGroupsForUserPages iterates over the pages of a ListGroupsForUser operation, @@ -6609,12 +8000,37 @@ func (c *IAM) ListGroupsForUser(input *ListGroupsForUserInput) (*ListGroupsForUs // return pageNum <= 3 // }) // -func (c *IAM) ListGroupsForUserPages(input *ListGroupsForUserInput, fn func(p *ListGroupsForUserOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListGroupsForUserRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListGroupsForUserOutput), lastPage) - }) +func (c *IAM) ListGroupsForUserPages(input *ListGroupsForUserInput, fn func(*ListGroupsForUserOutput, bool) bool) error { + return c.ListGroupsForUserPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListGroupsForUserPagesWithContext same as ListGroupsForUserPages 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 *IAM) ListGroupsForUserPagesWithContext(ctx aws.Context, input *ListGroupsForUserInput, fn func(*ListGroupsForUserOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListGroupsForUserInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListGroupsForUserRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListGroupsForUserOutput), !p.HasNextPage()) + } + return p.Err() } const opListInstanceProfiles = "ListInstanceProfiles" @@ -6689,8 +8105,23 @@ func (c *IAM) ListInstanceProfilesRequest(input *ListInstanceProfilesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListInstanceProfiles func (c *IAM) ListInstanceProfiles(input *ListInstanceProfilesInput) (*ListInstanceProfilesOutput, error) { req, out := c.ListInstanceProfilesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListInstanceProfilesWithContext is the same as ListInstanceProfiles with the addition of +// the ability to pass a context and additional request options. +// +// See ListInstanceProfiles 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 *IAM) ListInstanceProfilesWithContext(ctx aws.Context, input *ListInstanceProfilesInput, opts ...request.Option) (*ListInstanceProfilesOutput, error) { + req, out := c.ListInstanceProfilesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListInstanceProfilesPages iterates over the pages of a ListInstanceProfiles operation, @@ -6710,12 +8141,37 @@ func (c *IAM) ListInstanceProfiles(input *ListInstanceProfilesInput) (*ListInsta // return pageNum <= 3 // }) // -func (c *IAM) ListInstanceProfilesPages(input *ListInstanceProfilesInput, fn func(p *ListInstanceProfilesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListInstanceProfilesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListInstanceProfilesOutput), lastPage) - }) +func (c *IAM) ListInstanceProfilesPages(input *ListInstanceProfilesInput, fn func(*ListInstanceProfilesOutput, bool) bool) error { + return c.ListInstanceProfilesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListInstanceProfilesPagesWithContext same as ListInstanceProfilesPages 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 *IAM) ListInstanceProfilesPagesWithContext(ctx aws.Context, input *ListInstanceProfilesInput, fn func(*ListInstanceProfilesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListInstanceProfilesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListInstanceProfilesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListInstanceProfilesOutput), !p.HasNextPage()) + } + return p.Err() } const opListInstanceProfilesForRole = "ListInstanceProfilesForRole" @@ -6794,8 +8250,23 @@ func (c *IAM) ListInstanceProfilesForRoleRequest(input *ListInstanceProfilesForR // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListInstanceProfilesForRole func (c *IAM) ListInstanceProfilesForRole(input *ListInstanceProfilesForRoleInput) (*ListInstanceProfilesForRoleOutput, error) { req, out := c.ListInstanceProfilesForRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListInstanceProfilesForRoleWithContext is the same as ListInstanceProfilesForRole with the addition of +// the ability to pass a context and additional request options. +// +// See ListInstanceProfilesForRole 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 *IAM) ListInstanceProfilesForRoleWithContext(ctx aws.Context, input *ListInstanceProfilesForRoleInput, opts ...request.Option) (*ListInstanceProfilesForRoleOutput, error) { + req, out := c.ListInstanceProfilesForRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListInstanceProfilesForRolePages iterates over the pages of a ListInstanceProfilesForRole operation, @@ -6815,12 +8286,37 @@ func (c *IAM) ListInstanceProfilesForRole(input *ListInstanceProfilesForRoleInpu // return pageNum <= 3 // }) // -func (c *IAM) ListInstanceProfilesForRolePages(input *ListInstanceProfilesForRoleInput, fn func(p *ListInstanceProfilesForRoleOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListInstanceProfilesForRoleRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListInstanceProfilesForRoleOutput), lastPage) - }) +func (c *IAM) ListInstanceProfilesForRolePages(input *ListInstanceProfilesForRoleInput, fn func(*ListInstanceProfilesForRoleOutput, bool) bool) error { + return c.ListInstanceProfilesForRolePagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListInstanceProfilesForRolePagesWithContext same as ListInstanceProfilesForRolePages 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 *IAM) ListInstanceProfilesForRolePagesWithContext(ctx aws.Context, input *ListInstanceProfilesForRoleInput, fn func(*ListInstanceProfilesForRoleOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListInstanceProfilesForRoleInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListInstanceProfilesForRoleRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListInstanceProfilesForRoleOutput), !p.HasNextPage()) + } + return p.Err() } const opListMFADevices = "ListMFADevices" @@ -6900,8 +8396,23 @@ func (c *IAM) ListMFADevicesRequest(input *ListMFADevicesInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListMFADevices func (c *IAM) ListMFADevices(input *ListMFADevicesInput) (*ListMFADevicesOutput, error) { req, out := c.ListMFADevicesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListMFADevicesWithContext is the same as ListMFADevices with the addition of +// the ability to pass a context and additional request options. +// +// See ListMFADevices 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 *IAM) ListMFADevicesWithContext(ctx aws.Context, input *ListMFADevicesInput, opts ...request.Option) (*ListMFADevicesOutput, error) { + req, out := c.ListMFADevicesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListMFADevicesPages iterates over the pages of a ListMFADevices operation, @@ -6921,12 +8432,37 @@ func (c *IAM) ListMFADevices(input *ListMFADevicesInput) (*ListMFADevicesOutput, // return pageNum <= 3 // }) // -func (c *IAM) ListMFADevicesPages(input *ListMFADevicesInput, fn func(p *ListMFADevicesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListMFADevicesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListMFADevicesOutput), lastPage) - }) +func (c *IAM) ListMFADevicesPages(input *ListMFADevicesInput, fn func(*ListMFADevicesOutput, bool) bool) error { + return c.ListMFADevicesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListMFADevicesPagesWithContext same as ListMFADevicesPages 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 *IAM) ListMFADevicesPagesWithContext(ctx aws.Context, input *ListMFADevicesInput, fn func(*ListMFADevicesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListMFADevicesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListMFADevicesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListMFADevicesOutput), !p.HasNextPage()) + } + return p.Err() } const opListOpenIDConnectProviders = "ListOpenIDConnectProviders" @@ -6992,8 +8528,23 @@ func (c *IAM) ListOpenIDConnectProvidersRequest(input *ListOpenIDConnectProvider // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListOpenIDConnectProviders func (c *IAM) ListOpenIDConnectProviders(input *ListOpenIDConnectProvidersInput) (*ListOpenIDConnectProvidersOutput, error) { req, out := c.ListOpenIDConnectProvidersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListOpenIDConnectProvidersWithContext is the same as ListOpenIDConnectProviders with the addition of +// the ability to pass a context and additional request options. +// +// See ListOpenIDConnectProviders 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 *IAM) ListOpenIDConnectProvidersWithContext(ctx aws.Context, input *ListOpenIDConnectProvidersInput, opts ...request.Option) (*ListOpenIDConnectProvidersOutput, error) { + req, out := c.ListOpenIDConnectProvidersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListPolicies = "ListPolicies" @@ -7076,8 +8627,23 @@ func (c *IAM) ListPoliciesRequest(input *ListPoliciesInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListPolicies func (c *IAM) ListPolicies(input *ListPoliciesInput) (*ListPoliciesOutput, error) { req, out := c.ListPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPoliciesWithContext is the same as ListPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListPolicies 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 *IAM) ListPoliciesWithContext(ctx aws.Context, input *ListPoliciesInput, opts ...request.Option) (*ListPoliciesOutput, error) { + req, out := c.ListPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListPoliciesPages iterates over the pages of a ListPolicies operation, @@ -7097,12 +8663,37 @@ func (c *IAM) ListPolicies(input *ListPoliciesInput) (*ListPoliciesOutput, error // return pageNum <= 3 // }) // -func (c *IAM) ListPoliciesPages(input *ListPoliciesInput, fn func(p *ListPoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListPoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListPoliciesOutput), lastPage) - }) +func (c *IAM) ListPoliciesPages(input *ListPoliciesInput, fn func(*ListPoliciesOutput, bool) bool) error { + return c.ListPoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListPoliciesPagesWithContext same as ListPoliciesPages 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 *IAM) ListPoliciesPagesWithContext(ctx aws.Context, input *ListPoliciesInput, fn func(*ListPoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListPoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListPoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListPoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListPolicyVersions = "ListPolicyVersions" @@ -7186,8 +8777,23 @@ func (c *IAM) ListPolicyVersionsRequest(input *ListPolicyVersionsInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListPolicyVersions func (c *IAM) ListPolicyVersions(input *ListPolicyVersionsInput) (*ListPolicyVersionsOutput, error) { req, out := c.ListPolicyVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPolicyVersionsWithContext is the same as ListPolicyVersions with the addition of +// the ability to pass a context and additional request options. +// +// See ListPolicyVersions 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 *IAM) ListPolicyVersionsWithContext(ctx aws.Context, input *ListPolicyVersionsInput, opts ...request.Option) (*ListPolicyVersionsOutput, error) { + req, out := c.ListPolicyVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListPolicyVersionsPages iterates over the pages of a ListPolicyVersions operation, @@ -7207,12 +8813,37 @@ func (c *IAM) ListPolicyVersions(input *ListPolicyVersionsInput) (*ListPolicyVer // return pageNum <= 3 // }) // -func (c *IAM) ListPolicyVersionsPages(input *ListPolicyVersionsInput, fn func(p *ListPolicyVersionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListPolicyVersionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListPolicyVersionsOutput), lastPage) - }) +func (c *IAM) ListPolicyVersionsPages(input *ListPolicyVersionsInput, fn func(*ListPolicyVersionsOutput, bool) bool) error { + return c.ListPolicyVersionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListPolicyVersionsPagesWithContext same as ListPolicyVersionsPages 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 *IAM) ListPolicyVersionsPagesWithContext(ctx aws.Context, input *ListPolicyVersionsInput, fn func(*ListPolicyVersionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListPolicyVersionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListPolicyVersionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListPolicyVersionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListRolePolicies = "ListRolePolicies" @@ -7297,8 +8928,23 @@ func (c *IAM) ListRolePoliciesRequest(input *ListRolePoliciesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListRolePolicies func (c *IAM) ListRolePolicies(input *ListRolePoliciesInput) (*ListRolePoliciesOutput, error) { req, out := c.ListRolePoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListRolePoliciesWithContext is the same as ListRolePolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListRolePolicies 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 *IAM) ListRolePoliciesWithContext(ctx aws.Context, input *ListRolePoliciesInput, opts ...request.Option) (*ListRolePoliciesOutput, error) { + req, out := c.ListRolePoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListRolePoliciesPages iterates over the pages of a ListRolePolicies operation, @@ -7318,12 +8964,37 @@ func (c *IAM) ListRolePolicies(input *ListRolePoliciesInput) (*ListRolePoliciesO // return pageNum <= 3 // }) // -func (c *IAM) ListRolePoliciesPages(input *ListRolePoliciesInput, fn func(p *ListRolePoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListRolePoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListRolePoliciesOutput), lastPage) - }) +func (c *IAM) ListRolePoliciesPages(input *ListRolePoliciesInput, fn func(*ListRolePoliciesOutput, bool) bool) error { + return c.ListRolePoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListRolePoliciesPagesWithContext same as ListRolePoliciesPages 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 *IAM) ListRolePoliciesPagesWithContext(ctx aws.Context, input *ListRolePoliciesInput, fn func(*ListRolePoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListRolePoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListRolePoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListRolePoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListRoles = "ListRoles" @@ -7398,8 +9069,23 @@ func (c *IAM) ListRolesRequest(input *ListRolesInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListRoles func (c *IAM) ListRoles(input *ListRolesInput) (*ListRolesOutput, error) { req, out := c.ListRolesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListRolesWithContext is the same as ListRoles with the addition of +// the ability to pass a context and additional request options. +// +// See ListRoles 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 *IAM) ListRolesWithContext(ctx aws.Context, input *ListRolesInput, opts ...request.Option) (*ListRolesOutput, error) { + req, out := c.ListRolesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListRolesPages iterates over the pages of a ListRoles operation, @@ -7419,12 +9105,37 @@ func (c *IAM) ListRoles(input *ListRolesInput) (*ListRolesOutput, error) { // return pageNum <= 3 // }) // -func (c *IAM) ListRolesPages(input *ListRolesInput, fn func(p *ListRolesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListRolesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListRolesOutput), lastPage) - }) +func (c *IAM) ListRolesPages(input *ListRolesInput, fn func(*ListRolesOutput, bool) bool) error { + return c.ListRolesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListRolesPagesWithContext same as ListRolesPages 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 *IAM) ListRolesPagesWithContext(ctx aws.Context, input *ListRolesInput, fn func(*ListRolesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListRolesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListRolesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListRolesOutput), !p.HasNextPage()) + } + return p.Err() } const opListSAMLProviders = "ListSAMLProviders" @@ -7491,8 +9202,23 @@ func (c *IAM) ListSAMLProvidersRequest(input *ListSAMLProvidersInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListSAMLProviders func (c *IAM) ListSAMLProviders(input *ListSAMLProvidersInput) (*ListSAMLProvidersOutput, error) { req, out := c.ListSAMLProvidersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSAMLProvidersWithContext is the same as ListSAMLProviders with the addition of +// the ability to pass a context and additional request options. +// +// See ListSAMLProviders 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 *IAM) ListSAMLProvidersWithContext(ctx aws.Context, input *ListSAMLProvidersInput, opts ...request.Option) (*ListSAMLProvidersOutput, error) { + req, out := c.ListSAMLProvidersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListSSHPublicKeys = "ListSSHPublicKeys" @@ -7573,8 +9299,23 @@ func (c *IAM) ListSSHPublicKeysRequest(input *ListSSHPublicKeysInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListSSHPublicKeys func (c *IAM) ListSSHPublicKeys(input *ListSSHPublicKeysInput) (*ListSSHPublicKeysOutput, error) { req, out := c.ListSSHPublicKeysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSSHPublicKeysWithContext is the same as ListSSHPublicKeys with the addition of +// the ability to pass a context and additional request options. +// +// See ListSSHPublicKeys 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 *IAM) ListSSHPublicKeysWithContext(ctx aws.Context, input *ListSSHPublicKeysInput, opts ...request.Option) (*ListSSHPublicKeysOutput, error) { + req, out := c.ListSSHPublicKeysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListSSHPublicKeysPages iterates over the pages of a ListSSHPublicKeys operation, @@ -7594,12 +9335,37 @@ func (c *IAM) ListSSHPublicKeys(input *ListSSHPublicKeysInput) (*ListSSHPublicKe // return pageNum <= 3 // }) // -func (c *IAM) ListSSHPublicKeysPages(input *ListSSHPublicKeysInput, fn func(p *ListSSHPublicKeysOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListSSHPublicKeysRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListSSHPublicKeysOutput), lastPage) - }) +func (c *IAM) ListSSHPublicKeysPages(input *ListSSHPublicKeysInput, fn func(*ListSSHPublicKeysOutput, bool) bool) error { + return c.ListSSHPublicKeysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListSSHPublicKeysPagesWithContext same as ListSSHPublicKeysPages 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 *IAM) ListSSHPublicKeysPagesWithContext(ctx aws.Context, input *ListSSHPublicKeysInput, fn func(*ListSSHPublicKeysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListSSHPublicKeysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListSSHPublicKeysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListSSHPublicKeysOutput), !p.HasNextPage()) + } + return p.Err() } const opListServerCertificates = "ListServerCertificates" @@ -7678,8 +9444,23 @@ func (c *IAM) ListServerCertificatesRequest(input *ListServerCertificatesInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListServerCertificates func (c *IAM) ListServerCertificates(input *ListServerCertificatesInput) (*ListServerCertificatesOutput, error) { req, out := c.ListServerCertificatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListServerCertificatesWithContext is the same as ListServerCertificates with the addition of +// the ability to pass a context and additional request options. +// +// See ListServerCertificates 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 *IAM) ListServerCertificatesWithContext(ctx aws.Context, input *ListServerCertificatesInput, opts ...request.Option) (*ListServerCertificatesOutput, error) { + req, out := c.ListServerCertificatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListServerCertificatesPages iterates over the pages of a ListServerCertificates operation, @@ -7699,12 +9480,37 @@ func (c *IAM) ListServerCertificates(input *ListServerCertificatesInput) (*ListS // return pageNum <= 3 // }) // -func (c *IAM) ListServerCertificatesPages(input *ListServerCertificatesInput, fn func(p *ListServerCertificatesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListServerCertificatesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListServerCertificatesOutput), lastPage) - }) +func (c *IAM) ListServerCertificatesPages(input *ListServerCertificatesInput, fn func(*ListServerCertificatesOutput, bool) bool) error { + return c.ListServerCertificatesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListServerCertificatesPagesWithContext same as ListServerCertificatesPages 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 *IAM) ListServerCertificatesPagesWithContext(ctx aws.Context, input *ListServerCertificatesInput, fn func(*ListServerCertificatesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListServerCertificatesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListServerCertificatesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListServerCertificatesOutput), !p.HasNextPage()) + } + return p.Err() } const opListServiceSpecificCredentials = "ListServiceSpecificCredentials" @@ -7778,8 +9584,23 @@ func (c *IAM) ListServiceSpecificCredentialsRequest(input *ListServiceSpecificCr // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListServiceSpecificCredentials func (c *IAM) ListServiceSpecificCredentials(input *ListServiceSpecificCredentialsInput) (*ListServiceSpecificCredentialsOutput, error) { req, out := c.ListServiceSpecificCredentialsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListServiceSpecificCredentialsWithContext is the same as ListServiceSpecificCredentials with the addition of +// the ability to pass a context and additional request options. +// +// See ListServiceSpecificCredentials 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 *IAM) ListServiceSpecificCredentialsWithContext(ctx aws.Context, input *ListServiceSpecificCredentialsInput, opts ...request.Option) (*ListServiceSpecificCredentialsOutput, error) { + req, out := c.ListServiceSpecificCredentialsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListSigningCertificates = "ListSigningCertificates" @@ -7864,8 +9685,23 @@ func (c *IAM) ListSigningCertificatesRequest(input *ListSigningCertificatesInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListSigningCertificates func (c *IAM) ListSigningCertificates(input *ListSigningCertificatesInput) (*ListSigningCertificatesOutput, error) { req, out := c.ListSigningCertificatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSigningCertificatesWithContext is the same as ListSigningCertificates with the addition of +// the ability to pass a context and additional request options. +// +// See ListSigningCertificates 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 *IAM) ListSigningCertificatesWithContext(ctx aws.Context, input *ListSigningCertificatesInput, opts ...request.Option) (*ListSigningCertificatesOutput, error) { + req, out := c.ListSigningCertificatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListSigningCertificatesPages iterates over the pages of a ListSigningCertificates operation, @@ -7885,12 +9721,37 @@ func (c *IAM) ListSigningCertificates(input *ListSigningCertificatesInput) (*Lis // return pageNum <= 3 // }) // -func (c *IAM) ListSigningCertificatesPages(input *ListSigningCertificatesInput, fn func(p *ListSigningCertificatesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListSigningCertificatesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListSigningCertificatesOutput), lastPage) - }) +func (c *IAM) ListSigningCertificatesPages(input *ListSigningCertificatesInput, fn func(*ListSigningCertificatesOutput, bool) bool) error { + return c.ListSigningCertificatesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListSigningCertificatesPagesWithContext same as ListSigningCertificatesPages 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 *IAM) ListSigningCertificatesPagesWithContext(ctx aws.Context, input *ListSigningCertificatesInput, fn func(*ListSigningCertificatesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListSigningCertificatesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListSigningCertificatesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListSigningCertificatesOutput), !p.HasNextPage()) + } + return p.Err() } const opListUserPolicies = "ListUserPolicies" @@ -7974,8 +9835,23 @@ func (c *IAM) ListUserPoliciesRequest(input *ListUserPoliciesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListUserPolicies func (c *IAM) ListUserPolicies(input *ListUserPoliciesInput) (*ListUserPoliciesOutput, error) { req, out := c.ListUserPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListUserPoliciesWithContext is the same as ListUserPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListUserPolicies 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 *IAM) ListUserPoliciesWithContext(ctx aws.Context, input *ListUserPoliciesInput, opts ...request.Option) (*ListUserPoliciesOutput, error) { + req, out := c.ListUserPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListUserPoliciesPages iterates over the pages of a ListUserPolicies operation, @@ -7995,12 +9871,37 @@ func (c *IAM) ListUserPolicies(input *ListUserPoliciesInput) (*ListUserPoliciesO // return pageNum <= 3 // }) // -func (c *IAM) ListUserPoliciesPages(input *ListUserPoliciesInput, fn func(p *ListUserPoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListUserPoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListUserPoliciesOutput), lastPage) - }) +func (c *IAM) ListUserPoliciesPages(input *ListUserPoliciesInput, fn func(*ListUserPoliciesOutput, bool) bool) error { + return c.ListUserPoliciesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListUserPoliciesPagesWithContext same as ListUserPoliciesPages 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 *IAM) ListUserPoliciesPagesWithContext(ctx aws.Context, input *ListUserPoliciesInput, fn func(*ListUserPoliciesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListUserPoliciesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListUserPoliciesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListUserPoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListUsers = "ListUsers" @@ -8075,8 +9976,23 @@ func (c *IAM) ListUsersRequest(input *ListUsersInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListUsers func (c *IAM) ListUsers(input *ListUsersInput) (*ListUsersOutput, error) { req, out := c.ListUsersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListUsersWithContext is the same as ListUsers with the addition of +// the ability to pass a context and additional request options. +// +// See ListUsers 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 *IAM) ListUsersWithContext(ctx aws.Context, input *ListUsersInput, opts ...request.Option) (*ListUsersOutput, error) { + req, out := c.ListUsersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListUsersPages iterates over the pages of a ListUsers operation, @@ -8096,12 +10012,37 @@ func (c *IAM) ListUsers(input *ListUsersInput) (*ListUsersOutput, error) { // return pageNum <= 3 // }) // -func (c *IAM) ListUsersPages(input *ListUsersInput, fn func(p *ListUsersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListUsersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListUsersOutput), lastPage) - }) +func (c *IAM) ListUsersPages(input *ListUsersInput, fn func(*ListUsersOutput, bool) bool) error { + return c.ListUsersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListUsersPagesWithContext same as ListUsersPages 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 *IAM) ListUsersPagesWithContext(ctx aws.Context, input *ListUsersInput, fn func(*ListUsersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListUsersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListUsersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListUsersOutput), !p.HasNextPage()) + } + return p.Err() } const opListVirtualMFADevices = "ListVirtualMFADevices" @@ -8171,8 +10112,23 @@ func (c *IAM) ListVirtualMFADevicesRequest(input *ListVirtualMFADevicesInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ListVirtualMFADevices func (c *IAM) ListVirtualMFADevices(input *ListVirtualMFADevicesInput) (*ListVirtualMFADevicesOutput, error) { req, out := c.ListVirtualMFADevicesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListVirtualMFADevicesWithContext is the same as ListVirtualMFADevices with the addition of +// the ability to pass a context and additional request options. +// +// See ListVirtualMFADevices 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 *IAM) ListVirtualMFADevicesWithContext(ctx aws.Context, input *ListVirtualMFADevicesInput, opts ...request.Option) (*ListVirtualMFADevicesOutput, error) { + req, out := c.ListVirtualMFADevicesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListVirtualMFADevicesPages iterates over the pages of a ListVirtualMFADevices operation, @@ -8192,12 +10148,37 @@ func (c *IAM) ListVirtualMFADevices(input *ListVirtualMFADevicesInput) (*ListVir // return pageNum <= 3 // }) // -func (c *IAM) ListVirtualMFADevicesPages(input *ListVirtualMFADevicesInput, fn func(p *ListVirtualMFADevicesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListVirtualMFADevicesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListVirtualMFADevicesOutput), lastPage) - }) +func (c *IAM) ListVirtualMFADevicesPages(input *ListVirtualMFADevicesInput, fn func(*ListVirtualMFADevicesOutput, bool) bool) error { + return c.ListVirtualMFADevicesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListVirtualMFADevicesPagesWithContext same as ListVirtualMFADevicesPages 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 *IAM) ListVirtualMFADevicesPagesWithContext(ctx aws.Context, input *ListVirtualMFADevicesInput, fn func(*ListVirtualMFADevicesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListVirtualMFADevicesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListVirtualMFADevicesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListVirtualMFADevicesOutput), !p.HasNextPage()) + } + return p.Err() } const opPutGroupPolicy = "PutGroupPolicy" @@ -8292,8 +10273,23 @@ func (c *IAM) PutGroupPolicyRequest(input *PutGroupPolicyInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/PutGroupPolicy func (c *IAM) PutGroupPolicy(input *PutGroupPolicyInput) (*PutGroupPolicyOutput, error) { req, out := c.PutGroupPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutGroupPolicyWithContext is the same as PutGroupPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutGroupPolicy 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 *IAM) PutGroupPolicyWithContext(ctx aws.Context, input *PutGroupPolicyInput, opts ...request.Option) (*PutGroupPolicyOutput, error) { + req, out := c.PutGroupPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRolePolicy = "PutRolePolicy" @@ -8394,8 +10390,23 @@ func (c *IAM) PutRolePolicyRequest(input *PutRolePolicyInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/PutRolePolicy func (c *IAM) PutRolePolicy(input *PutRolePolicyInput) (*PutRolePolicyOutput, error) { req, out := c.PutRolePolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRolePolicyWithContext is the same as PutRolePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutRolePolicy 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 *IAM) PutRolePolicyWithContext(ctx aws.Context, input *PutRolePolicyInput, opts ...request.Option) (*PutRolePolicyOutput, error) { + req, out := c.PutRolePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutUserPolicy = "PutUserPolicy" @@ -8490,8 +10501,23 @@ func (c *IAM) PutUserPolicyRequest(input *PutUserPolicyInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/PutUserPolicy func (c *IAM) PutUserPolicy(input *PutUserPolicyInput) (*PutUserPolicyOutput, error) { req, out := c.PutUserPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutUserPolicyWithContext is the same as PutUserPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutUserPolicy 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 *IAM) PutUserPolicyWithContext(ctx aws.Context, input *PutUserPolicyInput, opts ...request.Option) (*PutUserPolicyOutput, error) { + req, out := c.PutUserPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveClientIDFromOpenIDConnectProvider = "RemoveClientIDFromOpenIDConnectProvider" @@ -8571,8 +10597,23 @@ func (c *IAM) RemoveClientIDFromOpenIDConnectProviderRequest(input *RemoveClient // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/RemoveClientIDFromOpenIDConnectProvider func (c *IAM) RemoveClientIDFromOpenIDConnectProvider(input *RemoveClientIDFromOpenIDConnectProviderInput) (*RemoveClientIDFromOpenIDConnectProviderOutput, error) { req, out := c.RemoveClientIDFromOpenIDConnectProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveClientIDFromOpenIDConnectProviderWithContext is the same as RemoveClientIDFromOpenIDConnectProvider with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveClientIDFromOpenIDConnectProvider 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 *IAM) RemoveClientIDFromOpenIDConnectProviderWithContext(ctx aws.Context, input *RemoveClientIDFromOpenIDConnectProviderInput, opts ...request.Option) (*RemoveClientIDFromOpenIDConnectProviderOutput, error) { + req, out := c.RemoveClientIDFromOpenIDConnectProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveRoleFromInstanceProfile = "RemoveRoleFromInstanceProfile" @@ -8656,8 +10697,23 @@ func (c *IAM) RemoveRoleFromInstanceProfileRequest(input *RemoveRoleFromInstance // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/RemoveRoleFromInstanceProfile func (c *IAM) RemoveRoleFromInstanceProfile(input *RemoveRoleFromInstanceProfileInput) (*RemoveRoleFromInstanceProfileOutput, error) { req, out := c.RemoveRoleFromInstanceProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveRoleFromInstanceProfileWithContext is the same as RemoveRoleFromInstanceProfile with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveRoleFromInstanceProfile 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 *IAM) RemoveRoleFromInstanceProfileWithContext(ctx aws.Context, input *RemoveRoleFromInstanceProfileInput, opts ...request.Option) (*RemoveRoleFromInstanceProfileOutput, error) { + req, out := c.RemoveRoleFromInstanceProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveUserFromGroup = "RemoveUserFromGroup" @@ -8732,8 +10788,23 @@ func (c *IAM) RemoveUserFromGroupRequest(input *RemoveUserFromGroupInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/RemoveUserFromGroup func (c *IAM) RemoveUserFromGroup(input *RemoveUserFromGroupInput) (*RemoveUserFromGroupOutput, error) { req, out := c.RemoveUserFromGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveUserFromGroupWithContext is the same as RemoveUserFromGroup with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveUserFromGroup 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 *IAM) RemoveUserFromGroupWithContext(ctx aws.Context, input *RemoveUserFromGroupInput, opts ...request.Option) (*RemoveUserFromGroupOutput, error) { + req, out := c.RemoveUserFromGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetServiceSpecificCredential = "ResetServiceSpecificCredential" @@ -8801,8 +10872,23 @@ func (c *IAM) ResetServiceSpecificCredentialRequest(input *ResetServiceSpecificC // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ResetServiceSpecificCredential func (c *IAM) ResetServiceSpecificCredential(input *ResetServiceSpecificCredentialInput) (*ResetServiceSpecificCredentialOutput, error) { req, out := c.ResetServiceSpecificCredentialRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetServiceSpecificCredentialWithContext is the same as ResetServiceSpecificCredential with the addition of +// the ability to pass a context and additional request options. +// +// See ResetServiceSpecificCredential 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 *IAM) ResetServiceSpecificCredentialWithContext(ctx aws.Context, input *ResetServiceSpecificCredentialInput, opts ...request.Option) (*ResetServiceSpecificCredentialOutput, error) { + req, out := c.ResetServiceSpecificCredentialRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResyncMFADevice = "ResyncMFADevice" @@ -8886,8 +10972,23 @@ func (c *IAM) ResyncMFADeviceRequest(input *ResyncMFADeviceInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/ResyncMFADevice func (c *IAM) ResyncMFADevice(input *ResyncMFADeviceInput) (*ResyncMFADeviceOutput, error) { req, out := c.ResyncMFADeviceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResyncMFADeviceWithContext is the same as ResyncMFADevice with the addition of +// the ability to pass a context and additional request options. +// +// See ResyncMFADevice 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 *IAM) ResyncMFADeviceWithContext(ctx aws.Context, input *ResyncMFADeviceInput, opts ...request.Option) (*ResyncMFADeviceOutput, error) { + req, out := c.ResyncMFADeviceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetDefaultPolicyVersion = "SetDefaultPolicyVersion" @@ -8975,8 +11076,23 @@ func (c *IAM) SetDefaultPolicyVersionRequest(input *SetDefaultPolicyVersionInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/SetDefaultPolicyVersion func (c *IAM) SetDefaultPolicyVersion(input *SetDefaultPolicyVersionInput) (*SetDefaultPolicyVersionOutput, error) { req, out := c.SetDefaultPolicyVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetDefaultPolicyVersionWithContext is the same as SetDefaultPolicyVersion with the addition of +// the ability to pass a context and additional request options. +// +// See SetDefaultPolicyVersion 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 *IAM) SetDefaultPolicyVersionWithContext(ctx aws.Context, input *SetDefaultPolicyVersionInput, opts ...request.Option) (*SetDefaultPolicyVersionOutput, error) { + req, out := c.SetDefaultPolicyVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSimulateCustomPolicy = "SimulateCustomPolicy" @@ -9067,8 +11183,23 @@ func (c *IAM) SimulateCustomPolicyRequest(input *SimulateCustomPolicyInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/SimulateCustomPolicy func (c *IAM) SimulateCustomPolicy(input *SimulateCustomPolicyInput) (*SimulatePolicyResponse, error) { req, out := c.SimulateCustomPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SimulateCustomPolicyWithContext is the same as SimulateCustomPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See SimulateCustomPolicy 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 *IAM) SimulateCustomPolicyWithContext(ctx aws.Context, input *SimulateCustomPolicyInput, opts ...request.Option) (*SimulatePolicyResponse, error) { + req, out := c.SimulateCustomPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // SimulateCustomPolicyPages iterates over the pages of a SimulateCustomPolicy operation, @@ -9088,12 +11219,37 @@ func (c *IAM) SimulateCustomPolicy(input *SimulateCustomPolicyInput) (*SimulateP // return pageNum <= 3 // }) // -func (c *IAM) SimulateCustomPolicyPages(input *SimulateCustomPolicyInput, fn func(p *SimulatePolicyResponse, lastPage bool) (shouldContinue bool)) error { - page, _ := c.SimulateCustomPolicyRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*SimulatePolicyResponse), lastPage) - }) +func (c *IAM) SimulateCustomPolicyPages(input *SimulateCustomPolicyInput, fn func(*SimulatePolicyResponse, bool) bool) error { + return c.SimulateCustomPolicyPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// SimulateCustomPolicyPagesWithContext same as SimulateCustomPolicyPages 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 *IAM) SimulateCustomPolicyPagesWithContext(ctx aws.Context, input *SimulateCustomPolicyInput, fn func(*SimulatePolicyResponse, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *SimulateCustomPolicyInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.SimulateCustomPolicyRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*SimulatePolicyResponse), !p.HasNextPage()) + } + return p.Err() } const opSimulatePrincipalPolicy = "SimulatePrincipalPolicy" @@ -9198,8 +11354,23 @@ func (c *IAM) SimulatePrincipalPolicyRequest(input *SimulatePrincipalPolicyInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/SimulatePrincipalPolicy func (c *IAM) SimulatePrincipalPolicy(input *SimulatePrincipalPolicyInput) (*SimulatePolicyResponse, error) { req, out := c.SimulatePrincipalPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SimulatePrincipalPolicyWithContext is the same as SimulatePrincipalPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See SimulatePrincipalPolicy 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 *IAM) SimulatePrincipalPolicyWithContext(ctx aws.Context, input *SimulatePrincipalPolicyInput, opts ...request.Option) (*SimulatePolicyResponse, error) { + req, out := c.SimulatePrincipalPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // SimulatePrincipalPolicyPages iterates over the pages of a SimulatePrincipalPolicy operation, @@ -9219,12 +11390,37 @@ func (c *IAM) SimulatePrincipalPolicy(input *SimulatePrincipalPolicyInput) (*Sim // return pageNum <= 3 // }) // -func (c *IAM) SimulatePrincipalPolicyPages(input *SimulatePrincipalPolicyInput, fn func(p *SimulatePolicyResponse, lastPage bool) (shouldContinue bool)) error { - page, _ := c.SimulatePrincipalPolicyRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*SimulatePolicyResponse), lastPage) - }) +func (c *IAM) SimulatePrincipalPolicyPages(input *SimulatePrincipalPolicyInput, fn func(*SimulatePolicyResponse, bool) bool) error { + return c.SimulatePrincipalPolicyPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// SimulatePrincipalPolicyPagesWithContext same as SimulatePrincipalPolicyPages 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 *IAM) SimulatePrincipalPolicyPagesWithContext(ctx aws.Context, input *SimulatePrincipalPolicyInput, fn func(*SimulatePolicyResponse, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *SimulatePrincipalPolicyInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.SimulatePrincipalPolicyRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*SimulatePolicyResponse), !p.HasNextPage()) + } + return p.Err() } const opUpdateAccessKey = "UpdateAccessKey" @@ -9309,8 +11505,23 @@ func (c *IAM) UpdateAccessKeyRequest(input *UpdateAccessKeyInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateAccessKey func (c *IAM) UpdateAccessKey(input *UpdateAccessKeyInput) (*UpdateAccessKeyOutput, error) { req, out := c.UpdateAccessKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAccessKeyWithContext is the same as UpdateAccessKey with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAccessKey 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 *IAM) UpdateAccessKeyWithContext(ctx aws.Context, input *UpdateAccessKeyInput, opts ...request.Option) (*UpdateAccessKeyOutput, error) { + req, out := c.UpdateAccessKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateAccountPasswordPolicy = "UpdateAccountPasswordPolicy" @@ -9398,8 +11609,23 @@ func (c *IAM) UpdateAccountPasswordPolicyRequest(input *UpdateAccountPasswordPol // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateAccountPasswordPolicy func (c *IAM) UpdateAccountPasswordPolicy(input *UpdateAccountPasswordPolicyInput) (*UpdateAccountPasswordPolicyOutput, error) { req, out := c.UpdateAccountPasswordPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAccountPasswordPolicyWithContext is the same as UpdateAccountPasswordPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAccountPasswordPolicy 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 *IAM) UpdateAccountPasswordPolicyWithContext(ctx aws.Context, input *UpdateAccountPasswordPolicyInput, opts ...request.Option) (*UpdateAccountPasswordPolicyOutput, error) { + req, out := c.UpdateAccountPasswordPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateAssumeRolePolicy = "UpdateAssumeRolePolicy" @@ -9481,8 +11707,23 @@ func (c *IAM) UpdateAssumeRolePolicyRequest(input *UpdateAssumeRolePolicyInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateAssumeRolePolicy func (c *IAM) UpdateAssumeRolePolicy(input *UpdateAssumeRolePolicyInput) (*UpdateAssumeRolePolicyOutput, error) { req, out := c.UpdateAssumeRolePolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAssumeRolePolicyWithContext is the same as UpdateAssumeRolePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAssumeRolePolicy 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 *IAM) UpdateAssumeRolePolicyWithContext(ctx aws.Context, input *UpdateAssumeRolePolicyInput, opts ...request.Option) (*UpdateAssumeRolePolicyOutput, error) { + req, out := c.UpdateAssumeRolePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateGroup = "UpdateGroup" @@ -9571,8 +11812,23 @@ func (c *IAM) UpdateGroupRequest(input *UpdateGroupInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateGroup func (c *IAM) UpdateGroup(input *UpdateGroupInput) (*UpdateGroupOutput, error) { req, out := c.UpdateGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateGroupWithContext is the same as UpdateGroup with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateGroup 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 *IAM) UpdateGroupWithContext(ctx aws.Context, input *UpdateGroupInput, opts ...request.Option) (*UpdateGroupOutput, error) { + req, out := c.UpdateGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateLoginProfile = "UpdateLoginProfile" @@ -9661,8 +11917,23 @@ func (c *IAM) UpdateLoginProfileRequest(input *UpdateLoginProfileInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateLoginProfile func (c *IAM) UpdateLoginProfile(input *UpdateLoginProfileInput) (*UpdateLoginProfileOutput, error) { req, out := c.UpdateLoginProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateLoginProfileWithContext is the same as UpdateLoginProfile with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateLoginProfile 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 *IAM) UpdateLoginProfileWithContext(ctx aws.Context, input *UpdateLoginProfileInput, opts ...request.Option) (*UpdateLoginProfileOutput, error) { + req, out := c.UpdateLoginProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateOpenIDConnectProviderThumbprint = "UpdateOpenIDConnectProviderThumbprint" @@ -9751,8 +12022,23 @@ func (c *IAM) UpdateOpenIDConnectProviderThumbprintRequest(input *UpdateOpenIDCo // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateOpenIDConnectProviderThumbprint func (c *IAM) UpdateOpenIDConnectProviderThumbprint(input *UpdateOpenIDConnectProviderThumbprintInput) (*UpdateOpenIDConnectProviderThumbprintOutput, error) { req, out := c.UpdateOpenIDConnectProviderThumbprintRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateOpenIDConnectProviderThumbprintWithContext is the same as UpdateOpenIDConnectProviderThumbprint with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateOpenIDConnectProviderThumbprint 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 *IAM) UpdateOpenIDConnectProviderThumbprintWithContext(ctx aws.Context, input *UpdateOpenIDConnectProviderThumbprintInput, opts ...request.Option) (*UpdateOpenIDConnectProviderThumbprintOutput, error) { + req, out := c.UpdateOpenIDConnectProviderThumbprintRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateSAMLProvider = "UpdateSAMLProvider" @@ -9831,8 +12117,23 @@ func (c *IAM) UpdateSAMLProviderRequest(input *UpdateSAMLProviderInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateSAMLProvider func (c *IAM) UpdateSAMLProvider(input *UpdateSAMLProviderInput) (*UpdateSAMLProviderOutput, error) { req, out := c.UpdateSAMLProviderRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateSAMLProviderWithContext is the same as UpdateSAMLProvider with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateSAMLProvider 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 *IAM) UpdateSAMLProviderWithContext(ctx aws.Context, input *UpdateSAMLProviderInput, opts ...request.Option) (*UpdateSAMLProviderOutput, error) { + req, out := c.UpdateSAMLProviderRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateSSHPublicKey = "UpdateSSHPublicKey" @@ -9908,8 +12209,23 @@ func (c *IAM) UpdateSSHPublicKeyRequest(input *UpdateSSHPublicKeyInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateSSHPublicKey func (c *IAM) UpdateSSHPublicKey(input *UpdateSSHPublicKeyInput) (*UpdateSSHPublicKeyOutput, error) { req, out := c.UpdateSSHPublicKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateSSHPublicKeyWithContext is the same as UpdateSSHPublicKey with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateSSHPublicKey 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 *IAM) UpdateSSHPublicKeyWithContext(ctx aws.Context, input *UpdateSSHPublicKeyInput, opts ...request.Option) (*UpdateSSHPublicKeyOutput, error) { + req, out := c.UpdateSSHPublicKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateServerCertificate = "UpdateServerCertificate" @@ -10006,8 +12322,23 @@ func (c *IAM) UpdateServerCertificateRequest(input *UpdateServerCertificateInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateServerCertificate func (c *IAM) UpdateServerCertificate(input *UpdateServerCertificateInput) (*UpdateServerCertificateOutput, error) { req, out := c.UpdateServerCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateServerCertificateWithContext is the same as UpdateServerCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateServerCertificate 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 *IAM) UpdateServerCertificateWithContext(ctx aws.Context, input *UpdateServerCertificateInput, opts ...request.Option) (*UpdateServerCertificateOutput, error) { + req, out := c.UpdateServerCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateServiceSpecificCredential = "UpdateServiceSpecificCredential" @@ -10077,8 +12408,23 @@ func (c *IAM) UpdateServiceSpecificCredentialRequest(input *UpdateServiceSpecifi // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateServiceSpecificCredential func (c *IAM) UpdateServiceSpecificCredential(input *UpdateServiceSpecificCredentialInput) (*UpdateServiceSpecificCredentialOutput, error) { req, out := c.UpdateServiceSpecificCredentialRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateServiceSpecificCredentialWithContext is the same as UpdateServiceSpecificCredential with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateServiceSpecificCredential 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 *IAM) UpdateServiceSpecificCredentialWithContext(ctx aws.Context, input *UpdateServiceSpecificCredentialInput, opts ...request.Option) (*UpdateServiceSpecificCredentialOutput, error) { + req, out := c.UpdateServiceSpecificCredentialRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateSigningCertificate = "UpdateSigningCertificate" @@ -10160,8 +12506,23 @@ func (c *IAM) UpdateSigningCertificateRequest(input *UpdateSigningCertificateInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateSigningCertificate func (c *IAM) UpdateSigningCertificate(input *UpdateSigningCertificateInput) (*UpdateSigningCertificateOutput, error) { req, out := c.UpdateSigningCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateSigningCertificateWithContext is the same as UpdateSigningCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateSigningCertificate 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 *IAM) UpdateSigningCertificateWithContext(ctx aws.Context, input *UpdateSigningCertificateInput, opts ...request.Option) (*UpdateSigningCertificateOutput, error) { + req, out := c.UpdateSigningCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateUser = "UpdateUser" @@ -10257,8 +12618,23 @@ func (c *IAM) UpdateUserRequest(input *UpdateUserInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UpdateUser func (c *IAM) UpdateUser(input *UpdateUserInput) (*UpdateUserOutput, error) { req, out := c.UpdateUserRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateUserWithContext is the same as UpdateUser with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateUser 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 *IAM) UpdateUserWithContext(ctx aws.Context, input *UpdateUserInput, opts ...request.Option) (*UpdateUserOutput, error) { + req, out := c.UpdateUserRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadSSHPublicKey = "UploadSSHPublicKey" @@ -10345,8 +12721,23 @@ func (c *IAM) UploadSSHPublicKeyRequest(input *UploadSSHPublicKeyInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UploadSSHPublicKey func (c *IAM) UploadSSHPublicKey(input *UploadSSHPublicKeyInput) (*UploadSSHPublicKeyOutput, error) { req, out := c.UploadSSHPublicKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadSSHPublicKeyWithContext is the same as UploadSSHPublicKey with the addition of +// the ability to pass a context and additional request options. +// +// See UploadSSHPublicKey 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 *IAM) UploadSSHPublicKeyWithContext(ctx aws.Context, input *UploadSSHPublicKeyInput, opts ...request.Option) (*UploadSSHPublicKeyOutput, error) { + req, out := c.UploadSSHPublicKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadServerCertificate = "UploadServerCertificate" @@ -10398,6 +12789,12 @@ func (c *IAM) UploadServerCertificateRequest(input *UploadServerCertificateInput // entity includes a public key certificate, a private key, and an optional // certificate chain, which should all be PEM-encoded. // +// We recommend that you use AWS Certificate Manager (https://aws.amazon.com/certificate-manager/) +// to provision, manage, and deploy your server certificates. With ACM you can +// request a certificate, deploy it to AWS resources, and let ACM handle certificate +// renewals for you. Certificates provided by ACM are free. For more information +// about using ACM, see the AWS Certificate Manager User Guide (http://docs.aws.amazon.com/acm/latest/userguide/). +// // For more information about working with server certificates, including a // list of AWS services that can use the server certificates that you manage // with IAM, go to Working with Server Certificates (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html) @@ -10446,8 +12843,23 @@ func (c *IAM) UploadServerCertificateRequest(input *UploadServerCertificateInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UploadServerCertificate func (c *IAM) UploadServerCertificate(input *UploadServerCertificateInput) (*UploadServerCertificateOutput, error) { req, out := c.UploadServerCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadServerCertificateWithContext is the same as UploadServerCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See UploadServerCertificate 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 *IAM) UploadServerCertificateWithContext(ctx aws.Context, input *UploadServerCertificateInput, opts ...request.Option) (*UploadServerCertificateOutput, error) { + req, out := c.UploadServerCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadSigningCertificate = "UploadSigningCertificate" @@ -10551,8 +12963,23 @@ func (c *IAM) UploadSigningCertificateRequest(input *UploadSigningCertificateInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/UploadSigningCertificate func (c *IAM) UploadSigningCertificate(input *UploadSigningCertificateInput) (*UploadSigningCertificateOutput, error) { req, out := c.UploadSigningCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadSigningCertificateWithContext is the same as UploadSigningCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See UploadSigningCertificate 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 *IAM) UploadSigningCertificateWithContext(ctx aws.Context, input *UploadSigningCertificateInput, opts ...request.Option) (*UploadSigningCertificateOutput, error) { + req, out := c.UploadSigningCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Contains information about an AWS access key. @@ -14604,6 +17031,11 @@ type EvaluationResult struct { // call GetContextKeysForCustomPolicy or GetContextKeysForPrincipalPolicy. MissingContextValues []*string `type:"list"` + // A structure that details how AWS Organizations and its service control policies + // affect the results of the simulation. Only applies if the simulated user's + // account is part of an organization. + OrganizationsDecisionDetail *OrganizationsDecisionDetail `type:"structure"` + // The individual results of the simulation of the API action specified in EvalActionName // on each resource. ResourceSpecificResults []*ResourceSpecificResult `type:"list"` @@ -14655,6 +17087,12 @@ func (s *EvaluationResult) SetMissingContextValues(v []*string) *EvaluationResul return s } +// SetOrganizationsDecisionDetail sets the OrganizationsDecisionDetail field's value. +func (s *EvaluationResult) SetOrganizationsDecisionDetail(v *OrganizationsDecisionDetail) *EvaluationResult { + s.OrganizationsDecisionDetail = v + return s +} + // SetResourceSpecificResults sets the ResourceSpecificResults field's value. func (s *EvaluationResult) SetResourceSpecificResults(v []*ResourceSpecificResult) *EvaluationResult { s.ResourceSpecificResults = v @@ -20226,6 +22664,32 @@ func (s *OpenIDConnectProviderListEntry) SetArn(v string) *OpenIDConnectProvider return s } +// Contains information about AWS Organizations's affect on a policy simulation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/OrganizationsDecisionDetail +type OrganizationsDecisionDetail struct { + _ struct{} `type:"structure"` + + // Specifies whether the simulated action is allowed by the AWS Organizations + // service control policies that impact the simulated user's account. + AllowedByOrganizations *bool `type:"boolean"` +} + +// String returns the string representation +func (s OrganizationsDecisionDetail) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OrganizationsDecisionDetail) GoString() string { + return s.String() +} + +// SetAllowedByOrganizations sets the AllowedByOrganizations field's value. +func (s *OrganizationsDecisionDetail) SetAllowedByOrganizations(v bool) *OrganizationsDecisionDetail { + s.AllowedByOrganizations = &v + return s +} + // Contains information about the account password policy. // // This data type is used as a response element in the GetAccountPasswordPolicy diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/errors.go index 26c2534bf9..fd23035230 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package iam diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/service.go index 1942ec03e2..73ea1bac2c 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package iam diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/waiters.go index 9231bf0bdc..8bf5129cb7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/iam/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/iam/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package iam import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilInstanceProfileExists uses the IAM API operation @@ -11,32 +14,50 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *IAM) WaitUntilInstanceProfileExists(input *GetInstanceProfileInput) error { - waiterCfg := waiter.Config{ - Operation: "GetInstanceProfile", - Delay: 1, + return c.WaitUntilInstanceProfileExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceProfileExistsWithContext is an extended version of WaitUntilInstanceProfileExists. +// 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 *IAM) WaitUntilInstanceProfileExistsWithContext(ctx aws.Context, input *GetInstanceProfileInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceProfileExists", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(1 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "retry", - Matcher: "status", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 404, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetInstanceProfileInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetInstanceProfileRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilUserExists uses the IAM API operation @@ -44,30 +65,48 @@ func (c *IAM) WaitUntilInstanceProfileExists(input *GetInstanceProfileInput) err // If the condition is not meet within the max attempt window an error will // be returned. func (c *IAM) WaitUntilUserExists(input *GetUserInput) error { - waiterCfg := waiter.Config{ - Operation: "GetUser", - Delay: 1, + return c.WaitUntilUserExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilUserExistsWithContext is an extended version of WaitUntilUserExists. +// 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 *IAM) WaitUntilUserExistsWithContext(ctx aws.Context, input *GetUserInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilUserExists", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(1 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "NoSuchEntity", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetUserInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetUserRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go index a81c6b062d..51aa84dbe3 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package inspector provides a client for Amazon Inspector. package inspector @@ -7,6 +7,7 @@ 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" @@ -86,8 +87,23 @@ func (c *Inspector) AddAttributesToFindingsRequest(input *AddAttributesToFinding // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/AddAttributesToFindings func (c *Inspector) AddAttributesToFindings(input *AddAttributesToFindingsInput) (*AddAttributesToFindingsOutput, error) { req, out := c.AddAttributesToFindingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddAttributesToFindingsWithContext is the same as AddAttributesToFindings with the addition of +// the ability to pass a context and additional request options. +// +// See AddAttributesToFindings 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 *Inspector) AddAttributesToFindingsWithContext(ctx aws.Context, input *AddAttributesToFindingsInput, opts ...request.Option) (*AddAttributesToFindingsOutput, error) { + req, out := c.AddAttributesToFindingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAssessmentTarget = "CreateAssessmentTarget" @@ -169,8 +185,23 @@ func (c *Inspector) CreateAssessmentTargetRequest(input *CreateAssessmentTargetI // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/CreateAssessmentTarget func (c *Inspector) CreateAssessmentTarget(input *CreateAssessmentTargetInput) (*CreateAssessmentTargetOutput, error) { req, out := c.CreateAssessmentTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAssessmentTargetWithContext is the same as CreateAssessmentTarget with the addition of +// the ability to pass a context and additional request options. +// +// See CreateAssessmentTarget 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 *Inspector) CreateAssessmentTargetWithContext(ctx aws.Context, input *CreateAssessmentTargetInput, opts ...request.Option) (*CreateAssessmentTargetOutput, error) { + req, out := c.CreateAssessmentTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAssessmentTemplate = "CreateAssessmentTemplate" @@ -250,8 +281,23 @@ func (c *Inspector) CreateAssessmentTemplateRequest(input *CreateAssessmentTempl // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/CreateAssessmentTemplate func (c *Inspector) CreateAssessmentTemplate(input *CreateAssessmentTemplateInput) (*CreateAssessmentTemplateOutput, error) { req, out := c.CreateAssessmentTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAssessmentTemplateWithContext is the same as CreateAssessmentTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See CreateAssessmentTemplate 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 *Inspector) CreateAssessmentTemplateWithContext(ctx aws.Context, input *CreateAssessmentTemplateInput, opts ...request.Option) (*CreateAssessmentTemplateOutput, error) { + req, out := c.CreateAssessmentTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateResourceGroup = "CreateResourceGroup" @@ -329,8 +375,23 @@ func (c *Inspector) CreateResourceGroupRequest(input *CreateResourceGroupInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/CreateResourceGroup func (c *Inspector) CreateResourceGroup(input *CreateResourceGroupInput) (*CreateResourceGroupOutput, error) { req, out := c.CreateResourceGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateResourceGroupWithContext is the same as CreateResourceGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateResourceGroup 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 *Inspector) CreateResourceGroupWithContext(ctx aws.Context, input *CreateResourceGroupInput, opts ...request.Option) (*CreateResourceGroupOutput, error) { + req, out := c.CreateResourceGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAssessmentRun = "DeleteAssessmentRun" @@ -412,8 +473,23 @@ func (c *Inspector) DeleteAssessmentRunRequest(input *DeleteAssessmentRunInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DeleteAssessmentRun func (c *Inspector) DeleteAssessmentRun(input *DeleteAssessmentRunInput) (*DeleteAssessmentRunOutput, error) { req, out := c.DeleteAssessmentRunRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAssessmentRunWithContext is the same as DeleteAssessmentRun with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAssessmentRun 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 *Inspector) DeleteAssessmentRunWithContext(ctx aws.Context, input *DeleteAssessmentRunInput, opts ...request.Option) (*DeleteAssessmentRunOutput, error) { + req, out := c.DeleteAssessmentRunRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAssessmentTarget = "DeleteAssessmentTarget" @@ -495,8 +571,23 @@ func (c *Inspector) DeleteAssessmentTargetRequest(input *DeleteAssessmentTargetI // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DeleteAssessmentTarget func (c *Inspector) DeleteAssessmentTarget(input *DeleteAssessmentTargetInput) (*DeleteAssessmentTargetOutput, error) { req, out := c.DeleteAssessmentTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAssessmentTargetWithContext is the same as DeleteAssessmentTarget with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAssessmentTarget 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 *Inspector) DeleteAssessmentTargetWithContext(ctx aws.Context, input *DeleteAssessmentTargetInput, opts ...request.Option) (*DeleteAssessmentTargetOutput, error) { + req, out := c.DeleteAssessmentTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAssessmentTemplate = "DeleteAssessmentTemplate" @@ -578,8 +669,23 @@ func (c *Inspector) DeleteAssessmentTemplateRequest(input *DeleteAssessmentTempl // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DeleteAssessmentTemplate func (c *Inspector) DeleteAssessmentTemplate(input *DeleteAssessmentTemplateInput) (*DeleteAssessmentTemplateOutput, error) { req, out := c.DeleteAssessmentTemplateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAssessmentTemplateWithContext is the same as DeleteAssessmentTemplate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAssessmentTemplate 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 *Inspector) DeleteAssessmentTemplateWithContext(ctx aws.Context, input *DeleteAssessmentTemplateInput, opts ...request.Option) (*DeleteAssessmentTemplateOutput, error) { + req, out := c.DeleteAssessmentTemplateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAssessmentRuns = "DescribeAssessmentRuns" @@ -648,8 +754,23 @@ func (c *Inspector) DescribeAssessmentRunsRequest(input *DescribeAssessmentRunsI // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DescribeAssessmentRuns func (c *Inspector) DescribeAssessmentRuns(input *DescribeAssessmentRunsInput) (*DescribeAssessmentRunsOutput, error) { req, out := c.DescribeAssessmentRunsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAssessmentRunsWithContext is the same as DescribeAssessmentRuns with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAssessmentRuns 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 *Inspector) DescribeAssessmentRunsWithContext(ctx aws.Context, input *DescribeAssessmentRunsInput, opts ...request.Option) (*DescribeAssessmentRunsOutput, error) { + req, out := c.DescribeAssessmentRunsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAssessmentTargets = "DescribeAssessmentTargets" @@ -718,8 +839,23 @@ func (c *Inspector) DescribeAssessmentTargetsRequest(input *DescribeAssessmentTa // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DescribeAssessmentTargets func (c *Inspector) DescribeAssessmentTargets(input *DescribeAssessmentTargetsInput) (*DescribeAssessmentTargetsOutput, error) { req, out := c.DescribeAssessmentTargetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAssessmentTargetsWithContext is the same as DescribeAssessmentTargets with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAssessmentTargets 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 *Inspector) DescribeAssessmentTargetsWithContext(ctx aws.Context, input *DescribeAssessmentTargetsInput, opts ...request.Option) (*DescribeAssessmentTargetsOutput, error) { + req, out := c.DescribeAssessmentTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAssessmentTemplates = "DescribeAssessmentTemplates" @@ -788,8 +924,23 @@ func (c *Inspector) DescribeAssessmentTemplatesRequest(input *DescribeAssessment // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DescribeAssessmentTemplates func (c *Inspector) DescribeAssessmentTemplates(input *DescribeAssessmentTemplatesInput) (*DescribeAssessmentTemplatesOutput, error) { req, out := c.DescribeAssessmentTemplatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAssessmentTemplatesWithContext is the same as DescribeAssessmentTemplates with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAssessmentTemplates 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 *Inspector) DescribeAssessmentTemplatesWithContext(ctx aws.Context, input *DescribeAssessmentTemplatesInput, opts ...request.Option) (*DescribeAssessmentTemplatesOutput, error) { + req, out := c.DescribeAssessmentTemplatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCrossAccountAccessRole = "DescribeCrossAccountAccessRole" @@ -853,8 +1004,23 @@ func (c *Inspector) DescribeCrossAccountAccessRoleRequest(input *DescribeCrossAc // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DescribeCrossAccountAccessRole func (c *Inspector) DescribeCrossAccountAccessRole(input *DescribeCrossAccountAccessRoleInput) (*DescribeCrossAccountAccessRoleOutput, error) { req, out := c.DescribeCrossAccountAccessRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCrossAccountAccessRoleWithContext is the same as DescribeCrossAccountAccessRole with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCrossAccountAccessRole 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 *Inspector) DescribeCrossAccountAccessRoleWithContext(ctx aws.Context, input *DescribeCrossAccountAccessRoleInput, opts ...request.Option) (*DescribeCrossAccountAccessRoleOutput, error) { + req, out := c.DescribeCrossAccountAccessRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeFindings = "DescribeFindings" @@ -922,8 +1088,23 @@ func (c *Inspector) DescribeFindingsRequest(input *DescribeFindingsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DescribeFindings func (c *Inspector) DescribeFindings(input *DescribeFindingsInput) (*DescribeFindingsOutput, error) { req, out := c.DescribeFindingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeFindingsWithContext is the same as DescribeFindings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeFindings 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 *Inspector) DescribeFindingsWithContext(ctx aws.Context, input *DescribeFindingsInput, opts ...request.Option) (*DescribeFindingsOutput, error) { + req, out := c.DescribeFindingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeResourceGroups = "DescribeResourceGroups" @@ -992,8 +1173,23 @@ func (c *Inspector) DescribeResourceGroupsRequest(input *DescribeResourceGroupsI // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DescribeResourceGroups func (c *Inspector) DescribeResourceGroups(input *DescribeResourceGroupsInput) (*DescribeResourceGroupsOutput, error) { req, out := c.DescribeResourceGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeResourceGroupsWithContext is the same as DescribeResourceGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeResourceGroups 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 *Inspector) DescribeResourceGroupsWithContext(ctx aws.Context, input *DescribeResourceGroupsInput, opts ...request.Option) (*DescribeResourceGroupsOutput, error) { + req, out := c.DescribeResourceGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeRulesPackages = "DescribeRulesPackages" @@ -1062,8 +1258,23 @@ func (c *Inspector) DescribeRulesPackagesRequest(input *DescribeRulesPackagesInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/DescribeRulesPackages func (c *Inspector) DescribeRulesPackages(input *DescribeRulesPackagesInput) (*DescribeRulesPackagesOutput, error) { req, out := c.DescribeRulesPackagesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRulesPackagesWithContext is the same as DescribeRulesPackages with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRulesPackages 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 *Inspector) DescribeRulesPackagesWithContext(ctx aws.Context, input *DescribeRulesPackagesInput, opts ...request.Option) (*DescribeRulesPackagesOutput, error) { + req, out := c.DescribeRulesPackagesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTelemetryMetadata = "GetTelemetryMetadata" @@ -1139,8 +1350,23 @@ func (c *Inspector) GetTelemetryMetadataRequest(input *GetTelemetryMetadataInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetTelemetryMetadata func (c *Inspector) GetTelemetryMetadata(input *GetTelemetryMetadataInput) (*GetTelemetryMetadataOutput, error) { req, out := c.GetTelemetryMetadataRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTelemetryMetadataWithContext is the same as GetTelemetryMetadata with the addition of +// the ability to pass a context and additional request options. +// +// See GetTelemetryMetadata 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 *Inspector) GetTelemetryMetadataWithContext(ctx aws.Context, input *GetTelemetryMetadataInput, opts ...request.Option) (*GetTelemetryMetadataOutput, error) { + req, out := c.GetTelemetryMetadataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAssessmentRunAgents = "ListAssessmentRunAgents" @@ -1216,8 +1442,23 @@ func (c *Inspector) ListAssessmentRunAgentsRequest(input *ListAssessmentRunAgent // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListAssessmentRunAgents func (c *Inspector) ListAssessmentRunAgents(input *ListAssessmentRunAgentsInput) (*ListAssessmentRunAgentsOutput, error) { req, out := c.ListAssessmentRunAgentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAssessmentRunAgentsWithContext is the same as ListAssessmentRunAgents with the addition of +// the ability to pass a context and additional request options. +// +// See ListAssessmentRunAgents 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 *Inspector) ListAssessmentRunAgentsWithContext(ctx aws.Context, input *ListAssessmentRunAgentsInput, opts ...request.Option) (*ListAssessmentRunAgentsOutput, error) { + req, out := c.ListAssessmentRunAgentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAssessmentRuns = "ListAssessmentRuns" @@ -1293,8 +1534,23 @@ func (c *Inspector) ListAssessmentRunsRequest(input *ListAssessmentRunsInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListAssessmentRuns func (c *Inspector) ListAssessmentRuns(input *ListAssessmentRunsInput) (*ListAssessmentRunsOutput, error) { req, out := c.ListAssessmentRunsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAssessmentRunsWithContext is the same as ListAssessmentRuns with the addition of +// the ability to pass a context and additional request options. +// +// See ListAssessmentRuns 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 *Inspector) ListAssessmentRunsWithContext(ctx aws.Context, input *ListAssessmentRunsInput, opts ...request.Option) (*ListAssessmentRunsOutput, error) { + req, out := c.ListAssessmentRunsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAssessmentTargets = "ListAssessmentTargets" @@ -1367,8 +1623,23 @@ func (c *Inspector) ListAssessmentTargetsRequest(input *ListAssessmentTargetsInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListAssessmentTargets func (c *Inspector) ListAssessmentTargets(input *ListAssessmentTargetsInput) (*ListAssessmentTargetsOutput, error) { req, out := c.ListAssessmentTargetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAssessmentTargetsWithContext is the same as ListAssessmentTargets with the addition of +// the ability to pass a context and additional request options. +// +// See ListAssessmentTargets 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 *Inspector) ListAssessmentTargetsWithContext(ctx aws.Context, input *ListAssessmentTargetsInput, opts ...request.Option) (*ListAssessmentTargetsOutput, error) { + req, out := c.ListAssessmentTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAssessmentTemplates = "ListAssessmentTemplates" @@ -1444,8 +1715,23 @@ func (c *Inspector) ListAssessmentTemplatesRequest(input *ListAssessmentTemplate // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListAssessmentTemplates func (c *Inspector) ListAssessmentTemplates(input *ListAssessmentTemplatesInput) (*ListAssessmentTemplatesOutput, error) { req, out := c.ListAssessmentTemplatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAssessmentTemplatesWithContext is the same as ListAssessmentTemplates with the addition of +// the ability to pass a context and additional request options. +// +// See ListAssessmentTemplates 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 *Inspector) ListAssessmentTemplatesWithContext(ctx aws.Context, input *ListAssessmentTemplatesInput, opts ...request.Option) (*ListAssessmentTemplatesOutput, error) { + req, out := c.ListAssessmentTemplatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListEventSubscriptions = "ListEventSubscriptions" @@ -1522,8 +1808,23 @@ func (c *Inspector) ListEventSubscriptionsRequest(input *ListEventSubscriptionsI // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListEventSubscriptions func (c *Inspector) ListEventSubscriptions(input *ListEventSubscriptionsInput) (*ListEventSubscriptionsOutput, error) { req, out := c.ListEventSubscriptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListEventSubscriptionsWithContext is the same as ListEventSubscriptions with the addition of +// the ability to pass a context and additional request options. +// +// See ListEventSubscriptions 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 *Inspector) ListEventSubscriptionsWithContext(ctx aws.Context, input *ListEventSubscriptionsInput, opts ...request.Option) (*ListEventSubscriptionsOutput, error) { + req, out := c.ListEventSubscriptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListFindings = "ListFindings" @@ -1599,8 +1900,23 @@ func (c *Inspector) ListFindingsRequest(input *ListFindingsInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListFindings func (c *Inspector) ListFindings(input *ListFindingsInput) (*ListFindingsOutput, error) { req, out := c.ListFindingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListFindingsWithContext is the same as ListFindings with the addition of +// the ability to pass a context and additional request options. +// +// See ListFindings 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 *Inspector) ListFindingsWithContext(ctx aws.Context, input *ListFindingsInput, opts ...request.Option) (*ListFindingsOutput, error) { + req, out := c.ListFindingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListRulesPackages = "ListRulesPackages" @@ -1671,8 +1987,23 @@ func (c *Inspector) ListRulesPackagesRequest(input *ListRulesPackagesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListRulesPackages func (c *Inspector) ListRulesPackages(input *ListRulesPackagesInput) (*ListRulesPackagesOutput, error) { req, out := c.ListRulesPackagesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListRulesPackagesWithContext is the same as ListRulesPackages with the addition of +// the ability to pass a context and additional request options. +// +// See ListRulesPackages 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 *Inspector) ListRulesPackagesWithContext(ctx aws.Context, input *ListRulesPackagesInput, opts ...request.Option) (*ListRulesPackagesOutput, error) { + req, out := c.ListRulesPackagesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResource = "ListTagsForResource" @@ -1747,8 +2078,23 @@ func (c *Inspector) ListTagsForResourceRequest(input *ListTagsForResourceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/ListTagsForResource func (c *Inspector) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *Inspector) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPreviewAgents = "PreviewAgents" @@ -1828,8 +2174,23 @@ func (c *Inspector) PreviewAgentsRequest(input *PreviewAgentsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/PreviewAgents func (c *Inspector) PreviewAgents(input *PreviewAgentsInput) (*PreviewAgentsOutput, error) { req, out := c.PreviewAgentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PreviewAgentsWithContext is the same as PreviewAgents with the addition of +// the ability to pass a context and additional request options. +// +// See PreviewAgents 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 *Inspector) PreviewAgentsWithContext(ctx aws.Context, input *PreviewAgentsInput, opts ...request.Option) (*PreviewAgentsOutput, error) { + req, out := c.PreviewAgentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterCrossAccountAccessRole = "RegisterCrossAccountAccessRole" @@ -1907,8 +2268,23 @@ func (c *Inspector) RegisterCrossAccountAccessRoleRequest(input *RegisterCrossAc // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/RegisterCrossAccountAccessRole func (c *Inspector) RegisterCrossAccountAccessRole(input *RegisterCrossAccountAccessRoleInput) (*RegisterCrossAccountAccessRoleOutput, error) { req, out := c.RegisterCrossAccountAccessRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterCrossAccountAccessRoleWithContext is the same as RegisterCrossAccountAccessRole with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterCrossAccountAccessRole 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 *Inspector) RegisterCrossAccountAccessRoleWithContext(ctx aws.Context, input *RegisterCrossAccountAccessRoleInput, opts ...request.Option) (*RegisterCrossAccountAccessRoleOutput, error) { + req, out := c.RegisterCrossAccountAccessRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveAttributesFromFindings = "RemoveAttributesFromFindings" @@ -1985,8 +2361,23 @@ func (c *Inspector) RemoveAttributesFromFindingsRequest(input *RemoveAttributesF // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/RemoveAttributesFromFindings func (c *Inspector) RemoveAttributesFromFindings(input *RemoveAttributesFromFindingsInput) (*RemoveAttributesFromFindingsOutput, error) { req, out := c.RemoveAttributesFromFindingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveAttributesFromFindingsWithContext is the same as RemoveAttributesFromFindings with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveAttributesFromFindings 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 *Inspector) RemoveAttributesFromFindingsWithContext(ctx aws.Context, input *RemoveAttributesFromFindingsInput, opts ...request.Option) (*RemoveAttributesFromFindingsOutput, error) { + req, out := c.RemoveAttributesFromFindingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetTagsForResource = "SetTagsForResource" @@ -2064,8 +2455,23 @@ func (c *Inspector) SetTagsForResourceRequest(input *SetTagsForResourceInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/SetTagsForResource func (c *Inspector) SetTagsForResource(input *SetTagsForResourceInput) (*SetTagsForResourceOutput, error) { req, out := c.SetTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetTagsForResourceWithContext is the same as SetTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See SetTagsForResource 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 *Inspector) SetTagsForResourceWithContext(ctx aws.Context, input *SetTagsForResourceInput, opts ...request.Option) (*SetTagsForResourceOutput, error) { + req, out := c.SetTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartAssessmentRun = "StartAssessmentRun" @@ -2154,8 +2560,23 @@ func (c *Inspector) StartAssessmentRunRequest(input *StartAssessmentRunInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/StartAssessmentRun func (c *Inspector) StartAssessmentRun(input *StartAssessmentRunInput) (*StartAssessmentRunOutput, error) { req, out := c.StartAssessmentRunRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartAssessmentRunWithContext is the same as StartAssessmentRun with the addition of +// the ability to pass a context and additional request options. +// +// See StartAssessmentRun 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 *Inspector) StartAssessmentRunWithContext(ctx aws.Context, input *StartAssessmentRunInput, opts ...request.Option) (*StartAssessmentRunOutput, error) { + req, out := c.StartAssessmentRunRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopAssessmentRun = "StopAssessmentRun" @@ -2232,8 +2653,23 @@ func (c *Inspector) StopAssessmentRunRequest(input *StopAssessmentRunInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/StopAssessmentRun func (c *Inspector) StopAssessmentRun(input *StopAssessmentRunInput) (*StopAssessmentRunOutput, error) { req, out := c.StopAssessmentRunRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopAssessmentRunWithContext is the same as StopAssessmentRun with the addition of +// the ability to pass a context and additional request options. +// +// See StopAssessmentRun 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 *Inspector) StopAssessmentRunWithContext(ctx aws.Context, input *StopAssessmentRunInput, opts ...request.Option) (*StopAssessmentRunOutput, error) { + req, out := c.StopAssessmentRunRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSubscribeToEvent = "SubscribeToEvent" @@ -2315,8 +2751,23 @@ func (c *Inspector) SubscribeToEventRequest(input *SubscribeToEventInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/SubscribeToEvent func (c *Inspector) SubscribeToEvent(input *SubscribeToEventInput) (*SubscribeToEventOutput, error) { req, out := c.SubscribeToEventRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SubscribeToEventWithContext is the same as SubscribeToEvent with the addition of +// the ability to pass a context and additional request options. +// +// See SubscribeToEvent 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 *Inspector) SubscribeToEventWithContext(ctx aws.Context, input *SubscribeToEventInput, opts ...request.Option) (*SubscribeToEventOutput, error) { + req, out := c.SubscribeToEventRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnsubscribeFromEvent = "UnsubscribeFromEvent" @@ -2394,8 +2845,23 @@ func (c *Inspector) UnsubscribeFromEventRequest(input *UnsubscribeFromEventInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/UnsubscribeFromEvent func (c *Inspector) UnsubscribeFromEvent(input *UnsubscribeFromEventInput) (*UnsubscribeFromEventOutput, error) { req, out := c.UnsubscribeFromEventRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnsubscribeFromEventWithContext is the same as UnsubscribeFromEvent with the addition of +// the ability to pass a context and additional request options. +// +// See UnsubscribeFromEvent 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 *Inspector) UnsubscribeFromEventWithContext(ctx aws.Context, input *UnsubscribeFromEventInput, opts ...request.Option) (*UnsubscribeFromEventOutput, error) { + req, out := c.UnsubscribeFromEventRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateAssessmentTarget = "UpdateAssessmentTarget" @@ -2473,8 +2939,23 @@ func (c *Inspector) UpdateAssessmentTargetRequest(input *UpdateAssessmentTargetI // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/UpdateAssessmentTarget func (c *Inspector) UpdateAssessmentTarget(input *UpdateAssessmentTargetInput) (*UpdateAssessmentTargetOutput, error) { req, out := c.UpdateAssessmentTargetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAssessmentTargetWithContext is the same as UpdateAssessmentTarget with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAssessmentTarget 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 *Inspector) UpdateAssessmentTargetWithContext(ctx aws.Context, input *UpdateAssessmentTargetInput, opts ...request.Option) (*UpdateAssessmentTargetOutput, error) { + req, out := c.UpdateAssessmentTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/AddAttributesToFindingsRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go index e39853022d..2178a76b23 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package inspector diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/service.go index 3401a9c405..81feadcc12 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/inspector/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package inspector diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go index e36f23d22a..e0b42ad5c8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package kinesis provides a client for Amazon Kinesis. package kinesis @@ -7,6 +7,7 @@ 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" @@ -93,8 +94,23 @@ func (c *Kinesis) AddTagsToStreamRequest(input *AddTagsToStreamInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/AddTagsToStream func (c *Kinesis) AddTagsToStream(input *AddTagsToStreamInput) (*AddTagsToStreamOutput, error) { req, out := c.AddTagsToStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToStreamWithContext is the same as AddTagsToStream with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToStream 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 *Kinesis) AddTagsToStreamWithContext(ctx aws.Context, input *AddTagsToStreamInput, opts ...request.Option) (*AddTagsToStreamOutput, error) { + req, out := c.AddTagsToStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateStream = "CreateStream" @@ -206,8 +222,23 @@ func (c *Kinesis) CreateStreamRequest(input *CreateStreamInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/CreateStream func (c *Kinesis) CreateStream(input *CreateStreamInput) (*CreateStreamOutput, error) { req, out := c.CreateStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateStreamWithContext is the same as CreateStream with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStream 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 *Kinesis) CreateStreamWithContext(ctx aws.Context, input *CreateStreamInput, opts ...request.Option) (*CreateStreamOutput, error) { + req, out := c.CreateStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDecreaseStreamRetentionPeriod = "DecreaseStreamRetentionPeriod" @@ -288,8 +319,23 @@ func (c *Kinesis) DecreaseStreamRetentionPeriodRequest(input *DecreaseStreamRete // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/DecreaseStreamRetentionPeriod func (c *Kinesis) DecreaseStreamRetentionPeriod(input *DecreaseStreamRetentionPeriodInput) (*DecreaseStreamRetentionPeriodOutput, error) { req, out := c.DecreaseStreamRetentionPeriodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DecreaseStreamRetentionPeriodWithContext is the same as DecreaseStreamRetentionPeriod with the addition of +// the ability to pass a context and additional request options. +// +// See DecreaseStreamRetentionPeriod 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 *Kinesis) DecreaseStreamRetentionPeriodWithContext(ctx aws.Context, input *DecreaseStreamRetentionPeriodInput, opts ...request.Option) (*DecreaseStreamRetentionPeriodOutput, error) { + req, out := c.DecreaseStreamRetentionPeriodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteStream = "DeleteStream" @@ -379,8 +425,23 @@ func (c *Kinesis) DeleteStreamRequest(input *DeleteStreamInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/DeleteStream func (c *Kinesis) DeleteStream(input *DeleteStreamInput) (*DeleteStreamOutput, error) { req, out := c.DeleteStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteStreamWithContext is the same as DeleteStream with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteStream 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 *Kinesis) DeleteStreamWithContext(ctx aws.Context, input *DeleteStreamInput, opts ...request.Option) (*DeleteStreamOutput, error) { + req, out := c.DeleteStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeLimits = "DescribeLimits" @@ -450,8 +511,23 @@ func (c *Kinesis) DescribeLimitsRequest(input *DescribeLimitsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/DescribeLimits func (c *Kinesis) DescribeLimits(input *DescribeLimitsInput) (*DescribeLimitsOutput, error) { req, out := c.DescribeLimitsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeLimitsWithContext is the same as DescribeLimits with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLimits 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 *Kinesis) DescribeLimitsWithContext(ctx aws.Context, input *DescribeLimitsInput, opts ...request.Option) (*DescribeLimitsOutput, error) { + req, out := c.DescribeLimitsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStream = "DescribeStream" @@ -544,8 +620,23 @@ func (c *Kinesis) DescribeStreamRequest(input *DescribeStreamInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/DescribeStream func (c *Kinesis) DescribeStream(input *DescribeStreamInput) (*DescribeStreamOutput, error) { req, out := c.DescribeStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStreamWithContext is the same as DescribeStream with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStream 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 *Kinesis) DescribeStreamWithContext(ctx aws.Context, input *DescribeStreamInput, opts ...request.Option) (*DescribeStreamOutput, error) { + req, out := c.DescribeStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeStreamPages iterates over the pages of a DescribeStream operation, @@ -565,12 +656,37 @@ func (c *Kinesis) DescribeStream(input *DescribeStreamInput) (*DescribeStreamOut // return pageNum <= 3 // }) // -func (c *Kinesis) DescribeStreamPages(input *DescribeStreamInput, fn func(p *DescribeStreamOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeStreamRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeStreamOutput), lastPage) - }) +func (c *Kinesis) DescribeStreamPages(input *DescribeStreamInput, fn func(*DescribeStreamOutput, bool) bool) error { + return c.DescribeStreamPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeStreamPagesWithContext same as DescribeStreamPages 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 *Kinesis) DescribeStreamPagesWithContext(ctx aws.Context, input *DescribeStreamInput, fn func(*DescribeStreamOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeStreamInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStreamRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeStreamOutput), !p.HasNextPage()) + } + return p.Err() } const opDisableEnhancedMonitoring = "DisableEnhancedMonitoring" @@ -647,8 +763,23 @@ func (c *Kinesis) DisableEnhancedMonitoringRequest(input *DisableEnhancedMonitor // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/DisableEnhancedMonitoring func (c *Kinesis) DisableEnhancedMonitoring(input *DisableEnhancedMonitoringInput) (*EnhancedMonitoringOutput, error) { req, out := c.DisableEnhancedMonitoringRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableEnhancedMonitoringWithContext is the same as DisableEnhancedMonitoring with the addition of +// the ability to pass a context and additional request options. +// +// See DisableEnhancedMonitoring 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 *Kinesis) DisableEnhancedMonitoringWithContext(ctx aws.Context, input *DisableEnhancedMonitoringInput, opts ...request.Option) (*EnhancedMonitoringOutput, error) { + req, out := c.DisableEnhancedMonitoringRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableEnhancedMonitoring = "EnableEnhancedMonitoring" @@ -725,8 +856,23 @@ func (c *Kinesis) EnableEnhancedMonitoringRequest(input *EnableEnhancedMonitorin // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/EnableEnhancedMonitoring func (c *Kinesis) EnableEnhancedMonitoring(input *EnableEnhancedMonitoringInput) (*EnhancedMonitoringOutput, error) { req, out := c.EnableEnhancedMonitoringRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableEnhancedMonitoringWithContext is the same as EnableEnhancedMonitoring with the addition of +// the ability to pass a context and additional request options. +// +// See EnableEnhancedMonitoring 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 *Kinesis) EnableEnhancedMonitoringWithContext(ctx aws.Context, input *EnableEnhancedMonitoringInput, opts ...request.Option) (*EnhancedMonitoringOutput, error) { + req, out := c.EnableEnhancedMonitoringRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRecords = "GetRecords" @@ -858,8 +1004,23 @@ func (c *Kinesis) GetRecordsRequest(input *GetRecordsInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/GetRecords func (c *Kinesis) GetRecords(input *GetRecordsInput) (*GetRecordsOutput, error) { req, out := c.GetRecordsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRecordsWithContext is the same as GetRecords with the addition of +// the ability to pass a context and additional request options. +// +// See GetRecords 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 *Kinesis) GetRecordsWithContext(ctx aws.Context, input *GetRecordsInput, opts ...request.Option) (*GetRecordsOutput, error) { + req, out := c.GetRecordsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetShardIterator = "GetShardIterator" @@ -973,8 +1134,23 @@ func (c *Kinesis) GetShardIteratorRequest(input *GetShardIteratorInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/GetShardIterator func (c *Kinesis) GetShardIterator(input *GetShardIteratorInput) (*GetShardIteratorOutput, error) { req, out := c.GetShardIteratorRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetShardIteratorWithContext is the same as GetShardIterator with the addition of +// the ability to pass a context and additional request options. +// +// See GetShardIterator 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 *Kinesis) GetShardIteratorWithContext(ctx aws.Context, input *GetShardIteratorInput, opts ...request.Option) (*GetShardIteratorOutput, error) { + req, out := c.GetShardIteratorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opIncreaseStreamRetentionPeriod = "IncreaseStreamRetentionPeriod" @@ -1059,8 +1235,23 @@ func (c *Kinesis) IncreaseStreamRetentionPeriodRequest(input *IncreaseStreamRete // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/IncreaseStreamRetentionPeriod func (c *Kinesis) IncreaseStreamRetentionPeriod(input *IncreaseStreamRetentionPeriodInput) (*IncreaseStreamRetentionPeriodOutput, error) { req, out := c.IncreaseStreamRetentionPeriodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// IncreaseStreamRetentionPeriodWithContext is the same as IncreaseStreamRetentionPeriod with the addition of +// the ability to pass a context and additional request options. +// +// See IncreaseStreamRetentionPeriod 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 *Kinesis) IncreaseStreamRetentionPeriodWithContext(ctx aws.Context, input *IncreaseStreamRetentionPeriodInput, opts ...request.Option) (*IncreaseStreamRetentionPeriodOutput, error) { + req, out := c.IncreaseStreamRetentionPeriodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListStreams = "ListStreams" @@ -1146,8 +1337,23 @@ func (c *Kinesis) ListStreamsRequest(input *ListStreamsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/ListStreams func (c *Kinesis) ListStreams(input *ListStreamsInput) (*ListStreamsOutput, error) { req, out := c.ListStreamsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListStreamsWithContext is the same as ListStreams with the addition of +// the ability to pass a context and additional request options. +// +// See ListStreams 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 *Kinesis) ListStreamsWithContext(ctx aws.Context, input *ListStreamsInput, opts ...request.Option) (*ListStreamsOutput, error) { + req, out := c.ListStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListStreamsPages iterates over the pages of a ListStreams operation, @@ -1167,12 +1373,37 @@ func (c *Kinesis) ListStreams(input *ListStreamsInput) (*ListStreamsOutput, erro // return pageNum <= 3 // }) // -func (c *Kinesis) ListStreamsPages(input *ListStreamsInput, fn func(p *ListStreamsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListStreamsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListStreamsOutput), lastPage) - }) +func (c *Kinesis) ListStreamsPages(input *ListStreamsInput, fn func(*ListStreamsOutput, bool) bool) error { + return c.ListStreamsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListStreamsPagesWithContext same as ListStreamsPages 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 *Kinesis) ListStreamsPagesWithContext(ctx aws.Context, input *ListStreamsInput, fn func(*ListStreamsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListStreamsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListStreamsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListStreamsOutput), !p.HasNextPage()) + } + return p.Err() } const opListTagsForStream = "ListTagsForStream" @@ -1245,8 +1476,23 @@ func (c *Kinesis) ListTagsForStreamRequest(input *ListTagsForStreamInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/ListTagsForStream func (c *Kinesis) ListTagsForStream(input *ListTagsForStreamInput) (*ListTagsForStreamOutput, error) { req, out := c.ListTagsForStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForStreamWithContext is the same as ListTagsForStream with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForStream 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 *Kinesis) ListTagsForStreamWithContext(ctx aws.Context, input *ListTagsForStreamInput, opts ...request.Option) (*ListTagsForStreamOutput, error) { + req, out := c.ListTagsForStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opMergeShards = "MergeShards" @@ -1360,8 +1606,23 @@ func (c *Kinesis) MergeShardsRequest(input *MergeShardsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/MergeShards func (c *Kinesis) MergeShards(input *MergeShardsInput) (*MergeShardsOutput, error) { req, out := c.MergeShardsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// MergeShardsWithContext is the same as MergeShards with the addition of +// the ability to pass a context and additional request options. +// +// See MergeShards 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 *Kinesis) MergeShardsWithContext(ctx aws.Context, input *MergeShardsInput, opts ...request.Option) (*MergeShardsOutput, error) { + req, out := c.MergeShardsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRecord = "PutRecord" @@ -1475,8 +1736,23 @@ func (c *Kinesis) PutRecordRequest(input *PutRecordInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/PutRecord func (c *Kinesis) PutRecord(input *PutRecordInput) (*PutRecordOutput, error) { req, out := c.PutRecordRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRecordWithContext is the same as PutRecord with the addition of +// the ability to pass a context and additional request options. +// +// See PutRecord 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 *Kinesis) PutRecordWithContext(ctx aws.Context, input *PutRecordInput, opts ...request.Option) (*PutRecordOutput, error) { + req, out := c.PutRecordRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutRecords = "PutRecords" @@ -1612,8 +1888,23 @@ func (c *Kinesis) PutRecordsRequest(input *PutRecordsInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/PutRecords func (c *Kinesis) PutRecords(input *PutRecordsInput) (*PutRecordsOutput, error) { req, out := c.PutRecordsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutRecordsWithContext is the same as PutRecords with the addition of +// the ability to pass a context and additional request options. +// +// See PutRecords 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 *Kinesis) PutRecordsWithContext(ctx aws.Context, input *PutRecordsInput, opts ...request.Option) (*PutRecordsOutput, error) { + req, out := c.PutRecordsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromStream = "RemoveTagsFromStream" @@ -1695,8 +1986,23 @@ func (c *Kinesis) RemoveTagsFromStreamRequest(input *RemoveTagsFromStreamInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/RemoveTagsFromStream func (c *Kinesis) RemoveTagsFromStream(input *RemoveTagsFromStreamInput) (*RemoveTagsFromStreamOutput, error) { req, out := c.RemoveTagsFromStreamRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromStreamWithContext is the same as RemoveTagsFromStream with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromStream 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 *Kinesis) RemoveTagsFromStreamWithContext(ctx aws.Context, input *RemoveTagsFromStreamInput, opts ...request.Option) (*RemoveTagsFromStreamOutput, error) { + req, out := c.RemoveTagsFromStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSplitShard = "SplitShard" @@ -1819,8 +2125,23 @@ func (c *Kinesis) SplitShardRequest(input *SplitShardInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/SplitShard func (c *Kinesis) SplitShard(input *SplitShardInput) (*SplitShardOutput, error) { req, out := c.SplitShardRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SplitShardWithContext is the same as SplitShard with the addition of +// the ability to pass a context and additional request options. +// +// See SplitShard 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 *Kinesis) SplitShardWithContext(ctx aws.Context, input *SplitShardInput, opts ...request.Option) (*SplitShardOutput, error) { + req, out := c.SplitShardRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateShardCount = "UpdateShardCount" @@ -1918,8 +2239,23 @@ func (c *Kinesis) UpdateShardCountRequest(input *UpdateShardCountInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/kinesis-2013-12-02/UpdateShardCount func (c *Kinesis) UpdateShardCount(input *UpdateShardCountInput) (*UpdateShardCountOutput, error) { req, out := c.UpdateShardCountRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateShardCountWithContext is the same as UpdateShardCount with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateShardCount 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 *Kinesis) UpdateShardCountWithContext(ctx aws.Context, input *UpdateShardCountInput, opts ...request.Option) (*UpdateShardCountOutput, error) { + req, out := c.UpdateShardCountRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Represents the input for AddTagsToStream. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations.go new file mode 100644 index 0000000000..f618f0da69 --- /dev/null +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/customizations.go @@ -0,0 +1,22 @@ +package kinesis + +import ( + "time" + + "github.com/aws/aws-sdk-go/aws/request" +) + +var readDuration = 5 * time.Second + +func init() { + ops := []string{ + opGetRecords, + } + initRequest = func(r *request.Request) { + for _, operation := range ops { + if r.Operation.Name == operation { + r.ApplyOptions(request.WithResponseReadTimeout(readDuration)) + } + } + } +} diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/errors.go index 083aa5e0f2..9c9beafe37 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package kinesis diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go index ed037fe6e3..212a54c778 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package kinesis diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/waiters.go index c1f56d6c16..14e2ba9e2f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kinesis/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package kinesis import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilStreamExists uses the Kinesis API operation @@ -11,24 +14,43 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *Kinesis) WaitUntilStreamExists(input *DescribeStreamInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeStream", - Delay: 10, + return c.WaitUntilStreamExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStreamExistsWithContext is an extended version of WaitUntilStreamExists. +// 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 *Kinesis) WaitUntilStreamExistsWithContext(ctx aws.Context, input *DescribeStreamInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilStreamExists", MaxAttempts: 18, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(10 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "StreamDescription.StreamStatus", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "StreamDescription.StreamStatus", Expected: "ACTIVE", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeStreamInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeStreamRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kms/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kms/api.go index afd375b1cf..82ef661204 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/kms/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kms/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package kms provides a client for AWS Key Management Service. package kms @@ -7,6 +7,7 @@ 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" @@ -100,8 +101,23 @@ func (c *KMS) CancelKeyDeletionRequest(input *CancelKeyDeletionInput) (req *requ // Please also see 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) - err := req.Send() - return out, err + 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 opCreateAlias = "CreateAlias" @@ -207,8 +223,23 @@ func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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 opCreateGrant = "CreateGrant" @@ -307,8 +338,23 @@ func (c *KMS) CreateGrantRequest(input *CreateGrantInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -406,8 +452,23 @@ func (c *KMS) CreateKeyRequest(input *CreateKeyInput) (req *request.Request, out // Please also see 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) - err := req.Send() - return out, err + 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" @@ -518,8 +579,23 @@ func (c *KMS) DecryptRequest(input *DecryptInput) (req *request.Request, output // Please also see 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) - err := req.Send() - return out, err + 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" @@ -602,8 +678,23 @@ func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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 opDeleteImportedKeyMaterial = "DeleteImportedKeyMaterial" @@ -702,8 +793,23 @@ func (c *KMS) DeleteImportedKeyMaterialRequest(input *DeleteImportedKeyMaterialI // Please also see 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) - err := req.Send() - return out, err + 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 opDescribeKey = "DescribeKey" @@ -779,8 +885,23 @@ func (c *KMS) DescribeKeyRequest(input *DescribeKeyInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -870,8 +991,23 @@ func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *request.Request, o // Please also see 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) - err := req.Send() - return out, err + 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" @@ -964,8 +1100,23 @@ func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *re // Please also see 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) - err := req.Send() - return out, err + 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 opEnableKey = "EnableKey" @@ -1056,8 +1207,23 @@ func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *request.Request, out // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1150,8 +1316,23 @@ func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *requ // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1264,8 +1445,23 @@ func (c *KMS) EncryptRequest(input *EncryptInput) (req *request.Request, output // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1402,8 +1598,23 @@ func (c *KMS) GenerateDataKeyRequest(input *GenerateDataKeyInput) (req *request. // Please also see 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) - err := req.Send() - return out, err + 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 opGenerateDataKeyWithoutPlaintext = "GenerateDataKeyWithoutPlaintext" @@ -1511,8 +1722,23 @@ func (c *KMS) GenerateDataKeyWithoutPlaintextRequest(input *GenerateDataKeyWitho // Please also see 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) - err := req.Send() - return out, err + 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 opGenerateRandom = "GenerateRandom" @@ -1581,8 +1807,23 @@ func (c *KMS) GenerateRandomRequest(input *GenerateRandomInput) (req *request.Re // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1666,8 +1907,23 @@ func (c *KMS) GetKeyPolicyRequest(input *GetKeyPolicyInput) (req *request.Reques // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1756,8 +2012,23 @@ func (c *KMS) GetKeyRotationStatusRequest(input *GetKeyRotationStatusInput) (req // Please also see 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) - err := req.Send() - return out, err + 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" @@ -1860,8 +2131,23 @@ func (c *KMS) GetParametersForImportRequest(input *GetParametersForImportInput) // Please also see 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) - err := req.Send() - return out, err + 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 opImportKeyMaterial = "ImportKeyMaterial" @@ -1988,8 +2274,23 @@ func (c *KMS) ImportKeyMaterialRequest(input *ImportKeyMaterialInput) (req *requ // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2068,8 +2369,23 @@ func (c *KMS) ListAliasesRequest(input *ListAliasesInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2089,12 +2405,37 @@ func (c *KMS) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error) { // return pageNum <= 3 // }) // -func (c *KMS) ListAliasesPages(input *ListAliasesInput, fn func(p *ListAliasesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListAliasesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListAliasesOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListAliasesOutput), !p.HasNextPage()) + } + return p.Err() } const opListGrants = "ListGrants" @@ -2188,8 +2529,23 @@ func (c *KMS) ListGrantsRequest(input *ListGrantsInput) (req *request.Request, o // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2209,12 +2565,37 @@ func (c *KMS) ListGrants(input *ListGrantsInput) (*ListGrantsResponse, error) { // return pageNum <= 3 // }) // -func (c *KMS) ListGrantsPages(input *ListGrantsInput, fn func(p *ListGrantsResponse, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListGrantsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListGrantsResponse), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListGrantsResponse), !p.HasNextPage()) + } + return p.Err() } const opListKeyPolicies = "ListKeyPolicies" @@ -2304,8 +2685,23 @@ func (c *KMS) ListKeyPoliciesRequest(input *ListKeyPoliciesInput) (req *request. // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2325,12 +2721,37 @@ func (c *KMS) ListKeyPolicies(input *ListKeyPoliciesInput) (*ListKeyPoliciesOutp // return pageNum <= 3 // }) // -func (c *KMS) ListKeyPoliciesPages(input *ListKeyPoliciesInput, fn func(p *ListKeyPoliciesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListKeyPoliciesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListKeyPoliciesOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListKeyPoliciesOutput), !p.HasNextPage()) + } + return p.Err() } const opListKeys = "ListKeys" @@ -2409,8 +2830,23 @@ func (c *KMS) ListKeysRequest(input *ListKeysInput) (req *request.Request, outpu // Please also see 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) - err := req.Send() - return out, err + 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, @@ -2430,12 +2866,37 @@ func (c *KMS) ListKeys(input *ListKeysInput) (*ListKeysOutput, error) { // return pageNum <= 3 // }) // -func (c *KMS) ListKeysPages(input *ListKeysInput, fn func(p *ListKeysOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListKeysRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListKeysOutput), lastPage) - }) +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 + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListKeysOutput), !p.HasNextPage()) + } + return p.Err() } const opListResourceTags = "ListResourceTags" @@ -2511,8 +2972,23 @@ func (c *KMS) ListResourceTagsRequest(input *ListResourceTagsInput) (req *reques // Please also see 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) - err := req.Send() - return out, err + 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() } const opListRetirableGrants = "ListRetirableGrants" @@ -2596,8 +3072,23 @@ func (c *KMS) ListRetirableGrantsRequest(input *ListRetirableGrantsInput) (req * // Please also see 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) - err := req.Send() - return out, err + 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() } const opPutKeyPolicy = "PutKeyPolicy" @@ -2699,8 +3190,23 @@ func (c *KMS) PutKeyPolicyRequest(input *PutKeyPolicyInput) (req *request.Reques // Please also see 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) - err := req.Send() - return out, err + 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" @@ -2809,8 +3315,23 @@ func (c *KMS) ReEncryptRequest(input *ReEncryptInput) (req *request.Request, out // Please also see 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) - err := req.Send() - return out, err + 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 opRetireGrant = "RetireGrant" @@ -2914,8 +3435,23 @@ func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3005,8 +3541,23 @@ func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3105,8 +3656,23 @@ func (c *KMS) ScheduleKeyDeletionRequest(input *ScheduleKeyDeletionInput) (req * // Please also see 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) - err := req.Send() - return out, err + 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 opTagResource = "TagResource" @@ -3206,8 +3772,23 @@ func (c *KMS) TagResourceRequest(input *TagResourceInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3297,8 +3878,23 @@ func (c *KMS) UntagResourceRequest(input *UntagResourceInput) (req *request.Requ // Please also see 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) - err := req.Send() - return out, err + 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" @@ -3393,8 +3989,23 @@ func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Request, // Please also see 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) - err := req.Send() - return out, err + 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 opUpdateKeyDescription = "UpdateKeyDescription" @@ -3480,8 +4091,23 @@ func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req // Please also see 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) - err := req.Send() - return out, err + 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() } // Contains information about an alias. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kms/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kms/errors.go index 474ae6baff..0358c94437 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/kms/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kms/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package kms diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/kms/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/kms/service.go index b4688cad32..10aeb248f2 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/kms/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/kms/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package kms diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go index 4a215f4eb0..2189b20a32 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package lambda provides a client for AWS Lambda. package lambda @@ -7,6 +7,7 @@ import ( "io" "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" @@ -102,8 +103,23 @@ func (c *Lambda) AddPermissionRequest(input *AddPermissionInput) (req *request.R // func (c *Lambda) AddPermission(input *AddPermissionInput) (*AddPermissionOutput, error) { req, out := c.AddPermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddPermissionWithContext is the same as AddPermission with the addition of +// the ability to pass a context and additional request options. +// +// See AddPermission 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 *Lambda) AddPermissionWithContext(ctx aws.Context, input *AddPermissionInput, opts ...request.Option) (*AddPermissionOutput, error) { + req, out := c.AddPermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAlias = "CreateAlias" @@ -182,8 +198,23 @@ func (c *Lambda) CreateAliasRequest(input *CreateAliasInput) (req *request.Reque // func (c *Lambda) CreateAlias(input *CreateAliasInput) (*AliasConfiguration, error) { req, out := c.CreateAliasRequest(input) - err := req.Send() - return out, err + 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 *Lambda) CreateAliasWithContext(ctx aws.Context, input *CreateAliasInput, opts ...request.Option) (*AliasConfiguration, error) { + req, out := c.CreateAliasRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateEventSourceMapping = "CreateEventSourceMapping" @@ -282,8 +313,23 @@ func (c *Lambda) CreateEventSourceMappingRequest(input *CreateEventSourceMapping // func (c *Lambda) CreateEventSourceMapping(input *CreateEventSourceMappingInput) (*EventSourceMappingConfiguration, error) { req, out := c.CreateEventSourceMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateEventSourceMappingWithContext is the same as CreateEventSourceMapping with the addition of +// the ability to pass a context and additional request options. +// +// See CreateEventSourceMapping 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 *Lambda) CreateEventSourceMappingWithContext(ctx aws.Context, input *CreateEventSourceMappingInput, opts ...request.Option) (*EventSourceMappingConfiguration, error) { + req, out := c.CreateEventSourceMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateFunction = "CreateFunction" @@ -370,8 +416,23 @@ func (c *Lambda) CreateFunctionRequest(input *CreateFunctionInput) (req *request // func (c *Lambda) CreateFunction(input *CreateFunctionInput) (*FunctionConfiguration, error) { req, out := c.CreateFunctionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateFunctionWithContext is the same as CreateFunction with the addition of +// the ability to pass a context and additional request options. +// +// See CreateFunction 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 *Lambda) CreateFunctionWithContext(ctx aws.Context, input *CreateFunctionInput, opts ...request.Option) (*FunctionConfiguration, error) { + req, out := c.CreateFunctionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAlias = "DeleteAlias" @@ -444,8 +505,23 @@ func (c *Lambda) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Reque // func (c *Lambda) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error) { req, out := c.DeleteAliasRequest(input) - err := req.Send() - return out, err + 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 *Lambda) 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 opDeleteEventSourceMapping = "DeleteEventSourceMapping" @@ -521,8 +597,23 @@ func (c *Lambda) DeleteEventSourceMappingRequest(input *DeleteEventSourceMapping // func (c *Lambda) DeleteEventSourceMapping(input *DeleteEventSourceMappingInput) (*EventSourceMappingConfiguration, error) { req, out := c.DeleteEventSourceMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEventSourceMappingWithContext is the same as DeleteEventSourceMapping with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEventSourceMapping 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 *Lambda) DeleteEventSourceMappingWithContext(ctx aws.Context, input *DeleteEventSourceMappingInput, opts ...request.Option) (*EventSourceMappingConfiguration, error) { + req, out := c.DeleteEventSourceMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteFunction = "DeleteFunction" @@ -611,8 +702,23 @@ func (c *Lambda) DeleteFunctionRequest(input *DeleteFunctionInput) (req *request // func (c *Lambda) DeleteFunction(input *DeleteFunctionInput) (*DeleteFunctionOutput, error) { req, out := c.DeleteFunctionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteFunctionWithContext is the same as DeleteFunction with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteFunction 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 *Lambda) DeleteFunctionWithContext(ctx aws.Context, input *DeleteFunctionInput, opts ...request.Option) (*DeleteFunctionOutput, error) { + req, out := c.DeleteFunctionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAccountSettings = "GetAccountSettings" @@ -681,8 +787,23 @@ func (c *Lambda) GetAccountSettingsRequest(input *GetAccountSettingsInput) (req // func (c *Lambda) GetAccountSettings(input *GetAccountSettingsInput) (*GetAccountSettingsOutput, error) { req, out := c.GetAccountSettingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAccountSettingsWithContext is the same as GetAccountSettings with the addition of +// the ability to pass a context and additional request options. +// +// See GetAccountSettings 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 *Lambda) GetAccountSettingsWithContext(ctx aws.Context, input *GetAccountSettingsInput, opts ...request.Option) (*GetAccountSettingsOutput, error) { + req, out := c.GetAccountSettingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAlias = "GetAlias" @@ -758,8 +879,23 @@ func (c *Lambda) GetAliasRequest(input *GetAliasInput) (req *request.Request, ou // func (c *Lambda) GetAlias(input *GetAliasInput) (*AliasConfiguration, error) { req, out := c.GetAliasRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAliasWithContext is the same as GetAlias with the addition of +// the ability to pass a context and additional request options. +// +// See GetAlias 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 *Lambda) GetAliasWithContext(ctx aws.Context, input *GetAliasInput, opts ...request.Option) (*AliasConfiguration, error) { + req, out := c.GetAliasRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetEventSourceMapping = "GetEventSourceMapping" @@ -834,8 +970,23 @@ func (c *Lambda) GetEventSourceMappingRequest(input *GetEventSourceMappingInput) // func (c *Lambda) GetEventSourceMapping(input *GetEventSourceMappingInput) (*EventSourceMappingConfiguration, error) { req, out := c.GetEventSourceMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetEventSourceMappingWithContext is the same as GetEventSourceMapping with the addition of +// the ability to pass a context and additional request options. +// +// See GetEventSourceMapping 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 *Lambda) GetEventSourceMappingWithContext(ctx aws.Context, input *GetEventSourceMappingInput, opts ...request.Option) (*EventSourceMappingConfiguration, error) { + req, out := c.GetEventSourceMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetFunction = "GetFunction" @@ -919,8 +1070,23 @@ func (c *Lambda) GetFunctionRequest(input *GetFunctionInput) (req *request.Reque // func (c *Lambda) GetFunction(input *GetFunctionInput) (*GetFunctionOutput, error) { req, out := c.GetFunctionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetFunctionWithContext is the same as GetFunction with the addition of +// the ability to pass a context and additional request options. +// +// See GetFunction 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 *Lambda) GetFunctionWithContext(ctx aws.Context, input *GetFunctionInput, opts ...request.Option) (*GetFunctionOutput, error) { + req, out := c.GetFunctionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetFunctionConfiguration = "GetFunctionConfiguration" @@ -1004,8 +1170,23 @@ func (c *Lambda) GetFunctionConfigurationRequest(input *GetFunctionConfiguration // func (c *Lambda) GetFunctionConfiguration(input *GetFunctionConfigurationInput) (*FunctionConfiguration, error) { req, out := c.GetFunctionConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetFunctionConfigurationWithContext is the same as GetFunctionConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See GetFunctionConfiguration 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 *Lambda) GetFunctionConfigurationWithContext(ctx aws.Context, input *GetFunctionConfigurationInput, opts ...request.Option) (*FunctionConfiguration, error) { + req, out := c.GetFunctionConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPolicy = "GetPolicy" @@ -1058,8 +1239,6 @@ func (c *Lambda) GetPolicyRequest(input *GetPolicyInput) (req *request.Request, // the version or alias name using the Qualifier parameter. For more information // about versioning, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). // -// For information about adding permissions, see AddPermission. -// // You need permission for the lambda:GetPolicy action. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1086,8 +1265,23 @@ func (c *Lambda) GetPolicyRequest(input *GetPolicyInput) (req *request.Request, // func (c *Lambda) GetPolicy(input *GetPolicyInput) (*GetPolicyOutput, error) { req, out := c.GetPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPolicyWithContext is the same as GetPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetPolicy 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 *Lambda) GetPolicyWithContext(ctx aws.Context, input *GetPolicyInput, opts ...request.Option) (*GetPolicyOutput, error) { + req, out := c.GetPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opInvoke = "Invoke" @@ -1225,8 +1419,23 @@ func (c *Lambda) InvokeRequest(input *InvokeInput) (req *request.Request, output // func (c *Lambda) Invoke(input *InvokeInput) (*InvokeOutput, error) { req, out := c.InvokeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// InvokeWithContext is the same as Invoke with the addition of +// the ability to pass a context and additional request options. +// +// See Invoke 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 *Lambda) InvokeWithContext(ctx aws.Context, input *InvokeInput, opts ...request.Option) (*InvokeOutput, error) { + req, out := c.InvokeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opInvokeAsync = "InvokeAsync" @@ -1303,8 +1512,23 @@ func (c *Lambda) InvokeAsyncRequest(input *InvokeAsyncInput) (req *request.Reque // func (c *Lambda) InvokeAsync(input *InvokeAsyncInput) (*InvokeAsyncOutput, error) { req, out := c.InvokeAsyncRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// InvokeAsyncWithContext is the same as InvokeAsync with the addition of +// the ability to pass a context and additional request options. +// +// See InvokeAsync 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 *Lambda) InvokeAsyncWithContext(ctx aws.Context, input *InvokeAsyncInput, opts ...request.Option) (*InvokeAsyncOutput, error) { + req, out := c.InvokeAsyncRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAliases = "ListAliases" @@ -1381,8 +1605,23 @@ func (c *Lambda) ListAliasesRequest(input *ListAliasesInput) (req *request.Reque // func (c *Lambda) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error) { req, out := c.ListAliasesRequest(input) - err := req.Send() - return out, err + 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 *Lambda) 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() } const opListEventSourceMappings = "ListEventSourceMappings" @@ -1472,8 +1711,23 @@ func (c *Lambda) ListEventSourceMappingsRequest(input *ListEventSourceMappingsIn // func (c *Lambda) ListEventSourceMappings(input *ListEventSourceMappingsInput) (*ListEventSourceMappingsOutput, error) { req, out := c.ListEventSourceMappingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListEventSourceMappingsWithContext is the same as ListEventSourceMappings with the addition of +// the ability to pass a context and additional request options. +// +// See ListEventSourceMappings 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 *Lambda) ListEventSourceMappingsWithContext(ctx aws.Context, input *ListEventSourceMappingsInput, opts ...request.Option) (*ListEventSourceMappingsOutput, error) { + req, out := c.ListEventSourceMappingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListEventSourceMappingsPages iterates over the pages of a ListEventSourceMappings operation, @@ -1493,12 +1747,37 @@ func (c *Lambda) ListEventSourceMappings(input *ListEventSourceMappingsInput) (* // return pageNum <= 3 // }) // -func (c *Lambda) ListEventSourceMappingsPages(input *ListEventSourceMappingsInput, fn func(p *ListEventSourceMappingsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListEventSourceMappingsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListEventSourceMappingsOutput), lastPage) - }) +func (c *Lambda) ListEventSourceMappingsPages(input *ListEventSourceMappingsInput, fn func(*ListEventSourceMappingsOutput, bool) bool) error { + return c.ListEventSourceMappingsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListEventSourceMappingsPagesWithContext same as ListEventSourceMappingsPages 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 *Lambda) ListEventSourceMappingsPagesWithContext(ctx aws.Context, input *ListEventSourceMappingsInput, fn func(*ListEventSourceMappingsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListEventSourceMappingsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListEventSourceMappingsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListEventSourceMappingsOutput), !p.HasNextPage()) + } + return p.Err() } const opListFunctions = "ListFunctions" @@ -1575,8 +1854,23 @@ func (c *Lambda) ListFunctionsRequest(input *ListFunctionsInput) (req *request.R // func (c *Lambda) ListFunctions(input *ListFunctionsInput) (*ListFunctionsOutput, error) { req, out := c.ListFunctionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListFunctionsWithContext is the same as ListFunctions with the addition of +// the ability to pass a context and additional request options. +// +// See ListFunctions 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 *Lambda) ListFunctionsWithContext(ctx aws.Context, input *ListFunctionsInput, opts ...request.Option) (*ListFunctionsOutput, error) { + req, out := c.ListFunctionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListFunctionsPages iterates over the pages of a ListFunctions operation, @@ -1596,12 +1890,126 @@ func (c *Lambda) ListFunctions(input *ListFunctionsInput) (*ListFunctionsOutput, // return pageNum <= 3 // }) // -func (c *Lambda) ListFunctionsPages(input *ListFunctionsInput, fn func(p *ListFunctionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListFunctionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListFunctionsOutput), lastPage) - }) +func (c *Lambda) ListFunctionsPages(input *ListFunctionsInput, fn func(*ListFunctionsOutput, bool) bool) error { + return c.ListFunctionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListFunctionsPagesWithContext same as ListFunctionsPages 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 *Lambda) ListFunctionsPagesWithContext(ctx aws.Context, input *ListFunctionsInput, fn func(*ListFunctionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListFunctionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListFunctionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListFunctionsOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListTags = "ListTags" + +// ListTagsRequest generates a "aws/request.Request" representing the +// client's request for the ListTags operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListTags for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListTags method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListTagsRequest method. +// req, resp := client.ListTagsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +func (c *Lambda) ListTagsRequest(input *ListTagsInput) (req *request.Request, output *ListTagsOutput) { + op := &request.Operation{ + Name: opListTags, + HTTPMethod: "GET", + HTTPPath: "/2017-03-31/tags/{ARN}", + } + + if input == nil { + input = &ListTagsInput{} + } + + output = &ListTagsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTags API operation for AWS Lambda. +// +// Returns a list of tags assigned to a function when supplied the function +// ARN (Amazon Resource Name). +// +// 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 Lambda's +// API operation ListTags for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// The AWS Lambda service encountered an internal error. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The resource (for example, a Lambda function or access policy statement) +// specified in the request does not exist. +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValueException" +// One of the parameters in the request is invalid. For example, if you provided +// an IAM role for AWS Lambda to assume in the CreateFunction or the UpdateFunctionConfiguration +// API, that AWS Lambda is unable to assume you will get this exception. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +func (c *Lambda) ListTags(input *ListTagsInput) (*ListTagsOutput, error) { + req, out := c.ListTagsRequest(input) + return out, req.Send() +} + +// ListTagsWithContext is the same as ListTags with the addition of +// the ability to pass a context and additional request options. +// +// See ListTags 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 *Lambda) ListTagsWithContext(ctx aws.Context, input *ListTagsInput, opts ...request.Option) (*ListTagsOutput, error) { + req, out := c.ListTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListVersionsByFunction = "ListVersionsByFunction" @@ -1674,8 +2082,23 @@ func (c *Lambda) ListVersionsByFunctionRequest(input *ListVersionsByFunctionInpu // func (c *Lambda) ListVersionsByFunction(input *ListVersionsByFunctionInput) (*ListVersionsByFunctionOutput, error) { req, out := c.ListVersionsByFunctionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListVersionsByFunctionWithContext is the same as ListVersionsByFunction with the addition of +// the ability to pass a context and additional request options. +// +// See ListVersionsByFunction 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 *Lambda) ListVersionsByFunctionWithContext(ctx aws.Context, input *ListVersionsByFunctionInput, opts ...request.Option) (*ListVersionsByFunctionOutput, error) { + req, out := c.ListVersionsByFunctionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPublishVersion = "PublishVersion" @@ -1754,8 +2177,23 @@ func (c *Lambda) PublishVersionRequest(input *PublishVersionInput) (req *request // func (c *Lambda) PublishVersion(input *PublishVersionInput) (*FunctionConfiguration, error) { req, out := c.PublishVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PublishVersionWithContext is the same as PublishVersion with the addition of +// the ability to pass a context and additional request options. +// +// See PublishVersion 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 *Lambda) PublishVersionWithContext(ctx aws.Context, input *PublishVersionInput, opts ...request.Option) (*FunctionConfiguration, error) { + req, out := c.PublishVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemovePermission = "RemovePermission" @@ -1841,8 +2279,206 @@ func (c *Lambda) RemovePermissionRequest(input *RemovePermissionInput) (req *req // func (c *Lambda) RemovePermission(input *RemovePermissionInput) (*RemovePermissionOutput, error) { req, out := c.RemovePermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemovePermissionWithContext is the same as RemovePermission with the addition of +// the ability to pass a context and additional request options. +// +// See RemovePermission 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 *Lambda) RemovePermissionWithContext(ctx aws.Context, input *RemovePermissionInput, opts ...request.Option) (*RemovePermissionOutput, error) { + req, out := c.RemovePermissionRequest(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 can be used to capture response data after the request's "Send" method +// is called. +// +// See TagResource for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the TagResource method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // 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) +// } +func (c *Lambda) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/2017-03-31/tags/{ARN}", + } + + if input == nil { + input = &TagResourceInput{} + } + + output = &TagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagResource API operation for AWS Lambda. +// +// Creates a list of tags (key-value pairs) on the Lambda function. Requires +// the Lambda function ARN (Amazon Resource Name). If a key is specified without +// a value, Lambda creates a tag with the specified key and a value of null. +// +// 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 Lambda's +// API operation TagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// The AWS Lambda service encountered an internal error. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The resource (for example, a Lambda function or access policy statement) +// specified in the request does not exist. +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValueException" +// One of the parameters in the request is invalid. For example, if you provided +// an IAM role for AWS Lambda to assume in the CreateFunction or the UpdateFunctionConfiguration +// API, that AWS Lambda is unable to assume you will get this exception. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +func (c *Lambda) 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 *Lambda) 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 can be used to capture response data after the request's "Send" method +// is called. +// +// See UntagResource for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the UntagResource method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // 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) +// } +func (c *Lambda) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "DELETE", + HTTPPath: "/2017-03-31/tags/{ARN}", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output = &UntagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagResource API operation for AWS Lambda. +// +// Removes tags from a Lambda function. Requires the function ARN (Amazon Resource +// Name). +// +// 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 Lambda's +// API operation UntagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// The AWS Lambda service encountered an internal error. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The resource (for example, a Lambda function or access policy statement) +// specified in the request does not exist. +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValueException" +// One of the parameters in the request is invalid. For example, if you provided +// an IAM role for AWS Lambda to assume in the CreateFunction or the UpdateFunctionConfiguration +// API, that AWS Lambda is unable to assume you will get this exception. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// +func (c *Lambda) 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 *Lambda) 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" @@ -1918,8 +2554,23 @@ func (c *Lambda) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Reque // func (c *Lambda) UpdateAlias(input *UpdateAliasInput) (*AliasConfiguration, error) { req, out := c.UpdateAliasRequest(input) - err := req.Send() - return out, err + 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 *Lambda) UpdateAliasWithContext(ctx aws.Context, input *UpdateAliasInput, opts ...request.Option) (*AliasConfiguration, error) { + req, out := c.UpdateAliasRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateEventSourceMapping = "UpdateEventSourceMapping" @@ -2010,8 +2661,23 @@ func (c *Lambda) UpdateEventSourceMappingRequest(input *UpdateEventSourceMapping // func (c *Lambda) UpdateEventSourceMapping(input *UpdateEventSourceMappingInput) (*EventSourceMappingConfiguration, error) { req, out := c.UpdateEventSourceMappingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateEventSourceMappingWithContext is the same as UpdateEventSourceMapping with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateEventSourceMapping 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 *Lambda) UpdateEventSourceMappingWithContext(ctx aws.Context, input *UpdateEventSourceMappingInput, opts ...request.Option) (*EventSourceMappingConfiguration, error) { + req, out := c.UpdateEventSourceMappingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateFunctionCode = "UpdateFunctionCode" @@ -2094,8 +2760,23 @@ func (c *Lambda) UpdateFunctionCodeRequest(input *UpdateFunctionCodeInput) (req // func (c *Lambda) UpdateFunctionCode(input *UpdateFunctionCodeInput) (*FunctionConfiguration, error) { req, out := c.UpdateFunctionCodeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateFunctionCodeWithContext is the same as UpdateFunctionCode with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateFunctionCode 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 *Lambda) UpdateFunctionCodeWithContext(ctx aws.Context, input *UpdateFunctionCodeInput, opts ...request.Option) (*FunctionConfiguration, error) { + req, out := c.UpdateFunctionCodeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateFunctionConfiguration = "UpdateFunctionConfiguration" @@ -2177,8 +2858,23 @@ func (c *Lambda) UpdateFunctionConfigurationRequest(input *UpdateFunctionConfigu // func (c *Lambda) UpdateFunctionConfiguration(input *UpdateFunctionConfigurationInput) (*FunctionConfiguration, error) { req, out := c.UpdateFunctionConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateFunctionConfigurationWithContext is the same as UpdateFunctionConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateFunctionConfiguration 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 *Lambda) UpdateFunctionConfigurationWithContext(ctx aws.Context, input *UpdateFunctionConfigurationInput, opts ...request.Option) (*FunctionConfiguration, error) { + req, out := c.UpdateFunctionConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Provides limits of code size and concurrency associated with the current @@ -2201,8 +2897,8 @@ type AccountLimit struct { // The default limit is 100. ConcurrentExecutions *int64 `type:"integer"` - // Maximum size, in megabytes, of a code package you can upload per region. - // The default size is 75 GB. + // Maximum size, in bytes, of a code package you can upload per region. The + // default size is 75 GB. TotalCodeSize *int64 `type:"long"` } @@ -2296,7 +2992,7 @@ type AddPermissionInput struct { // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -2330,24 +3026,23 @@ type AddPermissionInput struct { // arn:aws:lambda:aws-region:acct-id:function:function-name Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` - // This parameter is used for S3, SES, CloudWatch Logs and CloudWatch Rules - // only. The AWS account ID (without a hyphen) of the source owner. For example, - // if the SourceArn identifies a bucket, then this is the bucket owner's account - // ID. You can use this additional condition to ensure the bucket you specify - // is owned by a specific account (it is possible the bucket owner deleted the - // bucket and some other AWS account created the bucket). You can also use this - // condition to specify all sources (that is, you don't specify the SourceArn) - // owned by a specific account. + // This parameter is used for S3 and SES. The AWS account ID (without a hyphen) + // of the source owner. For example, if the SourceArn identifies a bucket, then + // this is the bucket owner's account ID. You can use this additional condition + // to ensure the bucket you specify is owned by a specific account (it is possible + // the bucket owner deleted the bucket and some other AWS account created the + // bucket). You can also use this condition to specify all sources (that is, + // you don't specify the SourceArn) owned by a specific account. SourceAccount *string `type:"string"` - // This is optional; however, when granting Amazon S3 permission to invoke your + // This is optional; however, when granting a source permission to invoke your // function, you should specify this field with the Amazon Resource Name (ARN) // as its value. This ensures that only events generated from the specified // source can invoke the function. // - // If you add a permission for the Amazon S3 principal without providing the - // source ARN, any AWS account that creates a mapping to your function ARN can - // send events to invoke your Lambda function from Amazon S3. + // If you add a permission for the source without providing the source ARN, + // any AWS account that creates a mapping to your function ARN can send events + // to invoke your Lambda function from that source. SourceArn *string `type:"string"` // A unique statement identifier. @@ -2529,7 +3224,9 @@ type CreateAliasInput struct { // Description of the alias. Description *string `type:"string"` - // Name of the Lambda function for which you want to create an alias. + // Name of the Lambda function for which you want to create an alias. Note that + // the length constraint applies only to the ARN. If you specify only the function + // name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -2642,7 +3339,7 @@ type CreateEventSourceMappingInput struct { // ID qualifier (for example, account-id:Thumbnail). // // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `min:"1" type:"string" required:"true"` @@ -2756,7 +3453,8 @@ type CreateFunctionInput struct { // The name you want to assign to the function you are uploading. The function // names appear in the console and are returned in the ListFunctions API. Function // names are used to specify functions to other AWS Lambda API operations, such - // as Invoke. + // as Invoke. Note that the length constraint applies only to the ARN. If you + // specify only the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `min:"1" type:"string" required:"true"` @@ -2795,17 +3493,22 @@ type CreateFunctionInput struct { // The runtime environment for the Lambda function you are uploading. // - // To use the Node.js runtime v4.3, set the value to "nodejs4.3". To use earlier - // runtime (v0.10.42), set the value to "nodejs". + // To use the Python runtime v3.6, set the value to "python3.6". To use the + // Python runtime v2.7, set the value to "python2.7". To use the Node.js runtime + // v6.10, set the value to "nodejs6.10". To use the Node.js runtime v4.3, set + // the value to "nodejs4.3". // // You can no longer create functions using the v0.10.42 runtime version as // of November, 2016. Existing functions will be supported until early 2017, - // but we recommend you migrate them to nodejs4.3 runtime version as soon as - // possible. + // but we recommend you migrate them to either nodejs6.10 or nodejs4.3 runtime + // version as soon as possible. // // Runtime is a required field Runtime *string `type:"string" required:"true" enum:"Runtime"` + // The list of tags (key-value pairs) assigned to the new function. + Tags map[string]*string `type:"map"` + // The function execution time at which Lambda should terminate the function. // Because the execution time has cost implications, we recommend you set this // value based on your expected execution time. The default is 3 seconds. @@ -2933,6 +3636,12 @@ func (s *CreateFunctionInput) SetRuntime(v string) *CreateFunctionInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateFunctionInput) SetTags(v map[string]*string) *CreateFunctionInput { + s.Tags = v + return s +} + // SetTimeout sets the Timeout field's value. func (s *CreateFunctionInput) SetTimeout(v int64) *CreateFunctionInput { s.Timeout = &v @@ -2975,7 +3684,9 @@ type DeleteAliasInput struct { _ struct{} `type:"structure"` // The Lambda function name for which the alias is created. Deleting an alias - // does not delete the function version to which it is pointing. + // does not delete the function version to which it is pointing. Note that the + // length constraint applies only to the ARN. If you specify only the function + // name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -3094,7 +3805,7 @@ type DeleteFunctionInput struct { // Lambda also allows you to specify only the function name with the account // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint // applies only to the ARN. If you specify only the function name, it is limited - // to 64 character in length. + // to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -3493,7 +4204,9 @@ type FunctionConfiguration struct { // The Amazon Resource Name (ARN) assigned to the function. FunctionArn *string `type:"string"` - // The name of the function. + // The name of the function. Note that the length constraint applies only to + // the ARN. If you specify only the function name, it is limited to 64 characters + // in length. FunctionName *string `min:"1" type:"string"` // The function Lambda calls to begin executing your function. @@ -3516,9 +4229,6 @@ type FunctionConfiguration struct { Role *string `type:"string"` // The runtime environment for the Lambda function. - // - // To use the Node.js runtime v4.3, set the value to "nodejs4.3". To use earlier - // runtime (v0.10.42), set the value to "nodejs". Runtime *string `type:"string" enum:"Runtime"` // The function execution time at which Lambda should terminate the function. @@ -3692,7 +4402,9 @@ type GetAliasInput struct { // Function name for which the alias is created. An alias is a subresource that // exists only in the context of an existing Lambda function so you must specify - // the function name. + // the function name. Note that the length constraint applies only to the ARN. + // If you specify only the function name, it is limited to 64 characters in + // length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -3795,7 +4507,7 @@ type GetFunctionConfigurationInput struct { // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -3861,7 +4573,7 @@ type GetFunctionInput struct { // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -3926,6 +4638,9 @@ type GetFunctionOutput struct { // A complex type that describes function metadata. Configuration *FunctionConfiguration `type:"structure"` + + // Returns the list of tags associated with the function. + Tags map[string]*string `type:"map"` } // String returns the string representation @@ -3950,6 +4665,12 @@ func (s *GetFunctionOutput) SetConfiguration(v *FunctionConfiguration) *GetFunct return s } +// SetTags sets the Tags field's value. +func (s *GetFunctionOutput) SetTags(v map[string]*string) *GetFunctionOutput { + s.Tags = v + return s +} + type GetPolicyInput struct { _ struct{} `type:"structure"` @@ -3962,7 +4683,7 @@ type GetPolicyInput struct { // Lambda also allows you to specify only the function name with the account // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint // applies only to the ARN. If you specify only the function name, it is limited - // to 64 character in length. + // to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4043,7 +4764,9 @@ func (s *GetPolicyOutput) SetPolicy(v string) *GetPolicyOutput { type InvokeAsyncInput struct { _ struct{} `deprecated:"true" type:"structure" payload:"InvokeArgs"` - // The Lambda function name. + // The Lambda function name. Note that the length constraint applies only to + // the ARN. If you specify only the function name, it is limited to 64 characters + // in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4137,7 +4860,7 @@ type InvokeInput struct { // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4305,7 +5028,9 @@ func (s *InvokeOutput) SetStatusCode(v int64) *InvokeOutput { type ListAliasesInput struct { _ struct{} `type:"structure"` - // Lambda function name for which the alias is created. + // Lambda function name for which the alias is created. Note that the length + // constraint applies only to the ARN. If you specify only the function name, + // it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4428,7 +5153,7 @@ type ListEventSourceMappingsInput struct { // Lambda also allows you to specify only the function name with the account // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint // applies only to the ARN. If you specify only the function name, it is limited - // to 64 character in length. + // to 64 characters in length. FunctionName *string `location:"querystring" locationName:"FunctionName" min:"1" type:"string"` // Optional string. An opaque pagination token returned from a previous ListEventSourceMappings @@ -4604,6 +5329,67 @@ func (s *ListFunctionsOutput) SetNextMarker(v string) *ListFunctionsOutput { return s } +type ListTagsInput struct { + _ struct{} `type:"structure"` + + // The ARN (Amazon Resource Name) of the function. + // + // Resource is a required field + Resource *string `location:"uri" locationName:"ARN" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListTagsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListTagsInput"} + if s.Resource == nil { + invalidParams.Add(request.NewErrParamRequired("Resource")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResource sets the Resource field's value. +func (s *ListTagsInput) SetResource(v string) *ListTagsInput { + s.Resource = &v + return s +} + +type ListTagsOutput struct { + _ struct{} `type:"structure"` + + // The list of tags assigned to the function. + Tags map[string]*string `type:"map"` +} + +// String returns the string representation +func (s ListTagsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsOutput) GoString() string { + return s.String() +} + +// SetTags sets the Tags field's value. +func (s *ListTagsOutput) SetTags(v map[string]*string) *ListTagsOutput { + s.Tags = v + return s +} + type ListVersionsByFunctionInput struct { _ struct{} `type:"structure"` @@ -4612,7 +5398,7 @@ type ListVersionsByFunctionInput struct { // function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4723,7 +5509,7 @@ type PublishVersionInput struct { // arn:aws:lambda:us-west-2:account-id:function:ThumbNail). AWS Lambda also // allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4782,7 +5568,7 @@ type RemovePermissionInput struct { // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4866,13 +5652,147 @@ func (s RemovePermissionOutput) GoString() string { return s.String() } +type TagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN (Amazon Resource Name) of the Lambda function. + // + // Resource is a required field + Resource *string `location:"uri" locationName:"ARN" type:"string" required:"true"` + + // The list of tags (key-value pairs) you are assigning to the Lambda function. + // + // Tags is a required field + Tags map[string]*string `type:"map" required:"true"` +} + +// String returns the string representation +func (s TagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +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.Resource == nil { + invalidParams.Add(request.NewErrParamRequired("Resource")) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResource sets the Resource field's value. +func (s *TagResourceInput) SetResource(v string) *TagResourceInput { + s.Resource = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagResourceInput) SetTags(v map[string]*string) *TagResourceInput { + s.Tags = v + return s +} + +type TagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s TagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceOutput) GoString() string { + return s.String() +} + +type UntagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN (Amazon Resource Name) of the function. + // + // Resource is a required field + Resource *string `location:"uri" locationName:"ARN" type:"string" required:"true"` + + // The list of tag keys to be deleted from the function. + // + // TagKeys is a required field + TagKeys []*string `location:"querystring" locationName:"tagKeys" type:"list" required:"true"` +} + +// String returns the string representation +func (s UntagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +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.Resource == nil { + invalidParams.Add(request.NewErrParamRequired("Resource")) + } + if s.TagKeys == nil { + invalidParams.Add(request.NewErrParamRequired("TagKeys")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResource sets the Resource field's value. +func (s *UntagResourceInput) SetResource(v string) *UntagResourceInput { + s.Resource = &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 +func (s UntagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceOutput) GoString() string { + return s.String() +} + type UpdateAliasInput struct { _ struct{} `type:"structure"` // You can change the description of the alias using this parameter. Description *string `type:"string"` - // The function name for which the alias is created. + // The function name for which the alias is created. Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -4962,6 +5882,8 @@ type UpdateEventSourceMappingInput struct { // You can specify a function name (for example, Thumbnail) or you can specify // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. // // If you are using versioning, you can also provide a qualified function ARN // (ARN that is qualified with function version or alias name as suffix). For @@ -5040,7 +5962,7 @@ type UpdateFunctionCodeInput struct { // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). // Note that the length constraint applies only to the ARN. If you specify only - // the function name, it is limited to 64 character in length. + // the function name, it is limited to 64 characters in length. // // FunctionName is a required field FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` @@ -5190,8 +6112,11 @@ type UpdateFunctionConfigurationInput struct { // The runtime environment for the Lambda function. // - // To use the Node.js runtime v4.3, set the value to "nodejs4.3". To use earlier - // runtime (v0.10.42), set the value to "nodejs". + // To use the Python runtime v3.6, set the value to "python3.6". To use the + // Python runtime v2.7, set the value to "python2.7". To use the Node.js runtime + // v6.10, set the value to "nodejs6.10". To use the Node.js runtime v4.3, set + // the value to "nodejs4.3". To use the Python runtime v3.6, set the value to + // "python3.6". To use the Python runtime v2.7, set the value to "python2.7". // // You can no longer downgrade to the v0.10.42 runtime version. This version // will no longer be supported as of early 2017. @@ -5422,12 +6347,18 @@ const ( // RuntimeNodejs43 is a Runtime enum value RuntimeNodejs43 = "nodejs4.3" + // RuntimeNodejs610 is a Runtime enum value + RuntimeNodejs610 = "nodejs6.10" + // RuntimeJava8 is a Runtime enum value RuntimeJava8 = "java8" // RuntimePython27 is a Runtime enum value RuntimePython27 = "python2.7" + // RuntimePython36 is a Runtime enum value + RuntimePython36 = "python3.6" + // RuntimeDotnetcore10 is a Runtime enum value RuntimeDotnetcore10 = "dotnetcore1.0" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/errors.go index 1f9a11b6b3..7ff426888d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package lambda diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go index abb46faa32..619c583f6c 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/lambda/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package lambda diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go index 06a44736e7..b61e0eaadf 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package lightsail provides a client for Amazon Lightsail. package lightsail @@ -6,6 +6,7 @@ package lightsail import ( "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" ) @@ -92,8 +93,23 @@ func (c *Lightsail) AllocateStaticIpRequest(input *AllocateStaticIpInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AllocateStaticIp func (c *Lightsail) AllocateStaticIp(input *AllocateStaticIpInput) (*AllocateStaticIpOutput, error) { req, out := c.AllocateStaticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AllocateStaticIpWithContext is the same as AllocateStaticIp with the addition of +// the ability to pass a context and additional request options. +// +// See AllocateStaticIp 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 *Lightsail) AllocateStaticIpWithContext(ctx aws.Context, input *AllocateStaticIpInput, opts ...request.Option) (*AllocateStaticIpOutput, error) { + req, out := c.AllocateStaticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachStaticIp = "AttachStaticIp" @@ -178,8 +194,23 @@ func (c *Lightsail) AttachStaticIpRequest(input *AttachStaticIpInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachStaticIp func (c *Lightsail) AttachStaticIp(input *AttachStaticIpInput) (*AttachStaticIpOutput, error) { req, out := c.AttachStaticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachStaticIpWithContext is the same as AttachStaticIp with the addition of +// the ability to pass a context and additional request options. +// +// See AttachStaticIp 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 *Lightsail) AttachStaticIpWithContext(ctx aws.Context, input *AttachStaticIpInput, opts ...request.Option) (*AttachStaticIpOutput, error) { + req, out := c.AttachStaticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCloseInstancePublicPorts = "CloseInstancePublicPorts" @@ -264,8 +295,23 @@ func (c *Lightsail) CloseInstancePublicPortsRequest(input *CloseInstancePublicPo // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CloseInstancePublicPorts func (c *Lightsail) CloseInstancePublicPorts(input *CloseInstancePublicPortsInput) (*CloseInstancePublicPortsOutput, error) { req, out := c.CloseInstancePublicPortsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CloseInstancePublicPortsWithContext is the same as CloseInstancePublicPorts with the addition of +// the ability to pass a context and additional request options. +// +// See CloseInstancePublicPorts 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 *Lightsail) CloseInstancePublicPortsWithContext(ctx aws.Context, input *CloseInstancePublicPortsInput, opts ...request.Option) (*CloseInstancePublicPortsOutput, error) { + req, out := c.CloseInstancePublicPortsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDomain = "CreateDomain" @@ -350,8 +396,23 @@ func (c *Lightsail) CreateDomainRequest(input *CreateDomainInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDomain func (c *Lightsail) CreateDomain(input *CreateDomainInput) (*CreateDomainOutput, error) { req, out := c.CreateDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDomainWithContext is the same as CreateDomain with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDomain 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 *Lightsail) CreateDomainWithContext(ctx aws.Context, input *CreateDomainInput, opts ...request.Option) (*CreateDomainOutput, error) { + req, out := c.CreateDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDomainEntry = "CreateDomainEntry" @@ -437,8 +498,23 @@ func (c *Lightsail) CreateDomainEntryRequest(input *CreateDomainEntryInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDomainEntry func (c *Lightsail) CreateDomainEntry(input *CreateDomainEntryInput) (*CreateDomainEntryOutput, error) { req, out := c.CreateDomainEntryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDomainEntryWithContext is the same as CreateDomainEntry with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDomainEntry 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 *Lightsail) CreateDomainEntryWithContext(ctx aws.Context, input *CreateDomainEntryInput, opts ...request.Option) (*CreateDomainEntryOutput, error) { + req, out := c.CreateDomainEntryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateInstanceSnapshot = "CreateInstanceSnapshot" @@ -524,8 +600,23 @@ func (c *Lightsail) CreateInstanceSnapshotRequest(input *CreateInstanceSnapshotI // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstanceSnapshot func (c *Lightsail) CreateInstanceSnapshot(input *CreateInstanceSnapshotInput) (*CreateInstanceSnapshotOutput, error) { req, out := c.CreateInstanceSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInstanceSnapshotWithContext is the same as CreateInstanceSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInstanceSnapshot 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 *Lightsail) CreateInstanceSnapshotWithContext(ctx aws.Context, input *CreateInstanceSnapshotInput, opts ...request.Option) (*CreateInstanceSnapshotOutput, error) { + req, out := c.CreateInstanceSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateInstances = "CreateInstances" @@ -610,8 +701,23 @@ func (c *Lightsail) CreateInstancesRequest(input *CreateInstancesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstances func (c *Lightsail) CreateInstances(input *CreateInstancesInput) (*CreateInstancesOutput, error) { req, out := c.CreateInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInstancesWithContext is the same as CreateInstances with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInstances 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 *Lightsail) CreateInstancesWithContext(ctx aws.Context, input *CreateInstancesInput, opts ...request.Option) (*CreateInstancesOutput, error) { + req, out := c.CreateInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateInstancesFromSnapshot = "CreateInstancesFromSnapshot" @@ -697,8 +803,23 @@ func (c *Lightsail) CreateInstancesFromSnapshotRequest(input *CreateInstancesFro // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstancesFromSnapshot func (c *Lightsail) CreateInstancesFromSnapshot(input *CreateInstancesFromSnapshotInput) (*CreateInstancesFromSnapshotOutput, error) { req, out := c.CreateInstancesFromSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInstancesFromSnapshotWithContext is the same as CreateInstancesFromSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInstancesFromSnapshot 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 *Lightsail) CreateInstancesFromSnapshotWithContext(ctx aws.Context, input *CreateInstancesFromSnapshotInput, opts ...request.Option) (*CreateInstancesFromSnapshotOutput, error) { + req, out := c.CreateInstancesFromSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateKeyPair = "CreateKeyPair" @@ -783,8 +904,23 @@ func (c *Lightsail) CreateKeyPairRequest(input *CreateKeyPairInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateKeyPair func (c *Lightsail) CreateKeyPair(input *CreateKeyPairInput) (*CreateKeyPairOutput, error) { req, out := c.CreateKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateKeyPairWithContext is the same as CreateKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See CreateKeyPair 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 *Lightsail) CreateKeyPairWithContext(ctx aws.Context, input *CreateKeyPairInput, opts ...request.Option) (*CreateKeyPairOutput, error) { + req, out := c.CreateKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDomain = "DeleteDomain" @@ -869,8 +1005,23 @@ func (c *Lightsail) DeleteDomainRequest(input *DeleteDomainInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDomain func (c *Lightsail) DeleteDomain(input *DeleteDomainInput) (*DeleteDomainOutput, error) { req, out := c.DeleteDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDomainWithContext is the same as DeleteDomain with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDomain 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 *Lightsail) DeleteDomainWithContext(ctx aws.Context, input *DeleteDomainInput, opts ...request.Option) (*DeleteDomainOutput, error) { + req, out := c.DeleteDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDomainEntry = "DeleteDomainEntry" @@ -955,8 +1106,23 @@ func (c *Lightsail) DeleteDomainEntryRequest(input *DeleteDomainEntryInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDomainEntry func (c *Lightsail) DeleteDomainEntry(input *DeleteDomainEntryInput) (*DeleteDomainEntryOutput, error) { req, out := c.DeleteDomainEntryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDomainEntryWithContext is the same as DeleteDomainEntry with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDomainEntry 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 *Lightsail) DeleteDomainEntryWithContext(ctx aws.Context, input *DeleteDomainEntryInput, opts ...request.Option) (*DeleteDomainEntryOutput, error) { + req, out := c.DeleteDomainEntryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteInstance = "DeleteInstance" @@ -1041,8 +1207,23 @@ func (c *Lightsail) DeleteInstanceRequest(input *DeleteInstanceInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteInstance func (c *Lightsail) DeleteInstance(input *DeleteInstanceInput) (*DeleteInstanceOutput, error) { req, out := c.DeleteInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteInstanceWithContext is the same as DeleteInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteInstance 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 *Lightsail) DeleteInstanceWithContext(ctx aws.Context, input *DeleteInstanceInput, opts ...request.Option) (*DeleteInstanceOutput, error) { + req, out := c.DeleteInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteInstanceSnapshot = "DeleteInstanceSnapshot" @@ -1127,8 +1308,23 @@ func (c *Lightsail) DeleteInstanceSnapshotRequest(input *DeleteInstanceSnapshotI // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteInstanceSnapshot func (c *Lightsail) DeleteInstanceSnapshot(input *DeleteInstanceSnapshotInput) (*DeleteInstanceSnapshotOutput, error) { req, out := c.DeleteInstanceSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteInstanceSnapshotWithContext is the same as DeleteInstanceSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteInstanceSnapshot 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 *Lightsail) DeleteInstanceSnapshotWithContext(ctx aws.Context, input *DeleteInstanceSnapshotInput, opts ...request.Option) (*DeleteInstanceSnapshotOutput, error) { + req, out := c.DeleteInstanceSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteKeyPair = "DeleteKeyPair" @@ -1213,8 +1409,23 @@ func (c *Lightsail) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteKeyPair func (c *Lightsail) DeleteKeyPair(input *DeleteKeyPairInput) (*DeleteKeyPairOutput, error) { req, out := c.DeleteKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteKeyPairWithContext is the same as DeleteKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteKeyPair 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 *Lightsail) DeleteKeyPairWithContext(ctx aws.Context, input *DeleteKeyPairInput, opts ...request.Option) (*DeleteKeyPairOutput, error) { + req, out := c.DeleteKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachStaticIp = "DetachStaticIp" @@ -1299,8 +1510,23 @@ func (c *Lightsail) DetachStaticIpRequest(input *DetachStaticIpInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DetachStaticIp func (c *Lightsail) DetachStaticIp(input *DetachStaticIpInput) (*DetachStaticIpOutput, error) { req, out := c.DetachStaticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachStaticIpWithContext is the same as DetachStaticIp with the addition of +// the ability to pass a context and additional request options. +// +// See DetachStaticIp 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 *Lightsail) DetachStaticIpWithContext(ctx aws.Context, input *DetachStaticIpInput, opts ...request.Option) (*DetachStaticIpOutput, error) { + req, out := c.DetachStaticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDownloadDefaultKeyPair = "DownloadDefaultKeyPair" @@ -1385,8 +1611,23 @@ func (c *Lightsail) DownloadDefaultKeyPairRequest(input *DownloadDefaultKeyPairI // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DownloadDefaultKeyPair func (c *Lightsail) DownloadDefaultKeyPair(input *DownloadDefaultKeyPairInput) (*DownloadDefaultKeyPairOutput, error) { req, out := c.DownloadDefaultKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DownloadDefaultKeyPairWithContext is the same as DownloadDefaultKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See DownloadDefaultKeyPair 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 *Lightsail) DownloadDefaultKeyPairWithContext(ctx aws.Context, input *DownloadDefaultKeyPairInput, opts ...request.Option) (*DownloadDefaultKeyPairOutput, error) { + req, out := c.DownloadDefaultKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetActiveNames = "GetActiveNames" @@ -1471,8 +1712,23 @@ func (c *Lightsail) GetActiveNamesRequest(input *GetActiveNamesInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetActiveNames func (c *Lightsail) GetActiveNames(input *GetActiveNamesInput) (*GetActiveNamesOutput, error) { req, out := c.GetActiveNamesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetActiveNamesWithContext is the same as GetActiveNames with the addition of +// the ability to pass a context and additional request options. +// +// See GetActiveNames 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 *Lightsail) GetActiveNamesWithContext(ctx aws.Context, input *GetActiveNamesInput, opts ...request.Option) (*GetActiveNamesOutput, error) { + req, out := c.GetActiveNamesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBlueprints = "GetBlueprints" @@ -1560,8 +1816,23 @@ func (c *Lightsail) GetBlueprintsRequest(input *GetBlueprintsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetBlueprints func (c *Lightsail) GetBlueprints(input *GetBlueprintsInput) (*GetBlueprintsOutput, error) { req, out := c.GetBlueprintsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBlueprintsWithContext is the same as GetBlueprints with the addition of +// the ability to pass a context and additional request options. +// +// See GetBlueprints 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 *Lightsail) GetBlueprintsWithContext(ctx aws.Context, input *GetBlueprintsInput, opts ...request.Option) (*GetBlueprintsOutput, error) { + req, out := c.GetBlueprintsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBundles = "GetBundles" @@ -1647,8 +1918,23 @@ func (c *Lightsail) GetBundlesRequest(input *GetBundlesInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetBundles func (c *Lightsail) GetBundles(input *GetBundlesInput) (*GetBundlesOutput, error) { req, out := c.GetBundlesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBundlesWithContext is the same as GetBundles with the addition of +// the ability to pass a context and additional request options. +// +// See GetBundles 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 *Lightsail) GetBundlesWithContext(ctx aws.Context, input *GetBundlesInput, opts ...request.Option) (*GetBundlesOutput, error) { + req, out := c.GetBundlesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDomain = "GetDomain" @@ -1733,8 +2019,23 @@ func (c *Lightsail) GetDomainRequest(input *GetDomainInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDomain func (c *Lightsail) GetDomain(input *GetDomainInput) (*GetDomainOutput, error) { req, out := c.GetDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDomainWithContext is the same as GetDomain with the addition of +// the ability to pass a context and additional request options. +// +// See GetDomain 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 *Lightsail) GetDomainWithContext(ctx aws.Context, input *GetDomainInput, opts ...request.Option) (*GetDomainOutput, error) { + req, out := c.GetDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDomains = "GetDomains" @@ -1819,8 +2120,23 @@ func (c *Lightsail) GetDomainsRequest(input *GetDomainsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDomains func (c *Lightsail) GetDomains(input *GetDomainsInput) (*GetDomainsOutput, error) { req, out := c.GetDomainsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDomainsWithContext is the same as GetDomains with the addition of +// the ability to pass a context and additional request options. +// +// See GetDomains 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 *Lightsail) GetDomainsWithContext(ctx aws.Context, input *GetDomainsInput, opts ...request.Option) (*GetDomainsOutput, error) { + req, out := c.GetDomainsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstance = "GetInstance" @@ -1906,8 +2222,23 @@ func (c *Lightsail) GetInstanceRequest(input *GetInstanceInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstance func (c *Lightsail) GetInstance(input *GetInstanceInput) (*GetInstanceOutput, error) { req, out := c.GetInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstanceWithContext is the same as GetInstance with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstance 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 *Lightsail) GetInstanceWithContext(ctx aws.Context, input *GetInstanceInput, opts ...request.Option) (*GetInstanceOutput, error) { + req, out := c.GetInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstanceAccessDetails = "GetInstanceAccessDetails" @@ -1993,8 +2324,23 @@ func (c *Lightsail) GetInstanceAccessDetailsRequest(input *GetInstanceAccessDeta // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceAccessDetails func (c *Lightsail) GetInstanceAccessDetails(input *GetInstanceAccessDetailsInput) (*GetInstanceAccessDetailsOutput, error) { req, out := c.GetInstanceAccessDetailsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstanceAccessDetailsWithContext is the same as GetInstanceAccessDetails with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstanceAccessDetails 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 *Lightsail) GetInstanceAccessDetailsWithContext(ctx aws.Context, input *GetInstanceAccessDetailsInput, opts ...request.Option) (*GetInstanceAccessDetailsOutput, error) { + req, out := c.GetInstanceAccessDetailsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstanceMetricData = "GetInstanceMetricData" @@ -2080,8 +2426,23 @@ func (c *Lightsail) GetInstanceMetricDataRequest(input *GetInstanceMetricDataInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceMetricData func (c *Lightsail) GetInstanceMetricData(input *GetInstanceMetricDataInput) (*GetInstanceMetricDataOutput, error) { req, out := c.GetInstanceMetricDataRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstanceMetricDataWithContext is the same as GetInstanceMetricData with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstanceMetricData 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 *Lightsail) GetInstanceMetricDataWithContext(ctx aws.Context, input *GetInstanceMetricDataInput, opts ...request.Option) (*GetInstanceMetricDataOutput, error) { + req, out := c.GetInstanceMetricDataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstancePortStates = "GetInstancePortStates" @@ -2166,8 +2527,23 @@ func (c *Lightsail) GetInstancePortStatesRequest(input *GetInstancePortStatesInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstancePortStates func (c *Lightsail) GetInstancePortStates(input *GetInstancePortStatesInput) (*GetInstancePortStatesOutput, error) { req, out := c.GetInstancePortStatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstancePortStatesWithContext is the same as GetInstancePortStates with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstancePortStates 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 *Lightsail) GetInstancePortStatesWithContext(ctx aws.Context, input *GetInstancePortStatesInput, opts ...request.Option) (*GetInstancePortStatesOutput, error) { + req, out := c.GetInstancePortStatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstanceSnapshot = "GetInstanceSnapshot" @@ -2252,8 +2628,23 @@ func (c *Lightsail) GetInstanceSnapshotRequest(input *GetInstanceSnapshotInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceSnapshot func (c *Lightsail) GetInstanceSnapshot(input *GetInstanceSnapshotInput) (*GetInstanceSnapshotOutput, error) { req, out := c.GetInstanceSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstanceSnapshotWithContext is the same as GetInstanceSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstanceSnapshot 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 *Lightsail) GetInstanceSnapshotWithContext(ctx aws.Context, input *GetInstanceSnapshotInput, opts ...request.Option) (*GetInstanceSnapshotOutput, error) { + req, out := c.GetInstanceSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstanceSnapshots = "GetInstanceSnapshots" @@ -2338,8 +2729,23 @@ func (c *Lightsail) GetInstanceSnapshotsRequest(input *GetInstanceSnapshotsInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceSnapshots func (c *Lightsail) GetInstanceSnapshots(input *GetInstanceSnapshotsInput) (*GetInstanceSnapshotsOutput, error) { req, out := c.GetInstanceSnapshotsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstanceSnapshotsWithContext is the same as GetInstanceSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstanceSnapshots 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 *Lightsail) GetInstanceSnapshotsWithContext(ctx aws.Context, input *GetInstanceSnapshotsInput, opts ...request.Option) (*GetInstanceSnapshotsOutput, error) { + req, out := c.GetInstanceSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstanceState = "GetInstanceState" @@ -2424,8 +2830,23 @@ func (c *Lightsail) GetInstanceStateRequest(input *GetInstanceStateInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceState func (c *Lightsail) GetInstanceState(input *GetInstanceStateInput) (*GetInstanceStateOutput, error) { req, out := c.GetInstanceStateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstanceStateWithContext is the same as GetInstanceState with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstanceState 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 *Lightsail) GetInstanceStateWithContext(ctx aws.Context, input *GetInstanceStateInput, opts ...request.Option) (*GetInstanceStateOutput, error) { + req, out := c.GetInstanceStateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInstances = "GetInstances" @@ -2511,8 +2932,23 @@ func (c *Lightsail) GetInstancesRequest(input *GetInstancesInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstances func (c *Lightsail) GetInstances(input *GetInstancesInput) (*GetInstancesOutput, error) { req, out := c.GetInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInstancesWithContext is the same as GetInstances with the addition of +// the ability to pass a context and additional request options. +// +// See GetInstances 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 *Lightsail) GetInstancesWithContext(ctx aws.Context, input *GetInstancesInput, opts ...request.Option) (*GetInstancesOutput, error) { + req, out := c.GetInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetKeyPair = "GetKeyPair" @@ -2597,8 +3033,23 @@ func (c *Lightsail) GetKeyPairRequest(input *GetKeyPairInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetKeyPair func (c *Lightsail) GetKeyPair(input *GetKeyPairInput) (*GetKeyPairOutput, error) { req, out := c.GetKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetKeyPairWithContext is the same as GetKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See GetKeyPair 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 *Lightsail) GetKeyPairWithContext(ctx aws.Context, input *GetKeyPairInput, opts ...request.Option) (*GetKeyPairOutput, error) { + req, out := c.GetKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetKeyPairs = "GetKeyPairs" @@ -2683,8 +3134,23 @@ func (c *Lightsail) GetKeyPairsRequest(input *GetKeyPairsInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetKeyPairs func (c *Lightsail) GetKeyPairs(input *GetKeyPairsInput) (*GetKeyPairsOutput, error) { req, out := c.GetKeyPairsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetKeyPairsWithContext is the same as GetKeyPairs with the addition of +// the ability to pass a context and additional request options. +// +// See GetKeyPairs 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 *Lightsail) GetKeyPairsWithContext(ctx aws.Context, input *GetKeyPairsInput, opts ...request.Option) (*GetKeyPairsOutput, error) { + req, out := c.GetKeyPairsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetOperation = "GetOperation" @@ -2771,8 +3237,23 @@ func (c *Lightsail) GetOperationRequest(input *GetOperationInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperation func (c *Lightsail) GetOperation(input *GetOperationInput) (*GetOperationOutput, error) { req, out := c.GetOperationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetOperationWithContext is the same as GetOperation with the addition of +// the ability to pass a context and additional request options. +// +// See GetOperation 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 *Lightsail) GetOperationWithContext(ctx aws.Context, input *GetOperationInput, opts ...request.Option) (*GetOperationOutput, error) { + req, out := c.GetOperationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetOperations = "GetOperations" @@ -2861,8 +3342,23 @@ func (c *Lightsail) GetOperationsRequest(input *GetOperationsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperations func (c *Lightsail) GetOperations(input *GetOperationsInput) (*GetOperationsOutput, error) { req, out := c.GetOperationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetOperationsWithContext is the same as GetOperations with the addition of +// the ability to pass a context and additional request options. +// +// See GetOperations 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 *Lightsail) GetOperationsWithContext(ctx aws.Context, input *GetOperationsInput, opts ...request.Option) (*GetOperationsOutput, error) { + req, out := c.GetOperationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetOperationsForResource = "GetOperationsForResource" @@ -2947,8 +3443,23 @@ func (c *Lightsail) GetOperationsForResourceRequest(input *GetOperationsForResou // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperationsForResource func (c *Lightsail) GetOperationsForResource(input *GetOperationsForResourceInput) (*GetOperationsForResourceOutput, error) { req, out := c.GetOperationsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetOperationsForResourceWithContext is the same as GetOperationsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See GetOperationsForResource 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 *Lightsail) GetOperationsForResourceWithContext(ctx aws.Context, input *GetOperationsForResourceInput, opts ...request.Option) (*GetOperationsForResourceOutput, error) { + req, out := c.GetOperationsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRegions = "GetRegions" @@ -3033,8 +3544,23 @@ func (c *Lightsail) GetRegionsRequest(input *GetRegionsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRegions func (c *Lightsail) GetRegions(input *GetRegionsInput) (*GetRegionsOutput, error) { req, out := c.GetRegionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRegionsWithContext is the same as GetRegions with the addition of +// the ability to pass a context and additional request options. +// +// See GetRegions 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 *Lightsail) GetRegionsWithContext(ctx aws.Context, input *GetRegionsInput, opts ...request.Option) (*GetRegionsOutput, error) { + req, out := c.GetRegionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetStaticIp = "GetStaticIp" @@ -3119,8 +3645,23 @@ func (c *Lightsail) GetStaticIpRequest(input *GetStaticIpInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetStaticIp func (c *Lightsail) GetStaticIp(input *GetStaticIpInput) (*GetStaticIpOutput, error) { req, out := c.GetStaticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetStaticIpWithContext is the same as GetStaticIp with the addition of +// the ability to pass a context and additional request options. +// +// See GetStaticIp 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 *Lightsail) GetStaticIpWithContext(ctx aws.Context, input *GetStaticIpInput, opts ...request.Option) (*GetStaticIpOutput, error) { + req, out := c.GetStaticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetStaticIps = "GetStaticIps" @@ -3205,8 +3746,23 @@ func (c *Lightsail) GetStaticIpsRequest(input *GetStaticIpsInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetStaticIps func (c *Lightsail) GetStaticIps(input *GetStaticIpsInput) (*GetStaticIpsOutput, error) { req, out := c.GetStaticIpsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetStaticIpsWithContext is the same as GetStaticIps with the addition of +// the ability to pass a context and additional request options. +// +// See GetStaticIps 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 *Lightsail) GetStaticIpsWithContext(ctx aws.Context, input *GetStaticIpsInput, opts ...request.Option) (*GetStaticIpsOutput, error) { + req, out := c.GetStaticIpsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opImportKeyPair = "ImportKeyPair" @@ -3291,8 +3847,23 @@ func (c *Lightsail) ImportKeyPairRequest(input *ImportKeyPairInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ImportKeyPair func (c *Lightsail) ImportKeyPair(input *ImportKeyPairInput) (*ImportKeyPairOutput, error) { req, out := c.ImportKeyPairRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ImportKeyPairWithContext is the same as ImportKeyPair with the addition of +// the ability to pass a context and additional request options. +// +// See ImportKeyPair 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 *Lightsail) ImportKeyPairWithContext(ctx aws.Context, input *ImportKeyPairInput, opts ...request.Option) (*ImportKeyPairOutput, error) { + req, out := c.ImportKeyPairRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opIsVpcPeered = "IsVpcPeered" @@ -3377,8 +3948,23 @@ func (c *Lightsail) IsVpcPeeredRequest(input *IsVpcPeeredInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/IsVpcPeered func (c *Lightsail) IsVpcPeered(input *IsVpcPeeredInput) (*IsVpcPeeredOutput, error) { req, out := c.IsVpcPeeredRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// IsVpcPeeredWithContext is the same as IsVpcPeered with the addition of +// the ability to pass a context and additional request options. +// +// See IsVpcPeered 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 *Lightsail) IsVpcPeeredWithContext(ctx aws.Context, input *IsVpcPeeredInput, opts ...request.Option) (*IsVpcPeeredOutput, error) { + req, out := c.IsVpcPeeredRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opOpenInstancePublicPorts = "OpenInstancePublicPorts" @@ -3463,8 +4049,23 @@ func (c *Lightsail) OpenInstancePublicPortsRequest(input *OpenInstancePublicPort // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/OpenInstancePublicPorts func (c *Lightsail) OpenInstancePublicPorts(input *OpenInstancePublicPortsInput) (*OpenInstancePublicPortsOutput, error) { req, out := c.OpenInstancePublicPortsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// OpenInstancePublicPortsWithContext is the same as OpenInstancePublicPorts with the addition of +// the ability to pass a context and additional request options. +// +// See OpenInstancePublicPorts 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 *Lightsail) OpenInstancePublicPortsWithContext(ctx aws.Context, input *OpenInstancePublicPortsInput, opts ...request.Option) (*OpenInstancePublicPortsOutput, error) { + req, out := c.OpenInstancePublicPortsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPeerVpc = "PeerVpc" @@ -3549,8 +4150,23 @@ func (c *Lightsail) PeerVpcRequest(input *PeerVpcInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PeerVpc func (c *Lightsail) PeerVpc(input *PeerVpcInput) (*PeerVpcOutput, error) { req, out := c.PeerVpcRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PeerVpcWithContext is the same as PeerVpc with the addition of +// the ability to pass a context and additional request options. +// +// See PeerVpc 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 *Lightsail) PeerVpcWithContext(ctx aws.Context, input *PeerVpcInput, opts ...request.Option) (*PeerVpcOutput, error) { + req, out := c.PeerVpcRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRebootInstance = "RebootInstance" @@ -3638,8 +4254,23 @@ func (c *Lightsail) RebootInstanceRequest(input *RebootInstanceInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/RebootInstance func (c *Lightsail) RebootInstance(input *RebootInstanceInput) (*RebootInstanceOutput, error) { req, out := c.RebootInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RebootInstanceWithContext is the same as RebootInstance with the addition of +// the ability to pass a context and additional request options. +// +// See RebootInstance 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 *Lightsail) RebootInstanceWithContext(ctx aws.Context, input *RebootInstanceInput, opts ...request.Option) (*RebootInstanceOutput, error) { + req, out := c.RebootInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReleaseStaticIp = "ReleaseStaticIp" @@ -3724,8 +4355,23 @@ func (c *Lightsail) ReleaseStaticIpRequest(input *ReleaseStaticIpInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ReleaseStaticIp func (c *Lightsail) ReleaseStaticIp(input *ReleaseStaticIpInput) (*ReleaseStaticIpOutput, error) { req, out := c.ReleaseStaticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReleaseStaticIpWithContext is the same as ReleaseStaticIp with the addition of +// the ability to pass a context and additional request options. +// +// See ReleaseStaticIp 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 *Lightsail) ReleaseStaticIpWithContext(ctx aws.Context, input *ReleaseStaticIpInput, opts ...request.Option) (*ReleaseStaticIpOutput, error) { + req, out := c.ReleaseStaticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartInstance = "StartInstance" @@ -3811,8 +4457,23 @@ func (c *Lightsail) StartInstanceRequest(input *StartInstanceInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StartInstance func (c *Lightsail) StartInstance(input *StartInstanceInput) (*StartInstanceOutput, error) { req, out := c.StartInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartInstanceWithContext is the same as StartInstance with the addition of +// the ability to pass a context and additional request options. +// +// See StartInstance 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 *Lightsail) StartInstanceWithContext(ctx aws.Context, input *StartInstanceInput, opts ...request.Option) (*StartInstanceOutput, error) { + req, out := c.StartInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopInstance = "StopInstance" @@ -3897,8 +4558,23 @@ func (c *Lightsail) StopInstanceRequest(input *StopInstanceInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StopInstance func (c *Lightsail) StopInstance(input *StopInstanceInput) (*StopInstanceOutput, error) { req, out := c.StopInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopInstanceWithContext is the same as StopInstance with the addition of +// the ability to pass a context and additional request options. +// +// See StopInstance 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 *Lightsail) StopInstanceWithContext(ctx aws.Context, input *StopInstanceInput, opts ...request.Option) (*StopInstanceOutput, error) { + req, out := c.StopInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnpeerVpc = "UnpeerVpc" @@ -3983,8 +4659,23 @@ func (c *Lightsail) UnpeerVpcRequest(input *UnpeerVpcInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UnpeerVpc func (c *Lightsail) UnpeerVpc(input *UnpeerVpcInput) (*UnpeerVpcOutput, error) { req, out := c.UnpeerVpcRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnpeerVpcWithContext is the same as UnpeerVpc with the addition of +// the ability to pass a context and additional request options. +// +// See UnpeerVpc 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 *Lightsail) UnpeerVpcWithContext(ctx aws.Context, input *UnpeerVpcInput, opts ...request.Option) (*UnpeerVpcOutput, error) { + req, out := c.UnpeerVpcRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDomainEntry = "UpdateDomainEntry" @@ -4069,8 +4760,23 @@ func (c *Lightsail) UpdateDomainEntryRequest(input *UpdateDomainEntryInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateDomainEntry func (c *Lightsail) UpdateDomainEntry(input *UpdateDomainEntryInput) (*UpdateDomainEntryOutput, error) { req, out := c.UpdateDomainEntryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDomainEntryWithContext is the same as UpdateDomainEntry with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDomainEntry 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 *Lightsail) UpdateDomainEntryWithContext(ctx aws.Context, input *UpdateDomainEntryInput, opts ...request.Option) (*UpdateDomainEntryOutput, error) { + req, out := c.UpdateDomainEntryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AllocateStaticIpRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go index 309a86b9c7..a42a1393bb 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package lightsail diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/service.go index c3e15def0a..544902d854 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/lightsail/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package lightsail diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/api.go index d0c09d2842..e415f79e8a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package opsworks provides a client for AWS OpsWorks. package opsworks @@ -6,6 +6,7 @@ package opsworks import ( "fmt" + "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" @@ -66,7 +67,7 @@ func (c *OpsWorks) AssignInstanceRequest(input *AssignInstanceInput) (req *reque // * You can assign registered Amazon EC2 instances only to custom layers. // // * You cannot use this action with instances that were created with AWS -// OpsWorks. +// OpsWorks Stacks. // // Required Permissions: To use this action, an AWS Identity and Access Management // (IAM) user must have a Manage permissions level for the stack or an attached @@ -90,8 +91,23 @@ func (c *OpsWorks) AssignInstanceRequest(input *AssignInstanceInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/AssignInstance func (c *OpsWorks) AssignInstance(input *AssignInstanceInput) (*AssignInstanceOutput, error) { req, out := c.AssignInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssignInstanceWithContext is the same as AssignInstance with the addition of +// the ability to pass a context and additional request options. +// +// See AssignInstance 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 *OpsWorks) AssignInstanceWithContext(ctx aws.Context, input *AssignInstanceInput, opts ...request.Option) (*AssignInstanceOutput, error) { + req, out := c.AssignInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssignVolume = "AssignVolume" @@ -169,8 +185,23 @@ func (c *OpsWorks) AssignVolumeRequest(input *AssignVolumeInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/AssignVolume func (c *OpsWorks) AssignVolume(input *AssignVolumeInput) (*AssignVolumeOutput, error) { req, out := c.AssignVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssignVolumeWithContext is the same as AssignVolume with the addition of +// the ability to pass a context and additional request options. +// +// See AssignVolume 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 *OpsWorks) AssignVolumeWithContext(ctx aws.Context, input *AssignVolumeInput, opts ...request.Option) (*AssignVolumeOutput, error) { + req, out := c.AssignVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssociateElasticIp = "AssociateElasticIp" @@ -246,8 +277,23 @@ func (c *OpsWorks) AssociateElasticIpRequest(input *AssociateElasticIpInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/AssociateElasticIp func (c *OpsWorks) AssociateElasticIp(input *AssociateElasticIpInput) (*AssociateElasticIpOutput, error) { req, out := c.AssociateElasticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateElasticIpWithContext is the same as AssociateElasticIp with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateElasticIp 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 *OpsWorks) AssociateElasticIpWithContext(ctx aws.Context, input *AssociateElasticIpInput, opts ...request.Option) (*AssociateElasticIpOutput, error) { + req, out := c.AssociateElasticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAttachElasticLoadBalancer = "AttachElasticLoadBalancer" @@ -326,8 +372,23 @@ func (c *OpsWorks) AttachElasticLoadBalancerRequest(input *AttachElasticLoadBala // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/AttachElasticLoadBalancer func (c *OpsWorks) AttachElasticLoadBalancer(input *AttachElasticLoadBalancerInput) (*AttachElasticLoadBalancerOutput, error) { req, out := c.AttachElasticLoadBalancerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AttachElasticLoadBalancerWithContext is the same as AttachElasticLoadBalancer with the addition of +// the ability to pass a context and additional request options. +// +// See AttachElasticLoadBalancer 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 *OpsWorks) AttachElasticLoadBalancerWithContext(ctx aws.Context, input *AttachElasticLoadBalancerInput, opts ...request.Option) (*AttachElasticLoadBalancerOutput, error) { + req, out := c.AttachElasticLoadBalancerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCloneStack = "CloneStack" @@ -400,8 +461,23 @@ func (c *OpsWorks) CloneStackRequest(input *CloneStackInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CloneStack func (c *OpsWorks) CloneStack(input *CloneStackInput) (*CloneStackOutput, error) { req, out := c.CloneStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CloneStackWithContext is the same as CloneStack with the addition of +// the ability to pass a context and additional request options. +// +// See CloneStack 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 *OpsWorks) CloneStackWithContext(ctx aws.Context, input *CloneStackInput, opts ...request.Option) (*CloneStackOutput, error) { + req, out := c.CloneStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateApp = "CreateApp" @@ -474,8 +550,23 @@ func (c *OpsWorks) CreateAppRequest(input *CreateAppInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CreateApp func (c *OpsWorks) CreateApp(input *CreateAppInput) (*CreateAppOutput, error) { req, out := c.CreateAppRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAppWithContext is the same as CreateApp with the addition of +// the ability to pass a context and additional request options. +// +// See CreateApp 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 *OpsWorks) CreateAppWithContext(ctx aws.Context, input *CreateAppInput, opts ...request.Option) (*CreateAppOutput, error) { + req, out := c.CreateAppRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDeployment = "CreateDeployment" @@ -549,8 +640,23 @@ func (c *OpsWorks) CreateDeploymentRequest(input *CreateDeploymentInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CreateDeployment func (c *OpsWorks) CreateDeployment(input *CreateDeploymentInput) (*CreateDeploymentOutput, error) { req, out := c.CreateDeploymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDeploymentWithContext is the same as CreateDeployment with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDeployment 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 *OpsWorks) CreateDeploymentWithContext(ctx aws.Context, input *CreateDeploymentInput, opts ...request.Option) (*CreateDeploymentOutput, error) { + req, out := c.CreateDeploymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateInstance = "CreateInstance" @@ -623,8 +729,23 @@ func (c *OpsWorks) CreateInstanceRequest(input *CreateInstanceInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CreateInstance func (c *OpsWorks) CreateInstance(input *CreateInstanceInput) (*CreateInstanceOutput, error) { req, out := c.CreateInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateInstanceWithContext is the same as CreateInstance with the addition of +// the ability to pass a context and additional request options. +// +// See CreateInstance 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 *OpsWorks) CreateInstanceWithContext(ctx aws.Context, input *CreateInstanceInput, opts ...request.Option) (*CreateInstanceOutput, error) { + req, out := c.CreateInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateLayer = "CreateLayer" @@ -703,8 +824,23 @@ func (c *OpsWorks) CreateLayerRequest(input *CreateLayerInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CreateLayer func (c *OpsWorks) CreateLayer(input *CreateLayerInput) (*CreateLayerOutput, error) { req, out := c.CreateLayerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateLayerWithContext is the same as CreateLayer with the addition of +// the ability to pass a context and additional request options. +// +// See CreateLayer 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 *OpsWorks) CreateLayerWithContext(ctx aws.Context, input *CreateLayerInput, opts ...request.Option) (*CreateLayerOutput, error) { + req, out := c.CreateLayerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateStack = "CreateStack" @@ -772,8 +908,23 @@ func (c *OpsWorks) CreateStackRequest(input *CreateStackInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CreateStack func (c *OpsWorks) CreateStack(input *CreateStackInput) (*CreateStackOutput, error) { req, out := c.CreateStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateStackWithContext is the same as CreateStack with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStack 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 *OpsWorks) CreateStackWithContext(ctx aws.Context, input *CreateStackInput, opts ...request.Option) (*CreateStackOutput, error) { + req, out := c.CreateStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateUserProfile = "CreateUserProfile" @@ -841,8 +992,23 @@ func (c *OpsWorks) CreateUserProfileRequest(input *CreateUserProfileInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CreateUserProfile func (c *OpsWorks) CreateUserProfile(input *CreateUserProfileInput) (*CreateUserProfileOutput, error) { req, out := c.CreateUserProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateUserProfileWithContext is the same as CreateUserProfile with the addition of +// the ability to pass a context and additional request options. +// +// See CreateUserProfile 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 *OpsWorks) CreateUserProfileWithContext(ctx aws.Context, input *CreateUserProfileInput, opts ...request.Option) (*CreateUserProfileOutput, error) { + req, out := c.CreateUserProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteApp = "DeleteApp" @@ -916,8 +1082,23 @@ func (c *OpsWorks) DeleteAppRequest(input *DeleteAppInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeleteApp func (c *OpsWorks) DeleteApp(input *DeleteAppInput) (*DeleteAppOutput, error) { req, out := c.DeleteAppRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAppWithContext is the same as DeleteApp with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteApp 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 *OpsWorks) DeleteAppWithContext(ctx aws.Context, input *DeleteAppInput, opts ...request.Option) (*DeleteAppOutput, error) { + req, out := c.DeleteAppRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteInstance = "DeleteInstance" @@ -994,8 +1175,23 @@ func (c *OpsWorks) DeleteInstanceRequest(input *DeleteInstanceInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeleteInstance func (c *OpsWorks) DeleteInstance(input *DeleteInstanceInput) (*DeleteInstanceOutput, error) { req, out := c.DeleteInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteInstanceWithContext is the same as DeleteInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteInstance 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 *OpsWorks) DeleteInstanceWithContext(ctx aws.Context, input *DeleteInstanceInput, opts ...request.Option) (*DeleteInstanceOutput, error) { + req, out := c.DeleteInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteLayer = "DeleteLayer" @@ -1071,8 +1267,23 @@ func (c *OpsWorks) DeleteLayerRequest(input *DeleteLayerInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeleteLayer func (c *OpsWorks) DeleteLayer(input *DeleteLayerInput) (*DeleteLayerOutput, error) { req, out := c.DeleteLayerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteLayerWithContext is the same as DeleteLayer with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteLayer 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 *OpsWorks) DeleteLayerWithContext(ctx aws.Context, input *DeleteLayerInput, opts ...request.Option) (*DeleteLayerOutput, error) { + req, out := c.DeleteLayerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteStack = "DeleteStack" @@ -1148,8 +1359,23 @@ func (c *OpsWorks) DeleteStackRequest(input *DeleteStackInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeleteStack func (c *OpsWorks) DeleteStack(input *DeleteStackInput) (*DeleteStackOutput, error) { req, out := c.DeleteStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteStackWithContext is the same as DeleteStack with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteStack 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 *OpsWorks) DeleteStackWithContext(ctx aws.Context, input *DeleteStackInput, opts ...request.Option) (*DeleteStackOutput, error) { + req, out := c.DeleteStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteUserProfile = "DeleteUserProfile" @@ -1222,8 +1448,23 @@ func (c *OpsWorks) DeleteUserProfileRequest(input *DeleteUserProfileInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeleteUserProfile func (c *OpsWorks) DeleteUserProfile(input *DeleteUserProfileInput) (*DeleteUserProfileOutput, error) { req, out := c.DeleteUserProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteUserProfileWithContext is the same as DeleteUserProfile with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteUserProfile 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 *OpsWorks) DeleteUserProfileWithContext(ctx aws.Context, input *DeleteUserProfileInput, opts ...request.Option) (*DeleteUserProfileOutput, error) { + req, out := c.DeleteUserProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterEcsCluster = "DeregisterEcsCluster" @@ -1298,8 +1539,23 @@ func (c *OpsWorks) DeregisterEcsClusterRequest(input *DeregisterEcsClusterInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeregisterEcsCluster func (c *OpsWorks) DeregisterEcsCluster(input *DeregisterEcsClusterInput) (*DeregisterEcsClusterOutput, error) { req, out := c.DeregisterEcsClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterEcsClusterWithContext is the same as DeregisterEcsCluster with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterEcsCluster 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 *OpsWorks) DeregisterEcsClusterWithContext(ctx aws.Context, input *DeregisterEcsClusterInput, opts ...request.Option) (*DeregisterEcsClusterOutput, error) { + req, out := c.DeregisterEcsClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterElasticIp = "DeregisterElasticIp" @@ -1374,8 +1630,23 @@ func (c *OpsWorks) DeregisterElasticIpRequest(input *DeregisterElasticIpInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeregisterElasticIp func (c *OpsWorks) DeregisterElasticIp(input *DeregisterElasticIpInput) (*DeregisterElasticIpOutput, error) { req, out := c.DeregisterElasticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterElasticIpWithContext is the same as DeregisterElasticIp with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterElasticIp 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 *OpsWorks) DeregisterElasticIpWithContext(ctx aws.Context, input *DeregisterElasticIpInput, opts ...request.Option) (*DeregisterElasticIpOutput, error) { + req, out := c.DeregisterElasticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterInstance = "DeregisterInstance" @@ -1427,7 +1698,7 @@ func (c *OpsWorks) DeregisterInstanceRequest(input *DeregisterInstanceInput) (re // // Deregister a registered Amazon EC2 or on-premises instance. This action removes // the instance from the stack and returns it to your control. This action can -// not be used with instances that were created with AWS OpsWorks. +// not be used with instances that were created with AWS OpsWorks Stacks. // // Required Permissions: To use this action, an IAM user must have a Manage // permissions level for the stack or an attached policy that explicitly grants @@ -1451,8 +1722,23 @@ func (c *OpsWorks) DeregisterInstanceRequest(input *DeregisterInstanceInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeregisterInstance func (c *OpsWorks) DeregisterInstance(input *DeregisterInstanceInput) (*DeregisterInstanceOutput, error) { req, out := c.DeregisterInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterInstanceWithContext is the same as DeregisterInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterInstance 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 *OpsWorks) DeregisterInstanceWithContext(ctx aws.Context, input *DeregisterInstanceInput, opts ...request.Option) (*DeregisterInstanceOutput, error) { + req, out := c.DeregisterInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterRdsDbInstance = "DeregisterRdsDbInstance" @@ -1526,8 +1812,23 @@ func (c *OpsWorks) DeregisterRdsDbInstanceRequest(input *DeregisterRdsDbInstance // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeregisterRdsDbInstance func (c *OpsWorks) DeregisterRdsDbInstance(input *DeregisterRdsDbInstanceInput) (*DeregisterRdsDbInstanceOutput, error) { req, out := c.DeregisterRdsDbInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterRdsDbInstanceWithContext is the same as DeregisterRdsDbInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterRdsDbInstance 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 *OpsWorks) DeregisterRdsDbInstanceWithContext(ctx aws.Context, input *DeregisterRdsDbInstanceInput, opts ...request.Option) (*DeregisterRdsDbInstanceOutput, error) { + req, out := c.DeregisterRdsDbInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterVolume = "DeregisterVolume" @@ -1602,8 +1903,23 @@ func (c *OpsWorks) DeregisterVolumeRequest(input *DeregisterVolumeInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DeregisterVolume func (c *OpsWorks) DeregisterVolume(input *DeregisterVolumeInput) (*DeregisterVolumeOutput, error) { req, out := c.DeregisterVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterVolumeWithContext is the same as DeregisterVolume with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterVolume 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 *OpsWorks) DeregisterVolumeWithContext(ctx aws.Context, input *DeregisterVolumeInput, opts ...request.Option) (*DeregisterVolumeOutput, error) { + req, out := c.DeregisterVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAgentVersions = "DescribeAgentVersions" @@ -1651,9 +1967,9 @@ func (c *OpsWorks) DescribeAgentVersionsRequest(input *DescribeAgentVersionsInpu // DescribeAgentVersions API operation for AWS OpsWorks. // -// Describes the available AWS OpsWorks agent versions. You must specify a stack -// ID or a configuration manager. DescribeAgentVersions returns a list of available -// agent versions for the specified stack or configuration manager. +// Describes the available AWS OpsWorks Stacks agent versions. You must specify +// a stack ID or a configuration manager. DescribeAgentVersions returns a list +// of available agent versions for the specified stack or configuration manager. // // 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 @@ -1672,8 +1988,23 @@ func (c *OpsWorks) DescribeAgentVersionsRequest(input *DescribeAgentVersionsInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeAgentVersions func (c *OpsWorks) DescribeAgentVersions(input *DescribeAgentVersionsInput) (*DescribeAgentVersionsOutput, error) { req, out := c.DescribeAgentVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAgentVersionsWithContext is the same as DescribeAgentVersions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAgentVersions 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 *OpsWorks) DescribeAgentVersionsWithContext(ctx aws.Context, input *DescribeAgentVersionsInput, opts ...request.Option) (*DescribeAgentVersionsOutput, error) { + req, out := c.DescribeAgentVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeApps = "DescribeApps" @@ -1723,7 +2054,7 @@ func (c *OpsWorks) DescribeAppsRequest(input *DescribeAppsInput) (req *request.R // // Requests a description of a specified set of apps. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -1747,8 +2078,23 @@ func (c *OpsWorks) DescribeAppsRequest(input *DescribeAppsInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeApps func (c *OpsWorks) DescribeApps(input *DescribeAppsInput) (*DescribeAppsOutput, error) { req, out := c.DescribeAppsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAppsWithContext is the same as DescribeApps with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeApps 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 *OpsWorks) DescribeAppsWithContext(ctx aws.Context, input *DescribeAppsInput, opts ...request.Option) (*DescribeAppsOutput, error) { + req, out := c.DescribeAppsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCommands = "DescribeCommands" @@ -1798,7 +2144,7 @@ func (c *OpsWorks) DescribeCommandsRequest(input *DescribeCommandsInput) (req *r // // Describes the results of specified commands. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -1822,8 +2168,23 @@ func (c *OpsWorks) DescribeCommandsRequest(input *DescribeCommandsInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeCommands func (c *OpsWorks) DescribeCommands(input *DescribeCommandsInput) (*DescribeCommandsOutput, error) { req, out := c.DescribeCommandsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCommandsWithContext is the same as DescribeCommands with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCommands 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 *OpsWorks) DescribeCommandsWithContext(ctx aws.Context, input *DescribeCommandsInput, opts ...request.Option) (*DescribeCommandsOutput, error) { + req, out := c.DescribeCommandsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDeployments = "DescribeDeployments" @@ -1873,7 +2234,7 @@ func (c *OpsWorks) DescribeDeploymentsRequest(input *DescribeDeploymentsInput) ( // // Requests a description of a specified set of deployments. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -1897,8 +2258,23 @@ func (c *OpsWorks) DescribeDeploymentsRequest(input *DescribeDeploymentsInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeDeployments func (c *OpsWorks) DescribeDeployments(input *DescribeDeploymentsInput) (*DescribeDeploymentsOutput, error) { req, out := c.DescribeDeploymentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDeploymentsWithContext is the same as DescribeDeployments with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDeployments 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 *OpsWorks) DescribeDeploymentsWithContext(ctx aws.Context, input *DescribeDeploymentsInput, opts ...request.Option) (*DescribeDeploymentsOutput, error) { + req, out := c.DescribeDeploymentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEcsClusters = "DescribeEcsClusters" @@ -1954,14 +2330,16 @@ func (c *OpsWorks) DescribeEcsClustersRequest(input *DescribeEcsClustersInput) ( // // Describes Amazon ECS clusters that are registered with a stack. If you specify // only a stack ID, you can use the MaxResults and NextToken parameters to paginate -// the response. However, AWS OpsWorks currently supports only one cluster per -// layer, so the result set has a maximum of one element. +// the response. However, AWS OpsWorks Stacks currently supports only one cluster +// per layer, so the result set has a maximum of one element. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack or an attached policy that explicitly // grants permission. For more information on user permissions, see Managing // User Permissions (http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html). // +// This call accepts only one resource-identifying parameter. +// // 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. @@ -1979,8 +2357,23 @@ func (c *OpsWorks) DescribeEcsClustersRequest(input *DescribeEcsClustersInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeEcsClusters func (c *OpsWorks) DescribeEcsClusters(input *DescribeEcsClustersInput) (*DescribeEcsClustersOutput, error) { req, out := c.DescribeEcsClustersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEcsClustersWithContext is the same as DescribeEcsClusters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEcsClusters 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 *OpsWorks) DescribeEcsClustersWithContext(ctx aws.Context, input *DescribeEcsClustersInput, opts ...request.Option) (*DescribeEcsClustersOutput, error) { + req, out := c.DescribeEcsClustersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEcsClustersPages iterates over the pages of a DescribeEcsClusters operation, @@ -2000,12 +2393,37 @@ func (c *OpsWorks) DescribeEcsClusters(input *DescribeEcsClustersInput) (*Descri // return pageNum <= 3 // }) // -func (c *OpsWorks) DescribeEcsClustersPages(input *DescribeEcsClustersInput, fn func(p *DescribeEcsClustersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEcsClustersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEcsClustersOutput), lastPage) - }) +func (c *OpsWorks) DescribeEcsClustersPages(input *DescribeEcsClustersInput, fn func(*DescribeEcsClustersOutput, bool) bool) error { + return c.DescribeEcsClustersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEcsClustersPagesWithContext same as DescribeEcsClustersPages 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 *OpsWorks) DescribeEcsClustersPagesWithContext(ctx aws.Context, input *DescribeEcsClustersInput, fn func(*DescribeEcsClustersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEcsClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEcsClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEcsClustersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeElasticIps = "DescribeElasticIps" @@ -2055,7 +2473,7 @@ func (c *OpsWorks) DescribeElasticIpsRequest(input *DescribeElasticIpsInput) (re // // Describes Elastic IP addresses (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html). // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -2079,8 +2497,23 @@ func (c *OpsWorks) DescribeElasticIpsRequest(input *DescribeElasticIpsInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeElasticIps func (c *OpsWorks) DescribeElasticIps(input *DescribeElasticIpsInput) (*DescribeElasticIpsOutput, error) { req, out := c.DescribeElasticIpsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeElasticIpsWithContext is the same as DescribeElasticIps with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeElasticIps 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 *OpsWorks) DescribeElasticIpsWithContext(ctx aws.Context, input *DescribeElasticIpsInput, opts ...request.Option) (*DescribeElasticIpsOutput, error) { + req, out := c.DescribeElasticIpsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeElasticLoadBalancers = "DescribeElasticLoadBalancers" @@ -2130,7 +2563,7 @@ func (c *OpsWorks) DescribeElasticLoadBalancersRequest(input *DescribeElasticLoa // // Describes a stack's Elastic Load Balancing instances. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -2154,8 +2587,23 @@ func (c *OpsWorks) DescribeElasticLoadBalancersRequest(input *DescribeElasticLoa // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeElasticLoadBalancers func (c *OpsWorks) DescribeElasticLoadBalancers(input *DescribeElasticLoadBalancersInput) (*DescribeElasticLoadBalancersOutput, error) { req, out := c.DescribeElasticLoadBalancersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeElasticLoadBalancersWithContext is the same as DescribeElasticLoadBalancers with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeElasticLoadBalancers 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 *OpsWorks) DescribeElasticLoadBalancersWithContext(ctx aws.Context, input *DescribeElasticLoadBalancersInput, opts ...request.Option) (*DescribeElasticLoadBalancersOutput, error) { + req, out := c.DescribeElasticLoadBalancersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeInstances = "DescribeInstances" @@ -2205,7 +2653,7 @@ func (c *OpsWorks) DescribeInstancesRequest(input *DescribeInstancesInput) (req // // Requests a description of a set of instances. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -2229,8 +2677,23 @@ func (c *OpsWorks) DescribeInstancesRequest(input *DescribeInstancesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeInstances func (c *OpsWorks) DescribeInstances(input *DescribeInstancesInput) (*DescribeInstancesOutput, error) { req, out := c.DescribeInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstancesWithContext is the same as DescribeInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstances 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 *OpsWorks) DescribeInstancesWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.Option) (*DescribeInstancesOutput, error) { + req, out := c.DescribeInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeLayers = "DescribeLayers" @@ -2280,7 +2743,7 @@ func (c *OpsWorks) DescribeLayersRequest(input *DescribeLayersInput) (req *reque // // Requests a description of one or more layers in a specified stack. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -2304,8 +2767,23 @@ func (c *OpsWorks) DescribeLayersRequest(input *DescribeLayersInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeLayers func (c *OpsWorks) DescribeLayers(input *DescribeLayersInput) (*DescribeLayersOutput, error) { req, out := c.DescribeLayersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeLayersWithContext is the same as DescribeLayers with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLayers 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 *OpsWorks) DescribeLayersWithContext(ctx aws.Context, input *DescribeLayersInput, opts ...request.Option) (*DescribeLayersOutput, error) { + req, out := c.DescribeLayersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeLoadBasedAutoScaling = "DescribeLoadBasedAutoScaling" @@ -2379,8 +2857,23 @@ func (c *OpsWorks) DescribeLoadBasedAutoScalingRequest(input *DescribeLoadBasedA // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeLoadBasedAutoScaling func (c *OpsWorks) DescribeLoadBasedAutoScaling(input *DescribeLoadBasedAutoScalingInput) (*DescribeLoadBasedAutoScalingOutput, error) { req, out := c.DescribeLoadBasedAutoScalingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeLoadBasedAutoScalingWithContext is the same as DescribeLoadBasedAutoScaling with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLoadBasedAutoScaling 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 *OpsWorks) DescribeLoadBasedAutoScalingWithContext(ctx aws.Context, input *DescribeLoadBasedAutoScalingInput, opts ...request.Option) (*DescribeLoadBasedAutoScalingOutput, error) { + req, out := c.DescribeLoadBasedAutoScalingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMyUserProfile = "DescribeMyUserProfile" @@ -2443,8 +2936,23 @@ func (c *OpsWorks) DescribeMyUserProfileRequest(input *DescribeMyUserProfileInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeMyUserProfile func (c *OpsWorks) DescribeMyUserProfile(input *DescribeMyUserProfileInput) (*DescribeMyUserProfileOutput, error) { req, out := c.DescribeMyUserProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMyUserProfileWithContext is the same as DescribeMyUserProfile with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMyUserProfile 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 *OpsWorks) DescribeMyUserProfileWithContext(ctx aws.Context, input *DescribeMyUserProfileInput, opts ...request.Option) (*DescribeMyUserProfileOutput, error) { + req, out := c.DescribeMyUserProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribePermissions = "DescribePermissions" @@ -2516,8 +3024,23 @@ func (c *OpsWorks) DescribePermissionsRequest(input *DescribePermissionsInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribePermissions func (c *OpsWorks) DescribePermissions(input *DescribePermissionsInput) (*DescribePermissionsOutput, error) { req, out := c.DescribePermissionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribePermissionsWithContext is the same as DescribePermissions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePermissions 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 *OpsWorks) DescribePermissionsWithContext(ctx aws.Context, input *DescribePermissionsInput, opts ...request.Option) (*DescribePermissionsOutput, error) { + req, out := c.DescribePermissionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeRaidArrays = "DescribeRaidArrays" @@ -2567,7 +3090,7 @@ func (c *OpsWorks) DescribeRaidArraysRequest(input *DescribeRaidArraysInput) (re // // Describe an instance's RAID arrays. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -2591,8 +3114,23 @@ func (c *OpsWorks) DescribeRaidArraysRequest(input *DescribeRaidArraysInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeRaidArrays func (c *OpsWorks) DescribeRaidArrays(input *DescribeRaidArraysInput) (*DescribeRaidArraysOutput, error) { req, out := c.DescribeRaidArraysRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRaidArraysWithContext is the same as DescribeRaidArrays with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRaidArrays 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 *OpsWorks) DescribeRaidArraysWithContext(ctx aws.Context, input *DescribeRaidArraysInput, opts ...request.Option) (*DescribeRaidArraysOutput, error) { + req, out := c.DescribeRaidArraysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeRdsDbInstances = "DescribeRdsDbInstances" @@ -2647,6 +3185,8 @@ func (c *OpsWorks) DescribeRdsDbInstancesRequest(input *DescribeRdsDbInstancesIn // grants permissions. For more information on user permissions, see Managing // User Permissions (http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html). // +// This call accepts only one resource-identifying parameter. +// // 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. @@ -2664,8 +3204,23 @@ func (c *OpsWorks) DescribeRdsDbInstancesRequest(input *DescribeRdsDbInstancesIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeRdsDbInstances func (c *OpsWorks) DescribeRdsDbInstances(input *DescribeRdsDbInstancesInput) (*DescribeRdsDbInstancesOutput, error) { req, out := c.DescribeRdsDbInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeRdsDbInstancesWithContext is the same as DescribeRdsDbInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRdsDbInstances 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 *OpsWorks) DescribeRdsDbInstancesWithContext(ctx aws.Context, input *DescribeRdsDbInstancesInput, opts ...request.Option) (*DescribeRdsDbInstancesOutput, error) { + req, out := c.DescribeRdsDbInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeServiceErrors = "DescribeServiceErrors" @@ -2713,13 +3268,15 @@ func (c *OpsWorks) DescribeServiceErrorsRequest(input *DescribeServiceErrorsInpu // DescribeServiceErrors API operation for AWS OpsWorks. // -// Describes AWS OpsWorks service errors. +// Describes AWS OpsWorks Stacks service errors. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly // grants permissions. For more information on user permissions, see Managing // User Permissions (http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html). // +// This call accepts only one resource-identifying parameter. +// // 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. @@ -2737,8 +3294,23 @@ func (c *OpsWorks) DescribeServiceErrorsRequest(input *DescribeServiceErrorsInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeServiceErrors func (c *OpsWorks) DescribeServiceErrors(input *DescribeServiceErrorsInput) (*DescribeServiceErrorsOutput, error) { req, out := c.DescribeServiceErrorsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeServiceErrorsWithContext is the same as DescribeServiceErrors with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeServiceErrors 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 *OpsWorks) DescribeServiceErrorsWithContext(ctx aws.Context, input *DescribeServiceErrorsInput, opts ...request.Option) (*DescribeServiceErrorsOutput, error) { + req, out := c.DescribeServiceErrorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStackProvisioningParameters = "DescribeStackProvisioningParameters" @@ -2810,8 +3382,23 @@ func (c *OpsWorks) DescribeStackProvisioningParametersRequest(input *DescribeSta // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeStackProvisioningParameters func (c *OpsWorks) DescribeStackProvisioningParameters(input *DescribeStackProvisioningParametersInput) (*DescribeStackProvisioningParametersOutput, error) { req, out := c.DescribeStackProvisioningParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStackProvisioningParametersWithContext is the same as DescribeStackProvisioningParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStackProvisioningParameters 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 *OpsWorks) DescribeStackProvisioningParametersWithContext(ctx aws.Context, input *DescribeStackProvisioningParametersInput, opts ...request.Option) (*DescribeStackProvisioningParametersOutput, error) { + req, out := c.DescribeStackProvisioningParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStackSummary = "DescribeStackSummary" @@ -2884,8 +3471,23 @@ func (c *OpsWorks) DescribeStackSummaryRequest(input *DescribeStackSummaryInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeStackSummary func (c *OpsWorks) DescribeStackSummary(input *DescribeStackSummaryInput) (*DescribeStackSummaryOutput, error) { req, out := c.DescribeStackSummaryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStackSummaryWithContext is the same as DescribeStackSummary with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStackSummary 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 *OpsWorks) DescribeStackSummaryWithContext(ctx aws.Context, input *DescribeStackSummaryInput, opts ...request.Option) (*DescribeStackSummaryOutput, error) { + req, out := c.DescribeStackSummaryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStacks = "DescribeStacks" @@ -2957,8 +3559,23 @@ func (c *OpsWorks) DescribeStacksRequest(input *DescribeStacksInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeStacks func (c *OpsWorks) DescribeStacks(input *DescribeStacksInput) (*DescribeStacksOutput, error) { req, out := c.DescribeStacksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStacksWithContext is the same as DescribeStacks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStacks 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 *OpsWorks) DescribeStacksWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...request.Option) (*DescribeStacksOutput, error) { + req, out := c.DescribeStacksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTimeBasedAutoScaling = "DescribeTimeBasedAutoScaling" @@ -3032,8 +3649,23 @@ func (c *OpsWorks) DescribeTimeBasedAutoScalingRequest(input *DescribeTimeBasedA // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeTimeBasedAutoScaling func (c *OpsWorks) DescribeTimeBasedAutoScaling(input *DescribeTimeBasedAutoScalingInput) (*DescribeTimeBasedAutoScalingOutput, error) { req, out := c.DescribeTimeBasedAutoScalingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTimeBasedAutoScalingWithContext is the same as DescribeTimeBasedAutoScaling with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTimeBasedAutoScaling 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 *OpsWorks) DescribeTimeBasedAutoScalingWithContext(ctx aws.Context, input *DescribeTimeBasedAutoScalingInput, opts ...request.Option) (*DescribeTimeBasedAutoScalingOutput, error) { + req, out := c.DescribeTimeBasedAutoScalingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeUserProfiles = "DescribeUserProfiles" @@ -3104,8 +3736,23 @@ func (c *OpsWorks) DescribeUserProfilesRequest(input *DescribeUserProfilesInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeUserProfiles func (c *OpsWorks) DescribeUserProfiles(input *DescribeUserProfilesInput) (*DescribeUserProfilesOutput, error) { req, out := c.DescribeUserProfilesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeUserProfilesWithContext is the same as DescribeUserProfiles with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeUserProfiles 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 *OpsWorks) DescribeUserProfilesWithContext(ctx aws.Context, input *DescribeUserProfilesInput, opts ...request.Option) (*DescribeUserProfilesOutput, error) { + req, out := c.DescribeUserProfilesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeVolumes = "DescribeVolumes" @@ -3155,7 +3802,7 @@ func (c *OpsWorks) DescribeVolumesRequest(input *DescribeVolumesInput) (req *req // // Describes an instance's Amazon EBS volumes. // -// You must specify at least one of the parameters. +// This call accepts only one resource-identifying parameter. // // Required Permissions: To use this action, an IAM user must have a Show, Deploy, // or Manage permissions level for the stack, or an attached policy that explicitly @@ -3179,8 +3826,23 @@ func (c *OpsWorks) DescribeVolumesRequest(input *DescribeVolumesInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeVolumes func (c *OpsWorks) DescribeVolumes(input *DescribeVolumesInput) (*DescribeVolumesOutput, error) { req, out := c.DescribeVolumesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeVolumesWithContext is the same as DescribeVolumes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVolumes 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 *OpsWorks) DescribeVolumesWithContext(ctx aws.Context, input *DescribeVolumesInput, opts ...request.Option) (*DescribeVolumesOutput, error) { + req, out := c.DescribeVolumesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDetachElasticLoadBalancer = "DetachElasticLoadBalancer" @@ -3251,8 +3913,23 @@ func (c *OpsWorks) DetachElasticLoadBalancerRequest(input *DetachElasticLoadBala // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DetachElasticLoadBalancer func (c *OpsWorks) DetachElasticLoadBalancer(input *DetachElasticLoadBalancerInput) (*DetachElasticLoadBalancerOutput, error) { req, out := c.DetachElasticLoadBalancerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DetachElasticLoadBalancerWithContext is the same as DetachElasticLoadBalancer with the addition of +// the ability to pass a context and additional request options. +// +// See DetachElasticLoadBalancer 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 *OpsWorks) DetachElasticLoadBalancerWithContext(ctx aws.Context, input *DetachElasticLoadBalancerInput, opts ...request.Option) (*DetachElasticLoadBalancerOutput, error) { + req, out := c.DetachElasticLoadBalancerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisassociateElasticIp = "DisassociateElasticIp" @@ -3328,8 +4005,23 @@ func (c *OpsWorks) DisassociateElasticIpRequest(input *DisassociateElasticIpInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DisassociateElasticIp func (c *OpsWorks) DisassociateElasticIp(input *DisassociateElasticIpInput) (*DisassociateElasticIpOutput, error) { req, out := c.DisassociateElasticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisassociateElasticIpWithContext is the same as DisassociateElasticIp with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateElasticIp 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 *OpsWorks) DisassociateElasticIpWithContext(ctx aws.Context, input *DisassociateElasticIpInput, opts ...request.Option) (*DisassociateElasticIpOutput, error) { + req, out := c.DisassociateElasticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHostnameSuggestion = "GetHostnameSuggestion" @@ -3402,8 +4094,23 @@ func (c *OpsWorks) GetHostnameSuggestionRequest(input *GetHostnameSuggestionInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/GetHostnameSuggestion func (c *OpsWorks) GetHostnameSuggestion(input *GetHostnameSuggestionInput) (*GetHostnameSuggestionOutput, error) { req, out := c.GetHostnameSuggestionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHostnameSuggestionWithContext is the same as GetHostnameSuggestion with the addition of +// the ability to pass a context and additional request options. +// +// See GetHostnameSuggestion 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 *OpsWorks) GetHostnameSuggestionWithContext(ctx aws.Context, input *GetHostnameSuggestionInput, opts ...request.Option) (*GetHostnameSuggestionOutput, error) { + req, out := c.GetHostnameSuggestionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGrantAccess = "GrantAccess" @@ -3472,8 +4179,23 @@ func (c *OpsWorks) GrantAccessRequest(input *GrantAccessInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/GrantAccess func (c *OpsWorks) GrantAccess(input *GrantAccessInput) (*GrantAccessOutput, error) { req, out := c.GrantAccessRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GrantAccessWithContext is the same as GrantAccess with the addition of +// the ability to pass a context and additional request options. +// +// See GrantAccess 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 *OpsWorks) GrantAccessWithContext(ctx aws.Context, input *GrantAccessInput, opts ...request.Option) (*GrantAccessOutput, error) { + req, out := c.GrantAccessRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRebootInstance = "RebootInstance" @@ -3548,8 +4270,23 @@ func (c *OpsWorks) RebootInstanceRequest(input *RebootInstanceInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/RebootInstance func (c *OpsWorks) RebootInstance(input *RebootInstanceInput) (*RebootInstanceOutput, error) { req, out := c.RebootInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RebootInstanceWithContext is the same as RebootInstance with the addition of +// the ability to pass a context and additional request options. +// +// See RebootInstance 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 *OpsWorks) RebootInstanceWithContext(ctx aws.Context, input *RebootInstanceInput, opts ...request.Option) (*RebootInstanceOutput, error) { + req, out := c.RebootInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterEcsCluster = "RegisterEcsCluster" @@ -3623,8 +4360,23 @@ func (c *OpsWorks) RegisterEcsClusterRequest(input *RegisterEcsClusterInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/RegisterEcsCluster func (c *OpsWorks) RegisterEcsCluster(input *RegisterEcsClusterInput) (*RegisterEcsClusterOutput, error) { req, out := c.RegisterEcsClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterEcsClusterWithContext is the same as RegisterEcsCluster with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterEcsCluster 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 *OpsWorks) RegisterEcsClusterWithContext(ctx aws.Context, input *RegisterEcsClusterInput, opts ...request.Option) (*RegisterEcsClusterOutput, error) { + req, out := c.RegisterEcsClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterElasticIp = "RegisterElasticIp" @@ -3699,8 +4451,23 @@ func (c *OpsWorks) RegisterElasticIpRequest(input *RegisterElasticIpInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/RegisterElasticIp func (c *OpsWorks) RegisterElasticIp(input *RegisterElasticIpInput) (*RegisterElasticIpOutput, error) { req, out := c.RegisterElasticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterElasticIpWithContext is the same as RegisterElasticIp with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterElasticIp 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 *OpsWorks) RegisterElasticIpWithContext(ctx aws.Context, input *RegisterElasticIpInput, opts ...request.Option) (*RegisterElasticIpOutput, error) { + req, out := c.RegisterElasticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterInstance = "RegisterInstance" @@ -3748,15 +4515,21 @@ func (c *OpsWorks) RegisterInstanceRequest(input *RegisterInstanceInput) (req *r // RegisterInstance API operation for AWS OpsWorks. // -// Registers instances with a specified stack that were created outside of AWS -// OpsWorks. +// Registers instances that were created outside of AWS OpsWorks Stacks with +// a specified stack. // // We do not recommend using this action to register instances. The complete -// registration operation has two primary steps, installing the AWS OpsWorks -// agent on the instance and registering the instance with the stack. RegisterInstance +// registration operation includes two tasks: installing the AWS OpsWorks Stacks +// agent on the instance, and registering the instance with the stack. RegisterInstance // handles only the second step. You should instead use the AWS CLI register // command, which performs the entire registration operation. For more information, -// see Registering an Instance with an AWS OpsWorks Stack (http://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register.html). +// see Registering an Instance with an AWS OpsWorks Stacks Stack (http://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register.html). +// +// Registered instances have the same requirements as instances that are created +// by using the CreateInstance API. For example, registered instances must be +// running a supported Linux-based operating system, and they must have a supported +// instance type. For more information about requirements for instances that +// you want to register, see Preparing the Instance (http://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register-registering-preparer.html). // // Required Permissions: To use this action, an IAM user must have a Manage // permissions level for the stack or an attached policy that explicitly grants @@ -3780,8 +4553,23 @@ func (c *OpsWorks) RegisterInstanceRequest(input *RegisterInstanceInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/RegisterInstance func (c *OpsWorks) RegisterInstance(input *RegisterInstanceInput) (*RegisterInstanceOutput, error) { req, out := c.RegisterInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterInstanceWithContext is the same as RegisterInstance with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterInstance 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 *OpsWorks) RegisterInstanceWithContext(ctx aws.Context, input *RegisterInstanceInput, opts ...request.Option) (*RegisterInstanceOutput, error) { + req, out := c.RegisterInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterRdsDbInstance = "RegisterRdsDbInstance" @@ -3855,8 +4643,23 @@ func (c *OpsWorks) RegisterRdsDbInstanceRequest(input *RegisterRdsDbInstanceInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/RegisterRdsDbInstance func (c *OpsWorks) RegisterRdsDbInstance(input *RegisterRdsDbInstanceInput) (*RegisterRdsDbInstanceOutput, error) { req, out := c.RegisterRdsDbInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterRdsDbInstanceWithContext is the same as RegisterRdsDbInstance with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterRdsDbInstance 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 *OpsWorks) RegisterRdsDbInstanceWithContext(ctx aws.Context, input *RegisterRdsDbInstanceInput, opts ...request.Option) (*RegisterRdsDbInstanceOutput, error) { + req, out := c.RegisterRdsDbInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterVolume = "RegisterVolume" @@ -3931,8 +4734,23 @@ func (c *OpsWorks) RegisterVolumeRequest(input *RegisterVolumeInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/RegisterVolume func (c *OpsWorks) RegisterVolume(input *RegisterVolumeInput) (*RegisterVolumeOutput, error) { req, out := c.RegisterVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterVolumeWithContext is the same as RegisterVolume with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterVolume 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 *OpsWorks) RegisterVolumeWithContext(ctx aws.Context, input *RegisterVolumeInput, opts ...request.Option) (*RegisterVolumeOutput, error) { + req, out := c.RegisterVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetLoadBasedAutoScaling = "SetLoadBasedAutoScaling" @@ -4013,8 +4831,23 @@ func (c *OpsWorks) SetLoadBasedAutoScalingRequest(input *SetLoadBasedAutoScaling // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/SetLoadBasedAutoScaling func (c *OpsWorks) SetLoadBasedAutoScaling(input *SetLoadBasedAutoScalingInput) (*SetLoadBasedAutoScalingOutput, error) { req, out := c.SetLoadBasedAutoScalingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetLoadBasedAutoScalingWithContext is the same as SetLoadBasedAutoScaling with the addition of +// the ability to pass a context and additional request options. +// +// See SetLoadBasedAutoScaling 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 *OpsWorks) SetLoadBasedAutoScalingWithContext(ctx aws.Context, input *SetLoadBasedAutoScalingInput, opts ...request.Option) (*SetLoadBasedAutoScalingOutput, error) { + req, out := c.SetLoadBasedAutoScalingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetPermission = "SetPermission" @@ -4089,8 +4922,23 @@ func (c *OpsWorks) SetPermissionRequest(input *SetPermissionInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/SetPermission func (c *OpsWorks) SetPermission(input *SetPermissionInput) (*SetPermissionOutput, error) { req, out := c.SetPermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetPermissionWithContext is the same as SetPermission with the addition of +// the ability to pass a context and additional request options. +// +// See SetPermission 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 *OpsWorks) SetPermissionWithContext(ctx aws.Context, input *SetPermissionInput, opts ...request.Option) (*SetPermissionOutput, error) { + req, out := c.SetPermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetTimeBasedAutoScaling = "SetTimeBasedAutoScaling" @@ -4166,8 +5014,23 @@ func (c *OpsWorks) SetTimeBasedAutoScalingRequest(input *SetTimeBasedAutoScaling // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/SetTimeBasedAutoScaling func (c *OpsWorks) SetTimeBasedAutoScaling(input *SetTimeBasedAutoScalingInput) (*SetTimeBasedAutoScalingOutput, error) { req, out := c.SetTimeBasedAutoScalingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetTimeBasedAutoScalingWithContext is the same as SetTimeBasedAutoScaling with the addition of +// the ability to pass a context and additional request options. +// +// See SetTimeBasedAutoScaling 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 *OpsWorks) SetTimeBasedAutoScalingWithContext(ctx aws.Context, input *SetTimeBasedAutoScalingInput, opts ...request.Option) (*SetTimeBasedAutoScalingOutput, error) { + req, out := c.SetTimeBasedAutoScalingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartInstance = "StartInstance" @@ -4242,8 +5105,23 @@ func (c *OpsWorks) StartInstanceRequest(input *StartInstanceInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/StartInstance func (c *OpsWorks) StartInstance(input *StartInstanceInput) (*StartInstanceOutput, error) { req, out := c.StartInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartInstanceWithContext is the same as StartInstance with the addition of +// the ability to pass a context and additional request options. +// +// See StartInstance 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 *OpsWorks) StartInstanceWithContext(ctx aws.Context, input *StartInstanceInput, opts ...request.Option) (*StartInstanceOutput, error) { + req, out := c.StartInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartStack = "StartStack" @@ -4317,8 +5195,23 @@ func (c *OpsWorks) StartStackRequest(input *StartStackInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/StartStack func (c *OpsWorks) StartStack(input *StartStackInput) (*StartStackOutput, error) { req, out := c.StartStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartStackWithContext is the same as StartStack with the addition of +// the ability to pass a context and additional request options. +// +// See StartStack 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 *OpsWorks) StartStackWithContext(ctx aws.Context, input *StartStackInput, opts ...request.Option) (*StartStackOutput, error) { + req, out := c.StartStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopInstance = "StopInstance" @@ -4395,8 +5288,23 @@ func (c *OpsWorks) StopInstanceRequest(input *StopInstanceInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/StopInstance func (c *OpsWorks) StopInstance(input *StopInstanceInput) (*StopInstanceOutput, error) { req, out := c.StopInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopInstanceWithContext is the same as StopInstance with the addition of +// the ability to pass a context and additional request options. +// +// See StopInstance 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 *OpsWorks) StopInstanceWithContext(ctx aws.Context, input *StopInstanceInput, opts ...request.Option) (*StopInstanceOutput, error) { + req, out := c.StopInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopStack = "StopStack" @@ -4464,14 +5372,29 @@ func (c *OpsWorks) StopStackRequest(input *StopStackInput) (req *request.Request // * ErrCodeValidationException "ValidationException" // Indicates that a request was not valid. // -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// Indicates that a resource was not found. +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// Indicates that a resource was not found. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/StopStack +func (c *OpsWorks) StopStack(input *StopStackInput) (*StopStackOutput, error) { + req, out := c.StopStackRequest(input) + return out, req.Send() +} + +// StopStackWithContext is the same as StopStack with the addition of +// the ability to pass a context and additional request options. +// +// See StopStack for details on how to use this API operation. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/StopStack -func (c *OpsWorks) StopStack(input *StopStackInput) (*StopStackOutput, error) { +// 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 *OpsWorks) StopStackWithContext(ctx aws.Context, input *StopStackInput, opts ...request.Option) (*StopStackOutput, error) { req, out := c.StopStackRequest(input) - err := req.Send() - return out, err + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnassignInstance = "UnassignInstance" @@ -4524,7 +5447,7 @@ func (c *OpsWorks) UnassignInstanceRequest(input *UnassignInstanceInput) (req *r // Unassigns a registered instance from all of it's layers. The instance remains // in the stack as an unassigned instance and can be assigned to another layer, // as needed. You cannot use this action with instances that were created with -// AWS OpsWorks. +// AWS OpsWorks Stacks. // // Required Permissions: To use this action, an IAM user must have a Manage // permissions level for the stack or an attached policy that explicitly grants @@ -4548,8 +5471,23 @@ func (c *OpsWorks) UnassignInstanceRequest(input *UnassignInstanceInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UnassignInstance func (c *OpsWorks) UnassignInstance(input *UnassignInstanceInput) (*UnassignInstanceOutput, error) { req, out := c.UnassignInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnassignInstanceWithContext is the same as UnassignInstance with the addition of +// the ability to pass a context and additional request options. +// +// See UnassignInstance 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 *OpsWorks) UnassignInstanceWithContext(ctx aws.Context, input *UnassignInstanceInput, opts ...request.Option) (*UnassignInstanceOutput, error) { + req, out := c.UnassignInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnassignVolume = "UnassignVolume" @@ -4624,8 +5562,23 @@ func (c *OpsWorks) UnassignVolumeRequest(input *UnassignVolumeInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UnassignVolume func (c *OpsWorks) UnassignVolume(input *UnassignVolumeInput) (*UnassignVolumeOutput, error) { req, out := c.UnassignVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnassignVolumeWithContext is the same as UnassignVolume with the addition of +// the ability to pass a context and additional request options. +// +// See UnassignVolume 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 *OpsWorks) UnassignVolumeWithContext(ctx aws.Context, input *UnassignVolumeInput, opts ...request.Option) (*UnassignVolumeOutput, error) { + req, out := c.UnassignVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateApp = "UpdateApp" @@ -4699,8 +5652,23 @@ func (c *OpsWorks) UpdateAppRequest(input *UpdateAppInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateApp func (c *OpsWorks) UpdateApp(input *UpdateAppInput) (*UpdateAppOutput, error) { req, out := c.UpdateAppRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAppWithContext is the same as UpdateApp with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateApp 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 *OpsWorks) UpdateAppWithContext(ctx aws.Context, input *UpdateAppInput, opts ...request.Option) (*UpdateAppOutput, error) { + req, out := c.UpdateAppRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateElasticIp = "UpdateElasticIp" @@ -4775,8 +5743,23 @@ func (c *OpsWorks) UpdateElasticIpRequest(input *UpdateElasticIpInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateElasticIp func (c *OpsWorks) UpdateElasticIp(input *UpdateElasticIpInput) (*UpdateElasticIpOutput, error) { req, out := c.UpdateElasticIpRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateElasticIpWithContext is the same as UpdateElasticIp with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateElasticIp 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 *OpsWorks) UpdateElasticIpWithContext(ctx aws.Context, input *UpdateElasticIpInput, opts ...request.Option) (*UpdateElasticIpOutput, error) { + req, out := c.UpdateElasticIpRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateInstance = "UpdateInstance" @@ -4850,8 +5833,23 @@ func (c *OpsWorks) UpdateInstanceRequest(input *UpdateInstanceInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateInstance func (c *OpsWorks) UpdateInstance(input *UpdateInstanceInput) (*UpdateInstanceOutput, error) { req, out := c.UpdateInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateInstanceWithContext is the same as UpdateInstance with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateInstance 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 *OpsWorks) UpdateInstanceWithContext(ctx aws.Context, input *UpdateInstanceInput, opts ...request.Option) (*UpdateInstanceOutput, error) { + req, out := c.UpdateInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateLayer = "UpdateLayer" @@ -4925,8 +5923,23 @@ func (c *OpsWorks) UpdateLayerRequest(input *UpdateLayerInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateLayer func (c *OpsWorks) UpdateLayer(input *UpdateLayerInput) (*UpdateLayerOutput, error) { req, out := c.UpdateLayerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateLayerWithContext is the same as UpdateLayer with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateLayer 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 *OpsWorks) UpdateLayerWithContext(ctx aws.Context, input *UpdateLayerInput, opts ...request.Option) (*UpdateLayerOutput, error) { + req, out := c.UpdateLayerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateMyUserProfile = "UpdateMyUserProfile" @@ -4996,8 +6009,23 @@ func (c *OpsWorks) UpdateMyUserProfileRequest(input *UpdateMyUserProfileInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateMyUserProfile func (c *OpsWorks) UpdateMyUserProfile(input *UpdateMyUserProfileInput) (*UpdateMyUserProfileOutput, error) { req, out := c.UpdateMyUserProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateMyUserProfileWithContext is the same as UpdateMyUserProfile with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateMyUserProfile 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 *OpsWorks) UpdateMyUserProfileWithContext(ctx aws.Context, input *UpdateMyUserProfileInput, opts ...request.Option) (*UpdateMyUserProfileOutput, error) { + req, out := c.UpdateMyUserProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateRdsDbInstance = "UpdateRdsDbInstance" @@ -5071,8 +6099,23 @@ func (c *OpsWorks) UpdateRdsDbInstanceRequest(input *UpdateRdsDbInstanceInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateRdsDbInstance func (c *OpsWorks) UpdateRdsDbInstance(input *UpdateRdsDbInstanceInput) (*UpdateRdsDbInstanceOutput, error) { req, out := c.UpdateRdsDbInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateRdsDbInstanceWithContext is the same as UpdateRdsDbInstance with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRdsDbInstance 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 *OpsWorks) UpdateRdsDbInstanceWithContext(ctx aws.Context, input *UpdateRdsDbInstanceInput, opts ...request.Option) (*UpdateRdsDbInstanceOutput, error) { + req, out := c.UpdateRdsDbInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateStack = "UpdateStack" @@ -5146,8 +6189,23 @@ func (c *OpsWorks) UpdateStackRequest(input *UpdateStackInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateStack func (c *OpsWorks) UpdateStack(input *UpdateStackInput) (*UpdateStackOutput, error) { req, out := c.UpdateStackRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateStackWithContext is the same as UpdateStack with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateStack 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 *OpsWorks) UpdateStackWithContext(ctx aws.Context, input *UpdateStackInput, opts ...request.Option) (*UpdateStackOutput, error) { + req, out := c.UpdateStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateUserProfile = "UpdateUserProfile" @@ -5220,8 +6278,23 @@ func (c *OpsWorks) UpdateUserProfileRequest(input *UpdateUserProfileInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateUserProfile func (c *OpsWorks) UpdateUserProfile(input *UpdateUserProfileInput) (*UpdateUserProfileOutput, error) { req, out := c.UpdateUserProfileRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateUserProfileWithContext is the same as UpdateUserProfile with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateUserProfile 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 *OpsWorks) UpdateUserProfileWithContext(ctx aws.Context, input *UpdateUserProfileInput, opts ...request.Option) (*UpdateUserProfileOutput, error) { + req, out := c.UpdateUserProfileRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateVolume = "UpdateVolume" @@ -5296,8 +6369,23 @@ func (c *OpsWorks) UpdateVolumeRequest(input *UpdateVolumeInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/UpdateVolume func (c *OpsWorks) UpdateVolume(input *UpdateVolumeInput) (*UpdateVolumeOutput, error) { req, out := c.UpdateVolumeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateVolumeWithContext is the same as UpdateVolume with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateVolume 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 *OpsWorks) UpdateVolumeWithContext(ctx aws.Context, input *UpdateVolumeInput, opts ...request.Option) (*UpdateVolumeOutput, error) { + req, out := c.UpdateVolumeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Describes an agent version. @@ -5752,7 +6840,7 @@ func (s AttachElasticLoadBalancerOutput) GoString() string { } // Describes a load-based auto scaling upscaling or downscaling threshold configuration, -// which specifies when AWS OpsWorks starts or stops load-based instances. +// which specifies when AWS OpsWorks Stacks starts or stops load-based instances. // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/AutoScalingThresholds type AutoScalingThresholds struct { _ struct{} `type:"structure"` @@ -5762,9 +6850,9 @@ type AutoScalingThresholds struct { // be in the same region as the stack. // // To use custom alarms, you must update your service role to allow cloudwatch:DescribeAlarms. - // You can either have AWS OpsWorks update the role for you when you first use - // this feature or you can edit the role manually. For more information, see - // Allowing AWS OpsWorks to Act on Your Behalf (http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-servicerole.html). + // You can either have AWS OpsWorks Stacks update the role for you when you + // first use this feature or you can edit the role manually. For more information, + // see Allowing AWS OpsWorks Stacks to Act on Your Behalf (http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-servicerole.html). Alarms []*string `type:"list"` // The CPU utilization threshold, as a percent of the available CPU. A value @@ -5772,13 +6860,13 @@ type AutoScalingThresholds struct { CpuThreshold *float64 `type:"double"` // The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks - // should ignore metrics and suppress additional scaling events. For example, - // AWS OpsWorks adds new instances following an upscaling event but the instances - // won't start reducing the load until they have been booted and configured. - // There is no point in raising additional scaling events during that operation, - // which typically takes several minutes. IgnoreMetricsTime allows you to direct - // AWS OpsWorks to suppress scaling events long enough to get the new instances - // online. + // Stacks should ignore metrics and suppress additional scaling events. For + // example, AWS OpsWorks Stacks adds new instances following an upscaling event + // but the instances won't start reducing the load until they have been booted + // and configured. There is no point in raising additional scaling events during + // that operation, which typically takes several minutes. IgnoreMetricsTime + // allows you to direct AWS OpsWorks Stacks to suppress scaling events long + // enough to get the new instances online. IgnoreMetricsTime *int64 `min:"1" type:"integer"` // The number of instances to add or remove when the load exceeds a threshold. @@ -5874,7 +6962,7 @@ type BlockDeviceMapping struct { // The device name that is exposed to the instance, such as /dev/sdh. For the // root device, you can use the explicit device name or you can set this parameter - // to ROOT_DEVICE and AWS OpsWorks will provide the correct device name. + // to ROOT_DEVICE and AWS OpsWorks Stacks will provide the correct device name. DeviceName *string `type:"string"` // An EBSBlockDevice that defines how to configure an Amazon EBS volume when @@ -5960,20 +7048,21 @@ func (s *ChefConfiguration) SetManageBerkshelf(v bool) *ChefConfiguration { type CloneStackInput struct { _ struct{} `type:"structure"` - // The default AWS OpsWorks agent version. You have the following options: + // The default AWS OpsWorks Stacks agent version. You have the following options: // - // * Auto-update - Set this parameter to LATEST. AWS OpsWorks automatically + // * Auto-update - Set this parameter to LATEST. AWS OpsWorks Stacks automatically // installs new agent versions on the stack's instances as soon as they are // available. // // * Fixed version - Set this parameter to your preferred agent version. // To update the agent version, you must edit the stack configuration and - // specify a new version. AWS OpsWorks then automatically installs that version - // on the stack's instances. + // specify a new version. AWS OpsWorks Stacks then automatically installs + // that version on the stack's instances. // // The default setting is LATEST. To specify an agent version, you must use // the complete version number, not the abbreviated number shown on the console. // For a list of available agent version numbers, call DescribeAgentVersions. + // AgentVersion cannot be set to Chef 12.2. // // You can also specify an agent version when you create or update an instance, // which overrides the stack's default setting. @@ -6029,12 +7118,13 @@ type CloneStackInput struct { // The stack's operating system, which must be set to one of the following. // // * A supported Linux operating system: An Amazon Linux version, such as - // Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon Linux 2015.03. + // Amazon Linux 2016.09, Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon + // Linux 2015.03. // // * A supported Ubuntu operating system, such as Ubuntu 16.04 LTS, Ubuntu // 14.04 LTS, or Ubuntu 12.04 LTS. // - // * CentOS 7 + // * CentOS Linux 7 // // * Red Hat Enterprise Linux 7 // @@ -6047,7 +7137,8 @@ type CloneStackInput struct { // OpsWorks, see Using Custom AMIs (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-custom-ami.html). // // The default option is the parent stack's operating system. For more information - // on the supported operating systems, see AWS OpsWorks Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). + // on the supported operating systems, see AWS OpsWorks Stacks Operating Systems + // (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). // // You can specify a different Linux operating system for the cloned stack, // but you cannot change from Linux to Windows or Windows to Linux. @@ -6114,11 +7205,12 @@ type CloneStackInput struct { Region *string `type:"string"` // The stack AWS Identity and Access Management (IAM) role, which allows AWS - // OpsWorks to work with AWS resources on your behalf. You must set this parameter - // to the Amazon Resource Name (ARN) for an existing IAM role. If you create - // a stack by using the AWS OpsWorks console, it creates the role for you. You - // can obtain an existing stack's IAM ARN programmatically by calling DescribePermissions. - // For more information about IAM ARNs, see Using Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html). + // OpsWorks Stacks to work with AWS resources on your behalf. You must set this + // parameter to the Amazon Resource Name (ARN) for an existing IAM role. If + // you create a stack by using the AWS OpsWorks Stacks console, it creates the + // role for you. You can obtain an existing stack's IAM ARN programmatically + // by calling DescribePermissions. For more information about IAM ARNs, see + // Using Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html). // // You must set this parameter to a valid service role ARN or the action will // fail; there is no default value. You can specify the source stack's service @@ -6135,25 +7227,25 @@ type CloneStackInput struct { // Whether to use custom cookbooks. UseCustomCookbooks *bool `type:"boolean"` - // Whether to associate the AWS OpsWorks built-in security groups with the stack's - // layers. + // Whether to associate the AWS OpsWorks Stacks built-in security groups with + // the stack's layers. // - // AWS OpsWorks provides a standard set of built-in security groups, one for - // each layer, which are associated with layers by default. With UseOpsworksSecurityGroups + // AWS OpsWorks Stacks provides a standard set of built-in security groups, + // one for each layer, which are associated with layers by default. With UseOpsworksSecurityGroups // you can instead provide your own custom security groups. UseOpsworksSecurityGroups // has the following settings: // - // * True - AWS OpsWorks automatically associates the appropriate built-in - // security group with each layer (default setting). You can associate additional - // security groups with a layer after you create it but you cannot delete - // the built-in security group. + // * True - AWS OpsWorks Stacks automatically associates the appropriate + // built-in security group with each layer (default setting). You can associate + // additional security groups with a layer after you create it but you cannot + // delete the built-in security group. // - // * False - AWS OpsWorks does not associate built-in security groups with - // layers. You must create appropriate Amazon Elastic Compute Cloud (Amazon - // EC2) security groups and associate a security group with each layer that - // you create. However, you can still manually associate a built-in security - // group with a layer on creation; custom security groups are required only - // for those layers that need custom settings. + // * False - AWS OpsWorks Stacks does not associate built-in security groups + // with layers. You must create appropriate Amazon Elastic Compute Cloud + // (Amazon EC2) security groups and associate a security group with each + // layer that you create. However, you can still manually associate a built-in + // security group with a layer on creation; custom security groups are required + // only for those layers that need custom settings. // // For more information, see Create a New Stack (http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-creating.html). UseOpsworksSecurityGroups *bool `type:"boolean"` @@ -6169,9 +7261,10 @@ type CloneStackInput struct { // // If the VPC ID corresponds to a default VPC and you have specified either // the DefaultAvailabilityZone or the DefaultSubnetId parameter only, AWS OpsWorks - // infers the value of the other parameter. If you specify neither parameter, - // AWS OpsWorks sets these parameters to the first valid Availability Zone for - // the specified region and the corresponding default VPC subnet ID, respectively. + // Stacks infers the value of the other parameter. If you specify neither parameter, + // AWS OpsWorks Stacks sets these parameters to the first valid Availability + // Zone for the specified region and the corresponding default VPC subnet ID, + // respectively. // // If you specify a nondefault VPC ID, note the following: // @@ -6179,8 +7272,8 @@ type CloneStackInput struct { // // * You must specify a value for DefaultSubnetId. // - // For more information on how to use AWS OpsWorks with a VPC, see Running a - // Stack in a VPC (http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-vpc.html). + // For more information on how to use AWS OpsWorks Stacks with a VPC, see Running + // a Stack in a VPC (http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-vpc.html). // For more information on default VPC and EC2 Classic, see Supported Platforms // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html). VpcId *string `type:"string"` @@ -6369,6 +7462,185 @@ func (s *CloneStackOutput) SetStackId(v string) *CloneStackOutput { return s } +// Describes the Amazon CloudWatch logs configuration for a layer. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CloudWatchLogsConfiguration +type CloudWatchLogsConfiguration struct { + _ struct{} `type:"structure"` + + // Whether CloudWatch Logs is enabled for a layer. + Enabled *bool `type:"boolean"` + + // A list of configuration options for CloudWatch Logs. + LogStreams []*CloudWatchLogsLogStream `type:"list"` +} + +// String returns the string representation +func (s CloudWatchLogsConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CloudWatchLogsConfiguration) GoString() string { + return s.String() +} + +// SetEnabled sets the Enabled field's value. +func (s *CloudWatchLogsConfiguration) SetEnabled(v bool) *CloudWatchLogsConfiguration { + s.Enabled = &v + return s +} + +// SetLogStreams sets the LogStreams field's value. +func (s *CloudWatchLogsConfiguration) SetLogStreams(v []*CloudWatchLogsLogStream) *CloudWatchLogsConfiguration { + s.LogStreams = v + return s +} + +// Describes the Amazon CloudWatch logs configuration for a layer. For detailed +// information about members of this data type, see the CloudWatch Logs Agent +// Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html). +// Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/CloudWatchLogsLogStream +type CloudWatchLogsLogStream struct { + _ struct{} `type:"structure"` + + // Specifies the max number of log events in a batch, up to 10000. The default + // value is 1000. + BatchCount *int64 `type:"integer"` + + // Specifies the maximum size of log events in a batch, in bytes, up to 1048576 + // bytes. The default value is 32768 bytes. This size is calculated as the sum + // of all event messages in UTF-8, plus 26 bytes for each log event. + BatchSize *int64 `type:"integer"` + + // Specifies the time duration for the batching of log events. The minimum value + // is 5000ms and default value is 5000ms. + BufferDuration *int64 `type:"integer"` + + // Specifies how the time stamp is extracted from logs. For more information, + // see the CloudWatch Logs Agent Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html). + DatetimeFormat *string `type:"string"` + + // Specifies the encoding of the log file so that the file can be read correctly. + // The default is utf_8. Encodings supported by Python codecs.decode() can be + // used here. + Encoding *string `type:"string" enum:"CloudWatchLogsEncoding"` + + // Specifies log files that you want to push to CloudWatch Logs. + // + // File can point to a specific file or multiple files (by using wild card characters + // such as /var/log/system.log*). Only the latest file is pushed to CloudWatch + // Logs, based on file modification time. We recommend that you use wild card + // characters to specify a series of files of the same type, such as access_log.2014-06-01-01, + // access_log.2014-06-01-02, and so on by using a pattern like access_log.*. + // Don't use a wildcard to match multiple file types, such as access_log_80 + // and access_log_443. To specify multiple, different file types, add another + // log stream entry to the configuration file, so that each log file type is + // stored in a different log group. + // + // Zipped files are not supported. + File *string `type:"string"` + + // Specifies the range of lines for identifying a file. The valid values are + // one number, or two dash-delimited numbers, such as '1', '2-5'. The default + // value is '1', meaning the first line is used to calculate the fingerprint. + // Fingerprint lines are not sent to CloudWatch Logs unless all specified lines + // are available. + FileFingerprintLines *string `type:"string"` + + // Specifies where to start to read data (start_of_file or end_of_file). The + // default is start_of_file. This setting is only used if there is no state + // persisted for that log stream. + InitialPosition *string `type:"string" enum:"CloudWatchLogsInitialPosition"` + + // Specifies the destination log group. A log group is created automatically + // if it doesn't already exist. Log group names can be between 1 and 512 characters + // long. Allowed characters include a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), + // '/' (forward slash), and '.' (period). + LogGroupName *string `type:"string"` + + // Specifies the pattern for identifying the start of a log message. + MultiLineStartPattern *string `type:"string"` + + // Specifies the time zone of log event time stamps. + TimeZone *string `type:"string" enum:"CloudWatchLogsTimeZone"` +} + +// String returns the string representation +func (s CloudWatchLogsLogStream) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CloudWatchLogsLogStream) GoString() string { + return s.String() +} + +// SetBatchCount sets the BatchCount field's value. +func (s *CloudWatchLogsLogStream) SetBatchCount(v int64) *CloudWatchLogsLogStream { + s.BatchCount = &v + return s +} + +// SetBatchSize sets the BatchSize field's value. +func (s *CloudWatchLogsLogStream) SetBatchSize(v int64) *CloudWatchLogsLogStream { + s.BatchSize = &v + return s +} + +// SetBufferDuration sets the BufferDuration field's value. +func (s *CloudWatchLogsLogStream) SetBufferDuration(v int64) *CloudWatchLogsLogStream { + s.BufferDuration = &v + return s +} + +// SetDatetimeFormat sets the DatetimeFormat field's value. +func (s *CloudWatchLogsLogStream) SetDatetimeFormat(v string) *CloudWatchLogsLogStream { + s.DatetimeFormat = &v + return s +} + +// SetEncoding sets the Encoding field's value. +func (s *CloudWatchLogsLogStream) SetEncoding(v string) *CloudWatchLogsLogStream { + s.Encoding = &v + return s +} + +// SetFile sets the File field's value. +func (s *CloudWatchLogsLogStream) SetFile(v string) *CloudWatchLogsLogStream { + s.File = &v + return s +} + +// SetFileFingerprintLines sets the FileFingerprintLines field's value. +func (s *CloudWatchLogsLogStream) SetFileFingerprintLines(v string) *CloudWatchLogsLogStream { + s.FileFingerprintLines = &v + return s +} + +// SetInitialPosition sets the InitialPosition field's value. +func (s *CloudWatchLogsLogStream) SetInitialPosition(v string) *CloudWatchLogsLogStream { + s.InitialPosition = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *CloudWatchLogsLogStream) SetLogGroupName(v string) *CloudWatchLogsLogStream { + s.LogGroupName = &v + return s +} + +// SetMultiLineStartPattern sets the MultiLineStartPattern field's value. +func (s *CloudWatchLogsLogStream) SetMultiLineStartPattern(v string) *CloudWatchLogsLogStream { + s.MultiLineStartPattern = &v + return s +} + +// SetTimeZone sets the TimeZone field's value. +func (s *CloudWatchLogsLogStream) SetTimeZone(v string) *CloudWatchLogsLogStream { + s.TimeZone = &v + return s +} + // Describes a command. // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/Command type Command struct { @@ -6560,9 +7832,9 @@ type CreateAppInput struct { // The app type. Each supported type is associated with a particular layer. // For example, PHP applications are associated with a PHP layer. AWS OpsWorks - // deploys an application to those instances that are members of the corresponding - // layer. If your app isn't one of the standard types, or you prefer to implement - // your own Deploy recipes, specify other. + // Stacks deploys an application to those instances that are members of the + // corresponding layer. If your app isn't one of the standard types, or you + // prefer to implement your own Deploy recipes, specify other. // // Type is a required field Type *string `type:"string" required:"true" enum:"AppType"` @@ -6851,18 +8123,19 @@ func (s *CreateDeploymentOutput) SetDeploymentId(v string) *CreateDeploymentOutp type CreateInstanceInput struct { _ struct{} `type:"structure"` - // The default AWS OpsWorks agent version. You have the following options: + // The default AWS OpsWorks Stacks agent version. You have the following options: // // * INHERIT - Use the stack's default agent version setting. // // * version_number - Use the specified agent version. This value overrides // the stack's default setting. To update the agent version, edit the instance - // configuration and specify a new version. AWS OpsWorks then automatically + // configuration and specify a new version. AWS OpsWorks Stacks then automatically // installs that version on the instance. // // The default setting is INHERIT. To specify an agent version, you must use // the complete version number, not the abbreviated number shown on the console. // For a list of available agent version numbers, call DescribeAgentVersions. + // AgentVersion cannot be set to Chef 12.2. AgentVersion *string `type:"string"` // A custom AMI ID to be used to create the instance. The AMI should be based @@ -6925,12 +8198,13 @@ type CreateInstanceInput struct { // The instance's operating system, which must be set to one of the following. // // * A supported Linux operating system: An Amazon Linux version, such as - // Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon Linux 2015.03. + // Amazon Linux 2016.09, Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon + // Linux 2015.03. // // * A supported Ubuntu operating system, such as Ubuntu 16.04 LTS, Ubuntu // 14.04 LTS, or Ubuntu 12.04 LTS. // - // * CentOS 7 + // * CentOS Linux 7 // // * Red Hat Enterprise Linux 7 // @@ -6942,15 +8216,15 @@ type CreateInstanceInput struct { // * A custom AMI: Custom. // // For more information on the supported operating systems, see AWS OpsWorks - // Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). + // Stacks Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). // // The default option is the current Amazon Linux version. If you set this parameter // to Custom, you must use the CreateInstance action's AmiId parameter to specify // the custom AMI that you want to use. Block device mappings are not supported // if the value is Custom. For more information on the supported operating systems, // see Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html)For - // more information on how to use custom AMIs with AWS OpsWorks, see Using Custom - // AMIs (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-custom-ami.html). + // more information on how to use custom AMIs with AWS OpsWorks Stacks, see + // Using Custom AMIs (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-custom-ami.html). Os *string `type:"string"` // The instance root device type. For more information, see Storage for the @@ -6967,7 +8241,7 @@ type CreateInstanceInput struct { // The ID of the instance's subnet. If the stack is running in a VPC, you can // use this parameter to override the stack's default subnet ID value and direct - // AWS OpsWorks to launch the instance in a different subnet. + // AWS OpsWorks Stacks to launch the instance in a different subnet. SubnetId *string `type:"string"` // The instance's tenancy option. The default option is no tenancy, or if the @@ -7167,6 +8441,10 @@ type CreateLayerInput struct { // a Layer (http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html). AutoAssignPublicIps *bool `type:"boolean"` + // Specifies CloudWatch Logs configuration options for the layer. For more information, + // see CloudWatchLogsLogStream. + CloudWatchLogsConfiguration *CloudWatchLogsConfiguration `type:"structure"` + // The ARN of an IAM profile to be used for the layer's EC2 instances. For more // information about IAM ARNs, see Using Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html). CustomInstanceProfileArn *string `type:"string"` @@ -7210,13 +8488,13 @@ type CreateLayerInput struct { Packages []*string `type:"list"` // For custom layers only, use this parameter to specify the layer's short name, - // which is used internally by AWS OpsWorks and by Chef recipes. The short name - // is also used as the name for the directory where your app files are installed. - // It can have a maximum of 200 characters, which are limited to the alphanumeric - // characters, '-', '_', and '.'. + // which is used internally by AWS OpsWorks Stacks and by Chef recipes. The + // short name is also used as the name for the directory where your app files + // are installed. It can have a maximum of 200 characters, which are limited + // to the alphanumeric characters, '-', '_', and '.'. // - // The built-in layers' short names are defined by AWS OpsWorks. For more information, - // see the Layer Reference (http://docs.aws.amazon.com/opsworks/latest/userguide/layers.html). + // The built-in layers' short names are defined by AWS OpsWorks Stacks. For + // more information, see the Layer Reference (http://docs.aws.amazon.com/opsworks/latest/userguide/layers.html). // // Shortname is a required field Shortname *string `type:"string" required:"true"` @@ -7300,6 +8578,12 @@ func (s *CreateLayerInput) SetAutoAssignPublicIps(v bool) *CreateLayerInput { return s } +// SetCloudWatchLogsConfiguration sets the CloudWatchLogsConfiguration field's value. +func (s *CreateLayerInput) SetCloudWatchLogsConfiguration(v *CloudWatchLogsConfiguration) *CreateLayerInput { + s.CloudWatchLogsConfiguration = v + return s +} + // SetCustomInstanceProfileArn sets the CustomInstanceProfileArn field's value. func (s *CreateLayerInput) SetCustomInstanceProfileArn(v string) *CreateLayerInput { s.CustomInstanceProfileArn = &v @@ -7413,21 +8697,21 @@ func (s *CreateLayerOutput) SetLayerId(v string) *CreateLayerOutput { type CreateStackInput struct { _ struct{} `type:"structure"` - // The default AWS OpsWorks agent version. You have the following options: + // The default AWS OpsWorks Stacks agent version. You have the following options: // - // * Auto-update - Set this parameter to LATEST. AWS OpsWorks automatically + // * Auto-update - Set this parameter to LATEST. AWS OpsWorks Stacks automatically // installs new agent versions on the stack's instances as soon as they are // available. // // * Fixed version - Set this parameter to your preferred agent version. // To update the agent version, you must edit the stack configuration and - // specify a new version. AWS OpsWorks then automatically installs that version - // on the stack's instances. + // specify a new version. AWS OpsWorks Stacks then automatically installs + // that version on the stack's instances. // // The default setting is the most recent release of the agent. To specify an // agent version, you must use the complete version number, not the abbreviated // number shown on the console. For a list of available agent version numbers, - // call DescribeAgentVersions. + // call DescribeAgentVersions. AgentVersion cannot be set to Chef 12.2. // // You can also specify an agent version when you create or update an instance, // which overrides the stack's default setting. @@ -7480,12 +8764,13 @@ type CreateStackInput struct { // You can specify one of the following. // // * A supported Linux operating system: An Amazon Linux version, such as - // Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon Linux 2015.03. + // Amazon Linux 2016.09, Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon + // Linux 2015.03. // // * A supported Ubuntu operating system, such as Ubuntu 16.04 LTS, Ubuntu // 14.04 LTS, or Ubuntu 12.04 LTS. // - // * CentOS 7 + // * CentOS Linux 7 // // * Red Hat Enterprise Linux 7 // @@ -7498,7 +8783,8 @@ type CreateStackInput struct { // you create instances. For more information, see Using Custom AMIs (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-custom-ami.html). // // The default option is the current Amazon Linux version. For more information - // on the supported operating systems, see AWS OpsWorks Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). + // on the supported operating systems, see AWS OpsWorks Stacks Operating Systems + // (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). DefaultOs *string `type:"string"` // The default root device type. This value is the default for all instances @@ -7567,9 +8853,9 @@ type CreateStackInput struct { Region *string `type:"string" required:"true"` // The stack's AWS Identity and Access Management (IAM) role, which allows AWS - // OpsWorks to work with AWS resources on your behalf. You must set this parameter - // to the Amazon Resource Name (ARN) for an existing IAM role. For more information - // about IAM ARNs, see Using Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html). + // OpsWorks Stacks to work with AWS resources on your behalf. You must set this + // parameter to the Amazon Resource Name (ARN) for an existing IAM role. For + // more information about IAM ARNs, see Using Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html). // // ServiceRoleArn is a required field ServiceRoleArn *string `type:"string" required:"true"` @@ -7577,21 +8863,21 @@ type CreateStackInput struct { // Whether the stack uses custom cookbooks. UseCustomCookbooks *bool `type:"boolean"` - // Whether to associate the AWS OpsWorks built-in security groups with the stack's - // layers. + // Whether to associate the AWS OpsWorks Stacks built-in security groups with + // the stack's layers. // - // AWS OpsWorks provides a standard set of built-in security groups, one for - // each layer, which are associated with layers by default. With UseOpsworksSecurityGroups + // AWS OpsWorks Stacks provides a standard set of built-in security groups, + // one for each layer, which are associated with layers by default. With UseOpsworksSecurityGroups // you can instead provide your own custom security groups. UseOpsworksSecurityGroups // has the following settings: // - // * True - AWS OpsWorks automatically associates the appropriate built-in - // security group with each layer (default setting). You can associate additional - // security groups with a layer after you create it, but you cannot delete - // the built-in security group. + // * True - AWS OpsWorks Stacks automatically associates the appropriate + // built-in security group with each layer (default setting). You can associate + // additional security groups with a layer after you create it, but you cannot + // delete the built-in security group. // - // * False - AWS OpsWorks does not associate built-in security groups with - // layers. You must create appropriate EC2 security groups and associate + // * False - AWS OpsWorks Stacks does not associate built-in security groups + // with layers. You must create appropriate EC2 security groups and associate // a security group with each layer that you create. However, you can still // manually associate a built-in security group with a layer on creation; // custom security groups are required only for those layers that need custom @@ -7611,9 +8897,10 @@ type CreateStackInput struct { // // If the VPC ID corresponds to a default VPC and you have specified either // the DefaultAvailabilityZone or the DefaultSubnetId parameter only, AWS OpsWorks - // infers the value of the other parameter. If you specify neither parameter, - // AWS OpsWorks sets these parameters to the first valid Availability Zone for - // the specified region and the corresponding default VPC subnet ID, respectively. + // Stacks infers the value of the other parameter. If you specify neither parameter, + // AWS OpsWorks Stacks sets these parameters to the first valid Availability + // Zone for the specified region and the corresponding default VPC subnet ID, + // respectively. // // If you specify a nondefault VPC ID, note the following: // @@ -7621,8 +8908,8 @@ type CreateStackInput struct { // // * You must specify a value for DefaultSubnetId. // - // For more information on how to use AWS OpsWorks with a VPC, see Running a - // Stack in a VPC (http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-vpc.html). + // For more information on how to use AWS OpsWorks Stacks with a VPC, see Running + // a Stack in a VPC (http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-vpc.html). // For more information on default VPC and EC2-Classic, see Supported Platforms // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html). VpcId *string `type:"string"` @@ -7818,9 +9105,9 @@ type CreateUserProfileInput struct { // The user's SSH user name. The allowable characters are [a-z], [A-Z], [0-9], // '-', and '_'. If the specified name includes other punctuation marks, AWS - // OpsWorks removes them. For example, my.name will be changed to myname. If - // you do not specify an SSH user name, AWS OpsWorks generates one from the - // IAM user name. + // OpsWorks Stacks removes them. For example, my.name will be changed to myname. + // If you do not specify an SSH user name, AWS OpsWorks Stacks generates one + // from the IAM user name. SshUsername *string `type:"string"` } @@ -8382,9 +9669,9 @@ type DeploymentCommand struct { // whose OS you want to upgrade, such as Amazon Linux 2014.09. You must also // set the allow_reboot argument to true. // - // * allow_reboot - Specifies whether to allow AWS OpsWorks to reboot the - // instances if necessary, after installing the updates. This argument can - // be set to either true or false. The default value is false. + // * allow_reboot - Specifies whether to allow AWS OpsWorks Stacks to reboot + // the instances if necessary, after installing the updates. This argument + // can be set to either true or false. The default value is false. // // For example, to upgrade an instance to Amazon Linux 2014.09, set Args to // the following. @@ -8417,9 +9704,9 @@ type DeploymentCommand struct { // The default setting is {"migrate":["false"]}. // // * rollback Roll the app back to the previous version. When you update - // an app, AWS OpsWorks stores the previous version, up to a maximum of five - // versions. You can use this command to roll an app back as many as four - // versions. + // an app, AWS OpsWorks Stacks stores the previous version, up to a maximum + // of five versions. You can use this command to roll an app back as many + // as four versions. // // * start: Start the app's web or application server. // @@ -8688,9 +9975,9 @@ func (s DeregisterRdsDbInstanceOutput) GoString() string { type DeregisterVolumeInput struct { _ struct{} `type:"structure"` - // The AWS OpsWorks volume ID, which is the GUID that AWS OpsWorks assigned - // to the instance when you registered the volume with the stack, not the Amazon - // EC2 volume ID. + // The AWS OpsWorks Stacks volume ID, which is the GUID that AWS OpsWorks Stacks + // assigned to the instance when you registered the volume with the stack, not + // the Amazon EC2 volume ID. // // VolumeId is a required field VolumeId *string `type:"string" required:"true"` @@ -9795,7 +11082,7 @@ func (s *DescribeStackProvisioningParametersInput) SetStackId(v string) *Describ type DescribeStackProvisioningParametersOutput struct { _ struct{} `type:"structure"` - // The AWS OpsWorks agent installer's URL. + // The AWS OpsWorks Stacks agent installer's URL. AgentInstallerUrl *string `type:"string"` // An embedded object that contains the provisioning parameters. @@ -10679,7 +11966,7 @@ func (s *GetHostnameSuggestionOutput) SetLayerId(v string) *GetHostnameSuggestio type GrantAccessInput struct { _ struct{} `type:"structure"` - // The instance's AWS OpsWorks ID. + // The instance's AWS OpsWorks Stacks ID. // // InstanceId is a required field InstanceId *string `type:"string" required:"true"` @@ -10853,7 +12140,7 @@ type Instance struct { // For registered instances, who performed the registration. RegisteredBy *string `type:"string"` - // The instance's reported AWS OpsWorks agent version. + // The instance's reported AWS OpsWorks Stacks agent version. ReportedAgentVersion *string `type:"string"` // For registered instances, the reported operating system. @@ -11404,10 +12691,10 @@ type Layer struct { // The layer attributes. // // For the HaproxyStatsPassword, MysqlRootPassword, and GangliaPassword attributes, - // AWS OpsWorks returns *****FILTERED***** instead of the actual value + // AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value // - // For an ECS Cluster layer, AWS OpsWorks the EcsClusterArn attribute is set - // to the cluster's ARN. + // For an ECS Cluster layer, AWS OpsWorks Stacks the EcsClusterArn attribute + // is set to the cluster's ARN. Attributes map[string]*string `type:"map"` // Whether to automatically assign an Elastic IP address (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) @@ -11419,6 +12706,9 @@ type Layer struct { // a Layer (http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html). AutoAssignPublicIps *bool `type:"boolean"` + // The Amazon CloudWatch Logs configuration settings for the layer. + CloudWatchLogsConfiguration *CloudWatchLogsConfiguration `type:"structure"` + // Date when the layer was created. CreatedAt *string `type:"string"` @@ -11436,12 +12726,13 @@ type Layer struct { // An array containing the layer's custom security group IDs. CustomSecurityGroupIds []*string `type:"list"` - // AWS OpsWorks supports five lifecycle events: setup, configuration, deploy, - // undeploy, and shutdown. For each layer, AWS OpsWorks runs a set of standard - // recipes for each event. In addition, you can provide custom recipes for any - // or all layers and events. AWS OpsWorks runs custom event recipes after the - // standard recipes. LayerCustomRecipes specifies the custom recipes for a particular - // layer to be run in response to each of the five events. + // AWS OpsWorks Stacks supports five lifecycle events: setup, configuration, + // deploy, undeploy, and shutdown. For each layer, AWS OpsWorks Stacks runs + // a set of standard recipes for each event. In addition, you can provide custom + // recipes for any or all layers and events. AWS OpsWorks Stacks runs custom + // event recipes after the standard recipes. LayerCustomRecipes specifies the + // custom recipes for a particular layer to be run in response to each of the + // five events. // // To specify a recipe, use the cookbook's directory name in the repository // followed by two colons and the recipe name, which is the recipe's file name @@ -11521,6 +12812,12 @@ func (s *Layer) SetAutoAssignPublicIps(v bool) *Layer { return s } +// SetCloudWatchLogsConfiguration sets the CloudWatchLogsConfiguration field's value. +func (s *Layer) SetCloudWatchLogsConfiguration(v *CloudWatchLogsConfiguration) *Layer { + s.CloudWatchLogsConfiguration = v + return s +} + // SetCreatedAt sets the CreatedAt field's value. func (s *Layer) SetCreatedAt(v string) *Layer { s.CreatedAt = &v @@ -11660,7 +12957,7 @@ type LoadBasedAutoScalingConfiguration struct { _ struct{} `type:"structure"` // An AutoScalingThresholds object that describes the downscaling configuration, - // which defines how and when AWS OpsWorks reduces the number of instances. + // which defines how and when AWS OpsWorks Stacks reduces the number of instances. DownScaling *AutoScalingThresholds `type:"structure"` // Whether load-based auto scaling is enabled for the layer. @@ -11670,7 +12967,7 @@ type LoadBasedAutoScalingConfiguration struct { LayerId *string `type:"string"` // An AutoScalingThresholds object that describes the upscaling configuration, - // which defines how and when AWS OpsWorks increases the number of instances. + // which defines how and when AWS OpsWorks Stacks increases the number of instances. UpScaling *AutoScalingThresholds `type:"structure"` } @@ -11928,7 +13225,7 @@ type RdsDbInstance struct { // The DB instance identifier. DbInstanceIdentifier *string `type:"string"` - // AWS OpsWorks returns *****FILTERED***** instead of the actual value. + // AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value. DbPassword *string `type:"string"` // The master user name. @@ -11937,9 +13234,10 @@ type RdsDbInstance struct { // The instance's database engine. Engine *string `type:"string"` - // Set to true if AWS OpsWorks was unable to discover the Amazon RDS instance. - // AWS OpsWorks attempts to discover the instance only once. If this value is - // set to true, you must deregister the instance and then register it again. + // Set to true if AWS OpsWorks Stacks is unable to discover the Amazon RDS instance. + // AWS OpsWorks Stacks attempts to discover the instance only once. If this + // value is set to true, you must deregister the instance, and then register + // it again. MissingOnRds *bool `type:"boolean"` // The instance's ARN. @@ -11948,7 +13246,7 @@ type RdsDbInstance struct { // The instance's AWS region. Region *string `type:"string"` - // The ID of the stack that the instance is registered with. + // The ID of the stack with which the instance is registered. StackId *string `type:"string"` } @@ -12070,12 +13368,13 @@ func (s RebootInstanceOutput) GoString() string { return s.String() } -// AWS OpsWorks supports five lifecycle events: setup, configuration, deploy, -// undeploy, and shutdown. For each layer, AWS OpsWorks runs a set of standard -// recipes for each event. In addition, you can provide custom recipes for any -// or all layers and events. AWS OpsWorks runs custom event recipes after the -// standard recipes. LayerCustomRecipes specifies the custom recipes for a particular -// layer to be run in response to each of the five events. +// AWS OpsWorks Stacks supports five lifecycle events: setup, configuration, +// deploy, undeploy, and shutdown. For each layer, AWS OpsWorks Stacks runs +// a set of standard recipes for each event. In addition, you can provide custom +// recipes for any or all layers and events. AWS OpsWorks Stacks runs custom +// event recipes after the standard recipes. LayerCustomRecipes specifies the +// custom recipes for a particular layer to be run in response to each of the +// five events. // // To specify a recipe, use the cookbook's directory name in the repository // followed by two colons and the recipe name, which is the recipe's file name @@ -12396,7 +13695,7 @@ func (s *RegisterInstanceInput) SetStackId(v string) *RegisterInstanceInput { type RegisterInstanceOutput struct { _ struct{} `type:"structure"` - // The registered instance's AWS OpsWorks ID. + // The registered instance's AWS OpsWorks Stacks ID. InstanceId *string `type:"string"` } @@ -12680,7 +13979,7 @@ func (s *SelfUserProfile) SetSshUsername(v string) *SelfUserProfile { return s } -// Describes an AWS OpsWorks service error. +// Describes an AWS OpsWorks Stacks service error. // Please also see https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/ServiceError type ServiceError struct { _ struct{} `type:"structure"` @@ -12756,7 +14055,7 @@ type SetLoadBasedAutoScalingInput struct { // An AutoScalingThresholds object with the downscaling threshold configuration. // If the load falls below these thresholds for a specified amount of time, - // AWS OpsWorks stops a specified number of instances. + // AWS OpsWorks Stacks stops a specified number of instances. DownScaling *AutoScalingThresholds `type:"structure"` // Enables load-based auto scaling for the layer. @@ -12769,7 +14068,7 @@ type SetLoadBasedAutoScalingInput struct { // An AutoScalingThresholds object with the upscaling threshold configuration. // If the load exceeds these thresholds for a specified amount of time, AWS - // OpsWorks starts a specified number of instances. + // OpsWorks Stacks starts a specified number of instances. UpScaling *AutoScalingThresholds `type:"structure"` } @@ -13026,8 +14325,8 @@ type ShutdownEventConfiguration struct { // see Connection Draining (http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#conn-drain) DelayUntilElbConnectionsDrained *bool `type:"boolean"` - // The time, in seconds, that AWS OpsWorks will wait after triggering a Shutdown - // event before shutting down an instance. + // The time, in seconds, that AWS OpsWorks Stacks will wait after triggering + // a Shutdown event before shutting down an instance. ExecutionTimeout *int64 `type:"integer"` } @@ -13070,20 +14369,20 @@ type Source struct { // For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html // (http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html). // - // In responses, AWS OpsWorks returns *****FILTERED***** instead of the actual - // value. + // In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the + // actual value. Password *string `type:"string"` - // The application's version. AWS OpsWorks enables you to easily deploy new - // versions of an application. One of the simplest approaches is to have branches - // or revisions in your repository that represent different versions that can - // potentially be deployed. + // The application's version. AWS OpsWorks Stacks enables you to easily deploy + // new versions of an application. One of the simplest approaches is to have + // branches or revisions in your repository that represent different versions + // that can potentially be deployed. Revision *string `type:"string"` // In requests, the repository's SSH key. // - // In responses, AWS OpsWorks returns *****FILTERED***** instead of the actual - // value. + // In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the + // actual value. SshKey *string `type:"string"` // The repository type. @@ -13296,8 +14595,8 @@ type Stack struct { // Whether the stack uses custom cookbooks. UseCustomCookbooks *bool `type:"boolean"` - // Whether the stack automatically associates the AWS OpsWorks built-in security - // groups with the stack's layers. + // Whether the stack automatically associates the AWS OpsWorks Stacks built-in + // security groups with the stack's layers. UseOpsworksSecurityGroups *bool `type:"boolean"` // The VPC ID; applicable only if the stack is running in a VPC. @@ -13774,7 +15073,7 @@ func (s StopStackOutput) GoString() string { type TemporaryCredential struct { _ struct{} `type:"structure"` - // The instance's AWS OpsWorks ID. + // The instance's AWS OpsWorks Stacks ID. InstanceId *string `type:"string"` // The password. @@ -14206,18 +15505,20 @@ func (s UpdateElasticIpOutput) GoString() string { type UpdateInstanceInput struct { _ struct{} `type:"structure"` - // The default AWS OpsWorks agent version. You have the following options: + // The default AWS OpsWorks Stacks agent version. You have the following options: // // * INHERIT - Use the stack's default agent version setting. // // * version_number - Use the specified agent version. This value overrides // the stack's default setting. To update the agent version, you must edit - // the instance configuration and specify a new version. AWS OpsWorks then - // automatically installs that version on the instance. + // the instance configuration and specify a new version. AWS OpsWorks Stacks + // then automatically installs that version on the instance. // // The default setting is INHERIT. To specify an agent version, you must use // the complete version number, not the abbreviated number shown on the console. // For a list of available agent version numbers, call DescribeAgentVersions. + // + // AgentVersion cannot be set to Chef 12.2. AgentVersion *string `type:"string"` // The ID of the AMI that was used to create the instance. The value of this @@ -14271,12 +15572,13 @@ type UpdateInstanceInput struct { // You cannot update an instance that is using a custom AMI. // // * A supported Linux operating system: An Amazon Linux version, such as - // Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon Linux 2015.03. + // Amazon Linux 2016.09, Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon + // Linux 2015.03. // // * A supported Ubuntu operating system, such as Ubuntu 16.04 LTS, Ubuntu // 14.04 LTS, or Ubuntu 12.04 LTS. // - // * CentOS 7 + // * CentOS Linux 7 // // * Red Hat Enterprise Linux 7 // @@ -14286,7 +15588,7 @@ type UpdateInstanceInput struct { // Windows Server 2012 R2 with SQL Server Web. // // For more information on the supported operating systems, see AWS OpsWorks - // Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). + // Stacks Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). // // The default option is the current Amazon Linux version. If you set this parameter // to Custom, you must use the AmiId parameter to specify the custom AMI that @@ -14429,6 +15731,10 @@ type UpdateLayerInput struct { // a Layer (http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-edit.html). AutoAssignPublicIps *bool `type:"boolean"` + // Specifies CloudWatch Logs configuration options for the layer. For more information, + // see CloudWatchLogsLogStream. + CloudWatchLogsConfiguration *CloudWatchLogsConfiguration `type:"structure"` + // The ARN of an IAM profile to be used for all of the layer's EC2 instances. // For more information about IAM ARNs, see Using Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html). CustomInstanceProfileArn *string `type:"string"` @@ -14471,13 +15777,13 @@ type UpdateLayerInput struct { Packages []*string `type:"list"` // For custom layers only, use this parameter to specify the layer's short name, - // which is used internally by AWS OpsWorksand by Chef. The short name is also - // used as the name for the directory where your app files are installed. It - // can have a maximum of 200 characters and must be in the following format: + // which is used internally by AWS OpsWorks Stacks and by Chef. The short name + // is also used as the name for the directory where your app files are installed. + // It can have a maximum of 200 characters and must be in the following format: // /\A[a-z0-9\-\_\.]+\Z/. // - // The built-in layers' short names are defined by AWS OpsWorks. For more information, - // see the Layer Reference (http://docs.aws.amazon.com/opsworks/latest/userguide/layers.html) + // The built-in layers' short names are defined by AWS OpsWorks Stacks. For + // more information, see the Layer Reference (http://docs.aws.amazon.com/opsworks/latest/userguide/layers.html) Shortname *string `type:"string"` // Whether to use Amazon EBS-optimized instances. @@ -14538,6 +15844,12 @@ func (s *UpdateLayerInput) SetAutoAssignPublicIps(v bool) *UpdateLayerInput { return s } +// SetCloudWatchLogsConfiguration sets the CloudWatchLogsConfiguration field's value. +func (s *UpdateLayerInput) SetCloudWatchLogsConfiguration(v *CloudWatchLogsConfiguration) *UpdateLayerInput { + s.CloudWatchLogsConfiguration = v + return s +} + // SetCustomInstanceProfileArn sets the CustomInstanceProfileArn field's value. func (s *UpdateLayerInput) SetCustomInstanceProfileArn(v string) *UpdateLayerInput { s.CustomInstanceProfileArn = &v @@ -14746,20 +16058,21 @@ func (s UpdateRdsDbInstanceOutput) GoString() string { type UpdateStackInput struct { _ struct{} `type:"structure"` - // The default AWS OpsWorks agent version. You have the following options: + // The default AWS OpsWorks Stacks agent version. You have the following options: // - // * Auto-update - Set this parameter to LATEST. AWS OpsWorks automatically + // * Auto-update - Set this parameter to LATEST. AWS OpsWorks Stacks automatically // installs new agent versions on the stack's instances as soon as they are // available. // // * Fixed version - Set this parameter to your preferred agent version. // To update the agent version, you must edit the stack configuration and - // specify a new version. AWS OpsWorks then automatically installs that version - // on the stack's instances. + // specify a new version. AWS OpsWorks Stacks then automatically installs + // that version on the stack's instances. // // The default setting is LATEST. To specify an agent version, you must use // the complete version number, not the abbreviated number shown on the console. // For a list of available agent version numbers, call DescribeAgentVersions. + // AgentVersion cannot be set to Chef 12.2. // // You can also specify an agent version when you create or update an instance, // which overrides the stack's default setting. @@ -14808,12 +16121,13 @@ type UpdateStackInput struct { // The stack's operating system, which must be set to one of the following: // // * A supported Linux operating system: An Amazon Linux version, such as - // Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon Linux 2015.03. + // Amazon Linux 2016.09, Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon + // Linux 2015.03. // // * A supported Ubuntu operating system, such as Ubuntu 16.04 LTS, Ubuntu // 14.04 LTS, or Ubuntu 12.04 LTS. // - // * CentOS 7 + // * CentOS Linux 7 // // * Red Hat Enterprise Linux 7 // @@ -14827,7 +16141,8 @@ type UpdateStackInput struct { // OpsWorks, see Using Custom AMIs (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-custom-ami.html). // // The default option is the stack's current operating system. For more information - // on the supported operating systems, see AWS OpsWorks Operating Systems (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). + // on the supported operating systems, see AWS OpsWorks Stacks Operating Systems + // (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html). DefaultOs *string `type:"string"` // The default root device type. This value is used by default for all instances @@ -14836,8 +16151,8 @@ type UpdateStackInput struct { DefaultRootDeviceType *string `type:"string" enum:"RootDeviceType"` // A default Amazon EC2 key-pair name. The default value is none. If you specify - // a key-pair name, AWS OpsWorks installs the public key on the instance and - // you can use the private key with an SSH client to log in to the instance. + // a key-pair name, AWS OpsWorks Stacks installs the public key on the instance + // and you can use the private key with an SSH client to log in to the instance. // For more information, see Using SSH to Communicate with an Instance (http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-ssh.html) // and Managing SSH Access (http://docs.aws.amazon.com/opsworks/latest/userguide/security-ssh-access.html). // You can override this setting by specifying a different key pair, or no key @@ -14897,21 +16212,21 @@ type UpdateStackInput struct { // Whether the stack uses custom cookbooks. UseCustomCookbooks *bool `type:"boolean"` - // Whether to associate the AWS OpsWorks built-in security groups with the stack's - // layers. + // Whether to associate the AWS OpsWorks Stacks built-in security groups with + // the stack's layers. // - // AWS OpsWorks provides a standard set of built-in security groups, one for - // each layer, which are associated with layers by default. UseOpsworksSecurityGroups + // AWS OpsWorks Stacks provides a standard set of built-in security groups, + // one for each layer, which are associated with layers by default. UseOpsworksSecurityGroups // allows you to provide your own custom security groups instead of using the // built-in groups. UseOpsworksSecurityGroups has the following settings: // - // * True - AWS OpsWorks automatically associates the appropriate built-in - // security group with each layer (default setting). You can associate additional - // security groups with a layer after you create it, but you cannot delete - // the built-in security group. + // * True - AWS OpsWorks Stacks automatically associates the appropriate + // built-in security group with each layer (default setting). You can associate + // additional security groups with a layer after you create it, but you cannot + // delete the built-in security group. // - // * False - AWS OpsWorks does not associate built-in security groups with - // layers. You must create appropriate EC2 security groups and associate + // * False - AWS OpsWorks Stacks does not associate built-in security groups + // with layers. You must create appropriate EC2 security groups and associate // a security group with each layer that you create. However, you can still // manually associate a built-in security group with a layer on. Custom security // groups are required only for those layers that need custom settings. @@ -15084,9 +16399,9 @@ type UpdateUserProfileInput struct { // The user's SSH user name. The allowable characters are [a-z], [A-Z], [0-9], // '-', and '_'. If the specified name includes other punctuation marks, AWS - // OpsWorks removes them. For example, my.name will be changed to myname. If - // you do not specify an SSH user name, AWS OpsWorks generates one from the - // IAM user name. + // OpsWorks Stacks removes them. For example, my.name will be changed to myname. + // If you do not specify an SSH user name, AWS OpsWorks Stacks generates one + // from the IAM user name. SshUsername *string `type:"string"` } @@ -15671,6 +16986,308 @@ const ( AutoScalingTypeTimer = "timer" ) +// Specifies the encoding of the log file so that the file can be read correctly. +// The default is utf_8. Encodings supported by Python codecs.decode() can be +// used here. +const ( + // CloudWatchLogsEncodingAscii is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingAscii = "ascii" + + // CloudWatchLogsEncodingBig5 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingBig5 = "big5" + + // CloudWatchLogsEncodingBig5hkscs is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingBig5hkscs = "big5hkscs" + + // CloudWatchLogsEncodingCp037 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp037 = "cp037" + + // CloudWatchLogsEncodingCp424 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp424 = "cp424" + + // CloudWatchLogsEncodingCp437 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp437 = "cp437" + + // CloudWatchLogsEncodingCp500 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp500 = "cp500" + + // CloudWatchLogsEncodingCp720 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp720 = "cp720" + + // CloudWatchLogsEncodingCp737 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp737 = "cp737" + + // CloudWatchLogsEncodingCp775 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp775 = "cp775" + + // CloudWatchLogsEncodingCp850 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp850 = "cp850" + + // CloudWatchLogsEncodingCp852 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp852 = "cp852" + + // CloudWatchLogsEncodingCp855 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp855 = "cp855" + + // CloudWatchLogsEncodingCp856 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp856 = "cp856" + + // CloudWatchLogsEncodingCp857 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp857 = "cp857" + + // CloudWatchLogsEncodingCp858 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp858 = "cp858" + + // CloudWatchLogsEncodingCp860 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp860 = "cp860" + + // CloudWatchLogsEncodingCp861 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp861 = "cp861" + + // CloudWatchLogsEncodingCp862 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp862 = "cp862" + + // CloudWatchLogsEncodingCp863 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp863 = "cp863" + + // CloudWatchLogsEncodingCp864 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp864 = "cp864" + + // CloudWatchLogsEncodingCp865 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp865 = "cp865" + + // CloudWatchLogsEncodingCp866 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp866 = "cp866" + + // CloudWatchLogsEncodingCp869 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp869 = "cp869" + + // CloudWatchLogsEncodingCp874 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp874 = "cp874" + + // CloudWatchLogsEncodingCp875 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp875 = "cp875" + + // CloudWatchLogsEncodingCp932 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp932 = "cp932" + + // CloudWatchLogsEncodingCp949 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp949 = "cp949" + + // CloudWatchLogsEncodingCp950 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp950 = "cp950" + + // CloudWatchLogsEncodingCp1006 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1006 = "cp1006" + + // CloudWatchLogsEncodingCp1026 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1026 = "cp1026" + + // CloudWatchLogsEncodingCp1140 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1140 = "cp1140" + + // CloudWatchLogsEncodingCp1250 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1250 = "cp1250" + + // CloudWatchLogsEncodingCp1251 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1251 = "cp1251" + + // CloudWatchLogsEncodingCp1252 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1252 = "cp1252" + + // CloudWatchLogsEncodingCp1253 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1253 = "cp1253" + + // CloudWatchLogsEncodingCp1254 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1254 = "cp1254" + + // CloudWatchLogsEncodingCp1255 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1255 = "cp1255" + + // CloudWatchLogsEncodingCp1256 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1256 = "cp1256" + + // CloudWatchLogsEncodingCp1257 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1257 = "cp1257" + + // CloudWatchLogsEncodingCp1258 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingCp1258 = "cp1258" + + // CloudWatchLogsEncodingEucJp is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingEucJp = "euc_jp" + + // CloudWatchLogsEncodingEucJis2004 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingEucJis2004 = "euc_jis_2004" + + // CloudWatchLogsEncodingEucJisx0213 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingEucJisx0213 = "euc_jisx0213" + + // CloudWatchLogsEncodingEucKr is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingEucKr = "euc_kr" + + // CloudWatchLogsEncodingGb2312 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingGb2312 = "gb2312" + + // CloudWatchLogsEncodingGbk is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingGbk = "gbk" + + // CloudWatchLogsEncodingGb18030 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingGb18030 = "gb18030" + + // CloudWatchLogsEncodingHz is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingHz = "hz" + + // CloudWatchLogsEncodingIso2022Jp is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso2022Jp = "iso2022_jp" + + // CloudWatchLogsEncodingIso2022Jp1 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso2022Jp1 = "iso2022_jp_1" + + // CloudWatchLogsEncodingIso2022Jp2 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso2022Jp2 = "iso2022_jp_2" + + // CloudWatchLogsEncodingIso2022Jp2004 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso2022Jp2004 = "iso2022_jp_2004" + + // CloudWatchLogsEncodingIso2022Jp3 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso2022Jp3 = "iso2022_jp_3" + + // CloudWatchLogsEncodingIso2022JpExt is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso2022JpExt = "iso2022_jp_ext" + + // CloudWatchLogsEncodingIso2022Kr is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso2022Kr = "iso2022_kr" + + // CloudWatchLogsEncodingLatin1 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingLatin1 = "latin_1" + + // CloudWatchLogsEncodingIso88592 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88592 = "iso8859_2" + + // CloudWatchLogsEncodingIso88593 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88593 = "iso8859_3" + + // CloudWatchLogsEncodingIso88594 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88594 = "iso8859_4" + + // CloudWatchLogsEncodingIso88595 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88595 = "iso8859_5" + + // CloudWatchLogsEncodingIso88596 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88596 = "iso8859_6" + + // CloudWatchLogsEncodingIso88597 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88597 = "iso8859_7" + + // CloudWatchLogsEncodingIso88598 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88598 = "iso8859_8" + + // CloudWatchLogsEncodingIso88599 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso88599 = "iso8859_9" + + // CloudWatchLogsEncodingIso885910 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso885910 = "iso8859_10" + + // CloudWatchLogsEncodingIso885913 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso885913 = "iso8859_13" + + // CloudWatchLogsEncodingIso885914 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso885914 = "iso8859_14" + + // CloudWatchLogsEncodingIso885915 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso885915 = "iso8859_15" + + // CloudWatchLogsEncodingIso885916 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingIso885916 = "iso8859_16" + + // CloudWatchLogsEncodingJohab is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingJohab = "johab" + + // CloudWatchLogsEncodingKoi8R is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingKoi8R = "koi8_r" + + // CloudWatchLogsEncodingKoi8U is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingKoi8U = "koi8_u" + + // CloudWatchLogsEncodingMacCyrillic is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingMacCyrillic = "mac_cyrillic" + + // CloudWatchLogsEncodingMacGreek is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingMacGreek = "mac_greek" + + // CloudWatchLogsEncodingMacIceland is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingMacIceland = "mac_iceland" + + // CloudWatchLogsEncodingMacLatin2 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingMacLatin2 = "mac_latin2" + + // CloudWatchLogsEncodingMacRoman is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingMacRoman = "mac_roman" + + // CloudWatchLogsEncodingMacTurkish is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingMacTurkish = "mac_turkish" + + // CloudWatchLogsEncodingPtcp154 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingPtcp154 = "ptcp154" + + // CloudWatchLogsEncodingShiftJis is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingShiftJis = "shift_jis" + + // CloudWatchLogsEncodingShiftJis2004 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingShiftJis2004 = "shift_jis_2004" + + // CloudWatchLogsEncodingShiftJisx0213 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingShiftJisx0213 = "shift_jisx0213" + + // CloudWatchLogsEncodingUtf32 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf32 = "utf_32" + + // CloudWatchLogsEncodingUtf32Be is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf32Be = "utf_32_be" + + // CloudWatchLogsEncodingUtf32Le is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf32Le = "utf_32_le" + + // CloudWatchLogsEncodingUtf16 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf16 = "utf_16" + + // CloudWatchLogsEncodingUtf16Be is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf16Be = "utf_16_be" + + // CloudWatchLogsEncodingUtf16Le is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf16Le = "utf_16_le" + + // CloudWatchLogsEncodingUtf7 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf7 = "utf_7" + + // CloudWatchLogsEncodingUtf8 is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf8 = "utf_8" + + // CloudWatchLogsEncodingUtf8Sig is a CloudWatchLogsEncoding enum value + CloudWatchLogsEncodingUtf8Sig = "utf_8_sig" +) + +// Specifies where to start to read data (start_of_file or end_of_file). The +// default is start_of_file. It's only used if there is no state persisted for +// that log stream. +const ( + // CloudWatchLogsInitialPositionStartOfFile is a CloudWatchLogsInitialPosition enum value + CloudWatchLogsInitialPositionStartOfFile = "start_of_file" + + // CloudWatchLogsInitialPositionEndOfFile is a CloudWatchLogsInitialPosition enum value + CloudWatchLogsInitialPositionEndOfFile = "end_of_file" +) + +// The preferred time zone for logs streamed to CloudWatch Logs. Valid values +// are LOCAL and UTC, for Coordinated Universal Time. +const ( + // CloudWatchLogsTimeZoneLocal is a CloudWatchLogsTimeZone enum value + CloudWatchLogsTimeZoneLocal = "LOCAL" + + // CloudWatchLogsTimeZoneUtc is a CloudWatchLogsTimeZone enum value + CloudWatchLogsTimeZoneUtc = "UTC" +) + const ( // DeploymentCommandNameInstallDependencies is a DeploymentCommandName enum value DeploymentCommandNameInstallDependencies = "install_dependencies" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/errors.go index d3e09499d6..fc849646cc 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package opsworks diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/service.go index fa799d9ffd..440f0f7204 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package opsworks @@ -11,20 +11,20 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" ) -// Welcome to the AWS OpsWorks API Reference. This guide provides descriptions, -// syntax, and usage examples for AWS OpsWorks actions and data types, including -// common parameters and error codes. +// Welcome to the AWS OpsWorks Stacks API Reference. This guide provides descriptions, +// syntax, and usage examples for AWS OpsWorks Stacks actions and data types, +// including common parameters and error codes. // -// AWS OpsWorks is an application management service that provides an integrated -// experience for overseeing the complete application lifecycle. For information -// about this product, go to the AWS OpsWorks (http://aws.amazon.com/opsworks/) +// AWS OpsWorks Stacks is an application management service that provides an +// integrated experience for overseeing the complete application lifecycle. +// For information about this product, go to the AWS OpsWorks (http://aws.amazon.com/opsworks/) // details page. // // SDKs and CLI // -// The most common way to use the AWS OpsWorks API is by using the AWS Command -// Line Interface (CLI) or by using one of the AWS SDKs to implement applications -// in your preferred language. For more information, see: +// The most common way to use the AWS OpsWorks Stacks API is by using the AWS +// Command Line Interface (CLI) or by using one of the AWS SDKs to implement +// applications in your preferred language. For more information, see: // // * AWS CLI (http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) // @@ -42,18 +42,22 @@ import ( // // Endpoints // -// AWS OpsWorks supports the following endpoints, all HTTPS. You must connect -// to one of the following endpoints. Stacks can only be accessed or managed -// within the endpoint in which they are created. +// AWS OpsWorks Stacks supports the following endpoints, all HTTPS. You must +// connect to one of the following endpoints. Stacks can only be accessed or +// managed within the endpoint in which they are created. // // * opsworks.us-east-1.amazonaws.com // +// * opsworks.us-east-2.amazonaws.com +// // * opsworks.us-west-1.amazonaws.com // // * opsworks.us-west-2.amazonaws.com // // * opsworks.eu-west-1.amazonaws.com // +// * opsworks.eu-west-2.amazonaws.com +// // * opsworks.eu-central-1.amazonaws.com // // * opsworks.ap-northeast-1.amazonaws.com diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/waiters.go index dc4fa42ae0..99a800a60a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/opsworks/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package opsworks import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilAppExists uses the AWS OpsWorks API operation @@ -11,32 +14,50 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *OpsWorks) WaitUntilAppExists(input *DescribeAppsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeApps", - Delay: 1, + return c.WaitUntilAppExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilAppExistsWithContext is an extended version of WaitUntilAppExists. +// 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 *OpsWorks) WaitUntilAppExistsWithContext(ctx aws.Context, input *DescribeAppsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilAppExists", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(1 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "failure", - Matcher: "status", - Argument: "", + State: request.FailureWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 400, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeAppsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAppsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilDeploymentSuccessful uses the AWS OpsWorks API operation @@ -44,32 +65,50 @@ func (c *OpsWorks) WaitUntilAppExists(input *DescribeAppsInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *OpsWorks) WaitUntilDeploymentSuccessful(input *DescribeDeploymentsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeDeployments", - Delay: 15, + return c.WaitUntilDeploymentSuccessfulWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilDeploymentSuccessfulWithContext is an extended version of WaitUntilDeploymentSuccessful. +// 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 *OpsWorks) WaitUntilDeploymentSuccessfulWithContext(ctx aws.Context, input *DescribeDeploymentsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilDeploymentSuccessful", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Deployments[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Deployments[].Status", Expected: "successful", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Deployments[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Deployments[].Status", Expected: "failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeDeploymentsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDeploymentsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceOnline uses the AWS OpsWorks API operation @@ -77,74 +116,85 @@ func (c *OpsWorks) WaitUntilDeploymentSuccessful(input *DescribeDeploymentsInput // If the condition is not meet within the max attempt window an error will // be returned. func (c *OpsWorks) WaitUntilInstanceOnline(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 15, + return c.WaitUntilInstanceOnlineWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceOnlineWithContext is an extended version of WaitUntilInstanceOnline. +// 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 *OpsWorks) WaitUntilInstanceOnlineWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceOnline", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Instances[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Instances[].Status", Expected: "online", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "setup_failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "shutting_down", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "start_failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "stopped", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "stopping", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "terminating", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "terminated", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "stop_failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceRegistered uses the AWS OpsWorks API operation @@ -152,68 +202,80 @@ func (c *OpsWorks) WaitUntilInstanceOnline(input *DescribeInstancesInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *OpsWorks) WaitUntilInstanceRegistered(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 15, + return c.WaitUntilInstanceRegisteredWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceRegisteredWithContext is an extended version of WaitUntilInstanceRegistered. +// 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 *OpsWorks) WaitUntilInstanceRegisteredWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceRegistered", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Instances[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Instances[].Status", Expected: "registered", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "setup_failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "shutting_down", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "stopped", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "stopping", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "terminating", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "terminated", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "stop_failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceStopped uses the AWS OpsWorks API operation @@ -221,80 +283,90 @@ func (c *OpsWorks) WaitUntilInstanceRegistered(input *DescribeInstancesInput) er // If the condition is not meet within the max attempt window an error will // be returned. func (c *OpsWorks) WaitUntilInstanceStopped(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 15, + return c.WaitUntilInstanceStoppedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceStoppedWithContext is an extended version of WaitUntilInstanceStopped. +// 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 *OpsWorks) WaitUntilInstanceStoppedWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceStopped", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Instances[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Instances[].Status", Expected: "stopped", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "booting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "online", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "pending", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "rebooting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "requested", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "running_setup", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "setup_failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "start_failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "stop_failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilInstanceTerminated uses the AWS OpsWorks API operation @@ -302,78 +374,88 @@ func (c *OpsWorks) WaitUntilInstanceStopped(input *DescribeInstancesInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *OpsWorks) WaitUntilInstanceTerminated(input *DescribeInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeInstances", - Delay: 15, + return c.WaitUntilInstanceTerminatedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilInstanceTerminatedWithContext is an extended version of WaitUntilInstanceTerminated. +// 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 *OpsWorks) WaitUntilInstanceTerminatedWithContext(ctx aws.Context, input *DescribeInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilInstanceTerminated", MaxAttempts: 40, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Instances[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Instances[].Status", Expected: "terminated", }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ResourceNotFoundException", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "booting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "online", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "pending", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "rebooting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "requested", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "running_setup", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "setup_failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Instances[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Instances[].Status", Expected: "start_failed", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/api.go index e9e7436610..0477c7471f 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package rds provides a client for Amazon Relational Database Service. package rds @@ -7,6 +7,7 @@ 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" @@ -89,8 +90,23 @@ func (c *RDS) AddRoleToDBClusterRequest(input *AddRoleToDBClusterInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/AddRoleToDBCluster func (c *RDS) AddRoleToDBCluster(input *AddRoleToDBClusterInput) (*AddRoleToDBClusterOutput, error) { req, out := c.AddRoleToDBClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddRoleToDBClusterWithContext is the same as AddRoleToDBCluster with the addition of +// the ability to pass a context and additional request options. +// +// See AddRoleToDBCluster 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 *RDS) AddRoleToDBClusterWithContext(ctx aws.Context, input *AddRoleToDBClusterInput, opts ...request.Option) (*AddRoleToDBClusterOutput, error) { + req, out := c.AddRoleToDBClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddSourceIdentifierToSubscription = "AddSourceIdentifierToSubscription" @@ -157,8 +173,23 @@ func (c *RDS) AddSourceIdentifierToSubscriptionRequest(input *AddSourceIdentifie // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/AddSourceIdentifierToSubscription func (c *RDS) AddSourceIdentifierToSubscription(input *AddSourceIdentifierToSubscriptionInput) (*AddSourceIdentifierToSubscriptionOutput, error) { req, out := c.AddSourceIdentifierToSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddSourceIdentifierToSubscriptionWithContext is the same as AddSourceIdentifierToSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See AddSourceIdentifierToSubscription 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 *RDS) AddSourceIdentifierToSubscriptionWithContext(ctx aws.Context, input *AddSourceIdentifierToSubscriptionInput, opts ...request.Option) (*AddSourceIdentifierToSubscriptionOutput, error) { + req, out := c.AddSourceIdentifierToSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAddTagsToResource = "AddTagsToResource" @@ -235,8 +266,23 @@ func (c *RDS) AddTagsToResourceRequest(input *AddTagsToResourceInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/AddTagsToResource func (c *RDS) AddTagsToResource(input *AddTagsToResourceInput) (*AddTagsToResourceOutput, error) { req, out := c.AddTagsToResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToResourceWithContext is the same as AddTagsToResource with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToResource 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 *RDS) AddTagsToResourceWithContext(ctx aws.Context, input *AddTagsToResourceInput, opts ...request.Option) (*AddTagsToResourceOutput, error) { + req, out := c.AddTagsToResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opApplyPendingMaintenanceAction = "ApplyPendingMaintenanceAction" @@ -301,8 +347,23 @@ func (c *RDS) ApplyPendingMaintenanceActionRequest(input *ApplyPendingMaintenanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ApplyPendingMaintenanceAction func (c *RDS) ApplyPendingMaintenanceAction(input *ApplyPendingMaintenanceActionInput) (*ApplyPendingMaintenanceActionOutput, error) { req, out := c.ApplyPendingMaintenanceActionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ApplyPendingMaintenanceActionWithContext is the same as ApplyPendingMaintenanceAction with the addition of +// the ability to pass a context and additional request options. +// +// See ApplyPendingMaintenanceAction 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 *RDS) ApplyPendingMaintenanceActionWithContext(ctx aws.Context, input *ApplyPendingMaintenanceActionInput, opts ...request.Option) (*ApplyPendingMaintenanceActionOutput, error) { + req, out := c.ApplyPendingMaintenanceActionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAuthorizeDBSecurityGroupIngress = "AuthorizeDBSecurityGroupIngress" @@ -388,8 +449,23 @@ func (c *RDS) AuthorizeDBSecurityGroupIngressRequest(input *AuthorizeDBSecurityG // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/AuthorizeDBSecurityGroupIngress func (c *RDS) AuthorizeDBSecurityGroupIngress(input *AuthorizeDBSecurityGroupIngressInput) (*AuthorizeDBSecurityGroupIngressOutput, error) { req, out := c.AuthorizeDBSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AuthorizeDBSecurityGroupIngressWithContext is the same as AuthorizeDBSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See AuthorizeDBSecurityGroupIngress 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 *RDS) AuthorizeDBSecurityGroupIngressWithContext(ctx aws.Context, input *AuthorizeDBSecurityGroupIngressInput, opts ...request.Option) (*AuthorizeDBSecurityGroupIngressOutput, error) { + req, out := c.AuthorizeDBSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyDBClusterParameterGroup = "CopyDBClusterParameterGroup" @@ -460,8 +536,23 @@ func (c *RDS) CopyDBClusterParameterGroupRequest(input *CopyDBClusterParameterGr // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CopyDBClusterParameterGroup func (c *RDS) CopyDBClusterParameterGroup(input *CopyDBClusterParameterGroupInput) (*CopyDBClusterParameterGroupOutput, error) { req, out := c.CopyDBClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyDBClusterParameterGroupWithContext is the same as CopyDBClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CopyDBClusterParameterGroup 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 *RDS) CopyDBClusterParameterGroupWithContext(ctx aws.Context, input *CopyDBClusterParameterGroupInput, opts ...request.Option) (*CopyDBClusterParameterGroupOutput, error) { + req, out := c.CopyDBClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyDBClusterSnapshot = "CopyDBClusterSnapshot" @@ -509,8 +600,67 @@ func (c *RDS) CopyDBClusterSnapshotRequest(input *CopyDBClusterSnapshotInput) (r // CopyDBClusterSnapshot API operation for Amazon Relational Database Service. // -// Creates a snapshot of a DB cluster. For more information on Amazon Aurora, -// see Aurora on Amazon RDS (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Aurora.html) +// Copies a snapshot of a DB cluster. +// +// To copy a DB cluster snapshot from a shared manual DB cluster snapshot, SourceDBClusterSnapshotIdentifier +// must be the Amazon Resource Name (ARN) of the shared DB cluster snapshot. +// +// You can copy an encrypted DB cluster snapshot from another AWS region. In +// that case, the region where you call the CopyDBClusterSnapshot action is +// the destination region for the encrypted DB cluster snapshot to be copied +// to. To copy an encrypted DB cluster snapshot from another region, you must +// provide the following values: +// +// * KmsKeyId - The AWS Key Management System (KMS) key identifier for the +// key to use to encrypt the copy of the DB cluster snapshot in the destination +// region. +// +// * PreSignedUrl - A URL that contains a Signature Version 4 signed request +// for the CopyDBClusterSnapshot action to be called in the source region +// where the DB cluster snapshot will be copied from. The pre-signed URL +// must be a valid request for the CopyDBClusterSnapshot API action that +// can be executed in the source region that contains the encrypted DB cluster +// snapshot to be copied. +// +// The pre-signed URL request must contain the following parameter values: +// +// KmsKeyId - The KMS key identifier for the key to use to encrypt the copy +// of the DB cluster snapshot in the destination region. This is the same +// identifier for both the CopyDBClusterSnapshot action that is called in +// the destination region, and the action contained in the pre-signed URL. +// +// DestinationRegion - The name of the region that the DB cluster snapshot will +// be created in. +// +// SourceDBClusterSnapshotIdentifier - The DB cluster snapshot identifier for +// the encrypted DB cluster snapshot to be copied. This identifier must be +// in the Amazon Resource Name (ARN) format for the source region. For example, +// if you are copying an encrypted DB cluster snapshot from the us-west-2 +// region, then your SourceDBClusterSnapshotIdentifier looks like the following +// example: arn:aws:rds:us-west-2:123456789012:cluster-snapshot:aurora-cluster1-snapshot-20161115. +// +// To learn how to generate a Signature Version 4 signed request, see Authenticating +// Requests: Using Query Parameters (AWS Signature Version 4) (http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) +// and Signature Version 4 Signing Process (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). +// +// * TargetDBClusterSnapshotIdentifier - The identifier for the new copy +// of the DB cluster snapshot in the destination region. +// +// * SourceDBClusterSnapshotIdentifier - The DB cluster snapshot identifier +// for the encrypted DB cluster snapshot to be copied. This identifier must +// be in the ARN format for the source region and is the same value as the +// SourceDBClusterSnapshotIdentifier in the pre-signed URL. +// +// To cancel the copy operation once it is in progress, delete the target DB +// cluster snapshot identified by TargetDBClusterSnapshotIdentifier while that +// DB cluster snapshot is in "copying" status. +// +// For more information on copying encrypted DB cluster snapshots from one region +// to another, see Copying a DB Cluster Snapshot in the Same Account, Either +// in the Same Region or Across Regions (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CopySnapshot.html#USER_CopyDBClusterSnapshot.CrossRegion) +// in the Amazon RDS User Guide. +// +// For more information on Amazon Aurora, see Aurora on Amazon RDS (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Aurora.html) // in the Amazon RDS User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -542,8 +692,23 @@ func (c *RDS) CopyDBClusterSnapshotRequest(input *CopyDBClusterSnapshotInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CopyDBClusterSnapshot func (c *RDS) CopyDBClusterSnapshot(input *CopyDBClusterSnapshotInput) (*CopyDBClusterSnapshotOutput, error) { req, out := c.CopyDBClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyDBClusterSnapshotWithContext is the same as CopyDBClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CopyDBClusterSnapshot 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 *RDS) CopyDBClusterSnapshotWithContext(ctx aws.Context, input *CopyDBClusterSnapshotInput, opts ...request.Option) (*CopyDBClusterSnapshotOutput, error) { + req, out := c.CopyDBClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyDBParameterGroup = "CopyDBParameterGroup" @@ -614,8 +779,23 @@ func (c *RDS) CopyDBParameterGroupRequest(input *CopyDBParameterGroupInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CopyDBParameterGroup func (c *RDS) CopyDBParameterGroup(input *CopyDBParameterGroupInput) (*CopyDBParameterGroupOutput, error) { req, out := c.CopyDBParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyDBParameterGroupWithContext is the same as CopyDBParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CopyDBParameterGroup 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 *RDS) CopyDBParameterGroupWithContext(ctx aws.Context, input *CopyDBParameterGroupInput, opts ...request.Option) (*CopyDBParameterGroupOutput, error) { + req, out := c.CopyDBParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyDBSnapshot = "CopyDBSnapshot" @@ -749,8 +929,23 @@ func (c *RDS) CopyDBSnapshotRequest(input *CopyDBSnapshotInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CopyDBSnapshot func (c *RDS) CopyDBSnapshot(input *CopyDBSnapshotInput) (*CopyDBSnapshotOutput, error) { req, out := c.CopyDBSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyDBSnapshotWithContext is the same as CopyDBSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CopyDBSnapshot 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 *RDS) CopyDBSnapshotWithContext(ctx aws.Context, input *CopyDBSnapshotInput, opts ...request.Option) (*CopyDBSnapshotOutput, error) { + req, out := c.CopyDBSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyOptionGroup = "CopyOptionGroup" @@ -820,8 +1015,23 @@ func (c *RDS) CopyOptionGroupRequest(input *CopyOptionGroupInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CopyOptionGroup func (c *RDS) CopyOptionGroup(input *CopyOptionGroupInput) (*CopyOptionGroupOutput, error) { req, out := c.CopyOptionGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyOptionGroupWithContext is the same as CopyOptionGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CopyOptionGroup 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 *RDS) CopyOptionGroupWithContext(ctx aws.Context, input *CopyOptionGroupInput, opts ...request.Option) (*CopyOptionGroupOutput, error) { + req, out := c.CopyOptionGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBCluster = "CreateDBCluster" @@ -873,6 +1083,8 @@ func (c *RDS) CreateDBClusterRequest(input *CreateDBClusterInput) (req *request. // // You can use the ReplicationSourceIdentifier parameter to create the DB cluster // as a Read Replica of another DB cluster or Amazon RDS MySQL DB instance. +// For cross-region replication where the DB cluster identified by ReplicationSourceIdentifier +// is encrypted, you must also specify the PreSignedUrl parameter. // // For more information on Amazon Aurora, see Aurora on Amazon RDS (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Aurora.html) // in the Amazon RDS User Guide. @@ -941,8 +1153,23 @@ func (c *RDS) CreateDBClusterRequest(input *CreateDBClusterInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBCluster func (c *RDS) CreateDBCluster(input *CreateDBClusterInput) (*CreateDBClusterOutput, error) { req, out := c.CreateDBClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBClusterWithContext is the same as CreateDBCluster with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBCluster 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 *RDS) CreateDBClusterWithContext(ctx aws.Context, input *CreateDBClusterInput, opts ...request.Option) (*CreateDBClusterOutput, error) { + req, out := c.CreateDBClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBClusterParameterGroup = "CreateDBClusterParameterGroup" @@ -1037,8 +1264,23 @@ func (c *RDS) CreateDBClusterParameterGroupRequest(input *CreateDBClusterParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBClusterParameterGroup func (c *RDS) CreateDBClusterParameterGroup(input *CreateDBClusterParameterGroupInput) (*CreateDBClusterParameterGroupOutput, error) { req, out := c.CreateDBClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBClusterParameterGroupWithContext is the same as CreateDBClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBClusterParameterGroup 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 *RDS) CreateDBClusterParameterGroupWithContext(ctx aws.Context, input *CreateDBClusterParameterGroupInput, opts ...request.Option) (*CreateDBClusterParameterGroupOutput, error) { + req, out := c.CreateDBClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBClusterSnapshot = "CreateDBClusterSnapshot" @@ -1116,8 +1358,23 @@ func (c *RDS) CreateDBClusterSnapshotRequest(input *CreateDBClusterSnapshotInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBClusterSnapshot func (c *RDS) CreateDBClusterSnapshot(input *CreateDBClusterSnapshotInput) (*CreateDBClusterSnapshotOutput, error) { req, out := c.CreateDBClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBClusterSnapshotWithContext is the same as CreateDBClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBClusterSnapshot 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 *RDS) CreateDBClusterSnapshotWithContext(ctx aws.Context, input *CreateDBClusterSnapshotInput, opts ...request.Option) (*CreateDBClusterSnapshotOutput, error) { + req, out := c.CreateDBClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBInstance = "CreateDBInstance" @@ -1241,8 +1498,23 @@ func (c *RDS) CreateDBInstanceRequest(input *CreateDBInstanceInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBInstance func (c *RDS) CreateDBInstance(input *CreateDBInstanceInput) (*CreateDBInstanceOutput, error) { req, out := c.CreateDBInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBInstanceWithContext is the same as CreateDBInstance with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBInstance 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 *RDS) CreateDBInstanceWithContext(ctx aws.Context, input *CreateDBInstanceInput, opts ...request.Option) (*CreateDBInstanceOutput, error) { + req, out := c.CreateDBInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBInstanceReadReplica = "CreateDBInstanceReadReplica" @@ -1427,8 +1699,23 @@ func (c *RDS) CreateDBInstanceReadReplicaRequest(input *CreateDBInstanceReadRepl // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBInstanceReadReplica func (c *RDS) CreateDBInstanceReadReplica(input *CreateDBInstanceReadReplicaInput) (*CreateDBInstanceReadReplicaOutput, error) { req, out := c.CreateDBInstanceReadReplicaRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBInstanceReadReplicaWithContext is the same as CreateDBInstanceReadReplica with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBInstanceReadReplica 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 *RDS) CreateDBInstanceReadReplicaWithContext(ctx aws.Context, input *CreateDBInstanceReadReplicaInput, opts ...request.Option) (*CreateDBInstanceReadReplicaOutput, error) { + req, out := c.CreateDBInstanceReadReplicaRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBParameterGroup = "CreateDBParameterGroup" @@ -1516,8 +1803,23 @@ func (c *RDS) CreateDBParameterGroupRequest(input *CreateDBParameterGroupInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBParameterGroup func (c *RDS) CreateDBParameterGroup(input *CreateDBParameterGroupInput) (*CreateDBParameterGroupOutput, error) { req, out := c.CreateDBParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBParameterGroupWithContext is the same as CreateDBParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBParameterGroup 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 *RDS) CreateDBParameterGroupWithContext(ctx aws.Context, input *CreateDBParameterGroupInput, opts ...request.Option) (*CreateDBParameterGroupOutput, error) { + req, out := c.CreateDBParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBSecurityGroup = "CreateDBSecurityGroup" @@ -1590,8 +1892,23 @@ func (c *RDS) CreateDBSecurityGroupRequest(input *CreateDBSecurityGroupInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBSecurityGroup func (c *RDS) CreateDBSecurityGroup(input *CreateDBSecurityGroupInput) (*CreateDBSecurityGroupOutput, error) { req, out := c.CreateDBSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBSecurityGroupWithContext is the same as CreateDBSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBSecurityGroup 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 *RDS) CreateDBSecurityGroupWithContext(ctx aws.Context, input *CreateDBSecurityGroupInput, opts ...request.Option) (*CreateDBSecurityGroupOutput, error) { + req, out := c.CreateDBSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBSnapshot = "CreateDBSnapshot" @@ -1664,8 +1981,23 @@ func (c *RDS) CreateDBSnapshotRequest(input *CreateDBSnapshotInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBSnapshot func (c *RDS) CreateDBSnapshot(input *CreateDBSnapshotInput) (*CreateDBSnapshotOutput, error) { req, out := c.CreateDBSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBSnapshotWithContext is the same as CreateDBSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBSnapshot 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 *RDS) CreateDBSnapshotWithContext(ctx aws.Context, input *CreateDBSnapshotInput, opts ...request.Option) (*CreateDBSnapshotOutput, error) { + req, out := c.CreateDBSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDBSubnetGroup = "CreateDBSubnetGroup" @@ -1745,8 +2077,23 @@ func (c *RDS) CreateDBSubnetGroupRequest(input *CreateDBSubnetGroupInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateDBSubnetGroup func (c *RDS) CreateDBSubnetGroup(input *CreateDBSubnetGroupInput) (*CreateDBSubnetGroupOutput, error) { req, out := c.CreateDBSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDBSubnetGroupWithContext is the same as CreateDBSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDBSubnetGroup 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 *RDS) CreateDBSubnetGroupWithContext(ctx aws.Context, input *CreateDBSubnetGroupInput, opts ...request.Option) (*CreateDBSubnetGroupOutput, error) { + req, out := c.CreateDBSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateEventSubscription = "CreateEventSubscription" @@ -1845,8 +2192,23 @@ func (c *RDS) CreateEventSubscriptionRequest(input *CreateEventSubscriptionInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateEventSubscription func (c *RDS) CreateEventSubscription(input *CreateEventSubscriptionInput) (*CreateEventSubscriptionOutput, error) { req, out := c.CreateEventSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateEventSubscriptionWithContext is the same as CreateEventSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See CreateEventSubscription 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 *RDS) CreateEventSubscriptionWithContext(ctx aws.Context, input *CreateEventSubscriptionInput, opts ...request.Option) (*CreateEventSubscriptionOutput, error) { + req, out := c.CreateEventSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateOptionGroup = "CreateOptionGroup" @@ -1913,8 +2275,23 @@ func (c *RDS) CreateOptionGroupRequest(input *CreateOptionGroupInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/CreateOptionGroup func (c *RDS) CreateOptionGroup(input *CreateOptionGroupInput) (*CreateOptionGroupOutput, error) { req, out := c.CreateOptionGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateOptionGroupWithContext is the same as CreateOptionGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateOptionGroup 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 *RDS) CreateOptionGroupWithContext(ctx aws.Context, input *CreateOptionGroupInput, opts ...request.Option) (*CreateOptionGroupOutput, error) { + req, out := c.CreateOptionGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBCluster = "DeleteDBCluster" @@ -1995,8 +2372,23 @@ func (c *RDS) DeleteDBClusterRequest(input *DeleteDBClusterInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBCluster func (c *RDS) DeleteDBCluster(input *DeleteDBClusterInput) (*DeleteDBClusterOutput, error) { req, out := c.DeleteDBClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBClusterWithContext is the same as DeleteDBCluster with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBCluster 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 *RDS) DeleteDBClusterWithContext(ctx aws.Context, input *DeleteDBClusterInput, opts ...request.Option) (*DeleteDBClusterOutput, error) { + req, out := c.DeleteDBClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBClusterParameterGroup = "DeleteDBClusterParameterGroup" @@ -2069,8 +2461,23 @@ func (c *RDS) DeleteDBClusterParameterGroupRequest(input *DeleteDBClusterParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBClusterParameterGroup func (c *RDS) DeleteDBClusterParameterGroup(input *DeleteDBClusterParameterGroupInput) (*DeleteDBClusterParameterGroupOutput, error) { req, out := c.DeleteDBClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBClusterParameterGroupWithContext is the same as DeleteDBClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBClusterParameterGroup 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 *RDS) DeleteDBClusterParameterGroupWithContext(ctx aws.Context, input *DeleteDBClusterParameterGroupInput, opts ...request.Option) (*DeleteDBClusterParameterGroupOutput, error) { + req, out := c.DeleteDBClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBClusterSnapshot = "DeleteDBClusterSnapshot" @@ -2143,8 +2550,23 @@ func (c *RDS) DeleteDBClusterSnapshotRequest(input *DeleteDBClusterSnapshotInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBClusterSnapshot func (c *RDS) DeleteDBClusterSnapshot(input *DeleteDBClusterSnapshotInput) (*DeleteDBClusterSnapshotOutput, error) { req, out := c.DeleteDBClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBClusterSnapshotWithContext is the same as DeleteDBClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBClusterSnapshot 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 *RDS) DeleteDBClusterSnapshotWithContext(ctx aws.Context, input *DeleteDBClusterSnapshotInput, opts ...request.Option) (*DeleteDBClusterSnapshotOutput, error) { + req, out := c.DeleteDBClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBInstance = "DeleteDBInstance" @@ -2244,8 +2666,23 @@ func (c *RDS) DeleteDBInstanceRequest(input *DeleteDBInstanceInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBInstance func (c *RDS) DeleteDBInstance(input *DeleteDBInstanceInput) (*DeleteDBInstanceOutput, error) { req, out := c.DeleteDBInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBInstanceWithContext is the same as DeleteDBInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBInstance 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 *RDS) DeleteDBInstanceWithContext(ctx aws.Context, input *DeleteDBInstanceInput, opts ...request.Option) (*DeleteDBInstanceOutput, error) { + req, out := c.DeleteDBInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBParameterGroup = "DeleteDBParameterGroup" @@ -2315,8 +2752,23 @@ func (c *RDS) DeleteDBParameterGroupRequest(input *DeleteDBParameterGroupInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBParameterGroup func (c *RDS) DeleteDBParameterGroup(input *DeleteDBParameterGroupInput) (*DeleteDBParameterGroupOutput, error) { req, out := c.DeleteDBParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBParameterGroupWithContext is the same as DeleteDBParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBParameterGroup 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 *RDS) DeleteDBParameterGroupWithContext(ctx aws.Context, input *DeleteDBParameterGroupInput, opts ...request.Option) (*DeleteDBParameterGroupOutput, error) { + req, out := c.DeleteDBParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBSecurityGroup = "DeleteDBSecurityGroup" @@ -2387,8 +2839,23 @@ func (c *RDS) DeleteDBSecurityGroupRequest(input *DeleteDBSecurityGroupInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBSecurityGroup func (c *RDS) DeleteDBSecurityGroup(input *DeleteDBSecurityGroupInput) (*DeleteDBSecurityGroupOutput, error) { req, out := c.DeleteDBSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBSecurityGroupWithContext is the same as DeleteDBSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBSecurityGroup 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 *RDS) DeleteDBSecurityGroupWithContext(ctx aws.Context, input *DeleteDBSecurityGroupInput, opts ...request.Option) (*DeleteDBSecurityGroupOutput, error) { + req, out := c.DeleteDBSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBSnapshot = "DeleteDBSnapshot" @@ -2458,8 +2925,23 @@ func (c *RDS) DeleteDBSnapshotRequest(input *DeleteDBSnapshotInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBSnapshot func (c *RDS) DeleteDBSnapshot(input *DeleteDBSnapshotInput) (*DeleteDBSnapshotOutput, error) { req, out := c.DeleteDBSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBSnapshotWithContext is the same as DeleteDBSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBSnapshot 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 *RDS) DeleteDBSnapshotWithContext(ctx aws.Context, input *DeleteDBSnapshotInput, opts ...request.Option) (*DeleteDBSnapshotOutput, error) { + req, out := c.DeleteDBSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDBSubnetGroup = "DeleteDBSubnetGroup" @@ -2533,8 +3015,23 @@ func (c *RDS) DeleteDBSubnetGroupRequest(input *DeleteDBSubnetGroupInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteDBSubnetGroup func (c *RDS) DeleteDBSubnetGroup(input *DeleteDBSubnetGroupInput) (*DeleteDBSubnetGroupOutput, error) { req, out := c.DeleteDBSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDBSubnetGroupWithContext is the same as DeleteDBSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDBSubnetGroup 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 *RDS) DeleteDBSubnetGroupWithContext(ctx aws.Context, input *DeleteDBSubnetGroupInput, opts ...request.Option) (*DeleteDBSubnetGroupOutput, error) { + req, out := c.DeleteDBSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteEventSubscription = "DeleteEventSubscription" @@ -2602,8 +3099,23 @@ func (c *RDS) DeleteEventSubscriptionRequest(input *DeleteEventSubscriptionInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteEventSubscription func (c *RDS) DeleteEventSubscription(input *DeleteEventSubscriptionInput) (*DeleteEventSubscriptionOutput, error) { req, out := c.DeleteEventSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEventSubscriptionWithContext is the same as DeleteEventSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEventSubscription 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 *RDS) DeleteEventSubscriptionWithContext(ctx aws.Context, input *DeleteEventSubscriptionInput, opts ...request.Option) (*DeleteEventSubscriptionOutput, error) { + req, out := c.DeleteEventSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteOptionGroup = "DeleteOptionGroup" @@ -2672,8 +3184,23 @@ func (c *RDS) DeleteOptionGroupRequest(input *DeleteOptionGroupInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DeleteOptionGroup func (c *RDS) DeleteOptionGroup(input *DeleteOptionGroupInput) (*DeleteOptionGroupOutput, error) { req, out := c.DeleteOptionGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteOptionGroupWithContext is the same as DeleteOptionGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteOptionGroup 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 *RDS) DeleteOptionGroupWithContext(ctx aws.Context, input *DeleteOptionGroupInput, opts ...request.Option) (*DeleteOptionGroupOutput, error) { + req, out := c.DeleteOptionGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAccountAttributes = "DescribeAccountAttributes" @@ -2737,8 +3264,23 @@ func (c *RDS) DescribeAccountAttributesRequest(input *DescribeAccountAttributesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeAccountAttributes func (c *RDS) DescribeAccountAttributes(input *DescribeAccountAttributesInput) (*DescribeAccountAttributesOutput, error) { req, out := c.DescribeAccountAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAccountAttributesWithContext is the same as DescribeAccountAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAccountAttributes 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 *RDS) DescribeAccountAttributesWithContext(ctx aws.Context, input *DescribeAccountAttributesInput, opts ...request.Option) (*DescribeAccountAttributesOutput, error) { + req, out := c.DescribeAccountAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeCertificates = "DescribeCertificates" @@ -2802,8 +3344,23 @@ func (c *RDS) DescribeCertificatesRequest(input *DescribeCertificatesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeCertificates func (c *RDS) DescribeCertificates(input *DescribeCertificatesInput) (*DescribeCertificatesOutput, error) { req, out := c.DescribeCertificatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeCertificatesWithContext is the same as DescribeCertificates with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeCertificates 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 *RDS) DescribeCertificatesWithContext(ctx aws.Context, input *DescribeCertificatesInput, opts ...request.Option) (*DescribeCertificatesOutput, error) { + req, out := c.DescribeCertificatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDBClusterParameterGroups = "DescribeDBClusterParameterGroups" @@ -2872,8 +3429,23 @@ func (c *RDS) DescribeDBClusterParameterGroupsRequest(input *DescribeDBClusterPa // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBClusterParameterGroups func (c *RDS) DescribeDBClusterParameterGroups(input *DescribeDBClusterParameterGroupsInput) (*DescribeDBClusterParameterGroupsOutput, error) { req, out := c.DescribeDBClusterParameterGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBClusterParameterGroupsWithContext is the same as DescribeDBClusterParameterGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBClusterParameterGroups 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 *RDS) DescribeDBClusterParameterGroupsWithContext(ctx aws.Context, input *DescribeDBClusterParameterGroupsInput, opts ...request.Option) (*DescribeDBClusterParameterGroupsOutput, error) { + req, out := c.DescribeDBClusterParameterGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDBClusterParameters = "DescribeDBClusterParameters" @@ -2941,8 +3513,23 @@ func (c *RDS) DescribeDBClusterParametersRequest(input *DescribeDBClusterParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBClusterParameters func (c *RDS) DescribeDBClusterParameters(input *DescribeDBClusterParametersInput) (*DescribeDBClusterParametersOutput, error) { req, out := c.DescribeDBClusterParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBClusterParametersWithContext is the same as DescribeDBClusterParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBClusterParameters 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 *RDS) DescribeDBClusterParametersWithContext(ctx aws.Context, input *DescribeDBClusterParametersInput, opts ...request.Option) (*DescribeDBClusterParametersOutput, error) { + req, out := c.DescribeDBClusterParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDBClusterSnapshotAttributes = "DescribeDBClusterSnapshotAttributes" @@ -3017,8 +3604,23 @@ func (c *RDS) DescribeDBClusterSnapshotAttributesRequest(input *DescribeDBCluste // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBClusterSnapshotAttributes func (c *RDS) DescribeDBClusterSnapshotAttributes(input *DescribeDBClusterSnapshotAttributesInput) (*DescribeDBClusterSnapshotAttributesOutput, error) { req, out := c.DescribeDBClusterSnapshotAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBClusterSnapshotAttributesWithContext is the same as DescribeDBClusterSnapshotAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBClusterSnapshotAttributes 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 *RDS) DescribeDBClusterSnapshotAttributesWithContext(ctx aws.Context, input *DescribeDBClusterSnapshotAttributesInput, opts ...request.Option) (*DescribeDBClusterSnapshotAttributesOutput, error) { + req, out := c.DescribeDBClusterSnapshotAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDBClusterSnapshots = "DescribeDBClusterSnapshots" @@ -3086,8 +3688,23 @@ func (c *RDS) DescribeDBClusterSnapshotsRequest(input *DescribeDBClusterSnapshot // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBClusterSnapshots func (c *RDS) DescribeDBClusterSnapshots(input *DescribeDBClusterSnapshotsInput) (*DescribeDBClusterSnapshotsOutput, error) { req, out := c.DescribeDBClusterSnapshotsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBClusterSnapshotsWithContext is the same as DescribeDBClusterSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBClusterSnapshots 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 *RDS) DescribeDBClusterSnapshotsWithContext(ctx aws.Context, input *DescribeDBClusterSnapshotsInput, opts ...request.Option) (*DescribeDBClusterSnapshotsOutput, error) { + req, out := c.DescribeDBClusterSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDBClusters = "DescribeDBClusters" @@ -3155,8 +3772,23 @@ func (c *RDS) DescribeDBClustersRequest(input *DescribeDBClustersInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBClusters func (c *RDS) DescribeDBClusters(input *DescribeDBClustersInput) (*DescribeDBClustersOutput, error) { req, out := c.DescribeDBClustersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBClustersWithContext is the same as DescribeDBClusters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBClusters 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 *RDS) DescribeDBClustersWithContext(ctx aws.Context, input *DescribeDBClustersInput, opts ...request.Option) (*DescribeDBClustersOutput, error) { + req, out := c.DescribeDBClustersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDBEngineVersions = "DescribeDBEngineVersions" @@ -3221,8 +3853,23 @@ func (c *RDS) DescribeDBEngineVersionsRequest(input *DescribeDBEngineVersionsInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBEngineVersions func (c *RDS) DescribeDBEngineVersions(input *DescribeDBEngineVersionsInput) (*DescribeDBEngineVersionsOutput, error) { req, out := c.DescribeDBEngineVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBEngineVersionsWithContext is the same as DescribeDBEngineVersions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBEngineVersions 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 *RDS) DescribeDBEngineVersionsWithContext(ctx aws.Context, input *DescribeDBEngineVersionsInput, opts ...request.Option) (*DescribeDBEngineVersionsOutput, error) { + req, out := c.DescribeDBEngineVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBEngineVersionsPages iterates over the pages of a DescribeDBEngineVersions operation, @@ -3242,12 +3889,37 @@ func (c *RDS) DescribeDBEngineVersions(input *DescribeDBEngineVersionsInput) (*D // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBEngineVersionsPages(input *DescribeDBEngineVersionsInput, fn func(p *DescribeDBEngineVersionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBEngineVersionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBEngineVersionsOutput), lastPage) - }) +func (c *RDS) DescribeDBEngineVersionsPages(input *DescribeDBEngineVersionsInput, fn func(*DescribeDBEngineVersionsOutput, bool) bool) error { + return c.DescribeDBEngineVersionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBEngineVersionsPagesWithContext same as DescribeDBEngineVersionsPages 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 *RDS) DescribeDBEngineVersionsPagesWithContext(ctx aws.Context, input *DescribeDBEngineVersionsInput, fn func(*DescribeDBEngineVersionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBEngineVersionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBEngineVersionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBEngineVersionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDBInstances = "DescribeDBInstances" @@ -3317,8 +3989,23 @@ func (c *RDS) DescribeDBInstancesRequest(input *DescribeDBInstancesInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBInstances func (c *RDS) DescribeDBInstances(input *DescribeDBInstancesInput) (*DescribeDBInstancesOutput, error) { req, out := c.DescribeDBInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBInstancesWithContext is the same as DescribeDBInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBInstances 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 *RDS) DescribeDBInstancesWithContext(ctx aws.Context, input *DescribeDBInstancesInput, opts ...request.Option) (*DescribeDBInstancesOutput, error) { + req, out := c.DescribeDBInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBInstancesPages iterates over the pages of a DescribeDBInstances operation, @@ -3338,12 +4025,37 @@ func (c *RDS) DescribeDBInstances(input *DescribeDBInstancesInput) (*DescribeDBI // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBInstancesPages(input *DescribeDBInstancesInput, fn func(p *DescribeDBInstancesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBInstancesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBInstancesOutput), lastPage) - }) +func (c *RDS) DescribeDBInstancesPages(input *DescribeDBInstancesInput, fn func(*DescribeDBInstancesOutput, bool) bool) error { + return c.DescribeDBInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBInstancesPagesWithContext same as DescribeDBInstancesPages 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 *RDS) DescribeDBInstancesPagesWithContext(ctx aws.Context, input *DescribeDBInstancesInput, fn func(*DescribeDBInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBInstancesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDBLogFiles = "DescribeDBLogFiles" @@ -3413,8 +4125,23 @@ func (c *RDS) DescribeDBLogFilesRequest(input *DescribeDBLogFilesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBLogFiles func (c *RDS) DescribeDBLogFiles(input *DescribeDBLogFilesInput) (*DescribeDBLogFilesOutput, error) { req, out := c.DescribeDBLogFilesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBLogFilesWithContext is the same as DescribeDBLogFiles with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBLogFiles 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 *RDS) DescribeDBLogFilesWithContext(ctx aws.Context, input *DescribeDBLogFilesInput, opts ...request.Option) (*DescribeDBLogFilesOutput, error) { + req, out := c.DescribeDBLogFilesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBLogFilesPages iterates over the pages of a DescribeDBLogFiles operation, @@ -3434,12 +4161,37 @@ func (c *RDS) DescribeDBLogFiles(input *DescribeDBLogFilesInput) (*DescribeDBLog // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBLogFilesPages(input *DescribeDBLogFilesInput, fn func(p *DescribeDBLogFilesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBLogFilesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBLogFilesOutput), lastPage) - }) +func (c *RDS) DescribeDBLogFilesPages(input *DescribeDBLogFilesInput, fn func(*DescribeDBLogFilesOutput, bool) bool) error { + return c.DescribeDBLogFilesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBLogFilesPagesWithContext same as DescribeDBLogFilesPages 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 *RDS) DescribeDBLogFilesPagesWithContext(ctx aws.Context, input *DescribeDBLogFilesInput, fn func(*DescribeDBLogFilesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBLogFilesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBLogFilesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBLogFilesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDBParameterGroups = "DescribeDBParameterGroups" @@ -3511,8 +4263,23 @@ func (c *RDS) DescribeDBParameterGroupsRequest(input *DescribeDBParameterGroupsI // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBParameterGroups func (c *RDS) DescribeDBParameterGroups(input *DescribeDBParameterGroupsInput) (*DescribeDBParameterGroupsOutput, error) { req, out := c.DescribeDBParameterGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBParameterGroupsWithContext is the same as DescribeDBParameterGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBParameterGroups 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 *RDS) DescribeDBParameterGroupsWithContext(ctx aws.Context, input *DescribeDBParameterGroupsInput, opts ...request.Option) (*DescribeDBParameterGroupsOutput, error) { + req, out := c.DescribeDBParameterGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBParameterGroupsPages iterates over the pages of a DescribeDBParameterGroups operation, @@ -3532,12 +4299,37 @@ func (c *RDS) DescribeDBParameterGroups(input *DescribeDBParameterGroupsInput) ( // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBParameterGroupsPages(input *DescribeDBParameterGroupsInput, fn func(p *DescribeDBParameterGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBParameterGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBParameterGroupsOutput), lastPage) - }) +func (c *RDS) DescribeDBParameterGroupsPages(input *DescribeDBParameterGroupsInput, fn func(*DescribeDBParameterGroupsOutput, bool) bool) error { + return c.DescribeDBParameterGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBParameterGroupsPagesWithContext same as DescribeDBParameterGroupsPages 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 *RDS) DescribeDBParameterGroupsPagesWithContext(ctx aws.Context, input *DescribeDBParameterGroupsInput, fn func(*DescribeDBParameterGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBParameterGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBParameterGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBParameterGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDBParameters = "DescribeDBParameters" @@ -3607,8 +4399,23 @@ func (c *RDS) DescribeDBParametersRequest(input *DescribeDBParametersInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBParameters func (c *RDS) DescribeDBParameters(input *DescribeDBParametersInput) (*DescribeDBParametersOutput, error) { req, out := c.DescribeDBParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBParametersWithContext is the same as DescribeDBParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBParameters 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 *RDS) DescribeDBParametersWithContext(ctx aws.Context, input *DescribeDBParametersInput, opts ...request.Option) (*DescribeDBParametersOutput, error) { + req, out := c.DescribeDBParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBParametersPages iterates over the pages of a DescribeDBParameters operation, @@ -3628,12 +4435,37 @@ func (c *RDS) DescribeDBParameters(input *DescribeDBParametersInput) (*DescribeD // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBParametersPages(input *DescribeDBParametersInput, fn func(p *DescribeDBParametersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBParametersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBParametersOutput), lastPage) - }) +func (c *RDS) DescribeDBParametersPages(input *DescribeDBParametersInput, fn func(*DescribeDBParametersOutput, bool) bool) error { + return c.DescribeDBParametersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBParametersPagesWithContext same as DescribeDBParametersPages 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 *RDS) DescribeDBParametersPagesWithContext(ctx aws.Context, input *DescribeDBParametersInput, fn func(*DescribeDBParametersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBParametersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBParametersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBParametersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDBSecurityGroups = "DescribeDBSecurityGroups" @@ -3705,8 +4537,23 @@ func (c *RDS) DescribeDBSecurityGroupsRequest(input *DescribeDBSecurityGroupsInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBSecurityGroups func (c *RDS) DescribeDBSecurityGroups(input *DescribeDBSecurityGroupsInput) (*DescribeDBSecurityGroupsOutput, error) { req, out := c.DescribeDBSecurityGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBSecurityGroupsWithContext is the same as DescribeDBSecurityGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBSecurityGroups 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 *RDS) DescribeDBSecurityGroupsWithContext(ctx aws.Context, input *DescribeDBSecurityGroupsInput, opts ...request.Option) (*DescribeDBSecurityGroupsOutput, error) { + req, out := c.DescribeDBSecurityGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBSecurityGroupsPages iterates over the pages of a DescribeDBSecurityGroups operation, @@ -3726,12 +4573,37 @@ func (c *RDS) DescribeDBSecurityGroups(input *DescribeDBSecurityGroupsInput) (*D // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBSecurityGroupsPages(input *DescribeDBSecurityGroupsInput, fn func(p *DescribeDBSecurityGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBSecurityGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBSecurityGroupsOutput), lastPage) - }) +func (c *RDS) DescribeDBSecurityGroupsPages(input *DescribeDBSecurityGroupsInput, fn func(*DescribeDBSecurityGroupsOutput, bool) bool) error { + return c.DescribeDBSecurityGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBSecurityGroupsPagesWithContext same as DescribeDBSecurityGroupsPages 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 *RDS) DescribeDBSecurityGroupsPagesWithContext(ctx aws.Context, input *DescribeDBSecurityGroupsInput, fn func(*DescribeDBSecurityGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBSecurityGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBSecurityGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBSecurityGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDBSnapshotAttributes = "DescribeDBSnapshotAttributes" @@ -3806,8 +4678,23 @@ func (c *RDS) DescribeDBSnapshotAttributesRequest(input *DescribeDBSnapshotAttri // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBSnapshotAttributes func (c *RDS) DescribeDBSnapshotAttributes(input *DescribeDBSnapshotAttributesInput) (*DescribeDBSnapshotAttributesOutput, error) { req, out := c.DescribeDBSnapshotAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBSnapshotAttributesWithContext is the same as DescribeDBSnapshotAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBSnapshotAttributes 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 *RDS) DescribeDBSnapshotAttributesWithContext(ctx aws.Context, input *DescribeDBSnapshotAttributesInput, opts ...request.Option) (*DescribeDBSnapshotAttributesOutput, error) { + req, out := c.DescribeDBSnapshotAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDBSnapshots = "DescribeDBSnapshots" @@ -3877,8 +4764,23 @@ func (c *RDS) DescribeDBSnapshotsRequest(input *DescribeDBSnapshotsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBSnapshots func (c *RDS) DescribeDBSnapshots(input *DescribeDBSnapshotsInput) (*DescribeDBSnapshotsOutput, error) { req, out := c.DescribeDBSnapshotsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBSnapshotsWithContext is the same as DescribeDBSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBSnapshots 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 *RDS) DescribeDBSnapshotsWithContext(ctx aws.Context, input *DescribeDBSnapshotsInput, opts ...request.Option) (*DescribeDBSnapshotsOutput, error) { + req, out := c.DescribeDBSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBSnapshotsPages iterates over the pages of a DescribeDBSnapshots operation, @@ -3898,12 +4800,37 @@ func (c *RDS) DescribeDBSnapshots(input *DescribeDBSnapshotsInput) (*DescribeDBS // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBSnapshotsPages(input *DescribeDBSnapshotsInput, fn func(p *DescribeDBSnapshotsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBSnapshotsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBSnapshotsOutput), lastPage) - }) +func (c *RDS) DescribeDBSnapshotsPages(input *DescribeDBSnapshotsInput, fn func(*DescribeDBSnapshotsOutput, bool) bool) error { + return c.DescribeDBSnapshotsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBSnapshotsPagesWithContext same as DescribeDBSnapshotsPages 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 *RDS) DescribeDBSnapshotsPagesWithContext(ctx aws.Context, input *DescribeDBSnapshotsInput, fn func(*DescribeDBSnapshotsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBSnapshotsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBSnapshotsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBSnapshotsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDBSubnetGroups = "DescribeDBSubnetGroups" @@ -3976,8 +4903,23 @@ func (c *RDS) DescribeDBSubnetGroupsRequest(input *DescribeDBSubnetGroupsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeDBSubnetGroups func (c *RDS) DescribeDBSubnetGroups(input *DescribeDBSubnetGroupsInput) (*DescribeDBSubnetGroupsOutput, error) { req, out := c.DescribeDBSubnetGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDBSubnetGroupsWithContext is the same as DescribeDBSubnetGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDBSubnetGroups 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 *RDS) DescribeDBSubnetGroupsWithContext(ctx aws.Context, input *DescribeDBSubnetGroupsInput, opts ...request.Option) (*DescribeDBSubnetGroupsOutput, error) { + req, out := c.DescribeDBSubnetGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDBSubnetGroupsPages iterates over the pages of a DescribeDBSubnetGroups operation, @@ -3997,12 +4939,37 @@ func (c *RDS) DescribeDBSubnetGroups(input *DescribeDBSubnetGroupsInput) (*Descr // return pageNum <= 3 // }) // -func (c *RDS) DescribeDBSubnetGroupsPages(input *DescribeDBSubnetGroupsInput, fn func(p *DescribeDBSubnetGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDBSubnetGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDBSubnetGroupsOutput), lastPage) - }) +func (c *RDS) DescribeDBSubnetGroupsPages(input *DescribeDBSubnetGroupsInput, fn func(*DescribeDBSubnetGroupsOutput, bool) bool) error { + return c.DescribeDBSubnetGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDBSubnetGroupsPagesWithContext same as DescribeDBSubnetGroupsPages 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 *RDS) DescribeDBSubnetGroupsPagesWithContext(ctx aws.Context, input *DescribeDBSubnetGroupsInput, fn func(*DescribeDBSubnetGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDBSubnetGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBSubnetGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDBSubnetGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeEngineDefaultClusterParameters = "DescribeEngineDefaultClusterParameters" @@ -4065,8 +5032,23 @@ func (c *RDS) DescribeEngineDefaultClusterParametersRequest(input *DescribeEngin // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeEngineDefaultClusterParameters func (c *RDS) DescribeEngineDefaultClusterParameters(input *DescribeEngineDefaultClusterParametersInput) (*DescribeEngineDefaultClusterParametersOutput, error) { req, out := c.DescribeEngineDefaultClusterParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEngineDefaultClusterParametersWithContext is the same as DescribeEngineDefaultClusterParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEngineDefaultClusterParameters 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 *RDS) DescribeEngineDefaultClusterParametersWithContext(ctx aws.Context, input *DescribeEngineDefaultClusterParametersInput, opts ...request.Option) (*DescribeEngineDefaultClusterParametersOutput, error) { + req, out := c.DescribeEngineDefaultClusterParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEngineDefaultParameters = "DescribeEngineDefaultParameters" @@ -4132,8 +5114,23 @@ func (c *RDS) DescribeEngineDefaultParametersRequest(input *DescribeEngineDefaul // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeEngineDefaultParameters func (c *RDS) DescribeEngineDefaultParameters(input *DescribeEngineDefaultParametersInput) (*DescribeEngineDefaultParametersOutput, error) { req, out := c.DescribeEngineDefaultParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEngineDefaultParametersWithContext is the same as DescribeEngineDefaultParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEngineDefaultParameters 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 *RDS) DescribeEngineDefaultParametersWithContext(ctx aws.Context, input *DescribeEngineDefaultParametersInput, opts ...request.Option) (*DescribeEngineDefaultParametersOutput, error) { + req, out := c.DescribeEngineDefaultParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEngineDefaultParametersPages iterates over the pages of a DescribeEngineDefaultParameters operation, @@ -4153,12 +5150,37 @@ func (c *RDS) DescribeEngineDefaultParameters(input *DescribeEngineDefaultParame // return pageNum <= 3 // }) // -func (c *RDS) DescribeEngineDefaultParametersPages(input *DescribeEngineDefaultParametersInput, fn func(p *DescribeEngineDefaultParametersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEngineDefaultParametersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEngineDefaultParametersOutput), lastPage) - }) +func (c *RDS) DescribeEngineDefaultParametersPages(input *DescribeEngineDefaultParametersInput, fn func(*DescribeEngineDefaultParametersOutput, bool) bool) error { + return c.DescribeEngineDefaultParametersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEngineDefaultParametersPagesWithContext same as DescribeEngineDefaultParametersPages 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 *RDS) DescribeEngineDefaultParametersPagesWithContext(ctx aws.Context, input *DescribeEngineDefaultParametersInput, fn func(*DescribeEngineDefaultParametersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEngineDefaultParametersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEngineDefaultParametersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEngineDefaultParametersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeEventCategories = "DescribeEventCategories" @@ -4220,8 +5242,23 @@ func (c *RDS) DescribeEventCategoriesRequest(input *DescribeEventCategoriesInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeEventCategories func (c *RDS) DescribeEventCategories(input *DescribeEventCategoriesInput) (*DescribeEventCategoriesOutput, error) { req, out := c.DescribeEventCategoriesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventCategoriesWithContext is the same as DescribeEventCategories with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEventCategories 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 *RDS) DescribeEventCategoriesWithContext(ctx aws.Context, input *DescribeEventCategoriesInput, opts ...request.Option) (*DescribeEventCategoriesOutput, error) { + req, out := c.DescribeEventCategoriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEventSubscriptions = "DescribeEventSubscriptions" @@ -4295,8 +5332,23 @@ func (c *RDS) DescribeEventSubscriptionsRequest(input *DescribeEventSubscription // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeEventSubscriptions func (c *RDS) DescribeEventSubscriptions(input *DescribeEventSubscriptionsInput) (*DescribeEventSubscriptionsOutput, error) { req, out := c.DescribeEventSubscriptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventSubscriptionsWithContext is the same as DescribeEventSubscriptions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEventSubscriptions 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 *RDS) DescribeEventSubscriptionsWithContext(ctx aws.Context, input *DescribeEventSubscriptionsInput, opts ...request.Option) (*DescribeEventSubscriptionsOutput, error) { + req, out := c.DescribeEventSubscriptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEventSubscriptionsPages iterates over the pages of a DescribeEventSubscriptions operation, @@ -4316,12 +5368,37 @@ func (c *RDS) DescribeEventSubscriptions(input *DescribeEventSubscriptionsInput) // return pageNum <= 3 // }) // -func (c *RDS) DescribeEventSubscriptionsPages(input *DescribeEventSubscriptionsInput, fn func(p *DescribeEventSubscriptionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEventSubscriptionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEventSubscriptionsOutput), lastPage) - }) +func (c *RDS) DescribeEventSubscriptionsPages(input *DescribeEventSubscriptionsInput, fn func(*DescribeEventSubscriptionsOutput, bool) bool) error { + return c.DescribeEventSubscriptionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEventSubscriptionsPagesWithContext same as DescribeEventSubscriptionsPages 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 *RDS) DescribeEventSubscriptionsPagesWithContext(ctx aws.Context, input *DescribeEventSubscriptionsInput, fn func(*DescribeEventSubscriptionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEventSubscriptionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEventSubscriptionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEventSubscriptionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeEvents = "DescribeEvents" @@ -4390,8 +5467,23 @@ func (c *RDS) DescribeEventsRequest(input *DescribeEventsInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeEvents func (c *RDS) DescribeEvents(input *DescribeEventsInput) (*DescribeEventsOutput, error) { req, out := c.DescribeEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventsWithContext is the same as DescribeEvents with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEvents 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 *RDS) DescribeEventsWithContext(ctx aws.Context, input *DescribeEventsInput, opts ...request.Option) (*DescribeEventsOutput, error) { + req, out := c.DescribeEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEventsPages iterates over the pages of a DescribeEvents operation, @@ -4411,12 +5503,37 @@ func (c *RDS) DescribeEvents(input *DescribeEventsInput) (*DescribeEventsOutput, // return pageNum <= 3 // }) // -func (c *RDS) DescribeEventsPages(input *DescribeEventsInput, fn func(p *DescribeEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEventsOutput), lastPage) - }) +func (c *RDS) DescribeEventsPages(input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool) error { + return c.DescribeEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEventsPagesWithContext same as DescribeEventsPages 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 *RDS) DescribeEventsPagesWithContext(ctx aws.Context, input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeOptionGroupOptions = "DescribeOptionGroupOptions" @@ -4481,8 +5598,23 @@ func (c *RDS) DescribeOptionGroupOptionsRequest(input *DescribeOptionGroupOption // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeOptionGroupOptions func (c *RDS) DescribeOptionGroupOptions(input *DescribeOptionGroupOptionsInput) (*DescribeOptionGroupOptionsOutput, error) { req, out := c.DescribeOptionGroupOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeOptionGroupOptionsWithContext is the same as DescribeOptionGroupOptions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeOptionGroupOptions 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 *RDS) DescribeOptionGroupOptionsWithContext(ctx aws.Context, input *DescribeOptionGroupOptionsInput, opts ...request.Option) (*DescribeOptionGroupOptionsOutput, error) { + req, out := c.DescribeOptionGroupOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeOptionGroupOptionsPages iterates over the pages of a DescribeOptionGroupOptions operation, @@ -4502,12 +5634,37 @@ func (c *RDS) DescribeOptionGroupOptions(input *DescribeOptionGroupOptionsInput) // return pageNum <= 3 // }) // -func (c *RDS) DescribeOptionGroupOptionsPages(input *DescribeOptionGroupOptionsInput, fn func(p *DescribeOptionGroupOptionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeOptionGroupOptionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeOptionGroupOptionsOutput), lastPage) - }) +func (c *RDS) DescribeOptionGroupOptionsPages(input *DescribeOptionGroupOptionsInput, fn func(*DescribeOptionGroupOptionsOutput, bool) bool) error { + return c.DescribeOptionGroupOptionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeOptionGroupOptionsPagesWithContext same as DescribeOptionGroupOptionsPages 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 *RDS) DescribeOptionGroupOptionsPagesWithContext(ctx aws.Context, input *DescribeOptionGroupOptionsInput, fn func(*DescribeOptionGroupOptionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeOptionGroupOptionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeOptionGroupOptionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeOptionGroupOptionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeOptionGroups = "DescribeOptionGroups" @@ -4577,8 +5734,23 @@ func (c *RDS) DescribeOptionGroupsRequest(input *DescribeOptionGroupsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeOptionGroups func (c *RDS) DescribeOptionGroups(input *DescribeOptionGroupsInput) (*DescribeOptionGroupsOutput, error) { req, out := c.DescribeOptionGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeOptionGroupsWithContext is the same as DescribeOptionGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeOptionGroups 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 *RDS) DescribeOptionGroupsWithContext(ctx aws.Context, input *DescribeOptionGroupsInput, opts ...request.Option) (*DescribeOptionGroupsOutput, error) { + req, out := c.DescribeOptionGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeOptionGroupsPages iterates over the pages of a DescribeOptionGroups operation, @@ -4598,12 +5770,37 @@ func (c *RDS) DescribeOptionGroups(input *DescribeOptionGroupsInput) (*DescribeO // return pageNum <= 3 // }) // -func (c *RDS) DescribeOptionGroupsPages(input *DescribeOptionGroupsInput, fn func(p *DescribeOptionGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeOptionGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeOptionGroupsOutput), lastPage) - }) +func (c *RDS) DescribeOptionGroupsPages(input *DescribeOptionGroupsInput, fn func(*DescribeOptionGroupsOutput, bool) bool) error { + return c.DescribeOptionGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeOptionGroupsPagesWithContext same as DescribeOptionGroupsPages 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 *RDS) DescribeOptionGroupsPagesWithContext(ctx aws.Context, input *DescribeOptionGroupsInput, fn func(*DescribeOptionGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeOptionGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeOptionGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeOptionGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeOrderableDBInstanceOptions = "DescribeOrderableDBInstanceOptions" @@ -4668,8 +5865,23 @@ func (c *RDS) DescribeOrderableDBInstanceOptionsRequest(input *DescribeOrderable // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeOrderableDBInstanceOptions func (c *RDS) DescribeOrderableDBInstanceOptions(input *DescribeOrderableDBInstanceOptionsInput) (*DescribeOrderableDBInstanceOptionsOutput, error) { req, out := c.DescribeOrderableDBInstanceOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeOrderableDBInstanceOptionsWithContext is the same as DescribeOrderableDBInstanceOptions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeOrderableDBInstanceOptions 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 *RDS) DescribeOrderableDBInstanceOptionsWithContext(ctx aws.Context, input *DescribeOrderableDBInstanceOptionsInput, opts ...request.Option) (*DescribeOrderableDBInstanceOptionsOutput, error) { + req, out := c.DescribeOrderableDBInstanceOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeOrderableDBInstanceOptionsPages iterates over the pages of a DescribeOrderableDBInstanceOptions operation, @@ -4689,12 +5901,37 @@ func (c *RDS) DescribeOrderableDBInstanceOptions(input *DescribeOrderableDBInsta // return pageNum <= 3 // }) // -func (c *RDS) DescribeOrderableDBInstanceOptionsPages(input *DescribeOrderableDBInstanceOptionsInput, fn func(p *DescribeOrderableDBInstanceOptionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeOrderableDBInstanceOptionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeOrderableDBInstanceOptionsOutput), lastPage) - }) +func (c *RDS) DescribeOrderableDBInstanceOptionsPages(input *DescribeOrderableDBInstanceOptionsInput, fn func(*DescribeOrderableDBInstanceOptionsOutput, bool) bool) error { + return c.DescribeOrderableDBInstanceOptionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeOrderableDBInstanceOptionsPagesWithContext same as DescribeOrderableDBInstanceOptionsPages 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 *RDS) DescribeOrderableDBInstanceOptionsPagesWithContext(ctx aws.Context, input *DescribeOrderableDBInstanceOptionsInput, fn func(*DescribeOrderableDBInstanceOptionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeOrderableDBInstanceOptionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeOrderableDBInstanceOptionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeOrderableDBInstanceOptionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribePendingMaintenanceActions = "DescribePendingMaintenanceActions" @@ -4759,8 +5996,23 @@ func (c *RDS) DescribePendingMaintenanceActionsRequest(input *DescribePendingMai // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribePendingMaintenanceActions func (c *RDS) DescribePendingMaintenanceActions(input *DescribePendingMaintenanceActionsInput) (*DescribePendingMaintenanceActionsOutput, error) { req, out := c.DescribePendingMaintenanceActionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribePendingMaintenanceActionsWithContext is the same as DescribePendingMaintenanceActions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePendingMaintenanceActions 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 *RDS) DescribePendingMaintenanceActionsWithContext(ctx aws.Context, input *DescribePendingMaintenanceActionsInput, opts ...request.Option) (*DescribePendingMaintenanceActionsOutput, error) { + req, out := c.DescribePendingMaintenanceActionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReservedDBInstances = "DescribeReservedDBInstances" @@ -4831,8 +6083,23 @@ func (c *RDS) DescribeReservedDBInstancesRequest(input *DescribeReservedDBInstan // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeReservedDBInstances func (c *RDS) DescribeReservedDBInstances(input *DescribeReservedDBInstancesInput) (*DescribeReservedDBInstancesOutput, error) { req, out := c.DescribeReservedDBInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedDBInstancesWithContext is the same as DescribeReservedDBInstances with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedDBInstances 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 *RDS) DescribeReservedDBInstancesWithContext(ctx aws.Context, input *DescribeReservedDBInstancesInput, opts ...request.Option) (*DescribeReservedDBInstancesOutput, error) { + req, out := c.DescribeReservedDBInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedDBInstancesPages iterates over the pages of a DescribeReservedDBInstances operation, @@ -4852,12 +6119,37 @@ func (c *RDS) DescribeReservedDBInstances(input *DescribeReservedDBInstancesInpu // return pageNum <= 3 // }) // -func (c *RDS) DescribeReservedDBInstancesPages(input *DescribeReservedDBInstancesInput, fn func(p *DescribeReservedDBInstancesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedDBInstancesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedDBInstancesOutput), lastPage) - }) +func (c *RDS) DescribeReservedDBInstancesPages(input *DescribeReservedDBInstancesInput, fn func(*DescribeReservedDBInstancesOutput, bool) bool) error { + return c.DescribeReservedDBInstancesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedDBInstancesPagesWithContext same as DescribeReservedDBInstancesPages 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 *RDS) DescribeReservedDBInstancesPagesWithContext(ctx aws.Context, input *DescribeReservedDBInstancesInput, fn func(*DescribeReservedDBInstancesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedDBInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedDBInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedDBInstancesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeReservedDBInstancesOfferings = "DescribeReservedDBInstancesOfferings" @@ -4924,11 +6216,26 @@ func (c *RDS) DescribeReservedDBInstancesOfferingsRequest(input *DescribeReserve // * ErrCodeReservedDBInstancesOfferingNotFoundFault "ReservedDBInstancesOfferingNotFound" // Specified offering does not exist. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeReservedDBInstancesOfferings -func (c *RDS) DescribeReservedDBInstancesOfferings(input *DescribeReservedDBInstancesOfferingsInput) (*DescribeReservedDBInstancesOfferingsOutput, error) { +// Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeReservedDBInstancesOfferings +func (c *RDS) DescribeReservedDBInstancesOfferings(input *DescribeReservedDBInstancesOfferingsInput) (*DescribeReservedDBInstancesOfferingsOutput, error) { + req, out := c.DescribeReservedDBInstancesOfferingsRequest(input) + return out, req.Send() +} + +// DescribeReservedDBInstancesOfferingsWithContext is the same as DescribeReservedDBInstancesOfferings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedDBInstancesOfferings 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 *RDS) DescribeReservedDBInstancesOfferingsWithContext(ctx aws.Context, input *DescribeReservedDBInstancesOfferingsInput, opts ...request.Option) (*DescribeReservedDBInstancesOfferingsOutput, error) { req, out := c.DescribeReservedDBInstancesOfferingsRequest(input) - err := req.Send() - return out, err + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedDBInstancesOfferingsPages iterates over the pages of a DescribeReservedDBInstancesOfferings operation, @@ -4948,12 +6255,37 @@ func (c *RDS) DescribeReservedDBInstancesOfferings(input *DescribeReservedDBInst // return pageNum <= 3 // }) // -func (c *RDS) DescribeReservedDBInstancesOfferingsPages(input *DescribeReservedDBInstancesOfferingsInput, fn func(p *DescribeReservedDBInstancesOfferingsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedDBInstancesOfferingsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedDBInstancesOfferingsOutput), lastPage) - }) +func (c *RDS) DescribeReservedDBInstancesOfferingsPages(input *DescribeReservedDBInstancesOfferingsInput, fn func(*DescribeReservedDBInstancesOfferingsOutput, bool) bool) error { + return c.DescribeReservedDBInstancesOfferingsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedDBInstancesOfferingsPagesWithContext same as DescribeReservedDBInstancesOfferingsPages 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 *RDS) DescribeReservedDBInstancesOfferingsPagesWithContext(ctx aws.Context, input *DescribeReservedDBInstancesOfferingsInput, fn func(*DescribeReservedDBInstancesOfferingsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedDBInstancesOfferingsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedDBInstancesOfferingsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedDBInstancesOfferingsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeSourceRegions = "DescribeSourceRegions" @@ -5014,8 +6346,23 @@ func (c *RDS) DescribeSourceRegionsRequest(input *DescribeSourceRegionsInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DescribeSourceRegions func (c *RDS) DescribeSourceRegions(input *DescribeSourceRegionsInput) (*DescribeSourceRegionsOutput, error) { req, out := c.DescribeSourceRegionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSourceRegionsWithContext is the same as DescribeSourceRegions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSourceRegions 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 *RDS) DescribeSourceRegionsWithContext(ctx aws.Context, input *DescribeSourceRegionsInput, opts ...request.Option) (*DescribeSourceRegionsOutput, error) { + req, out := c.DescribeSourceRegionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDownloadDBLogFilePortion = "DownloadDBLogFilePortion" @@ -5088,8 +6435,23 @@ func (c *RDS) DownloadDBLogFilePortionRequest(input *DownloadDBLogFilePortionInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/DownloadDBLogFilePortion func (c *RDS) DownloadDBLogFilePortion(input *DownloadDBLogFilePortionInput) (*DownloadDBLogFilePortionOutput, error) { req, out := c.DownloadDBLogFilePortionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DownloadDBLogFilePortionWithContext is the same as DownloadDBLogFilePortion with the addition of +// the ability to pass a context and additional request options. +// +// See DownloadDBLogFilePortion 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 *RDS) DownloadDBLogFilePortionWithContext(ctx aws.Context, input *DownloadDBLogFilePortionInput, opts ...request.Option) (*DownloadDBLogFilePortionOutput, error) { + req, out := c.DownloadDBLogFilePortionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DownloadDBLogFilePortionPages iterates over the pages of a DownloadDBLogFilePortion operation, @@ -5109,12 +6471,37 @@ func (c *RDS) DownloadDBLogFilePortion(input *DownloadDBLogFilePortionInput) (*D // return pageNum <= 3 // }) // -func (c *RDS) DownloadDBLogFilePortionPages(input *DownloadDBLogFilePortionInput, fn func(p *DownloadDBLogFilePortionOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DownloadDBLogFilePortionRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DownloadDBLogFilePortionOutput), lastPage) - }) +func (c *RDS) DownloadDBLogFilePortionPages(input *DownloadDBLogFilePortionInput, fn func(*DownloadDBLogFilePortionOutput, bool) bool) error { + return c.DownloadDBLogFilePortionPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DownloadDBLogFilePortionPagesWithContext same as DownloadDBLogFilePortionPages 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 *RDS) DownloadDBLogFilePortionPagesWithContext(ctx aws.Context, input *DownloadDBLogFilePortionInput, fn func(*DownloadDBLogFilePortionOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DownloadDBLogFilePortionInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DownloadDBLogFilePortionRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DownloadDBLogFilePortionOutput), !p.HasNextPage()) + } + return p.Err() } const opFailoverDBCluster = "FailoverDBCluster" @@ -5197,8 +6584,23 @@ func (c *RDS) FailoverDBClusterRequest(input *FailoverDBClusterInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/FailoverDBCluster func (c *RDS) FailoverDBCluster(input *FailoverDBClusterInput) (*FailoverDBClusterOutput, error) { req, out := c.FailoverDBClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// FailoverDBClusterWithContext is the same as FailoverDBCluster with the addition of +// the ability to pass a context and additional request options. +// +// See FailoverDBCluster 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 *RDS) FailoverDBClusterWithContext(ctx aws.Context, input *FailoverDBClusterInput, opts ...request.Option) (*FailoverDBClusterOutput, error) { + req, out := c.FailoverDBClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResource = "ListTagsForResource" @@ -5271,8 +6673,23 @@ func (c *RDS) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ListTagsForResource func (c *RDS) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *RDS) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBCluster = "ModifyDBCluster" @@ -5374,8 +6791,23 @@ func (c *RDS) ModifyDBClusterRequest(input *ModifyDBClusterInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBCluster func (c *RDS) ModifyDBCluster(input *ModifyDBClusterInput) (*ModifyDBClusterOutput, error) { req, out := c.ModifyDBClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBClusterWithContext is the same as ModifyDBCluster with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBCluster 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 *RDS) ModifyDBClusterWithContext(ctx aws.Context, input *ModifyDBClusterInput, opts ...request.Option) (*ModifyDBClusterOutput, error) { + req, out := c.ModifyDBClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBClusterParameterGroup = "ModifyDBClusterParameterGroup" @@ -5462,8 +6894,23 @@ func (c *RDS) ModifyDBClusterParameterGroupRequest(input *ModifyDBClusterParamet // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBClusterParameterGroup func (c *RDS) ModifyDBClusterParameterGroup(input *ModifyDBClusterParameterGroupInput) (*DBClusterParameterGroupNameMessage, error) { req, out := c.ModifyDBClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBClusterParameterGroupWithContext is the same as ModifyDBClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBClusterParameterGroup 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 *RDS) ModifyDBClusterParameterGroupWithContext(ctx aws.Context, input *ModifyDBClusterParameterGroupInput, opts ...request.Option) (*DBClusterParameterGroupNameMessage, error) { + req, out := c.ModifyDBClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBClusterSnapshotAttribute = "ModifyDBClusterSnapshotAttribute" @@ -5549,8 +6996,23 @@ func (c *RDS) ModifyDBClusterSnapshotAttributeRequest(input *ModifyDBClusterSnap // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBClusterSnapshotAttribute func (c *RDS) ModifyDBClusterSnapshotAttribute(input *ModifyDBClusterSnapshotAttributeInput) (*ModifyDBClusterSnapshotAttributeOutput, error) { req, out := c.ModifyDBClusterSnapshotAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBClusterSnapshotAttributeWithContext is the same as ModifyDBClusterSnapshotAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBClusterSnapshotAttribute 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 *RDS) ModifyDBClusterSnapshotAttributeWithContext(ctx aws.Context, input *ModifyDBClusterSnapshotAttributeInput, opts ...request.Option) (*ModifyDBClusterSnapshotAttributeOutput, error) { + req, out := c.ModifyDBClusterSnapshotAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBInstance = "ModifyDBInstance" @@ -5668,8 +7130,23 @@ func (c *RDS) ModifyDBInstanceRequest(input *ModifyDBInstanceInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBInstance func (c *RDS) ModifyDBInstance(input *ModifyDBInstanceInput) (*ModifyDBInstanceOutput, error) { req, out := c.ModifyDBInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBInstanceWithContext is the same as ModifyDBInstance with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBInstance 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 *RDS) ModifyDBInstanceWithContext(ctx aws.Context, input *ModifyDBInstanceInput, opts ...request.Option) (*ModifyDBInstanceOutput, error) { + req, out := c.ModifyDBInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBParameterGroup = "ModifyDBParameterGroup" @@ -5753,8 +7230,23 @@ func (c *RDS) ModifyDBParameterGroupRequest(input *ModifyDBParameterGroupInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBParameterGroup func (c *RDS) ModifyDBParameterGroup(input *ModifyDBParameterGroupInput) (*DBParameterGroupNameMessage, error) { req, out := c.ModifyDBParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBParameterGroupWithContext is the same as ModifyDBParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBParameterGroup 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 *RDS) ModifyDBParameterGroupWithContext(ctx aws.Context, input *ModifyDBParameterGroupInput, opts ...request.Option) (*DBParameterGroupNameMessage, error) { + req, out := c.ModifyDBParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBSnapshot = "ModifyDBSnapshot" @@ -5823,8 +7315,23 @@ func (c *RDS) ModifyDBSnapshotRequest(input *ModifyDBSnapshotInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBSnapshot func (c *RDS) ModifyDBSnapshot(input *ModifyDBSnapshotInput) (*ModifyDBSnapshotOutput, error) { req, out := c.ModifyDBSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBSnapshotWithContext is the same as ModifyDBSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBSnapshot 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 *RDS) ModifyDBSnapshotWithContext(ctx aws.Context, input *ModifyDBSnapshotInput, opts ...request.Option) (*ModifyDBSnapshotOutput, error) { + req, out := c.ModifyDBSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBSnapshotAttribute = "ModifyDBSnapshotAttribute" @@ -5910,8 +7417,23 @@ func (c *RDS) ModifyDBSnapshotAttributeRequest(input *ModifyDBSnapshotAttributeI // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBSnapshotAttribute func (c *RDS) ModifyDBSnapshotAttribute(input *ModifyDBSnapshotAttributeInput) (*ModifyDBSnapshotAttributeOutput, error) { req, out := c.ModifyDBSnapshotAttributeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBSnapshotAttributeWithContext is the same as ModifyDBSnapshotAttribute with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBSnapshotAttribute 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 *RDS) ModifyDBSnapshotAttributeWithContext(ctx aws.Context, input *ModifyDBSnapshotAttributeInput, opts ...request.Option) (*ModifyDBSnapshotAttributeOutput, error) { + req, out := c.ModifyDBSnapshotAttributeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDBSubnetGroup = "ModifyDBSubnetGroup" @@ -5991,8 +7513,23 @@ func (c *RDS) ModifyDBSubnetGroupRequest(input *ModifyDBSubnetGroupInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyDBSubnetGroup func (c *RDS) ModifyDBSubnetGroup(input *ModifyDBSubnetGroupInput) (*ModifyDBSubnetGroupOutput, error) { req, out := c.ModifyDBSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDBSubnetGroupWithContext is the same as ModifyDBSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDBSubnetGroup 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 *RDS) ModifyDBSubnetGroupWithContext(ctx aws.Context, input *ModifyDBSubnetGroupInput, opts ...request.Option) (*ModifyDBSubnetGroupOutput, error) { + req, out := c.ModifyDBSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyEventSubscription = "ModifyEventSubscription" @@ -6079,8 +7616,23 @@ func (c *RDS) ModifyEventSubscriptionRequest(input *ModifyEventSubscriptionInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyEventSubscription func (c *RDS) ModifyEventSubscription(input *ModifyEventSubscriptionInput) (*ModifyEventSubscriptionOutput, error) { req, out := c.ModifyEventSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyEventSubscriptionWithContext is the same as ModifyEventSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyEventSubscription 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 *RDS) ModifyEventSubscriptionWithContext(ctx aws.Context, input *ModifyEventSubscriptionInput, opts ...request.Option) (*ModifyEventSubscriptionOutput, error) { + req, out := c.ModifyEventSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyOptionGroup = "ModifyOptionGroup" @@ -6147,8 +7699,23 @@ func (c *RDS) ModifyOptionGroupRequest(input *ModifyOptionGroupInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ModifyOptionGroup func (c *RDS) ModifyOptionGroup(input *ModifyOptionGroupInput) (*ModifyOptionGroupOutput, error) { req, out := c.ModifyOptionGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyOptionGroupWithContext is the same as ModifyOptionGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyOptionGroup 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 *RDS) ModifyOptionGroupWithContext(ctx aws.Context, input *ModifyOptionGroupInput, opts ...request.Option) (*ModifyOptionGroupOutput, error) { + req, out := c.ModifyOptionGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPromoteReadReplica = "PromoteReadReplica" @@ -6220,8 +7787,23 @@ func (c *RDS) PromoteReadReplicaRequest(input *PromoteReadReplicaInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/PromoteReadReplica func (c *RDS) PromoteReadReplica(input *PromoteReadReplicaInput) (*PromoteReadReplicaOutput, error) { req, out := c.PromoteReadReplicaRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PromoteReadReplicaWithContext is the same as PromoteReadReplica with the addition of +// the ability to pass a context and additional request options. +// +// See PromoteReadReplica 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 *RDS) PromoteReadReplicaWithContext(ctx aws.Context, input *PromoteReadReplicaInput, opts ...request.Option) (*PromoteReadReplicaOutput, error) { + req, out := c.PromoteReadReplicaRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPromoteReadReplicaDBCluster = "PromoteReadReplicaDBCluster" @@ -6288,8 +7870,23 @@ func (c *RDS) PromoteReadReplicaDBClusterRequest(input *PromoteReadReplicaDBClus // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/PromoteReadReplicaDBCluster func (c *RDS) PromoteReadReplicaDBCluster(input *PromoteReadReplicaDBClusterInput) (*PromoteReadReplicaDBClusterOutput, error) { req, out := c.PromoteReadReplicaDBClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PromoteReadReplicaDBClusterWithContext is the same as PromoteReadReplicaDBCluster with the addition of +// the ability to pass a context and additional request options. +// +// See PromoteReadReplicaDBCluster 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 *RDS) PromoteReadReplicaDBClusterWithContext(ctx aws.Context, input *PromoteReadReplicaDBClusterInput, opts ...request.Option) (*PromoteReadReplicaDBClusterOutput, error) { + req, out := c.PromoteReadReplicaDBClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPurchaseReservedDBInstancesOffering = "PurchaseReservedDBInstancesOffering" @@ -6359,8 +7956,23 @@ func (c *RDS) PurchaseReservedDBInstancesOfferingRequest(input *PurchaseReserved // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/PurchaseReservedDBInstancesOffering func (c *RDS) PurchaseReservedDBInstancesOffering(input *PurchaseReservedDBInstancesOfferingInput) (*PurchaseReservedDBInstancesOfferingOutput, error) { req, out := c.PurchaseReservedDBInstancesOfferingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurchaseReservedDBInstancesOfferingWithContext is the same as PurchaseReservedDBInstancesOffering with the addition of +// the ability to pass a context and additional request options. +// +// See PurchaseReservedDBInstancesOffering 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 *RDS) PurchaseReservedDBInstancesOfferingWithContext(ctx aws.Context, input *PurchaseReservedDBInstancesOfferingInput, opts ...request.Option) (*PurchaseReservedDBInstancesOfferingOutput, error) { + req, out := c.PurchaseReservedDBInstancesOfferingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRebootDBInstance = "RebootDBInstance" @@ -6443,8 +8055,23 @@ func (c *RDS) RebootDBInstanceRequest(input *RebootDBInstanceInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RebootDBInstance func (c *RDS) RebootDBInstance(input *RebootDBInstanceInput) (*RebootDBInstanceOutput, error) { req, out := c.RebootDBInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RebootDBInstanceWithContext is the same as RebootDBInstance with the addition of +// the ability to pass a context and additional request options. +// +// See RebootDBInstance 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 *RDS) RebootDBInstanceWithContext(ctx aws.Context, input *RebootDBInstanceInput, opts ...request.Option) (*RebootDBInstanceOutput, error) { + req, out := c.RebootDBInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveRoleFromDBCluster = "RemoveRoleFromDBCluster" @@ -6519,8 +8146,23 @@ func (c *RDS) RemoveRoleFromDBClusterRequest(input *RemoveRoleFromDBClusterInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RemoveRoleFromDBCluster func (c *RDS) RemoveRoleFromDBCluster(input *RemoveRoleFromDBClusterInput) (*RemoveRoleFromDBClusterOutput, error) { req, out := c.RemoveRoleFromDBClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveRoleFromDBClusterWithContext is the same as RemoveRoleFromDBCluster with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveRoleFromDBCluster 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 *RDS) RemoveRoleFromDBClusterWithContext(ctx aws.Context, input *RemoveRoleFromDBClusterInput, opts ...request.Option) (*RemoveRoleFromDBClusterOutput, error) { + req, out := c.RemoveRoleFromDBClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveSourceIdentifierFromSubscription = "RemoveSourceIdentifierFromSubscription" @@ -6587,8 +8229,23 @@ func (c *RDS) RemoveSourceIdentifierFromSubscriptionRequest(input *RemoveSourceI // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RemoveSourceIdentifierFromSubscription func (c *RDS) RemoveSourceIdentifierFromSubscription(input *RemoveSourceIdentifierFromSubscriptionInput) (*RemoveSourceIdentifierFromSubscriptionOutput, error) { req, out := c.RemoveSourceIdentifierFromSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveSourceIdentifierFromSubscriptionWithContext is the same as RemoveSourceIdentifierFromSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveSourceIdentifierFromSubscription 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 *RDS) RemoveSourceIdentifierFromSubscriptionWithContext(ctx aws.Context, input *RemoveSourceIdentifierFromSubscriptionInput, opts ...request.Option) (*RemoveSourceIdentifierFromSubscriptionOutput, error) { + req, out := c.RemoveSourceIdentifierFromSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromResource = "RemoveTagsFromResource" @@ -6663,8 +8320,23 @@ func (c *RDS) RemoveTagsFromResourceRequest(input *RemoveTagsFromResourceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RemoveTagsFromResource func (c *RDS) RemoveTagsFromResource(input *RemoveTagsFromResourceInput) (*RemoveTagsFromResourceOutput, error) { req, out := c.RemoveTagsFromResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromResourceWithContext is the same as RemoveTagsFromResource with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromResource 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 *RDS) RemoveTagsFromResourceWithContext(ctx aws.Context, input *RemoveTagsFromResourceInput, opts ...request.Option) (*RemoveTagsFromResourceOutput, error) { + req, out := c.RemoveTagsFromResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetDBClusterParameterGroup = "ResetDBClusterParameterGroup" @@ -6743,8 +8415,23 @@ func (c *RDS) ResetDBClusterParameterGroupRequest(input *ResetDBClusterParameter // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ResetDBClusterParameterGroup func (c *RDS) ResetDBClusterParameterGroup(input *ResetDBClusterParameterGroupInput) (*DBClusterParameterGroupNameMessage, error) { req, out := c.ResetDBClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetDBClusterParameterGroupWithContext is the same as ResetDBClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ResetDBClusterParameterGroup 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 *RDS) ResetDBClusterParameterGroupWithContext(ctx aws.Context, input *ResetDBClusterParameterGroupInput, opts ...request.Option) (*DBClusterParameterGroupNameMessage, error) { + req, out := c.ResetDBClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetDBParameterGroup = "ResetDBParameterGroup" @@ -6817,8 +8504,23 @@ func (c *RDS) ResetDBParameterGroupRequest(input *ResetDBParameterGroupInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/ResetDBParameterGroup func (c *RDS) ResetDBParameterGroup(input *ResetDBParameterGroupInput) (*DBParameterGroupNameMessage, error) { req, out := c.ResetDBParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetDBParameterGroupWithContext is the same as ResetDBParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ResetDBParameterGroup 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 *RDS) ResetDBParameterGroupWithContext(ctx aws.Context, input *ResetDBParameterGroupInput, opts ...request.Option) (*DBParameterGroupNameMessage, error) { + req, out := c.ResetDBParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreDBClusterFromS3 = "RestoreDBClusterFromS3" @@ -6930,8 +8632,23 @@ func (c *RDS) RestoreDBClusterFromS3Request(input *RestoreDBClusterFromS3Input) // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RestoreDBClusterFromS3 func (c *RDS) RestoreDBClusterFromS3(input *RestoreDBClusterFromS3Input) (*RestoreDBClusterFromS3Output, error) { req, out := c.RestoreDBClusterFromS3Request(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreDBClusterFromS3WithContext is the same as RestoreDBClusterFromS3 with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreDBClusterFromS3 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 *RDS) RestoreDBClusterFromS3WithContext(ctx aws.Context, input *RestoreDBClusterFromS3Input, opts ...request.Option) (*RestoreDBClusterFromS3Output, error) { + req, out := c.RestoreDBClusterFromS3Request(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreDBClusterFromSnapshot = "RestoreDBClusterFromSnapshot" @@ -7056,8 +8773,23 @@ func (c *RDS) RestoreDBClusterFromSnapshotRequest(input *RestoreDBClusterFromSna // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RestoreDBClusterFromSnapshot func (c *RDS) RestoreDBClusterFromSnapshot(input *RestoreDBClusterFromSnapshotInput) (*RestoreDBClusterFromSnapshotOutput, error) { req, out := c.RestoreDBClusterFromSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreDBClusterFromSnapshotWithContext is the same as RestoreDBClusterFromSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreDBClusterFromSnapshot 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 *RDS) RestoreDBClusterFromSnapshotWithContext(ctx aws.Context, input *RestoreDBClusterFromSnapshotInput, opts ...request.Option) (*RestoreDBClusterFromSnapshotOutput, error) { + req, out := c.RestoreDBClusterFromSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreDBClusterToPointInTime = "RestoreDBClusterToPointInTime" @@ -7183,8 +8915,23 @@ func (c *RDS) RestoreDBClusterToPointInTimeRequest(input *RestoreDBClusterToPoin // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RestoreDBClusterToPointInTime func (c *RDS) RestoreDBClusterToPointInTime(input *RestoreDBClusterToPointInTimeInput) (*RestoreDBClusterToPointInTimeOutput, error) { req, out := c.RestoreDBClusterToPointInTimeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreDBClusterToPointInTimeWithContext is the same as RestoreDBClusterToPointInTime with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreDBClusterToPointInTime 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 *RDS) RestoreDBClusterToPointInTimeWithContext(ctx aws.Context, input *RestoreDBClusterToPointInTimeInput, opts ...request.Option) (*RestoreDBClusterToPointInTimeOutput, error) { + req, out := c.RestoreDBClusterToPointInTimeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreDBInstanceFromDBSnapshot = "RestoreDBInstanceFromDBSnapshot" @@ -7326,8 +9073,23 @@ func (c *RDS) RestoreDBInstanceFromDBSnapshotRequest(input *RestoreDBInstanceFro // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RestoreDBInstanceFromDBSnapshot func (c *RDS) RestoreDBInstanceFromDBSnapshot(input *RestoreDBInstanceFromDBSnapshotInput) (*RestoreDBInstanceFromDBSnapshotOutput, error) { req, out := c.RestoreDBInstanceFromDBSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreDBInstanceFromDBSnapshotWithContext is the same as RestoreDBInstanceFromDBSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreDBInstanceFromDBSnapshot 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 *RDS) RestoreDBInstanceFromDBSnapshotWithContext(ctx aws.Context, input *RestoreDBInstanceFromDBSnapshotInput, opts ...request.Option) (*RestoreDBInstanceFromDBSnapshotOutput, error) { + req, out := c.RestoreDBInstanceFromDBSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreDBInstanceToPointInTime = "RestoreDBInstanceToPointInTime" @@ -7466,8 +9228,23 @@ func (c *RDS) RestoreDBInstanceToPointInTimeRequest(input *RestoreDBInstanceToPo // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RestoreDBInstanceToPointInTime func (c *RDS) RestoreDBInstanceToPointInTime(input *RestoreDBInstanceToPointInTimeInput) (*RestoreDBInstanceToPointInTimeOutput, error) { req, out := c.RestoreDBInstanceToPointInTimeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreDBInstanceToPointInTimeWithContext is the same as RestoreDBInstanceToPointInTime with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreDBInstanceToPointInTime 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 *RDS) RestoreDBInstanceToPointInTimeWithContext(ctx aws.Context, input *RestoreDBInstanceToPointInTimeInput, opts ...request.Option) (*RestoreDBInstanceToPointInTimeOutput, error) { + req, out := c.RestoreDBInstanceToPointInTimeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRevokeDBSecurityGroupIngress = "RevokeDBSecurityGroupIngress" @@ -7544,8 +9321,23 @@ func (c *RDS) RevokeDBSecurityGroupIngressRequest(input *RevokeDBSecurityGroupIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31/RevokeDBSecurityGroupIngress func (c *RDS) RevokeDBSecurityGroupIngress(input *RevokeDBSecurityGroupIngressInput) (*RevokeDBSecurityGroupIngressOutput, error) { req, out := c.RevokeDBSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RevokeDBSecurityGroupIngressWithContext is the same as RevokeDBSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See RevokeDBSecurityGroupIngress 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 *RDS) RevokeDBSecurityGroupIngressWithContext(ctx aws.Context, input *RevokeDBSecurityGroupIngressInput, opts ...request.Option) (*RevokeDBSecurityGroupIngressOutput, error) { + req, out := c.RevokeDBSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Describes a quota for an AWS account, for example, the number of DB instances @@ -8316,6 +10108,65 @@ func (s *CopyDBClusterParameterGroupOutput) SetDBClusterParameterGroup(v *DBClus type CopyDBClusterSnapshotInput struct { _ struct{} `type:"structure"` + CopyTags *bool `type:"boolean"` + + // DestinationRegion is used for presigning the request to a given region. + DestinationRegion *string `type:"string"` + + // The AWS KMS key ID for an encrypted DB cluster snapshot. The KMS key ID is + // the Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias + // for the KMS encryption key. + // + // If you copy an unencrypted DB cluster snapshot and specify a value for the + // KmsKeyId parameter, Amazon RDS encrypts the target DB cluster snapshot using + // the specified KMS encryption key. + // + // If you copy an encrypted DB cluster snapshot from your AWS account, you can + // specify a value for KmsKeyId to encrypt the copy with a new KMS encryption + // key. If you don't specify a value for KmsKeyId, then the copy of the DB cluster + // snapshot is encrypted with the same KMS key as the source DB cluster snapshot. + // + // If you copy an encrypted DB cluster snapshot that is shared from another + // AWS account, then you must specify a value for KmsKeyId. + // + // To copy an encrypted DB cluster snapshot to another region, you must set + // KmsKeyId to the KMS key ID you want to use to encrypt the copy of the DB + // cluster snapshot in the destination region. KMS encryption keys are specific + // to the region that they are created in, and you cannot use encryption keys + // from one region in another region. + KmsKeyId *string `type:"string"` + + // The URL that contains a Signature Version 4 signed request for the CopyDBClusterSnapshot + // API action in the AWS region that contains the source DB cluster snapshot + // to copy. The PreSignedUrl parameter must be used when copying an encrypted + // DB cluster snapshot from another AWS region. + // + // The pre-signed URL must be a valid request for the CopyDBSClusterSnapshot + // API action that can be executed in the source region that contains the encrypted + // DB cluster snapshot to be copied. The pre-signed URL request must contain + // the following parameter values: + // + // * KmsKeyId - The KMS key identifier for the key to use to encrypt the + // copy of the DB cluster snapshot in the destination region. This is the + // same identifier for both the CopyDBClusterSnapshot action that is called + // in the destination region, and the action contained in the pre-signed + // URL. + // + // * DestinationRegion - The name of the region that the DB cluster snapshot + // will be created in. + // + // * SourceDBClusterSnapshotIdentifier - The DB cluster snapshot identifier + // for the encrypted DB cluster snapshot to be copied. This identifier must + // be in the Amazon Resource Name (ARN) format for the source region. For + // example, if you are copying an encrypted DB cluster snapshot from the + // us-west-2 region, then your SourceDBClusterSnapshotIdentifier looks like + // the following example: arn:aws:rds:us-west-2:123456789012:cluster-snapshot:aurora-cluster1-snapshot-20161115. + // + // To learn how to generate a Signature Version 4 signed request, see Authenticating + // Requests: Using Query Parameters (AWS Signature Version 4) (http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) + // and Signature Version 4 Signing Process (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). + PreSignedUrl *string `type:"string"` + // The identifier of the DB cluster snapshot to copy. This parameter is not // case-sensitive. // @@ -8332,6 +10183,11 @@ type CopyDBClusterSnapshotInput struct { // SourceDBClusterSnapshotIdentifier is a required field SourceDBClusterSnapshotIdentifier *string `type:"string" required:"true"` + // SourceRegion is the source region where the resource exists. This is not + // sent over the wire and is only used for presigning. This value should always + // have the same region as the source ARN. + SourceRegion *string `type:"string" ignore:"true"` + // A list of tags. Tags []*Tag `locationNameList:"Tag" type:"list"` @@ -8378,12 +10234,42 @@ func (s *CopyDBClusterSnapshotInput) Validate() error { return nil } +// SetCopyTags sets the CopyTags field's value. +func (s *CopyDBClusterSnapshotInput) SetCopyTags(v bool) *CopyDBClusterSnapshotInput { + s.CopyTags = &v + return s +} + +// SetDestinationRegion sets the DestinationRegion field's value. +func (s *CopyDBClusterSnapshotInput) SetDestinationRegion(v string) *CopyDBClusterSnapshotInput { + s.DestinationRegion = &v + return s +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *CopyDBClusterSnapshotInput) SetKmsKeyId(v string) *CopyDBClusterSnapshotInput { + s.KmsKeyId = &v + return s +} + +// SetPreSignedUrl sets the PreSignedUrl field's value. +func (s *CopyDBClusterSnapshotInput) SetPreSignedUrl(v string) *CopyDBClusterSnapshotInput { + s.PreSignedUrl = &v + return s +} + // SetSourceDBClusterSnapshotIdentifier sets the SourceDBClusterSnapshotIdentifier field's value. func (s *CopyDBClusterSnapshotInput) SetSourceDBClusterSnapshotIdentifier(v string) *CopyDBClusterSnapshotInput { s.SourceDBClusterSnapshotIdentifier = &v return s } +// SetSourceRegion sets the SourceRegion field's value. +func (s *CopyDBClusterSnapshotInput) SetSourceRegion(v string) *CopyDBClusterSnapshotInput { + s.SourceRegion = &v + return s +} + // SetTags sets the Tags field's value. func (s *CopyDBClusterSnapshotInput) SetTags(v []*Tag) *CopyDBClusterSnapshotInput { s.Tags = v @@ -8966,6 +10852,9 @@ type CreateDBClusterInput struct { // you are creating. DatabaseName *string `type:"string"` + // DestinationRegion is used for presigning the request to a given region. + DestinationRegion *string `type:"string"` + // The name of the database engine to be used for this DB cluster. // // Valid Values: aurora @@ -8985,12 +10874,16 @@ type CreateDBClusterInput struct { // The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption // key. If you are creating a DB cluster with the same AWS account that owns // the KMS encryption key used to encrypt the new DB cluster, then you can use - // the KMS key alias instead of the ARN for the KM encryption key. + // the KMS key alias instead of the ARN for the KMS encryption key. // // If the StorageEncrypted parameter is true, and you do not specify a value // for the KmsKeyId parameter, then Amazon RDS will use your default encryption // key. AWS KMS creates the default encryption key for your AWS account. Your // AWS account has a different default encryption key for each AWS region. + // + // If you create a Read Replica of an encrypted DB cluster in another region, + // you must set KmsKeyId to a KMS key ID that is valid in the destination region. + // This key is used to encrypt the Read Replica in that region. KmsKeyId *string `type:"string"` // The password for the master database user. This password can contain any @@ -9022,6 +10915,36 @@ type CreateDBClusterInput struct { // Default: 3306 Port *int64 `type:"integer"` + // A URL that contains a Signature Version 4 signed request for the CreateDBCluster + // action to be called in the source region where the DB cluster will be replicated + // from. You only need to specify PreSignedUrl when you are performing cross-region + // replication from an encrypted DB cluster. + // + // The pre-signed URL must be a valid request for the CreateDBCluster API action + // that can be executed in the source region that contains the encrypted DB + // cluster to be copied. + // + // The pre-signed URL request must contain the following parameter values: + // + // * KmsKeyId - The KMS key identifier for the key to use to encrypt the + // copy of the DB cluster in the destination region. This should refer to + // the same KMS key for both the CreateDBCluster action that is called in + // the destination region, and the action contained in the pre-signed URL. + // + // * DestinationRegion - The name of the region that Aurora Read Replica + // will be created in. + // + // * ReplicationSourceIdentifier - The DB cluster identifier for the encrypted + // DB cluster to be copied. This identifier must be in the Amazon Resource + // Name (ARN) format for the source region. For example, if you are copying + // an encrypted DB cluster from the us-west-2 region, then your ReplicationSourceIdentifier + // would look like Example: arn:aws:rds:us-west-2:123456789012:cluster:aurora-cluster1. + // + // To learn how to generate a Signature Version 4 signed request, see Authenticating + // Requests: Using Query Parameters (AWS Signature Version 4) (http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) + // and Signature Version 4 Signing Process (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). + PreSignedUrl *string `type:"string"` + // The daily time range during which automated backups are created if automated // backups are enabled using the BackupRetentionPeriod parameter. // @@ -9060,6 +10983,11 @@ type CreateDBClusterInput struct { // this DB cluster is created as a Read Replica. ReplicationSourceIdentifier *string `type:"string"` + // SourceRegion is the source region where the resource exists. This is not + // sent over the wire and is only used for presigning. This value should always + // have the same region as the source ARN. + SourceRegion *string `type:"string" ignore:"true"` + // Specifies whether the DB cluster is encrypted. StorageEncrypted *bool `type:"boolean"` @@ -9138,6 +11066,12 @@ func (s *CreateDBClusterInput) SetDatabaseName(v string) *CreateDBClusterInput { return s } +// SetDestinationRegion sets the DestinationRegion field's value. +func (s *CreateDBClusterInput) SetDestinationRegion(v string) *CreateDBClusterInput { + s.DestinationRegion = &v + return s +} + // SetEngine sets the Engine field's value. func (s *CreateDBClusterInput) SetEngine(v string) *CreateDBClusterInput { s.Engine = &v @@ -9180,6 +11114,12 @@ func (s *CreateDBClusterInput) SetPort(v int64) *CreateDBClusterInput { return s } +// SetPreSignedUrl sets the PreSignedUrl field's value. +func (s *CreateDBClusterInput) SetPreSignedUrl(v string) *CreateDBClusterInput { + s.PreSignedUrl = &v + return s +} + // SetPreferredBackupWindow sets the PreferredBackupWindow field's value. func (s *CreateDBClusterInput) SetPreferredBackupWindow(v string) *CreateDBClusterInput { s.PreferredBackupWindow = &v @@ -9198,6 +11138,12 @@ func (s *CreateDBClusterInput) SetReplicationSourceIdentifier(v string) *CreateD return s } +// SetSourceRegion sets the SourceRegion field's value. +func (s *CreateDBClusterInput) SetSourceRegion(v string) *CreateDBClusterInput { + s.SourceRegion = &v + return s +} + // SetStorageEncrypted sets the StorageEncrypted field's value. func (s *CreateDBClusterInput) SetStorageEncrypted(v bool) *CreateDBClusterInput { s.StorageEncrypted = &v diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/customizations.go b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/customizations.go index e25b8dd80e..d412fb282b 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/customizations.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/customizations.go @@ -13,6 +13,8 @@ func init() { ops := []string{ opCopyDBSnapshot, opCreateDBInstanceReadReplica, + opCopyDBClusterSnapshot, + opCreateDBCluster, } initRequest = func(r *request.Request) { for _, operation := range ops { @@ -27,6 +29,8 @@ func fillPresignedURL(r *request.Request) { fns := map[string]func(r *request.Request){ opCopyDBSnapshot: copyDBSnapshotPresign, opCreateDBInstanceReadReplica: createDBInstanceReadReplicaPresign, + opCopyDBClusterSnapshot: copyDBClusterSnapshotPresign, + opCreateDBCluster: createDBClusterPresign, } if !r.ParamsFilled() { return @@ -39,7 +43,7 @@ func fillPresignedURL(r *request.Request) { func copyDBSnapshotPresign(r *request.Request) { originParams := r.Params.(*CopyDBSnapshotInput) - if originParams.PreSignedUrl != nil || originParams.DestinationRegion != nil { + if originParams.SourceRegion == nil || originParams.PreSignedUrl != nil || originParams.DestinationRegion != nil { return } @@ -51,7 +55,7 @@ func copyDBSnapshotPresign(r *request.Request) { func createDBInstanceReadReplicaPresign(r *request.Request) { originParams := r.Params.(*CreateDBInstanceReadReplicaInput) - if originParams.PreSignedUrl != nil || originParams.DestinationRegion != nil { + if originParams.SourceRegion == nil || originParams.PreSignedUrl != nil || originParams.DestinationRegion != nil { return } @@ -60,6 +64,30 @@ func createDBInstanceReadReplicaPresign(r *request.Request) { originParams.PreSignedUrl = presignURL(r, originParams.SourceRegion, newParams) } +func copyDBClusterSnapshotPresign(r *request.Request) { + originParams := r.Params.(*CopyDBClusterSnapshotInput) + + if originParams.SourceRegion == nil || originParams.PreSignedUrl != nil || originParams.DestinationRegion != nil { + return + } + + originParams.DestinationRegion = r.Config.Region + newParams := awsutil.CopyOf(r.Params).(*CopyDBClusterSnapshotInput) + originParams.PreSignedUrl = presignURL(r, originParams.SourceRegion, newParams) +} + +func createDBClusterPresign(r *request.Request) { + originParams := r.Params.(*CreateDBClusterInput) + + if originParams.SourceRegion == nil || originParams.PreSignedUrl != nil || originParams.DestinationRegion != nil { + return + } + + originParams.DestinationRegion = r.Config.Region + newParams := awsutil.CopyOf(r.Params).(*CreateDBClusterInput) + originParams.PreSignedUrl = presignURL(r, originParams.SourceRegion, newParams) +} + // presignURL will presign the request by using SoureRegion to sign with. SourceRegion is not // sent to the service, and is only used to not have the SDKs parsing ARNs. func presignURL(r *request.Request, sourceRegion *string, newParams interface{}) *string { diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/errors.go index 1ffd1a0fb0..2617719ff7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package rds diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/service.go index e81de91826..80fa5120a5 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package rds diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go index 00f532a75f..3ea78a9ba0 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/rds/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package rds import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilDBInstanceAvailable uses the Amazon RDS API operation @@ -11,56 +14,70 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *RDS) WaitUntilDBInstanceAvailable(input *DescribeDBInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeDBInstances", - Delay: 30, + return c.WaitUntilDBInstanceAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilDBInstanceAvailableWithContext is an extended version of WaitUntilDBInstanceAvailable. +// 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 *RDS) WaitUntilDBInstanceAvailableWithContext(ctx aws.Context, input *DescribeDBInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilDBInstanceAvailable", MaxAttempts: 60, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "DBInstances[].DBInstanceStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "deleted", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "deleting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "incompatible-restore", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "incompatible-parameters", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeDBInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilDBInstanceDeleted uses the Amazon RDS API operation @@ -68,54 +85,68 @@ func (c *RDS) WaitUntilDBInstanceAvailable(input *DescribeDBInstancesInput) erro // If the condition is not meet within the max attempt window an error will // be returned. func (c *RDS) WaitUntilDBInstanceDeleted(input *DescribeDBInstancesInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeDBInstances", - Delay: 30, + return c.WaitUntilDBInstanceDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilDBInstanceDeletedWithContext is an extended version of WaitUntilDBInstanceDeleted. +// 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 *RDS) WaitUntilDBInstanceDeletedWithContext(ctx aws.Context, input *DescribeDBInstancesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilDBInstanceDeleted", MaxAttempts: 60, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "DBInstances[].DBInstanceStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "deleted", }, { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "DBInstanceNotFound", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "creating", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "modifying", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "rebooting", }, { - State: "failure", - Matcher: "pathAny", - Argument: "DBInstances[].DBInstanceStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "DBInstances[].DBInstanceStatus", Expected: "resetting-master-credentials", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeDBInstancesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDBInstancesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/api.go index 7a9a7cf2c0..6061755918 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package redshift provides a client for Amazon Redshift. package redshift @@ -6,6 +6,7 @@ package redshift import ( "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" @@ -103,8 +104,23 @@ func (c *Redshift) AuthorizeClusterSecurityGroupIngressRequest(input *AuthorizeC // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/AuthorizeClusterSecurityGroupIngress func (c *Redshift) AuthorizeClusterSecurityGroupIngress(input *AuthorizeClusterSecurityGroupIngressInput) (*AuthorizeClusterSecurityGroupIngressOutput, error) { req, out := c.AuthorizeClusterSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AuthorizeClusterSecurityGroupIngressWithContext is the same as AuthorizeClusterSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See AuthorizeClusterSecurityGroupIngress 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 *Redshift) AuthorizeClusterSecurityGroupIngressWithContext(ctx aws.Context, input *AuthorizeClusterSecurityGroupIngressInput, opts ...request.Option) (*AuthorizeClusterSecurityGroupIngressOutput, error) { + req, out := c.AuthorizeClusterSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAuthorizeSnapshotAccess = "AuthorizeSnapshotAccess" @@ -190,8 +206,23 @@ func (c *Redshift) AuthorizeSnapshotAccessRequest(input *AuthorizeSnapshotAccess // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/AuthorizeSnapshotAccess func (c *Redshift) AuthorizeSnapshotAccess(input *AuthorizeSnapshotAccessInput) (*AuthorizeSnapshotAccessOutput, error) { req, out := c.AuthorizeSnapshotAccessRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AuthorizeSnapshotAccessWithContext is the same as AuthorizeSnapshotAccess with the addition of +// the ability to pass a context and additional request options. +// +// See AuthorizeSnapshotAccess 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 *Redshift) AuthorizeSnapshotAccessWithContext(ctx aws.Context, input *AuthorizeSnapshotAccessInput, opts ...request.Option) (*AuthorizeSnapshotAccessOutput, error) { + req, out := c.AuthorizeSnapshotAccessRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyClusterSnapshot = "CopyClusterSnapshot" @@ -279,8 +310,23 @@ func (c *Redshift) CopyClusterSnapshotRequest(input *CopyClusterSnapshotInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CopyClusterSnapshot func (c *Redshift) CopyClusterSnapshot(input *CopyClusterSnapshotInput) (*CopyClusterSnapshotOutput, error) { req, out := c.CopyClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyClusterSnapshotWithContext is the same as CopyClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CopyClusterSnapshot 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 *Redshift) CopyClusterSnapshotWithContext(ctx aws.Context, input *CopyClusterSnapshotInput, opts ...request.Option) (*CopyClusterSnapshotOutput, error) { + req, out := c.CopyClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateCluster = "CreateCluster" @@ -414,8 +460,23 @@ func (c *Redshift) CreateClusterRequest(input *CreateClusterInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateCluster func (c *Redshift) CreateCluster(input *CreateClusterInput) (*CreateClusterOutput, error) { req, out := c.CreateClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateClusterWithContext is the same as CreateCluster with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCluster 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 *Redshift) CreateClusterWithContext(ctx aws.Context, input *CreateClusterInput, opts ...request.Option) (*CreateClusterOutput, error) { + req, out := c.CreateClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateClusterParameterGroup = "CreateClusterParameterGroup" @@ -501,8 +562,23 @@ func (c *Redshift) CreateClusterParameterGroupRequest(input *CreateClusterParame // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateClusterParameterGroup func (c *Redshift) CreateClusterParameterGroup(input *CreateClusterParameterGroupInput) (*CreateClusterParameterGroupOutput, error) { req, out := c.CreateClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateClusterParameterGroupWithContext is the same as CreateClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateClusterParameterGroup 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 *Redshift) CreateClusterParameterGroupWithContext(ctx aws.Context, input *CreateClusterParameterGroupInput, opts ...request.Option) (*CreateClusterParameterGroupOutput, error) { + req, out := c.CreateClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateClusterSecurityGroup = "CreateClusterSecurityGroup" @@ -583,8 +659,23 @@ func (c *Redshift) CreateClusterSecurityGroupRequest(input *CreateClusterSecurit // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateClusterSecurityGroup func (c *Redshift) CreateClusterSecurityGroup(input *CreateClusterSecurityGroupInput) (*CreateClusterSecurityGroupOutput, error) { req, out := c.CreateClusterSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateClusterSecurityGroupWithContext is the same as CreateClusterSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateClusterSecurityGroup 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 *Redshift) CreateClusterSecurityGroupWithContext(ctx aws.Context, input *CreateClusterSecurityGroupInput, opts ...request.Option) (*CreateClusterSecurityGroupOutput, error) { + req, out := c.CreateClusterSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateClusterSnapshot = "CreateClusterSnapshot" @@ -670,8 +761,23 @@ func (c *Redshift) CreateClusterSnapshotRequest(input *CreateClusterSnapshotInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateClusterSnapshot func (c *Redshift) CreateClusterSnapshot(input *CreateClusterSnapshotInput) (*CreateClusterSnapshotOutput, error) { req, out := c.CreateClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateClusterSnapshotWithContext is the same as CreateClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateClusterSnapshot 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 *Redshift) CreateClusterSnapshotWithContext(ctx aws.Context, input *CreateClusterSnapshotInput, opts ...request.Option) (*CreateClusterSnapshotOutput, error) { + req, out := c.CreateClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateClusterSubnetGroup = "CreateClusterSubnetGroup" @@ -770,8 +876,23 @@ func (c *Redshift) CreateClusterSubnetGroupRequest(input *CreateClusterSubnetGro // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateClusterSubnetGroup func (c *Redshift) CreateClusterSubnetGroup(input *CreateClusterSubnetGroupInput) (*CreateClusterSubnetGroupOutput, error) { req, out := c.CreateClusterSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateClusterSubnetGroupWithContext is the same as CreateClusterSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateClusterSubnetGroup 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 *Redshift) CreateClusterSubnetGroupWithContext(ctx aws.Context, input *CreateClusterSubnetGroupInput, opts ...request.Option) (*CreateClusterSubnetGroupOutput, error) { + req, out := c.CreateClusterSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateEventSubscription = "CreateEventSubscription" @@ -896,8 +1017,23 @@ func (c *Redshift) CreateEventSubscriptionRequest(input *CreateEventSubscription // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateEventSubscription func (c *Redshift) CreateEventSubscription(input *CreateEventSubscriptionInput) (*CreateEventSubscriptionOutput, error) { req, out := c.CreateEventSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateEventSubscriptionWithContext is the same as CreateEventSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See CreateEventSubscription 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 *Redshift) CreateEventSubscriptionWithContext(ctx aws.Context, input *CreateEventSubscriptionInput, opts ...request.Option) (*CreateEventSubscriptionOutput, error) { + req, out := c.CreateEventSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateHsmClientCertificate = "CreateHsmClientCertificate" @@ -981,8 +1117,23 @@ func (c *Redshift) CreateHsmClientCertificateRequest(input *CreateHsmClientCerti // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateHsmClientCertificate func (c *Redshift) CreateHsmClientCertificate(input *CreateHsmClientCertificateInput) (*CreateHsmClientCertificateOutput, error) { req, out := c.CreateHsmClientCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateHsmClientCertificateWithContext is the same as CreateHsmClientCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See CreateHsmClientCertificate 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 *Redshift) CreateHsmClientCertificateWithContext(ctx aws.Context, input *CreateHsmClientCertificateInput, opts ...request.Option) (*CreateHsmClientCertificateOutput, error) { + req, out := c.CreateHsmClientCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateHsmConfiguration = "CreateHsmConfiguration" @@ -1067,8 +1218,23 @@ func (c *Redshift) CreateHsmConfigurationRequest(input *CreateHsmConfigurationIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateHsmConfiguration func (c *Redshift) CreateHsmConfiguration(input *CreateHsmConfigurationInput) (*CreateHsmConfigurationOutput, error) { req, out := c.CreateHsmConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateHsmConfigurationWithContext is the same as CreateHsmConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See CreateHsmConfiguration 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 *Redshift) CreateHsmConfigurationWithContext(ctx aws.Context, input *CreateHsmConfigurationInput, opts ...request.Option) (*CreateHsmConfigurationOutput, error) { + req, out := c.CreateHsmConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSnapshotCopyGrant = "CreateSnapshotCopyGrant" @@ -1156,8 +1322,23 @@ func (c *Redshift) CreateSnapshotCopyGrantRequest(input *CreateSnapshotCopyGrant // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateSnapshotCopyGrant func (c *Redshift) CreateSnapshotCopyGrant(input *CreateSnapshotCopyGrantInput) (*CreateSnapshotCopyGrantOutput, error) { req, out := c.CreateSnapshotCopyGrantRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSnapshotCopyGrantWithContext is the same as CreateSnapshotCopyGrant with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSnapshotCopyGrant 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 *Redshift) CreateSnapshotCopyGrantWithContext(ctx aws.Context, input *CreateSnapshotCopyGrantInput, opts ...request.Option) (*CreateSnapshotCopyGrantOutput, error) { + req, out := c.CreateSnapshotCopyGrantRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTags = "CreateTags" @@ -1235,8 +1416,23 @@ func (c *Redshift) CreateTagsRequest(input *CreateTagsInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/CreateTags func (c *Redshift) CreateTags(input *CreateTagsInput) (*CreateTagsOutput, error) { req, out := c.CreateTagsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTagsWithContext is the same as CreateTags with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTags 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 *Redshift) CreateTagsWithContext(ctx aws.Context, input *CreateTagsInput, opts ...request.Option) (*CreateTagsOutput, error) { + req, out := c.CreateTagsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteCluster = "DeleteCluster" @@ -1327,8 +1523,23 @@ func (c *Redshift) DeleteClusterRequest(input *DeleteClusterInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteCluster func (c *Redshift) DeleteCluster(input *DeleteClusterInput) (*DeleteClusterOutput, error) { req, out := c.DeleteClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteClusterWithContext is the same as DeleteCluster with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteCluster 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 *Redshift) DeleteClusterWithContext(ctx aws.Context, input *DeleteClusterInput, opts ...request.Option) (*DeleteClusterOutput, error) { + req, out := c.DeleteClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteClusterParameterGroup = "DeleteClusterParameterGroup" @@ -1401,8 +1612,23 @@ func (c *Redshift) DeleteClusterParameterGroupRequest(input *DeleteClusterParame // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteClusterParameterGroup func (c *Redshift) DeleteClusterParameterGroup(input *DeleteClusterParameterGroupInput) (*DeleteClusterParameterGroupOutput, error) { req, out := c.DeleteClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteClusterParameterGroupWithContext is the same as DeleteClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteClusterParameterGroup 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 *Redshift) DeleteClusterParameterGroupWithContext(ctx aws.Context, input *DeleteClusterParameterGroupInput, opts ...request.Option) (*DeleteClusterParameterGroupOutput, error) { + req, out := c.DeleteClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteClusterSecurityGroup = "DeleteClusterSecurityGroup" @@ -1479,8 +1705,23 @@ func (c *Redshift) DeleteClusterSecurityGroupRequest(input *DeleteClusterSecurit // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteClusterSecurityGroup func (c *Redshift) DeleteClusterSecurityGroup(input *DeleteClusterSecurityGroupInput) (*DeleteClusterSecurityGroupOutput, error) { req, out := c.DeleteClusterSecurityGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteClusterSecurityGroupWithContext is the same as DeleteClusterSecurityGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteClusterSecurityGroup 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 *Redshift) DeleteClusterSecurityGroupWithContext(ctx aws.Context, input *DeleteClusterSecurityGroupInput, opts ...request.Option) (*DeleteClusterSecurityGroupOutput, error) { + req, out := c.DeleteClusterSecurityGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteClusterSnapshot = "DeleteClusterSnapshot" @@ -1555,8 +1796,23 @@ func (c *Redshift) DeleteClusterSnapshotRequest(input *DeleteClusterSnapshotInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteClusterSnapshot func (c *Redshift) DeleteClusterSnapshot(input *DeleteClusterSnapshotInput) (*DeleteClusterSnapshotOutput, error) { req, out := c.DeleteClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteClusterSnapshotWithContext is the same as DeleteClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteClusterSnapshot 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 *Redshift) DeleteClusterSnapshotWithContext(ctx aws.Context, input *DeleteClusterSnapshotInput, opts ...request.Option) (*DeleteClusterSnapshotOutput, error) { + req, out := c.DeleteClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteClusterSubnetGroup = "DeleteClusterSubnetGroup" @@ -1629,8 +1885,23 @@ func (c *Redshift) DeleteClusterSubnetGroupRequest(input *DeleteClusterSubnetGro // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteClusterSubnetGroup func (c *Redshift) DeleteClusterSubnetGroup(input *DeleteClusterSubnetGroupInput) (*DeleteClusterSubnetGroupOutput, error) { req, out := c.DeleteClusterSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteClusterSubnetGroupWithContext is the same as DeleteClusterSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteClusterSubnetGroup 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 *Redshift) DeleteClusterSubnetGroupWithContext(ctx aws.Context, input *DeleteClusterSubnetGroupInput, opts ...request.Option) (*DeleteClusterSubnetGroupOutput, error) { + req, out := c.DeleteClusterSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteEventSubscription = "DeleteEventSubscription" @@ -1701,8 +1972,23 @@ func (c *Redshift) DeleteEventSubscriptionRequest(input *DeleteEventSubscription // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteEventSubscription func (c *Redshift) DeleteEventSubscription(input *DeleteEventSubscriptionInput) (*DeleteEventSubscriptionOutput, error) { req, out := c.DeleteEventSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEventSubscriptionWithContext is the same as DeleteEventSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEventSubscription 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 *Redshift) DeleteEventSubscriptionWithContext(ctx aws.Context, input *DeleteEventSubscriptionInput, opts ...request.Option) (*DeleteEventSubscriptionOutput, error) { + req, out := c.DeleteEventSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteHsmClientCertificate = "DeleteHsmClientCertificate" @@ -1772,8 +2058,23 @@ func (c *Redshift) DeleteHsmClientCertificateRequest(input *DeleteHsmClientCerti // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteHsmClientCertificate func (c *Redshift) DeleteHsmClientCertificate(input *DeleteHsmClientCertificateInput) (*DeleteHsmClientCertificateOutput, error) { req, out := c.DeleteHsmClientCertificateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteHsmClientCertificateWithContext is the same as DeleteHsmClientCertificate with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteHsmClientCertificate 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 *Redshift) DeleteHsmClientCertificateWithContext(ctx aws.Context, input *DeleteHsmClientCertificateInput, opts ...request.Option) (*DeleteHsmClientCertificateOutput, error) { + req, out := c.DeleteHsmClientCertificateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteHsmConfiguration = "DeleteHsmConfiguration" @@ -1843,8 +2144,23 @@ func (c *Redshift) DeleteHsmConfigurationRequest(input *DeleteHsmConfigurationIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteHsmConfiguration func (c *Redshift) DeleteHsmConfiguration(input *DeleteHsmConfigurationInput) (*DeleteHsmConfigurationOutput, error) { req, out := c.DeleteHsmConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteHsmConfigurationWithContext is the same as DeleteHsmConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteHsmConfiguration 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 *Redshift) DeleteHsmConfigurationWithContext(ctx aws.Context, input *DeleteHsmConfigurationInput, opts ...request.Option) (*DeleteHsmConfigurationOutput, error) { + req, out := c.DeleteHsmConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSnapshotCopyGrant = "DeleteSnapshotCopyGrant" @@ -1915,8 +2231,23 @@ func (c *Redshift) DeleteSnapshotCopyGrantRequest(input *DeleteSnapshotCopyGrant // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteSnapshotCopyGrant func (c *Redshift) DeleteSnapshotCopyGrant(input *DeleteSnapshotCopyGrantInput) (*DeleteSnapshotCopyGrantOutput, error) { req, out := c.DeleteSnapshotCopyGrantRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSnapshotCopyGrantWithContext is the same as DeleteSnapshotCopyGrant with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSnapshotCopyGrant 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 *Redshift) DeleteSnapshotCopyGrantWithContext(ctx aws.Context, input *DeleteSnapshotCopyGrantInput, opts ...request.Option) (*DeleteSnapshotCopyGrantOutput, error) { + req, out := c.DeleteSnapshotCopyGrantRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTags = "DeleteTags" @@ -1986,8 +2317,23 @@ func (c *Redshift) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DeleteTags func (c *Redshift) DeleteTags(input *DeleteTagsInput) (*DeleteTagsOutput, error) { req, out := c.DeleteTagsRequest(input) - err := req.Send() - return out, err + 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 *Redshift) 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 opDescribeClusterParameterGroups = "DescribeClusterParameterGroups" @@ -2078,8 +2424,23 @@ func (c *Redshift) DescribeClusterParameterGroupsRequest(input *DescribeClusterP // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeClusterParameterGroups func (c *Redshift) DescribeClusterParameterGroups(input *DescribeClusterParameterGroupsInput) (*DescribeClusterParameterGroupsOutput, error) { req, out := c.DescribeClusterParameterGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClusterParameterGroupsWithContext is the same as DescribeClusterParameterGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusterParameterGroups 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 *Redshift) DescribeClusterParameterGroupsWithContext(ctx aws.Context, input *DescribeClusterParameterGroupsInput, opts ...request.Option) (*DescribeClusterParameterGroupsOutput, error) { + req, out := c.DescribeClusterParameterGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeClusterParameterGroupsPages iterates over the pages of a DescribeClusterParameterGroups operation, @@ -2099,12 +2460,37 @@ func (c *Redshift) DescribeClusterParameterGroups(input *DescribeClusterParamete // return pageNum <= 3 // }) // -func (c *Redshift) DescribeClusterParameterGroupsPages(input *DescribeClusterParameterGroupsInput, fn func(p *DescribeClusterParameterGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeClusterParameterGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeClusterParameterGroupsOutput), lastPage) - }) +func (c *Redshift) DescribeClusterParameterGroupsPages(input *DescribeClusterParameterGroupsInput, fn func(*DescribeClusterParameterGroupsOutput, bool) bool) error { + return c.DescribeClusterParameterGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClusterParameterGroupsPagesWithContext same as DescribeClusterParameterGroupsPages 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 *Redshift) DescribeClusterParameterGroupsPagesWithContext(ctx aws.Context, input *DescribeClusterParameterGroupsInput, fn func(*DescribeClusterParameterGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClusterParameterGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterParameterGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClusterParameterGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeClusterParameters = "DescribeClusterParameters" @@ -2185,8 +2571,23 @@ func (c *Redshift) DescribeClusterParametersRequest(input *DescribeClusterParame // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeClusterParameters func (c *Redshift) DescribeClusterParameters(input *DescribeClusterParametersInput) (*DescribeClusterParametersOutput, error) { req, out := c.DescribeClusterParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClusterParametersWithContext is the same as DescribeClusterParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusterParameters 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 *Redshift) DescribeClusterParametersWithContext(ctx aws.Context, input *DescribeClusterParametersInput, opts ...request.Option) (*DescribeClusterParametersOutput, error) { + req, out := c.DescribeClusterParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeClusterParametersPages iterates over the pages of a DescribeClusterParameters operation, @@ -2206,12 +2607,37 @@ func (c *Redshift) DescribeClusterParameters(input *DescribeClusterParametersInp // return pageNum <= 3 // }) // -func (c *Redshift) DescribeClusterParametersPages(input *DescribeClusterParametersInput, fn func(p *DescribeClusterParametersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeClusterParametersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeClusterParametersOutput), lastPage) - }) +func (c *Redshift) DescribeClusterParametersPages(input *DescribeClusterParametersInput, fn func(*DescribeClusterParametersOutput, bool) bool) error { + return c.DescribeClusterParametersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClusterParametersPagesWithContext same as DescribeClusterParametersPages 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 *Redshift) DescribeClusterParametersPagesWithContext(ctx aws.Context, input *DescribeClusterParametersInput, fn func(*DescribeClusterParametersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClusterParametersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterParametersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClusterParametersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeClusterSecurityGroups = "DescribeClusterSecurityGroups" @@ -2301,8 +2727,23 @@ func (c *Redshift) DescribeClusterSecurityGroupsRequest(input *DescribeClusterSe // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeClusterSecurityGroups func (c *Redshift) DescribeClusterSecurityGroups(input *DescribeClusterSecurityGroupsInput) (*DescribeClusterSecurityGroupsOutput, error) { req, out := c.DescribeClusterSecurityGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClusterSecurityGroupsWithContext is the same as DescribeClusterSecurityGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusterSecurityGroups 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 *Redshift) DescribeClusterSecurityGroupsWithContext(ctx aws.Context, input *DescribeClusterSecurityGroupsInput, opts ...request.Option) (*DescribeClusterSecurityGroupsOutput, error) { + req, out := c.DescribeClusterSecurityGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeClusterSecurityGroupsPages iterates over the pages of a DescribeClusterSecurityGroups operation, @@ -2322,12 +2763,37 @@ func (c *Redshift) DescribeClusterSecurityGroups(input *DescribeClusterSecurityG // return pageNum <= 3 // }) // -func (c *Redshift) DescribeClusterSecurityGroupsPages(input *DescribeClusterSecurityGroupsInput, fn func(p *DescribeClusterSecurityGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeClusterSecurityGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeClusterSecurityGroupsOutput), lastPage) - }) +func (c *Redshift) DescribeClusterSecurityGroupsPages(input *DescribeClusterSecurityGroupsInput, fn func(*DescribeClusterSecurityGroupsOutput, bool) bool) error { + return c.DescribeClusterSecurityGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClusterSecurityGroupsPagesWithContext same as DescribeClusterSecurityGroupsPages 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 *Redshift) DescribeClusterSecurityGroupsPagesWithContext(ctx aws.Context, input *DescribeClusterSecurityGroupsInput, fn func(*DescribeClusterSecurityGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClusterSecurityGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterSecurityGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClusterSecurityGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeClusterSnapshots = "DescribeClusterSnapshots" @@ -2414,8 +2880,23 @@ func (c *Redshift) DescribeClusterSnapshotsRequest(input *DescribeClusterSnapsho // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeClusterSnapshots func (c *Redshift) DescribeClusterSnapshots(input *DescribeClusterSnapshotsInput) (*DescribeClusterSnapshotsOutput, error) { req, out := c.DescribeClusterSnapshotsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClusterSnapshotsWithContext is the same as DescribeClusterSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusterSnapshots 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 *Redshift) DescribeClusterSnapshotsWithContext(ctx aws.Context, input *DescribeClusterSnapshotsInput, opts ...request.Option) (*DescribeClusterSnapshotsOutput, error) { + req, out := c.DescribeClusterSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeClusterSnapshotsPages iterates over the pages of a DescribeClusterSnapshots operation, @@ -2435,12 +2916,37 @@ func (c *Redshift) DescribeClusterSnapshots(input *DescribeClusterSnapshotsInput // return pageNum <= 3 // }) // -func (c *Redshift) DescribeClusterSnapshotsPages(input *DescribeClusterSnapshotsInput, fn func(p *DescribeClusterSnapshotsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeClusterSnapshotsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeClusterSnapshotsOutput), lastPage) - }) +func (c *Redshift) DescribeClusterSnapshotsPages(input *DescribeClusterSnapshotsInput, fn func(*DescribeClusterSnapshotsOutput, bool) bool) error { + return c.DescribeClusterSnapshotsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClusterSnapshotsPagesWithContext same as DescribeClusterSnapshotsPages 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 *Redshift) DescribeClusterSnapshotsPagesWithContext(ctx aws.Context, input *DescribeClusterSnapshotsInput, fn func(*DescribeClusterSnapshotsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClusterSnapshotsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterSnapshotsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClusterSnapshotsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeClusterSubnetGroups = "DescribeClusterSubnetGroups" @@ -2526,8 +3032,23 @@ func (c *Redshift) DescribeClusterSubnetGroupsRequest(input *DescribeClusterSubn // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeClusterSubnetGroups func (c *Redshift) DescribeClusterSubnetGroups(input *DescribeClusterSubnetGroupsInput) (*DescribeClusterSubnetGroupsOutput, error) { req, out := c.DescribeClusterSubnetGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClusterSubnetGroupsWithContext is the same as DescribeClusterSubnetGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusterSubnetGroups 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 *Redshift) DescribeClusterSubnetGroupsWithContext(ctx aws.Context, input *DescribeClusterSubnetGroupsInput, opts ...request.Option) (*DescribeClusterSubnetGroupsOutput, error) { + req, out := c.DescribeClusterSubnetGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeClusterSubnetGroupsPages iterates over the pages of a DescribeClusterSubnetGroups operation, @@ -2547,12 +3068,37 @@ func (c *Redshift) DescribeClusterSubnetGroups(input *DescribeClusterSubnetGroup // return pageNum <= 3 // }) // -func (c *Redshift) DescribeClusterSubnetGroupsPages(input *DescribeClusterSubnetGroupsInput, fn func(p *DescribeClusterSubnetGroupsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeClusterSubnetGroupsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeClusterSubnetGroupsOutput), lastPage) - }) +func (c *Redshift) DescribeClusterSubnetGroupsPages(input *DescribeClusterSubnetGroupsInput, fn func(*DescribeClusterSubnetGroupsOutput, bool) bool) error { + return c.DescribeClusterSubnetGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClusterSubnetGroupsPagesWithContext same as DescribeClusterSubnetGroupsPages 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 *Redshift) DescribeClusterSubnetGroupsPagesWithContext(ctx aws.Context, input *DescribeClusterSubnetGroupsInput, fn func(*DescribeClusterSubnetGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClusterSubnetGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterSubnetGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClusterSubnetGroupsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeClusterVersions = "DescribeClusterVersions" @@ -2621,8 +3167,23 @@ func (c *Redshift) DescribeClusterVersionsRequest(input *DescribeClusterVersions // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeClusterVersions func (c *Redshift) DescribeClusterVersions(input *DescribeClusterVersionsInput) (*DescribeClusterVersionsOutput, error) { req, out := c.DescribeClusterVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClusterVersionsWithContext is the same as DescribeClusterVersions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusterVersions 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 *Redshift) DescribeClusterVersionsWithContext(ctx aws.Context, input *DescribeClusterVersionsInput, opts ...request.Option) (*DescribeClusterVersionsOutput, error) { + req, out := c.DescribeClusterVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeClusterVersionsPages iterates over the pages of a DescribeClusterVersions operation, @@ -2642,12 +3203,37 @@ func (c *Redshift) DescribeClusterVersions(input *DescribeClusterVersionsInput) // return pageNum <= 3 // }) // -func (c *Redshift) DescribeClusterVersionsPages(input *DescribeClusterVersionsInput, fn func(p *DescribeClusterVersionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeClusterVersionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeClusterVersionsOutput), lastPage) - }) +func (c *Redshift) DescribeClusterVersionsPages(input *DescribeClusterVersionsInput, fn func(*DescribeClusterVersionsOutput, bool) bool) error { + return c.DescribeClusterVersionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClusterVersionsPagesWithContext same as DescribeClusterVersionsPages 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 *Redshift) DescribeClusterVersionsPagesWithContext(ctx aws.Context, input *DescribeClusterVersionsInput, fn func(*DescribeClusterVersionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClusterVersionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterVersionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClusterVersionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeClusters = "DescribeClusters" @@ -2733,8 +3319,23 @@ func (c *Redshift) DescribeClustersRequest(input *DescribeClustersInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeClusters func (c *Redshift) DescribeClusters(input *DescribeClustersInput) (*DescribeClustersOutput, error) { req, out := c.DescribeClustersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeClustersWithContext is the same as DescribeClusters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeClusters 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 *Redshift) DescribeClustersWithContext(ctx aws.Context, input *DescribeClustersInput, opts ...request.Option) (*DescribeClustersOutput, error) { + req, out := c.DescribeClustersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeClustersPages iterates over the pages of a DescribeClusters operation, @@ -2754,12 +3355,37 @@ func (c *Redshift) DescribeClusters(input *DescribeClustersInput) (*DescribeClus // return pageNum <= 3 // }) // -func (c *Redshift) DescribeClustersPages(input *DescribeClustersInput, fn func(p *DescribeClustersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeClustersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeClustersOutput), lastPage) - }) +func (c *Redshift) DescribeClustersPages(input *DescribeClustersInput, fn func(*DescribeClustersOutput, bool) bool) error { + return c.DescribeClustersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeClustersPagesWithContext same as DescribeClustersPages 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 *Redshift) DescribeClustersPagesWithContext(ctx aws.Context, input *DescribeClustersInput, fn func(*DescribeClustersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeClustersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeDefaultClusterParameters = "DescribeDefaultClusterParameters" @@ -2828,8 +3454,23 @@ func (c *Redshift) DescribeDefaultClusterParametersRequest(input *DescribeDefaul // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeDefaultClusterParameters func (c *Redshift) DescribeDefaultClusterParameters(input *DescribeDefaultClusterParametersInput) (*DescribeDefaultClusterParametersOutput, error) { req, out := c.DescribeDefaultClusterParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDefaultClusterParametersWithContext is the same as DescribeDefaultClusterParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDefaultClusterParameters 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 *Redshift) DescribeDefaultClusterParametersWithContext(ctx aws.Context, input *DescribeDefaultClusterParametersInput, opts ...request.Option) (*DescribeDefaultClusterParametersOutput, error) { + req, out := c.DescribeDefaultClusterParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeDefaultClusterParametersPages iterates over the pages of a DescribeDefaultClusterParameters operation, @@ -2849,12 +3490,37 @@ func (c *Redshift) DescribeDefaultClusterParameters(input *DescribeDefaultCluste // return pageNum <= 3 // }) // -func (c *Redshift) DescribeDefaultClusterParametersPages(input *DescribeDefaultClusterParametersInput, fn func(p *DescribeDefaultClusterParametersOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeDefaultClusterParametersRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeDefaultClusterParametersOutput), lastPage) - }) +func (c *Redshift) DescribeDefaultClusterParametersPages(input *DescribeDefaultClusterParametersInput, fn func(*DescribeDefaultClusterParametersOutput, bool) bool) error { + return c.DescribeDefaultClusterParametersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDefaultClusterParametersPagesWithContext same as DescribeDefaultClusterParametersPages 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 *Redshift) DescribeDefaultClusterParametersPagesWithContext(ctx aws.Context, input *DescribeDefaultClusterParametersInput, fn func(*DescribeDefaultClusterParametersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDefaultClusterParametersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDefaultClusterParametersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeDefaultClusterParametersOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeEventCategories = "DescribeEventCategories" @@ -2915,8 +3581,23 @@ func (c *Redshift) DescribeEventCategoriesRequest(input *DescribeEventCategories // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeEventCategories func (c *Redshift) DescribeEventCategories(input *DescribeEventCategoriesInput) (*DescribeEventCategoriesOutput, error) { req, out := c.DescribeEventCategoriesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventCategoriesWithContext is the same as DescribeEventCategories with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEventCategories 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 *Redshift) DescribeEventCategoriesWithContext(ctx aws.Context, input *DescribeEventCategoriesInput, opts ...request.Option) (*DescribeEventCategoriesOutput, error) { + req, out := c.DescribeEventCategoriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEventSubscriptions = "DescribeEventSubscriptions" @@ -2989,8 +3670,23 @@ func (c *Redshift) DescribeEventSubscriptionsRequest(input *DescribeEventSubscri // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeEventSubscriptions func (c *Redshift) DescribeEventSubscriptions(input *DescribeEventSubscriptionsInput) (*DescribeEventSubscriptionsOutput, error) { req, out := c.DescribeEventSubscriptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventSubscriptionsWithContext is the same as DescribeEventSubscriptions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEventSubscriptions 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 *Redshift) DescribeEventSubscriptionsWithContext(ctx aws.Context, input *DescribeEventSubscriptionsInput, opts ...request.Option) (*DescribeEventSubscriptionsOutput, error) { + req, out := c.DescribeEventSubscriptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEventSubscriptionsPages iterates over the pages of a DescribeEventSubscriptions operation, @@ -3010,12 +3706,37 @@ func (c *Redshift) DescribeEventSubscriptions(input *DescribeEventSubscriptionsI // return pageNum <= 3 // }) // -func (c *Redshift) DescribeEventSubscriptionsPages(input *DescribeEventSubscriptionsInput, fn func(p *DescribeEventSubscriptionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEventSubscriptionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEventSubscriptionsOutput), lastPage) - }) +func (c *Redshift) DescribeEventSubscriptionsPages(input *DescribeEventSubscriptionsInput, fn func(*DescribeEventSubscriptionsOutput, bool) bool) error { + return c.DescribeEventSubscriptionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEventSubscriptionsPagesWithContext same as DescribeEventSubscriptionsPages 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 *Redshift) DescribeEventSubscriptionsPagesWithContext(ctx aws.Context, input *DescribeEventSubscriptionsInput, fn func(*DescribeEventSubscriptionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEventSubscriptionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEventSubscriptionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEventSubscriptionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeEvents = "DescribeEvents" @@ -3083,8 +3804,23 @@ func (c *Redshift) DescribeEventsRequest(input *DescribeEventsInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeEvents func (c *Redshift) DescribeEvents(input *DescribeEventsInput) (*DescribeEventsOutput, error) { req, out := c.DescribeEventsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEventsWithContext is the same as DescribeEvents with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEvents 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 *Redshift) DescribeEventsWithContext(ctx aws.Context, input *DescribeEventsInput, opts ...request.Option) (*DescribeEventsOutput, error) { + req, out := c.DescribeEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeEventsPages iterates over the pages of a DescribeEvents operation, @@ -3104,12 +3840,37 @@ func (c *Redshift) DescribeEvents(input *DescribeEventsInput) (*DescribeEventsOu // return pageNum <= 3 // }) // -func (c *Redshift) DescribeEventsPages(input *DescribeEventsInput, fn func(p *DescribeEventsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeEventsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeEventsOutput), lastPage) - }) +func (c *Redshift) DescribeEventsPages(input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool) error { + return c.DescribeEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeEventsPagesWithContext same as DescribeEventsPages 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 *Redshift) DescribeEventsPagesWithContext(ctx aws.Context, input *DescribeEventsInput, fn func(*DescribeEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeEventsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeHsmClientCertificates = "DescribeHsmClientCertificates" @@ -3194,8 +3955,23 @@ func (c *Redshift) DescribeHsmClientCertificatesRequest(input *DescribeHsmClient // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeHsmClientCertificates func (c *Redshift) DescribeHsmClientCertificates(input *DescribeHsmClientCertificatesInput) (*DescribeHsmClientCertificatesOutput, error) { req, out := c.DescribeHsmClientCertificatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeHsmClientCertificatesWithContext is the same as DescribeHsmClientCertificates with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeHsmClientCertificates 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 *Redshift) DescribeHsmClientCertificatesWithContext(ctx aws.Context, input *DescribeHsmClientCertificatesInput, opts ...request.Option) (*DescribeHsmClientCertificatesOutput, error) { + req, out := c.DescribeHsmClientCertificatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeHsmClientCertificatesPages iterates over the pages of a DescribeHsmClientCertificates operation, @@ -3215,12 +3991,37 @@ func (c *Redshift) DescribeHsmClientCertificates(input *DescribeHsmClientCertifi // return pageNum <= 3 // }) // -func (c *Redshift) DescribeHsmClientCertificatesPages(input *DescribeHsmClientCertificatesInput, fn func(p *DescribeHsmClientCertificatesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeHsmClientCertificatesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeHsmClientCertificatesOutput), lastPage) - }) +func (c *Redshift) DescribeHsmClientCertificatesPages(input *DescribeHsmClientCertificatesInput, fn func(*DescribeHsmClientCertificatesOutput, bool) bool) error { + return c.DescribeHsmClientCertificatesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeHsmClientCertificatesPagesWithContext same as DescribeHsmClientCertificatesPages 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 *Redshift) DescribeHsmClientCertificatesPagesWithContext(ctx aws.Context, input *DescribeHsmClientCertificatesInput, fn func(*DescribeHsmClientCertificatesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeHsmClientCertificatesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeHsmClientCertificatesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeHsmClientCertificatesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeHsmConfigurations = "DescribeHsmConfigurations" @@ -3305,8 +4106,23 @@ func (c *Redshift) DescribeHsmConfigurationsRequest(input *DescribeHsmConfigurat // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeHsmConfigurations func (c *Redshift) DescribeHsmConfigurations(input *DescribeHsmConfigurationsInput) (*DescribeHsmConfigurationsOutput, error) { req, out := c.DescribeHsmConfigurationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeHsmConfigurationsWithContext is the same as DescribeHsmConfigurations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeHsmConfigurations 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 *Redshift) DescribeHsmConfigurationsWithContext(ctx aws.Context, input *DescribeHsmConfigurationsInput, opts ...request.Option) (*DescribeHsmConfigurationsOutput, error) { + req, out := c.DescribeHsmConfigurationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeHsmConfigurationsPages iterates over the pages of a DescribeHsmConfigurations operation, @@ -3326,12 +4142,37 @@ func (c *Redshift) DescribeHsmConfigurations(input *DescribeHsmConfigurationsInp // return pageNum <= 3 // }) // -func (c *Redshift) DescribeHsmConfigurationsPages(input *DescribeHsmConfigurationsInput, fn func(p *DescribeHsmConfigurationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeHsmConfigurationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeHsmConfigurationsOutput), lastPage) - }) +func (c *Redshift) DescribeHsmConfigurationsPages(input *DescribeHsmConfigurationsInput, fn func(*DescribeHsmConfigurationsOutput, bool) bool) error { + return c.DescribeHsmConfigurationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeHsmConfigurationsPagesWithContext same as DescribeHsmConfigurationsPages 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 *Redshift) DescribeHsmConfigurationsPagesWithContext(ctx aws.Context, input *DescribeHsmConfigurationsInput, fn func(*DescribeHsmConfigurationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeHsmConfigurationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeHsmConfigurationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeHsmConfigurationsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeLoggingStatus = "DescribeLoggingStatus" @@ -3396,8 +4237,23 @@ func (c *Redshift) DescribeLoggingStatusRequest(input *DescribeLoggingStatusInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeLoggingStatus func (c *Redshift) DescribeLoggingStatus(input *DescribeLoggingStatusInput) (*LoggingStatus, error) { req, out := c.DescribeLoggingStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeLoggingStatusWithContext is the same as DescribeLoggingStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLoggingStatus 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 *Redshift) DescribeLoggingStatusWithContext(ctx aws.Context, input *DescribeLoggingStatusInput, opts ...request.Option) (*LoggingStatus, error) { + req, out := c.DescribeLoggingStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeOrderableClusterOptions = "DescribeOrderableClusterOptions" @@ -3470,8 +4326,23 @@ func (c *Redshift) DescribeOrderableClusterOptionsRequest(input *DescribeOrderab // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeOrderableClusterOptions func (c *Redshift) DescribeOrderableClusterOptions(input *DescribeOrderableClusterOptionsInput) (*DescribeOrderableClusterOptionsOutput, error) { req, out := c.DescribeOrderableClusterOptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeOrderableClusterOptionsWithContext is the same as DescribeOrderableClusterOptions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeOrderableClusterOptions 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 *Redshift) DescribeOrderableClusterOptionsWithContext(ctx aws.Context, input *DescribeOrderableClusterOptionsInput, opts ...request.Option) (*DescribeOrderableClusterOptionsOutput, error) { + req, out := c.DescribeOrderableClusterOptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeOrderableClusterOptionsPages iterates over the pages of a DescribeOrderableClusterOptions operation, @@ -3491,12 +4362,37 @@ func (c *Redshift) DescribeOrderableClusterOptions(input *DescribeOrderableClust // return pageNum <= 3 // }) // -func (c *Redshift) DescribeOrderableClusterOptionsPages(input *DescribeOrderableClusterOptionsInput, fn func(p *DescribeOrderableClusterOptionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeOrderableClusterOptionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeOrderableClusterOptionsOutput), lastPage) - }) +func (c *Redshift) DescribeOrderableClusterOptionsPages(input *DescribeOrderableClusterOptionsInput, fn func(*DescribeOrderableClusterOptionsOutput, bool) bool) error { + return c.DescribeOrderableClusterOptionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeOrderableClusterOptionsPagesWithContext same as DescribeOrderableClusterOptionsPages 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 *Redshift) DescribeOrderableClusterOptionsPagesWithContext(ctx aws.Context, input *DescribeOrderableClusterOptionsInput, fn func(*DescribeOrderableClusterOptionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeOrderableClusterOptionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeOrderableClusterOptionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeOrderableClusterOptionsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeReservedNodeOfferings = "DescribeReservedNodeOfferings" @@ -3575,11 +4471,30 @@ func (c *Redshift) DescribeReservedNodeOfferingsRequest(input *DescribeReservedN // * ErrCodeUnsupportedOperationFault "UnsupportedOperation" // The requested operation isn't supported. // +// * ErrCodeDependentServiceUnavailableFault "DependentServiceUnavailableFault" +// Your request cannot be completed because a dependent internal service is +// temporarily unavailable. Wait 30 to 60 seconds and try again. +// // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeReservedNodeOfferings func (c *Redshift) DescribeReservedNodeOfferings(input *DescribeReservedNodeOfferingsInput) (*DescribeReservedNodeOfferingsOutput, error) { req, out := c.DescribeReservedNodeOfferingsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedNodeOfferingsWithContext is the same as DescribeReservedNodeOfferings with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedNodeOfferings 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 *Redshift) DescribeReservedNodeOfferingsWithContext(ctx aws.Context, input *DescribeReservedNodeOfferingsInput, opts ...request.Option) (*DescribeReservedNodeOfferingsOutput, error) { + req, out := c.DescribeReservedNodeOfferingsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedNodeOfferingsPages iterates over the pages of a DescribeReservedNodeOfferings operation, @@ -3599,12 +4514,37 @@ func (c *Redshift) DescribeReservedNodeOfferings(input *DescribeReservedNodeOffe // return pageNum <= 3 // }) // -func (c *Redshift) DescribeReservedNodeOfferingsPages(input *DescribeReservedNodeOfferingsInput, fn func(p *DescribeReservedNodeOfferingsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedNodeOfferingsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedNodeOfferingsOutput), lastPage) - }) +func (c *Redshift) DescribeReservedNodeOfferingsPages(input *DescribeReservedNodeOfferingsInput, fn func(*DescribeReservedNodeOfferingsOutput, bool) bool) error { + return c.DescribeReservedNodeOfferingsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedNodeOfferingsPagesWithContext same as DescribeReservedNodeOfferingsPages 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 *Redshift) DescribeReservedNodeOfferingsPagesWithContext(ctx aws.Context, input *DescribeReservedNodeOfferingsInput, fn func(*DescribeReservedNodeOfferingsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedNodeOfferingsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedNodeOfferingsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedNodeOfferingsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeReservedNodes = "DescribeReservedNodes" @@ -3671,11 +4611,30 @@ func (c *Redshift) DescribeReservedNodesRequest(input *DescribeReservedNodesInpu // * ErrCodeReservedNodeNotFoundFault "ReservedNodeNotFound" // The specified reserved compute node not found. // +// * ErrCodeDependentServiceUnavailableFault "DependentServiceUnavailableFault" +// Your request cannot be completed because a dependent internal service is +// temporarily unavailable. Wait 30 to 60 seconds and try again. +// // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeReservedNodes func (c *Redshift) DescribeReservedNodes(input *DescribeReservedNodesInput) (*DescribeReservedNodesOutput, error) { req, out := c.DescribeReservedNodesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReservedNodesWithContext is the same as DescribeReservedNodes with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReservedNodes 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 *Redshift) DescribeReservedNodesWithContext(ctx aws.Context, input *DescribeReservedNodesInput, opts ...request.Option) (*DescribeReservedNodesOutput, error) { + req, out := c.DescribeReservedNodesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeReservedNodesPages iterates over the pages of a DescribeReservedNodes operation, @@ -3695,12 +4654,37 @@ func (c *Redshift) DescribeReservedNodes(input *DescribeReservedNodesInput) (*De // return pageNum <= 3 // }) // -func (c *Redshift) DescribeReservedNodesPages(input *DescribeReservedNodesInput, fn func(p *DescribeReservedNodesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeReservedNodesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeReservedNodesOutput), lastPage) - }) +func (c *Redshift) DescribeReservedNodesPages(input *DescribeReservedNodesInput, fn func(*DescribeReservedNodesOutput, bool) bool) error { + return c.DescribeReservedNodesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeReservedNodesPagesWithContext same as DescribeReservedNodesPages 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 *Redshift) DescribeReservedNodesPagesWithContext(ctx aws.Context, input *DescribeReservedNodesInput, fn func(*DescribeReservedNodesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReservedNodesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReservedNodesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReservedNodesOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeResize = "DescribeResize" @@ -3773,8 +4757,23 @@ func (c *Redshift) DescribeResizeRequest(input *DescribeResizeInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeResize func (c *Redshift) DescribeResize(input *DescribeResizeInput) (*DescribeResizeOutput, error) { req, out := c.DescribeResizeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeResizeWithContext is the same as DescribeResize with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeResize 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 *Redshift) DescribeResizeWithContext(ctx aws.Context, input *DescribeResizeInput, opts ...request.Option) (*DescribeResizeOutput, error) { + req, out := c.DescribeResizeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeSnapshotCopyGrants = "DescribeSnapshotCopyGrants" @@ -3847,8 +4846,23 @@ func (c *Redshift) DescribeSnapshotCopyGrantsRequest(input *DescribeSnapshotCopy // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeSnapshotCopyGrants func (c *Redshift) DescribeSnapshotCopyGrants(input *DescribeSnapshotCopyGrantsInput) (*DescribeSnapshotCopyGrantsOutput, error) { req, out := c.DescribeSnapshotCopyGrantsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeSnapshotCopyGrantsWithContext is the same as DescribeSnapshotCopyGrants with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSnapshotCopyGrants 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 *Redshift) DescribeSnapshotCopyGrantsWithContext(ctx aws.Context, input *DescribeSnapshotCopyGrantsInput, opts ...request.Option) (*DescribeSnapshotCopyGrantsOutput, error) { + req, out := c.DescribeSnapshotCopyGrantsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTableRestoreStatus = "DescribeTableRestoreStatus" @@ -3919,8 +4933,23 @@ func (c *Redshift) DescribeTableRestoreStatusRequest(input *DescribeTableRestore // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeTableRestoreStatus func (c *Redshift) DescribeTableRestoreStatus(input *DescribeTableRestoreStatusInput) (*DescribeTableRestoreStatusOutput, error) { req, out := c.DescribeTableRestoreStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeTableRestoreStatusWithContext is the same as DescribeTableRestoreStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeTableRestoreStatus 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 *Redshift) DescribeTableRestoreStatusWithContext(ctx aws.Context, input *DescribeTableRestoreStatusInput, opts ...request.Option) (*DescribeTableRestoreStatusOutput, error) { + req, out := c.DescribeTableRestoreStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeTags = "DescribeTags" @@ -4009,8 +5038,23 @@ func (c *Redshift) DescribeTagsRequest(input *DescribeTagsInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeTags func (c *Redshift) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error) { req, out := c.DescribeTagsRequest(input) - err := req.Send() - return out, err + 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 *Redshift) 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 opDisableLogging = "DisableLogging" @@ -4075,8 +5119,23 @@ func (c *Redshift) DisableLoggingRequest(input *DisableLoggingInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DisableLogging func (c *Redshift) DisableLogging(input *DisableLoggingInput) (*LoggingStatus, error) { req, out := c.DisableLoggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableLoggingWithContext is the same as DisableLogging with the addition of +// the ability to pass a context and additional request options. +// +// See DisableLogging 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 *Redshift) DisableLoggingWithContext(ctx aws.Context, input *DisableLoggingInput, opts ...request.Option) (*LoggingStatus, error) { + req, out := c.DisableLoggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableSnapshotCopy = "DisableSnapshotCopy" @@ -4154,8 +5213,23 @@ func (c *Redshift) DisableSnapshotCopyRequest(input *DisableSnapshotCopyInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DisableSnapshotCopy func (c *Redshift) DisableSnapshotCopy(input *DisableSnapshotCopyInput) (*DisableSnapshotCopyOutput, error) { req, out := c.DisableSnapshotCopyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableSnapshotCopyWithContext is the same as DisableSnapshotCopy with the addition of +// the ability to pass a context and additional request options. +// +// See DisableSnapshotCopy 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 *Redshift) DisableSnapshotCopyWithContext(ctx aws.Context, input *DisableSnapshotCopyInput, opts ...request.Option) (*DisableSnapshotCopyOutput, error) { + req, out := c.DisableSnapshotCopyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableLogging = "EnableLogging" @@ -4236,8 +5310,23 @@ func (c *Redshift) EnableLoggingRequest(input *EnableLoggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/EnableLogging func (c *Redshift) EnableLogging(input *EnableLoggingInput) (*LoggingStatus, error) { req, out := c.EnableLoggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableLoggingWithContext is the same as EnableLogging with the addition of +// the ability to pass a context and additional request options. +// +// See EnableLogging 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 *Redshift) EnableLoggingWithContext(ctx aws.Context, input *EnableLoggingInput, opts ...request.Option) (*LoggingStatus, error) { + req, out := c.EnableLoggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableSnapshotCopy = "EnableSnapshotCopy" @@ -4331,8 +5420,128 @@ func (c *Redshift) EnableSnapshotCopyRequest(input *EnableSnapshotCopyInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/EnableSnapshotCopy func (c *Redshift) EnableSnapshotCopy(input *EnableSnapshotCopyInput) (*EnableSnapshotCopyOutput, error) { req, out := c.EnableSnapshotCopyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableSnapshotCopyWithContext is the same as EnableSnapshotCopy with the addition of +// the ability to pass a context and additional request options. +// +// See EnableSnapshotCopy 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 *Redshift) EnableSnapshotCopyWithContext(ctx aws.Context, input *EnableSnapshotCopyInput, opts ...request.Option) (*EnableSnapshotCopyOutput, error) { + req, out := c.EnableSnapshotCopyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetClusterCredentials = "GetClusterCredentials" + +// GetClusterCredentialsRequest generates a "aws/request.Request" representing the +// client's request for the GetClusterCredentials operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetClusterCredentials for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetClusterCredentials method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetClusterCredentialsRequest method. +// req, resp := client.GetClusterCredentialsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/GetClusterCredentials +func (c *Redshift) GetClusterCredentialsRequest(input *GetClusterCredentialsInput) (req *request.Request, output *GetClusterCredentialsOutput) { + op := &request.Operation{ + Name: opGetClusterCredentials, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetClusterCredentialsInput{} + } + + output = &GetClusterCredentialsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetClusterCredentials API operation for Amazon Redshift. +// +// Returns a database user name and temporary password with temporary authorization +// to log in to an Amazon Redshift database. The action returns the database +// user name prefixed with IAM: if AutoCreate is False or IAMA: if AutoCreate +// is True. You can optionally specify one or more database user groups that +// the user will join at log in. By default, the temporary credentials expire +// in 900 seconds. You can optionally specify a duration between 900 seconds +// (15 minutes) and 3600 seconds (60 minutes). For more information, see Generating +// IAM Database User Credentials in the Amazon Redshift Cluster Management Guide. +// +// The IAM user or role that executes GetClusterCredentials must have an IAM +// policy attached that allows the redshift:GetClusterCredentials action with +// access to the dbuser resource on the cluster. The user name specified for +// dbuser in the IAM policy and the user name specified for the DbUser parameter +// must match. +// +// If the DbGroups parameter is specified, the IAM policy must allow the redshift:JoinGroup +// action with access to the listed dbgroups. +// +// In addition, if the AutoCreate parameter is set to True, then the policy +// must include the redshift:CreateClusterUser privilege. +// +// If the DbName parameter is specified, the IAM policy must allow access to +// the resource dbname for the specified database name. +// +// 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 Amazon Redshift's +// API operation GetClusterCredentials for usage and error information. +// +// Returned Error Codes: +// * ErrCodeClusterNotFoundFault "ClusterNotFound" +// The ClusterIdentifier parameter does not refer to an existing cluster. +// +// * ErrCodeUnsupportedOperationFault "UnsupportedOperation" +// The requested operation isn't supported. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/GetClusterCredentials +func (c *Redshift) GetClusterCredentials(input *GetClusterCredentialsInput) (*GetClusterCredentialsOutput, error) { + req, out := c.GetClusterCredentialsRequest(input) + return out, req.Send() +} + +// GetClusterCredentialsWithContext is the same as GetClusterCredentials with the addition of +// the ability to pass a context and additional request options. +// +// See GetClusterCredentials 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 *Redshift) GetClusterCredentialsWithContext(ctx aws.Context, input *GetClusterCredentialsInput, opts ...request.Option) (*GetClusterCredentialsOutput, error) { + req, out := c.GetClusterCredentialsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyCluster = "ModifyCluster" @@ -4415,6 +5624,9 @@ func (c *Redshift) ModifyClusterRequest(input *ModifyClusterInput) (req *request // (http://docs.aws.amazon.com/redshift/latest/mgmt/amazon-redshift-limits.html) // in the Amazon Redshift Cluster Management Guide. // +// * ErrCodeNumberOfNodesPerClusterLimitExceededFault "NumberOfNodesPerClusterLimitExceeded" +// The operation would exceed the number of nodes allowed for a cluster. +// // * ErrCodeClusterSecurityGroupNotFoundFault "ClusterSecurityGroupNotFound" // The cluster security group name does not refer to an existing cluster security // group. @@ -4453,8 +5665,23 @@ func (c *Redshift) ModifyClusterRequest(input *ModifyClusterInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ModifyCluster func (c *Redshift) ModifyCluster(input *ModifyClusterInput) (*ModifyClusterOutput, error) { req, out := c.ModifyClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyClusterWithContext is the same as ModifyCluster with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyCluster 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 *Redshift) ModifyClusterWithContext(ctx aws.Context, input *ModifyClusterInput, opts ...request.Option) (*ModifyClusterOutput, error) { + req, out := c.ModifyClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyClusterIamRoles = "ModifyClusterIamRoles" @@ -4524,8 +5751,23 @@ func (c *Redshift) ModifyClusterIamRolesRequest(input *ModifyClusterIamRolesInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ModifyClusterIamRoles func (c *Redshift) ModifyClusterIamRoles(input *ModifyClusterIamRolesInput) (*ModifyClusterIamRolesOutput, error) { req, out := c.ModifyClusterIamRolesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyClusterIamRolesWithContext is the same as ModifyClusterIamRoles with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyClusterIamRoles 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 *Redshift) ModifyClusterIamRolesWithContext(ctx aws.Context, input *ModifyClusterIamRolesInput, opts ...request.Option) (*ModifyClusterIamRolesOutput, error) { + req, out := c.ModifyClusterIamRolesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyClusterParameterGroup = "ModifyClusterParameterGroup" @@ -4598,8 +5840,23 @@ func (c *Redshift) ModifyClusterParameterGroupRequest(input *ModifyClusterParame // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ModifyClusterParameterGroup func (c *Redshift) ModifyClusterParameterGroup(input *ModifyClusterParameterGroupInput) (*ClusterParameterGroupNameMessage, error) { req, out := c.ModifyClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyClusterParameterGroupWithContext is the same as ModifyClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyClusterParameterGroup 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 *Redshift) ModifyClusterParameterGroupWithContext(ctx aws.Context, input *ModifyClusterParameterGroupInput, opts ...request.Option) (*ClusterParameterGroupNameMessage, error) { + req, out := c.ModifyClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyClusterSubnetGroup = "ModifyClusterSubnetGroup" @@ -4686,8 +5943,23 @@ func (c *Redshift) ModifyClusterSubnetGroupRequest(input *ModifyClusterSubnetGro // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ModifyClusterSubnetGroup func (c *Redshift) ModifyClusterSubnetGroup(input *ModifyClusterSubnetGroupInput) (*ModifyClusterSubnetGroupOutput, error) { req, out := c.ModifyClusterSubnetGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyClusterSubnetGroupWithContext is the same as ModifyClusterSubnetGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyClusterSubnetGroup 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 *Redshift) ModifyClusterSubnetGroupWithContext(ctx aws.Context, input *ModifyClusterSubnetGroupInput, opts ...request.Option) (*ModifyClusterSubnetGroupOutput, error) { + req, out := c.ModifyClusterSubnetGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyEventSubscription = "ModifyEventSubscription" @@ -4783,8 +6055,23 @@ func (c *Redshift) ModifyEventSubscriptionRequest(input *ModifyEventSubscription // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ModifyEventSubscription func (c *Redshift) ModifyEventSubscription(input *ModifyEventSubscriptionInput) (*ModifyEventSubscriptionOutput, error) { req, out := c.ModifyEventSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyEventSubscriptionWithContext is the same as ModifyEventSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyEventSubscription 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 *Redshift) ModifyEventSubscriptionWithContext(ctx aws.Context, input *ModifyEventSubscriptionInput, opts ...request.Option) (*ModifyEventSubscriptionOutput, error) { + req, out := c.ModifyEventSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifySnapshotCopyRetentionPeriod = "ModifySnapshotCopyRetentionPeriod" @@ -4858,8 +6145,23 @@ func (c *Redshift) ModifySnapshotCopyRetentionPeriodRequest(input *ModifySnapsho // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ModifySnapshotCopyRetentionPeriod func (c *Redshift) ModifySnapshotCopyRetentionPeriod(input *ModifySnapshotCopyRetentionPeriodInput) (*ModifySnapshotCopyRetentionPeriodOutput, error) { req, out := c.ModifySnapshotCopyRetentionPeriodRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifySnapshotCopyRetentionPeriodWithContext is the same as ModifySnapshotCopyRetentionPeriod with the addition of +// the ability to pass a context and additional request options. +// +// See ModifySnapshotCopyRetentionPeriod 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 *Redshift) ModifySnapshotCopyRetentionPeriodWithContext(ctx aws.Context, input *ModifySnapshotCopyRetentionPeriodInput, opts ...request.Option) (*ModifySnapshotCopyRetentionPeriodOutput, error) { + req, out := c.ModifySnapshotCopyRetentionPeriodRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPurchaseReservedNodeOffering = "PurchaseReservedNodeOffering" @@ -4942,8 +6244,23 @@ func (c *Redshift) PurchaseReservedNodeOfferingRequest(input *PurchaseReservedNo // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/PurchaseReservedNodeOffering func (c *Redshift) PurchaseReservedNodeOffering(input *PurchaseReservedNodeOfferingInput) (*PurchaseReservedNodeOfferingOutput, error) { req, out := c.PurchaseReservedNodeOfferingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurchaseReservedNodeOfferingWithContext is the same as PurchaseReservedNodeOffering with the addition of +// the ability to pass a context and additional request options. +// +// See PurchaseReservedNodeOffering 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 *Redshift) PurchaseReservedNodeOfferingWithContext(ctx aws.Context, input *PurchaseReservedNodeOfferingInput, opts ...request.Option) (*PurchaseReservedNodeOfferingOutput, error) { + req, out := c.PurchaseReservedNodeOfferingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRebootCluster = "RebootCluster" @@ -5016,8 +6333,23 @@ func (c *Redshift) RebootClusterRequest(input *RebootClusterInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/RebootCluster func (c *Redshift) RebootCluster(input *RebootClusterInput) (*RebootClusterOutput, error) { req, out := c.RebootClusterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RebootClusterWithContext is the same as RebootCluster with the addition of +// the ability to pass a context and additional request options. +// +// See RebootCluster 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 *Redshift) RebootClusterWithContext(ctx aws.Context, input *RebootClusterInput, opts ...request.Option) (*RebootClusterOutput, error) { + req, out := c.RebootClusterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResetClusterParameterGroup = "ResetClusterParameterGroup" @@ -5089,8 +6421,23 @@ func (c *Redshift) ResetClusterParameterGroupRequest(input *ResetClusterParamete // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ResetClusterParameterGroup func (c *Redshift) ResetClusterParameterGroup(input *ResetClusterParameterGroupInput) (*ClusterParameterGroupNameMessage, error) { req, out := c.ResetClusterParameterGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResetClusterParameterGroupWithContext is the same as ResetClusterParameterGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ResetClusterParameterGroup 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 *Redshift) ResetClusterParameterGroupWithContext(ctx aws.Context, input *ResetClusterParameterGroupInput, opts ...request.Option) (*ClusterParameterGroupNameMessage, error) { + req, out := c.ResetClusterParameterGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreFromClusterSnapshot = "RestoreFromClusterSnapshot" @@ -5240,8 +6587,23 @@ func (c *Redshift) RestoreFromClusterSnapshotRequest(input *RestoreFromClusterSn // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/RestoreFromClusterSnapshot func (c *Redshift) RestoreFromClusterSnapshot(input *RestoreFromClusterSnapshotInput) (*RestoreFromClusterSnapshotOutput, error) { req, out := c.RestoreFromClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreFromClusterSnapshotWithContext is the same as RestoreFromClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreFromClusterSnapshot 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 *Redshift) RestoreFromClusterSnapshotWithContext(ctx aws.Context, input *RestoreFromClusterSnapshotInput, opts ...request.Option) (*RestoreFromClusterSnapshotOutput, error) { + req, out := c.RestoreFromClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreTableFromClusterSnapshot = "RestoreTableFromClusterSnapshot" @@ -5338,8 +6700,23 @@ func (c *Redshift) RestoreTableFromClusterSnapshotRequest(input *RestoreTableFro // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/RestoreTableFromClusterSnapshot func (c *Redshift) RestoreTableFromClusterSnapshot(input *RestoreTableFromClusterSnapshotInput) (*RestoreTableFromClusterSnapshotOutput, error) { req, out := c.RestoreTableFromClusterSnapshotRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreTableFromClusterSnapshotWithContext is the same as RestoreTableFromClusterSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreTableFromClusterSnapshot 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 *Redshift) RestoreTableFromClusterSnapshotWithContext(ctx aws.Context, input *RestoreTableFromClusterSnapshotInput, opts ...request.Option) (*RestoreTableFromClusterSnapshotOutput, error) { + req, out := c.RestoreTableFromClusterSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRevokeClusterSecurityGroupIngress = "RevokeClusterSecurityGroupIngress" @@ -5415,8 +6792,23 @@ func (c *Redshift) RevokeClusterSecurityGroupIngressRequest(input *RevokeCluster // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/RevokeClusterSecurityGroupIngress func (c *Redshift) RevokeClusterSecurityGroupIngress(input *RevokeClusterSecurityGroupIngressInput) (*RevokeClusterSecurityGroupIngressOutput, error) { req, out := c.RevokeClusterSecurityGroupIngressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RevokeClusterSecurityGroupIngressWithContext is the same as RevokeClusterSecurityGroupIngress with the addition of +// the ability to pass a context and additional request options. +// +// See RevokeClusterSecurityGroupIngress 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 *Redshift) RevokeClusterSecurityGroupIngressWithContext(ctx aws.Context, input *RevokeClusterSecurityGroupIngressInput, opts ...request.Option) (*RevokeClusterSecurityGroupIngressOutput, error) { + req, out := c.RevokeClusterSecurityGroupIngressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRevokeSnapshotAccess = "RevokeSnapshotAccess" @@ -5494,8 +6886,23 @@ func (c *Redshift) RevokeSnapshotAccessRequest(input *RevokeSnapshotAccessInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/RevokeSnapshotAccess func (c *Redshift) RevokeSnapshotAccess(input *RevokeSnapshotAccessInput) (*RevokeSnapshotAccessOutput, error) { req, out := c.RevokeSnapshotAccessRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RevokeSnapshotAccessWithContext is the same as RevokeSnapshotAccess with the addition of +// the ability to pass a context and additional request options. +// +// See RevokeSnapshotAccess 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 *Redshift) RevokeSnapshotAccessWithContext(ctx aws.Context, input *RevokeSnapshotAccessInput, opts ...request.Option) (*RevokeSnapshotAccessOutput, error) { + req, out := c.RevokeSnapshotAccessRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRotateEncryptionKey = "RotateEncryptionKey" @@ -5566,8 +6973,23 @@ func (c *Redshift) RotateEncryptionKeyRequest(input *RotateEncryptionKeyInput) ( // Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/RotateEncryptionKey func (c *Redshift) RotateEncryptionKey(input *RotateEncryptionKeyInput) (*RotateEncryptionKeyOutput, error) { req, out := c.RotateEncryptionKeyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RotateEncryptionKeyWithContext is the same as RotateEncryptionKey with the addition of +// the ability to pass a context and additional request options. +// +// See RotateEncryptionKey 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 *Redshift) RotateEncryptionKeyWithContext(ctx aws.Context, input *RotateEncryptionKeyInput, opts ...request.Option) (*RotateEncryptionKeyOutput, error) { + req, out := c.RotateEncryptionKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Describes an AWS customer account authorized to restore a snapshot. @@ -5575,6 +6997,10 @@ func (c *Redshift) RotateEncryptionKey(input *RotateEncryptionKeyInput) (*Rotate type AccountWithRestoreAccess struct { _ struct{} `type:"structure"` + // The identifier of an AWS support account authorized to restore a snapshot. + // For AWS support, the identifier is amazon-redshift-support. + AccountAlias *string `type:"string"` + // The identifier of an AWS customer account authorized to restore a snapshot. AccountId *string `type:"string"` } @@ -5589,6 +7015,12 @@ func (s AccountWithRestoreAccess) GoString() string { return s.String() } +// SetAccountAlias sets the AccountAlias field's value. +func (s *AccountWithRestoreAccess) SetAccountAlias(v string) *AccountWithRestoreAccess { + s.AccountAlias = &v + return s +} + // SetAccountId sets the AccountId field's value. func (s *AccountWithRestoreAccess) SetAccountId(v string) *AccountWithRestoreAccess { s.AccountId = &v @@ -5696,6 +7128,8 @@ type AuthorizeSnapshotAccessInput struct { // The identifier of the AWS customer account authorized to restore the specified // snapshot. // + // To share a snapshot with AWS support, specify amazon-redshift-support. + // // AccountWithRestoreAccess is a required field AccountWithRestoreAccess *string `type:"string" required:"true"` @@ -12178,6 +13612,185 @@ func (s *EventSubscription) SetTags(v []*Tag) *EventSubscription { return s } +// The request parameters to get cluster credentials. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/GetClusterCredentialsMessage +type GetClusterCredentialsInput struct { + _ struct{} `type:"structure"` + + // Create a database user with the name specified for DbUser if one does not + // exist. + AutoCreate *bool `type:"boolean"` + + // The unique identifier of the cluster that contains the database for which + // your are requesting credentials. This parameter is case sensitive. + // + // ClusterIdentifier is a required field + ClusterIdentifier *string `type:"string" required:"true"` + + // A list of the names of existing database groups that DbUser will join for + // the current session. If not specified, the new user is added only to PUBLIC. + DbGroups []*string `locationNameList:"DbGroup" type:"list"` + + // The name of a database that DbUser is authorized to log on to. If DbName + // is not specified, DbUser can log in to any existing database. + // + // Constraints: + // + // * Must be 1 to 64 alphanumeric characters or hyphens + // + // * Must contain only lowercase letters. + // + // * Cannot be a reserved word. A list of reserved words can be found in + // Reserved Words (http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html) + // in the Amazon Redshift Database Developer Guide. + DbName *string `type:"string"` + + // The name of a database user. If a user name matching DbUser exists in the + // database, the temporary user credentials have the same permissions as the + // existing user. If DbUser doesn't exist in the database and Autocreate is + // True, a new user is created using the value for DbUser with PUBLIC permissions. + // If a database user matching the value for DbUser doesn't exist and Autocreate + // is False, then the command succeeds but the connection attempt will fail + // because the user doesn't exist in the database. + // + // For more information, see CREATE USER (http://docs.aws.amazon.com/http:/docs.aws.amazon.com/redshift/latest/dg/r_CREATE_USER.html) + // in the Amazon Redshift Database Developer Guide. + // + // Constraints: + // + // * Must be 1 to 128 alphanumeric characters or hyphens + // + // * Must contain only lowercase letters. + // + // * First character must be a letter. + // + // * Must not contain a colon ( : ) or slash ( / ). + // + // * Cannot be a reserved word. A list of reserved words can be found in + // Reserved Words (http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html) + // in the Amazon Redshift Database Developer Guide. + // + // DbUser is a required field + DbUser *string `type:"string" required:"true"` + + // The number of seconds until the returned temporary password expires. + // + // Constraint: minimum 900, maximum 3600. + // + // Default: 900 + DurationSeconds *int64 `type:"integer"` +} + +// String returns the string representation +func (s GetClusterCredentialsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetClusterCredentialsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetClusterCredentialsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetClusterCredentialsInput"} + if s.ClusterIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("ClusterIdentifier")) + } + if s.DbUser == nil { + invalidParams.Add(request.NewErrParamRequired("DbUser")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAutoCreate sets the AutoCreate field's value. +func (s *GetClusterCredentialsInput) SetAutoCreate(v bool) *GetClusterCredentialsInput { + s.AutoCreate = &v + return s +} + +// SetClusterIdentifier sets the ClusterIdentifier field's value. +func (s *GetClusterCredentialsInput) SetClusterIdentifier(v string) *GetClusterCredentialsInput { + s.ClusterIdentifier = &v + return s +} + +// SetDbGroups sets the DbGroups field's value. +func (s *GetClusterCredentialsInput) SetDbGroups(v []*string) *GetClusterCredentialsInput { + s.DbGroups = v + return s +} + +// SetDbName sets the DbName field's value. +func (s *GetClusterCredentialsInput) SetDbName(v string) *GetClusterCredentialsInput { + s.DbName = &v + return s +} + +// SetDbUser sets the DbUser field's value. +func (s *GetClusterCredentialsInput) SetDbUser(v string) *GetClusterCredentialsInput { + s.DbUser = &v + return s +} + +// SetDurationSeconds sets the DurationSeconds field's value. +func (s *GetClusterCredentialsInput) SetDurationSeconds(v int64) *GetClusterCredentialsInput { + s.DurationSeconds = &v + return s +} + +// Temporary credentials with authorization to log in to an Amazon Redshift +// database. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/ClusterCredentials +type GetClusterCredentialsOutput struct { + _ struct{} `type:"structure"` + + // A temporary password that authorizes the user name returned by DbUser to + // log on to the database DbName. + DbPassword *string `type:"string"` + + // A database user name that is authorized to log on to the database DbName + // using the password DbPassword. If the DbGroups parameter is specifed, DbUser + // is added to the listed groups for the current session. The user name is prefixed + // with IAM: for an existing user name or IAMA: if the user was auto-created. + DbUser *string `type:"string"` + + // The date and time DbPassword expires. + Expiration *time.Time `type:"timestamp" timestampFormat:"iso8601"` +} + +// String returns the string representation +func (s GetClusterCredentialsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetClusterCredentialsOutput) GoString() string { + return s.String() +} + +// SetDbPassword sets the DbPassword field's value. +func (s *GetClusterCredentialsOutput) SetDbPassword(v string) *GetClusterCredentialsOutput { + s.DbPassword = &v + return s +} + +// SetDbUser sets the DbUser field's value. +func (s *GetClusterCredentialsOutput) SetDbUser(v string) *GetClusterCredentialsOutput { + s.DbUser = &v + return s +} + +// SetExpiration sets the Expiration field's value. +func (s *GetClusterCredentialsOutput) SetExpiration(v time.Time) *GetClusterCredentialsOutput { + s.Expiration = &v + return s +} + // Returns information about an HSM client certificate. The certificate is stored // in a secure Hardware Storage Module (HSM), and used by the Amazon Redshift // cluster to encrypt data files. diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/errors.go index b59f68d880..8b0570fe3e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package redshift @@ -165,6 +165,13 @@ const ( // requests made by Amazon Redshift on your behalf. Wait and retry the request. ErrCodeDependentServiceRequestThrottlingFault = "DependentServiceRequestThrottlingFault" + // ErrCodeDependentServiceUnavailableFault for service response error code + // "DependentServiceUnavailableFault". + // + // Your request cannot be completed because a dependent internal service is + // temporarily unavailable. Wait 30 to 60 seconds and try again. + ErrCodeDependentServiceUnavailableFault = "DependentServiceUnavailableFault" + // ErrCodeEventSubscriptionQuotaExceededFault for service response error code // "EventSubscriptionQuotaExceeded". // diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/service.go index 904e408dfd..fd96e4bbc1 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package redshift diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/waiters.go index 59e26ed598..21ce4ee923 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/redshift/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package redshift import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilClusterAvailable uses the Amazon Redshift API operation @@ -11,38 +14,55 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *Redshift) WaitUntilClusterAvailable(input *DescribeClustersInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeClusters", - Delay: 60, + return c.WaitUntilClusterAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilClusterAvailableWithContext is an extended version of WaitUntilClusterAvailable. +// 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 *Redshift) WaitUntilClusterAvailableWithContext(ctx aws.Context, input *DescribeClustersInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilClusterAvailable", MaxAttempts: 30, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(60 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Clusters[].ClusterStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Clusters[].ClusterStatus", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Clusters[].ClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Clusters[].ClusterStatus", Expected: "deleting", }, { - State: "retry", - Matcher: "error", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ClusterNotFound", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilClusterDeleted uses the Amazon Redshift API operation @@ -50,38 +70,55 @@ func (c *Redshift) WaitUntilClusterAvailable(input *DescribeClustersInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *Redshift) WaitUntilClusterDeleted(input *DescribeClustersInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeClusters", - Delay: 60, + return c.WaitUntilClusterDeletedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilClusterDeletedWithContext is an extended version of WaitUntilClusterDeleted. +// 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 *Redshift) WaitUntilClusterDeletedWithContext(ctx aws.Context, input *DescribeClustersInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilClusterDeleted", MaxAttempts: 30, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(60 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "error", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.ErrorWaiterMatch, Expected: "ClusterNotFound", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Clusters[].ClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Clusters[].ClusterStatus", Expected: "creating", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Clusters[].ClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Clusters[].ClusterStatus", Expected: "modifying", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilClusterRestored uses the Amazon Redshift API operation @@ -89,32 +126,50 @@ func (c *Redshift) WaitUntilClusterDeleted(input *DescribeClustersInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *Redshift) WaitUntilClusterRestored(input *DescribeClustersInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeClusters", - Delay: 60, + return c.WaitUntilClusterRestoredWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilClusterRestoredWithContext is an extended version of WaitUntilClusterRestored. +// 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 *Redshift) WaitUntilClusterRestoredWithContext(ctx aws.Context, input *DescribeClustersInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilClusterRestored", MaxAttempts: 30, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(60 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Clusters[].RestoreStatus.Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Clusters[].RestoreStatus.Status", Expected: "completed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Clusters[].ClusterStatus", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Clusters[].ClusterStatus", Expected: "deleting", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeClustersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClustersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilSnapshotAvailable uses the Amazon Redshift API operation @@ -122,36 +177,53 @@ func (c *Redshift) WaitUntilClusterRestored(input *DescribeClustersInput) error // If the condition is not meet within the max attempt window an error will // be returned. func (c *Redshift) WaitUntilSnapshotAvailable(input *DescribeClusterSnapshotsInput) error { - waiterCfg := waiter.Config{ - Operation: "DescribeClusterSnapshots", - Delay: 15, + return c.WaitUntilSnapshotAvailableWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilSnapshotAvailableWithContext is an extended version of WaitUntilSnapshotAvailable. +// 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 *Redshift) WaitUntilSnapshotAvailableWithContext(ctx aws.Context, input *DescribeClusterSnapshotsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilSnapshotAvailable", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(15 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "Snapshots[].Status", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "Snapshots[].Status", Expected: "available", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Snapshots[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Snapshots[].Status", Expected: "failed", }, { - State: "failure", - Matcher: "pathAny", - Argument: "Snapshots[].Status", + State: request.FailureWaiterState, + Matcher: request.PathAnyWaiterMatch, Argument: "Snapshots[].Status", Expected: "deleted", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeClusterSnapshotsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeClusterSnapshotsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/api.go index 110e42f8e3..d967d9bb59 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package route53 provides a client for Amazon Route 53. package route53 @@ -7,6 +7,7 @@ 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" ) @@ -111,8 +112,23 @@ func (c *Route53) AssociateVPCWithHostedZoneRequest(input *AssociateVPCWithHoste // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/AssociateVPCWithHostedZone func (c *Route53) AssociateVPCWithHostedZone(input *AssociateVPCWithHostedZoneInput) (*AssociateVPCWithHostedZoneOutput, error) { req, out := c.AssociateVPCWithHostedZoneRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssociateVPCWithHostedZoneWithContext is the same as AssociateVPCWithHostedZone with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateVPCWithHostedZone 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 *Route53) AssociateVPCWithHostedZoneWithContext(ctx aws.Context, input *AssociateVPCWithHostedZoneInput, opts ...request.Option) (*AssociateVPCWithHostedZoneOutput, error) { + req, out := c.AssociateVPCWithHostedZoneRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opChangeResourceRecordSets = "ChangeResourceRecordSets" @@ -165,6 +181,8 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // // /2013-04-01/hostedzone/Amazon Route 53 hosted Zone ID/rrset resource. // +// Change Batches and Transactional Changes +// // The request body must include a document with a ChangeResourceRecordSetsRequest // element. The request body contains a list of change items, known as a change // batch. Change batches are considered transactional changes. When using the @@ -185,6 +203,8 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // the same change batch more than once, Amazon Route 53 returns an InvalidChangeBatch // error. // +// Traffic Flow +// // To create resource record sets for complex routing configurations, use either // the traffic flow visual editor in the Amazon Route 53 console or the API // actions for traffic policies and traffic policy instances. Save the configuration @@ -195,6 +215,8 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // see Using Traffic Flow to Route DNS Traffic (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/traffic-flow.html) // in the Amazon Route 53 Developer Guide. // +// Create, Delete, and Upsert +// // Use ChangeResourceRecordsSetsRequest to perform the following actions: // // * CREATE: Creates a resource record set that has the specified values. @@ -206,47 +228,28 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // it. If a resource set does exist, Amazon Route 53 updates it with the // values in the request. // -// The values that you need to include in the request depend on the type of -// resource record set that you're creating, deleting, or updating: -// -// Basic resource record sets (excluding alias, failover, geolocation, latency, -// and weighted resource record sets) -// -// * Name -// -// * Type -// -// * TTL +// Syntaxes for Creating, Updating, and Deleting Resource Record Sets // -// Failover, geolocation, latency, or weighted resource record sets (excluding -// alias resource record sets) +// The syntax for a request depends on the type of resource record set that +// you want to create, delete, or update, such as weighted, alias, or failover. +// The XML elements in your request must appear in the order listed in the syntax. // -// * Name +// For an example for each type of resource record set, see "Examples." // -// * Type +// Don't refer to the syntax in the "Parameter Syntax" section, which includes +// all of the elements for every kind of resource record set that you can create, +// delete, or update by using ChangeResourceRecordSets. // -// * TTL -// -// * SetIdentifier -// -// Alias resource record sets (including failover alias, geolocation alias, -// latency alias, and weighted alias resource record sets) -// -// * Name -// -// * Type -// -// * AliasTarget (includes DNSName, EvaluateTargetHealth, and HostedZoneId) -// -// * SetIdentifier (for failover, geolocation, latency, and weighted resource -// record sets) +// Change Propagation to Amazon Route 53 DNS Servers // // When you submit a ChangeResourceRecordSets request, Amazon Route 53 propagates // your changes to all of the Amazon Route 53 authoritative DNS servers. While // your changes are propagating, GetChange returns a status of PENDING. When // propagation is complete, GetChange returns a status of INSYNC. Changes generally // propagate to all Amazon Route 53 name servers in a few minutes. In rare circumstances, -// propagation can take up to 30 minutes. For more information, see GetChange +// propagation can take up to 30 minutes. For more information, see GetChange. +// +// Limits on ChangeResourceRecordSets Requests // // For information about the limits on a ChangeResourceRecordSets request, see // Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) @@ -284,8 +287,23 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeResourceRecordSets func (c *Route53) ChangeResourceRecordSets(input *ChangeResourceRecordSetsInput) (*ChangeResourceRecordSetsOutput, error) { req, out := c.ChangeResourceRecordSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ChangeResourceRecordSetsWithContext is the same as ChangeResourceRecordSets with the addition of +// the ability to pass a context and additional request options. +// +// See ChangeResourceRecordSets 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 *Route53) ChangeResourceRecordSetsWithContext(ctx aws.Context, input *ChangeResourceRecordSetsInput, opts ...request.Option) (*ChangeResourceRecordSetsOutput, error) { + req, out := c.ChangeResourceRecordSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opChangeTagsForResource = "ChangeTagsForResource" @@ -365,12 +383,28 @@ func (c *Route53) ChangeTagsForResourceRequest(input *ChangeTagsForResourceInput // duration, before you try the request again. // // * ErrCodeThrottlingException "ThrottlingException" +// The limit on the number of requests per second was exceeded. // // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeTagsForResource func (c *Route53) ChangeTagsForResource(input *ChangeTagsForResourceInput) (*ChangeTagsForResourceOutput, error) { req, out := c.ChangeTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ChangeTagsForResourceWithContext is the same as ChangeTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ChangeTagsForResource 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 *Route53) ChangeTagsForResourceWithContext(ctx aws.Context, input *ChangeTagsForResourceInput, opts ...request.Option) (*ChangeTagsForResourceOutput, error) { + req, out := c.ChangeTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateHealthCheck = "CreateHealthCheck" @@ -427,7 +461,7 @@ func (c *Route53) CreateHealthCheckRequest(input *CreateHealthCheckInput) (req * // set. For information about adding health checks to resource record sets, // see ResourceRecordSet$HealthCheckId in ChangeResourceRecordSets. // -// If you are registering EC2 instances with an Elastic Load Balancing (ELB) +// If you're registering EC2 instances with an Elastic Load Balancing (ELB) // load balancer, do not create Amazon Route 53 health checks for the EC2 instances. // When you register an EC2 instance with a load balancer, you configure settings // for an ELB health check, which performs a similar function to an Amazon Route @@ -465,10 +499,9 @@ func (c *Route53) CreateHealthCheckRequest(input *CreateHealthCheckInput) (req * // with the AWS Support Center. // // * ErrCodeHealthCheckAlreadyExists "HealthCheckAlreadyExists" -// The health check you're attempting to create already exists. -// -// Amazon Route 53 returns this error when a health check has already been created -// with the specified value for CallerReference. +// The health check you're attempting to create already exists. Amazon Route +// 53 returns this error when a health check has already been created with the +// specified value for CallerReference. // // * ErrCodeInvalidInput "InvalidInput" // The input is not valid. @@ -476,8 +509,23 @@ func (c *Route53) CreateHealthCheckRequest(input *CreateHealthCheckInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateHealthCheck func (c *Route53) CreateHealthCheck(input *CreateHealthCheckInput) (*CreateHealthCheckOutput, error) { req, out := c.CreateHealthCheckRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateHealthCheckWithContext is the same as CreateHealthCheck with the addition of +// the ability to pass a context and additional request options. +// +// See CreateHealthCheck 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 *Route53) CreateHealthCheckWithContext(ctx aws.Context, input *CreateHealthCheckInput, opts ...request.Option) (*CreateHealthCheckOutput, error) { + req, out := c.CreateHealthCheckRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateHostedZone = "CreateHostedZone" @@ -578,8 +626,8 @@ func (c *Route53) CreateHostedZoneRequest(input *CreateHostedZoneInput) (req *re // The specified domain name is not valid. // // * ErrCodeHostedZoneAlreadyExists "HostedZoneAlreadyExists" -// The hosted zone you are trying to create already exists. Amazon Route 53 -// returns this error when a hosted zone has already been created with the specified +// The hosted zone you're trying to create already exists. Amazon Route 53 returns +// this error when a hosted zone has already been created with the specified // CallerReference. // // * ErrCodeTooManyHostedZones "TooManyHostedZones" @@ -617,8 +665,23 @@ func (c *Route53) CreateHostedZoneRequest(input *CreateHostedZoneInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateHostedZone func (c *Route53) CreateHostedZone(input *CreateHostedZoneInput) (*CreateHostedZoneOutput, error) { req, out := c.CreateHostedZoneRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateHostedZoneWithContext is the same as CreateHostedZone with the addition of +// the ability to pass a context and additional request options. +// +// See CreateHostedZone 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 *Route53) CreateHostedZoneWithContext(ctx aws.Context, input *CreateHostedZoneInput, opts ...request.Option) (*CreateHostedZoneOutput, error) { + req, out := c.CreateHostedZoneRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReusableDelegationSet = "CreateReusableDelegationSet" @@ -698,7 +761,7 @@ func (c *Route53) CreateReusableDelegationSetRequest(input *CreateReusableDelega // The specified HostedZone can't be found. // // * ErrCodeInvalidArgument "InvalidArgument" -// Parameter name and problem. +// Parameter name is invalid. // // * ErrCodeInvalidInput "InvalidInput" // The input is not valid. @@ -716,8 +779,23 @@ func (c *Route53) CreateReusableDelegationSetRequest(input *CreateReusableDelega // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateReusableDelegationSet func (c *Route53) CreateReusableDelegationSet(input *CreateReusableDelegationSetInput) (*CreateReusableDelegationSetOutput, error) { req, out := c.CreateReusableDelegationSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReusableDelegationSetWithContext is the same as CreateReusableDelegationSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReusableDelegationSet 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 *Route53) CreateReusableDelegationSetWithContext(ctx aws.Context, input *CreateReusableDelegationSetInput, opts ...request.Option) (*CreateReusableDelegationSetOutput, error) { + req, out := c.CreateReusableDelegationSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTrafficPolicy = "CreateTrafficPolicy" @@ -800,8 +878,23 @@ func (c *Route53) CreateTrafficPolicyRequest(input *CreateTrafficPolicyInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicy func (c *Route53) CreateTrafficPolicy(input *CreateTrafficPolicyInput) (*CreateTrafficPolicyOutput, error) { req, out := c.CreateTrafficPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTrafficPolicyWithContext is the same as CreateTrafficPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrafficPolicy 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 *Route53) CreateTrafficPolicyWithContext(ctx aws.Context, input *CreateTrafficPolicyInput, opts ...request.Option) (*CreateTrafficPolicyOutput, error) { + req, out := c.CreateTrafficPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTrafficPolicyInstance = "CreateTrafficPolicyInstance" @@ -889,8 +982,23 @@ func (c *Route53) CreateTrafficPolicyInstanceRequest(input *CreateTrafficPolicyI // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyInstance func (c *Route53) CreateTrafficPolicyInstance(input *CreateTrafficPolicyInstanceInput) (*CreateTrafficPolicyInstanceOutput, error) { req, out := c.CreateTrafficPolicyInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTrafficPolicyInstanceWithContext is the same as CreateTrafficPolicyInstance with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrafficPolicyInstance 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 *Route53) CreateTrafficPolicyInstanceWithContext(ctx aws.Context, input *CreateTrafficPolicyInstanceInput, opts ...request.Option) (*CreateTrafficPolicyInstanceOutput, error) { + req, out := c.CreateTrafficPolicyInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTrafficPolicyVersion = "CreateTrafficPolicyVersion" @@ -977,8 +1085,23 @@ func (c *Route53) CreateTrafficPolicyVersionRequest(input *CreateTrafficPolicyVe // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyVersion func (c *Route53) CreateTrafficPolicyVersion(input *CreateTrafficPolicyVersionInput) (*CreateTrafficPolicyVersionOutput, error) { req, out := c.CreateTrafficPolicyVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTrafficPolicyVersionWithContext is the same as CreateTrafficPolicyVersion with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTrafficPolicyVersion 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 *Route53) CreateTrafficPolicyVersionWithContext(ctx aws.Context, input *CreateTrafficPolicyVersionInput, opts ...request.Option) (*CreateTrafficPolicyVersionOutput, error) { + req, out := c.CreateTrafficPolicyVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateVPCAssociationAuthorization = "CreateVPCAssociationAuthorization" @@ -1049,6 +1172,10 @@ func (c *Route53) CreateVPCAssociationAuthorizationRequest(input *CreateVPCAssoc // API operation CreateVPCAssociationAuthorization for usage and error information. // // Returned Error Codes: +// * ErrCodeConcurrentModification "ConcurrentModification" +// Another user submitted a request to update the object at the same time that +// you did. Retry the request. +// // * ErrCodeTooManyVPCAssociationAuthorizations "TooManyVPCAssociationAuthorizations" // You've created the maximum number of authorizations that can be created for // the specified hosted zone. To authorize another VPC to be associated with @@ -1069,8 +1196,23 @@ func (c *Route53) CreateVPCAssociationAuthorizationRequest(input *CreateVPCAssoc // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateVPCAssociationAuthorization func (c *Route53) CreateVPCAssociationAuthorization(input *CreateVPCAssociationAuthorizationInput) (*CreateVPCAssociationAuthorizationOutput, error) { req, out := c.CreateVPCAssociationAuthorizationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateVPCAssociationAuthorizationWithContext is the same as CreateVPCAssociationAuthorization with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVPCAssociationAuthorization 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 *Route53) CreateVPCAssociationAuthorizationWithContext(ctx aws.Context, input *CreateVPCAssociationAuthorizationInput, opts ...request.Option) (*CreateVPCAssociationAuthorizationOutput, error) { + req, out := c.CreateVPCAssociationAuthorizationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteHealthCheck = "DeleteHealthCheck" @@ -1152,8 +1294,23 @@ func (c *Route53) DeleteHealthCheckRequest(input *DeleteHealthCheckInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteHealthCheck func (c *Route53) DeleteHealthCheck(input *DeleteHealthCheckInput) (*DeleteHealthCheckOutput, error) { req, out := c.DeleteHealthCheckRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteHealthCheckWithContext is the same as DeleteHealthCheck with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteHealthCheck 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 *Route53) DeleteHealthCheckWithContext(ctx aws.Context, input *DeleteHealthCheckInput, opts ...request.Option) (*DeleteHealthCheckOutput, error) { + req, out := c.DeleteHealthCheckRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteHostedZone = "DeleteHostedZone" @@ -1241,8 +1398,23 @@ func (c *Route53) DeleteHostedZoneRequest(input *DeleteHostedZoneInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteHostedZone func (c *Route53) DeleteHostedZone(input *DeleteHostedZoneInput) (*DeleteHostedZoneOutput, error) { req, out := c.DeleteHostedZoneRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteHostedZoneWithContext is the same as DeleteHostedZone with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteHostedZone 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 *Route53) DeleteHostedZoneWithContext(ctx aws.Context, input *DeleteHostedZoneInput, opts ...request.Option) (*DeleteHostedZoneOutput, error) { + req, out := c.DeleteHostedZoneRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReusableDelegationSet = "DeleteReusableDelegationSet" @@ -1324,8 +1496,23 @@ func (c *Route53) DeleteReusableDelegationSetRequest(input *DeleteReusableDelega // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteReusableDelegationSet func (c *Route53) DeleteReusableDelegationSet(input *DeleteReusableDelegationSetInput) (*DeleteReusableDelegationSetOutput, error) { req, out := c.DeleteReusableDelegationSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReusableDelegationSetWithContext is the same as DeleteReusableDelegationSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReusableDelegationSet 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 *Route53) DeleteReusableDelegationSetWithContext(ctx aws.Context, input *DeleteReusableDelegationSetInput, opts ...request.Option) (*DeleteReusableDelegationSetOutput, error) { + req, out := c.DeleteReusableDelegationSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTrafficPolicy = "DeleteTrafficPolicy" @@ -1402,8 +1589,23 @@ func (c *Route53) DeleteTrafficPolicyRequest(input *DeleteTrafficPolicyInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteTrafficPolicy func (c *Route53) DeleteTrafficPolicy(input *DeleteTrafficPolicyInput) (*DeleteTrafficPolicyOutput, error) { req, out := c.DeleteTrafficPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteTrafficPolicyWithContext is the same as DeleteTrafficPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrafficPolicy 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 *Route53) DeleteTrafficPolicyWithContext(ctx aws.Context, input *DeleteTrafficPolicyInput, opts ...request.Option) (*DeleteTrafficPolicyOutput, error) { + req, out := c.DeleteTrafficPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTrafficPolicyInstance = "DeleteTrafficPolicyInstance" @@ -1484,8 +1686,23 @@ func (c *Route53) DeleteTrafficPolicyInstanceRequest(input *DeleteTrafficPolicyI // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteTrafficPolicyInstance func (c *Route53) DeleteTrafficPolicyInstance(input *DeleteTrafficPolicyInstanceInput) (*DeleteTrafficPolicyInstanceOutput, error) { req, out := c.DeleteTrafficPolicyInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteTrafficPolicyInstanceWithContext is the same as DeleteTrafficPolicyInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTrafficPolicyInstance 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 *Route53) DeleteTrafficPolicyInstanceWithContext(ctx aws.Context, input *DeleteTrafficPolicyInstanceInput, opts ...request.Option) (*DeleteTrafficPolicyInstanceOutput, error) { + req, out := c.DeleteTrafficPolicyInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVPCAssociationAuthorization = "DeleteVPCAssociationAuthorization" @@ -1556,6 +1773,10 @@ func (c *Route53) DeleteVPCAssociationAuthorizationRequest(input *DeleteVPCAssoc // API operation DeleteVPCAssociationAuthorization for usage and error information. // // Returned Error Codes: +// * ErrCodeConcurrentModification "ConcurrentModification" +// Another user submitted a request to update the object at the same time that +// you did. Retry the request. +// // * ErrCodeVPCAssociationAuthorizationNotFound "VPCAssociationAuthorizationNotFound" // The VPC that you specified is not authorized to be associated with the hosted // zone. @@ -1573,8 +1794,23 @@ func (c *Route53) DeleteVPCAssociationAuthorizationRequest(input *DeleteVPCAssoc // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteVPCAssociationAuthorization func (c *Route53) DeleteVPCAssociationAuthorization(input *DeleteVPCAssociationAuthorizationInput) (*DeleteVPCAssociationAuthorizationOutput, error) { req, out := c.DeleteVPCAssociationAuthorizationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVPCAssociationAuthorizationWithContext is the same as DeleteVPCAssociationAuthorization with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVPCAssociationAuthorization 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 *Route53) DeleteVPCAssociationAuthorizationWithContext(ctx aws.Context, input *DeleteVPCAssociationAuthorizationInput, opts ...request.Option) (*DeleteVPCAssociationAuthorizationOutput, error) { + req, out := c.DeleteVPCAssociationAuthorizationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisassociateVPCFromHostedZone = "DisassociateVPCFromHostedZone" @@ -1663,8 +1899,23 @@ func (c *Route53) DisassociateVPCFromHostedZoneRequest(input *DisassociateVPCFro // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DisassociateVPCFromHostedZone func (c *Route53) DisassociateVPCFromHostedZone(input *DisassociateVPCFromHostedZoneInput) (*DisassociateVPCFromHostedZoneOutput, error) { req, out := c.DisassociateVPCFromHostedZoneRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisassociateVPCFromHostedZoneWithContext is the same as DisassociateVPCFromHostedZone with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateVPCFromHostedZone 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 *Route53) DisassociateVPCFromHostedZoneWithContext(ctx aws.Context, input *DisassociateVPCFromHostedZoneInput, opts ...request.Option) (*DisassociateVPCFromHostedZoneOutput, error) { + req, out := c.DisassociateVPCFromHostedZoneRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetChange = "GetChange" @@ -1739,8 +1990,23 @@ func (c *Route53) GetChangeRequest(input *GetChangeInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetChange func (c *Route53) GetChange(input *GetChangeInput) (*GetChangeOutput, error) { req, out := c.GetChangeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetChangeWithContext is the same as GetChange with the addition of +// the ability to pass a context and additional request options. +// +// See GetChange 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 *Route53) GetChangeWithContext(ctx aws.Context, input *GetChangeInput, opts ...request.Option) (*GetChangeOutput, error) { + req, out := c.GetChangeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetCheckerIpRanges = "GetCheckerIpRanges" @@ -1788,11 +2054,10 @@ func (c *Route53) GetCheckerIpRangesRequest(input *GetCheckerIpRangesInput) (req // GetCheckerIpRanges API operation for Amazon Route 53. // -// Retrieves a list of the IP ranges used by Amazon Route 53 health checkers -// to check the health of your resources. Send a GET request to the /Amazon -// Route 53 API version/checkeripranges resource. Use these IP addresses to -// configure router and firewall rules to allow health checkers to check the -// health of your resources. +// GetCheckerIpRanges still works, but we recommend that you download ip-ranges.json, +// which includes IP address ranges for all AWS services. For more information, +// see IP Address Ranges of Amazon Route 53 Servers (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/route-53-ip-addresses.html) +// in the Amazon Route 53 Developer 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 @@ -1803,8 +2068,23 @@ func (c *Route53) GetCheckerIpRangesRequest(input *GetCheckerIpRangesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetCheckerIpRanges func (c *Route53) GetCheckerIpRanges(input *GetCheckerIpRangesInput) (*GetCheckerIpRangesOutput, error) { req, out := c.GetCheckerIpRangesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCheckerIpRangesWithContext is the same as GetCheckerIpRanges with the addition of +// the ability to pass a context and additional request options. +// +// See GetCheckerIpRanges 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 *Route53) GetCheckerIpRangesWithContext(ctx aws.Context, input *GetCheckerIpRangesInput, opts ...request.Option) (*GetCheckerIpRangesOutput, error) { + req, out := c.GetCheckerIpRangesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetGeoLocation = "GetGeoLocation" @@ -1873,8 +2153,23 @@ func (c *Route53) GetGeoLocationRequest(input *GetGeoLocationInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetGeoLocation func (c *Route53) GetGeoLocation(input *GetGeoLocationInput) (*GetGeoLocationOutput, error) { req, out := c.GetGeoLocationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetGeoLocationWithContext is the same as GetGeoLocation with the addition of +// the ability to pass a context and additional request options. +// +// See GetGeoLocation 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 *Route53) GetGeoLocationWithContext(ctx aws.Context, input *GetGeoLocationInput, opts ...request.Option) (*GetGeoLocationOutput, error) { + req, out := c.GetGeoLocationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHealthCheck = "GetHealthCheck" @@ -1944,14 +2239,29 @@ func (c *Route53) GetHealthCheckRequest(input *GetHealthCheckInput) (req *reques // The input is not valid. // // * ErrCodeIncompatibleVersion "IncompatibleVersion" -// The resource you are trying to access is unsupported on this Amazon Route -// 53 endpoint. Please consider using a newer endpoint or a tool that does so. +// The resource you're trying to access is unsupported on this Amazon Route +// 53 endpoint. // // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheck func (c *Route53) GetHealthCheck(input *GetHealthCheckInput) (*GetHealthCheckOutput, error) { req, out := c.GetHealthCheckRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHealthCheckWithContext is the same as GetHealthCheck with the addition of +// the ability to pass a context and additional request options. +// +// See GetHealthCheck 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 *Route53) GetHealthCheckWithContext(ctx aws.Context, input *GetHealthCheckInput, opts ...request.Option) (*GetHealthCheckOutput, error) { + req, out := c.GetHealthCheckRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHealthCheckCount = "GetHealthCheckCount" @@ -2011,8 +2321,23 @@ func (c *Route53) GetHealthCheckCountRequest(input *GetHealthCheckCountInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckCount func (c *Route53) GetHealthCheckCount(input *GetHealthCheckCountInput) (*GetHealthCheckCountOutput, error) { req, out := c.GetHealthCheckCountRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHealthCheckCountWithContext is the same as GetHealthCheckCount with the addition of +// the ability to pass a context and additional request options. +// +// See GetHealthCheckCount 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 *Route53) GetHealthCheckCountWithContext(ctx aws.Context, input *GetHealthCheckCountInput, opts ...request.Option) (*GetHealthCheckCountOutput, error) { + req, out := c.GetHealthCheckCountRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHealthCheckLastFailureReason = "GetHealthCheckLastFailureReason" @@ -2083,8 +2408,23 @@ func (c *Route53) GetHealthCheckLastFailureReasonRequest(input *GetHealthCheckLa // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckLastFailureReason func (c *Route53) GetHealthCheckLastFailureReason(input *GetHealthCheckLastFailureReasonInput) (*GetHealthCheckLastFailureReasonOutput, error) { req, out := c.GetHealthCheckLastFailureReasonRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHealthCheckLastFailureReasonWithContext is the same as GetHealthCheckLastFailureReason with the addition of +// the ability to pass a context and additional request options. +// +// See GetHealthCheckLastFailureReason 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 *Route53) GetHealthCheckLastFailureReasonWithContext(ctx aws.Context, input *GetHealthCheckLastFailureReasonInput, opts ...request.Option) (*GetHealthCheckLastFailureReasonOutput, error) { + req, out := c.GetHealthCheckLastFailureReasonRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHealthCheckStatus = "GetHealthCheckStatus" @@ -2154,8 +2494,23 @@ func (c *Route53) GetHealthCheckStatusRequest(input *GetHealthCheckStatusInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckStatus func (c *Route53) GetHealthCheckStatus(input *GetHealthCheckStatusInput) (*GetHealthCheckStatusOutput, error) { req, out := c.GetHealthCheckStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHealthCheckStatusWithContext is the same as GetHealthCheckStatus with the addition of +// the ability to pass a context and additional request options. +// +// See GetHealthCheckStatus 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 *Route53) GetHealthCheckStatusWithContext(ctx aws.Context, input *GetHealthCheckStatusInput, opts ...request.Option) (*GetHealthCheckStatusOutput, error) { + req, out := c.GetHealthCheckStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHostedZone = "GetHostedZone" @@ -2224,8 +2579,23 @@ func (c *Route53) GetHostedZoneRequest(input *GetHostedZoneInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZone func (c *Route53) GetHostedZone(input *GetHostedZoneInput) (*GetHostedZoneOutput, error) { req, out := c.GetHostedZoneRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHostedZoneWithContext is the same as GetHostedZone with the addition of +// the ability to pass a context and additional request options. +// +// See GetHostedZone 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 *Route53) GetHostedZoneWithContext(ctx aws.Context, input *GetHostedZoneInput, opts ...request.Option) (*GetHostedZoneOutput, error) { + req, out := c.GetHostedZoneRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetHostedZoneCount = "GetHostedZoneCount" @@ -2290,8 +2660,23 @@ func (c *Route53) GetHostedZoneCountRequest(input *GetHostedZoneCountInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZoneCount func (c *Route53) GetHostedZoneCount(input *GetHostedZoneCountInput) (*GetHostedZoneCountOutput, error) { req, out := c.GetHostedZoneCountRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetHostedZoneCountWithContext is the same as GetHostedZoneCount with the addition of +// the ability to pass a context and additional request options. +// +// See GetHostedZoneCount 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 *Route53) GetHostedZoneCountWithContext(ctx aws.Context, input *GetHostedZoneCountInput, opts ...request.Option) (*GetHostedZoneCountOutput, error) { + req, out := c.GetHostedZoneCountRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetReusableDelegationSet = "GetReusableDelegationSet" @@ -2362,8 +2747,23 @@ func (c *Route53) GetReusableDelegationSetRequest(input *GetReusableDelegationSe // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetReusableDelegationSet func (c *Route53) GetReusableDelegationSet(input *GetReusableDelegationSetInput) (*GetReusableDelegationSetOutput, error) { req, out := c.GetReusableDelegationSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetReusableDelegationSetWithContext is the same as GetReusableDelegationSet with the addition of +// the ability to pass a context and additional request options. +// +// See GetReusableDelegationSet 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 *Route53) GetReusableDelegationSetWithContext(ctx aws.Context, input *GetReusableDelegationSetInput, opts ...request.Option) (*GetReusableDelegationSetOutput, error) { + req, out := c.GetReusableDelegationSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTrafficPolicy = "GetTrafficPolicy" @@ -2432,8 +2832,23 @@ func (c *Route53) GetTrafficPolicyRequest(input *GetTrafficPolicyInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicy func (c *Route53) GetTrafficPolicy(input *GetTrafficPolicyInput) (*GetTrafficPolicyOutput, error) { req, out := c.GetTrafficPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTrafficPolicyWithContext is the same as GetTrafficPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetTrafficPolicy 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 *Route53) GetTrafficPolicyWithContext(ctx aws.Context, input *GetTrafficPolicyInput, opts ...request.Option) (*GetTrafficPolicyOutput, error) { + req, out := c.GetTrafficPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTrafficPolicyInstance = "GetTrafficPolicyInstance" @@ -2511,8 +2926,23 @@ func (c *Route53) GetTrafficPolicyInstanceRequest(input *GetTrafficPolicyInstanc // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyInstance func (c *Route53) GetTrafficPolicyInstance(input *GetTrafficPolicyInstanceInput) (*GetTrafficPolicyInstanceOutput, error) { req, out := c.GetTrafficPolicyInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTrafficPolicyInstanceWithContext is the same as GetTrafficPolicyInstance with the addition of +// the ability to pass a context and additional request options. +// +// See GetTrafficPolicyInstance 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 *Route53) GetTrafficPolicyInstanceWithContext(ctx aws.Context, input *GetTrafficPolicyInstanceInput, opts ...request.Option) (*GetTrafficPolicyInstanceOutput, error) { + req, out := c.GetTrafficPolicyInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTrafficPolicyInstanceCount = "GetTrafficPolicyInstanceCount" @@ -2575,8 +3005,23 @@ func (c *Route53) GetTrafficPolicyInstanceCountRequest(input *GetTrafficPolicyIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyInstanceCount func (c *Route53) GetTrafficPolicyInstanceCount(input *GetTrafficPolicyInstanceCountInput) (*GetTrafficPolicyInstanceCountOutput, error) { req, out := c.GetTrafficPolicyInstanceCountRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTrafficPolicyInstanceCountWithContext is the same as GetTrafficPolicyInstanceCount with the addition of +// the ability to pass a context and additional request options. +// +// See GetTrafficPolicyInstanceCount 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 *Route53) GetTrafficPolicyInstanceCountWithContext(ctx aws.Context, input *GetTrafficPolicyInstanceCountInput, opts ...request.Option) (*GetTrafficPolicyInstanceCountOutput, error) { + req, out := c.GetTrafficPolicyInstanceCountRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListGeoLocations = "ListGeoLocations" @@ -2647,8 +3092,23 @@ func (c *Route53) ListGeoLocationsRequest(input *ListGeoLocationsInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListGeoLocations func (c *Route53) ListGeoLocations(input *ListGeoLocationsInput) (*ListGeoLocationsOutput, error) { req, out := c.ListGeoLocationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListGeoLocationsWithContext is the same as ListGeoLocations with the addition of +// the ability to pass a context and additional request options. +// +// See ListGeoLocations 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 *Route53) ListGeoLocationsWithContext(ctx aws.Context, input *ListGeoLocationsInput, opts ...request.Option) (*ListGeoLocationsOutput, error) { + req, out := c.ListGeoLocationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListHealthChecks = "ListHealthChecks" @@ -2724,14 +3184,29 @@ func (c *Route53) ListHealthChecksRequest(input *ListHealthChecksInput) (req *re // The input is not valid. // // * ErrCodeIncompatibleVersion "IncompatibleVersion" -// The resource you are trying to access is unsupported on this Amazon Route -// 53 endpoint. Please consider using a newer endpoint or a tool that does so. +// The resource you're trying to access is unsupported on this Amazon Route +// 53 endpoint. // // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHealthChecks func (c *Route53) ListHealthChecks(input *ListHealthChecksInput) (*ListHealthChecksOutput, error) { req, out := c.ListHealthChecksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListHealthChecksWithContext is the same as ListHealthChecks with the addition of +// the ability to pass a context and additional request options. +// +// See ListHealthChecks 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 *Route53) ListHealthChecksWithContext(ctx aws.Context, input *ListHealthChecksInput, opts ...request.Option) (*ListHealthChecksOutput, error) { + req, out := c.ListHealthChecksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListHealthChecksPages iterates over the pages of a ListHealthChecks operation, @@ -2751,12 +3226,37 @@ func (c *Route53) ListHealthChecks(input *ListHealthChecksInput) (*ListHealthChe // return pageNum <= 3 // }) // -func (c *Route53) ListHealthChecksPages(input *ListHealthChecksInput, fn func(p *ListHealthChecksOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListHealthChecksRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListHealthChecksOutput), lastPage) - }) +func (c *Route53) ListHealthChecksPages(input *ListHealthChecksInput, fn func(*ListHealthChecksOutput, bool) bool) error { + return c.ListHealthChecksPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListHealthChecksPagesWithContext same as ListHealthChecksPages 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 *Route53) ListHealthChecksPagesWithContext(ctx aws.Context, input *ListHealthChecksInput, fn func(*ListHealthChecksOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListHealthChecksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListHealthChecksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListHealthChecksOutput), !p.HasNextPage()) + } + return p.Err() } const opListHostedZones = "ListHostedZones" @@ -2857,8 +3357,23 @@ func (c *Route53) ListHostedZonesRequest(input *ListHostedZonesInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHostedZones func (c *Route53) ListHostedZones(input *ListHostedZonesInput) (*ListHostedZonesOutput, error) { req, out := c.ListHostedZonesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListHostedZonesWithContext is the same as ListHostedZones with the addition of +// the ability to pass a context and additional request options. +// +// See ListHostedZones 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 *Route53) ListHostedZonesWithContext(ctx aws.Context, input *ListHostedZonesInput, opts ...request.Option) (*ListHostedZonesOutput, error) { + req, out := c.ListHostedZonesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListHostedZonesPages iterates over the pages of a ListHostedZones operation, @@ -2878,12 +3393,37 @@ func (c *Route53) ListHostedZones(input *ListHostedZonesInput) (*ListHostedZones // return pageNum <= 3 // }) // -func (c *Route53) ListHostedZonesPages(input *ListHostedZonesInput, fn func(p *ListHostedZonesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListHostedZonesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListHostedZonesOutput), lastPage) - }) +func (c *Route53) ListHostedZonesPages(input *ListHostedZonesInput, fn func(*ListHostedZonesOutput, bool) bool) error { + return c.ListHostedZonesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListHostedZonesPagesWithContext same as ListHostedZonesPages 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 *Route53) ListHostedZonesPagesWithContext(ctx aws.Context, input *ListHostedZonesInput, fn func(*ListHostedZonesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListHostedZonesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListHostedZonesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListHostedZonesOutput), !p.HasNextPage()) + } + return p.Err() } const opListHostedZonesByName = "ListHostedZonesByName" @@ -3000,8 +3540,23 @@ func (c *Route53) ListHostedZonesByNameRequest(input *ListHostedZonesByNameInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHostedZonesByName func (c *Route53) ListHostedZonesByName(input *ListHostedZonesByNameInput) (*ListHostedZonesByNameOutput, error) { req, out := c.ListHostedZonesByNameRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListHostedZonesByNameWithContext is the same as ListHostedZonesByName with the addition of +// the ability to pass a context and additional request options. +// +// See ListHostedZonesByName 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 *Route53) ListHostedZonesByNameWithContext(ctx aws.Context, input *ListHostedZonesByNameInput, opts ...request.Option) (*ListHostedZonesByNameOutput, error) { + req, out := c.ListHostedZonesByNameRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListResourceRecordSets = "ListResourceRecordSets" @@ -3112,8 +3667,23 @@ func (c *Route53) ListResourceRecordSetsRequest(input *ListResourceRecordSetsInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListResourceRecordSets func (c *Route53) ListResourceRecordSets(input *ListResourceRecordSetsInput) (*ListResourceRecordSetsOutput, error) { req, out := c.ListResourceRecordSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListResourceRecordSetsWithContext is the same as ListResourceRecordSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListResourceRecordSets 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 *Route53) ListResourceRecordSetsWithContext(ctx aws.Context, input *ListResourceRecordSetsInput, opts ...request.Option) (*ListResourceRecordSetsOutput, error) { + req, out := c.ListResourceRecordSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListResourceRecordSetsPages iterates over the pages of a ListResourceRecordSets operation, @@ -3133,12 +3703,37 @@ func (c *Route53) ListResourceRecordSets(input *ListResourceRecordSetsInput) (*L // return pageNum <= 3 // }) // -func (c *Route53) ListResourceRecordSetsPages(input *ListResourceRecordSetsInput, fn func(p *ListResourceRecordSetsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListResourceRecordSetsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListResourceRecordSetsOutput), lastPage) - }) +func (c *Route53) ListResourceRecordSetsPages(input *ListResourceRecordSetsInput, fn func(*ListResourceRecordSetsOutput, bool) bool) error { + return c.ListResourceRecordSetsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListResourceRecordSetsPagesWithContext same as ListResourceRecordSetsPages 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 *Route53) ListResourceRecordSetsPagesWithContext(ctx aws.Context, input *ListResourceRecordSetsInput, fn func(*ListResourceRecordSetsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListResourceRecordSetsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListResourceRecordSetsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListResourceRecordSetsOutput), !p.HasNextPage()) + } + return p.Err() } const opListReusableDelegationSets = "ListReusableDelegationSets" @@ -3211,8 +3806,23 @@ func (c *Route53) ListReusableDelegationSetsRequest(input *ListReusableDelegatio // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListReusableDelegationSets func (c *Route53) ListReusableDelegationSets(input *ListReusableDelegationSetsInput) (*ListReusableDelegationSetsOutput, error) { req, out := c.ListReusableDelegationSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListReusableDelegationSetsWithContext is the same as ListReusableDelegationSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListReusableDelegationSets 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 *Route53) ListReusableDelegationSetsWithContext(ctx aws.Context, input *ListReusableDelegationSetsInput, opts ...request.Option) (*ListReusableDelegationSetsOutput, error) { + req, out := c.ListReusableDelegationSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResource = "ListTagsForResource" @@ -3292,12 +3902,28 @@ func (c *Route53) ListTagsForResourceRequest(input *ListTagsForResourceInput) (r // duration, before you try the request again. // // * ErrCodeThrottlingException "ThrottlingException" +// The limit on the number of requests per second was exceeded. // // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTagsForResource func (c *Route53) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *Route53) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResources = "ListTagsForResources" @@ -3377,12 +4003,28 @@ func (c *Route53) ListTagsForResourcesRequest(input *ListTagsForResourcesInput) // duration, before you try the request again. // // * ErrCodeThrottlingException "ThrottlingException" +// The limit on the number of requests per second was exceeded. // // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTagsForResources func (c *Route53) ListTagsForResources(input *ListTagsForResourcesInput) (*ListTagsForResourcesOutput, error) { req, out := c.ListTagsForResourcesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourcesWithContext is the same as ListTagsForResources with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResources 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 *Route53) ListTagsForResourcesWithContext(ctx aws.Context, input *ListTagsForResourcesInput, opts ...request.Option) (*ListTagsForResourcesOutput, error) { + req, out := c.ListTagsForResourcesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTrafficPolicies = "ListTrafficPolicies" @@ -3479,8 +4121,23 @@ func (c *Route53) ListTrafficPoliciesRequest(input *ListTrafficPoliciesInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicies func (c *Route53) ListTrafficPolicies(input *ListTrafficPoliciesInput) (*ListTrafficPoliciesOutput, error) { req, out := c.ListTrafficPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTrafficPoliciesWithContext is the same as ListTrafficPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListTrafficPolicies 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 *Route53) ListTrafficPoliciesWithContext(ctx aws.Context, input *ListTrafficPoliciesInput, opts ...request.Option) (*ListTrafficPoliciesOutput, error) { + req, out := c.ListTrafficPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTrafficPolicyInstances = "ListTrafficPolicyInstances" @@ -3586,8 +4243,23 @@ func (c *Route53) ListTrafficPolicyInstancesRequest(input *ListTrafficPolicyInst // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstances func (c *Route53) ListTrafficPolicyInstances(input *ListTrafficPolicyInstancesInput) (*ListTrafficPolicyInstancesOutput, error) { req, out := c.ListTrafficPolicyInstancesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTrafficPolicyInstancesWithContext is the same as ListTrafficPolicyInstances with the addition of +// the ability to pass a context and additional request options. +// +// See ListTrafficPolicyInstances 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 *Route53) ListTrafficPolicyInstancesWithContext(ctx aws.Context, input *ListTrafficPolicyInstancesInput, opts ...request.Option) (*ListTrafficPolicyInstancesOutput, error) { + req, out := c.ListTrafficPolicyInstancesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTrafficPolicyInstancesByHostedZone = "ListTrafficPolicyInstancesByHostedZone" @@ -3696,8 +4368,23 @@ func (c *Route53) ListTrafficPolicyInstancesByHostedZoneRequest(input *ListTraff // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesByHostedZone func (c *Route53) ListTrafficPolicyInstancesByHostedZone(input *ListTrafficPolicyInstancesByHostedZoneInput) (*ListTrafficPolicyInstancesByHostedZoneOutput, error) { req, out := c.ListTrafficPolicyInstancesByHostedZoneRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTrafficPolicyInstancesByHostedZoneWithContext is the same as ListTrafficPolicyInstancesByHostedZone with the addition of +// the ability to pass a context and additional request options. +// +// See ListTrafficPolicyInstancesByHostedZone 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 *Route53) ListTrafficPolicyInstancesByHostedZoneWithContext(ctx aws.Context, input *ListTrafficPolicyInstancesByHostedZoneInput, opts ...request.Option) (*ListTrafficPolicyInstancesByHostedZoneOutput, error) { + req, out := c.ListTrafficPolicyInstancesByHostedZoneRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTrafficPolicyInstancesByPolicy = "ListTrafficPolicyInstancesByPolicy" @@ -3805,8 +4492,23 @@ func (c *Route53) ListTrafficPolicyInstancesByPolicyRequest(input *ListTrafficPo // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesByPolicy func (c *Route53) ListTrafficPolicyInstancesByPolicy(input *ListTrafficPolicyInstancesByPolicyInput) (*ListTrafficPolicyInstancesByPolicyOutput, error) { req, out := c.ListTrafficPolicyInstancesByPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTrafficPolicyInstancesByPolicyWithContext is the same as ListTrafficPolicyInstancesByPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See ListTrafficPolicyInstancesByPolicy 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 *Route53) ListTrafficPolicyInstancesByPolicyWithContext(ctx aws.Context, input *ListTrafficPolicyInstancesByPolicyInput, opts ...request.Option) (*ListTrafficPolicyInstancesByPolicyOutput, error) { + req, out := c.ListTrafficPolicyInstancesByPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTrafficPolicyVersions = "ListTrafficPolicyVersions" @@ -3906,8 +4608,23 @@ func (c *Route53) ListTrafficPolicyVersionsRequest(input *ListTrafficPolicyVersi // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyVersions func (c *Route53) ListTrafficPolicyVersions(input *ListTrafficPolicyVersionsInput) (*ListTrafficPolicyVersionsOutput, error) { req, out := c.ListTrafficPolicyVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTrafficPolicyVersionsWithContext is the same as ListTrafficPolicyVersions with the addition of +// the ability to pass a context and additional request options. +// +// See ListTrafficPolicyVersions 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 *Route53) ListTrafficPolicyVersionsWithContext(ctx aws.Context, input *ListTrafficPolicyVersionsInput, opts ...request.Option) (*ListTrafficPolicyVersionsOutput, error) { + req, out := c.ListTrafficPolicyVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListVPCAssociationAuthorizations = "ListVPCAssociationAuthorizations" @@ -3996,8 +4713,23 @@ func (c *Route53) ListVPCAssociationAuthorizationsRequest(input *ListVPCAssociat // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListVPCAssociationAuthorizations func (c *Route53) ListVPCAssociationAuthorizations(input *ListVPCAssociationAuthorizationsInput) (*ListVPCAssociationAuthorizationsOutput, error) { req, out := c.ListVPCAssociationAuthorizationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListVPCAssociationAuthorizationsWithContext is the same as ListVPCAssociationAuthorizations with the addition of +// the ability to pass a context and additional request options. +// +// See ListVPCAssociationAuthorizations 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 *Route53) ListVPCAssociationAuthorizationsWithContext(ctx aws.Context, input *ListVPCAssociationAuthorizationsInput, opts ...request.Option) (*ListVPCAssociationAuthorizationsOutput, error) { + req, out := c.ListVPCAssociationAuthorizationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTestDNSAnswer = "TestDNSAnswer" @@ -4066,8 +4798,23 @@ func (c *Route53) TestDNSAnswerRequest(input *TestDNSAnswerInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/TestDNSAnswer func (c *Route53) TestDNSAnswer(input *TestDNSAnswerInput) (*TestDNSAnswerOutput, error) { req, out := c.TestDNSAnswerRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TestDNSAnswerWithContext is the same as TestDNSAnswer with the addition of +// the ability to pass a context and additional request options. +// +// See TestDNSAnswer 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 *Route53) TestDNSAnswerWithContext(ctx aws.Context, input *TestDNSAnswerInput, opts ...request.Option) (*TestDNSAnswerOutput, error) { + req, out := c.TestDNSAnswerRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateHealthCheck = "UpdateHealthCheck" @@ -4145,8 +4892,23 @@ func (c *Route53) UpdateHealthCheckRequest(input *UpdateHealthCheckInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateHealthCheck func (c *Route53) UpdateHealthCheck(input *UpdateHealthCheckInput) (*UpdateHealthCheckOutput, error) { req, out := c.UpdateHealthCheckRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateHealthCheckWithContext is the same as UpdateHealthCheck with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateHealthCheck 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 *Route53) UpdateHealthCheckWithContext(ctx aws.Context, input *UpdateHealthCheckInput, opts ...request.Option) (*UpdateHealthCheckOutput, error) { + req, out := c.UpdateHealthCheckRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateHostedZoneComment = "UpdateHostedZoneComment" @@ -4214,8 +4976,23 @@ func (c *Route53) UpdateHostedZoneCommentRequest(input *UpdateHostedZoneCommentI // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateHostedZoneComment func (c *Route53) UpdateHostedZoneComment(input *UpdateHostedZoneCommentInput) (*UpdateHostedZoneCommentOutput, error) { req, out := c.UpdateHostedZoneCommentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateHostedZoneCommentWithContext is the same as UpdateHostedZoneComment with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateHostedZoneComment 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 *Route53) UpdateHostedZoneCommentWithContext(ctx aws.Context, input *UpdateHostedZoneCommentInput, opts ...request.Option) (*UpdateHostedZoneCommentOutput, error) { + req, out := c.UpdateHostedZoneCommentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateTrafficPolicyComment = "UpdateTrafficPolicyComment" @@ -4291,8 +5068,23 @@ func (c *Route53) UpdateTrafficPolicyCommentRequest(input *UpdateTrafficPolicyCo // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateTrafficPolicyComment func (c *Route53) UpdateTrafficPolicyComment(input *UpdateTrafficPolicyCommentInput) (*UpdateTrafficPolicyCommentOutput, error) { req, out := c.UpdateTrafficPolicyCommentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateTrafficPolicyCommentWithContext is the same as UpdateTrafficPolicyComment with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateTrafficPolicyComment 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 *Route53) UpdateTrafficPolicyCommentWithContext(ctx aws.Context, input *UpdateTrafficPolicyCommentInput, opts ...request.Option) (*UpdateTrafficPolicyCommentOutput, error) { + req, out := c.UpdateTrafficPolicyCommentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateTrafficPolicyInstance = "UpdateTrafficPolicyInstance" @@ -4396,8 +5188,23 @@ func (c *Route53) UpdateTrafficPolicyInstanceRequest(input *UpdateTrafficPolicyI // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateTrafficPolicyInstance func (c *Route53) UpdateTrafficPolicyInstance(input *UpdateTrafficPolicyInstanceInput) (*UpdateTrafficPolicyInstanceOutput, error) { req, out := c.UpdateTrafficPolicyInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateTrafficPolicyInstanceWithContext is the same as UpdateTrafficPolicyInstance with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateTrafficPolicyInstance 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 *Route53) UpdateTrafficPolicyInstanceWithContext(ctx aws.Context, input *UpdateTrafficPolicyInstanceInput, opts ...request.Option) (*UpdateTrafficPolicyInstanceOutput, error) { + req, out := c.UpdateTrafficPolicyInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // A complex type that identifies the CloudWatch alarm that you want Amazon @@ -4418,7 +5225,8 @@ type AlarmIdentifier struct { // healthy. // // For the current list of CloudWatch regions, see Amazon CloudWatch (http://docs.aws.amazon.com/general/latest/gr/rande.html#cw_region) - // in AWS Regions and Endpoints in the Amazon Web Services General Reference. + // in the AWS Regions and Endpoints chapter of the Amazon Web Services General + // Reference. // // Region is a required field Region *string `min:"1" type:"string" required:"true" enum:"CloudWatchRegion"` @@ -4470,7 +5278,7 @@ func (s *AlarmIdentifier) SetRegion(v string) *AlarmIdentifier { // Alias resource record sets only: Information about the CloudFront distribution, // Elastic Beanstalk environment, ELB load balancer, Amazon S3 bucket, or Amazon -// Route 53 resource record set that you're redirecting queries to. The Elastic +// Route 53 resource record set that you're redirecting queries to. An Elastic // Beanstalk environment must have a regionalized subdomain. // // When creating resource record sets for a private hosted zone, note the following: @@ -4490,70 +5298,62 @@ type AliasTarget struct { // Alias resource record sets only: The value that you specify depends on where // you want to route queries: // - // * A CloudFront distribution: Specify the domain name that CloudFront assigned - // when you created your distribution. + // CloudFront distributionSpecify the domain name that CloudFront assigned when + // you created your distribution. // // Your CloudFront distribution must include an alternate domain name that matches - // the name of the resource record set. For example, if the name of the resource - // record set is acme.example.com, your CloudFront distribution must include - // acme.example.com as one of the alternate domain names. For more information, - // see Using Alternate Domain Names (CNAMEs) (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html) - // in the Amazon CloudFront Developer Guide. + // the name of the resource record set. For example, if the name of the resource + // record set is acme.example.com, your CloudFront distribution must include + // acme.example.com as one of the alternate domain names. For more information, + // see Using Alternate Domain Names (CNAMEs) (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html) + // in the Amazon CloudFront Developer Guide. // - // * Elastic Beanstalk environment: Specify the CNAME attribute for the environment. - // (The environment must have a regionalized domain name.) You can use the - // following methods to get the value of the CNAME attribute: + // Elastic Beanstalk environmentSpecify the CNAME attribute for the environment. + // (The environment must have a regionalized domain name.) You can use the following + // methods to get the value of the CNAME attribute: // // AWS Management Console: For information about how to get the value by using - // the console, see Using Custom Domains with AWS Elastic Beanstalk (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html) - // in the AWS Elastic Beanstalk Developer Guide. + // the console, see Using Custom Domains with AWS Elastic Beanstalk (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html) + // in the AWS Elastic Beanstalk Developer Guide. // // Elastic Beanstalk API: Use the DescribeEnvironments action to get the value - // of the CNAME attribute. For more information, see DescribeEnvironments - // (http://docs.aws.amazon.com/elasticbeanstalk/latest/api/API_DescribeEnvironments.html) - // in the AWS Elastic Beanstalk API Reference. + // of the CNAME attribute. For more information, see DescribeEnvironments (http://docs.aws.amazon.com/elasticbeanstalk/latest/api/API_DescribeEnvironments.html) + // in the AWS Elastic Beanstalk API Reference. // // AWS CLI: Use the describe-environments command to get the value of the CNAME - // attribute. For more information, see describe-environments (http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/describe-environments.html) - // in the AWS Command Line Interface Reference. + // attribute. For more information, see describe-environments (http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/describe-environments.html) + // in the AWS Command Line Interface Reference. // - // * An ELB load balancer: Specify the DNS name that is associated with the - // load balancer. Get the DNS name by using the AWS Management Console, the - // ELB API, or the AWS CLI. Use the same method to get values for HostedZoneId - // and DNSName. If you get one value from the console and the other value - // from the API or the CLI, creating the resource record set will fail. + // ELB load balancerSpecify the DNS name that is associated with the load balancer. + // Get the DNS name by using the AWS Management Console, the ELB API, or the + // AWS CLI. // - // AWS Management Console: Go to the EC2 page, click Load Balancers in the navigation - // pane, choose the load balancer, choose the Description tab, and get the - // value of the DNS name field. (If you're routing traffic to a Classic Load - // Balancer, get the value that begins with dualstack.) Use the same process - // to get the value of the Hosted zone field. See AliasTarget$HostedZoneId. + // AWS Management Console: Go to the EC2 page, choose Load Balancers in the + // navigation pane, choose the load balancer, choose the Description tab, and + // get the value of the DNS name field. (If you're routing traffic to a Classic + // Load Balancer, get the value that begins with dualstack.) // // Elastic Load Balancing API: Use DescribeLoadBalancers to get the value of - // DNSName and CanonicalHostedZoneNameId. (You specify the value of CanonicalHostedZoneNameId - // for AliasTarget$HostedZoneId.) For more information, see the applicable - // guide: + // DNSName. For more information, see the applicable guide: // // Classic Load Balancer: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/API_DescribeLoadBalancers.html) // // Application Load Balancer: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) // // AWS CLI: Use describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elb/describe-load-balancers.html) - // to get the value of DNSName and CanonicalHostedZoneNameId. (You specify - // the value of CanonicalHostedZoneNameId for AliasTarget$HostedZoneId.) - // - // * An Amazon S3 bucket that is configured as a static website: Specify - // the domain name of the Amazon S3 website endpoint in which you created - // the bucket, for example, s3-website-us-east-1.amazonaws.com. For more - // information about valid values, see the table Amazon Simple Storage Service - // (S3) Website Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) - // in the Amazon Web Services General Reference. For more information about - // using S3 buckets for websites, see Getting Started with Amazon Route 53 - // (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) - // in the Amazon Route 53 Developer Guide. + // to get the value of DNSName. // - // * Another Amazon Route 53 resource record set: Specify the value of the - // Name element for a resource record set in the current hosted zone. + // Amazon S3 bucket that is configured as a static websiteSpecify the domain + // name of the Amazon S3 website endpoint in which you created the bucket, for + // example, s3-website-us-east-2.amazonaws.com. For more information about valid + // values, see the table Amazon Simple Storage Service (S3) Website Endpoints + // (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) in the + // Amazon Web Services General Reference. For more information about using S3 + // buckets for websites, see Getting Started with Amazon Route 53 (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) + // in the Amazon Route 53 Developer Guide. + // + // Another Amazon Route 53 resource record setSpecify the value of the Name + // element for a resource record set in the current hosted zone. // // DNSName is a required field DNSName *string `type:"string" required:"true"` @@ -4638,10 +5438,10 @@ type AliasTarget struct { // EvaluateTargetHealth is a required field EvaluateTargetHealth *bool `type:"boolean" required:"true"` - // Alias resource records sets only: The value used depends on where the queries - // are routed: + // Alias resource records sets only: The value used depends on where you want + // to route traffic: // - // A CloudFront distributionSpecify Z2FDTNDATAQYW2. + // CloudFront distributionSpecify Z2FDTNDATAQYW2. // // Alias resource record sets for CloudFront can't be created in a private zone. // @@ -4649,33 +5449,37 @@ type AliasTarget struct { // which you created the environment. The environment must have a regionalized // subdomain. For a list of regions and the corresponding hosted zone IDs, see // AWS Elastic Beanstalk (http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region) - // in the Regions and Endpoints chapter of the Amazon Web Services General Reference. + // in the "AWS Regions and Endpoints" chapter of the Amazon Web Services General + // Reference. // // ELB load balancerSpecify the value of the hosted zone ID for the load balancer. // Use the following methods to get the hosted zone ID: // + // Elastic Load Balancing (http://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region) + // table in the "AWS Regions and Endpoints" chapter of the Amazon Web Services + // General Reference: Use the value in the "Amazon Route 53 Hosted Zone ID" + // column that corresponds with the region that you created your load balancer + // in. + // // AWS Management Console: Go to the Amazon EC2 page, click Load Balancers in // the navigation pane, select the load balancer, and get the value of the Hosted - // zone field on the Description tab. Use the same process to get the value - // of DNS name. (You specify the value of DNS name for AliasTarget$DNSName.) + // zone field on the Description tab. // // Elastic Load Balancing API: Use DescribeLoadBalancers to get the value of - // CanonicalHostedZoneNameId and DNSName. (You specify the value of DNSName - // for AliasTarget$DNSName.) For more information, see the applicable guide: + // CanonicalHostedZoneNameId. For more information, see the applicable guide: // // Classic Load Balancer: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/API_DescribeLoadBalancers.html) // // Application Load Balancer: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) // // AWS CLI: Use describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elb/describe-load-balancers.html) - // to get the value of CanonicalHostedZoneNameID and DNSName. (You specify the - // value of DNSName for AliasTarget$DNSName.) + // to get the value of CanonicalHostedZoneNameID. // // An Amazon S3 bucket configured as a static websiteSpecify the hosted zone // ID for the region that you created the bucket in. For more information about - // valid values, see the table Amazon Simple Storage Service Website Endpoints - // (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) in the - // Amazon Web Services General Reference. + // valid values, see the Amazon Simple Storage Service Website Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) + // table in the "AWS Regions and Endpoints" chapter of the Amazon Web Services + // General Reference. // // Another Amazon Route 53 resource record set in your hosted zoneSpecify the // hosted zone ID of your hosted zone. (An alias resource record set can't reference @@ -5280,7 +6084,7 @@ type CloudWatchAlarmConfiguration struct { // For the metric that the CloudWatch alarm is associated with, a complex type // that contains information about the dimensions for the metric.For information, - // see Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference ( http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html) + // see Amazon CloudWatch Namespaces, Dimensions, and Metrics Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html) // in the Amazon CloudWatch User Guide. Dimensions []*Dimension `locationNameList:"Dimension" type:"list"` @@ -7027,7 +7831,6 @@ func (s *GetChangeOutput) SetChangeInfo(v *ChangeInfo) *GetChangeOutput { return s } -// Empty request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetCheckerIpRangesRequest type GetCheckerIpRangesInput struct { _ struct{} `type:"structure"` @@ -7043,14 +7846,10 @@ func (s GetCheckerIpRangesInput) GoString() string { return s.String() } -// A complex type that contains the CheckerIpRanges element. // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetCheckerIpRangesResponse type GetCheckerIpRangesOutput struct { _ struct{} `type:"structure"` - // A complex type that contains sorted list of IP ranges in CIDR format for - // Amazon Route 53 health checkers. - // // CheckerIpRanges is a required field CheckerIpRanges []*string `type:"list" required:"true"` } @@ -7388,63 +8187,13 @@ func (s *GetHealthCheckOutput) SetHealthCheck(v *HealthCheck) *GetHealthCheckOut type GetHealthCheckStatusInput struct { _ struct{} `type:"structure"` - // If you want Amazon Route 53 to return this resource record set in response - // to a DNS query only when a health check is passing, include the HealthCheckId - // element and specify the ID of the applicable health check. - // - // Amazon Route 53 determines whether a resource record set is healthy by periodically - // sending a request to the endpoint that is specified in the health check. - // If that endpoint returns an HTTP status code of 2xx or 3xx, the endpoint - // is healthy. If the endpoint returns an HTTP status code of 400 or greater, - // or if the endpoint doesn't respond for a certain amount of time, Amazon Route - // 53 considers the endpoint unhealthy and also considers the resource record - // set unhealthy. - // - // The HealthCheckId element is only useful when Amazon Route 53 is choosing - // between two or more resource record sets to respond to a DNS query, and you - // want Amazon Route 53 to base the choice in part on the status of a health - // check. Configuring health checks only makes sense in the following configurations: - // - // * You're checking the health of the resource record sets in a weighted, - // latency, geolocation, or failover resource record set, and you specify - // health check IDs for all of the resource record sets. If the health check - // for one resource record set specifies an endpoint that is not healthy, - // Amazon Route 53 stops responding to queries using the value for that resource - // record set. - // - // * You set EvaluateTargetHealth to true for the resource record sets in - // an alias, weighted alias, latency alias, geolocation alias, or failover - // alias resource record set, and you specify health check IDs for all of - // the resource record sets that are referenced by the alias resource record - // sets. For more information about this configuration, see EvaluateTargetHealth. - // - // Amazon Route 53 doesn't check the health of the endpoint specified in the - // resource record set, for example, the endpoint specified by the IP address - // in the Value element. When you add a HealthCheckId element to a resource - // record set, Amazon Route 53 checks the health of the endpoint that you - // specified in the health check. - // - // For geolocation resource record sets, if an endpoint is unhealthy, Amazon - // Route 53 looks for a resource record set for the larger, associated geographic - // region. For example, suppose you have resource record sets for a state in - // the United States, for the United States, for North America, and for all - // locations. If the endpoint for the state resource record set is unhealthy, - // Amazon Route 53 checks the resource record sets for the United States, for - // North America, and for all locations (a resource record set for which the - // value of CountryCode is *), in that order, until it finds a resource record - // set for which the endpoint is healthy. - // - // If your health checks specify the endpoint only by domain name, we recommend - // that you create a separate health check for each endpoint. For example, create - // a health check for each HTTP server that is serving content for www.example.com. - // For the value of FullyQualifiedDomainName, specify the domain name of the - // server (such as us-east-1-www.example.com), not the name of the resource - // record sets (example.com). + // The ID for the health check for which you want the current status. When you + // created the health check, CreateHealthCheck returned the ID in the response, + // in the HealthCheckId element. // - // In this configuration, if you create a health check for which the value of - // FullyQualifiedDomainName matches the name of the resource record sets and - // then associate the health check with those resource record sets, health check - // results will be unpredictable. + // If you want to check the status of a calculated health check, you must use + // the Amazon Route 53 console or the CloudWatch console. You can't use GetHealthCheckStatus + // to get the status of a calculated health check. // // HealthCheckId is a required field HealthCheckId *string `location:"uri" locationName:"HealthCheckId" type:"string" required:"true"` @@ -7771,8 +8520,8 @@ func (s *GetTrafficPolicyInput) SetVersion(v int64) *GetTrafficPolicyInput { return s } -// To retrieve a count of all your traffic policy instances, send a GET request -// to the /2013-04-01/trafficpolicyinstancecount resource. +// Request to get the number of traffic policy instances that are associated +// with the current AWS account. // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyInstanceCountRequest type GetTrafficPolicyInstanceCountInput struct { _ struct{} `type:"structure"` @@ -8036,6 +8785,9 @@ type HealthCheckConfig struct { // to healthy or vice versa. For more information, see How Amazon Route 53 Determines // Whether an Endpoint Is Healthy (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html) // in the Amazon Route 53 Developer Guide. + // + // If you don't specify a value for FailureThreshold, the default value is three + // health checks. FailureThreshold *int64 `min:"1" type:"integer"` // Amazon Route 53 behavior depends on whether you specify a value for IPAddress. @@ -8083,7 +8835,7 @@ type HealthCheckConfig struct { // we recommend that you create a separate health check for each endpoint. For // example, create a health check for each HTTP server that is serving content // for www.example.com. For the value of FullyQualifiedDomainName, specify the - // domain name of the server (such as us-east-1-www.example.com), not the name + // domain name of the server (such as us-east-2-www.example.com), not the name // of the resource record sets (www.example.com). // // In this configuration, if you create a health check for which the value of @@ -8119,6 +8871,16 @@ type HealthCheckConfig struct { // Using an IP address returned by DNS, Amazon Route 53 then checks the health // of the endpoint. // + // Use one of the following formats for the value of IPAddress: + // + // * IPv4 address: four values between 0 and 255, separated by periods (.), + // for example, 192.0.2.44. + // + // * IPv6 address: eight groups of four hexadecimal values, separated by + // colons (:), for example, 2001:0db8:85a3:0000:0000:abcd:0001:2345. You + // can also shorten IPv6 addresses as described in RFC 5952, for example, + // 2001:db8:85a3::abcd:1:2345. + // // If the endpoint is an EC2 instance, we recommend that you create an Elastic // IP address, associate it with your EC2 instance, and specify the Elastic // IP address for IPAddress. This ensures that the IP address of your instance @@ -8171,13 +8933,24 @@ type HealthCheckConfig struct { // A complex type that contains one Region element for each region from which // you want Amazon Route 53 health checkers to check the specified endpoint. + // + // If you don't specify any regions, Amazon Route 53 health checkers automatically + // performs checks from all of the regions that are listed under Valid Values. + // + // If you update a health check to remove a region that has been performing + // health checks, Amazon Route 53 will briefly continue to perform checks from + // that region to ensure that some health checkers are always checking the endpoint + // (for example, if you replace three regions with four different regions). Regions []*string `locationNameList:"Region" min:"1" type:"list"` // The number of seconds between the time that Amazon Route 53 gets a response - // from your endpoint and the time that it sends the next health-check request. + // from your endpoint and the time that it sends the next health check request. // Each Amazon Route 53 health checker makes requests at this interval. // // You can't change the value of RequestInterval after you create a health check. + // + // If you don't specify a value for RequestInterval, the default value is 30 + // seconds. RequestInterval *int64 `min:"10" type:"integer"` // The path, if any, that you want Amazon Route 53 to request when performing @@ -10250,8 +11023,8 @@ func (s *ListTrafficPolicyInstancesByPolicyOutput) SetTrafficPolicyInstances(v [ return s } -// A complex type that contains the information about the request to list your -// traffic policy instances. +// A request to get information about the traffic policy instances that you +// created by using the current AWS account. // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesRequest type ListTrafficPolicyInstancesInput struct { _ struct{} `type:"structure"` @@ -10690,7 +11463,7 @@ func (s *ListVPCAssociationAuthorizationsOutput) SetVPCs(v []*VPC) *ListVPCAssoc // Information specific to the resource record. // -// If you are creating an alias resource record set, omit ResourceRecord. +// If you're creating an alias resource record set, omit ResourceRecord. // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ResourceRecord type ResourceRecord struct { _ struct{} `type:"structure"` @@ -10704,7 +11477,7 @@ type ResourceRecord struct { // You can specify more than one value for all record types except CNAME and // SOA. // - // If you are creating an alias resource record set, omit Value. + // If you're creating an alias resource record set, omit Value. // // Value is a required field Value *string `type:"string" required:"true"` @@ -10746,7 +11519,7 @@ type ResourceRecordSet struct { // Alias resource record sets only: Information about the CloudFront distribution, // AWS Elastic Beanstalk environment, ELB load balancer, Amazon S3 bucket, or - // Amazon Route 53 resource record set to which you are redirecting queries. + // Amazon Route 53 resource record set to which you're redirecting queries. // The AWS Elastic Beanstalk environment must have a regionalized subdomain. // // If you're creating resource records sets for a private hosted zone, note @@ -10859,26 +11632,26 @@ type ResourceRecordSet struct { // * By determining the current state of a CloudWatch alarm (CloudWatch metric // health checks) // - // For information about how Amazon Route 53 determines whether a health check - // is healthy, see CreateHealthCheck. + // For more information, see How Amazon Route 53 Determines Whether an Endpoint + // Is Healthy (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html). // // The HealthCheckId element is only useful when Amazon Route 53 is choosing // between two or more resource record sets to respond to a DNS query, and you // want Amazon Route 53 to base the choice in part on the status of a health // check. Configuring health checks only makes sense in the following configurations: // - // * You're checking the health of the resource record sets in a weighted, - // latency, geolocation, or failover resource record set, and you specify - // health check IDs for all of the resource record sets. If the health check - // for one resource record set specifies an endpoint that is not healthy, - // Amazon Route 53 stops responding to queries using the value for that resource - // record set. + // * You're checking the health of the resource record sets in a group of + // weighted, latency, geolocation, or failover resource record sets, and + // you specify health check IDs for all of the resource record sets. If the + // health check for one resource record set specifies an endpoint that is + // not healthy, Amazon Route 53 stops responding to queries using the value + // for that resource record set. // // * You set EvaluateTargetHealth to true for the resource record sets in - // an alias, weighted alias, latency alias, geolocation alias, or failover - // alias resource record set, and you specify health check IDs for all of - // the resource record sets that are referenced by the alias resource record - // sets. + // a group of alias, weighted alias, latency alias, geolocation alias, or + // failover alias resource record sets, and you specify health check IDs + // for all of the resource record sets that are referenced by the alias resource + // record sets. // // Amazon Route 53 doesn't check the health of the endpoint specified in the // resource record set, for example, the endpoint specified by the IP address @@ -10900,7 +11673,7 @@ type ResourceRecordSet struct { // that you create a separate health check for each endpoint. For example, create // a health check for each HTTP server that is serving content for www.example.com. // For the value of FullyQualifiedDomainName, specify the domain name of the - // server (such as us-east-1-www.example.com), not the name of the resource + // server (such as us-east-2-www.example.com), not the name of the resource // record sets (example.com). // // n this configuration, if you create a health check for which the value of @@ -10974,10 +11747,9 @@ type ResourceRecordSet struct { // * You can only create one latency resource record set for each Amazon // EC2 Region. // - // * You are not required to create latency resource record sets for all - // Amazon EC2 Regions. Amazon Route 53 will choose the region with the best - // latency from among the regions for which you create latency resource record - // sets. + // * You aren't required to create latency resource record sets for all Amazon + // EC2 Regions. Amazon Route 53 will choose the region with the best latency + // from among the regions for which you create latency resource record sets. // // * You can't create non-latency resource record sets that have the same // values for the Name and Type elements as latency resource record sets. @@ -10985,7 +11757,7 @@ type ResourceRecordSet struct { // Information about the resource records to act upon. // - // If you are creating an alias resource record set, omit ResourceRecords. + // If you're creating an alias resource record set, omit ResourceRecords. ResourceRecords []*ResourceRecord `locationNameList:"ResourceRecord" min:"1" type:"list"` // Weighted, Latency, Geo, and Failover resource record sets only: An identifier @@ -11926,6 +12698,9 @@ type UpdateHealthCheckInput struct { // to healthy or vice versa. For more information, see How Amazon Route 53 Determines // Whether an Endpoint Is Healthy (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html) // in the Amazon Route 53 Developer Guide. + // + // If you don't specify a value for FailureThreshold, the default value is three + // health checks. FailureThreshold *int64 `min:"1" type:"integer"` // Amazon Route 53 behavior depends on whether you specify a value for IPAddress. @@ -11978,7 +12753,7 @@ type UpdateHealthCheckInput struct { // we recommend that you create a separate health check for each endpoint. For // example, create a health check for each HTTP server that is serving content // for www.example.com. For the value of FullyQualifiedDomainName, specify the - // domain name of the server (such as us-east-1-www.example.com), not the name + // domain name of the server (such as us-east-2-www.example.com), not the name // of the resource record sets (www.example.com). // // In this configuration, if the value of FullyQualifiedDomainName matches the @@ -12038,6 +12813,16 @@ type UpdateHealthCheckInput struct { // Using an IP address that is returned by DNS, Amazon Route 53 then checks // the health of the endpoint. // + // Use one of the following formats for the value of IPAddress: + // + // * IPv4 address: four values between 0 and 255, separated by periods (.), + // for example, 192.0.2.44. + // + // * IPv6 address: eight groups of four hexadecimal values, separated by + // colons (:), for example, 2001:0db8:85a3:0000:0000:abcd:0001:2345. You + // can also shorten IPv6 addresses as described in RFC 5952, for example, + // 2001:db8:85a3::abcd:1:2345. + // // If the endpoint is an EC2 instance, we recommend that you create an Elastic // IP address, associate it with your EC2 instance, and specify the Elastic // IP address for IPAddress. This ensures that the IP address of your instance @@ -12690,8 +13475,6 @@ const ( ComparisonOperatorLessThanOrEqualToThreshold = "LessThanOrEqualToThreshold" ) -// An Amazon EC2 Region that you want Amazon Route 53 to use to perform health -// checks. const ( // HealthCheckRegionUsEast1 is a HealthCheckRegion enum value HealthCheckRegionUsEast1 = "us-east-1" diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go index 9c3b57ded2..6dcbc3f03c 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package route53 @@ -68,10 +68,9 @@ const ( // ErrCodeHealthCheckAlreadyExists for service response error code // "HealthCheckAlreadyExists". // - // The health check you're attempting to create already exists. - // - // Amazon Route 53 returns this error when a health check has already been created - // with the specified value for CallerReference. + // The health check you're attempting to create already exists. Amazon Route + // 53 returns this error when a health check has already been created with the + // specified value for CallerReference. ErrCodeHealthCheckAlreadyExists = "HealthCheckAlreadyExists" // ErrCodeHealthCheckInUse for service response error code @@ -92,8 +91,8 @@ const ( // ErrCodeHostedZoneAlreadyExists for service response error code // "HostedZoneAlreadyExists". // - // The hosted zone you are trying to create already exists. Amazon Route 53 - // returns this error when a hosted zone has already been created with the specified + // The hosted zone you're trying to create already exists. Amazon Route 53 returns + // this error when a hosted zone has already been created with the specified // CallerReference. ErrCodeHostedZoneAlreadyExists = "HostedZoneAlreadyExists" @@ -112,14 +111,14 @@ const ( // ErrCodeIncompatibleVersion for service response error code // "IncompatibleVersion". // - // The resource you are trying to access is unsupported on this Amazon Route - // 53 endpoint. Please consider using a newer endpoint or a tool that does so. + // The resource you're trying to access is unsupported on this Amazon Route + // 53 endpoint. ErrCodeIncompatibleVersion = "IncompatibleVersion" // ErrCodeInvalidArgument for service response error code // "InvalidArgument". // - // Parameter name and problem. + // Parameter name is invalid. ErrCodeInvalidArgument = "InvalidArgument" // ErrCodeInvalidChangeBatch for service response error code @@ -242,6 +241,8 @@ const ( // ErrCodeThrottlingException for service response error code // "ThrottlingException". + // + // The limit on the number of requests per second was exceeded. ErrCodeThrottlingException = "ThrottlingException" // ErrCodeTooManyHealthChecks for service response error code diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/service.go index 287e7db7e4..9b2e767ce8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package route53 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/waiters.go index 85a70ab5a4..71d99e6eaf 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/route53/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/route53/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package route53 import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilResourceRecordSetsChanged uses the Route 53 API operation @@ -11,24 +14,43 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *Route53) WaitUntilResourceRecordSetsChanged(input *GetChangeInput) error { - waiterCfg := waiter.Config{ - Operation: "GetChange", - Delay: 30, + return c.WaitUntilResourceRecordSetsChangedWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilResourceRecordSetsChangedWithContext is an extended version of WaitUntilResourceRecordSetsChanged. +// 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 *Route53) WaitUntilResourceRecordSetsChangedWithContext(ctx aws.Context, input *GetChangeInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilResourceRecordSetsChanged", MaxAttempts: 60, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(30 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "path", - Argument: "ChangeInfo.Status", + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "ChangeInfo.Status", Expected: "INSYNC", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetChangeInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetChangeRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/api.go index ea141d5334..0ea07cfeb7 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package route53domains provides a client for Amazon Route 53 Domains. package route53domains @@ -7,6 +7,7 @@ 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" ) @@ -79,8 +80,23 @@ func (c *Route53Domains) CheckDomainAvailabilityRequest(input *CheckDomainAvaila // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/CheckDomainAvailability func (c *Route53Domains) CheckDomainAvailability(input *CheckDomainAvailabilityInput) (*CheckDomainAvailabilityOutput, error) { req, out := c.CheckDomainAvailabilityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CheckDomainAvailabilityWithContext is the same as CheckDomainAvailability with the addition of +// the ability to pass a context and additional request options. +// +// See CheckDomainAvailability 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 *Route53Domains) CheckDomainAvailabilityWithContext(ctx aws.Context, input *CheckDomainAvailabilityInput, opts ...request.Option) (*CheckDomainAvailabilityOutput, error) { + req, out := c.CheckDomainAvailabilityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTagsForDomain = "DeleteTagsForDomain" @@ -156,8 +172,23 @@ func (c *Route53Domains) DeleteTagsForDomainRequest(input *DeleteTagsForDomainIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/DeleteTagsForDomain func (c *Route53Domains) DeleteTagsForDomain(input *DeleteTagsForDomainInput) (*DeleteTagsForDomainOutput, error) { req, out := c.DeleteTagsForDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteTagsForDomainWithContext is the same as DeleteTagsForDomain with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTagsForDomain 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 *Route53Domains) DeleteTagsForDomainWithContext(ctx aws.Context, input *DeleteTagsForDomainInput, opts ...request.Option) (*DeleteTagsForDomainOutput, error) { + req, out := c.DeleteTagsForDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableDomainAutoRenew = "DisableDomainAutoRenew" @@ -227,8 +258,23 @@ func (c *Route53Domains) DisableDomainAutoRenewRequest(input *DisableDomainAutoR // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/DisableDomainAutoRenew func (c *Route53Domains) DisableDomainAutoRenew(input *DisableDomainAutoRenewInput) (*DisableDomainAutoRenewOutput, error) { req, out := c.DisableDomainAutoRenewRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableDomainAutoRenewWithContext is the same as DisableDomainAutoRenew with the addition of +// the ability to pass a context and additional request options. +// +// See DisableDomainAutoRenew 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 *Route53Domains) DisableDomainAutoRenewWithContext(ctx aws.Context, input *DisableDomainAutoRenewInput, opts ...request.Option) (*DisableDomainAutoRenewOutput, error) { + req, out := c.DisableDomainAutoRenewRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDisableDomainTransferLock = "DisableDomainTransferLock" @@ -313,8 +359,23 @@ func (c *Route53Domains) DisableDomainTransferLockRequest(input *DisableDomainTr // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/DisableDomainTransferLock func (c *Route53Domains) DisableDomainTransferLock(input *DisableDomainTransferLockInput) (*DisableDomainTransferLockOutput, error) { req, out := c.DisableDomainTransferLockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DisableDomainTransferLockWithContext is the same as DisableDomainTransferLock with the addition of +// the ability to pass a context and additional request options. +// +// See DisableDomainTransferLock 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 *Route53Domains) DisableDomainTransferLockWithContext(ctx aws.Context, input *DisableDomainTransferLockInput, opts ...request.Option) (*DisableDomainTransferLockOutput, error) { + req, out := c.DisableDomainTransferLockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableDomainAutoRenew = "EnableDomainAutoRenew" @@ -395,8 +456,23 @@ func (c *Route53Domains) EnableDomainAutoRenewRequest(input *EnableDomainAutoRen // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/EnableDomainAutoRenew func (c *Route53Domains) EnableDomainAutoRenew(input *EnableDomainAutoRenewInput) (*EnableDomainAutoRenewOutput, error) { req, out := c.EnableDomainAutoRenewRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableDomainAutoRenewWithContext is the same as EnableDomainAutoRenew with the addition of +// the ability to pass a context and additional request options. +// +// See EnableDomainAutoRenew 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 *Route53Domains) EnableDomainAutoRenewWithContext(ctx aws.Context, input *EnableDomainAutoRenewInput, opts ...request.Option) (*EnableDomainAutoRenewOutput, error) { + req, out := c.EnableDomainAutoRenewRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opEnableDomainTransferLock = "EnableDomainTransferLock" @@ -479,8 +555,23 @@ func (c *Route53Domains) EnableDomainTransferLockRequest(input *EnableDomainTran // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/EnableDomainTransferLock func (c *Route53Domains) EnableDomainTransferLock(input *EnableDomainTransferLockInput) (*EnableDomainTransferLockOutput, error) { req, out := c.EnableDomainTransferLockRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// EnableDomainTransferLockWithContext is the same as EnableDomainTransferLock with the addition of +// the ability to pass a context and additional request options. +// +// See EnableDomainTransferLock 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 *Route53Domains) EnableDomainTransferLockWithContext(ctx aws.Context, input *EnableDomainTransferLockInput, opts ...request.Option) (*EnableDomainTransferLockOutput, error) { + req, out := c.EnableDomainTransferLockRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetContactReachabilityStatus = "GetContactReachabilityStatus" @@ -558,8 +649,23 @@ func (c *Route53Domains) GetContactReachabilityStatusRequest(input *GetContactRe // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/GetContactReachabilityStatus func (c *Route53Domains) GetContactReachabilityStatus(input *GetContactReachabilityStatusInput) (*GetContactReachabilityStatusOutput, error) { req, out := c.GetContactReachabilityStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetContactReachabilityStatusWithContext is the same as GetContactReachabilityStatus with the addition of +// the ability to pass a context and additional request options. +// +// See GetContactReachabilityStatus 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 *Route53Domains) GetContactReachabilityStatusWithContext(ctx aws.Context, input *GetContactReachabilityStatusInput, opts ...request.Option) (*GetContactReachabilityStatusOutput, error) { + req, out := c.GetContactReachabilityStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDomainDetail = "GetDomainDetail" @@ -629,8 +735,23 @@ func (c *Route53Domains) GetDomainDetailRequest(input *GetDomainDetailInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/GetDomainDetail func (c *Route53Domains) GetDomainDetail(input *GetDomainDetailInput) (*GetDomainDetailOutput, error) { req, out := c.GetDomainDetailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDomainDetailWithContext is the same as GetDomainDetail with the addition of +// the ability to pass a context and additional request options. +// +// See GetDomainDetail 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 *Route53Domains) GetDomainDetailWithContext(ctx aws.Context, input *GetDomainDetailInput, opts ...request.Option) (*GetDomainDetailOutput, error) { + req, out := c.GetDomainDetailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDomainSuggestions = "GetDomainSuggestions" @@ -711,8 +832,23 @@ func (c *Route53Domains) GetDomainSuggestionsRequest(input *GetDomainSuggestions // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/GetDomainSuggestions func (c *Route53Domains) GetDomainSuggestions(input *GetDomainSuggestionsInput) (*GetDomainSuggestionsOutput, error) { req, out := c.GetDomainSuggestionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDomainSuggestionsWithContext is the same as GetDomainSuggestions with the addition of +// the ability to pass a context and additional request options. +// +// See GetDomainSuggestions 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 *Route53Domains) GetDomainSuggestionsWithContext(ctx aws.Context, input *GetDomainSuggestionsInput, opts ...request.Option) (*GetDomainSuggestionsOutput, error) { + req, out := c.GetDomainSuggestionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetOperationDetail = "GetOperationDetail" @@ -778,8 +914,23 @@ func (c *Route53Domains) GetOperationDetailRequest(input *GetOperationDetailInpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/GetOperationDetail func (c *Route53Domains) GetOperationDetail(input *GetOperationDetailInput) (*GetOperationDetailOutput, error) { req, out := c.GetOperationDetailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetOperationDetailWithContext is the same as GetOperationDetail with the addition of +// the ability to pass a context and additional request options. +// +// See GetOperationDetail 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 *Route53Domains) GetOperationDetailWithContext(ctx aws.Context, input *GetOperationDetailInput, opts ...request.Option) (*GetOperationDetailOutput, error) { + req, out := c.GetOperationDetailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListDomains = "ListDomains" @@ -852,8 +1003,23 @@ func (c *Route53Domains) ListDomainsRequest(input *ListDomainsInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/ListDomains func (c *Route53Domains) ListDomains(input *ListDomainsInput) (*ListDomainsOutput, error) { req, out := c.ListDomainsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDomainsWithContext is the same as ListDomains with the addition of +// the ability to pass a context and additional request options. +// +// See ListDomains 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 *Route53Domains) ListDomainsWithContext(ctx aws.Context, input *ListDomainsInput, opts ...request.Option) (*ListDomainsOutput, error) { + req, out := c.ListDomainsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListDomainsPages iterates over the pages of a ListDomains operation, @@ -873,12 +1039,37 @@ func (c *Route53Domains) ListDomains(input *ListDomainsInput) (*ListDomainsOutpu // return pageNum <= 3 // }) // -func (c *Route53Domains) ListDomainsPages(input *ListDomainsInput, fn func(p *ListDomainsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListDomainsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListDomainsOutput), lastPage) - }) +func (c *Route53Domains) ListDomainsPages(input *ListDomainsInput, fn func(*ListDomainsOutput, bool) bool) error { + return c.ListDomainsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDomainsPagesWithContext same as ListDomainsPages 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 *Route53Domains) ListDomainsPagesWithContext(ctx aws.Context, input *ListDomainsInput, fn func(*ListDomainsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDomainsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDomainsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDomainsOutput), !p.HasNextPage()) + } + return p.Err() } const opListOperations = "ListOperations" @@ -950,8 +1141,23 @@ func (c *Route53Domains) ListOperationsRequest(input *ListOperationsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/ListOperations func (c *Route53Domains) ListOperations(input *ListOperationsInput) (*ListOperationsOutput, error) { req, out := c.ListOperationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListOperationsWithContext is the same as ListOperations with the addition of +// the ability to pass a context and additional request options. +// +// See ListOperations 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 *Route53Domains) ListOperationsWithContext(ctx aws.Context, input *ListOperationsInput, opts ...request.Option) (*ListOperationsOutput, error) { + req, out := c.ListOperationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListOperationsPages iterates over the pages of a ListOperations operation, @@ -971,12 +1177,37 @@ func (c *Route53Domains) ListOperations(input *ListOperationsInput) (*ListOperat // return pageNum <= 3 // }) // -func (c *Route53Domains) ListOperationsPages(input *ListOperationsInput, fn func(p *ListOperationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListOperationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListOperationsOutput), lastPage) - }) +func (c *Route53Domains) ListOperationsPages(input *ListOperationsInput, fn func(*ListOperationsOutput, bool) bool) error { + return c.ListOperationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListOperationsPagesWithContext same as ListOperationsPages 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 *Route53Domains) ListOperationsPagesWithContext(ctx aws.Context, input *ListOperationsInput, fn func(*ListOperationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListOperationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListOperationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListOperationsOutput), !p.HasNextPage()) + } + return p.Err() } const opListTagsForDomain = "ListTagsForDomain" @@ -1053,8 +1284,23 @@ func (c *Route53Domains) ListTagsForDomainRequest(input *ListTagsForDomainInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/ListTagsForDomain func (c *Route53Domains) ListTagsForDomain(input *ListTagsForDomainInput) (*ListTagsForDomainOutput, error) { req, out := c.ListTagsForDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForDomainWithContext is the same as ListTagsForDomain with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForDomain 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 *Route53Domains) ListTagsForDomainWithContext(ctx aws.Context, input *ListTagsForDomainInput, opts ...request.Option) (*ListTagsForDomainOutput, error) { + req, out := c.ListTagsForDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterDomain = "RegisterDomain" @@ -1157,8 +1403,23 @@ func (c *Route53Domains) RegisterDomainRequest(input *RegisterDomainInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/RegisterDomain func (c *Route53Domains) RegisterDomain(input *RegisterDomainInput) (*RegisterDomainOutput, error) { req, out := c.RegisterDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterDomainWithContext is the same as RegisterDomain with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterDomain 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 *Route53Domains) RegisterDomainWithContext(ctx aws.Context, input *RegisterDomainInput, opts ...request.Option) (*RegisterDomainOutput, error) { + req, out := c.RegisterDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRenewDomain = "RenewDomain" @@ -1244,8 +1505,23 @@ func (c *Route53Domains) RenewDomainRequest(input *RenewDomainInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/RenewDomain func (c *Route53Domains) RenewDomain(input *RenewDomainInput) (*RenewDomainOutput, error) { req, out := c.RenewDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RenewDomainWithContext is the same as RenewDomain with the addition of +// the ability to pass a context and additional request options. +// +// See RenewDomain 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 *Route53Domains) RenewDomainWithContext(ctx aws.Context, input *RenewDomainInput, opts ...request.Option) (*RenewDomainOutput, error) { + req, out := c.RenewDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opResendContactReachabilityEmail = "ResendContactReachabilityEmail" @@ -1320,8 +1596,23 @@ func (c *Route53Domains) ResendContactReachabilityEmailRequest(input *ResendCont // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/ResendContactReachabilityEmail func (c *Route53Domains) ResendContactReachabilityEmail(input *ResendContactReachabilityEmailInput) (*ResendContactReachabilityEmailOutput, error) { req, out := c.ResendContactReachabilityEmailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ResendContactReachabilityEmailWithContext is the same as ResendContactReachabilityEmail with the addition of +// the ability to pass a context and additional request options. +// +// See ResendContactReachabilityEmail 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 *Route53Domains) ResendContactReachabilityEmailWithContext(ctx aws.Context, input *ResendContactReachabilityEmailInput, opts ...request.Option) (*ResendContactReachabilityEmailOutput, error) { + req, out := c.ResendContactReachabilityEmailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRetrieveDomainAuthCode = "RetrieveDomainAuthCode" @@ -1391,8 +1682,23 @@ func (c *Route53Domains) RetrieveDomainAuthCodeRequest(input *RetrieveDomainAuth // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/RetrieveDomainAuthCode func (c *Route53Domains) RetrieveDomainAuthCode(input *RetrieveDomainAuthCodeInput) (*RetrieveDomainAuthCodeOutput, error) { req, out := c.RetrieveDomainAuthCodeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RetrieveDomainAuthCodeWithContext is the same as RetrieveDomainAuthCode with the addition of +// the ability to pass a context and additional request options. +// +// See RetrieveDomainAuthCode 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 *Route53Domains) RetrieveDomainAuthCodeWithContext(ctx aws.Context, input *RetrieveDomainAuthCodeInput, opts ...request.Option) (*RetrieveDomainAuthCodeOutput, error) { + req, out := c.RetrieveDomainAuthCodeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opTransferDomain = "TransferDomain" @@ -1497,8 +1803,23 @@ func (c *Route53Domains) TransferDomainRequest(input *TransferDomainInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/TransferDomain func (c *Route53Domains) TransferDomain(input *TransferDomainInput) (*TransferDomainOutput, error) { req, out := c.TransferDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// TransferDomainWithContext is the same as TransferDomain with the addition of +// the ability to pass a context and additional request options. +// +// See TransferDomain 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 *Route53Domains) TransferDomainWithContext(ctx aws.Context, input *TransferDomainInput, opts ...request.Option) (*TransferDomainOutput, error) { + req, out := c.TransferDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDomainContact = "UpdateDomainContact" @@ -1584,8 +1905,23 @@ func (c *Route53Domains) UpdateDomainContactRequest(input *UpdateDomainContactIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/UpdateDomainContact func (c *Route53Domains) UpdateDomainContact(input *UpdateDomainContactInput) (*UpdateDomainContactOutput, error) { req, out := c.UpdateDomainContactRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDomainContactWithContext is the same as UpdateDomainContact with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDomainContact 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 *Route53Domains) UpdateDomainContactWithContext(ctx aws.Context, input *UpdateDomainContactInput, opts ...request.Option) (*UpdateDomainContactOutput, error) { + req, out := c.UpdateDomainContactRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDomainContactPrivacy = "UpdateDomainContactPrivacy" @@ -1674,8 +2010,23 @@ func (c *Route53Domains) UpdateDomainContactPrivacyRequest(input *UpdateDomainCo // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/UpdateDomainContactPrivacy func (c *Route53Domains) UpdateDomainContactPrivacy(input *UpdateDomainContactPrivacyInput) (*UpdateDomainContactPrivacyOutput, error) { req, out := c.UpdateDomainContactPrivacyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDomainContactPrivacyWithContext is the same as UpdateDomainContactPrivacy with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDomainContactPrivacy 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 *Route53Domains) UpdateDomainContactPrivacyWithContext(ctx aws.Context, input *UpdateDomainContactPrivacyInput, opts ...request.Option) (*UpdateDomainContactPrivacyOutput, error) { + req, out := c.UpdateDomainContactPrivacyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDomainNameservers = "UpdateDomainNameservers" @@ -1761,8 +2112,23 @@ func (c *Route53Domains) UpdateDomainNameserversRequest(input *UpdateDomainNames // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/UpdateDomainNameservers func (c *Route53Domains) UpdateDomainNameservers(input *UpdateDomainNameserversInput) (*UpdateDomainNameserversOutput, error) { req, out := c.UpdateDomainNameserversRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDomainNameserversWithContext is the same as UpdateDomainNameservers with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDomainNameservers 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 *Route53Domains) UpdateDomainNameserversWithContext(ctx aws.Context, input *UpdateDomainNameserversInput, opts ...request.Option) (*UpdateDomainNameserversOutput, error) { + req, out := c.UpdateDomainNameserversRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateTagsForDomain = "UpdateTagsForDomain" @@ -1838,8 +2204,23 @@ func (c *Route53Domains) UpdateTagsForDomainRequest(input *UpdateTagsForDomainIn // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/UpdateTagsForDomain func (c *Route53Domains) UpdateTagsForDomain(input *UpdateTagsForDomainInput) (*UpdateTagsForDomainOutput, error) { req, out := c.UpdateTagsForDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateTagsForDomainWithContext is the same as UpdateTagsForDomain with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateTagsForDomain 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 *Route53Domains) UpdateTagsForDomainWithContext(ctx aws.Context, input *UpdateTagsForDomainInput, opts ...request.Option) (*UpdateTagsForDomainOutput, error) { + req, out := c.UpdateTagsForDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opViewBilling = "ViewBilling" @@ -1906,8 +2287,23 @@ func (c *Route53Domains) ViewBillingRequest(input *ViewBillingInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/ViewBilling func (c *Route53Domains) ViewBilling(input *ViewBillingInput) (*ViewBillingOutput, error) { req, out := c.ViewBillingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ViewBillingWithContext is the same as ViewBilling with the addition of +// the ability to pass a context and additional request options. +// +// See ViewBilling 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 *Route53Domains) ViewBillingWithContext(ctx aws.Context, input *ViewBillingInput, opts ...request.Option) (*ViewBillingOutput, error) { + req, out := c.ViewBillingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/route53domains-2014-05-15/BillingRecord diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/errors.go index f72c2fe59b..9e91a8521a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package route53domains diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/service.go index 21e26261a1..15b849a51d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/route53domains/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package route53domains diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/api.go index 9b205f3f0c..3f0fc2fdc0 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package s3 provides a client for Amazon Simple Storage Service. package s3 @@ -8,6 +8,7 @@ import ( "io" "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" @@ -79,8 +80,23 @@ func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUpload func (c *S3) AbortMultipartUpload(input *AbortMultipartUploadInput) (*AbortMultipartUploadOutput, error) { req, out := c.AbortMultipartUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AbortMultipartUploadWithContext is the same as AbortMultipartUpload with the addition of +// the ability to pass a context and additional request options. +// +// See AbortMultipartUpload 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 *S3) AbortMultipartUploadWithContext(ctx aws.Context, input *AbortMultipartUploadInput, opts ...request.Option) (*AbortMultipartUploadOutput, error) { + req, out := c.AbortMultipartUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCompleteMultipartUpload = "CompleteMultipartUpload" @@ -139,8 +155,23 @@ func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUpload func (c *S3) CompleteMultipartUpload(input *CompleteMultipartUploadInput) (*CompleteMultipartUploadOutput, error) { req, out := c.CompleteMultipartUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CompleteMultipartUploadWithContext is the same as CompleteMultipartUpload with the addition of +// the ability to pass a context and additional request options. +// +// See CompleteMultipartUpload 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 *S3) CompleteMultipartUploadWithContext(ctx aws.Context, input *CompleteMultipartUploadInput, opts ...request.Option) (*CompleteMultipartUploadOutput, error) { + req, out := c.CompleteMultipartUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCopyObject = "CopyObject" @@ -205,8 +236,23 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObject func (c *S3) CopyObject(input *CopyObjectInput) (*CopyObjectOutput, error) { req, out := c.CopyObjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CopyObjectWithContext is the same as CopyObject with the addition of +// the ability to pass a context and additional request options. +// +// See CopyObject 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 *S3) CopyObjectWithContext(ctx aws.Context, input *CopyObjectInput, opts ...request.Option) (*CopyObjectOutput, error) { + req, out := c.CopyObjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateBucket = "CreateBucket" @@ -273,8 +319,23 @@ func (c *S3) CreateBucketRequest(input *CreateBucketInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucket func (c *S3) CreateBucket(input *CreateBucketInput) (*CreateBucketOutput, error) { req, out := c.CreateBucketRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateBucketWithContext is the same as CreateBucket with the addition of +// the ability to pass a context and additional request options. +// +// See CreateBucket 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 *S3) CreateBucketWithContext(ctx aws.Context, input *CreateBucketInput, opts ...request.Option) (*CreateBucketOutput, error) { + req, out := c.CreateBucketRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateMultipartUpload = "CreateMultipartUpload" @@ -339,8 +400,23 @@ func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUpload func (c *S3) CreateMultipartUpload(input *CreateMultipartUploadInput) (*CreateMultipartUploadOutput, error) { req, out := c.CreateMultipartUploadRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateMultipartUploadWithContext is the same as CreateMultipartUpload with the addition of +// the ability to pass a context and additional request options. +// +// See CreateMultipartUpload 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 *S3) CreateMultipartUploadWithContext(ctx aws.Context, input *CreateMultipartUploadInput, opts ...request.Option) (*CreateMultipartUploadOutput, error) { + req, out := c.CreateMultipartUploadRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucket = "DeleteBucket" @@ -402,8 +478,23 @@ func (c *S3) DeleteBucketRequest(input *DeleteBucketInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket func (c *S3) DeleteBucket(input *DeleteBucketInput) (*DeleteBucketOutput, error) { req, out := c.DeleteBucketRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketWithContext is the same as DeleteBucket with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucket 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 *S3) DeleteBucketWithContext(ctx aws.Context, input *DeleteBucketInput, opts ...request.Option) (*DeleteBucketOutput, error) { + req, out := c.DeleteBucketRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketAnalyticsConfiguration = "DeleteBucketAnalyticsConfiguration" @@ -465,8 +556,23 @@ func (c *S3) DeleteBucketAnalyticsConfigurationRequest(input *DeleteBucketAnalyt // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfiguration func (c *S3) DeleteBucketAnalyticsConfiguration(input *DeleteBucketAnalyticsConfigurationInput) (*DeleteBucketAnalyticsConfigurationOutput, error) { req, out := c.DeleteBucketAnalyticsConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketAnalyticsConfigurationWithContext is the same as DeleteBucketAnalyticsConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketAnalyticsConfiguration 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 *S3) DeleteBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *DeleteBucketAnalyticsConfigurationInput, opts ...request.Option) (*DeleteBucketAnalyticsConfigurationOutput, error) { + req, out := c.DeleteBucketAnalyticsConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketCors = "DeleteBucketCors" @@ -527,8 +633,23 @@ func (c *S3) DeleteBucketCorsRequest(input *DeleteBucketCorsInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCors func (c *S3) DeleteBucketCors(input *DeleteBucketCorsInput) (*DeleteBucketCorsOutput, error) { req, out := c.DeleteBucketCorsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketCorsWithContext is the same as DeleteBucketCors with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketCors 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 *S3) DeleteBucketCorsWithContext(ctx aws.Context, input *DeleteBucketCorsInput, opts ...request.Option) (*DeleteBucketCorsOutput, error) { + req, out := c.DeleteBucketCorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketInventoryConfiguration = "DeleteBucketInventoryConfiguration" @@ -590,8 +711,23 @@ func (c *S3) DeleteBucketInventoryConfigurationRequest(input *DeleteBucketInvent // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfiguration func (c *S3) DeleteBucketInventoryConfiguration(input *DeleteBucketInventoryConfigurationInput) (*DeleteBucketInventoryConfigurationOutput, error) { req, out := c.DeleteBucketInventoryConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketInventoryConfigurationWithContext is the same as DeleteBucketInventoryConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketInventoryConfiguration 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 *S3) DeleteBucketInventoryConfigurationWithContext(ctx aws.Context, input *DeleteBucketInventoryConfigurationInput, opts ...request.Option) (*DeleteBucketInventoryConfigurationOutput, error) { + req, out := c.DeleteBucketInventoryConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketLifecycle = "DeleteBucketLifecycle" @@ -652,8 +788,23 @@ func (c *S3) DeleteBucketLifecycleRequest(input *DeleteBucketLifecycleInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycle func (c *S3) DeleteBucketLifecycle(input *DeleteBucketLifecycleInput) (*DeleteBucketLifecycleOutput, error) { req, out := c.DeleteBucketLifecycleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketLifecycleWithContext is the same as DeleteBucketLifecycle with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketLifecycle 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 *S3) DeleteBucketLifecycleWithContext(ctx aws.Context, input *DeleteBucketLifecycleInput, opts ...request.Option) (*DeleteBucketLifecycleOutput, error) { + req, out := c.DeleteBucketLifecycleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketMetricsConfiguration = "DeleteBucketMetricsConfiguration" @@ -715,8 +866,23 @@ func (c *S3) DeleteBucketMetricsConfigurationRequest(input *DeleteBucketMetricsC // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfiguration func (c *S3) DeleteBucketMetricsConfiguration(input *DeleteBucketMetricsConfigurationInput) (*DeleteBucketMetricsConfigurationOutput, error) { req, out := c.DeleteBucketMetricsConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketMetricsConfigurationWithContext is the same as DeleteBucketMetricsConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketMetricsConfiguration 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 *S3) DeleteBucketMetricsConfigurationWithContext(ctx aws.Context, input *DeleteBucketMetricsConfigurationInput, opts ...request.Option) (*DeleteBucketMetricsConfigurationOutput, error) { + req, out := c.DeleteBucketMetricsConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketPolicy = "DeleteBucketPolicy" @@ -777,8 +943,23 @@ func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicy func (c *S3) DeleteBucketPolicy(input *DeleteBucketPolicyInput) (*DeleteBucketPolicyOutput, error) { req, out := c.DeleteBucketPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketPolicyWithContext is the same as DeleteBucketPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketPolicy 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 *S3) DeleteBucketPolicyWithContext(ctx aws.Context, input *DeleteBucketPolicyInput, opts ...request.Option) (*DeleteBucketPolicyOutput, error) { + req, out := c.DeleteBucketPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketReplication = "DeleteBucketReplication" @@ -839,8 +1020,23 @@ func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplication func (c *S3) DeleteBucketReplication(input *DeleteBucketReplicationInput) (*DeleteBucketReplicationOutput, error) { req, out := c.DeleteBucketReplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketReplicationWithContext is the same as DeleteBucketReplication with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketReplication 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 *S3) DeleteBucketReplicationWithContext(ctx aws.Context, input *DeleteBucketReplicationInput, opts ...request.Option) (*DeleteBucketReplicationOutput, error) { + req, out := c.DeleteBucketReplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketTagging = "DeleteBucketTagging" @@ -901,8 +1097,23 @@ func (c *S3) DeleteBucketTaggingRequest(input *DeleteBucketTaggingInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTagging func (c *S3) DeleteBucketTagging(input *DeleteBucketTaggingInput) (*DeleteBucketTaggingOutput, error) { req, out := c.DeleteBucketTaggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketTaggingWithContext is the same as DeleteBucketTagging with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketTagging 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 *S3) DeleteBucketTaggingWithContext(ctx aws.Context, input *DeleteBucketTaggingInput, opts ...request.Option) (*DeleteBucketTaggingOutput, error) { + req, out := c.DeleteBucketTaggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteBucketWebsite = "DeleteBucketWebsite" @@ -963,8 +1174,23 @@ func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsite func (c *S3) DeleteBucketWebsite(input *DeleteBucketWebsiteInput) (*DeleteBucketWebsiteOutput, error) { req, out := c.DeleteBucketWebsiteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteBucketWebsiteWithContext is the same as DeleteBucketWebsite with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteBucketWebsite 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 *S3) DeleteBucketWebsiteWithContext(ctx aws.Context, input *DeleteBucketWebsiteInput, opts ...request.Option) (*DeleteBucketWebsiteOutput, error) { + req, out := c.DeleteBucketWebsiteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteObject = "DeleteObject" @@ -1025,8 +1251,23 @@ func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject func (c *S3) DeleteObject(input *DeleteObjectInput) (*DeleteObjectOutput, error) { req, out := c.DeleteObjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteObjectWithContext is the same as DeleteObject with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteObject 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 *S3) DeleteObjectWithContext(ctx aws.Context, input *DeleteObjectInput, opts ...request.Option) (*DeleteObjectOutput, error) { + req, out := c.DeleteObjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteObjectTagging = "DeleteObjectTagging" @@ -1085,8 +1326,23 @@ func (c *S3) DeleteObjectTaggingRequest(input *DeleteObjectTaggingInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTagging func (c *S3) DeleteObjectTagging(input *DeleteObjectTaggingInput) (*DeleteObjectTaggingOutput, error) { req, out := c.DeleteObjectTaggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteObjectTaggingWithContext is the same as DeleteObjectTagging with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteObjectTagging 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 *S3) DeleteObjectTaggingWithContext(ctx aws.Context, input *DeleteObjectTaggingInput, opts ...request.Option) (*DeleteObjectTaggingOutput, error) { + req, out := c.DeleteObjectTaggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteObjects = "DeleteObjects" @@ -1146,8 +1402,23 @@ func (c *S3) DeleteObjectsRequest(input *DeleteObjectsInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjects func (c *S3) DeleteObjects(input *DeleteObjectsInput) (*DeleteObjectsOutput, error) { req, out := c.DeleteObjectsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteObjectsWithContext is the same as DeleteObjects with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteObjects 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 *S3) DeleteObjectsWithContext(ctx aws.Context, input *DeleteObjectsInput, opts ...request.Option) (*DeleteObjectsOutput, error) { + req, out := c.DeleteObjectsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketAccelerateConfiguration = "GetBucketAccelerateConfiguration" @@ -1206,8 +1477,23 @@ func (c *S3) GetBucketAccelerateConfigurationRequest(input *GetBucketAccelerateC // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfiguration func (c *S3) GetBucketAccelerateConfiguration(input *GetBucketAccelerateConfigurationInput) (*GetBucketAccelerateConfigurationOutput, error) { req, out := c.GetBucketAccelerateConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketAccelerateConfigurationWithContext is the same as GetBucketAccelerateConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketAccelerateConfiguration 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 *S3) GetBucketAccelerateConfigurationWithContext(ctx aws.Context, input *GetBucketAccelerateConfigurationInput, opts ...request.Option) (*GetBucketAccelerateConfigurationOutput, error) { + req, out := c.GetBucketAccelerateConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketAcl = "GetBucketAcl" @@ -1266,8 +1552,23 @@ func (c *S3) GetBucketAclRequest(input *GetBucketAclInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAcl func (c *S3) GetBucketAcl(input *GetBucketAclInput) (*GetBucketAclOutput, error) { req, out := c.GetBucketAclRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketAclWithContext is the same as GetBucketAcl with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketAcl 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 *S3) GetBucketAclWithContext(ctx aws.Context, input *GetBucketAclInput, opts ...request.Option) (*GetBucketAclOutput, error) { + req, out := c.GetBucketAclRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketAnalyticsConfiguration = "GetBucketAnalyticsConfiguration" @@ -1327,8 +1628,23 @@ func (c *S3) GetBucketAnalyticsConfigurationRequest(input *GetBucketAnalyticsCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfiguration func (c *S3) GetBucketAnalyticsConfiguration(input *GetBucketAnalyticsConfigurationInput) (*GetBucketAnalyticsConfigurationOutput, error) { req, out := c.GetBucketAnalyticsConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketAnalyticsConfigurationWithContext is the same as GetBucketAnalyticsConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketAnalyticsConfiguration 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 *S3) GetBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *GetBucketAnalyticsConfigurationInput, opts ...request.Option) (*GetBucketAnalyticsConfigurationOutput, error) { + req, out := c.GetBucketAnalyticsConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketCors = "GetBucketCors" @@ -1387,8 +1703,23 @@ func (c *S3) GetBucketCorsRequest(input *GetBucketCorsInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCors func (c *S3) GetBucketCors(input *GetBucketCorsInput) (*GetBucketCorsOutput, error) { req, out := c.GetBucketCorsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketCorsWithContext is the same as GetBucketCors with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketCors 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 *S3) GetBucketCorsWithContext(ctx aws.Context, input *GetBucketCorsInput, opts ...request.Option) (*GetBucketCorsOutput, error) { + req, out := c.GetBucketCorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketInventoryConfiguration = "GetBucketInventoryConfiguration" @@ -1448,8 +1779,23 @@ func (c *S3) GetBucketInventoryConfigurationRequest(input *GetBucketInventoryCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfiguration func (c *S3) GetBucketInventoryConfiguration(input *GetBucketInventoryConfigurationInput) (*GetBucketInventoryConfigurationOutput, error) { req, out := c.GetBucketInventoryConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketInventoryConfigurationWithContext is the same as GetBucketInventoryConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketInventoryConfiguration 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 *S3) GetBucketInventoryConfigurationWithContext(ctx aws.Context, input *GetBucketInventoryConfigurationInput, opts ...request.Option) (*GetBucketInventoryConfigurationOutput, error) { + req, out := c.GetBucketInventoryConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketLifecycle = "GetBucketLifecycle" @@ -1511,8 +1857,23 @@ func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycle func (c *S3) GetBucketLifecycle(input *GetBucketLifecycleInput) (*GetBucketLifecycleOutput, error) { req, out := c.GetBucketLifecycleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketLifecycleWithContext is the same as GetBucketLifecycle with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketLifecycle 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 *S3) GetBucketLifecycleWithContext(ctx aws.Context, input *GetBucketLifecycleInput, opts ...request.Option) (*GetBucketLifecycleOutput, error) { + req, out := c.GetBucketLifecycleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketLifecycleConfiguration = "GetBucketLifecycleConfiguration" @@ -1571,8 +1932,23 @@ func (c *S3) GetBucketLifecycleConfigurationRequest(input *GetBucketLifecycleCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfiguration func (c *S3) GetBucketLifecycleConfiguration(input *GetBucketLifecycleConfigurationInput) (*GetBucketLifecycleConfigurationOutput, error) { req, out := c.GetBucketLifecycleConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketLifecycleConfigurationWithContext is the same as GetBucketLifecycleConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketLifecycleConfiguration 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 *S3) GetBucketLifecycleConfigurationWithContext(ctx aws.Context, input *GetBucketLifecycleConfigurationInput, opts ...request.Option) (*GetBucketLifecycleConfigurationOutput, error) { + req, out := c.GetBucketLifecycleConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketLocation = "GetBucketLocation" @@ -1631,8 +2007,23 @@ func (c *S3) GetBucketLocationRequest(input *GetBucketLocationInput) (req *reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocation func (c *S3) GetBucketLocation(input *GetBucketLocationInput) (*GetBucketLocationOutput, error) { req, out := c.GetBucketLocationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketLocationWithContext is the same as GetBucketLocation with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketLocation 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 *S3) GetBucketLocationWithContext(ctx aws.Context, input *GetBucketLocationInput, opts ...request.Option) (*GetBucketLocationOutput, error) { + req, out := c.GetBucketLocationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketLogging = "GetBucketLogging" @@ -1692,8 +2083,23 @@ func (c *S3) GetBucketLoggingRequest(input *GetBucketLoggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLogging func (c *S3) GetBucketLogging(input *GetBucketLoggingInput) (*GetBucketLoggingOutput, error) { req, out := c.GetBucketLoggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketLoggingWithContext is the same as GetBucketLogging with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketLogging 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 *S3) GetBucketLoggingWithContext(ctx aws.Context, input *GetBucketLoggingInput, opts ...request.Option) (*GetBucketLoggingOutput, error) { + req, out := c.GetBucketLoggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketMetricsConfiguration = "GetBucketMetricsConfiguration" @@ -1753,8 +2159,23 @@ func (c *S3) GetBucketMetricsConfigurationRequest(input *GetBucketMetricsConfigu // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfiguration func (c *S3) GetBucketMetricsConfiguration(input *GetBucketMetricsConfigurationInput) (*GetBucketMetricsConfigurationOutput, error) { req, out := c.GetBucketMetricsConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketMetricsConfigurationWithContext is the same as GetBucketMetricsConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketMetricsConfiguration 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 *S3) GetBucketMetricsConfigurationWithContext(ctx aws.Context, input *GetBucketMetricsConfigurationInput, opts ...request.Option) (*GetBucketMetricsConfigurationOutput, error) { + req, out := c.GetBucketMetricsConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketNotification = "GetBucketNotification" @@ -1816,8 +2237,23 @@ func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationConfigurat // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotification func (c *S3) GetBucketNotification(input *GetBucketNotificationConfigurationRequest) (*NotificationConfigurationDeprecated, error) { req, out := c.GetBucketNotificationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketNotificationWithContext is the same as GetBucketNotification with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketNotification 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 *S3) GetBucketNotificationWithContext(ctx aws.Context, input *GetBucketNotificationConfigurationRequest, opts ...request.Option) (*NotificationConfigurationDeprecated, error) { + req, out := c.GetBucketNotificationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketNotificationConfiguration = "GetBucketNotificationConfiguration" @@ -1876,8 +2312,23 @@ func (c *S3) GetBucketNotificationConfigurationRequest(input *GetBucketNotificat // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationConfiguration func (c *S3) GetBucketNotificationConfiguration(input *GetBucketNotificationConfigurationRequest) (*NotificationConfiguration, error) { req, out := c.GetBucketNotificationConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketNotificationConfigurationWithContext is the same as GetBucketNotificationConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketNotificationConfiguration 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 *S3) GetBucketNotificationConfigurationWithContext(ctx aws.Context, input *GetBucketNotificationConfigurationRequest, opts ...request.Option) (*NotificationConfiguration, error) { + req, out := c.GetBucketNotificationConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketPolicy = "GetBucketPolicy" @@ -1936,8 +2387,23 @@ func (c *S3) GetBucketPolicyRequest(input *GetBucketPolicyInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicy func (c *S3) GetBucketPolicy(input *GetBucketPolicyInput) (*GetBucketPolicyOutput, error) { req, out := c.GetBucketPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketPolicyWithContext is the same as GetBucketPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketPolicy 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 *S3) GetBucketPolicyWithContext(ctx aws.Context, input *GetBucketPolicyInput, opts ...request.Option) (*GetBucketPolicyOutput, error) { + req, out := c.GetBucketPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketReplication = "GetBucketReplication" @@ -1996,8 +2462,23 @@ func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplication func (c *S3) GetBucketReplication(input *GetBucketReplicationInput) (*GetBucketReplicationOutput, error) { req, out := c.GetBucketReplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketReplicationWithContext is the same as GetBucketReplication with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketReplication 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 *S3) GetBucketReplicationWithContext(ctx aws.Context, input *GetBucketReplicationInput, opts ...request.Option) (*GetBucketReplicationOutput, error) { + req, out := c.GetBucketReplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketRequestPayment = "GetBucketRequestPayment" @@ -2056,8 +2537,23 @@ func (c *S3) GetBucketRequestPaymentRequest(input *GetBucketRequestPaymentInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPayment func (c *S3) GetBucketRequestPayment(input *GetBucketRequestPaymentInput) (*GetBucketRequestPaymentOutput, error) { req, out := c.GetBucketRequestPaymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketRequestPaymentWithContext is the same as GetBucketRequestPayment with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketRequestPayment 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 *S3) GetBucketRequestPaymentWithContext(ctx aws.Context, input *GetBucketRequestPaymentInput, opts ...request.Option) (*GetBucketRequestPaymentOutput, error) { + req, out := c.GetBucketRequestPaymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketTagging = "GetBucketTagging" @@ -2116,8 +2612,23 @@ func (c *S3) GetBucketTaggingRequest(input *GetBucketTaggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTagging func (c *S3) GetBucketTagging(input *GetBucketTaggingInput) (*GetBucketTaggingOutput, error) { req, out := c.GetBucketTaggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketTaggingWithContext is the same as GetBucketTagging with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketTagging 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 *S3) GetBucketTaggingWithContext(ctx aws.Context, input *GetBucketTaggingInput, opts ...request.Option) (*GetBucketTaggingOutput, error) { + req, out := c.GetBucketTaggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketVersioning = "GetBucketVersioning" @@ -2176,8 +2687,23 @@ func (c *S3) GetBucketVersioningRequest(input *GetBucketVersioningInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioning func (c *S3) GetBucketVersioning(input *GetBucketVersioningInput) (*GetBucketVersioningOutput, error) { req, out := c.GetBucketVersioningRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketVersioningWithContext is the same as GetBucketVersioning with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketVersioning 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 *S3) GetBucketVersioningWithContext(ctx aws.Context, input *GetBucketVersioningInput, opts ...request.Option) (*GetBucketVersioningOutput, error) { + req, out := c.GetBucketVersioningRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetBucketWebsite = "GetBucketWebsite" @@ -2236,8 +2762,23 @@ func (c *S3) GetBucketWebsiteRequest(input *GetBucketWebsiteInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsite func (c *S3) GetBucketWebsite(input *GetBucketWebsiteInput) (*GetBucketWebsiteOutput, error) { req, out := c.GetBucketWebsiteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetBucketWebsiteWithContext is the same as GetBucketWebsite with the addition of +// the ability to pass a context and additional request options. +// +// See GetBucketWebsite 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 *S3) GetBucketWebsiteWithContext(ctx aws.Context, input *GetBucketWebsiteInput, opts ...request.Option) (*GetBucketWebsiteOutput, error) { + req, out := c.GetBucketWebsiteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetObject = "GetObject" @@ -2301,8 +2842,23 @@ func (c *S3) GetObjectRequest(input *GetObjectInput) (req *request.Request, outp // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject func (c *S3) GetObject(input *GetObjectInput) (*GetObjectOutput, error) { req, out := c.GetObjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetObjectWithContext is the same as GetObject with the addition of +// the ability to pass a context and additional request options. +// +// See GetObject 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 *S3) GetObjectWithContext(ctx aws.Context, input *GetObjectInput, opts ...request.Option) (*GetObjectOutput, error) { + req, out := c.GetObjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetObjectAcl = "GetObjectAcl" @@ -2366,8 +2922,23 @@ func (c *S3) GetObjectAclRequest(input *GetObjectAclInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAcl func (c *S3) GetObjectAcl(input *GetObjectAclInput) (*GetObjectAclOutput, error) { req, out := c.GetObjectAclRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetObjectAclWithContext is the same as GetObjectAcl with the addition of +// the ability to pass a context and additional request options. +// +// See GetObjectAcl 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 *S3) GetObjectAclWithContext(ctx aws.Context, input *GetObjectAclInput, opts ...request.Option) (*GetObjectAclOutput, error) { + req, out := c.GetObjectAclRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetObjectTagging = "GetObjectTagging" @@ -2426,8 +2997,23 @@ func (c *S3) GetObjectTaggingRequest(input *GetObjectTaggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTagging func (c *S3) GetObjectTagging(input *GetObjectTaggingInput) (*GetObjectTaggingOutput, error) { req, out := c.GetObjectTaggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetObjectTaggingWithContext is the same as GetObjectTagging with the addition of +// the ability to pass a context and additional request options. +// +// See GetObjectTagging 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 *S3) GetObjectTaggingWithContext(ctx aws.Context, input *GetObjectTaggingInput, opts ...request.Option) (*GetObjectTaggingOutput, error) { + req, out := c.GetObjectTaggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetObjectTorrent = "GetObjectTorrent" @@ -2486,8 +3072,23 @@ func (c *S3) GetObjectTorrentRequest(input *GetObjectTorrentInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrent func (c *S3) GetObjectTorrent(input *GetObjectTorrentInput) (*GetObjectTorrentOutput, error) { req, out := c.GetObjectTorrentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetObjectTorrentWithContext is the same as GetObjectTorrent with the addition of +// the ability to pass a context and additional request options. +// +// See GetObjectTorrent 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 *S3) GetObjectTorrentWithContext(ctx aws.Context, input *GetObjectTorrentInput, opts ...request.Option) (*GetObjectTorrentOutput, error) { + req, out := c.GetObjectTorrentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opHeadBucket = "HeadBucket" @@ -2554,8 +3155,23 @@ func (c *S3) HeadBucketRequest(input *HeadBucketInput) (req *request.Request, ou // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucket func (c *S3) HeadBucket(input *HeadBucketInput) (*HeadBucketOutput, error) { req, out := c.HeadBucketRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// HeadBucketWithContext is the same as HeadBucket with the addition of +// the ability to pass a context and additional request options. +// +// See HeadBucket 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 *S3) HeadBucketWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.Option) (*HeadBucketOutput, error) { + req, out := c.HeadBucketRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opHeadObject = "HeadObject" @@ -2621,8 +3237,23 @@ func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *request.Request, ou // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObject func (c *S3) HeadObject(input *HeadObjectInput) (*HeadObjectOutput, error) { req, out := c.HeadObjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// HeadObjectWithContext is the same as HeadObject with the addition of +// the ability to pass a context and additional request options. +// +// See HeadObject 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 *S3) HeadObjectWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.Option) (*HeadObjectOutput, error) { + req, out := c.HeadObjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBucketAnalyticsConfigurations = "ListBucketAnalyticsConfigurations" @@ -2681,8 +3312,23 @@ func (c *S3) ListBucketAnalyticsConfigurationsRequest(input *ListBucketAnalytics // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurations func (c *S3) ListBucketAnalyticsConfigurations(input *ListBucketAnalyticsConfigurationsInput) (*ListBucketAnalyticsConfigurationsOutput, error) { req, out := c.ListBucketAnalyticsConfigurationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBucketAnalyticsConfigurationsWithContext is the same as ListBucketAnalyticsConfigurations with the addition of +// the ability to pass a context and additional request options. +// +// See ListBucketAnalyticsConfigurations 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 *S3) ListBucketAnalyticsConfigurationsWithContext(ctx aws.Context, input *ListBucketAnalyticsConfigurationsInput, opts ...request.Option) (*ListBucketAnalyticsConfigurationsOutput, error) { + req, out := c.ListBucketAnalyticsConfigurationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBucketInventoryConfigurations = "ListBucketInventoryConfigurations" @@ -2741,8 +3387,23 @@ func (c *S3) ListBucketInventoryConfigurationsRequest(input *ListBucketInventory // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurations func (c *S3) ListBucketInventoryConfigurations(input *ListBucketInventoryConfigurationsInput) (*ListBucketInventoryConfigurationsOutput, error) { req, out := c.ListBucketInventoryConfigurationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBucketInventoryConfigurationsWithContext is the same as ListBucketInventoryConfigurations with the addition of +// the ability to pass a context and additional request options. +// +// See ListBucketInventoryConfigurations 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 *S3) ListBucketInventoryConfigurationsWithContext(ctx aws.Context, input *ListBucketInventoryConfigurationsInput, opts ...request.Option) (*ListBucketInventoryConfigurationsOutput, error) { + req, out := c.ListBucketInventoryConfigurationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBucketMetricsConfigurations = "ListBucketMetricsConfigurations" @@ -2801,8 +3462,23 @@ func (c *S3) ListBucketMetricsConfigurationsRequest(input *ListBucketMetricsConf // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurations func (c *S3) ListBucketMetricsConfigurations(input *ListBucketMetricsConfigurationsInput) (*ListBucketMetricsConfigurationsOutput, error) { req, out := c.ListBucketMetricsConfigurationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBucketMetricsConfigurationsWithContext is the same as ListBucketMetricsConfigurations with the addition of +// the ability to pass a context and additional request options. +// +// See ListBucketMetricsConfigurations 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 *S3) ListBucketMetricsConfigurationsWithContext(ctx aws.Context, input *ListBucketMetricsConfigurationsInput, opts ...request.Option) (*ListBucketMetricsConfigurationsOutput, error) { + req, out := c.ListBucketMetricsConfigurationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListBuckets = "ListBuckets" @@ -2861,8 +3537,23 @@ func (c *S3) ListBucketsRequest(input *ListBucketsInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets func (c *S3) ListBuckets(input *ListBucketsInput) (*ListBucketsOutput, error) { req, out := c.ListBucketsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListBucketsWithContext is the same as ListBuckets with the addition of +// the ability to pass a context and additional request options. +// +// See ListBuckets 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 *S3) ListBucketsWithContext(ctx aws.Context, input *ListBucketsInput, opts ...request.Option) (*ListBucketsOutput, error) { + req, out := c.ListBucketsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListMultipartUploads = "ListMultipartUploads" @@ -2927,8 +3618,23 @@ func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploads func (c *S3) ListMultipartUploads(input *ListMultipartUploadsInput) (*ListMultipartUploadsOutput, error) { req, out := c.ListMultipartUploadsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListMultipartUploadsWithContext is the same as ListMultipartUploads with the addition of +// the ability to pass a context and additional request options. +// +// See ListMultipartUploads 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 *S3) ListMultipartUploadsWithContext(ctx aws.Context, input *ListMultipartUploadsInput, opts ...request.Option) (*ListMultipartUploadsOutput, error) { + req, out := c.ListMultipartUploadsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListMultipartUploadsPages iterates over the pages of a ListMultipartUploads operation, @@ -2948,12 +3654,37 @@ func (c *S3) ListMultipartUploads(input *ListMultipartUploadsInput) (*ListMultip // return pageNum <= 3 // }) // -func (c *S3) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func(p *ListMultipartUploadsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListMultipartUploadsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListMultipartUploadsOutput), lastPage) - }) +func (c *S3) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool) error { + return c.ListMultipartUploadsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListMultipartUploadsPagesWithContext same as ListMultipartUploadsPages 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 *S3) ListMultipartUploadsPagesWithContext(ctx aws.Context, input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListMultipartUploadsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListMultipartUploadsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListMultipartUploadsOutput), !p.HasNextPage()) + } + return p.Err() } const opListObjectVersions = "ListObjectVersions" @@ -3018,8 +3749,23 @@ func (c *S3) ListObjectVersionsRequest(input *ListObjectVersionsInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersions func (c *S3) ListObjectVersions(input *ListObjectVersionsInput) (*ListObjectVersionsOutput, error) { req, out := c.ListObjectVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListObjectVersionsWithContext is the same as ListObjectVersions with the addition of +// the ability to pass a context and additional request options. +// +// See ListObjectVersions 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 *S3) ListObjectVersionsWithContext(ctx aws.Context, input *ListObjectVersionsInput, opts ...request.Option) (*ListObjectVersionsOutput, error) { + req, out := c.ListObjectVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListObjectVersionsPages iterates over the pages of a ListObjectVersions operation, @@ -3039,12 +3785,37 @@ func (c *S3) ListObjectVersions(input *ListObjectVersionsInput) (*ListObjectVers // return pageNum <= 3 // }) // -func (c *S3) ListObjectVersionsPages(input *ListObjectVersionsInput, fn func(p *ListObjectVersionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListObjectVersionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListObjectVersionsOutput), lastPage) - }) +func (c *S3) ListObjectVersionsPages(input *ListObjectVersionsInput, fn func(*ListObjectVersionsOutput, bool) bool) error { + return c.ListObjectVersionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListObjectVersionsPagesWithContext same as ListObjectVersionsPages 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 *S3) ListObjectVersionsPagesWithContext(ctx aws.Context, input *ListObjectVersionsInput, fn func(*ListObjectVersionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListObjectVersionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListObjectVersionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListObjectVersionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListObjects = "ListObjects" @@ -3116,8 +3887,23 @@ func (c *S3) ListObjectsRequest(input *ListObjectsInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects func (c *S3) ListObjects(input *ListObjectsInput) (*ListObjectsOutput, error) { req, out := c.ListObjectsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListObjectsWithContext is the same as ListObjects with the addition of +// the ability to pass a context and additional request options. +// +// See ListObjects 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 *S3) ListObjectsWithContext(ctx aws.Context, input *ListObjectsInput, opts ...request.Option) (*ListObjectsOutput, error) { + req, out := c.ListObjectsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListObjectsPages iterates over the pages of a ListObjects operation, @@ -3137,12 +3923,37 @@ func (c *S3) ListObjects(input *ListObjectsInput) (*ListObjectsOutput, error) { // return pageNum <= 3 // }) // -func (c *S3) ListObjectsPages(input *ListObjectsInput, fn func(p *ListObjectsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListObjectsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListObjectsOutput), lastPage) - }) +func (c *S3) ListObjectsPages(input *ListObjectsInput, fn func(*ListObjectsOutput, bool) bool) error { + return c.ListObjectsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListObjectsPagesWithContext same as ListObjectsPages 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 *S3) ListObjectsPagesWithContext(ctx aws.Context, input *ListObjectsInput, fn func(*ListObjectsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListObjectsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListObjectsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListObjectsOutput), !p.HasNextPage()) + } + return p.Err() } const opListObjectsV2 = "ListObjectsV2" @@ -3215,8 +4026,23 @@ func (c *S3) ListObjectsV2Request(input *ListObjectsV2Input) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2 func (c *S3) ListObjectsV2(input *ListObjectsV2Input) (*ListObjectsV2Output, error) { req, out := c.ListObjectsV2Request(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListObjectsV2WithContext is the same as ListObjectsV2 with the addition of +// the ability to pass a context and additional request options. +// +// See ListObjectsV2 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 *S3) ListObjectsV2WithContext(ctx aws.Context, input *ListObjectsV2Input, opts ...request.Option) (*ListObjectsV2Output, error) { + req, out := c.ListObjectsV2Request(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListObjectsV2Pages iterates over the pages of a ListObjectsV2 operation, @@ -3236,12 +4062,37 @@ func (c *S3) ListObjectsV2(input *ListObjectsV2Input) (*ListObjectsV2Output, err // return pageNum <= 3 // }) // -func (c *S3) ListObjectsV2Pages(input *ListObjectsV2Input, fn func(p *ListObjectsV2Output, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListObjectsV2Request(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListObjectsV2Output), lastPage) - }) +func (c *S3) ListObjectsV2Pages(input *ListObjectsV2Input, fn func(*ListObjectsV2Output, bool) bool) error { + return c.ListObjectsV2PagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListObjectsV2PagesWithContext same as ListObjectsV2Pages 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 *S3) ListObjectsV2PagesWithContext(ctx aws.Context, input *ListObjectsV2Input, fn func(*ListObjectsV2Output, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListObjectsV2Input + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListObjectsV2Request(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListObjectsV2Output), !p.HasNextPage()) + } + return p.Err() } const opListParts = "ListParts" @@ -3306,8 +4157,23 @@ func (c *S3) ListPartsRequest(input *ListPartsInput) (req *request.Request, outp // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListParts func (c *S3) ListParts(input *ListPartsInput) (*ListPartsOutput, error) { req, out := c.ListPartsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPartsWithContext is the same as ListParts with the addition of +// the ability to pass a context and additional request options. +// +// See ListParts 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 *S3) ListPartsWithContext(ctx aws.Context, input *ListPartsInput, opts ...request.Option) (*ListPartsOutput, error) { + req, out := c.ListPartsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListPartsPages iterates over the pages of a ListParts operation, @@ -3327,12 +4193,37 @@ func (c *S3) ListParts(input *ListPartsInput) (*ListPartsOutput, error) { // return pageNum <= 3 // }) // -func (c *S3) ListPartsPages(input *ListPartsInput, fn func(p *ListPartsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListPartsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListPartsOutput), lastPage) - }) +func (c *S3) ListPartsPages(input *ListPartsInput, fn func(*ListPartsOutput, bool) bool) error { + return c.ListPartsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListPartsPagesWithContext same as ListPartsPages 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 *S3) ListPartsPagesWithContext(ctx aws.Context, input *ListPartsInput, fn func(*ListPartsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListPartsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListPartsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListPartsOutput), !p.HasNextPage()) + } + return p.Err() } const opPutBucketAccelerateConfiguration = "PutBucketAccelerateConfiguration" @@ -3393,8 +4284,23 @@ func (c *S3) PutBucketAccelerateConfigurationRequest(input *PutBucketAccelerateC // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfiguration func (c *S3) PutBucketAccelerateConfiguration(input *PutBucketAccelerateConfigurationInput) (*PutBucketAccelerateConfigurationOutput, error) { req, out := c.PutBucketAccelerateConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketAccelerateConfigurationWithContext is the same as PutBucketAccelerateConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketAccelerateConfiguration 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 *S3) PutBucketAccelerateConfigurationWithContext(ctx aws.Context, input *PutBucketAccelerateConfigurationInput, opts ...request.Option) (*PutBucketAccelerateConfigurationOutput, error) { + req, out := c.PutBucketAccelerateConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketAcl = "PutBucketAcl" @@ -3455,8 +4361,23 @@ func (c *S3) PutBucketAclRequest(input *PutBucketAclInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAcl func (c *S3) PutBucketAcl(input *PutBucketAclInput) (*PutBucketAclOutput, error) { req, out := c.PutBucketAclRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketAclWithContext is the same as PutBucketAcl with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketAcl 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 *S3) PutBucketAclWithContext(ctx aws.Context, input *PutBucketAclInput, opts ...request.Option) (*PutBucketAclOutput, error) { + req, out := c.PutBucketAclRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketAnalyticsConfiguration = "PutBucketAnalyticsConfiguration" @@ -3518,8 +4439,23 @@ func (c *S3) PutBucketAnalyticsConfigurationRequest(input *PutBucketAnalyticsCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfiguration func (c *S3) PutBucketAnalyticsConfiguration(input *PutBucketAnalyticsConfigurationInput) (*PutBucketAnalyticsConfigurationOutput, error) { req, out := c.PutBucketAnalyticsConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketAnalyticsConfigurationWithContext is the same as PutBucketAnalyticsConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketAnalyticsConfiguration 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 *S3) PutBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *PutBucketAnalyticsConfigurationInput, opts ...request.Option) (*PutBucketAnalyticsConfigurationOutput, error) { + req, out := c.PutBucketAnalyticsConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketCors = "PutBucketCors" @@ -3580,8 +4516,23 @@ func (c *S3) PutBucketCorsRequest(input *PutBucketCorsInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCors func (c *S3) PutBucketCors(input *PutBucketCorsInput) (*PutBucketCorsOutput, error) { req, out := c.PutBucketCorsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketCorsWithContext is the same as PutBucketCors with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketCors 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 *S3) PutBucketCorsWithContext(ctx aws.Context, input *PutBucketCorsInput, opts ...request.Option) (*PutBucketCorsOutput, error) { + req, out := c.PutBucketCorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketInventoryConfiguration = "PutBucketInventoryConfiguration" @@ -3643,8 +4594,23 @@ func (c *S3) PutBucketInventoryConfigurationRequest(input *PutBucketInventoryCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfiguration func (c *S3) PutBucketInventoryConfiguration(input *PutBucketInventoryConfigurationInput) (*PutBucketInventoryConfigurationOutput, error) { req, out := c.PutBucketInventoryConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketInventoryConfigurationWithContext is the same as PutBucketInventoryConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketInventoryConfiguration 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 *S3) PutBucketInventoryConfigurationWithContext(ctx aws.Context, input *PutBucketInventoryConfigurationInput, opts ...request.Option) (*PutBucketInventoryConfigurationOutput, error) { + req, out := c.PutBucketInventoryConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketLifecycle = "PutBucketLifecycle" @@ -3708,8 +4674,23 @@ func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycle func (c *S3) PutBucketLifecycle(input *PutBucketLifecycleInput) (*PutBucketLifecycleOutput, error) { req, out := c.PutBucketLifecycleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketLifecycleWithContext is the same as PutBucketLifecycle with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketLifecycle 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 *S3) PutBucketLifecycleWithContext(ctx aws.Context, input *PutBucketLifecycleInput, opts ...request.Option) (*PutBucketLifecycleOutput, error) { + req, out := c.PutBucketLifecycleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketLifecycleConfiguration = "PutBucketLifecycleConfiguration" @@ -3771,8 +4752,23 @@ func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleCon // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfiguration func (c *S3) PutBucketLifecycleConfiguration(input *PutBucketLifecycleConfigurationInput) (*PutBucketLifecycleConfigurationOutput, error) { req, out := c.PutBucketLifecycleConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketLifecycleConfigurationWithContext is the same as PutBucketLifecycleConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketLifecycleConfiguration 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 *S3) PutBucketLifecycleConfigurationWithContext(ctx aws.Context, input *PutBucketLifecycleConfigurationInput, opts ...request.Option) (*PutBucketLifecycleConfigurationOutput, error) { + req, out := c.PutBucketLifecycleConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketLogging = "PutBucketLogging" @@ -3835,8 +4831,23 @@ func (c *S3) PutBucketLoggingRequest(input *PutBucketLoggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLogging func (c *S3) PutBucketLogging(input *PutBucketLoggingInput) (*PutBucketLoggingOutput, error) { req, out := c.PutBucketLoggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketLoggingWithContext is the same as PutBucketLogging with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketLogging 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 *S3) PutBucketLoggingWithContext(ctx aws.Context, input *PutBucketLoggingInput, opts ...request.Option) (*PutBucketLoggingOutput, error) { + req, out := c.PutBucketLoggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketMetricsConfiguration = "PutBucketMetricsConfiguration" @@ -3898,8 +4909,23 @@ func (c *S3) PutBucketMetricsConfigurationRequest(input *PutBucketMetricsConfigu // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfiguration func (c *S3) PutBucketMetricsConfiguration(input *PutBucketMetricsConfigurationInput) (*PutBucketMetricsConfigurationOutput, error) { req, out := c.PutBucketMetricsConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketMetricsConfigurationWithContext is the same as PutBucketMetricsConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketMetricsConfiguration 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 *S3) PutBucketMetricsConfigurationWithContext(ctx aws.Context, input *PutBucketMetricsConfigurationInput, opts ...request.Option) (*PutBucketMetricsConfigurationOutput, error) { + req, out := c.PutBucketMetricsConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketNotification = "PutBucketNotification" @@ -3963,8 +4989,23 @@ func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (re // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotification func (c *S3) PutBucketNotification(input *PutBucketNotificationInput) (*PutBucketNotificationOutput, error) { req, out := c.PutBucketNotificationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketNotificationWithContext is the same as PutBucketNotification with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketNotification 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 *S3) PutBucketNotificationWithContext(ctx aws.Context, input *PutBucketNotificationInput, opts ...request.Option) (*PutBucketNotificationOutput, error) { + req, out := c.PutBucketNotificationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketNotificationConfiguration = "PutBucketNotificationConfiguration" @@ -4025,8 +5066,23 @@ func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificat // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfiguration func (c *S3) PutBucketNotificationConfiguration(input *PutBucketNotificationConfigurationInput) (*PutBucketNotificationConfigurationOutput, error) { req, out := c.PutBucketNotificationConfigurationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketNotificationConfigurationWithContext is the same as PutBucketNotificationConfiguration with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketNotificationConfiguration 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 *S3) PutBucketNotificationConfigurationWithContext(ctx aws.Context, input *PutBucketNotificationConfigurationInput, opts ...request.Option) (*PutBucketNotificationConfigurationOutput, error) { + req, out := c.PutBucketNotificationConfigurationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketPolicy = "PutBucketPolicy" @@ -4088,8 +5144,23 @@ func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *request.R // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicy func (c *S3) PutBucketPolicy(input *PutBucketPolicyInput) (*PutBucketPolicyOutput, error) { req, out := c.PutBucketPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketPolicyWithContext is the same as PutBucketPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketPolicy 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 *S3) PutBucketPolicyWithContext(ctx aws.Context, input *PutBucketPolicyInput, opts ...request.Option) (*PutBucketPolicyOutput, error) { + req, out := c.PutBucketPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketReplication = "PutBucketReplication" @@ -4151,8 +5222,23 @@ func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplication func (c *S3) PutBucketReplication(input *PutBucketReplicationInput) (*PutBucketReplicationOutput, error) { req, out := c.PutBucketReplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketReplicationWithContext is the same as PutBucketReplication with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketReplication 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 *S3) PutBucketReplicationWithContext(ctx aws.Context, input *PutBucketReplicationInput, opts ...request.Option) (*PutBucketReplicationOutput, error) { + req, out := c.PutBucketReplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketRequestPayment = "PutBucketRequestPayment" @@ -4217,8 +5303,23 @@ func (c *S3) PutBucketRequestPaymentRequest(input *PutBucketRequestPaymentInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPayment func (c *S3) PutBucketRequestPayment(input *PutBucketRequestPaymentInput) (*PutBucketRequestPaymentOutput, error) { req, out := c.PutBucketRequestPaymentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketRequestPaymentWithContext is the same as PutBucketRequestPayment with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketRequestPayment 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 *S3) PutBucketRequestPaymentWithContext(ctx aws.Context, input *PutBucketRequestPaymentInput, opts ...request.Option) (*PutBucketRequestPaymentOutput, error) { + req, out := c.PutBucketRequestPaymentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketTagging = "PutBucketTagging" @@ -4279,8 +5380,23 @@ func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTagging func (c *S3) PutBucketTagging(input *PutBucketTaggingInput) (*PutBucketTaggingOutput, error) { req, out := c.PutBucketTaggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketTaggingWithContext is the same as PutBucketTagging with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketTagging 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 *S3) PutBucketTaggingWithContext(ctx aws.Context, input *PutBucketTaggingInput, opts ...request.Option) (*PutBucketTaggingOutput, error) { + req, out := c.PutBucketTaggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketVersioning = "PutBucketVersioning" @@ -4342,8 +5458,23 @@ func (c *S3) PutBucketVersioningRequest(input *PutBucketVersioningInput) (req *r // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioning func (c *S3) PutBucketVersioning(input *PutBucketVersioningInput) (*PutBucketVersioningOutput, error) { req, out := c.PutBucketVersioningRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketVersioningWithContext is the same as PutBucketVersioning with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketVersioning 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 *S3) PutBucketVersioningWithContext(ctx aws.Context, input *PutBucketVersioningInput, opts ...request.Option) (*PutBucketVersioningOutput, error) { + req, out := c.PutBucketVersioningRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutBucketWebsite = "PutBucketWebsite" @@ -4404,8 +5535,23 @@ func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsite func (c *S3) PutBucketWebsite(input *PutBucketWebsiteInput) (*PutBucketWebsiteOutput, error) { req, out := c.PutBucketWebsiteRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutBucketWebsiteWithContext is the same as PutBucketWebsite with the addition of +// the ability to pass a context and additional request options. +// +// See PutBucketWebsite 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 *S3) PutBucketWebsiteWithContext(ctx aws.Context, input *PutBucketWebsiteInput, opts ...request.Option) (*PutBucketWebsiteOutput, error) { + req, out := c.PutBucketWebsiteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutObject = "PutObject" @@ -4464,8 +5610,23 @@ func (c *S3) PutObjectRequest(input *PutObjectInput) (req *request.Request, outp // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject func (c *S3) PutObject(input *PutObjectInput) (*PutObjectOutput, error) { req, out := c.PutObjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutObjectWithContext is the same as PutObject with the addition of +// the ability to pass a context and additional request options. +// +// See PutObject 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 *S3) PutObjectWithContext(ctx aws.Context, input *PutObjectInput, opts ...request.Option) (*PutObjectOutput, error) { + req, out := c.PutObjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutObjectAcl = "PutObjectAcl" @@ -4530,8 +5691,23 @@ func (c *S3) PutObjectAclRequest(input *PutObjectAclInput) (req *request.Request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAcl func (c *S3) PutObjectAcl(input *PutObjectAclInput) (*PutObjectAclOutput, error) { req, out := c.PutObjectAclRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutObjectAclWithContext is the same as PutObjectAcl with the addition of +// the ability to pass a context and additional request options. +// +// See PutObjectAcl 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 *S3) PutObjectAclWithContext(ctx aws.Context, input *PutObjectAclInput, opts ...request.Option) (*PutObjectAclOutput, error) { + req, out := c.PutObjectAclRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutObjectTagging = "PutObjectTagging" @@ -4590,8 +5766,23 @@ func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *request // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTagging func (c *S3) PutObjectTagging(input *PutObjectTaggingInput) (*PutObjectTaggingOutput, error) { req, out := c.PutObjectTaggingRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutObjectTaggingWithContext is the same as PutObjectTagging with the addition of +// the ability to pass a context and additional request options. +// +// See PutObjectTagging 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 *S3) PutObjectTaggingWithContext(ctx aws.Context, input *PutObjectTaggingInput, opts ...request.Option) (*PutObjectTaggingOutput, error) { + req, out := c.PutObjectTaggingRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRestoreObject = "RestoreObject" @@ -4655,8 +5846,23 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObject func (c *S3) RestoreObject(input *RestoreObjectInput) (*RestoreObjectOutput, error) { req, out := c.RestoreObjectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RestoreObjectWithContext is the same as RestoreObject with the addition of +// the ability to pass a context and additional request options. +// +// See RestoreObject 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 *S3) RestoreObjectWithContext(ctx aws.Context, input *RestoreObjectInput, opts ...request.Option) (*RestoreObjectOutput, error) { + req, out := c.RestoreObjectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadPart = "UploadPart" @@ -4721,8 +5927,23 @@ func (c *S3) UploadPartRequest(input *UploadPartInput) (req *request.Request, ou // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPart func (c *S3) UploadPart(input *UploadPartInput) (*UploadPartOutput, error) { req, out := c.UploadPartRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadPartWithContext is the same as UploadPart with the addition of +// the ability to pass a context and additional request options. +// +// See UploadPart 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 *S3) UploadPartWithContext(ctx aws.Context, input *UploadPartInput, opts ...request.Option) (*UploadPartOutput, error) { + req, out := c.UploadPartRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUploadPartCopy = "UploadPartCopy" @@ -4781,8 +6002,23 @@ func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) (req *request.Req // Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopy func (c *S3) UploadPartCopy(input *UploadPartCopyInput) (*UploadPartCopyOutput, error) { req, out := c.UploadPartCopyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UploadPartCopyWithContext is the same as UploadPartCopy with the addition of +// the ability to pass a context and additional request options. +// +// See UploadPartCopy 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 *S3) UploadPartCopyWithContext(ctx aws.Context, input *UploadPartCopyInput, opts ...request.Option) (*UploadPartCopyOutput, error) { + req, out := c.UploadPartCopyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Specifies the days since the initiation of an Incomplete Multipart Upload diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go index 13ebbdad90..931cb17bb0 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package s3 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/service.go index 5e6f2299ef..3fb5b3be7b 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package s3 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go index ed91c5872f..bcca8627af 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go @@ -23,17 +23,22 @@ func unmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) + hostID := r.HTTPResponse.Header.Get("X-Amz-Id-2") + // Bucket exists in a different region, and request needs // to be made to the correct region. if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { - r.Error = awserr.NewRequestFailure( - awserr.New("BucketRegionError", - fmt.Sprintf("incorrect region, the bucket is not in '%s' region", - aws.StringValue(r.Config.Region)), - nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) + r.Error = requestFailure{ + RequestFailure: awserr.NewRequestFailure( + awserr.New("BucketRegionError", + fmt.Sprintf("incorrect region, the bucket is not in '%s' region", + aws.StringValue(r.Config.Region)), + nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ), + hostID: hostID, + } return } @@ -48,6 +53,7 @@ func unmarshalError(r *request.Request) { } else { errCode = resp.Code errMsg = resp.Message + err = nil } // Fallback to status code converted to message if still no error code @@ -57,9 +63,41 @@ func unmarshalError(r *request.Request) { errMsg = statusText } - r.Error = awserr.NewRequestFailure( - awserr.New(errCode, errMsg, nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) + r.Error = requestFailure{ + RequestFailure: awserr.NewRequestFailure( + awserr.New(errCode, errMsg, err), + r.HTTPResponse.StatusCode, + r.RequestID, + ), + hostID: hostID, + } +} + +// A RequestFailure provides access to the S3 Request ID and Host ID values +// returned from API operation errors. Getting the error as a string will +// return the formated error with the same information as awserr.RequestFailure, +// while also adding the HostID value from the response. +type RequestFailure interface { + awserr.RequestFailure + + // Host ID is the S3 Host ID needed for debug, and contacting support + HostID() string +} + +type requestFailure struct { + awserr.RequestFailure + + hostID string +} + +func (r requestFailure) Error() string { + extra := fmt.Sprintf("status code: %d, request id: %s, host id: %s", + r.StatusCode(), r.RequestID(), r.hostID) + return awserr.SprintError(r.Code(), r.Message(), extra, r.OrigErr()) +} +func (r requestFailure) String() string { + return r.Error() +} +func (r requestFailure) HostID() string { + return r.hostID } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go index 5e16be4ba9..cccfa8c2b3 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package s3 import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilBucketExists uses the Amazon S3 API operation @@ -11,44 +14,60 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *S3) WaitUntilBucketExists(input *HeadBucketInput) error { - waiterCfg := waiter.Config{ - Operation: "HeadBucket", - Delay: 5, + return c.WaitUntilBucketExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilBucketExistsWithContext is an extended version of WaitUntilBucketExists. +// 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 *S3) WaitUntilBucketExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilBucketExists", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 301, }, { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 403, }, { - State: "retry", - Matcher: "status", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 404, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *HeadBucketInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.HeadBucketRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilBucketNotExists uses the Amazon S3 API operation @@ -56,26 +75,45 @@ func (c *S3) WaitUntilBucketExists(input *HeadBucketInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *S3) WaitUntilBucketNotExists(input *HeadBucketInput) error { - waiterCfg := waiter.Config{ - Operation: "HeadBucket", - Delay: 5, + return c.WaitUntilBucketNotExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilBucketNotExistsWithContext is an extended version of WaitUntilBucketNotExists. +// 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 *S3) WaitUntilBucketNotExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilBucketNotExists", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 404, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *HeadBucketInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.HeadBucketRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilObjectExists uses the Amazon S3 API operation @@ -83,32 +121,50 @@ func (c *S3) WaitUntilBucketNotExists(input *HeadBucketInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *S3) WaitUntilObjectExists(input *HeadObjectInput) error { - waiterCfg := waiter.Config{ - Operation: "HeadObject", - Delay: 5, + return c.WaitUntilObjectExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilObjectExistsWithContext is an extended version of WaitUntilObjectExists. +// 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 *S3) WaitUntilObjectExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilObjectExists", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 200, }, { - State: "retry", - Matcher: "status", - Argument: "", + State: request.RetryWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 404, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *HeadObjectInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.HeadObjectRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } // WaitUntilObjectNotExists uses the Amazon S3 API operation @@ -116,24 +172,43 @@ func (c *S3) WaitUntilObjectExists(input *HeadObjectInput) error { // If the condition is not meet within the max attempt window an error will // be returned. func (c *S3) WaitUntilObjectNotExists(input *HeadObjectInput) error { - waiterCfg := waiter.Config{ - Operation: "HeadObject", - Delay: 5, + return c.WaitUntilObjectNotExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilObjectNotExistsWithContext is an extended version of WaitUntilObjectNotExists. +// 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 *S3) WaitUntilObjectNotExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilObjectNotExists", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "status", - Argument: "", + State: request.SuccessWaiterState, + Matcher: request.StatusWaiterMatch, Expected: 404, }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *HeadObjectInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.HeadObjectRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/api.go index 79253784a7..30156443a9 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package ses provides a client for Amazon Simple Email Service. package ses @@ -7,6 +7,7 @@ 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" @@ -88,8 +89,23 @@ func (c *SES) CloneReceiptRuleSetRequest(input *CloneReceiptRuleSetInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/CloneReceiptRuleSet func (c *SES) CloneReceiptRuleSet(input *CloneReceiptRuleSetInput) (*CloneReceiptRuleSetOutput, error) { req, out := c.CloneReceiptRuleSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CloneReceiptRuleSetWithContext is the same as CloneReceiptRuleSet with the addition of +// the ability to pass a context and additional request options. +// +// See CloneReceiptRuleSet 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 *SES) CloneReceiptRuleSetWithContext(ctx aws.Context, input *CloneReceiptRuleSetInput, opts ...request.Option) (*CloneReceiptRuleSetOutput, error) { + req, out := c.CloneReceiptRuleSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateConfigurationSet = "CreateConfigurationSet" @@ -167,8 +183,23 @@ func (c *SES) CreateConfigurationSetRequest(input *CreateConfigurationSetInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/CreateConfigurationSet func (c *SES) CreateConfigurationSet(input *CreateConfigurationSetInput) (*CreateConfigurationSetOutput, error) { req, out := c.CreateConfigurationSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateConfigurationSetWithContext is the same as CreateConfigurationSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateConfigurationSet 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 *SES) CreateConfigurationSetWithContext(ctx aws.Context, input *CreateConfigurationSetInput, opts ...request.Option) (*CreateConfigurationSetOutput, error) { + req, out := c.CreateConfigurationSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateConfigurationSetEventDestination = "CreateConfigurationSetEventDestination" @@ -258,8 +289,23 @@ func (c *SES) CreateConfigurationSetEventDestinationRequest(input *CreateConfigu // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/CreateConfigurationSetEventDestination func (c *SES) CreateConfigurationSetEventDestination(input *CreateConfigurationSetEventDestinationInput) (*CreateConfigurationSetEventDestinationOutput, error) { req, out := c.CreateConfigurationSetEventDestinationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateConfigurationSetEventDestinationWithContext is the same as CreateConfigurationSetEventDestination with the addition of +// the ability to pass a context and additional request options. +// +// See CreateConfigurationSetEventDestination 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 *SES) CreateConfigurationSetEventDestinationWithContext(ctx aws.Context, input *CreateConfigurationSetEventDestinationInput, opts ...request.Option) (*CreateConfigurationSetEventDestinationOutput, error) { + req, out := c.CreateConfigurationSetEventDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReceiptFilter = "CreateReceiptFilter" @@ -332,8 +378,23 @@ func (c *SES) CreateReceiptFilterRequest(input *CreateReceiptFilterInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/CreateReceiptFilter func (c *SES) CreateReceiptFilter(input *CreateReceiptFilterInput) (*CreateReceiptFilterOutput, error) { req, out := c.CreateReceiptFilterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReceiptFilterWithContext is the same as CreateReceiptFilter with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReceiptFilter 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 *SES) CreateReceiptFilterWithContext(ctx aws.Context, input *CreateReceiptFilterInput, opts ...request.Option) (*CreateReceiptFilterOutput, error) { + req, out := c.CreateReceiptFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReceiptRule = "CreateReceiptRule" @@ -429,8 +490,23 @@ func (c *SES) CreateReceiptRuleRequest(input *CreateReceiptRuleInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/CreateReceiptRule func (c *SES) CreateReceiptRule(input *CreateReceiptRuleInput) (*CreateReceiptRuleOutput, error) { req, out := c.CreateReceiptRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReceiptRuleWithContext is the same as CreateReceiptRule with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReceiptRule 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 *SES) CreateReceiptRuleWithContext(ctx aws.Context, input *CreateReceiptRuleInput, opts ...request.Option) (*CreateReceiptRuleOutput, error) { + req, out := c.CreateReceiptRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateReceiptRuleSet = "CreateReceiptRuleSet" @@ -503,8 +579,23 @@ func (c *SES) CreateReceiptRuleSetRequest(input *CreateReceiptRuleSetInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/CreateReceiptRuleSet func (c *SES) CreateReceiptRuleSet(input *CreateReceiptRuleSetInput) (*CreateReceiptRuleSetOutput, error) { req, out := c.CreateReceiptRuleSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateReceiptRuleSetWithContext is the same as CreateReceiptRuleSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateReceiptRuleSet 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 *SES) CreateReceiptRuleSetWithContext(ctx aws.Context, input *CreateReceiptRuleSetInput, opts ...request.Option) (*CreateReceiptRuleSetOutput, error) { + req, out := c.CreateReceiptRuleSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteConfigurationSet = "DeleteConfigurationSet" @@ -573,8 +664,23 @@ func (c *SES) DeleteConfigurationSetRequest(input *DeleteConfigurationSetInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteConfigurationSet func (c *SES) DeleteConfigurationSet(input *DeleteConfigurationSetInput) (*DeleteConfigurationSetOutput, error) { req, out := c.DeleteConfigurationSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteConfigurationSetWithContext is the same as DeleteConfigurationSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteConfigurationSet 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 *SES) DeleteConfigurationSetWithContext(ctx aws.Context, input *DeleteConfigurationSetInput, opts ...request.Option) (*DeleteConfigurationSetOutput, error) { + req, out := c.DeleteConfigurationSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteConfigurationSetEventDestination = "DeleteConfigurationSetEventDestination" @@ -647,8 +753,23 @@ func (c *SES) DeleteConfigurationSetEventDestinationRequest(input *DeleteConfigu // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteConfigurationSetEventDestination func (c *SES) DeleteConfigurationSetEventDestination(input *DeleteConfigurationSetEventDestinationInput) (*DeleteConfigurationSetEventDestinationOutput, error) { req, out := c.DeleteConfigurationSetEventDestinationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteConfigurationSetEventDestinationWithContext is the same as DeleteConfigurationSetEventDestination with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteConfigurationSetEventDestination 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 *SES) DeleteConfigurationSetEventDestinationWithContext(ctx aws.Context, input *DeleteConfigurationSetEventDestinationInput, opts ...request.Option) (*DeleteConfigurationSetEventDestinationOutput, error) { + req, out := c.DeleteConfigurationSetEventDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteIdentity = "DeleteIdentity" @@ -710,8 +831,23 @@ func (c *SES) DeleteIdentityRequest(input *DeleteIdentityInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteIdentity func (c *SES) DeleteIdentity(input *DeleteIdentityInput) (*DeleteIdentityOutput, error) { req, out := c.DeleteIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteIdentityWithContext is the same as DeleteIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteIdentity 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 *SES) DeleteIdentityWithContext(ctx aws.Context, input *DeleteIdentityInput, opts ...request.Option) (*DeleteIdentityOutput, error) { + req, out := c.DeleteIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteIdentityPolicy = "DeleteIdentityPolicy" @@ -781,8 +917,23 @@ func (c *SES) DeleteIdentityPolicyRequest(input *DeleteIdentityPolicyInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteIdentityPolicy func (c *SES) DeleteIdentityPolicy(input *DeleteIdentityPolicyInput) (*DeleteIdentityPolicyOutput, error) { req, out := c.DeleteIdentityPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteIdentityPolicyWithContext is the same as DeleteIdentityPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteIdentityPolicy 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 *SES) DeleteIdentityPolicyWithContext(ctx aws.Context, input *DeleteIdentityPolicyInput, opts ...request.Option) (*DeleteIdentityPolicyOutput, error) { + req, out := c.DeleteIdentityPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReceiptFilter = "DeleteReceiptFilter" @@ -846,8 +997,23 @@ func (c *SES) DeleteReceiptFilterRequest(input *DeleteReceiptFilterInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteReceiptFilter func (c *SES) DeleteReceiptFilter(input *DeleteReceiptFilterInput) (*DeleteReceiptFilterOutput, error) { req, out := c.DeleteReceiptFilterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReceiptFilterWithContext is the same as DeleteReceiptFilter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReceiptFilter 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 *SES) DeleteReceiptFilterWithContext(ctx aws.Context, input *DeleteReceiptFilterInput, opts ...request.Option) (*DeleteReceiptFilterOutput, error) { + req, out := c.DeleteReceiptFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReceiptRule = "DeleteReceiptRule" @@ -916,8 +1082,23 @@ func (c *SES) DeleteReceiptRuleRequest(input *DeleteReceiptRuleInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteReceiptRule func (c *SES) DeleteReceiptRule(input *DeleteReceiptRuleInput) (*DeleteReceiptRuleOutput, error) { req, out := c.DeleteReceiptRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReceiptRuleWithContext is the same as DeleteReceiptRule with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReceiptRule 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 *SES) DeleteReceiptRuleWithContext(ctx aws.Context, input *DeleteReceiptRuleInput, opts ...request.Option) (*DeleteReceiptRuleOutput, error) { + req, out := c.DeleteReceiptRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteReceiptRuleSet = "DeleteReceiptRuleSet" @@ -988,8 +1169,23 @@ func (c *SES) DeleteReceiptRuleSetRequest(input *DeleteReceiptRuleSetInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteReceiptRuleSet func (c *SES) DeleteReceiptRuleSet(input *DeleteReceiptRuleSetInput) (*DeleteReceiptRuleSetOutput, error) { req, out := c.DeleteReceiptRuleSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteReceiptRuleSetWithContext is the same as DeleteReceiptRuleSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteReceiptRuleSet 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 *SES) DeleteReceiptRuleSetWithContext(ctx aws.Context, input *DeleteReceiptRuleSetInput, opts ...request.Option) (*DeleteReceiptRuleSetOutput, error) { + req, out := c.DeleteReceiptRuleSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteVerifiedEmailAddress = "DeleteVerifiedEmailAddress" @@ -1055,8 +1251,23 @@ func (c *SES) DeleteVerifiedEmailAddressRequest(input *DeleteVerifiedEmailAddres // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DeleteVerifiedEmailAddress func (c *SES) DeleteVerifiedEmailAddress(input *DeleteVerifiedEmailAddressInput) (*DeleteVerifiedEmailAddressOutput, error) { req, out := c.DeleteVerifiedEmailAddressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteVerifiedEmailAddressWithContext is the same as DeleteVerifiedEmailAddress with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVerifiedEmailAddress 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 *SES) DeleteVerifiedEmailAddressWithContext(ctx aws.Context, input *DeleteVerifiedEmailAddressInput, opts ...request.Option) (*DeleteVerifiedEmailAddressOutput, error) { + req, out := c.DeleteVerifiedEmailAddressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeActiveReceiptRuleSet = "DescribeActiveReceiptRuleSet" @@ -1121,8 +1332,23 @@ func (c *SES) DescribeActiveReceiptRuleSetRequest(input *DescribeActiveReceiptRu // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DescribeActiveReceiptRuleSet func (c *SES) DescribeActiveReceiptRuleSet(input *DescribeActiveReceiptRuleSetInput) (*DescribeActiveReceiptRuleSetOutput, error) { req, out := c.DescribeActiveReceiptRuleSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeActiveReceiptRuleSetWithContext is the same as DescribeActiveReceiptRuleSet with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeActiveReceiptRuleSet 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 *SES) DescribeActiveReceiptRuleSetWithContext(ctx aws.Context, input *DescribeActiveReceiptRuleSetInput, opts ...request.Option) (*DescribeActiveReceiptRuleSetOutput, error) { + req, out := c.DescribeActiveReceiptRuleSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeConfigurationSet = "DescribeConfigurationSet" @@ -1191,8 +1417,23 @@ func (c *SES) DescribeConfigurationSetRequest(input *DescribeConfigurationSetInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DescribeConfigurationSet func (c *SES) DescribeConfigurationSet(input *DescribeConfigurationSetInput) (*DescribeConfigurationSetOutput, error) { req, out := c.DescribeConfigurationSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeConfigurationSetWithContext is the same as DescribeConfigurationSet with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeConfigurationSet 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 *SES) DescribeConfigurationSetWithContext(ctx aws.Context, input *DescribeConfigurationSetInput, opts ...request.Option) (*DescribeConfigurationSetOutput, error) { + req, out := c.DescribeConfigurationSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReceiptRule = "DescribeReceiptRule" @@ -1264,8 +1505,23 @@ func (c *SES) DescribeReceiptRuleRequest(input *DescribeReceiptRuleInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DescribeReceiptRule func (c *SES) DescribeReceiptRule(input *DescribeReceiptRuleInput) (*DescribeReceiptRuleOutput, error) { req, out := c.DescribeReceiptRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReceiptRuleWithContext is the same as DescribeReceiptRule with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReceiptRule 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 *SES) DescribeReceiptRuleWithContext(ctx aws.Context, input *DescribeReceiptRuleInput, opts ...request.Option) (*DescribeReceiptRuleOutput, error) { + req, out := c.DescribeReceiptRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeReceiptRuleSet = "DescribeReceiptRuleSet" @@ -1334,8 +1590,23 @@ func (c *SES) DescribeReceiptRuleSetRequest(input *DescribeReceiptRuleSetInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/DescribeReceiptRuleSet func (c *SES) DescribeReceiptRuleSet(input *DescribeReceiptRuleSetInput) (*DescribeReceiptRuleSetOutput, error) { req, out := c.DescribeReceiptRuleSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeReceiptRuleSetWithContext is the same as DescribeReceiptRuleSet with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeReceiptRuleSet 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 *SES) DescribeReceiptRuleSetWithContext(ctx aws.Context, input *DescribeReceiptRuleSetInput, opts ...request.Option) (*DescribeReceiptRuleSetOutput, error) { + req, out := c.DescribeReceiptRuleSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIdentityDkimAttributes = "GetIdentityDkimAttributes" @@ -1415,8 +1686,23 @@ func (c *SES) GetIdentityDkimAttributesRequest(input *GetIdentityDkimAttributesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/GetIdentityDkimAttributes func (c *SES) GetIdentityDkimAttributes(input *GetIdentityDkimAttributesInput) (*GetIdentityDkimAttributesOutput, error) { req, out := c.GetIdentityDkimAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIdentityDkimAttributesWithContext is the same as GetIdentityDkimAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetIdentityDkimAttributes 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 *SES) GetIdentityDkimAttributesWithContext(ctx aws.Context, input *GetIdentityDkimAttributesInput, opts ...request.Option) (*GetIdentityDkimAttributesOutput, error) { + req, out := c.GetIdentityDkimAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIdentityMailFromDomainAttributes = "GetIdentityMailFromDomainAttributes" @@ -1479,8 +1765,23 @@ func (c *SES) GetIdentityMailFromDomainAttributesRequest(input *GetIdentityMailF // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/GetIdentityMailFromDomainAttributes func (c *SES) GetIdentityMailFromDomainAttributes(input *GetIdentityMailFromDomainAttributesInput) (*GetIdentityMailFromDomainAttributesOutput, error) { req, out := c.GetIdentityMailFromDomainAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIdentityMailFromDomainAttributesWithContext is the same as GetIdentityMailFromDomainAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetIdentityMailFromDomainAttributes 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 *SES) GetIdentityMailFromDomainAttributesWithContext(ctx aws.Context, input *GetIdentityMailFromDomainAttributesInput, opts ...request.Option) (*GetIdentityMailFromDomainAttributesOutput, error) { + req, out := c.GetIdentityMailFromDomainAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIdentityNotificationAttributes = "GetIdentityNotificationAttributes" @@ -1546,8 +1847,23 @@ func (c *SES) GetIdentityNotificationAttributesRequest(input *GetIdentityNotific // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/GetIdentityNotificationAttributes func (c *SES) GetIdentityNotificationAttributes(input *GetIdentityNotificationAttributesInput) (*GetIdentityNotificationAttributesOutput, error) { req, out := c.GetIdentityNotificationAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIdentityNotificationAttributesWithContext is the same as GetIdentityNotificationAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetIdentityNotificationAttributes 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 *SES) GetIdentityNotificationAttributesWithContext(ctx aws.Context, input *GetIdentityNotificationAttributesInput, opts ...request.Option) (*GetIdentityNotificationAttributesOutput, error) { + req, out := c.GetIdentityNotificationAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIdentityPolicies = "GetIdentityPolicies" @@ -1618,8 +1934,23 @@ func (c *SES) GetIdentityPoliciesRequest(input *GetIdentityPoliciesInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/GetIdentityPolicies func (c *SES) GetIdentityPolicies(input *GetIdentityPoliciesInput) (*GetIdentityPoliciesOutput, error) { req, out := c.GetIdentityPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIdentityPoliciesWithContext is the same as GetIdentityPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See GetIdentityPolicies 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 *SES) GetIdentityPoliciesWithContext(ctx aws.Context, input *GetIdentityPoliciesInput, opts ...request.Option) (*GetIdentityPoliciesOutput, error) { + req, out := c.GetIdentityPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIdentityVerificationAttributes = "GetIdentityVerificationAttributes" @@ -1683,8 +2014,23 @@ func (c *SES) GetIdentityVerificationAttributesRequest(input *GetIdentityVerific // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/GetIdentityVerificationAttributes func (c *SES) GetIdentityVerificationAttributes(input *GetIdentityVerificationAttributesInput) (*GetIdentityVerificationAttributesOutput, error) { req, out := c.GetIdentityVerificationAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIdentityVerificationAttributesWithContext is the same as GetIdentityVerificationAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetIdentityVerificationAttributes 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 *SES) GetIdentityVerificationAttributesWithContext(ctx aws.Context, input *GetIdentityVerificationAttributesInput, opts ...request.Option) (*GetIdentityVerificationAttributesOutput, error) { + req, out := c.GetIdentityVerificationAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSendQuota = "GetSendQuota" @@ -1745,8 +2091,23 @@ func (c *SES) GetSendQuotaRequest(input *GetSendQuotaInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/GetSendQuota func (c *SES) GetSendQuota(input *GetSendQuotaInput) (*GetSendQuotaOutput, error) { req, out := c.GetSendQuotaRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSendQuotaWithContext is the same as GetSendQuota with the addition of +// the ability to pass a context and additional request options. +// +// See GetSendQuota 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 *SES) GetSendQuotaWithContext(ctx aws.Context, input *GetSendQuotaInput, opts ...request.Option) (*GetSendQuotaOutput, error) { + req, out := c.GetSendQuotaRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSendStatistics = "GetSendStatistics" @@ -1810,8 +2171,23 @@ func (c *SES) GetSendStatisticsRequest(input *GetSendStatisticsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/GetSendStatistics func (c *SES) GetSendStatistics(input *GetSendStatisticsInput) (*GetSendStatisticsOutput, error) { req, out := c.GetSendStatisticsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSendStatisticsWithContext is the same as GetSendStatistics with the addition of +// the ability to pass a context and additional request options. +// +// See GetSendStatistics 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 *SES) GetSendStatisticsWithContext(ctx aws.Context, input *GetSendStatisticsInput, opts ...request.Option) (*GetSendStatisticsOutput, error) { + req, out := c.GetSendStatisticsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListConfigurationSets = "ListConfigurationSets" @@ -1876,8 +2252,23 @@ func (c *SES) ListConfigurationSetsRequest(input *ListConfigurationSetsInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/ListConfigurationSets func (c *SES) ListConfigurationSets(input *ListConfigurationSetsInput) (*ListConfigurationSetsOutput, error) { req, out := c.ListConfigurationSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListConfigurationSetsWithContext is the same as ListConfigurationSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListConfigurationSets 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 *SES) ListConfigurationSetsWithContext(ctx aws.Context, input *ListConfigurationSetsInput, opts ...request.Option) (*ListConfigurationSetsOutput, error) { + req, out := c.ListConfigurationSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListIdentities = "ListIdentities" @@ -1945,8 +2336,23 @@ func (c *SES) ListIdentitiesRequest(input *ListIdentitiesInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/ListIdentities func (c *SES) ListIdentities(input *ListIdentitiesInput) (*ListIdentitiesOutput, error) { req, out := c.ListIdentitiesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListIdentitiesWithContext is the same as ListIdentities with the addition of +// the ability to pass a context and additional request options. +// +// See ListIdentities 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 *SES) ListIdentitiesWithContext(ctx aws.Context, input *ListIdentitiesInput, opts ...request.Option) (*ListIdentitiesOutput, error) { + req, out := c.ListIdentitiesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListIdentitiesPages iterates over the pages of a ListIdentities operation, @@ -1966,12 +2372,37 @@ func (c *SES) ListIdentities(input *ListIdentitiesInput) (*ListIdentitiesOutput, // return pageNum <= 3 // }) // -func (c *SES) ListIdentitiesPages(input *ListIdentitiesInput, fn func(p *ListIdentitiesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListIdentitiesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListIdentitiesOutput), lastPage) - }) +func (c *SES) ListIdentitiesPages(input *ListIdentitiesInput, fn func(*ListIdentitiesOutput, bool) bool) error { + return c.ListIdentitiesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListIdentitiesPagesWithContext same as ListIdentitiesPages 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 *SES) ListIdentitiesPagesWithContext(ctx aws.Context, input *ListIdentitiesInput, fn func(*ListIdentitiesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListIdentitiesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListIdentitiesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListIdentitiesOutput), !p.HasNextPage()) + } + return p.Err() } const opListIdentityPolicies = "ListIdentityPolicies" @@ -2041,8 +2472,23 @@ func (c *SES) ListIdentityPoliciesRequest(input *ListIdentityPoliciesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/ListIdentityPolicies func (c *SES) ListIdentityPolicies(input *ListIdentityPoliciesInput) (*ListIdentityPoliciesOutput, error) { req, out := c.ListIdentityPoliciesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListIdentityPoliciesWithContext is the same as ListIdentityPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See ListIdentityPolicies 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 *SES) ListIdentityPoliciesWithContext(ctx aws.Context, input *ListIdentityPoliciesInput, opts ...request.Option) (*ListIdentityPoliciesOutput, error) { + req, out := c.ListIdentityPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListReceiptFilters = "ListReceiptFilters" @@ -2106,8 +2552,23 @@ func (c *SES) ListReceiptFiltersRequest(input *ListReceiptFiltersInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/ListReceiptFilters func (c *SES) ListReceiptFilters(input *ListReceiptFiltersInput) (*ListReceiptFiltersOutput, error) { req, out := c.ListReceiptFiltersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListReceiptFiltersWithContext is the same as ListReceiptFilters with the addition of +// the ability to pass a context and additional request options. +// +// See ListReceiptFilters 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 *SES) ListReceiptFiltersWithContext(ctx aws.Context, input *ListReceiptFiltersInput, opts ...request.Option) (*ListReceiptFiltersOutput, error) { + req, out := c.ListReceiptFiltersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListReceiptRuleSets = "ListReceiptRuleSets" @@ -2174,8 +2635,23 @@ func (c *SES) ListReceiptRuleSetsRequest(input *ListReceiptRuleSetsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/ListReceiptRuleSets func (c *SES) ListReceiptRuleSets(input *ListReceiptRuleSetsInput) (*ListReceiptRuleSetsOutput, error) { req, out := c.ListReceiptRuleSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListReceiptRuleSetsWithContext is the same as ListReceiptRuleSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListReceiptRuleSets 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 *SES) ListReceiptRuleSetsWithContext(ctx aws.Context, input *ListReceiptRuleSetsInput, opts ...request.Option) (*ListReceiptRuleSetsOutput, error) { + req, out := c.ListReceiptRuleSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListVerifiedEmailAddresses = "ListVerifiedEmailAddresses" @@ -2239,8 +2715,23 @@ func (c *SES) ListVerifiedEmailAddressesRequest(input *ListVerifiedEmailAddresse // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/ListVerifiedEmailAddresses func (c *SES) ListVerifiedEmailAddresses(input *ListVerifiedEmailAddressesInput) (*ListVerifiedEmailAddressesOutput, error) { req, out := c.ListVerifiedEmailAddressesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListVerifiedEmailAddressesWithContext is the same as ListVerifiedEmailAddresses with the addition of +// the ability to pass a context and additional request options. +// +// See ListVerifiedEmailAddresses 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 *SES) ListVerifiedEmailAddressesWithContext(ctx aws.Context, input *ListVerifiedEmailAddressesInput, opts ...request.Option) (*ListVerifiedEmailAddressesOutput, error) { + req, out := c.ListVerifiedEmailAddressesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutIdentityPolicy = "PutIdentityPolicy" @@ -2315,8 +2806,23 @@ func (c *SES) PutIdentityPolicyRequest(input *PutIdentityPolicyInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/PutIdentityPolicy func (c *SES) PutIdentityPolicy(input *PutIdentityPolicyInput) (*PutIdentityPolicyOutput, error) { req, out := c.PutIdentityPolicyRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutIdentityPolicyWithContext is the same as PutIdentityPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutIdentityPolicy 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 *SES) PutIdentityPolicyWithContext(ctx aws.Context, input *PutIdentityPolicyInput, opts ...request.Option) (*PutIdentityPolicyOutput, error) { + req, out := c.PutIdentityPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReorderReceiptRuleSet = "ReorderReceiptRuleSet" @@ -2392,8 +2898,23 @@ func (c *SES) ReorderReceiptRuleSetRequest(input *ReorderReceiptRuleSetInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/ReorderReceiptRuleSet func (c *SES) ReorderReceiptRuleSet(input *ReorderReceiptRuleSetInput) (*ReorderReceiptRuleSetOutput, error) { req, out := c.ReorderReceiptRuleSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReorderReceiptRuleSetWithContext is the same as ReorderReceiptRuleSet with the addition of +// the ability to pass a context and additional request options. +// +// See ReorderReceiptRuleSet 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 *SES) ReorderReceiptRuleSetWithContext(ctx aws.Context, input *ReorderReceiptRuleSetInput, opts ...request.Option) (*ReorderReceiptRuleSetOutput, error) { + req, out := c.ReorderReceiptRuleSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendBounce = "SendBounce" @@ -2468,8 +2989,23 @@ func (c *SES) SendBounceRequest(input *SendBounceInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SendBounce func (c *SES) SendBounce(input *SendBounceInput) (*SendBounceOutput, error) { req, out := c.SendBounceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendBounceWithContext is the same as SendBounce with the addition of +// the ability to pass a context and additional request options. +// +// See SendBounce 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 *SES) SendBounceWithContext(ctx aws.Context, input *SendBounceInput, opts ...request.Option) (*SendBounceOutput, error) { + req, out := c.SendBounceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendEmail = "SendEmail" @@ -2567,8 +3103,23 @@ func (c *SES) SendEmailRequest(input *SendEmailInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SendEmail func (c *SES) SendEmail(input *SendEmailInput) (*SendEmailOutput, error) { req, out := c.SendEmailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendEmailWithContext is the same as SendEmail with the addition of +// the ability to pass a context and additional request options. +// +// See SendEmail 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 *SES) SendEmailWithContext(ctx aws.Context, input *SendEmailInput, opts ...request.Option) (*SendEmailOutput, error) { + req, out := c.SendEmailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendRawEmail = "SendRawEmail" @@ -2698,8 +3249,23 @@ func (c *SES) SendRawEmailRequest(input *SendRawEmailInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SendRawEmail func (c *SES) SendRawEmail(input *SendRawEmailInput) (*SendRawEmailOutput, error) { req, out := c.SendRawEmailRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendRawEmailWithContext is the same as SendRawEmail with the addition of +// the ability to pass a context and additional request options. +// +// See SendRawEmail 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 *SES) SendRawEmailWithContext(ctx aws.Context, input *SendRawEmailInput, opts ...request.Option) (*SendRawEmailOutput, error) { + req, out := c.SendRawEmailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetActiveReceiptRuleSet = "SetActiveReceiptRuleSet" @@ -2771,8 +3337,23 @@ func (c *SES) SetActiveReceiptRuleSetRequest(input *SetActiveReceiptRuleSetInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SetActiveReceiptRuleSet func (c *SES) SetActiveReceiptRuleSet(input *SetActiveReceiptRuleSetInput) (*SetActiveReceiptRuleSetOutput, error) { req, out := c.SetActiveReceiptRuleSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetActiveReceiptRuleSetWithContext is the same as SetActiveReceiptRuleSet with the addition of +// the ability to pass a context and additional request options. +// +// See SetActiveReceiptRuleSet 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 *SES) SetActiveReceiptRuleSetWithContext(ctx aws.Context, input *SetActiveReceiptRuleSetInput, opts ...request.Option) (*SetActiveReceiptRuleSetOutput, error) { + req, out := c.SetActiveReceiptRuleSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetIdentityDkimEnabled = "SetIdentityDkimEnabled" @@ -2847,8 +3428,23 @@ func (c *SES) SetIdentityDkimEnabledRequest(input *SetIdentityDkimEnabledInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SetIdentityDkimEnabled func (c *SES) SetIdentityDkimEnabled(input *SetIdentityDkimEnabledInput) (*SetIdentityDkimEnabledOutput, error) { req, out := c.SetIdentityDkimEnabledRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetIdentityDkimEnabledWithContext is the same as SetIdentityDkimEnabled with the addition of +// the ability to pass a context and additional request options. +// +// See SetIdentityDkimEnabled 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 *SES) SetIdentityDkimEnabledWithContext(ctx aws.Context, input *SetIdentityDkimEnabledInput, opts ...request.Option) (*SetIdentityDkimEnabledOutput, error) { + req, out := c.SetIdentityDkimEnabledRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetIdentityFeedbackForwardingEnabled = "SetIdentityFeedbackForwardingEnabled" @@ -2918,8 +3514,23 @@ func (c *SES) SetIdentityFeedbackForwardingEnabledRequest(input *SetIdentityFeed // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SetIdentityFeedbackForwardingEnabled func (c *SES) SetIdentityFeedbackForwardingEnabled(input *SetIdentityFeedbackForwardingEnabledInput) (*SetIdentityFeedbackForwardingEnabledOutput, error) { req, out := c.SetIdentityFeedbackForwardingEnabledRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetIdentityFeedbackForwardingEnabledWithContext is the same as SetIdentityFeedbackForwardingEnabled with the addition of +// the ability to pass a context and additional request options. +// +// See SetIdentityFeedbackForwardingEnabled 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 *SES) SetIdentityFeedbackForwardingEnabledWithContext(ctx aws.Context, input *SetIdentityFeedbackForwardingEnabledInput, opts ...request.Option) (*SetIdentityFeedbackForwardingEnabledOutput, error) { + req, out := c.SetIdentityFeedbackForwardingEnabledRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetIdentityHeadersInNotificationsEnabled = "SetIdentityHeadersInNotificationsEnabled" @@ -2985,8 +3596,23 @@ func (c *SES) SetIdentityHeadersInNotificationsEnabledRequest(input *SetIdentity // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SetIdentityHeadersInNotificationsEnabled func (c *SES) SetIdentityHeadersInNotificationsEnabled(input *SetIdentityHeadersInNotificationsEnabledInput) (*SetIdentityHeadersInNotificationsEnabledOutput, error) { req, out := c.SetIdentityHeadersInNotificationsEnabledRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetIdentityHeadersInNotificationsEnabledWithContext is the same as SetIdentityHeadersInNotificationsEnabled with the addition of +// the ability to pass a context and additional request options. +// +// See SetIdentityHeadersInNotificationsEnabled 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 *SES) SetIdentityHeadersInNotificationsEnabledWithContext(ctx aws.Context, input *SetIdentityHeadersInNotificationsEnabledInput, opts ...request.Option) (*SetIdentityHeadersInNotificationsEnabledOutput, error) { + req, out := c.SetIdentityHeadersInNotificationsEnabledRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetIdentityMailFromDomain = "SetIdentityMailFromDomain" @@ -3053,8 +3679,23 @@ func (c *SES) SetIdentityMailFromDomainRequest(input *SetIdentityMailFromDomainI // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SetIdentityMailFromDomain func (c *SES) SetIdentityMailFromDomain(input *SetIdentityMailFromDomainInput) (*SetIdentityMailFromDomainOutput, error) { req, out := c.SetIdentityMailFromDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetIdentityMailFromDomainWithContext is the same as SetIdentityMailFromDomain with the addition of +// the ability to pass a context and additional request options. +// +// See SetIdentityMailFromDomain 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 *SES) SetIdentityMailFromDomainWithContext(ctx aws.Context, input *SetIdentityMailFromDomainInput, opts ...request.Option) (*SetIdentityMailFromDomainOutput, error) { + req, out := c.SetIdentityMailFromDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetIdentityNotificationTopic = "SetIdentityNotificationTopic" @@ -3124,8 +3765,23 @@ func (c *SES) SetIdentityNotificationTopicRequest(input *SetIdentityNotification // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SetIdentityNotificationTopic func (c *SES) SetIdentityNotificationTopic(input *SetIdentityNotificationTopicInput) (*SetIdentityNotificationTopicOutput, error) { req, out := c.SetIdentityNotificationTopicRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetIdentityNotificationTopicWithContext is the same as SetIdentityNotificationTopic with the addition of +// the ability to pass a context and additional request options. +// +// See SetIdentityNotificationTopic 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 *SES) SetIdentityNotificationTopicWithContext(ctx aws.Context, input *SetIdentityNotificationTopicInput, opts ...request.Option) (*SetIdentityNotificationTopicOutput, error) { + req, out := c.SetIdentityNotificationTopicRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetReceiptRulePosition = "SetReceiptRulePosition" @@ -3197,8 +3853,23 @@ func (c *SES) SetReceiptRulePositionRequest(input *SetReceiptRulePositionInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/SetReceiptRulePosition func (c *SES) SetReceiptRulePosition(input *SetReceiptRulePositionInput) (*SetReceiptRulePositionOutput, error) { req, out := c.SetReceiptRulePositionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetReceiptRulePositionWithContext is the same as SetReceiptRulePosition with the addition of +// the ability to pass a context and additional request options. +// +// See SetReceiptRulePosition 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 *SES) SetReceiptRulePositionWithContext(ctx aws.Context, input *SetReceiptRulePositionInput, opts ...request.Option) (*SetReceiptRulePositionOutput, error) { + req, out := c.SetReceiptRulePositionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateConfigurationSetEventDestination = "UpdateConfigurationSetEventDestination" @@ -3284,8 +3955,23 @@ func (c *SES) UpdateConfigurationSetEventDestinationRequest(input *UpdateConfigu // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/UpdateConfigurationSetEventDestination func (c *SES) UpdateConfigurationSetEventDestination(input *UpdateConfigurationSetEventDestinationInput) (*UpdateConfigurationSetEventDestinationOutput, error) { req, out := c.UpdateConfigurationSetEventDestinationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateConfigurationSetEventDestinationWithContext is the same as UpdateConfigurationSetEventDestination with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateConfigurationSetEventDestination 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 *SES) UpdateConfigurationSetEventDestinationWithContext(ctx aws.Context, input *UpdateConfigurationSetEventDestinationInput, opts ...request.Option) (*UpdateConfigurationSetEventDestinationOutput, error) { + req, out := c.UpdateConfigurationSetEventDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateReceiptRule = "UpdateReceiptRule" @@ -3378,8 +4064,23 @@ func (c *SES) UpdateReceiptRuleRequest(input *UpdateReceiptRuleInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/UpdateReceiptRule func (c *SES) UpdateReceiptRule(input *UpdateReceiptRuleInput) (*UpdateReceiptRuleOutput, error) { req, out := c.UpdateReceiptRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateReceiptRuleWithContext is the same as UpdateReceiptRule with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateReceiptRule 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 *SES) UpdateReceiptRuleWithContext(ctx aws.Context, input *UpdateReceiptRuleInput, opts ...request.Option) (*UpdateReceiptRuleOutput, error) { + req, out := c.UpdateReceiptRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opVerifyDomainDkim = "VerifyDomainDkim" @@ -3452,8 +4153,23 @@ func (c *SES) VerifyDomainDkimRequest(input *VerifyDomainDkimInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/VerifyDomainDkim func (c *SES) VerifyDomainDkim(input *VerifyDomainDkimInput) (*VerifyDomainDkimOutput, error) { req, out := c.VerifyDomainDkimRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// VerifyDomainDkimWithContext is the same as VerifyDomainDkim with the addition of +// the ability to pass a context and additional request options. +// +// See VerifyDomainDkim 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 *SES) VerifyDomainDkimWithContext(ctx aws.Context, input *VerifyDomainDkimInput, opts ...request.Option) (*VerifyDomainDkimOutput, error) { + req, out := c.VerifyDomainDkimRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opVerifyDomainIdentity = "VerifyDomainIdentity" @@ -3514,8 +4230,23 @@ func (c *SES) VerifyDomainIdentityRequest(input *VerifyDomainIdentityInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/VerifyDomainIdentity func (c *SES) VerifyDomainIdentity(input *VerifyDomainIdentityInput) (*VerifyDomainIdentityOutput, error) { req, out := c.VerifyDomainIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// VerifyDomainIdentityWithContext is the same as VerifyDomainIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See VerifyDomainIdentity 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 *SES) VerifyDomainIdentityWithContext(ctx aws.Context, input *VerifyDomainIdentityInput, opts ...request.Option) (*VerifyDomainIdentityOutput, error) { + req, out := c.VerifyDomainIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opVerifyEmailAddress = "VerifyEmailAddress" @@ -3582,8 +4313,23 @@ func (c *SES) VerifyEmailAddressRequest(input *VerifyEmailAddressInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/VerifyEmailAddress func (c *SES) VerifyEmailAddress(input *VerifyEmailAddressInput) (*VerifyEmailAddressOutput, error) { req, out := c.VerifyEmailAddressRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// VerifyEmailAddressWithContext is the same as VerifyEmailAddress with the addition of +// the ability to pass a context and additional request options. +// +// See VerifyEmailAddress 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 *SES) VerifyEmailAddressWithContext(ctx aws.Context, input *VerifyEmailAddressInput, opts ...request.Option) (*VerifyEmailAddressOutput, error) { + req, out := c.VerifyEmailAddressRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opVerifyEmailIdentity = "VerifyEmailIdentity" @@ -3645,8 +4391,23 @@ func (c *SES) VerifyEmailIdentityRequest(input *VerifyEmailIdentityInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/VerifyEmailIdentity func (c *SES) VerifyEmailIdentity(input *VerifyEmailIdentityInput) (*VerifyEmailIdentityOutput, error) { req, out := c.VerifyEmailIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// VerifyEmailIdentityWithContext is the same as VerifyEmailIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See VerifyEmailIdentity 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 *SES) VerifyEmailIdentityWithContext(ctx aws.Context, input *VerifyEmailIdentityInput, opts ...request.Option) (*VerifyEmailIdentityOutput, error) { + req, out := c.VerifyEmailIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // When included in a receipt rule, this action adds a header to the received diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/errors.go index 704f87e6ae..ef5f15819a 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ses diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/service.go index 187c1d6af4..25b20e0614 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ses diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/waiters.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/waiters.go index bf79344b80..6597b6b77d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ses/waiters.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ses/waiters.go @@ -1,9 +1,12 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ses import ( - "github.com/aws/aws-sdk-go/private/waiter" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" ) // WaitUntilIdentityExists uses the Amazon SES API operation @@ -11,24 +14,43 @@ import ( // If the condition is not meet within the max attempt window an error will // be returned. func (c *SES) WaitUntilIdentityExists(input *GetIdentityVerificationAttributesInput) error { - waiterCfg := waiter.Config{ - Operation: "GetIdentityVerificationAttributes", - Delay: 3, + return c.WaitUntilIdentityExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilIdentityExistsWithContext is an extended version of WaitUntilIdentityExists. +// 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 *SES) WaitUntilIdentityExistsWithContext(ctx aws.Context, input *GetIdentityVerificationAttributesInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilIdentityExists", MaxAttempts: 20, - Acceptors: []waiter.WaitAcceptor{ + Delay: request.ConstantWaiterDelay(3 * time.Second), + Acceptors: []request.WaiterAcceptor{ { - State: "success", - Matcher: "pathAll", - Argument: "VerificationAttributes.*.VerificationStatus", + State: request.SuccessWaiterState, + Matcher: request.PathAllWaiterMatch, Argument: "VerificationAttributes.*.VerificationStatus", Expected: "Success", }, }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *GetIdentityVerificationAttributesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetIdentityVerificationAttributesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, } + w.ApplyOptions(opts...) - w := waiter.Waiter{ - Client: c, - Input: input, - Config: waiterCfg, - } - return w.Wait() + return w.WaitWithContext(ctx) } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/api.go index c6b207e1c8..701c3fbfb3 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package sfn provides a client for AWS Step Functions. package sfn @@ -6,6 +6,7 @@ package sfn import ( "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" ) @@ -75,8 +76,23 @@ func (c *SFN) CreateActivityRequest(input *CreateActivityInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/CreateActivity func (c *SFN) CreateActivity(input *CreateActivityInput) (*CreateActivityOutput, error) { req, out := c.CreateActivityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateActivityWithContext is the same as CreateActivity with the addition of +// the ability to pass a context and additional request options. +// +// See CreateActivity 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 *SFN) CreateActivityWithContext(ctx aws.Context, input *CreateActivityInput, opts ...request.Option) (*CreateActivityOutput, error) { + req, out := c.CreateActivityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateStateMachine = "CreateStateMachine" @@ -157,8 +173,23 @@ func (c *SFN) CreateStateMachineRequest(input *CreateStateMachineInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/CreateStateMachine func (c *SFN) CreateStateMachine(input *CreateStateMachineInput) (*CreateStateMachineOutput, error) { req, out := c.CreateStateMachineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateStateMachineWithContext is the same as CreateStateMachine with the addition of +// the ability to pass a context and additional request options. +// +// See CreateStateMachine 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 *SFN) CreateStateMachineWithContext(ctx aws.Context, input *CreateStateMachineInput, opts ...request.Option) (*CreateStateMachineOutput, error) { + req, out := c.CreateStateMachineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteActivity = "DeleteActivity" @@ -222,8 +253,23 @@ func (c *SFN) DeleteActivityRequest(input *DeleteActivityInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/DeleteActivity func (c *SFN) DeleteActivity(input *DeleteActivityInput) (*DeleteActivityOutput, error) { req, out := c.DeleteActivityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteActivityWithContext is the same as DeleteActivity with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteActivity 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 *SFN) DeleteActivityWithContext(ctx aws.Context, input *DeleteActivityInput, opts ...request.Option) (*DeleteActivityOutput, error) { + req, out := c.DeleteActivityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteStateMachine = "DeleteStateMachine" @@ -288,8 +334,23 @@ func (c *SFN) DeleteStateMachineRequest(input *DeleteStateMachineInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/DeleteStateMachine func (c *SFN) DeleteStateMachine(input *DeleteStateMachineInput) (*DeleteStateMachineOutput, error) { req, out := c.DeleteStateMachineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteStateMachineWithContext is the same as DeleteStateMachine with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteStateMachine 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 *SFN) DeleteStateMachineWithContext(ctx aws.Context, input *DeleteStateMachineInput, opts ...request.Option) (*DeleteStateMachineOutput, error) { + req, out := c.DeleteStateMachineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeActivity = "DescribeActivity" @@ -356,8 +417,23 @@ func (c *SFN) DescribeActivityRequest(input *DescribeActivityInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/DescribeActivity func (c *SFN) DescribeActivity(input *DescribeActivityInput) (*DescribeActivityOutput, error) { req, out := c.DescribeActivityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeActivityWithContext is the same as DescribeActivity with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeActivity 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 *SFN) DescribeActivityWithContext(ctx aws.Context, input *DescribeActivityInput, opts ...request.Option) (*DescribeActivityOutput, error) { + req, out := c.DescribeActivityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeExecution = "DescribeExecution" @@ -424,8 +500,23 @@ func (c *SFN) DescribeExecutionRequest(input *DescribeExecutionInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/DescribeExecution func (c *SFN) DescribeExecution(input *DescribeExecutionInput) (*DescribeExecutionOutput, error) { req, out := c.DescribeExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeExecutionWithContext is the same as DescribeExecution with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeExecution 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 *SFN) DescribeExecutionWithContext(ctx aws.Context, input *DescribeExecutionInput, opts ...request.Option) (*DescribeExecutionOutput, error) { + req, out := c.DescribeExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeStateMachine = "DescribeStateMachine" @@ -492,8 +583,23 @@ func (c *SFN) DescribeStateMachineRequest(input *DescribeStateMachineInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/DescribeStateMachine func (c *SFN) DescribeStateMachine(input *DescribeStateMachineInput) (*DescribeStateMachineOutput, error) { req, out := c.DescribeStateMachineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeStateMachineWithContext is the same as DescribeStateMachine with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeStateMachine 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 *SFN) DescribeStateMachineWithContext(ctx aws.Context, input *DescribeStateMachineInput, opts ...request.Option) (*DescribeStateMachineOutput, error) { + req, out := c.DescribeStateMachineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetActivityTask = "GetActivityTask" @@ -573,8 +679,23 @@ func (c *SFN) GetActivityTaskRequest(input *GetActivityTaskInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/GetActivityTask func (c *SFN) GetActivityTask(input *GetActivityTaskInput) (*GetActivityTaskOutput, error) { req, out := c.GetActivityTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetActivityTaskWithContext is the same as GetActivityTask with the addition of +// the ability to pass a context and additional request options. +// +// See GetActivityTask 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 *SFN) GetActivityTaskWithContext(ctx aws.Context, input *GetActivityTaskInput, opts ...request.Option) (*GetActivityTaskOutput, error) { + req, out := c.GetActivityTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetExecutionHistory = "GetExecutionHistory" @@ -654,8 +775,23 @@ func (c *SFN) GetExecutionHistoryRequest(input *GetExecutionHistoryInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/GetExecutionHistory func (c *SFN) GetExecutionHistory(input *GetExecutionHistoryInput) (*GetExecutionHistoryOutput, error) { req, out := c.GetExecutionHistoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetExecutionHistoryWithContext is the same as GetExecutionHistory with the addition of +// the ability to pass a context and additional request options. +// +// See GetExecutionHistory 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 *SFN) GetExecutionHistoryWithContext(ctx aws.Context, input *GetExecutionHistoryInput, opts ...request.Option) (*GetExecutionHistoryOutput, error) { + req, out := c.GetExecutionHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // GetExecutionHistoryPages iterates over the pages of a GetExecutionHistory operation, @@ -675,12 +811,37 @@ func (c *SFN) GetExecutionHistory(input *GetExecutionHistoryInput) (*GetExecutio // return pageNum <= 3 // }) // -func (c *SFN) GetExecutionHistoryPages(input *GetExecutionHistoryInput, fn func(p *GetExecutionHistoryOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.GetExecutionHistoryRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*GetExecutionHistoryOutput), lastPage) - }) +func (c *SFN) GetExecutionHistoryPages(input *GetExecutionHistoryInput, fn func(*GetExecutionHistoryOutput, bool) bool) error { + return c.GetExecutionHistoryPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetExecutionHistoryPagesWithContext same as GetExecutionHistoryPages 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 *SFN) GetExecutionHistoryPagesWithContext(ctx aws.Context, input *GetExecutionHistoryInput, fn func(*GetExecutionHistoryOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetExecutionHistoryInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetExecutionHistoryRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetExecutionHistoryOutput), !p.HasNextPage()) + } + return p.Err() } const opListActivities = "ListActivities" @@ -752,8 +913,23 @@ func (c *SFN) ListActivitiesRequest(input *ListActivitiesInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/ListActivities func (c *SFN) ListActivities(input *ListActivitiesInput) (*ListActivitiesOutput, error) { req, out := c.ListActivitiesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListActivitiesWithContext is the same as ListActivities with the addition of +// the ability to pass a context and additional request options. +// +// See ListActivities 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 *SFN) ListActivitiesWithContext(ctx aws.Context, input *ListActivitiesInput, opts ...request.Option) (*ListActivitiesOutput, error) { + req, out := c.ListActivitiesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListActivitiesPages iterates over the pages of a ListActivities operation, @@ -773,12 +949,37 @@ func (c *SFN) ListActivities(input *ListActivitiesInput) (*ListActivitiesOutput, // return pageNum <= 3 // }) // -func (c *SFN) ListActivitiesPages(input *ListActivitiesInput, fn func(p *ListActivitiesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListActivitiesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListActivitiesOutput), lastPage) - }) +func (c *SFN) ListActivitiesPages(input *ListActivitiesInput, fn func(*ListActivitiesOutput, bool) bool) error { + return c.ListActivitiesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListActivitiesPagesWithContext same as ListActivitiesPages 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 *SFN) ListActivitiesPagesWithContext(ctx aws.Context, input *ListActivitiesInput, fn func(*ListActivitiesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListActivitiesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListActivitiesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListActivitiesOutput), !p.HasNextPage()) + } + return p.Err() } const opListExecutions = "ListExecutions" @@ -856,8 +1057,23 @@ func (c *SFN) ListExecutionsRequest(input *ListExecutionsInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/ListExecutions func (c *SFN) ListExecutions(input *ListExecutionsInput) (*ListExecutionsOutput, error) { req, out := c.ListExecutionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListExecutionsWithContext is the same as ListExecutions with the addition of +// the ability to pass a context and additional request options. +// +// See ListExecutions 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 *SFN) ListExecutionsWithContext(ctx aws.Context, input *ListExecutionsInput, opts ...request.Option) (*ListExecutionsOutput, error) { + req, out := c.ListExecutionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListExecutionsPages iterates over the pages of a ListExecutions operation, @@ -877,12 +1093,37 @@ func (c *SFN) ListExecutions(input *ListExecutionsInput) (*ListExecutionsOutput, // return pageNum <= 3 // }) // -func (c *SFN) ListExecutionsPages(input *ListExecutionsInput, fn func(p *ListExecutionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListExecutionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListExecutionsOutput), lastPage) - }) +func (c *SFN) ListExecutionsPages(input *ListExecutionsInput, fn func(*ListExecutionsOutput, bool) bool) error { + return c.ListExecutionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListExecutionsPagesWithContext same as ListExecutionsPages 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 *SFN) ListExecutionsPagesWithContext(ctx aws.Context, input *ListExecutionsInput, fn func(*ListExecutionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListExecutionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListExecutionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListExecutionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListStateMachines = "ListStateMachines" @@ -954,8 +1195,23 @@ func (c *SFN) ListStateMachinesRequest(input *ListStateMachinesInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/ListStateMachines func (c *SFN) ListStateMachines(input *ListStateMachinesInput) (*ListStateMachinesOutput, error) { req, out := c.ListStateMachinesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListStateMachinesWithContext is the same as ListStateMachines with the addition of +// the ability to pass a context and additional request options. +// +// See ListStateMachines 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 *SFN) ListStateMachinesWithContext(ctx aws.Context, input *ListStateMachinesInput, opts ...request.Option) (*ListStateMachinesOutput, error) { + req, out := c.ListStateMachinesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListStateMachinesPages iterates over the pages of a ListStateMachines operation, @@ -975,12 +1231,37 @@ func (c *SFN) ListStateMachines(input *ListStateMachinesInput) (*ListStateMachin // return pageNum <= 3 // }) // -func (c *SFN) ListStateMachinesPages(input *ListStateMachinesInput, fn func(p *ListStateMachinesOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListStateMachinesRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListStateMachinesOutput), lastPage) - }) +func (c *SFN) ListStateMachinesPages(input *ListStateMachinesInput, fn func(*ListStateMachinesOutput, bool) bool) error { + return c.ListStateMachinesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListStateMachinesPagesWithContext same as ListStateMachinesPages 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 *SFN) ListStateMachinesPagesWithContext(ctx aws.Context, input *ListStateMachinesInput, fn func(*ListStateMachinesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListStateMachinesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListStateMachinesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListStateMachinesOutput), !p.HasNextPage()) + } + return p.Err() } const opSendTaskFailure = "SendTaskFailure" @@ -1048,8 +1329,23 @@ func (c *SFN) SendTaskFailureRequest(input *SendTaskFailureInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/SendTaskFailure func (c *SFN) SendTaskFailure(input *SendTaskFailureInput) (*SendTaskFailureOutput, error) { req, out := c.SendTaskFailureRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendTaskFailureWithContext is the same as SendTaskFailure with the addition of +// the ability to pass a context and additional request options. +// +// See SendTaskFailure 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 *SFN) SendTaskFailureWithContext(ctx aws.Context, input *SendTaskFailureInput, opts ...request.Option) (*SendTaskFailureOutput, error) { + req, out := c.SendTaskFailureRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendTaskHeartbeat = "SendTaskHeartbeat" @@ -1129,8 +1425,23 @@ func (c *SFN) SendTaskHeartbeatRequest(input *SendTaskHeartbeatInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/SendTaskHeartbeat func (c *SFN) SendTaskHeartbeat(input *SendTaskHeartbeatInput) (*SendTaskHeartbeatOutput, error) { req, out := c.SendTaskHeartbeatRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendTaskHeartbeatWithContext is the same as SendTaskHeartbeat with the addition of +// the ability to pass a context and additional request options. +// +// See SendTaskHeartbeat 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 *SFN) SendTaskHeartbeatWithContext(ctx aws.Context, input *SendTaskHeartbeatInput, opts ...request.Option) (*SendTaskHeartbeatOutput, error) { + req, out := c.SendTaskHeartbeatRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendTaskSuccess = "SendTaskSuccess" @@ -1202,8 +1513,23 @@ func (c *SFN) SendTaskSuccessRequest(input *SendTaskSuccessInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/SendTaskSuccess func (c *SFN) SendTaskSuccess(input *SendTaskSuccessInput) (*SendTaskSuccessOutput, error) { req, out := c.SendTaskSuccessRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendTaskSuccessWithContext is the same as SendTaskSuccess with the addition of +// the ability to pass a context and additional request options. +// +// See SendTaskSuccess 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 *SFN) SendTaskSuccessWithContext(ctx aws.Context, input *SendTaskSuccessInput, opts ...request.Option) (*SendTaskSuccessOutput, error) { + req, out := c.SendTaskSuccessRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartExecution = "StartExecution" @@ -1286,8 +1612,23 @@ func (c *SFN) StartExecutionRequest(input *StartExecutionInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/StartExecution func (c *SFN) StartExecution(input *StartExecutionInput) (*StartExecutionOutput, error) { req, out := c.StartExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartExecutionWithContext is the same as StartExecution with the addition of +// the ability to pass a context and additional request options. +// +// See StartExecution 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 *SFN) StartExecutionWithContext(ctx aws.Context, input *StartExecutionInput, opts ...request.Option) (*StartExecutionOutput, error) { + req, out := c.StartExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopExecution = "StopExecution" @@ -1354,8 +1695,23 @@ func (c *SFN) StopExecutionRequest(input *StopExecutionInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/StopExecution func (c *SFN) StopExecution(input *StopExecutionInput) (*StopExecutionOutput, error) { req, out := c.StopExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopExecutionWithContext is the same as StopExecution with the addition of +// the ability to pass a context and additional request options. +// +// See StopExecution 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 *SFN) StopExecutionWithContext(ctx aws.Context, input *StopExecutionInput, opts ...request.Option) (*StopExecutionOutput, error) { + req, out := c.StopExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/ActivityFailedEventDetails diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/errors.go index 2a438eb66e..ee02f364d0 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sfn diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/service.go index 77bf817e7c..4ac61d3794 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sfn/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sfn diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/api.go index 9308ec37c8..1a40436dec 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package simpledb provides a client for Amazon SimpleDB. package simpledb @@ -6,6 +6,7 @@ package simpledb import ( "fmt" + "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" @@ -37,8 +38,6 @@ const opBatchDeleteAttributes = "BatchDeleteAttributes" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchDeleteAttributes func (c *SimpleDB) BatchDeleteAttributesRequest(input *BatchDeleteAttributesInput) (req *request.Request, output *BatchDeleteAttributesOutput) { op := &request.Operation{ Name: opBatchDeleteAttributes, @@ -90,11 +89,25 @@ func (c *SimpleDB) BatchDeleteAttributesRequest(input *BatchDeleteAttributesInpu // // See the AWS API reference guide for Amazon SimpleDB's // API operation BatchDeleteAttributes for usage and error information. -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchDeleteAttributes func (c *SimpleDB) BatchDeleteAttributes(input *BatchDeleteAttributesInput) (*BatchDeleteAttributesOutput, error) { req, out := c.BatchDeleteAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchDeleteAttributesWithContext is the same as BatchDeleteAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See BatchDeleteAttributes 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 *SimpleDB) BatchDeleteAttributesWithContext(ctx aws.Context, input *BatchDeleteAttributesInput, opts ...request.Option) (*BatchDeleteAttributesOutput, error) { + req, out := c.BatchDeleteAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opBatchPutAttributes = "BatchPutAttributes" @@ -122,8 +135,6 @@ const opBatchPutAttributes = "BatchPutAttributes" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchPutAttributes func (c *SimpleDB) BatchPutAttributesRequest(input *BatchPutAttributesInput) (req *request.Request, output *BatchPutAttributesOutput) { op := &request.Operation{ Name: opBatchPutAttributes, @@ -223,11 +234,25 @@ func (c *SimpleDB) BatchPutAttributesRequest(input *BatchPutAttributesInput) (re // * ErrCodeNumberSubmittedAttributesExceeded "NumberSubmittedAttributesExceeded" // Too many attributes exist in a single call. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchPutAttributes func (c *SimpleDB) BatchPutAttributes(input *BatchPutAttributesInput) (*BatchPutAttributesOutput, error) { req, out := c.BatchPutAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// BatchPutAttributesWithContext is the same as BatchPutAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See BatchPutAttributes 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 *SimpleDB) BatchPutAttributesWithContext(ctx aws.Context, input *BatchPutAttributesInput, opts ...request.Option) (*BatchPutAttributesOutput, error) { + req, out := c.BatchPutAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDomain = "CreateDomain" @@ -255,8 +280,6 @@ const opCreateDomain = "CreateDomain" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//CreateDomain func (c *SimpleDB) CreateDomainRequest(input *CreateDomainInput) (req *request.Request, output *CreateDomainOutput) { op := &request.Operation{ Name: opCreateDomain, @@ -304,11 +327,25 @@ func (c *SimpleDB) CreateDomainRequest(input *CreateDomainInput) (req *request.R // * ErrCodeNumberDomainsExceeded "NumberDomainsExceeded" // Too many domains exist per this account. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//CreateDomain func (c *SimpleDB) CreateDomain(input *CreateDomainInput) (*CreateDomainOutput, error) { req, out := c.CreateDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDomainWithContext is the same as CreateDomain with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDomain 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 *SimpleDB) CreateDomainWithContext(ctx aws.Context, input *CreateDomainInput, opts ...request.Option) (*CreateDomainOutput, error) { + req, out := c.CreateDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAttributes = "DeleteAttributes" @@ -336,8 +373,6 @@ const opDeleteAttributes = "DeleteAttributes" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteAttributes func (c *SimpleDB) DeleteAttributesRequest(input *DeleteAttributesInput) (req *request.Request, output *DeleteAttributesOutput) { op := &request.Operation{ Name: opDeleteAttributes, @@ -390,11 +425,25 @@ func (c *SimpleDB) DeleteAttributesRequest(input *DeleteAttributesInput) (req *r // * ErrCodeAttributeDoesNotExist "AttributeDoesNotExist" // The specified attribute does not exist. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteAttributes func (c *SimpleDB) DeleteAttributes(input *DeleteAttributesInput) (*DeleteAttributesOutput, error) { req, out := c.DeleteAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAttributesWithContext is the same as DeleteAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAttributes 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 *SimpleDB) DeleteAttributesWithContext(ctx aws.Context, input *DeleteAttributesInput, opts ...request.Option) (*DeleteAttributesOutput, error) { + req, out := c.DeleteAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDomain = "DeleteDomain" @@ -422,8 +471,6 @@ const opDeleteDomain = "DeleteDomain" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteDomain func (c *SimpleDB) DeleteDomainRequest(input *DeleteDomainInput) (req *request.Request, output *DeleteDomainOutput) { op := &request.Operation{ Name: opDeleteDomain, @@ -462,11 +509,25 @@ func (c *SimpleDB) DeleteDomainRequest(input *DeleteDomainInput) (req *request.R // * ErrCodeMissingParameter "MissingParameter" // The request must contain the specified missing parameter. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteDomain func (c *SimpleDB) DeleteDomain(input *DeleteDomainInput) (*DeleteDomainOutput, error) { req, out := c.DeleteDomainRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDomainWithContext is the same as DeleteDomain with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDomain 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 *SimpleDB) DeleteDomainWithContext(ctx aws.Context, input *DeleteDomainInput, opts ...request.Option) (*DeleteDomainOutput, error) { + req, out := c.DeleteDomainRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDomainMetadata = "DomainMetadata" @@ -494,8 +555,6 @@ const opDomainMetadata = "DomainMetadata" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DomainMetadata func (c *SimpleDB) DomainMetadataRequest(input *DomainMetadataInput) (req *request.Request, output *DomainMetadataOutput) { op := &request.Operation{ Name: opDomainMetadata, @@ -532,11 +591,25 @@ func (c *SimpleDB) DomainMetadataRequest(input *DomainMetadataInput) (req *reque // * ErrCodeNoSuchDomain "NoSuchDomain" // The specified domain does not exist. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DomainMetadata func (c *SimpleDB) DomainMetadata(input *DomainMetadataInput) (*DomainMetadataOutput, error) { req, out := c.DomainMetadataRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DomainMetadataWithContext is the same as DomainMetadata with the addition of +// the ability to pass a context and additional request options. +// +// See DomainMetadata 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 *SimpleDB) DomainMetadataWithContext(ctx aws.Context, input *DomainMetadataInput, opts ...request.Option) (*DomainMetadataOutput, error) { + req, out := c.DomainMetadataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAttributes = "GetAttributes" @@ -564,8 +637,6 @@ const opGetAttributes = "GetAttributes" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//GetAttributes func (c *SimpleDB) GetAttributesRequest(input *GetAttributesInput) (req *request.Request, output *GetAttributesOutput) { op := &request.Operation{ Name: opGetAttributes, @@ -612,11 +683,25 @@ func (c *SimpleDB) GetAttributesRequest(input *GetAttributesInput) (req *request // * ErrCodeNoSuchDomain "NoSuchDomain" // The specified domain does not exist. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//GetAttributes func (c *SimpleDB) GetAttributes(input *GetAttributesInput) (*GetAttributesOutput, error) { req, out := c.GetAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAttributesWithContext is the same as GetAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetAttributes 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 *SimpleDB) GetAttributesWithContext(ctx aws.Context, input *GetAttributesInput, opts ...request.Option) (*GetAttributesOutput, error) { + req, out := c.GetAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListDomains = "ListDomains" @@ -644,8 +729,6 @@ const opListDomains = "ListDomains" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//ListDomains func (c *SimpleDB) ListDomainsRequest(input *ListDomainsInput) (req *request.Request, output *ListDomainsOutput) { op := &request.Operation{ Name: opListDomains, @@ -691,11 +774,25 @@ func (c *SimpleDB) ListDomainsRequest(input *ListDomainsInput) (req *request.Req // * ErrCodeInvalidNextToken "InvalidNextToken" // The specified NextToken is not valid. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//ListDomains func (c *SimpleDB) ListDomains(input *ListDomainsInput) (*ListDomainsOutput, error) { req, out := c.ListDomainsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDomainsWithContext is the same as ListDomains with the addition of +// the ability to pass a context and additional request options. +// +// See ListDomains 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 *SimpleDB) ListDomainsWithContext(ctx aws.Context, input *ListDomainsInput, opts ...request.Option) (*ListDomainsOutput, error) { + req, out := c.ListDomainsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListDomainsPages iterates over the pages of a ListDomains operation, @@ -715,12 +812,37 @@ func (c *SimpleDB) ListDomains(input *ListDomainsInput) (*ListDomainsOutput, err // return pageNum <= 3 // }) // -func (c *SimpleDB) ListDomainsPages(input *ListDomainsInput, fn func(p *ListDomainsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListDomainsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListDomainsOutput), lastPage) - }) +func (c *SimpleDB) ListDomainsPages(input *ListDomainsInput, fn func(*ListDomainsOutput, bool) bool) error { + return c.ListDomainsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDomainsPagesWithContext same as ListDomainsPages 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 *SimpleDB) ListDomainsPagesWithContext(ctx aws.Context, input *ListDomainsInput, fn func(*ListDomainsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDomainsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDomainsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDomainsOutput), !p.HasNextPage()) + } + return p.Err() } const opPutAttributes = "PutAttributes" @@ -748,8 +870,6 @@ const opPutAttributes = "PutAttributes" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//PutAttributes func (c *SimpleDB) PutAttributesRequest(input *PutAttributesInput) (req *request.Request, output *PutAttributesOutput) { op := &request.Operation{ Name: opPutAttributes, @@ -831,11 +951,25 @@ func (c *SimpleDB) PutAttributesRequest(input *PutAttributesInput) (req *request // * ErrCodeAttributeDoesNotExist "AttributeDoesNotExist" // The specified attribute does not exist. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//PutAttributes func (c *SimpleDB) PutAttributes(input *PutAttributesInput) (*PutAttributesOutput, error) { req, out := c.PutAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutAttributesWithContext is the same as PutAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See PutAttributes 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 *SimpleDB) PutAttributesWithContext(ctx aws.Context, input *PutAttributesInput, opts ...request.Option) (*PutAttributesOutput, error) { + req, out := c.PutAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSelect = "Select" @@ -863,8 +997,6 @@ const opSelect = "Select" // if err == nil { // resp is now filled // fmt.Println(resp) // } -// -// Please also see https://docs.aws.amazon.com/goto/WebAPI//Select func (c *SimpleDB) SelectRequest(input *SelectInput) (req *request.Request, output *SelectOutput) { op := &request.Operation{ Name: opSelect, @@ -937,11 +1069,25 @@ func (c *SimpleDB) SelectRequest(input *SelectInput) (req *request.Request, outp // * ErrCodeTooManyRequestedAttributes "TooManyRequestedAttributes" // Too many attributes requested. // -// Please also see https://docs.aws.amazon.com/goto/WebAPI//Select func (c *SimpleDB) Select(input *SelectInput) (*SelectOutput, error) { req, out := c.SelectRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SelectWithContext is the same as Select with the addition of +// the ability to pass a context and additional request options. +// +// See Select 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 *SimpleDB) SelectWithContext(ctx aws.Context, input *SelectInput, opts ...request.Option) (*SelectOutput, error) { + req, out := c.SelectRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // SelectPages iterates over the pages of a Select operation, @@ -961,15 +1107,39 @@ func (c *SimpleDB) Select(input *SelectInput) (*SelectOutput, error) { // return pageNum <= 3 // }) // -func (c *SimpleDB) SelectPages(input *SelectInput, fn func(p *SelectOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.SelectRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*SelectOutput), lastPage) - }) +func (c *SimpleDB) SelectPages(input *SelectInput, fn func(*SelectOutput, bool) bool) error { + return c.SelectPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// SelectPagesWithContext same as SelectPages 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 *SimpleDB) SelectPagesWithContext(ctx aws.Context, input *SelectInput, fn func(*SelectOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *SelectInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.SelectRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*SelectOutput), !p.HasNextPage()) + } + return p.Err() } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//Attribute type Attribute struct { _ struct{} `type:"structure"` @@ -1022,7 +1192,6 @@ func (s *Attribute) SetValue(v string) *Attribute { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchDeleteAttributesRequest type BatchDeleteAttributesInput struct { _ struct{} `type:"structure"` @@ -1085,7 +1254,6 @@ func (s *BatchDeleteAttributesInput) SetItems(v []*DeletableItem) *BatchDeleteAt return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchDeleteAttributesOutput type BatchDeleteAttributesOutput struct { _ struct{} `type:"structure"` } @@ -1100,7 +1268,6 @@ func (s BatchDeleteAttributesOutput) GoString() string { return s.String() } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchPutAttributesRequest type BatchPutAttributesInput struct { _ struct{} `type:"structure"` @@ -1163,7 +1330,6 @@ func (s *BatchPutAttributesInput) SetItems(v []*ReplaceableItem) *BatchPutAttrib return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//BatchPutAttributesOutput type BatchPutAttributesOutput struct { _ struct{} `type:"structure"` } @@ -1178,7 +1344,6 @@ func (s BatchPutAttributesOutput) GoString() string { return s.String() } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//CreateDomainRequest type CreateDomainInput struct { _ struct{} `type:"structure"` @@ -1218,7 +1383,6 @@ func (s *CreateDomainInput) SetDomainName(v string) *CreateDomainInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//CreateDomainOutput type CreateDomainOutput struct { _ struct{} `type:"structure"` } @@ -1233,7 +1397,6 @@ func (s CreateDomainOutput) GoString() string { return s.String() } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeletableAttribute type DeletableAttribute struct { _ struct{} `type:"structure"` @@ -1281,7 +1444,6 @@ func (s *DeletableAttribute) SetValue(v string) *DeletableAttribute { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeletableItem type DeletableItem struct { _ struct{} `type:"structure"` @@ -1336,7 +1498,6 @@ func (s *DeletableItem) SetName(v string) *DeletableItem { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteAttributesRequest type DeleteAttributesInput struct { _ struct{} `type:"structure"` @@ -1421,7 +1582,6 @@ func (s *DeleteAttributesInput) SetItemName(v string) *DeleteAttributesInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteAttributesOutput type DeleteAttributesOutput struct { _ struct{} `type:"structure"` } @@ -1436,7 +1596,6 @@ func (s DeleteAttributesOutput) GoString() string { return s.String() } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteDomainRequest type DeleteDomainInput struct { _ struct{} `type:"structure"` @@ -1475,7 +1634,6 @@ func (s *DeleteDomainInput) SetDomainName(v string) *DeleteDomainInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DeleteDomainOutput type DeleteDomainOutput struct { _ struct{} `type:"structure"` } @@ -1490,7 +1648,6 @@ func (s DeleteDomainOutput) GoString() string { return s.String() } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DomainMetadataRequest type DomainMetadataInput struct { _ struct{} `type:"structure"` @@ -1529,7 +1686,6 @@ func (s *DomainMetadataInput) SetDomainName(v string) *DomainMetadataInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//DomainMetadataResult type DomainMetadataOutput struct { _ struct{} `type:"structure"` @@ -1607,7 +1763,6 @@ func (s *DomainMetadataOutput) SetTimestamp(v int64) *DomainMetadataOutput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//GetAttributesRequest type GetAttributesInput struct { _ struct{} `type:"structure"` @@ -1679,7 +1834,6 @@ func (s *GetAttributesInput) SetItemName(v string) *GetAttributesInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//GetAttributesResult type GetAttributesOutput struct { _ struct{} `type:"structure"` @@ -1703,7 +1857,6 @@ func (s *GetAttributesOutput) SetAttributes(v []*Attribute) *GetAttributesOutput return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//Item type Item struct { _ struct{} `type:"structure"` @@ -1748,7 +1901,6 @@ func (s *Item) SetName(v string) *Item { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//ListDomainsRequest type ListDomainsInput struct { _ struct{} `type:"structure"` @@ -1783,7 +1935,6 @@ func (s *ListDomainsInput) SetNextToken(v string) *ListDomainsInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//ListDomainsResult type ListDomainsOutput struct { _ struct{} `type:"structure"` @@ -1817,7 +1968,6 @@ func (s *ListDomainsOutput) SetNextToken(v string) *ListDomainsOutput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//PutAttributesRequest type PutAttributesInput struct { _ struct{} `type:"structure"` @@ -1905,7 +2055,6 @@ func (s *PutAttributesInput) SetItemName(v string) *PutAttributesInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//PutAttributesOutput type PutAttributesOutput struct { _ struct{} `type:"structure"` } @@ -1920,7 +2069,6 @@ func (s PutAttributesOutput) GoString() string { return s.String() } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//ReplaceableAttribute type ReplaceableAttribute struct { _ struct{} `type:"structure"` @@ -1983,7 +2131,6 @@ func (s *ReplaceableAttribute) SetValue(v string) *ReplaceableAttribute { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//ReplaceableItem type ReplaceableItem struct { _ struct{} `type:"structure"` @@ -2046,7 +2193,6 @@ func (s *ReplaceableItem) SetName(v string) *ReplaceableItem { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//SelectRequest type SelectInput struct { _ struct{} `type:"structure"` @@ -2104,7 +2250,6 @@ func (s *SelectInput) SetSelectExpression(v string) *SelectInput { return s } -// Please also see https://docs.aws.amazon.com/goto/WebAPI//SelectResult type SelectOutput struct { _ struct{} `type:"structure"` @@ -2141,7 +2286,6 @@ func (s *SelectOutput) SetNextToken(v string) *SelectOutput { // condition is specified for a request, the data will only be updated if the // condition is satisfied. For example, if an attribute with a specific name // and value exists, or if a specific attribute doesn't exist. -// Please also see https://docs.aws.amazon.com/goto/WebAPI//UpdateCondition type UpdateCondition struct { _ struct{} `type:"structure"` diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/errors.go index f12143a0dc..5fa4dd4774 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package simpledb diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/service.go index dd5bf1da3b..f2bbf6af5b 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/simpledb/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package simpledb @@ -29,7 +29,6 @@ import ( // more information. // The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. -// Please also see https://docs.aws.amazon.com/goto/WebAPI/ type SimpleDB struct { *client.Client } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sns/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sns/api.go index ee7f647e96..bec8fe5dd8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sns/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sns/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package sns provides a client for Amazon Simple Notification Service. package sns @@ -6,6 +6,7 @@ package sns import ( "fmt" + "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" @@ -85,8 +86,23 @@ func (c *SNS) AddPermissionRequest(input *AddPermissionInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/AddPermission func (c *SNS) AddPermission(input *AddPermissionInput) (*AddPermissionOutput, error) { req, out := c.AddPermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddPermissionWithContext is the same as AddPermission with the addition of +// the ability to pass a context and additional request options. +// +// See AddPermission 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 *SNS) AddPermissionWithContext(ctx aws.Context, input *AddPermissionInput, opts ...request.Option) (*AddPermissionOutput, error) { + req, out := c.AddPermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCheckIfPhoneNumberIsOptedOut = "CheckIfPhoneNumberIsOptedOut" @@ -165,8 +181,23 @@ func (c *SNS) CheckIfPhoneNumberIsOptedOutRequest(input *CheckIfPhoneNumberIsOpt // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/CheckIfPhoneNumberIsOptedOut func (c *SNS) CheckIfPhoneNumberIsOptedOut(input *CheckIfPhoneNumberIsOptedOutInput) (*CheckIfPhoneNumberIsOptedOutOutput, error) { req, out := c.CheckIfPhoneNumberIsOptedOutRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CheckIfPhoneNumberIsOptedOutWithContext is the same as CheckIfPhoneNumberIsOptedOut with the addition of +// the ability to pass a context and additional request options. +// +// See CheckIfPhoneNumberIsOptedOut 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 *SNS) CheckIfPhoneNumberIsOptedOutWithContext(ctx aws.Context, input *CheckIfPhoneNumberIsOptedOutInput, opts ...request.Option) (*CheckIfPhoneNumberIsOptedOutOutput, error) { + req, out := c.CheckIfPhoneNumberIsOptedOutRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opConfirmSubscription = "ConfirmSubscription" @@ -246,8 +277,23 @@ func (c *SNS) ConfirmSubscriptionRequest(input *ConfirmSubscriptionInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ConfirmSubscription func (c *SNS) ConfirmSubscription(input *ConfirmSubscriptionInput) (*ConfirmSubscriptionOutput, error) { req, out := c.ConfirmSubscriptionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ConfirmSubscriptionWithContext is the same as ConfirmSubscription with the addition of +// the ability to pass a context and additional request options. +// +// See ConfirmSubscription 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 *SNS) ConfirmSubscriptionWithContext(ctx aws.Context, input *ConfirmSubscriptionInput, opts ...request.Option) (*ConfirmSubscriptionOutput, error) { + req, out := c.ConfirmSubscriptionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePlatformApplication = "CreatePlatformApplication" @@ -342,8 +388,23 @@ func (c *SNS) CreatePlatformApplicationRequest(input *CreatePlatformApplicationI // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/CreatePlatformApplication func (c *SNS) CreatePlatformApplication(input *CreatePlatformApplicationInput) (*CreatePlatformApplicationOutput, error) { req, out := c.CreatePlatformApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePlatformApplicationWithContext is the same as CreatePlatformApplication with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePlatformApplication 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 *SNS) CreatePlatformApplicationWithContext(ctx aws.Context, input *CreatePlatformApplicationInput, opts ...request.Option) (*CreatePlatformApplicationOutput, error) { + req, out := c.CreatePlatformApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePlatformEndpoint = "CreatePlatformEndpoint" @@ -429,8 +490,23 @@ func (c *SNS) CreatePlatformEndpointRequest(input *CreatePlatformEndpointInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/CreatePlatformEndpoint func (c *SNS) CreatePlatformEndpoint(input *CreatePlatformEndpointInput) (*CreatePlatformEndpointOutput, error) { req, out := c.CreatePlatformEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePlatformEndpointWithContext is the same as CreatePlatformEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePlatformEndpoint 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 *SNS) CreatePlatformEndpointWithContext(ctx aws.Context, input *CreatePlatformEndpointInput, opts ...request.Option) (*CreatePlatformEndpointOutput, error) { + req, out := c.CreatePlatformEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateTopic = "CreateTopic" @@ -507,8 +583,23 @@ func (c *SNS) CreateTopicRequest(input *CreateTopicInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/CreateTopic func (c *SNS) CreateTopic(input *CreateTopicInput) (*CreateTopicOutput, error) { req, out := c.CreateTopicRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateTopicWithContext is the same as CreateTopic with the addition of +// the ability to pass a context and additional request options. +// +// See CreateTopic 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 *SNS) CreateTopicWithContext(ctx aws.Context, input *CreateTopicInput, opts ...request.Option) (*CreateTopicOutput, error) { + req, out := c.CreateTopicRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteEndpoint = "DeleteEndpoint" @@ -585,8 +676,23 @@ func (c *SNS) DeleteEndpointRequest(input *DeleteEndpointInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/DeleteEndpoint func (c *SNS) DeleteEndpoint(input *DeleteEndpointInput) (*DeleteEndpointOutput, error) { req, out := c.DeleteEndpointRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteEndpointWithContext is the same as DeleteEndpoint with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteEndpoint 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 *SNS) DeleteEndpointWithContext(ctx aws.Context, input *DeleteEndpointInput, opts ...request.Option) (*DeleteEndpointOutput, error) { + req, out := c.DeleteEndpointRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeletePlatformApplication = "DeletePlatformApplication" @@ -660,8 +766,23 @@ func (c *SNS) DeletePlatformApplicationRequest(input *DeletePlatformApplicationI // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/DeletePlatformApplication func (c *SNS) DeletePlatformApplication(input *DeletePlatformApplicationInput) (*DeletePlatformApplicationOutput, error) { req, out := c.DeletePlatformApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeletePlatformApplicationWithContext is the same as DeletePlatformApplication with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePlatformApplication 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 *SNS) DeletePlatformApplicationWithContext(ctx aws.Context, input *DeletePlatformApplicationInput, opts ...request.Option) (*DeletePlatformApplicationOutput, error) { + req, out := c.DeletePlatformApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteTopic = "DeleteTopic" @@ -739,8 +860,23 @@ func (c *SNS) DeleteTopicRequest(input *DeleteTopicInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/DeleteTopic func (c *SNS) DeleteTopic(input *DeleteTopicInput) (*DeleteTopicOutput, error) { req, out := c.DeleteTopicRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteTopicWithContext is the same as DeleteTopic with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteTopic 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 *SNS) DeleteTopicWithContext(ctx aws.Context, input *DeleteTopicInput, opts ...request.Option) (*DeleteTopicOutput, error) { + req, out := c.DeleteTopicRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetEndpointAttributes = "GetEndpointAttributes" @@ -815,8 +951,23 @@ func (c *SNS) GetEndpointAttributesRequest(input *GetEndpointAttributesInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/GetEndpointAttributes func (c *SNS) GetEndpointAttributes(input *GetEndpointAttributesInput) (*GetEndpointAttributesOutput, error) { req, out := c.GetEndpointAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetEndpointAttributesWithContext is the same as GetEndpointAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetEndpointAttributes 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 *SNS) GetEndpointAttributesWithContext(ctx aws.Context, input *GetEndpointAttributesInput, opts ...request.Option) (*GetEndpointAttributesOutput, error) { + req, out := c.GetEndpointAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPlatformApplicationAttributes = "GetPlatformApplicationAttributes" @@ -891,8 +1042,23 @@ func (c *SNS) GetPlatformApplicationAttributesRequest(input *GetPlatformApplicat // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/GetPlatformApplicationAttributes func (c *SNS) GetPlatformApplicationAttributes(input *GetPlatformApplicationAttributesInput) (*GetPlatformApplicationAttributesOutput, error) { req, out := c.GetPlatformApplicationAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPlatformApplicationAttributesWithContext is the same as GetPlatformApplicationAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetPlatformApplicationAttributes 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 *SNS) GetPlatformApplicationAttributesWithContext(ctx aws.Context, input *GetPlatformApplicationAttributesInput, opts ...request.Option) (*GetPlatformApplicationAttributesOutput, error) { + req, out := c.GetPlatformApplicationAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSMSAttributes = "GetSMSAttributes" @@ -968,8 +1134,23 @@ func (c *SNS) GetSMSAttributesRequest(input *GetSMSAttributesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/GetSMSAttributes func (c *SNS) GetSMSAttributes(input *GetSMSAttributesInput) (*GetSMSAttributesOutput, error) { req, out := c.GetSMSAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSMSAttributesWithContext is the same as GetSMSAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetSMSAttributes 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 *SNS) GetSMSAttributesWithContext(ctx aws.Context, input *GetSMSAttributesInput, opts ...request.Option) (*GetSMSAttributesOutput, error) { + req, out := c.GetSMSAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSubscriptionAttributes = "GetSubscriptionAttributes" @@ -1042,8 +1223,23 @@ func (c *SNS) GetSubscriptionAttributesRequest(input *GetSubscriptionAttributesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/GetSubscriptionAttributes func (c *SNS) GetSubscriptionAttributes(input *GetSubscriptionAttributesInput) (*GetSubscriptionAttributesOutput, error) { req, out := c.GetSubscriptionAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSubscriptionAttributesWithContext is the same as GetSubscriptionAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetSubscriptionAttributes 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 *SNS) GetSubscriptionAttributesWithContext(ctx aws.Context, input *GetSubscriptionAttributesInput, opts ...request.Option) (*GetSubscriptionAttributesOutput, error) { + req, out := c.GetSubscriptionAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetTopicAttributes = "GetTopicAttributes" @@ -1117,8 +1313,23 @@ func (c *SNS) GetTopicAttributesRequest(input *GetTopicAttributesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/GetTopicAttributes func (c *SNS) GetTopicAttributes(input *GetTopicAttributesInput) (*GetTopicAttributesOutput, error) { req, out := c.GetTopicAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetTopicAttributesWithContext is the same as GetTopicAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetTopicAttributes 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 *SNS) GetTopicAttributesWithContext(ctx aws.Context, input *GetTopicAttributesInput, opts ...request.Option) (*GetTopicAttributesOutput, error) { + req, out := c.GetTopicAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListEndpointsByPlatformApplication = "ListEndpointsByPlatformApplication" @@ -1204,8 +1415,23 @@ func (c *SNS) ListEndpointsByPlatformApplicationRequest(input *ListEndpointsByPl // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListEndpointsByPlatformApplication func (c *SNS) ListEndpointsByPlatformApplication(input *ListEndpointsByPlatformApplicationInput) (*ListEndpointsByPlatformApplicationOutput, error) { req, out := c.ListEndpointsByPlatformApplicationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListEndpointsByPlatformApplicationWithContext is the same as ListEndpointsByPlatformApplication with the addition of +// the ability to pass a context and additional request options. +// +// See ListEndpointsByPlatformApplication 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 *SNS) ListEndpointsByPlatformApplicationWithContext(ctx aws.Context, input *ListEndpointsByPlatformApplicationInput, opts ...request.Option) (*ListEndpointsByPlatformApplicationOutput, error) { + req, out := c.ListEndpointsByPlatformApplicationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListEndpointsByPlatformApplicationPages iterates over the pages of a ListEndpointsByPlatformApplication operation, @@ -1225,12 +1451,37 @@ func (c *SNS) ListEndpointsByPlatformApplication(input *ListEndpointsByPlatformA // return pageNum <= 3 // }) // -func (c *SNS) ListEndpointsByPlatformApplicationPages(input *ListEndpointsByPlatformApplicationInput, fn func(p *ListEndpointsByPlatformApplicationOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListEndpointsByPlatformApplicationRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListEndpointsByPlatformApplicationOutput), lastPage) - }) +func (c *SNS) ListEndpointsByPlatformApplicationPages(input *ListEndpointsByPlatformApplicationInput, fn func(*ListEndpointsByPlatformApplicationOutput, bool) bool) error { + return c.ListEndpointsByPlatformApplicationPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListEndpointsByPlatformApplicationPagesWithContext same as ListEndpointsByPlatformApplicationPages 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 *SNS) ListEndpointsByPlatformApplicationPagesWithContext(ctx aws.Context, input *ListEndpointsByPlatformApplicationInput, fn func(*ListEndpointsByPlatformApplicationOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListEndpointsByPlatformApplicationInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListEndpointsByPlatformApplicationRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListEndpointsByPlatformApplicationOutput), !p.HasNextPage()) + } + return p.Err() } const opListPhoneNumbersOptedOut = "ListPhoneNumbersOptedOut" @@ -1312,8 +1563,23 @@ func (c *SNS) ListPhoneNumbersOptedOutRequest(input *ListPhoneNumbersOptedOutInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListPhoneNumbersOptedOut func (c *SNS) ListPhoneNumbersOptedOut(input *ListPhoneNumbersOptedOutInput) (*ListPhoneNumbersOptedOutOutput, error) { req, out := c.ListPhoneNumbersOptedOutRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPhoneNumbersOptedOutWithContext is the same as ListPhoneNumbersOptedOut with the addition of +// the ability to pass a context and additional request options. +// +// See ListPhoneNumbersOptedOut 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 *SNS) ListPhoneNumbersOptedOutWithContext(ctx aws.Context, input *ListPhoneNumbersOptedOutInput, opts ...request.Option) (*ListPhoneNumbersOptedOutOutput, error) { + req, out := c.ListPhoneNumbersOptedOutRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListPlatformApplications = "ListPlatformApplications" @@ -1396,8 +1662,23 @@ func (c *SNS) ListPlatformApplicationsRequest(input *ListPlatformApplicationsInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListPlatformApplications func (c *SNS) ListPlatformApplications(input *ListPlatformApplicationsInput) (*ListPlatformApplicationsOutput, error) { req, out := c.ListPlatformApplicationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListPlatformApplicationsWithContext is the same as ListPlatformApplications with the addition of +// the ability to pass a context and additional request options. +// +// See ListPlatformApplications 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 *SNS) ListPlatformApplicationsWithContext(ctx aws.Context, input *ListPlatformApplicationsInput, opts ...request.Option) (*ListPlatformApplicationsOutput, error) { + req, out := c.ListPlatformApplicationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListPlatformApplicationsPages iterates over the pages of a ListPlatformApplications operation, @@ -1417,12 +1698,37 @@ func (c *SNS) ListPlatformApplications(input *ListPlatformApplicationsInput) (*L // return pageNum <= 3 // }) // -func (c *SNS) ListPlatformApplicationsPages(input *ListPlatformApplicationsInput, fn func(p *ListPlatformApplicationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListPlatformApplicationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListPlatformApplicationsOutput), lastPage) - }) +func (c *SNS) ListPlatformApplicationsPages(input *ListPlatformApplicationsInput, fn func(*ListPlatformApplicationsOutput, bool) bool) error { + return c.ListPlatformApplicationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListPlatformApplicationsPagesWithContext same as ListPlatformApplicationsPages 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 *SNS) ListPlatformApplicationsPagesWithContext(ctx aws.Context, input *ListPlatformApplicationsInput, fn func(*ListPlatformApplicationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListPlatformApplicationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListPlatformApplicationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListPlatformApplicationsOutput), !p.HasNextPage()) + } + return p.Err() } const opListSubscriptions = "ListSubscriptions" @@ -1501,8 +1807,23 @@ func (c *SNS) ListSubscriptionsRequest(input *ListSubscriptionsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListSubscriptions func (c *SNS) ListSubscriptions(input *ListSubscriptionsInput) (*ListSubscriptionsOutput, error) { req, out := c.ListSubscriptionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSubscriptionsWithContext is the same as ListSubscriptions with the addition of +// the ability to pass a context and additional request options. +// +// See ListSubscriptions 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 *SNS) ListSubscriptionsWithContext(ctx aws.Context, input *ListSubscriptionsInput, opts ...request.Option) (*ListSubscriptionsOutput, error) { + req, out := c.ListSubscriptionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListSubscriptionsPages iterates over the pages of a ListSubscriptions operation, @@ -1522,12 +1843,37 @@ func (c *SNS) ListSubscriptions(input *ListSubscriptionsInput) (*ListSubscriptio // return pageNum <= 3 // }) // -func (c *SNS) ListSubscriptionsPages(input *ListSubscriptionsInput, fn func(p *ListSubscriptionsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListSubscriptionsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListSubscriptionsOutput), lastPage) - }) +func (c *SNS) ListSubscriptionsPages(input *ListSubscriptionsInput, fn func(*ListSubscriptionsOutput, bool) bool) error { + return c.ListSubscriptionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListSubscriptionsPagesWithContext same as ListSubscriptionsPages 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 *SNS) ListSubscriptionsPagesWithContext(ctx aws.Context, input *ListSubscriptionsInput, fn func(*ListSubscriptionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListSubscriptionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListSubscriptionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListSubscriptionsOutput), !p.HasNextPage()) + } + return p.Err() } const opListSubscriptionsByTopic = "ListSubscriptionsByTopic" @@ -1609,8 +1955,23 @@ func (c *SNS) ListSubscriptionsByTopicRequest(input *ListSubscriptionsByTopicInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListSubscriptionsByTopic func (c *SNS) ListSubscriptionsByTopic(input *ListSubscriptionsByTopicInput) (*ListSubscriptionsByTopicOutput, error) { req, out := c.ListSubscriptionsByTopicRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSubscriptionsByTopicWithContext is the same as ListSubscriptionsByTopic with the addition of +// the ability to pass a context and additional request options. +// +// See ListSubscriptionsByTopic 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 *SNS) ListSubscriptionsByTopicWithContext(ctx aws.Context, input *ListSubscriptionsByTopicInput, opts ...request.Option) (*ListSubscriptionsByTopicOutput, error) { + req, out := c.ListSubscriptionsByTopicRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListSubscriptionsByTopicPages iterates over the pages of a ListSubscriptionsByTopic operation, @@ -1630,12 +1991,37 @@ func (c *SNS) ListSubscriptionsByTopic(input *ListSubscriptionsByTopicInput) (*L // return pageNum <= 3 // }) // -func (c *SNS) ListSubscriptionsByTopicPages(input *ListSubscriptionsByTopicInput, fn func(p *ListSubscriptionsByTopicOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListSubscriptionsByTopicRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListSubscriptionsByTopicOutput), lastPage) - }) +func (c *SNS) ListSubscriptionsByTopicPages(input *ListSubscriptionsByTopicInput, fn func(*ListSubscriptionsByTopicOutput, bool) bool) error { + return c.ListSubscriptionsByTopicPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListSubscriptionsByTopicPagesWithContext same as ListSubscriptionsByTopicPages 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 *SNS) ListSubscriptionsByTopicPagesWithContext(ctx aws.Context, input *ListSubscriptionsByTopicInput, fn func(*ListSubscriptionsByTopicOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListSubscriptionsByTopicInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListSubscriptionsByTopicRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListSubscriptionsByTopicOutput), !p.HasNextPage()) + } + return p.Err() } const opListTopics = "ListTopics" @@ -1713,8 +2099,23 @@ func (c *SNS) ListTopicsRequest(input *ListTopicsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListTopics func (c *SNS) ListTopics(input *ListTopicsInput) (*ListTopicsOutput, error) { req, out := c.ListTopicsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTopicsWithContext is the same as ListTopics with the addition of +// the ability to pass a context and additional request options. +// +// See ListTopics 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 *SNS) ListTopicsWithContext(ctx aws.Context, input *ListTopicsInput, opts ...request.Option) (*ListTopicsOutput, error) { + req, out := c.ListTopicsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListTopicsPages iterates over the pages of a ListTopics operation, @@ -1734,12 +2135,37 @@ func (c *SNS) ListTopics(input *ListTopicsInput) (*ListTopicsOutput, error) { // return pageNum <= 3 // }) // -func (c *SNS) ListTopicsPages(input *ListTopicsInput, fn func(p *ListTopicsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListTopicsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListTopicsOutput), lastPage) - }) +func (c *SNS) ListTopicsPages(input *ListTopicsInput, fn func(*ListTopicsOutput, bool) bool) error { + return c.ListTopicsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListTopicsPagesWithContext same as ListTopicsPages 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 *SNS) ListTopicsPagesWithContext(ctx aws.Context, input *ListTopicsInput, fn func(*ListTopicsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListTopicsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListTopicsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListTopicsOutput), !p.HasNextPage()) + } + return p.Err() } const opOptInPhoneNumber = "OptInPhoneNumber" @@ -1816,8 +2242,23 @@ func (c *SNS) OptInPhoneNumberRequest(input *OptInPhoneNumberInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/OptInPhoneNumber func (c *SNS) OptInPhoneNumber(input *OptInPhoneNumberInput) (*OptInPhoneNumberOutput, error) { req, out := c.OptInPhoneNumberRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// OptInPhoneNumberWithContext is the same as OptInPhoneNumber with the addition of +// the ability to pass a context and additional request options. +// +// See OptInPhoneNumber 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 *SNS) OptInPhoneNumberWithContext(ctx aws.Context, input *OptInPhoneNumberInput, opts ...request.Option) (*OptInPhoneNumberOutput, error) { + req, out := c.OptInPhoneNumberRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPublish = "Publish" @@ -1910,8 +2351,23 @@ func (c *SNS) PublishRequest(input *PublishInput) (req *request.Request, output // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/Publish func (c *SNS) Publish(input *PublishInput) (*PublishOutput, error) { req, out := c.PublishRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PublishWithContext is the same as Publish with the addition of +// the ability to pass a context and additional request options. +// +// See Publish 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 *SNS) PublishWithContext(ctx aws.Context, input *PublishInput, opts ...request.Option) (*PublishOutput, error) { + req, out := c.PublishRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemovePermission = "RemovePermission" @@ -1986,8 +2442,23 @@ func (c *SNS) RemovePermissionRequest(input *RemovePermissionInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/RemovePermission func (c *SNS) RemovePermission(input *RemovePermissionInput) (*RemovePermissionOutput, error) { req, out := c.RemovePermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemovePermissionWithContext is the same as RemovePermission with the addition of +// the ability to pass a context and additional request options. +// +// See RemovePermission 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 *SNS) RemovePermissionWithContext(ctx aws.Context, input *RemovePermissionInput, opts ...request.Option) (*RemovePermissionOutput, error) { + req, out := c.RemovePermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetEndpointAttributes = "SetEndpointAttributes" @@ -2064,8 +2535,23 @@ func (c *SNS) SetEndpointAttributesRequest(input *SetEndpointAttributesInput) (r // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/SetEndpointAttributes func (c *SNS) SetEndpointAttributes(input *SetEndpointAttributesInput) (*SetEndpointAttributesOutput, error) { req, out := c.SetEndpointAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetEndpointAttributesWithContext is the same as SetEndpointAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See SetEndpointAttributes 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 *SNS) SetEndpointAttributesWithContext(ctx aws.Context, input *SetEndpointAttributesInput, opts ...request.Option) (*SetEndpointAttributesOutput, error) { + req, out := c.SetEndpointAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetPlatformApplicationAttributes = "SetPlatformApplicationAttributes" @@ -2144,8 +2630,23 @@ func (c *SNS) SetPlatformApplicationAttributesRequest(input *SetPlatformApplicat // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/SetPlatformApplicationAttributes func (c *SNS) SetPlatformApplicationAttributes(input *SetPlatformApplicationAttributesInput) (*SetPlatformApplicationAttributesOutput, error) { req, out := c.SetPlatformApplicationAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetPlatformApplicationAttributesWithContext is the same as SetPlatformApplicationAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See SetPlatformApplicationAttributes 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 *SNS) SetPlatformApplicationAttributesWithContext(ctx aws.Context, input *SetPlatformApplicationAttributesInput, opts ...request.Option) (*SetPlatformApplicationAttributesOutput, error) { + req, out := c.SetPlatformApplicationAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetSMSAttributes = "SetSMSAttributes" @@ -2225,8 +2726,23 @@ func (c *SNS) SetSMSAttributesRequest(input *SetSMSAttributesInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/SetSMSAttributes func (c *SNS) SetSMSAttributes(input *SetSMSAttributesInput) (*SetSMSAttributesOutput, error) { req, out := c.SetSMSAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetSMSAttributesWithContext is the same as SetSMSAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See SetSMSAttributes 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 *SNS) SetSMSAttributesWithContext(ctx aws.Context, input *SetSMSAttributesInput, opts ...request.Option) (*SetSMSAttributesOutput, error) { + req, out := c.SetSMSAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetSubscriptionAttributes = "SetSubscriptionAttributes" @@ -2301,8 +2817,23 @@ func (c *SNS) SetSubscriptionAttributesRequest(input *SetSubscriptionAttributesI // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/SetSubscriptionAttributes func (c *SNS) SetSubscriptionAttributes(input *SetSubscriptionAttributesInput) (*SetSubscriptionAttributesOutput, error) { req, out := c.SetSubscriptionAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetSubscriptionAttributesWithContext is the same as SetSubscriptionAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See SetSubscriptionAttributes 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 *SNS) SetSubscriptionAttributesWithContext(ctx aws.Context, input *SetSubscriptionAttributesInput, opts ...request.Option) (*SetSubscriptionAttributesOutput, error) { + req, out := c.SetSubscriptionAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetTopicAttributes = "SetTopicAttributes" @@ -2377,8 +2908,23 @@ func (c *SNS) SetTopicAttributesRequest(input *SetTopicAttributesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/SetTopicAttributes func (c *SNS) SetTopicAttributes(input *SetTopicAttributesInput) (*SetTopicAttributesOutput, error) { req, out := c.SetTopicAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetTopicAttributesWithContext is the same as SetTopicAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See SetTopicAttributes 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 *SNS) SetTopicAttributesWithContext(ctx aws.Context, input *SetTopicAttributesInput, opts ...request.Option) (*SetTopicAttributesOutput, error) { + req, out := c.SetTopicAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSubscribe = "Subscribe" @@ -2457,8 +3003,23 @@ func (c *SNS) SubscribeRequest(input *SubscribeInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/Subscribe func (c *SNS) Subscribe(input *SubscribeInput) (*SubscribeOutput, error) { req, out := c.SubscribeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SubscribeWithContext is the same as Subscribe with the addition of +// the ability to pass a context and additional request options. +// +// See Subscribe 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 *SNS) SubscribeWithContext(ctx aws.Context, input *SubscribeInput, opts ...request.Option) (*SubscribeOutput, error) { + req, out := c.SubscribeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUnsubscribe = "Unsubscribe" @@ -2538,8 +3099,23 @@ func (c *SNS) UnsubscribeRequest(input *UnsubscribeInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/Unsubscribe func (c *SNS) Unsubscribe(input *UnsubscribeInput) (*UnsubscribeOutput, error) { req, out := c.UnsubscribeRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UnsubscribeWithContext is the same as Unsubscribe with the addition of +// the ability to pass a context and additional request options. +// +// See Unsubscribe 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 *SNS) UnsubscribeWithContext(ctx aws.Context, input *UnsubscribeInput, opts ...request.Option) (*UnsubscribeOutput, error) { + req, out := c.UnsubscribeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/AddPermissionInput diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sns/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sns/errors.go index c6e3dbe20f..60e503f256 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sns/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sns/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sns diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sns/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sns/service.go index 6bb73fa7c0..8c735f5a5d 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sns/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sns/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sns diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go index 207ef6d492..3fea4687d1 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package sqs provides a client for Amazon Simple Queue Service. package sqs @@ -6,6 +6,7 @@ package sqs import ( "fmt" + "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" @@ -97,8 +98,23 @@ func (c *SQS) AddPermissionRequest(input *AddPermissionInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/AddPermission func (c *SQS) AddPermission(input *AddPermissionInput) (*AddPermissionOutput, error) { req, out := c.AddPermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddPermissionWithContext is the same as AddPermission with the addition of +// the ability to pass a context and additional request options. +// +// See AddPermission 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 *SQS) AddPermissionWithContext(ctx aws.Context, input *AddPermissionInput, opts ...request.Option) (*AddPermissionOutput, error) { + req, out := c.AddPermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opChangeMessageVisibility = "ChangeMessageVisibility" @@ -203,8 +219,23 @@ func (c *SQS) ChangeMessageVisibilityRequest(input *ChangeMessageVisibilityInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/ChangeMessageVisibility func (c *SQS) ChangeMessageVisibility(input *ChangeMessageVisibilityInput) (*ChangeMessageVisibilityOutput, error) { req, out := c.ChangeMessageVisibilityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ChangeMessageVisibilityWithContext is the same as ChangeMessageVisibility with the addition of +// the ability to pass a context and additional request options. +// +// See ChangeMessageVisibility 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 *SQS) ChangeMessageVisibilityWithContext(ctx aws.Context, input *ChangeMessageVisibilityInput, opts ...request.Option) (*ChangeMessageVisibilityOutput, error) { + req, out := c.ChangeMessageVisibilityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opChangeMessageVisibilityBatch = "ChangeMessageVisibilityBatch" @@ -292,8 +323,23 @@ func (c *SQS) ChangeMessageVisibilityBatchRequest(input *ChangeMessageVisibility // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/ChangeMessageVisibilityBatch func (c *SQS) ChangeMessageVisibilityBatch(input *ChangeMessageVisibilityBatchInput) (*ChangeMessageVisibilityBatchOutput, error) { req, out := c.ChangeMessageVisibilityBatchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ChangeMessageVisibilityBatchWithContext is the same as ChangeMessageVisibilityBatch with the addition of +// the ability to pass a context and additional request options. +// +// See ChangeMessageVisibilityBatch 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 *SQS) ChangeMessageVisibilityBatchWithContext(ctx aws.Context, input *ChangeMessageVisibilityBatchInput, opts ...request.Option) (*ChangeMessageVisibilityBatchOutput, error) { + req, out := c.ChangeMessageVisibilityBatchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateQueue = "CreateQueue" @@ -403,8 +449,23 @@ func (c *SQS) CreateQueueRequest(input *CreateQueueInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/CreateQueue func (c *SQS) CreateQueue(input *CreateQueueInput) (*CreateQueueOutput, error) { req, out := c.CreateQueueRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateQueueWithContext is the same as CreateQueue with the addition of +// the ability to pass a context and additional request options. +// +// See CreateQueue 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 *SQS) CreateQueueWithContext(ctx aws.Context, input *CreateQueueInput, opts ...request.Option) (*CreateQueueOutput, error) { + req, out := c.CreateQueueRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteMessage = "DeleteMessage" @@ -492,8 +553,23 @@ func (c *SQS) DeleteMessageRequest(input *DeleteMessageInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/DeleteMessage func (c *SQS) DeleteMessage(input *DeleteMessageInput) (*DeleteMessageOutput, error) { req, out := c.DeleteMessageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteMessageWithContext is the same as DeleteMessage with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMessage 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 *SQS) DeleteMessageWithContext(ctx aws.Context, input *DeleteMessageInput, opts ...request.Option) (*DeleteMessageOutput, error) { + req, out := c.DeleteMessageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteMessageBatch = "DeleteMessageBatch" @@ -580,8 +656,23 @@ func (c *SQS) DeleteMessageBatchRequest(input *DeleteMessageBatchInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/DeleteMessageBatch func (c *SQS) DeleteMessageBatch(input *DeleteMessageBatchInput) (*DeleteMessageBatchOutput, error) { req, out := c.DeleteMessageBatchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteMessageBatchWithContext is the same as DeleteMessageBatch with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMessageBatch 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 *SQS) DeleteMessageBatchWithContext(ctx aws.Context, input *DeleteMessageBatchInput, opts ...request.Option) (*DeleteMessageBatchOutput, error) { + req, out := c.DeleteMessageBatchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteQueue = "DeleteQueue" @@ -654,8 +745,23 @@ func (c *SQS) DeleteQueueRequest(input *DeleteQueueInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/DeleteQueue func (c *SQS) DeleteQueue(input *DeleteQueueInput) (*DeleteQueueOutput, error) { req, out := c.DeleteQueueRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteQueueWithContext is the same as DeleteQueue with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteQueue 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 *SQS) DeleteQueueWithContext(ctx aws.Context, input *DeleteQueueInput, opts ...request.Option) (*DeleteQueueOutput, error) { + req, out := c.DeleteQueueRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetQueueAttributes = "GetQueueAttributes" @@ -727,8 +833,23 @@ func (c *SQS) GetQueueAttributesRequest(input *GetQueueAttributesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/GetQueueAttributes func (c *SQS) GetQueueAttributes(input *GetQueueAttributesInput) (*GetQueueAttributesOutput, error) { req, out := c.GetQueueAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetQueueAttributesWithContext is the same as GetQueueAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See GetQueueAttributes 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 *SQS) GetQueueAttributesWithContext(ctx aws.Context, input *GetQueueAttributesInput, opts ...request.Option) (*GetQueueAttributesOutput, error) { + req, out := c.GetQueueAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetQueueUrl = "GetQueueUrl" @@ -799,8 +920,23 @@ func (c *SQS) GetQueueUrlRequest(input *GetQueueUrlInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/GetQueueUrl func (c *SQS) GetQueueUrl(input *GetQueueUrlInput) (*GetQueueUrlOutput, error) { req, out := c.GetQueueUrlRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetQueueUrlWithContext is the same as GetQueueUrl with the addition of +// the ability to pass a context and additional request options. +// +// See GetQueueUrl 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 *SQS) GetQueueUrlWithContext(ctx aws.Context, input *GetQueueUrlInput, opts ...request.Option) (*GetQueueUrlOutput, error) { + req, out := c.GetQueueUrlRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListDeadLetterSourceQueues = "ListDeadLetterSourceQueues" @@ -869,8 +1005,23 @@ func (c *SQS) ListDeadLetterSourceQueuesRequest(input *ListDeadLetterSourceQueue // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/ListDeadLetterSourceQueues func (c *SQS) ListDeadLetterSourceQueues(input *ListDeadLetterSourceQueuesInput) (*ListDeadLetterSourceQueuesOutput, error) { req, out := c.ListDeadLetterSourceQueuesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDeadLetterSourceQueuesWithContext is the same as ListDeadLetterSourceQueues with the addition of +// the ability to pass a context and additional request options. +// +// See ListDeadLetterSourceQueues 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 *SQS) ListDeadLetterSourceQueuesWithContext(ctx aws.Context, input *ListDeadLetterSourceQueuesInput, opts ...request.Option) (*ListDeadLetterSourceQueuesOutput, error) { + req, out := c.ListDeadLetterSourceQueuesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListQueues = "ListQueues" @@ -931,8 +1082,23 @@ func (c *SQS) ListQueuesRequest(input *ListQueuesInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/ListQueues func (c *SQS) ListQueues(input *ListQueuesInput) (*ListQueuesOutput, error) { req, out := c.ListQueuesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListQueuesWithContext is the same as ListQueues with the addition of +// the ability to pass a context and additional request options. +// +// See ListQueues 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 *SQS) ListQueuesWithContext(ctx aws.Context, input *ListQueuesInput, opts ...request.Option) (*ListQueuesOutput, error) { + req, out := c.ListQueuesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPurgeQueue = "PurgeQueue" @@ -1012,8 +1178,23 @@ func (c *SQS) PurgeQueueRequest(input *PurgeQueueInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/PurgeQueue func (c *SQS) PurgeQueue(input *PurgeQueueInput) (*PurgeQueueOutput, error) { req, out := c.PurgeQueueRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PurgeQueueWithContext is the same as PurgeQueue with the addition of +// the ability to pass a context and additional request options. +// +// See PurgeQueue 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 *SQS) PurgeQueueWithContext(ctx aws.Context, input *PurgeQueueInput, opts ...request.Option) (*PurgeQueueOutput, error) { + req, out := c.PurgeQueueRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opReceiveMessage = "ReceiveMessage" @@ -1126,8 +1307,23 @@ func (c *SQS) ReceiveMessageRequest(input *ReceiveMessageInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/ReceiveMessage func (c *SQS) ReceiveMessage(input *ReceiveMessageInput) (*ReceiveMessageOutput, error) { req, out := c.ReceiveMessageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ReceiveMessageWithContext is the same as ReceiveMessage with the addition of +// the ability to pass a context and additional request options. +// +// See ReceiveMessage 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 *SQS) ReceiveMessageWithContext(ctx aws.Context, input *ReceiveMessageInput, opts ...request.Option) (*ReceiveMessageOutput, error) { + req, out := c.ReceiveMessageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemovePermission = "RemovePermission" @@ -1189,8 +1385,23 @@ func (c *SQS) RemovePermissionRequest(input *RemovePermissionInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/RemovePermission func (c *SQS) RemovePermission(input *RemovePermissionInput) (*RemovePermissionOutput, error) { req, out := c.RemovePermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemovePermissionWithContext is the same as RemovePermission with the addition of +// the ability to pass a context and additional request options. +// +// See RemovePermission 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 *SQS) RemovePermissionWithContext(ctx aws.Context, input *RemovePermissionInput, opts ...request.Option) (*RemovePermissionOutput, error) { + req, out := c.RemovePermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendMessage = "SendMessage" @@ -1276,8 +1487,23 @@ func (c *SQS) SendMessageRequest(input *SendMessageInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/SendMessage func (c *SQS) SendMessage(input *SendMessageInput) (*SendMessageOutput, error) { req, out := c.SendMessageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendMessageWithContext is the same as SendMessage with the addition of +// the ability to pass a context and additional request options. +// +// See SendMessage 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 *SQS) SendMessageWithContext(ctx aws.Context, input *SendMessageInput, opts ...request.Option) (*SendMessageOutput, error) { + req, out := c.SendMessageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendMessageBatch = "SendMessageBatch" @@ -1397,8 +1623,23 @@ func (c *SQS) SendMessageBatchRequest(input *SendMessageBatchInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/SendMessageBatch func (c *SQS) SendMessageBatch(input *SendMessageBatchInput) (*SendMessageBatchOutput, error) { req, out := c.SendMessageBatchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendMessageBatchWithContext is the same as SendMessageBatch with the addition of +// the ability to pass a context and additional request options. +// +// See SendMessageBatch 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 *SQS) SendMessageBatchWithContext(ctx aws.Context, input *SendMessageBatchInput, opts ...request.Option) (*SendMessageBatchOutput, error) { + req, out := c.SendMessageBatchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSetQueueAttributes = "SetQueueAttributes" @@ -1471,8 +1712,23 @@ func (c *SQS) SetQueueAttributesRequest(input *SetQueueAttributesInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/SetQueueAttributes func (c *SQS) SetQueueAttributes(input *SetQueueAttributesInput) (*SetQueueAttributesOutput, error) { req, out := c.SetQueueAttributesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SetQueueAttributesWithContext is the same as SetQueueAttributes with the addition of +// the ability to pass a context and additional request options. +// +// See SetQueueAttributes 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 *SQS) SetQueueAttributesWithContext(ctx aws.Context, input *SetQueueAttributesInput, opts ...request.Option) (*SetQueueAttributesOutput, error) { + req, out := c.SetQueueAttributesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05/AddPermissionRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/errors.go index d4f394e0ec..722867d329 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sqs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go index 7df1fbc7eb..0fee951c53 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sqs/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sqs diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go index 56bbee8ee4..bd233e4ed8 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package ssm provides a client for Amazon Simple Systems Manager (SSM). package ssm @@ -7,6 +7,7 @@ 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" ) @@ -101,8 +102,23 @@ func (c *SSM) AddTagsToResourceRequest(input *AddTagsToResourceInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/AddTagsToResource func (c *SSM) AddTagsToResource(input *AddTagsToResourceInput) (*AddTagsToResourceOutput, error) { req, out := c.AddTagsToResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AddTagsToResourceWithContext is the same as AddTagsToResource with the addition of +// the ability to pass a context and additional request options. +// +// See AddTagsToResource 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 *SSM) AddTagsToResourceWithContext(ctx aws.Context, input *AddTagsToResourceInput, opts ...request.Option) (*AddTagsToResourceOutput, error) { + req, out := c.AddTagsToResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCancelCommand = "CancelCommand" @@ -171,12 +187,12 @@ func (c *SSM) CancelCommandRequest(input *CancelCommandInput) (req *request.Requ // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -187,8 +203,23 @@ func (c *SSM) CancelCommandRequest(input *CancelCommandInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CancelCommand func (c *SSM) CancelCommand(input *CancelCommandInput) (*CancelCommandOutput, error) { req, out := c.CancelCommandRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CancelCommandWithContext is the same as CancelCommand with the addition of +// the ability to pass a context and additional request options. +// +// See CancelCommand 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 *SSM) CancelCommandWithContext(ctx aws.Context, input *CancelCommandInput, opts ...request.Option) (*CancelCommandOutput, error) { + req, out := c.CancelCommandRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateActivation = "CreateActivation" @@ -239,10 +270,8 @@ func (c *SSM) CreateActivationRequest(input *CreateActivationInput) (req *reques // Registers your on-premises server or virtual machine with Amazon EC2 so that // you can manage these resources using Run Command. An on-premises server or // virtual machine that has been registered with EC2 is called a managed instance. -// For more information about activations, see Setting Up Managed Instances -// (Linux) (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managed-instances.html) -// or Setting Up Managed Instances (Windows) (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/managed-instances.html) -// in the Amazon EC2 User Guide. +// For more information about activations, see Setting Up Systems Manager in +// Hybrid Environments (http://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-managedinstances.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 @@ -258,8 +287,23 @@ func (c *SSM) CreateActivationRequest(input *CreateActivationInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CreateActivation func (c *SSM) CreateActivation(input *CreateActivationInput) (*CreateActivationOutput, error) { req, out := c.CreateActivationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateActivationWithContext is the same as CreateActivation with the addition of +// the ability to pass a context and additional request options. +// +// See CreateActivation 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 *SSM) CreateActivationWithContext(ctx aws.Context, input *CreateActivationInput, opts ...request.Option) (*CreateActivationOutput, error) { + req, out := c.CreateActivationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAssociation = "CreateAssociation" @@ -307,11 +351,12 @@ func (c *SSM) CreateAssociationRequest(input *CreateAssociationInput) (req *requ // CreateAssociation API operation for Amazon Simple Systems Manager (SSM). // -// Associates the specified SSM document with the specified instances or targets. +// Associates the specified Systems Manager document with the specified instances +// or targets. // -// When you associate an SSM document with one or more instances using instance -// IDs or tags, the SSM agent running on the instance processes the document -// and configures the instance as specified. +// When you associate a document with one or more instances using instance IDs +// or tags, the SSM Agent running on the instance processes the document and +// configures the instance as specified. // // If you associate a document with an instance that already has an associated // document, the system throws the AssociationAlreadyExists exception. @@ -344,19 +389,19 @@ func (c *SSM) CreateAssociationRequest(input *CreateAssociationInput) (req *requ // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. // // * ErrCodeUnsupportedPlatformType "UnsupportedPlatformType" // The document does not support the platform type of the given instance ID(s). -// For example, you sent an SSM document for a Windows instance to a Linux instance. +// For example, you sent an document for a Windows instance to a Linux instance. // // * ErrCodeInvalidOutputLocation "InvalidOutputLocation" // The output location is not valid or does not exist. @@ -375,8 +420,23 @@ func (c *SSM) CreateAssociationRequest(input *CreateAssociationInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CreateAssociation func (c *SSM) CreateAssociation(input *CreateAssociationInput) (*CreateAssociationOutput, error) { req, out := c.CreateAssociationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAssociationWithContext is the same as CreateAssociation with the addition of +// the ability to pass a context and additional request options. +// +// See CreateAssociation 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 *SSM) CreateAssociationWithContext(ctx aws.Context, input *CreateAssociationInput, opts ...request.Option) (*CreateAssociationOutput, error) { + req, out := c.CreateAssociationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateAssociationBatch = "CreateAssociationBatch" @@ -424,11 +484,12 @@ func (c *SSM) CreateAssociationBatchRequest(input *CreateAssociationBatchInput) // CreateAssociationBatch API operation for Amazon Simple Systems Manager (SSM). // -// Associates the specified SSM document with the specified instances or targets. +// Associates the specified Systems Manager document with the specified instances +// or targets. // -// When you associate an SSM document with one or more instances using instance -// IDs or tags, the SSM agent running on the instance processes the document -// and configures the instance as specified. +// When you associate a document with one or more instances using instance IDs +// or tags, the SSM Agent running on the instance processes the document and +// configures the instance as specified. // // If you associate a document with an instance that already has an associated // document, the system throws the AssociationAlreadyExists exception. @@ -455,12 +516,12 @@ func (c *SSM) CreateAssociationBatchRequest(input *CreateAssociationBatchInput) // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -477,7 +538,7 @@ func (c *SSM) CreateAssociationBatchRequest(input *CreateAssociationBatchInput) // // * ErrCodeUnsupportedPlatformType "UnsupportedPlatformType" // The document does not support the platform type of the given instance ID(s). -// For example, you sent an SSM document for a Windows instance to a Linux instance. +// For example, you sent an document for a Windows instance to a Linux instance. // // * ErrCodeInvalidOutputLocation "InvalidOutputLocation" // The output location is not valid or does not exist. @@ -492,8 +553,23 @@ func (c *SSM) CreateAssociationBatchRequest(input *CreateAssociationBatchInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CreateAssociationBatch func (c *SSM) CreateAssociationBatch(input *CreateAssociationBatchInput) (*CreateAssociationBatchOutput, error) { req, out := c.CreateAssociationBatchRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateAssociationBatchWithContext is the same as CreateAssociationBatch with the addition of +// the ability to pass a context and additional request options. +// +// See CreateAssociationBatch 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 *SSM) CreateAssociationBatchWithContext(ctx aws.Context, input *CreateAssociationBatchInput, opts ...request.Option) (*CreateAssociationBatchOutput, error) { + req, out := c.CreateAssociationBatchRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateDocument = "CreateDocument" @@ -541,10 +617,10 @@ func (c *SSM) CreateDocumentRequest(input *CreateDocumentInput) (req *request.Re // CreateDocument API operation for Amazon Simple Systems Manager (SSM). // -// Creates an SSM document. +// Creates a Systems Manager document. // -// After you create an SSM document, you can use CreateAssociation to associate -// it with one or more running instances. +// After you create a document, you can use CreateAssociation to associate it +// with one or more running 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 @@ -555,16 +631,16 @@ func (c *SSM) CreateDocumentRequest(input *CreateDocumentInput) (req *request.Re // // Returned Error Codes: // * ErrCodeDocumentAlreadyExists "DocumentAlreadyExists" -// The specified SSM document already exists. +// The specified document already exists. // // * ErrCodeMaxDocumentSizeExceeded "MaxDocumentSizeExceeded" -// The size limit of an SSM document is 64 KB. +// The size limit of a document is 64 KB. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. // // * ErrCodeInvalidDocumentContent "InvalidDocumentContent" -// The content for the SSM document is not valid. +// The content for the document is not valid. // // * ErrCodeDocumentLimitExceeded "DocumentLimitExceeded" // You can have at most 200 active SSM documents. @@ -575,8 +651,23 @@ func (c *SSM) CreateDocumentRequest(input *CreateDocumentInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CreateDocument func (c *SSM) CreateDocument(input *CreateDocumentInput) (*CreateDocumentOutput, error) { req, out := c.CreateDocumentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateDocumentWithContext is the same as CreateDocument with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDocument 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 *SSM) CreateDocumentWithContext(ctx aws.Context, input *CreateDocumentInput, opts ...request.Option) (*CreateDocumentOutput, error) { + req, out := c.CreateDocumentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateMaintenanceWindow = "CreateMaintenanceWindow" @@ -648,8 +739,23 @@ func (c *SSM) CreateMaintenanceWindowRequest(input *CreateMaintenanceWindowInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CreateMaintenanceWindow func (c *SSM) CreateMaintenanceWindow(input *CreateMaintenanceWindowInput) (*CreateMaintenanceWindowOutput, error) { req, out := c.CreateMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateMaintenanceWindowWithContext is the same as CreateMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See CreateMaintenanceWindow 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 *SSM) CreateMaintenanceWindowWithContext(ctx aws.Context, input *CreateMaintenanceWindowInput, opts ...request.Option) (*CreateMaintenanceWindowOutput, error) { + req, out := c.CreateMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreatePatchBaseline = "CreatePatchBaseline" @@ -721,8 +827,23 @@ func (c *SSM) CreatePatchBaselineRequest(input *CreatePatchBaselineInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CreatePatchBaseline func (c *SSM) CreatePatchBaseline(input *CreatePatchBaselineInput) (*CreatePatchBaselineOutput, error) { req, out := c.CreatePatchBaselineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreatePatchBaselineWithContext is the same as CreatePatchBaseline with the addition of +// the ability to pass a context and additional request options. +// +// See CreatePatchBaseline 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 *SSM) CreatePatchBaselineWithContext(ctx aws.Context, input *CreatePatchBaselineInput, opts ...request.Option) (*CreatePatchBaselineOutput, error) { + req, out := c.CreatePatchBaselineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteActivation = "DeleteActivation" @@ -797,8 +918,23 @@ func (c *SSM) DeleteActivationRequest(input *DeleteActivationInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeleteActivation func (c *SSM) DeleteActivation(input *DeleteActivationInput) (*DeleteActivationOutput, error) { req, out := c.DeleteActivationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteActivationWithContext is the same as DeleteActivation with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteActivation 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 *SSM) DeleteActivationWithContext(ctx aws.Context, input *DeleteActivationInput, opts ...request.Option) (*DeleteActivationOutput, error) { + req, out := c.DeleteActivationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteAssociation = "DeleteAssociation" @@ -846,12 +982,12 @@ func (c *SSM) DeleteAssociationRequest(input *DeleteAssociationInput) (req *requ // DeleteAssociation API operation for Amazon Simple Systems Manager (SSM). // -// Disassociates the specified SSM document from the specified instance. +// Disassociates the specified Systems Manager document from the specified instance. // -// When you disassociate an SSM document from an instance, it does not change -// the configuration of the instance. To change the configuration state of an -// instance after you disassociate a document, you must create a new document -// with the desired configuration and associate it with the instance. +// When you disassociate a document from an instance, it does not change the +// configuration of the instance. To change the configuration state of an instance +// after you disassociate a document, you must create a new document with the +// desired configuration and associate it with the instance. // // 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 @@ -875,12 +1011,12 @@ func (c *SSM) DeleteAssociationRequest(input *DeleteAssociationInput) (req *requ // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -892,8 +1028,23 @@ func (c *SSM) DeleteAssociationRequest(input *DeleteAssociationInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeleteAssociation func (c *SSM) DeleteAssociation(input *DeleteAssociationInput) (*DeleteAssociationOutput, error) { req, out := c.DeleteAssociationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteAssociationWithContext is the same as DeleteAssociation with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAssociation 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 *SSM) DeleteAssociationWithContext(ctx aws.Context, input *DeleteAssociationInput, opts ...request.Option) (*DeleteAssociationOutput, error) { + req, out := c.DeleteAssociationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteDocument = "DeleteDocument" @@ -941,9 +1092,10 @@ func (c *SSM) DeleteDocumentRequest(input *DeleteDocumentInput) (req *request.Re // DeleteDocument API operation for Amazon Simple Systems Manager (SSM). // -// Deletes the SSM document and all instance associations to the document. +// Deletes the Systems Manager document and all instance associations to the +// document. // -// Before you delete the SSM document, we recommend that you use DeleteAssociation +// Before you delete the document, we recommend that you use DeleteAssociation // to disassociate all instances that are associated with the document. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -965,14 +1117,29 @@ func (c *SSM) DeleteDocumentRequest(input *DeleteDocumentInput) (req *request.Re // sharing the document before you can delete it. // // * ErrCodeAssociatedInstances "AssociatedInstances" -// You must disassociate an SSM document from all instances before you can delete +// You must disassociate a document from all instances before you can delete // it. // // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeleteDocument func (c *SSM) DeleteDocument(input *DeleteDocumentInput) (*DeleteDocumentOutput, error) { req, out := c.DeleteDocumentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteDocumentWithContext is the same as DeleteDocument with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDocument 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 *SSM) DeleteDocumentWithContext(ctx aws.Context, input *DeleteDocumentInput, opts ...request.Option) (*DeleteDocumentOutput, error) { + req, out := c.DeleteDocumentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteMaintenanceWindow = "DeleteMaintenanceWindow" @@ -1036,8 +1203,23 @@ func (c *SSM) DeleteMaintenanceWindowRequest(input *DeleteMaintenanceWindowInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeleteMaintenanceWindow func (c *SSM) DeleteMaintenanceWindow(input *DeleteMaintenanceWindowInput) (*DeleteMaintenanceWindowOutput, error) { req, out := c.DeleteMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteMaintenanceWindowWithContext is the same as DeleteMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMaintenanceWindow 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 *SSM) DeleteMaintenanceWindowWithContext(ctx aws.Context, input *DeleteMaintenanceWindowInput, opts ...request.Option) (*DeleteMaintenanceWindowOutput, error) { + req, out := c.DeleteMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteParameter = "DeleteParameter" @@ -1104,8 +1286,23 @@ func (c *SSM) DeleteParameterRequest(input *DeleteParameterInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeleteParameter func (c *SSM) DeleteParameter(input *DeleteParameterInput) (*DeleteParameterOutput, error) { req, out := c.DeleteParameterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteParameterWithContext is the same as DeleteParameter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteParameter 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 *SSM) DeleteParameterWithContext(ctx aws.Context, input *DeleteParameterInput, opts ...request.Option) (*DeleteParameterOutput, error) { + req, out := c.DeleteParameterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeletePatchBaseline = "DeletePatchBaseline" @@ -1173,8 +1370,23 @@ func (c *SSM) DeletePatchBaselineRequest(input *DeletePatchBaselineInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeletePatchBaseline func (c *SSM) DeletePatchBaseline(input *DeletePatchBaselineInput) (*DeletePatchBaselineOutput, error) { req, out := c.DeletePatchBaselineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeletePatchBaselineWithContext is the same as DeletePatchBaseline with the addition of +// the ability to pass a context and additional request options. +// +// See DeletePatchBaseline 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 *SSM) DeletePatchBaselineWithContext(ctx aws.Context, input *DeletePatchBaselineInput, opts ...request.Option) (*DeletePatchBaselineOutput, error) { + req, out := c.DeletePatchBaselineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterManagedInstance = "DeregisterManagedInstance" @@ -1224,7 +1436,7 @@ func (c *SSM) DeregisterManagedInstanceRequest(input *DeregisterManagedInstanceI // // Removes the server or virtual machine from the list of registered servers. // You can reregister the instance again at any time. If you don’t plan to use -// Run Command on the server, we suggest uninstalling the SSM agent first. +// Run Command on the server, we suggest uninstalling the SSM Agent first. // // 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 @@ -1239,12 +1451,12 @@ func (c *SSM) DeregisterManagedInstanceRequest(input *DeregisterManagedInstanceI // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -1255,8 +1467,23 @@ func (c *SSM) DeregisterManagedInstanceRequest(input *DeregisterManagedInstanceI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeregisterManagedInstance func (c *SSM) DeregisterManagedInstance(input *DeregisterManagedInstanceInput) (*DeregisterManagedInstanceOutput, error) { req, out := c.DeregisterManagedInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterManagedInstanceWithContext is the same as DeregisterManagedInstance with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterManagedInstance 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 *SSM) DeregisterManagedInstanceWithContext(ctx aws.Context, input *DeregisterManagedInstanceInput, opts ...request.Option) (*DeregisterManagedInstanceOutput, error) { + req, out := c.DeregisterManagedInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterPatchBaselineForPatchGroup = "DeregisterPatchBaselineForPatchGroup" @@ -1324,8 +1551,23 @@ func (c *SSM) DeregisterPatchBaselineForPatchGroupRequest(input *DeregisterPatch // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeregisterPatchBaselineForPatchGroup func (c *SSM) DeregisterPatchBaselineForPatchGroup(input *DeregisterPatchBaselineForPatchGroupInput) (*DeregisterPatchBaselineForPatchGroupOutput, error) { req, out := c.DeregisterPatchBaselineForPatchGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterPatchBaselineForPatchGroupWithContext is the same as DeregisterPatchBaselineForPatchGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterPatchBaselineForPatchGroup 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 *SSM) DeregisterPatchBaselineForPatchGroupWithContext(ctx aws.Context, input *DeregisterPatchBaselineForPatchGroupInput, opts ...request.Option) (*DeregisterPatchBaselineForPatchGroupOutput, error) { + req, out := c.DeregisterPatchBaselineForPatchGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterTargetFromMaintenanceWindow = "DeregisterTargetFromMaintenanceWindow" @@ -1393,8 +1635,23 @@ func (c *SSM) DeregisterTargetFromMaintenanceWindowRequest(input *DeregisterTarg // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeregisterTargetFromMaintenanceWindow func (c *SSM) DeregisterTargetFromMaintenanceWindow(input *DeregisterTargetFromMaintenanceWindowInput) (*DeregisterTargetFromMaintenanceWindowOutput, error) { req, out := c.DeregisterTargetFromMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterTargetFromMaintenanceWindowWithContext is the same as DeregisterTargetFromMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterTargetFromMaintenanceWindow 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 *SSM) DeregisterTargetFromMaintenanceWindowWithContext(ctx aws.Context, input *DeregisterTargetFromMaintenanceWindowInput, opts ...request.Option) (*DeregisterTargetFromMaintenanceWindowOutput, error) { + req, out := c.DeregisterTargetFromMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeregisterTaskFromMaintenanceWindow = "DeregisterTaskFromMaintenanceWindow" @@ -1462,8 +1719,23 @@ func (c *SSM) DeregisterTaskFromMaintenanceWindowRequest(input *DeregisterTaskFr // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DeregisterTaskFromMaintenanceWindow func (c *SSM) DeregisterTaskFromMaintenanceWindow(input *DeregisterTaskFromMaintenanceWindowInput) (*DeregisterTaskFromMaintenanceWindowOutput, error) { req, out := c.DeregisterTaskFromMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeregisterTaskFromMaintenanceWindowWithContext is the same as DeregisterTaskFromMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See DeregisterTaskFromMaintenanceWindow 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 *SSM) DeregisterTaskFromMaintenanceWindowWithContext(ctx aws.Context, input *DeregisterTaskFromMaintenanceWindowInput, opts ...request.Option) (*DeregisterTaskFromMaintenanceWindowOutput, error) { + req, out := c.DeregisterTaskFromMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeActivations = "DescribeActivations" @@ -1542,8 +1814,23 @@ func (c *SSM) DescribeActivationsRequest(input *DescribeActivationsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeActivations func (c *SSM) DescribeActivations(input *DescribeActivationsInput) (*DescribeActivationsOutput, error) { req, out := c.DescribeActivationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeActivationsWithContext is the same as DescribeActivations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeActivations 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 *SSM) DescribeActivationsWithContext(ctx aws.Context, input *DescribeActivationsInput, opts ...request.Option) (*DescribeActivationsOutput, error) { + req, out := c.DescribeActivationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeActivationsPages iterates over the pages of a DescribeActivations operation, @@ -1563,12 +1850,37 @@ func (c *SSM) DescribeActivations(input *DescribeActivationsInput) (*DescribeAct // return pageNum <= 3 // }) // -func (c *SSM) DescribeActivationsPages(input *DescribeActivationsInput, fn func(p *DescribeActivationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeActivationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeActivationsOutput), lastPage) - }) +func (c *SSM) DescribeActivationsPages(input *DescribeActivationsInput, fn func(*DescribeActivationsOutput, bool) bool) error { + return c.DescribeActivationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeActivationsPagesWithContext same as DescribeActivationsPages 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 *SSM) DescribeActivationsPagesWithContext(ctx aws.Context, input *DescribeActivationsInput, fn func(*DescribeActivationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeActivationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeActivationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeActivationsOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeAssociation = "DescribeAssociation" @@ -1616,7 +1928,8 @@ func (c *SSM) DescribeAssociationRequest(input *DescribeAssociationInput) (req * // DescribeAssociation API operation for Amazon Simple Systems Manager (SSM). // -// Describes the associations for the specified SSM document or instance. +// Describes the associations for the specified Systems Manager document or +// instance. // // 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 @@ -1640,12 +1953,12 @@ func (c *SSM) DescribeAssociationRequest(input *DescribeAssociationInput) (req * // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -1653,8 +1966,23 @@ func (c *SSM) DescribeAssociationRequest(input *DescribeAssociationInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeAssociation func (c *SSM) DescribeAssociation(input *DescribeAssociationInput) (*DescribeAssociationOutput, error) { req, out := c.DescribeAssociationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAssociationWithContext is the same as DescribeAssociation with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAssociation 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 *SSM) DescribeAssociationWithContext(ctx aws.Context, input *DescribeAssociationInput, opts ...request.Option) (*DescribeAssociationOutput, error) { + req, out := c.DescribeAssociationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAutomationExecutions = "DescribeAutomationExecutions" @@ -1721,8 +2049,23 @@ func (c *SSM) DescribeAutomationExecutionsRequest(input *DescribeAutomationExecu // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeAutomationExecutions func (c *SSM) DescribeAutomationExecutions(input *DescribeAutomationExecutionsInput) (*DescribeAutomationExecutionsOutput, error) { req, out := c.DescribeAutomationExecutionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAutomationExecutionsWithContext is the same as DescribeAutomationExecutions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAutomationExecutions 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 *SSM) DescribeAutomationExecutionsWithContext(ctx aws.Context, input *DescribeAutomationExecutionsInput, opts ...request.Option) (*DescribeAutomationExecutionsOutput, error) { + req, out := c.DescribeAutomationExecutionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeAvailablePatches = "DescribeAvailablePatches" @@ -1786,8 +2129,23 @@ func (c *SSM) DescribeAvailablePatchesRequest(input *DescribeAvailablePatchesInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeAvailablePatches func (c *SSM) DescribeAvailablePatches(input *DescribeAvailablePatchesInput) (*DescribeAvailablePatchesOutput, error) { req, out := c.DescribeAvailablePatchesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeAvailablePatchesWithContext is the same as DescribeAvailablePatches with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAvailablePatches 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 *SSM) DescribeAvailablePatchesWithContext(ctx aws.Context, input *DescribeAvailablePatchesInput, opts ...request.Option) (*DescribeAvailablePatchesOutput, error) { + req, out := c.DescribeAvailablePatchesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDocument = "DescribeDocument" @@ -1857,8 +2215,23 @@ func (c *SSM) DescribeDocumentRequest(input *DescribeDocumentInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeDocument func (c *SSM) DescribeDocument(input *DescribeDocumentInput) (*DescribeDocumentOutput, error) { req, out := c.DescribeDocumentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDocumentWithContext is the same as DescribeDocument with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDocument 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 *SSM) DescribeDocumentWithContext(ctx aws.Context, input *DescribeDocumentInput, opts ...request.Option) (*DescribeDocumentOutput, error) { + req, out := c.DescribeDocumentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeDocumentPermission = "DescribeDocumentPermission" @@ -1906,9 +2279,9 @@ func (c *SSM) DescribeDocumentPermissionRequest(input *DescribeDocumentPermissio // DescribeDocumentPermission API operation for Amazon Simple Systems Manager (SSM). // -// Describes the permissions for an SSM document. If you created the document, -// you are the owner. If a document is shared, it can either be shared privately -// (by specifying a user’s AWS account ID) or publicly (All). +// Describes the permissions for a Systems Manager document. If you created +// the document, you are the owner. If a document is shared, it can either be +// shared privately (by specifying a user’s AWS account ID) or publicly (All). // // 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 @@ -1931,8 +2304,23 @@ func (c *SSM) DescribeDocumentPermissionRequest(input *DescribeDocumentPermissio // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeDocumentPermission func (c *SSM) DescribeDocumentPermission(input *DescribeDocumentPermissionInput) (*DescribeDocumentPermissionOutput, error) { req, out := c.DescribeDocumentPermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeDocumentPermissionWithContext is the same as DescribeDocumentPermission with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDocumentPermission 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 *SSM) DescribeDocumentPermissionWithContext(ctx aws.Context, input *DescribeDocumentPermissionInput, opts ...request.Option) (*DescribeDocumentPermissionOutput, error) { + req, out := c.DescribeDocumentPermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEffectiveInstanceAssociations = "DescribeEffectiveInstanceAssociations" @@ -1998,12 +2386,12 @@ func (c *SSM) DescribeEffectiveInstanceAssociationsRequest(input *DescribeEffect // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -2014,8 +2402,23 @@ func (c *SSM) DescribeEffectiveInstanceAssociationsRequest(input *DescribeEffect // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeEffectiveInstanceAssociations func (c *SSM) DescribeEffectiveInstanceAssociations(input *DescribeEffectiveInstanceAssociationsInput) (*DescribeEffectiveInstanceAssociationsOutput, error) { req, out := c.DescribeEffectiveInstanceAssociationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEffectiveInstanceAssociationsWithContext is the same as DescribeEffectiveInstanceAssociations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEffectiveInstanceAssociations 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 *SSM) DescribeEffectiveInstanceAssociationsWithContext(ctx aws.Context, input *DescribeEffectiveInstanceAssociationsInput, opts ...request.Option) (*DescribeEffectiveInstanceAssociationsOutput, error) { + req, out := c.DescribeEffectiveInstanceAssociationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeEffectivePatchesForPatchBaseline = "DescribeEffectivePatchesForPatchBaseline" @@ -2088,8 +2491,23 @@ func (c *SSM) DescribeEffectivePatchesForPatchBaselineRequest(input *DescribeEff // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeEffectivePatchesForPatchBaseline func (c *SSM) DescribeEffectivePatchesForPatchBaseline(input *DescribeEffectivePatchesForPatchBaselineInput) (*DescribeEffectivePatchesForPatchBaselineOutput, error) { req, out := c.DescribeEffectivePatchesForPatchBaselineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeEffectivePatchesForPatchBaselineWithContext is the same as DescribeEffectivePatchesForPatchBaseline with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeEffectivePatchesForPatchBaseline 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 *SSM) DescribeEffectivePatchesForPatchBaselineWithContext(ctx aws.Context, input *DescribeEffectivePatchesForPatchBaselineInput, opts ...request.Option) (*DescribeEffectivePatchesForPatchBaselineOutput, error) { + req, out := c.DescribeEffectivePatchesForPatchBaselineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeInstanceAssociationsStatus = "DescribeInstanceAssociationsStatus" @@ -2155,12 +2573,12 @@ func (c *SSM) DescribeInstanceAssociationsStatusRequest(input *DescribeInstanceA // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -2171,8 +2589,23 @@ func (c *SSM) DescribeInstanceAssociationsStatusRequest(input *DescribeInstanceA // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeInstanceAssociationsStatus func (c *SSM) DescribeInstanceAssociationsStatus(input *DescribeInstanceAssociationsStatusInput) (*DescribeInstanceAssociationsStatusOutput, error) { req, out := c.DescribeInstanceAssociationsStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstanceAssociationsStatusWithContext is the same as DescribeInstanceAssociationsStatus with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstanceAssociationsStatus 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 *SSM) DescribeInstanceAssociationsStatusWithContext(ctx aws.Context, input *DescribeInstanceAssociationsStatusInput, opts ...request.Option) (*DescribeInstanceAssociationsStatusOutput, error) { + req, out := c.DescribeInstanceAssociationsStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeInstanceInformation = "DescribeInstanceInformation" @@ -2227,7 +2660,7 @@ func (c *SSM) DescribeInstanceInformationRequest(input *DescribeInstanceInformat // DescribeInstanceInformation API operation for Amazon Simple Systems Manager (SSM). // // Describes one or more of your instances. You can use this to get information -// about instances like the operating system platform, the SSM agent version +// about instances like the operating system platform, the SSM Agent version // (Linux), status etc. If you specify one or more instance IDs, it returns // information for those instances. If you do not specify instance IDs, it returns // information for all your instances. If you specify an instance ID that is @@ -2249,12 +2682,12 @@ func (c *SSM) DescribeInstanceInformationRequest(input *DescribeInstanceInformat // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -2271,8 +2704,23 @@ func (c *SSM) DescribeInstanceInformationRequest(input *DescribeInstanceInformat // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeInstanceInformation func (c *SSM) DescribeInstanceInformation(input *DescribeInstanceInformationInput) (*DescribeInstanceInformationOutput, error) { req, out := c.DescribeInstanceInformationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstanceInformationWithContext is the same as DescribeInstanceInformation with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstanceInformation 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 *SSM) DescribeInstanceInformationWithContext(ctx aws.Context, input *DescribeInstanceInformationInput, opts ...request.Option) (*DescribeInstanceInformationOutput, error) { + req, out := c.DescribeInstanceInformationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // DescribeInstanceInformationPages iterates over the pages of a DescribeInstanceInformation operation, @@ -2292,12 +2740,37 @@ func (c *SSM) DescribeInstanceInformation(input *DescribeInstanceInformationInpu // return pageNum <= 3 // }) // -func (c *SSM) DescribeInstanceInformationPages(input *DescribeInstanceInformationInput, fn func(p *DescribeInstanceInformationOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.DescribeInstanceInformationRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*DescribeInstanceInformationOutput), lastPage) - }) +func (c *SSM) DescribeInstanceInformationPages(input *DescribeInstanceInformationInput, fn func(*DescribeInstanceInformationOutput, bool) bool) error { + return c.DescribeInstanceInformationPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeInstanceInformationPagesWithContext same as DescribeInstanceInformationPages 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 *SSM) DescribeInstanceInformationPagesWithContext(ctx aws.Context, input *DescribeInstanceInformationInput, fn func(*DescribeInstanceInformationOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeInstanceInformationInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInstanceInformationRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeInstanceInformationOutput), !p.HasNextPage()) + } + return p.Err() } const opDescribeInstancePatchStates = "DescribeInstancePatchStates" @@ -2364,8 +2837,23 @@ func (c *SSM) DescribeInstancePatchStatesRequest(input *DescribeInstancePatchSta // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeInstancePatchStates func (c *SSM) DescribeInstancePatchStates(input *DescribeInstancePatchStatesInput) (*DescribeInstancePatchStatesOutput, error) { req, out := c.DescribeInstancePatchStatesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstancePatchStatesWithContext is the same as DescribeInstancePatchStates with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstancePatchStates 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 *SSM) DescribeInstancePatchStatesWithContext(ctx aws.Context, input *DescribeInstancePatchStatesInput, opts ...request.Option) (*DescribeInstancePatchStatesOutput, error) { + req, out := c.DescribeInstancePatchStatesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeInstancePatchStatesForPatchGroup = "DescribeInstancePatchStatesForPatchGroup" @@ -2437,8 +2925,23 @@ func (c *SSM) DescribeInstancePatchStatesForPatchGroupRequest(input *DescribeIns // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeInstancePatchStatesForPatchGroup func (c *SSM) DescribeInstancePatchStatesForPatchGroup(input *DescribeInstancePatchStatesForPatchGroupInput) (*DescribeInstancePatchStatesForPatchGroupOutput, error) { req, out := c.DescribeInstancePatchStatesForPatchGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstancePatchStatesForPatchGroupWithContext is the same as DescribeInstancePatchStatesForPatchGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstancePatchStatesForPatchGroup 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 *SSM) DescribeInstancePatchStatesForPatchGroupWithContext(ctx aws.Context, input *DescribeInstancePatchStatesForPatchGroupInput, opts ...request.Option) (*DescribeInstancePatchStatesForPatchGroupOutput, error) { + req, out := c.DescribeInstancePatchStatesForPatchGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeInstancePatches = "DescribeInstancePatches" @@ -2505,12 +3008,12 @@ func (c *SSM) DescribeInstancePatchesRequest(input *DescribeInstancePatchesInput // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -2525,8 +3028,23 @@ func (c *SSM) DescribeInstancePatchesRequest(input *DescribeInstancePatchesInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeInstancePatches func (c *SSM) DescribeInstancePatches(input *DescribeInstancePatchesInput) (*DescribeInstancePatchesOutput, error) { req, out := c.DescribeInstancePatchesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeInstancePatchesWithContext is the same as DescribeInstancePatches with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInstancePatches 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 *SSM) DescribeInstancePatchesWithContext(ctx aws.Context, input *DescribeInstancePatchesInput, opts ...request.Option) (*DescribeInstancePatchesOutput, error) { + req, out := c.DescribeInstancePatchesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMaintenanceWindowExecutionTaskInvocations = "DescribeMaintenanceWindowExecutionTaskInvocations" @@ -2595,8 +3113,23 @@ func (c *SSM) DescribeMaintenanceWindowExecutionTaskInvocationsRequest(input *De // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeMaintenanceWindowExecutionTaskInvocations func (c *SSM) DescribeMaintenanceWindowExecutionTaskInvocations(input *DescribeMaintenanceWindowExecutionTaskInvocationsInput) (*DescribeMaintenanceWindowExecutionTaskInvocationsOutput, error) { req, out := c.DescribeMaintenanceWindowExecutionTaskInvocationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMaintenanceWindowExecutionTaskInvocationsWithContext is the same as DescribeMaintenanceWindowExecutionTaskInvocations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMaintenanceWindowExecutionTaskInvocations 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 *SSM) DescribeMaintenanceWindowExecutionTaskInvocationsWithContext(ctx aws.Context, input *DescribeMaintenanceWindowExecutionTaskInvocationsInput, opts ...request.Option) (*DescribeMaintenanceWindowExecutionTaskInvocationsOutput, error) { + req, out := c.DescribeMaintenanceWindowExecutionTaskInvocationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMaintenanceWindowExecutionTasks = "DescribeMaintenanceWindowExecutionTasks" @@ -2664,8 +3197,23 @@ func (c *SSM) DescribeMaintenanceWindowExecutionTasksRequest(input *DescribeMain // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeMaintenanceWindowExecutionTasks func (c *SSM) DescribeMaintenanceWindowExecutionTasks(input *DescribeMaintenanceWindowExecutionTasksInput) (*DescribeMaintenanceWindowExecutionTasksOutput, error) { req, out := c.DescribeMaintenanceWindowExecutionTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMaintenanceWindowExecutionTasksWithContext is the same as DescribeMaintenanceWindowExecutionTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMaintenanceWindowExecutionTasks 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 *SSM) DescribeMaintenanceWindowExecutionTasksWithContext(ctx aws.Context, input *DescribeMaintenanceWindowExecutionTasksInput, opts ...request.Option) (*DescribeMaintenanceWindowExecutionTasksOutput, error) { + req, out := c.DescribeMaintenanceWindowExecutionTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMaintenanceWindowExecutions = "DescribeMaintenanceWindowExecutions" @@ -2731,8 +3279,23 @@ func (c *SSM) DescribeMaintenanceWindowExecutionsRequest(input *DescribeMaintena // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeMaintenanceWindowExecutions func (c *SSM) DescribeMaintenanceWindowExecutions(input *DescribeMaintenanceWindowExecutionsInput) (*DescribeMaintenanceWindowExecutionsOutput, error) { req, out := c.DescribeMaintenanceWindowExecutionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMaintenanceWindowExecutionsWithContext is the same as DescribeMaintenanceWindowExecutions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMaintenanceWindowExecutions 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 *SSM) DescribeMaintenanceWindowExecutionsWithContext(ctx aws.Context, input *DescribeMaintenanceWindowExecutionsInput, opts ...request.Option) (*DescribeMaintenanceWindowExecutionsOutput, error) { + req, out := c.DescribeMaintenanceWindowExecutionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMaintenanceWindowTargets = "DescribeMaintenanceWindowTargets" @@ -2800,8 +3363,23 @@ func (c *SSM) DescribeMaintenanceWindowTargetsRequest(input *DescribeMaintenance // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeMaintenanceWindowTargets func (c *SSM) DescribeMaintenanceWindowTargets(input *DescribeMaintenanceWindowTargetsInput) (*DescribeMaintenanceWindowTargetsOutput, error) { req, out := c.DescribeMaintenanceWindowTargetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMaintenanceWindowTargetsWithContext is the same as DescribeMaintenanceWindowTargets with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMaintenanceWindowTargets 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 *SSM) DescribeMaintenanceWindowTargetsWithContext(ctx aws.Context, input *DescribeMaintenanceWindowTargetsInput, opts ...request.Option) (*DescribeMaintenanceWindowTargetsOutput, error) { + req, out := c.DescribeMaintenanceWindowTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMaintenanceWindowTasks = "DescribeMaintenanceWindowTasks" @@ -2869,8 +3447,23 @@ func (c *SSM) DescribeMaintenanceWindowTasksRequest(input *DescribeMaintenanceWi // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeMaintenanceWindowTasks func (c *SSM) DescribeMaintenanceWindowTasks(input *DescribeMaintenanceWindowTasksInput) (*DescribeMaintenanceWindowTasksOutput, error) { req, out := c.DescribeMaintenanceWindowTasksRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMaintenanceWindowTasksWithContext is the same as DescribeMaintenanceWindowTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMaintenanceWindowTasks 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 *SSM) DescribeMaintenanceWindowTasksWithContext(ctx aws.Context, input *DescribeMaintenanceWindowTasksInput, opts ...request.Option) (*DescribeMaintenanceWindowTasksOutput, error) { + req, out := c.DescribeMaintenanceWindowTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeMaintenanceWindows = "DescribeMaintenanceWindows" @@ -2934,8 +3527,23 @@ func (c *SSM) DescribeMaintenanceWindowsRequest(input *DescribeMaintenanceWindow // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeMaintenanceWindows func (c *SSM) DescribeMaintenanceWindows(input *DescribeMaintenanceWindowsInput) (*DescribeMaintenanceWindowsOutput, error) { req, out := c.DescribeMaintenanceWindowsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeMaintenanceWindowsWithContext is the same as DescribeMaintenanceWindows with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMaintenanceWindows 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 *SSM) DescribeMaintenanceWindowsWithContext(ctx aws.Context, input *DescribeMaintenanceWindowsInput, opts ...request.Option) (*DescribeMaintenanceWindowsOutput, error) { + req, out := c.DescribeMaintenanceWindowsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribeParameters = "DescribeParameters" @@ -3005,8 +3613,23 @@ func (c *SSM) DescribeParametersRequest(input *DescribeParametersInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribeParameters func (c *SSM) DescribeParameters(input *DescribeParametersInput) (*DescribeParametersOutput, error) { req, out := c.DescribeParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribeParametersWithContext is the same as DescribeParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeParameters 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 *SSM) DescribeParametersWithContext(ctx aws.Context, input *DescribeParametersInput, opts ...request.Option) (*DescribeParametersOutput, error) { + req, out := c.DescribeParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribePatchBaselines = "DescribePatchBaselines" @@ -3070,8 +3693,23 @@ func (c *SSM) DescribePatchBaselinesRequest(input *DescribePatchBaselinesInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribePatchBaselines func (c *SSM) DescribePatchBaselines(input *DescribePatchBaselinesInput) (*DescribePatchBaselinesOutput, error) { req, out := c.DescribePatchBaselinesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribePatchBaselinesWithContext is the same as DescribePatchBaselines with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePatchBaselines 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 *SSM) DescribePatchBaselinesWithContext(ctx aws.Context, input *DescribePatchBaselinesInput, opts ...request.Option) (*DescribePatchBaselinesOutput, error) { + req, out := c.DescribePatchBaselinesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribePatchGroupState = "DescribePatchGroupState" @@ -3138,8 +3776,23 @@ func (c *SSM) DescribePatchGroupStateRequest(input *DescribePatchGroupStateInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribePatchGroupState func (c *SSM) DescribePatchGroupState(input *DescribePatchGroupStateInput) (*DescribePatchGroupStateOutput, error) { req, out := c.DescribePatchGroupStateRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribePatchGroupStateWithContext is the same as DescribePatchGroupState with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePatchGroupState 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 *SSM) DescribePatchGroupStateWithContext(ctx aws.Context, input *DescribePatchGroupStateInput, opts ...request.Option) (*DescribePatchGroupStateOutput, error) { + req, out := c.DescribePatchGroupStateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDescribePatchGroups = "DescribePatchGroups" @@ -3203,8 +3856,23 @@ func (c *SSM) DescribePatchGroupsRequest(input *DescribePatchGroupsInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DescribePatchGroups func (c *SSM) DescribePatchGroups(input *DescribePatchGroupsInput) (*DescribePatchGroupsOutput, error) { req, out := c.DescribePatchGroupsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DescribePatchGroupsWithContext is the same as DescribePatchGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribePatchGroups 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 *SSM) DescribePatchGroupsWithContext(ctx aws.Context, input *DescribePatchGroupsInput, opts ...request.Option) (*DescribePatchGroupsOutput, error) { + req, out := c.DescribePatchGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetAutomationExecution = "GetAutomationExecution" @@ -3272,8 +3940,23 @@ func (c *SSM) GetAutomationExecutionRequest(input *GetAutomationExecutionInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetAutomationExecution func (c *SSM) GetAutomationExecution(input *GetAutomationExecutionInput) (*GetAutomationExecutionOutput, error) { req, out := c.GetAutomationExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetAutomationExecutionWithContext is the same as GetAutomationExecution with the addition of +// the ability to pass a context and additional request options. +// +// See GetAutomationExecution 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 *SSM) GetAutomationExecutionWithContext(ctx aws.Context, input *GetAutomationExecutionInput, opts ...request.Option) (*GetAutomationExecutionOutput, error) { + req, out := c.GetAutomationExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetCommandInvocation = "GetCommandInvocation" @@ -3342,12 +4025,12 @@ func (c *SSM) GetCommandInvocationRequest(input *GetCommandInvocationInput) (req // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -3362,8 +4045,23 @@ func (c *SSM) GetCommandInvocationRequest(input *GetCommandInvocationInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetCommandInvocation func (c *SSM) GetCommandInvocation(input *GetCommandInvocationInput) (*GetCommandInvocationOutput, error) { req, out := c.GetCommandInvocationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCommandInvocationWithContext is the same as GetCommandInvocation with the addition of +// the ability to pass a context and additional request options. +// +// See GetCommandInvocation 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 *SSM) GetCommandInvocationWithContext(ctx aws.Context, input *GetCommandInvocationInput, opts ...request.Option) (*GetCommandInvocationOutput, error) { + req, out := c.GetCommandInvocationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDefaultPatchBaseline = "GetDefaultPatchBaseline" @@ -3427,8 +4125,23 @@ func (c *SSM) GetDefaultPatchBaselineRequest(input *GetDefaultPatchBaselineInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetDefaultPatchBaseline func (c *SSM) GetDefaultPatchBaseline(input *GetDefaultPatchBaselineInput) (*GetDefaultPatchBaselineOutput, error) { req, out := c.GetDefaultPatchBaselineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDefaultPatchBaselineWithContext is the same as GetDefaultPatchBaseline with the addition of +// the ability to pass a context and additional request options. +// +// See GetDefaultPatchBaseline 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 *SSM) GetDefaultPatchBaselineWithContext(ctx aws.Context, input *GetDefaultPatchBaselineInput, opts ...request.Option) (*GetDefaultPatchBaselineOutput, error) { + req, out := c.GetDefaultPatchBaselineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDeployablePatchSnapshotForInstance = "GetDeployablePatchSnapshotForInstance" @@ -3494,8 +4207,23 @@ func (c *SSM) GetDeployablePatchSnapshotForInstanceRequest(input *GetDeployableP // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetDeployablePatchSnapshotForInstance func (c *SSM) GetDeployablePatchSnapshotForInstance(input *GetDeployablePatchSnapshotForInstanceInput) (*GetDeployablePatchSnapshotForInstanceOutput, error) { req, out := c.GetDeployablePatchSnapshotForInstanceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDeployablePatchSnapshotForInstanceWithContext is the same as GetDeployablePatchSnapshotForInstance with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeployablePatchSnapshotForInstance 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 *SSM) GetDeployablePatchSnapshotForInstanceWithContext(ctx aws.Context, input *GetDeployablePatchSnapshotForInstanceInput, opts ...request.Option) (*GetDeployablePatchSnapshotForInstanceOutput, error) { + req, out := c.GetDeployablePatchSnapshotForInstanceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetDocument = "GetDocument" @@ -3565,8 +4293,23 @@ func (c *SSM) GetDocumentRequest(input *GetDocumentInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetDocument func (c *SSM) GetDocument(input *GetDocumentInput) (*GetDocumentOutput, error) { req, out := c.GetDocumentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetDocumentWithContext is the same as GetDocument with the addition of +// the ability to pass a context and additional request options. +// +// See GetDocument 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 *SSM) GetDocumentWithContext(ctx aws.Context, input *GetDocumentInput, opts ...request.Option) (*GetDocumentOutput, error) { + req, out := c.GetDocumentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInventory = "GetInventory" @@ -3643,8 +4386,23 @@ func (c *SSM) GetInventoryRequest(input *GetInventoryInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetInventory func (c *SSM) GetInventory(input *GetInventoryInput) (*GetInventoryOutput, error) { req, out := c.GetInventoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInventoryWithContext is the same as GetInventory with the addition of +// the ability to pass a context and additional request options. +// +// See GetInventory 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 *SSM) GetInventoryWithContext(ctx aws.Context, input *GetInventoryInput, opts ...request.Option) (*GetInventoryOutput, error) { + req, out := c.GetInventoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetInventorySchema = "GetInventorySchema" @@ -3715,8 +4473,23 @@ func (c *SSM) GetInventorySchemaRequest(input *GetInventorySchemaInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetInventorySchema func (c *SSM) GetInventorySchema(input *GetInventorySchemaInput) (*GetInventorySchemaOutput, error) { req, out := c.GetInventorySchemaRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetInventorySchemaWithContext is the same as GetInventorySchema with the addition of +// the ability to pass a context and additional request options. +// +// See GetInventorySchema 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 *SSM) GetInventorySchemaWithContext(ctx aws.Context, input *GetInventorySchemaInput, opts ...request.Option) (*GetInventorySchemaOutput, error) { + req, out := c.GetInventorySchemaRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetMaintenanceWindow = "GetMaintenanceWindow" @@ -3784,8 +4557,23 @@ func (c *SSM) GetMaintenanceWindowRequest(input *GetMaintenanceWindowInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetMaintenanceWindow func (c *SSM) GetMaintenanceWindow(input *GetMaintenanceWindowInput) (*GetMaintenanceWindowOutput, error) { req, out := c.GetMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetMaintenanceWindowWithContext is the same as GetMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See GetMaintenanceWindow 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 *SSM) GetMaintenanceWindowWithContext(ctx aws.Context, input *GetMaintenanceWindowInput, opts ...request.Option) (*GetMaintenanceWindowOutput, error) { + req, out := c.GetMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetMaintenanceWindowExecution = "GetMaintenanceWindowExecution" @@ -3854,8 +4642,23 @@ func (c *SSM) GetMaintenanceWindowExecutionRequest(input *GetMaintenanceWindowEx // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetMaintenanceWindowExecution func (c *SSM) GetMaintenanceWindowExecution(input *GetMaintenanceWindowExecutionInput) (*GetMaintenanceWindowExecutionOutput, error) { req, out := c.GetMaintenanceWindowExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetMaintenanceWindowExecutionWithContext is the same as GetMaintenanceWindowExecution with the addition of +// the ability to pass a context and additional request options. +// +// See GetMaintenanceWindowExecution 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 *SSM) GetMaintenanceWindowExecutionWithContext(ctx aws.Context, input *GetMaintenanceWindowExecutionInput, opts ...request.Option) (*GetMaintenanceWindowExecutionOutput, error) { + req, out := c.GetMaintenanceWindowExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetMaintenanceWindowExecutionTask = "GetMaintenanceWindowExecutionTask" @@ -3924,8 +4727,23 @@ func (c *SSM) GetMaintenanceWindowExecutionTaskRequest(input *GetMaintenanceWind // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetMaintenanceWindowExecutionTask func (c *SSM) GetMaintenanceWindowExecutionTask(input *GetMaintenanceWindowExecutionTaskInput) (*GetMaintenanceWindowExecutionTaskOutput, error) { req, out := c.GetMaintenanceWindowExecutionTaskRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetMaintenanceWindowExecutionTaskWithContext is the same as GetMaintenanceWindowExecutionTask with the addition of +// the ability to pass a context and additional request options. +// +// See GetMaintenanceWindowExecutionTask 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 *SSM) GetMaintenanceWindowExecutionTaskWithContext(ctx aws.Context, input *GetMaintenanceWindowExecutionTaskInput, opts ...request.Option) (*GetMaintenanceWindowExecutionTaskOutput, error) { + req, out := c.GetMaintenanceWindowExecutionTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetParameterHistory = "GetParameterHistory" @@ -3995,8 +4813,23 @@ func (c *SSM) GetParameterHistoryRequest(input *GetParameterHistoryInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetParameterHistory func (c *SSM) GetParameterHistory(input *GetParameterHistoryInput) (*GetParameterHistoryOutput, error) { req, out := c.GetParameterHistoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetParameterHistoryWithContext is the same as GetParameterHistory with the addition of +// the ability to pass a context and additional request options. +// +// See GetParameterHistory 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 *SSM) GetParameterHistoryWithContext(ctx aws.Context, input *GetParameterHistoryInput, opts ...request.Option) (*GetParameterHistoryOutput, error) { + req, out := c.GetParameterHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetParameters = "GetParameters" @@ -4044,7 +4877,7 @@ func (c *SSM) GetParametersRequest(input *GetParametersInput) (req *request.Requ // GetParameters API operation for Amazon Simple Systems Manager (SSM). // -// Get a list of parameters used by the AWS account.> +// Get details of a parameter. // // 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 @@ -4060,8 +4893,23 @@ func (c *SSM) GetParametersRequest(input *GetParametersInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetParameters func (c *SSM) GetParameters(input *GetParametersInput) (*GetParametersOutput, error) { req, out := c.GetParametersRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetParametersWithContext is the same as GetParameters with the addition of +// the ability to pass a context and additional request options. +// +// See GetParameters 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 *SSM) GetParametersWithContext(ctx aws.Context, input *GetParametersInput, opts ...request.Option) (*GetParametersOutput, error) { + req, out := c.GetParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPatchBaseline = "GetPatchBaseline" @@ -4133,8 +4981,23 @@ func (c *SSM) GetPatchBaselineRequest(input *GetPatchBaselineInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetPatchBaseline func (c *SSM) GetPatchBaseline(input *GetPatchBaselineInput) (*GetPatchBaselineOutput, error) { req, out := c.GetPatchBaselineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPatchBaselineWithContext is the same as GetPatchBaseline with the addition of +// the ability to pass a context and additional request options. +// +// See GetPatchBaseline 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 *SSM) GetPatchBaselineWithContext(ctx aws.Context, input *GetPatchBaselineInput, opts ...request.Option) (*GetPatchBaselineOutput, error) { + req, out := c.GetPatchBaselineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetPatchBaselineForPatchGroup = "GetPatchBaselineForPatchGroup" @@ -4199,8 +5062,23 @@ func (c *SSM) GetPatchBaselineForPatchGroupRequest(input *GetPatchBaselineForPat // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetPatchBaselineForPatchGroup func (c *SSM) GetPatchBaselineForPatchGroup(input *GetPatchBaselineForPatchGroupInput) (*GetPatchBaselineForPatchGroupOutput, error) { req, out := c.GetPatchBaselineForPatchGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetPatchBaselineForPatchGroupWithContext is the same as GetPatchBaselineForPatchGroup with the addition of +// the ability to pass a context and additional request options. +// +// See GetPatchBaselineForPatchGroup 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 *SSM) GetPatchBaselineForPatchGroupWithContext(ctx aws.Context, input *GetPatchBaselineForPatchGroupInput, opts ...request.Option) (*GetPatchBaselineForPatchGroupOutput, error) { + req, out := c.GetPatchBaselineForPatchGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListAssociations = "ListAssociations" @@ -4254,7 +5132,7 @@ func (c *SSM) ListAssociationsRequest(input *ListAssociationsInput) (req *reques // ListAssociations API operation for Amazon Simple Systems Manager (SSM). // -// Lists the associations for the specified SSM document or instance. +// Lists the associations for the specified Systems Manager document or instance. // // 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 @@ -4273,8 +5151,23 @@ func (c *SSM) ListAssociationsRequest(input *ListAssociationsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ListAssociations func (c *SSM) ListAssociations(input *ListAssociationsInput) (*ListAssociationsOutput, error) { req, out := c.ListAssociationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListAssociationsWithContext is the same as ListAssociations with the addition of +// the ability to pass a context and additional request options. +// +// See ListAssociations 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 *SSM) ListAssociationsWithContext(ctx aws.Context, input *ListAssociationsInput, opts ...request.Option) (*ListAssociationsOutput, error) { + req, out := c.ListAssociationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListAssociationsPages iterates over the pages of a ListAssociations operation, @@ -4294,12 +5187,37 @@ func (c *SSM) ListAssociations(input *ListAssociationsInput) (*ListAssociationsO // return pageNum <= 3 // }) // -func (c *SSM) ListAssociationsPages(input *ListAssociationsInput, fn func(p *ListAssociationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListAssociationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListAssociationsOutput), lastPage) - }) +func (c *SSM) ListAssociationsPages(input *ListAssociationsInput, fn func(*ListAssociationsOutput, bool) bool) error { + return c.ListAssociationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListAssociationsPagesWithContext same as ListAssociationsPages 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 *SSM) ListAssociationsPagesWithContext(ctx aws.Context, input *ListAssociationsInput, fn func(*ListAssociationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListAssociationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListAssociationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListAssociationsOutput), !p.HasNextPage()) + } + return p.Err() } const opListCommandInvocations = "ListCommandInvocations" @@ -4377,12 +5295,12 @@ func (c *SSM) ListCommandInvocationsRequest(input *ListCommandInvocationsInput) // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -4396,8 +5314,23 @@ func (c *SSM) ListCommandInvocationsRequest(input *ListCommandInvocationsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ListCommandInvocations func (c *SSM) ListCommandInvocations(input *ListCommandInvocationsInput) (*ListCommandInvocationsOutput, error) { req, out := c.ListCommandInvocationsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListCommandInvocationsWithContext is the same as ListCommandInvocations with the addition of +// the ability to pass a context and additional request options. +// +// See ListCommandInvocations 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 *SSM) ListCommandInvocationsWithContext(ctx aws.Context, input *ListCommandInvocationsInput, opts ...request.Option) (*ListCommandInvocationsOutput, error) { + req, out := c.ListCommandInvocationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListCommandInvocationsPages iterates over the pages of a ListCommandInvocations operation, @@ -4417,12 +5350,37 @@ func (c *SSM) ListCommandInvocations(input *ListCommandInvocationsInput) (*ListC // return pageNum <= 3 // }) // -func (c *SSM) ListCommandInvocationsPages(input *ListCommandInvocationsInput, fn func(p *ListCommandInvocationsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListCommandInvocationsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListCommandInvocationsOutput), lastPage) - }) +func (c *SSM) ListCommandInvocationsPages(input *ListCommandInvocationsInput, fn func(*ListCommandInvocationsOutput, bool) bool) error { + return c.ListCommandInvocationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListCommandInvocationsPagesWithContext same as ListCommandInvocationsPages 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 *SSM) ListCommandInvocationsPagesWithContext(ctx aws.Context, input *ListCommandInvocationsInput, fn func(*ListCommandInvocationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListCommandInvocationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListCommandInvocationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListCommandInvocationsOutput), !p.HasNextPage()) + } + return p.Err() } const opListCommands = "ListCommands" @@ -4496,12 +5454,12 @@ func (c *SSM) ListCommandsRequest(input *ListCommandsInput) (req *request.Reques // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -4515,8 +5473,23 @@ func (c *SSM) ListCommandsRequest(input *ListCommandsInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ListCommands func (c *SSM) ListCommands(input *ListCommandsInput) (*ListCommandsOutput, error) { req, out := c.ListCommandsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListCommandsWithContext is the same as ListCommands with the addition of +// the ability to pass a context and additional request options. +// +// See ListCommands 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 *SSM) ListCommandsWithContext(ctx aws.Context, input *ListCommandsInput, opts ...request.Option) (*ListCommandsOutput, error) { + req, out := c.ListCommandsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListCommandsPages iterates over the pages of a ListCommands operation, @@ -4536,12 +5509,37 @@ func (c *SSM) ListCommands(input *ListCommandsInput) (*ListCommandsOutput, error // return pageNum <= 3 // }) // -func (c *SSM) ListCommandsPages(input *ListCommandsInput, fn func(p *ListCommandsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListCommandsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListCommandsOutput), lastPage) - }) +func (c *SSM) ListCommandsPages(input *ListCommandsInput, fn func(*ListCommandsOutput, bool) bool) error { + return c.ListCommandsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListCommandsPagesWithContext same as ListCommandsPages 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 *SSM) ListCommandsPagesWithContext(ctx aws.Context, input *ListCommandsInput, fn func(*ListCommandsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListCommandsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListCommandsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListCommandsOutput), !p.HasNextPage()) + } + return p.Err() } const opListDocumentVersions = "ListDocumentVersions" @@ -4611,8 +5609,23 @@ func (c *SSM) ListDocumentVersionsRequest(input *ListDocumentVersionsInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ListDocumentVersions func (c *SSM) ListDocumentVersions(input *ListDocumentVersionsInput) (*ListDocumentVersionsOutput, error) { req, out := c.ListDocumentVersionsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDocumentVersionsWithContext is the same as ListDocumentVersions with the addition of +// the ability to pass a context and additional request options. +// +// See ListDocumentVersions 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 *SSM) ListDocumentVersionsWithContext(ctx aws.Context, input *ListDocumentVersionsInput, opts ...request.Option) (*ListDocumentVersionsOutput, error) { + req, out := c.ListDocumentVersionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListDocuments = "ListDocuments" @@ -4688,8 +5701,23 @@ func (c *SSM) ListDocumentsRequest(input *ListDocumentsInput) (req *request.Requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ListDocuments func (c *SSM) ListDocuments(input *ListDocumentsInput) (*ListDocumentsOutput, error) { req, out := c.ListDocumentsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListDocumentsWithContext is the same as ListDocuments with the addition of +// the ability to pass a context and additional request options. +// +// See ListDocuments 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 *SSM) ListDocumentsWithContext(ctx aws.Context, input *ListDocumentsInput, opts ...request.Option) (*ListDocumentsOutput, error) { + req, out := c.ListDocumentsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // ListDocumentsPages iterates over the pages of a ListDocuments operation, @@ -4709,12 +5737,37 @@ func (c *SSM) ListDocuments(input *ListDocumentsInput) (*ListDocumentsOutput, er // return pageNum <= 3 // }) // -func (c *SSM) ListDocumentsPages(input *ListDocumentsInput, fn func(p *ListDocumentsOutput, lastPage bool) (shouldContinue bool)) error { - page, _ := c.ListDocumentsRequest(input) - page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator")) - return page.EachPage(func(p interface{}, lastPage bool) bool { - return fn(p.(*ListDocumentsOutput), lastPage) - }) +func (c *SSM) ListDocumentsPages(input *ListDocumentsInput, fn func(*ListDocumentsOutput, bool) bool) error { + return c.ListDocumentsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDocumentsPagesWithContext same as ListDocumentsPages 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 *SSM) ListDocumentsPagesWithContext(ctx aws.Context, input *ListDocumentsInput, fn func(*ListDocumentsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDocumentsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDocumentsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListDocumentsOutput), !p.HasNextPage()) + } + return p.Err() } const opListInventoryEntries = "ListInventoryEntries" @@ -4780,12 +5833,12 @@ func (c *SSM) ListInventoryEntriesRequest(input *ListInventoryEntriesInput) (req // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -4803,8 +5856,23 @@ func (c *SSM) ListInventoryEntriesRequest(input *ListInventoryEntriesInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ListInventoryEntries func (c *SSM) ListInventoryEntries(input *ListInventoryEntriesInput) (*ListInventoryEntriesOutput, error) { req, out := c.ListInventoryEntriesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListInventoryEntriesWithContext is the same as ListInventoryEntries with the addition of +// the ability to pass a context and additional request options. +// +// See ListInventoryEntries 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 *SSM) ListInventoryEntriesWithContext(ctx aws.Context, input *ListInventoryEntriesInput, opts ...request.Option) (*ListInventoryEntriesOutput, error) { + req, out := c.ListInventoryEntriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListTagsForResource = "ListTagsForResource" @@ -4876,8 +5944,23 @@ func (c *SSM) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ListTagsForResource func (c *SSM) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource 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 *SSM) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opModifyDocumentPermission = "ModifyDocumentPermission" @@ -4925,10 +6008,10 @@ func (c *SSM) ModifyDocumentPermissionRequest(input *ModifyDocumentPermissionInp // ModifyDocumentPermission API operation for Amazon Simple Systems Manager (SSM). // -// Share a document publicly or privately. If you share a document privately, -// you must specify the AWS user account IDs for those people who can use the -// document. If you share a document publicly, you must specify All as the account -// ID. +// Shares a Systems Manager document publicly or privately. If you share a document +// privately, you must specify the AWS user account IDs for those people who +// can use the document. If you share a document publicly, you must specify +// All as the account ID. // // 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 @@ -4959,8 +6042,23 @@ func (c *SSM) ModifyDocumentPermissionRequest(input *ModifyDocumentPermissionInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ModifyDocumentPermission func (c *SSM) ModifyDocumentPermission(input *ModifyDocumentPermissionInput) (*ModifyDocumentPermissionOutput, error) { req, out := c.ModifyDocumentPermissionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ModifyDocumentPermissionWithContext is the same as ModifyDocumentPermission with the addition of +// the ability to pass a context and additional request options. +// +// See ModifyDocumentPermission 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 *SSM) ModifyDocumentPermissionWithContext(ctx aws.Context, input *ModifyDocumentPermissionInput, opts ...request.Option) (*ModifyDocumentPermissionOutput, error) { + req, out := c.ModifyDocumentPermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutInventory = "PutInventory" @@ -5028,12 +6126,12 @@ func (c *SSM) PutInventoryRequest(input *PutInventoryInput) (req *request.Reques // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -5065,8 +6163,23 @@ func (c *SSM) PutInventoryRequest(input *PutInventoryInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/PutInventory func (c *SSM) PutInventory(input *PutInventoryInput) (*PutInventoryOutput, error) { req, out := c.PutInventoryRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutInventoryWithContext is the same as PutInventory with the addition of +// the ability to pass a context and additional request options. +// +// See PutInventory 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 *SSM) PutInventoryWithContext(ctx aws.Context, input *PutInventoryInput, opts ...request.Option) (*PutInventoryOutput, error) { + req, out := c.PutInventoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opPutParameter = "PutParameter" @@ -5147,8 +6260,23 @@ func (c *SSM) PutParameterRequest(input *PutParameterInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/PutParameter func (c *SSM) PutParameter(input *PutParameterInput) (*PutParameterOutput, error) { req, out := c.PutParameterRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// PutParameterWithContext is the same as PutParameter with the addition of +// the ability to pass a context and additional request options. +// +// See PutParameter 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 *SSM) PutParameterWithContext(ctx aws.Context, input *PutParameterInput, opts ...request.Option) (*PutParameterOutput, error) { + req, out := c.PutParameterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterDefaultPatchBaseline = "RegisterDefaultPatchBaseline" @@ -5220,8 +6348,23 @@ func (c *SSM) RegisterDefaultPatchBaselineRequest(input *RegisterDefaultPatchBas // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/RegisterDefaultPatchBaseline func (c *SSM) RegisterDefaultPatchBaseline(input *RegisterDefaultPatchBaselineInput) (*RegisterDefaultPatchBaselineOutput, error) { req, out := c.RegisterDefaultPatchBaselineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterDefaultPatchBaselineWithContext is the same as RegisterDefaultPatchBaseline with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterDefaultPatchBaseline 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 *SSM) RegisterDefaultPatchBaselineWithContext(ctx aws.Context, input *RegisterDefaultPatchBaselineInput, opts ...request.Option) (*RegisterDefaultPatchBaselineOutput, error) { + req, out := c.RegisterDefaultPatchBaselineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterPatchBaselineForPatchGroup = "RegisterPatchBaselineForPatchGroup" @@ -5301,8 +6444,23 @@ func (c *SSM) RegisterPatchBaselineForPatchGroupRequest(input *RegisterPatchBase // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/RegisterPatchBaselineForPatchGroup func (c *SSM) RegisterPatchBaselineForPatchGroup(input *RegisterPatchBaselineForPatchGroupInput) (*RegisterPatchBaselineForPatchGroupOutput, error) { req, out := c.RegisterPatchBaselineForPatchGroupRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterPatchBaselineForPatchGroupWithContext is the same as RegisterPatchBaselineForPatchGroup with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterPatchBaselineForPatchGroup 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 *SSM) RegisterPatchBaselineForPatchGroupWithContext(ctx aws.Context, input *RegisterPatchBaselineForPatchGroupInput, opts ...request.Option) (*RegisterPatchBaselineForPatchGroupOutput, error) { + req, out := c.RegisterPatchBaselineForPatchGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterTargetWithMaintenanceWindow = "RegisterTargetWithMaintenanceWindow" @@ -5378,8 +6536,23 @@ func (c *SSM) RegisterTargetWithMaintenanceWindowRequest(input *RegisterTargetWi // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/RegisterTargetWithMaintenanceWindow func (c *SSM) RegisterTargetWithMaintenanceWindow(input *RegisterTargetWithMaintenanceWindowInput) (*RegisterTargetWithMaintenanceWindowOutput, error) { req, out := c.RegisterTargetWithMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterTargetWithMaintenanceWindowWithContext is the same as RegisterTargetWithMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterTargetWithMaintenanceWindow 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 *SSM) RegisterTargetWithMaintenanceWindowWithContext(ctx aws.Context, input *RegisterTargetWithMaintenanceWindowInput, opts ...request.Option) (*RegisterTargetWithMaintenanceWindowOutput, error) { + req, out := c.RegisterTargetWithMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRegisterTaskWithMaintenanceWindow = "RegisterTaskWithMaintenanceWindow" @@ -5455,8 +6628,23 @@ func (c *SSM) RegisterTaskWithMaintenanceWindowRequest(input *RegisterTaskWithMa // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/RegisterTaskWithMaintenanceWindow func (c *SSM) RegisterTaskWithMaintenanceWindow(input *RegisterTaskWithMaintenanceWindowInput) (*RegisterTaskWithMaintenanceWindowOutput, error) { req, out := c.RegisterTaskWithMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RegisterTaskWithMaintenanceWindowWithContext is the same as RegisterTaskWithMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See RegisterTaskWithMaintenanceWindow 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 *SSM) RegisterTaskWithMaintenanceWindowWithContext(ctx aws.Context, input *RegisterTaskWithMaintenanceWindowInput, opts ...request.Option) (*RegisterTaskWithMaintenanceWindowOutput, error) { + req, out := c.RegisterTaskWithMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opRemoveTagsFromResource = "RemoveTagsFromResource" @@ -5528,8 +6716,23 @@ func (c *SSM) RemoveTagsFromResourceRequest(input *RemoveTagsFromResourceInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/RemoveTagsFromResource func (c *SSM) RemoveTagsFromResource(input *RemoveTagsFromResourceInput) (*RemoveTagsFromResourceOutput, error) { req, out := c.RemoveTagsFromResourceRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// RemoveTagsFromResourceWithContext is the same as RemoveTagsFromResource with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTagsFromResource 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 *SSM) RemoveTagsFromResourceWithContext(ctx aws.Context, input *RemoveTagsFromResourceInput, opts ...request.Option) (*RemoveTagsFromResourceOutput, error) { + req, out := c.RemoveTagsFromResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opSendCommand = "SendCommand" @@ -5598,12 +6801,12 @@ func (c *SSM) SendCommandRequest(input *SendCommandInput) (req *request.Request, // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -5620,17 +6823,17 @@ func (c *SSM) SendCommandRequest(input *SendCommandInput) (req *request.Request, // // * ErrCodeUnsupportedPlatformType "UnsupportedPlatformType" // The document does not support the platform type of the given instance ID(s). -// For example, you sent an SSM document for a Windows instance to a Linux instance. +// For example, you sent an document for a Windows instance to a Linux instance. // // * ErrCodeMaxDocumentSizeExceeded "MaxDocumentSizeExceeded" -// The size limit of an SSM document is 64 KB. +// The size limit of a document is 64 KB. // // * ErrCodeInvalidRole "InvalidRole" // The role name can't contain invalid characters. Also verify that you specified // an IAM role for notifications that includes the required trust policy. For // information about configuring the IAM role for Run Command notifications, -// see Getting Amazon SNS Notifications When a Command Changes Status (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/rc-sns.html) -// in the Amazon Elastic Compute Cloud User Guide . +// see Configuring Amazon SNS Notifications for Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/rc-sns-notifications.html) +// in the Amazon EC2 Systems Manager User Guide. // // * ErrCodeInvalidNotificationConfig "InvalidNotificationConfig" // One or more configuration items is not valid. Verify that a valid Amazon @@ -5639,8 +6842,23 @@ func (c *SSM) SendCommandRequest(input *SendCommandInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/SendCommand func (c *SSM) SendCommand(input *SendCommandInput) (*SendCommandOutput, error) { req, out := c.SendCommandRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// SendCommandWithContext is the same as SendCommand with the addition of +// the ability to pass a context and additional request options. +// +// See SendCommand 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 *SSM) SendCommandWithContext(ctx aws.Context, input *SendCommandInput, opts ...request.Option) (*SendCommandOutput, error) { + req, out := c.SendCommandRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStartAutomationExecution = "StartAutomationExecution" @@ -5719,8 +6937,23 @@ func (c *SSM) StartAutomationExecutionRequest(input *StartAutomationExecutionInp // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/StartAutomationExecution func (c *SSM) StartAutomationExecution(input *StartAutomationExecutionInput) (*StartAutomationExecutionOutput, error) { req, out := c.StartAutomationExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StartAutomationExecutionWithContext is the same as StartAutomationExecution with the addition of +// the ability to pass a context and additional request options. +// +// See StartAutomationExecution 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 *SSM) StartAutomationExecutionWithContext(ctx aws.Context, input *StartAutomationExecutionInput, opts ...request.Option) (*StartAutomationExecutionOutput, error) { + req, out := c.StartAutomationExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opStopAutomationExecution = "StopAutomationExecution" @@ -5788,8 +7021,23 @@ func (c *SSM) StopAutomationExecutionRequest(input *StopAutomationExecutionInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/StopAutomationExecution func (c *SSM) StopAutomationExecution(input *StopAutomationExecutionInput) (*StopAutomationExecutionOutput, error) { req, out := c.StopAutomationExecutionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// StopAutomationExecutionWithContext is the same as StopAutomationExecution with the addition of +// the ability to pass a context and additional request options. +// +// See StopAutomationExecution 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 *SSM) StopAutomationExecutionWithContext(ctx aws.Context, input *StopAutomationExecutionInput, opts ...request.Option) (*StopAutomationExecutionOutput, error) { + req, out := c.StopAutomationExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateAssociation = "UpdateAssociation" @@ -5877,8 +7125,23 @@ func (c *SSM) UpdateAssociationRequest(input *UpdateAssociationInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateAssociation func (c *SSM) UpdateAssociation(input *UpdateAssociationInput) (*UpdateAssociationOutput, error) { req, out := c.UpdateAssociationRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAssociationWithContext is the same as UpdateAssociation with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAssociation 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 *SSM) UpdateAssociationWithContext(ctx aws.Context, input *UpdateAssociationInput, opts ...request.Option) (*UpdateAssociationOutput, error) { + req, out := c.UpdateAssociationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateAssociationStatus = "UpdateAssociationStatus" @@ -5926,7 +7189,8 @@ func (c *SSM) UpdateAssociationStatusRequest(input *UpdateAssociationStatusInput // UpdateAssociationStatus API operation for Amazon Simple Systems Manager (SSM). // -// Updates the status of the SSM document associated with the specified instance. +// Updates the status of the Systems Manager document associated with the specified +// instance. // // 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 @@ -5944,12 +7208,12 @@ func (c *SSM) UpdateAssociationStatusRequest(input *UpdateAssociationStatusInput // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -5970,8 +7234,23 @@ func (c *SSM) UpdateAssociationStatusRequest(input *UpdateAssociationStatusInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateAssociationStatus func (c *SSM) UpdateAssociationStatus(input *UpdateAssociationStatusInput) (*UpdateAssociationStatusOutput, error) { req, out := c.UpdateAssociationStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateAssociationStatusWithContext is the same as UpdateAssociationStatus with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAssociationStatus 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 *SSM) UpdateAssociationStatusWithContext(ctx aws.Context, input *UpdateAssociationStatusInput, opts ...request.Option) (*UpdateAssociationStatusOutput, error) { + req, out := c.UpdateAssociationStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDocument = "UpdateDocument" @@ -6030,7 +7309,7 @@ func (c *SSM) UpdateDocumentRequest(input *UpdateDocumentInput) (req *request.Re // // Returned Error Codes: // * ErrCodeMaxDocumentSizeExceeded "MaxDocumentSizeExceeded" -// The size limit of an SSM document is 64 KB. +// The size limit of a document is 64 KB. // // * ErrCodeDocumentVersionLimitExceeded "DocumentVersionLimitExceeded" // The document has too many versions. Delete one or more document versions @@ -6044,7 +7323,7 @@ func (c *SSM) UpdateDocumentRequest(input *UpdateDocumentInput) (req *request.Re // the content of the document and try again. // // * ErrCodeInvalidDocumentContent "InvalidDocumentContent" -// The content for the SSM document is not valid. +// The content for the document is not valid. // // * ErrCodeInvalidDocumentVersion "InvalidDocumentVersion" // The document version is not valid or does not exist. @@ -6058,8 +7337,23 @@ func (c *SSM) UpdateDocumentRequest(input *UpdateDocumentInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateDocument func (c *SSM) UpdateDocument(input *UpdateDocumentInput) (*UpdateDocumentOutput, error) { req, out := c.UpdateDocumentRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDocumentWithContext is the same as UpdateDocument with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDocument 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 *SSM) UpdateDocumentWithContext(ctx aws.Context, input *UpdateDocumentInput, opts ...request.Option) (*UpdateDocumentOutput, error) { + req, out := c.UpdateDocumentRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateDocumentDefaultVersion = "UpdateDocumentDefaultVersion" @@ -6132,8 +7426,23 @@ func (c *SSM) UpdateDocumentDefaultVersionRequest(input *UpdateDocumentDefaultVe // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateDocumentDefaultVersion func (c *SSM) UpdateDocumentDefaultVersion(input *UpdateDocumentDefaultVersionInput) (*UpdateDocumentDefaultVersionOutput, error) { req, out := c.UpdateDocumentDefaultVersionRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateDocumentDefaultVersionWithContext is the same as UpdateDocumentDefaultVersion with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateDocumentDefaultVersion 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 *SSM) UpdateDocumentDefaultVersionWithContext(ctx aws.Context, input *UpdateDocumentDefaultVersionInput, opts ...request.Option) (*UpdateDocumentDefaultVersionOutput, error) { + req, out := c.UpdateDocumentDefaultVersionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateMaintenanceWindow = "UpdateMaintenanceWindow" @@ -6201,8 +7510,23 @@ func (c *SSM) UpdateMaintenanceWindowRequest(input *UpdateMaintenanceWindowInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateMaintenanceWindow func (c *SSM) UpdateMaintenanceWindow(input *UpdateMaintenanceWindowInput) (*UpdateMaintenanceWindowOutput, error) { req, out := c.UpdateMaintenanceWindowRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateMaintenanceWindowWithContext is the same as UpdateMaintenanceWindow with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateMaintenanceWindow 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 *SSM) UpdateMaintenanceWindowWithContext(ctx aws.Context, input *UpdateMaintenanceWindowInput, opts ...request.Option) (*UpdateMaintenanceWindowOutput, error) { + req, out := c.UpdateMaintenanceWindowRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateManagedInstanceRole = "UpdateManagedInstanceRole" @@ -6266,12 +7590,12 @@ func (c *SSM) UpdateManagedInstanceRoleRequest(input *UpdateManagedInstanceRoleI // // You do not have permission to access the instance. // -// The SSM agent is not running. On managed instances and Linux instances, verify -// that the SSM agent is running. On EC2 Windows instances, verify that the +// The SSM Agent is not running. On managed instances and Linux instances, verify +// that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // -// The SSM agent or EC2Config service is not registered to the SSM endpoint. -// Try reinstalling the SSM agent or EC2Config service. +// The SSM Agent or EC2Config service is not registered to the SSM endpoint. +// Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -6282,8 +7606,23 @@ func (c *SSM) UpdateManagedInstanceRoleRequest(input *UpdateManagedInstanceRoleI // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateManagedInstanceRole func (c *SSM) UpdateManagedInstanceRole(input *UpdateManagedInstanceRoleInput) (*UpdateManagedInstanceRoleOutput, error) { req, out := c.UpdateManagedInstanceRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateManagedInstanceRoleWithContext is the same as UpdateManagedInstanceRole with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateManagedInstanceRole 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 *SSM) UpdateManagedInstanceRoleWithContext(ctx aws.Context, input *UpdateManagedInstanceRoleInput, opts ...request.Option) (*UpdateManagedInstanceRoleOutput, error) { + req, out := c.UpdateManagedInstanceRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdatePatchBaseline = "UpdatePatchBaseline" @@ -6352,8 +7691,23 @@ func (c *SSM) UpdatePatchBaselineRequest(input *UpdatePatchBaselineInput) (req * // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdatePatchBaseline func (c *SSM) UpdatePatchBaseline(input *UpdatePatchBaselineInput) (*UpdatePatchBaselineOutput, error) { req, out := c.UpdatePatchBaselineRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdatePatchBaselineWithContext is the same as UpdatePatchBaseline with the addition of +// the ability to pass a context and additional request options. +// +// See UpdatePatchBaseline 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 *SSM) UpdatePatchBaselineWithContext(ctx aws.Context, input *UpdatePatchBaselineInput, opts ...request.Option) (*UpdatePatchBaselineOutput, error) { + req, out := c.UpdatePatchBaselineRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // An activation registers one or more on-premises servers or virtual machines @@ -6551,7 +7905,7 @@ func (s AddTagsToResourceOutput) GoString() string { return s.String() } -// Describes an association of an SSM document and an instance. +// Describes an association of a Systems Manager document and an instance. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/Association type Association struct { _ struct{} `type:"structure"` @@ -7319,7 +8673,7 @@ type Command struct { // Timed Out, Delivery Timed Out, Canceled, Terminated, or Undeliverable. CompletedCount *int64 `type:"integer"` - // The name of the SSM document requested for execution. + // The name of the document requested for execution. DocumentName *string `type:"string"` // The number of targets for which the status is Failed or Execution Timed Out. @@ -7336,19 +8690,15 @@ type Command struct { // The maximum number of instances that are allowed to execute the command at // the same time. You can specify a number of instances, such as 10, or a percentage // of instances, such as 10%. The default value is 50. For more information - // about how to use MaxConcurrency, see Executing a Command Using Amazon EC2 - // Run Command (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/run-command.html) - // (Linux) or Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/run-command.html) - // (Windows). + // about how to use MaxConcurrency, see Executing a Command Using Systems Manager + // Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). MaxConcurrency *string `min:"1" type:"string"` // The maximum number of errors allowed before the system stops sending the // command to additional targets. You can specify a number of errors, such as // 10, or a percentage or errors, such as 10%. The default value is 50. For // more information about how to use MaxErrors, see Executing a Command Using - // Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/run-command.html) - // (Linux) or Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/run-command.html) - // (Windows). + // Systems Manager Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). MaxErrors *string `min:"1" type:"string"` // Configurations for sending notifications about command status changes. @@ -7366,8 +8716,7 @@ type Command struct { // is located. The default value is the region where Run Command is being called. OutputS3Region *string `min:"3" type:"string"` - // The parameter values to be inserted in the SSM document when executing the - // command. + // The parameter values to be inserted in the document when executing the command. Parameters map[string][]*string `type:"map"` // The date and time the command was requested. @@ -7383,9 +8732,8 @@ type Command struct { // A detailed status of the command execution. StatusDetails includes more information // than Status because it includes states resulting from error and concurrency // control parameters. StatusDetails can show different results than Status. - // For more information about these statuses, see Monitor Commands (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitor-commands.html) - // (Linux) or Monitor Commands (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/monitor-commands.html) - // (Windows). StatusDetails can be one of the following values: + // For more information about these statuses, see Run Command Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). + // StatusDetails can be one of the following values: // // * Pending – The command has not been sent to any instances. // @@ -7419,7 +8767,7 @@ type Command struct { // The number of targets for the command. TargetCount *int64 `type:"integer"` - // An array of search criteria that targets instances using a Key;Value combination + // An array of search criteria that targets instances using a Key,Value combination // that you specify. Targets is required if you don't provide one or more instance // IDs in the call. Targets []*Target `type:"list"` @@ -7671,9 +9019,8 @@ type CommandInvocation struct { // targeted by the command). StatusDetails includes more information than Status // because it includes states resulting from error and concurrency control parameters. // StatusDetails can show different results than Status. For more information - // about these statuses, see Monitor Commands (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitor-commands.html) - // (Linux) or Monitor Commands (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/monitor-commands.html) - // (Windows). StatusDetails can be one of the following values: + // about these statuses, see Run Command Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). + // StatusDetails can be one of the following values: // // * Pending – The command has not been sent to the instance. // @@ -7881,9 +9228,8 @@ type CommandPlugin struct { // A detailed status of the plugin execution. StatusDetails includes more information // than Status because it includes states resulting from error and concurrency // control parameters. StatusDetails can show different results than Status. - // For more information about these statuses, see Monitor Commands (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitor-commands.html) - // (Linux) or Monitor Commands (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/monitor-commands.html) - // (Windows). StatusDetails can be one of the following values: + // For more information about these statuses, see Run Command Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). + // StatusDetails can be one of the following values: // // * Pending – The command has not been sent to the instance. // @@ -8208,7 +9554,7 @@ func (s *CreateAssociationBatchOutput) SetSuccessful(v []*AssociationDescription return s } -// Describes the association of an SSM document and an instance. +// Describes the association of a Systems Manager document and an instance. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/CreateAssociationBatchRequestEntry type CreateAssociationBatchRequestEntry struct { _ struct{} `type:"structure"` @@ -8331,7 +9677,7 @@ type CreateAssociationInput struct { // The instance ID. InstanceId *string `type:"string"` - // The name of the SSM document. + // The name of the Systems Manager document. // // Name is a required field Name *string `type:"string" required:"true"` @@ -8479,7 +9825,7 @@ type CreateDocumentInput struct { // and Command. DocumentType *string `type:"string" enum:"DocumentType"` - // A name for the SSM document. + // A name for the Systems Manager document. // // Name is a required field Name *string `type:"string" required:"true"` @@ -8536,7 +9882,7 @@ func (s *CreateDocumentInput) SetName(v string) *CreateDocumentInput { type CreateDocumentOutput struct { _ struct{} `type:"structure"` - // Information about the SSM document. + // Information about the Systems Manager document. DocumentDescription *DocumentDescription `type:"structure"` } @@ -8898,7 +10244,7 @@ type DeleteAssociationInput struct { // The ID of the instance. InstanceId *string `type:"string"` - // The name of the SSM document. + // The name of the Systems Manager document. Name *string `type:"string"` } @@ -8949,7 +10295,7 @@ func (s DeleteAssociationOutput) GoString() string { type DeleteDocumentInput struct { _ struct{} `type:"structure"` - // The name of the SSM document. + // The name of the document. // // Name is a required field Name *string `type:"string" required:"true"` @@ -12005,7 +13351,7 @@ func (s *DocumentDefaultVersionDescription) SetName(v string) *DocumentDefaultVe type DocumentDescription struct { _ struct{} `type:"structure"` - // The date when the SSM document was created. + // The date when the document was created. CreatedDate *time.Time `type:"timestamp" timestampFormat:"unix"` // The default version. @@ -12282,8 +13628,8 @@ func (s *DocumentIdentifier) SetSchemaVersion(v string) *DocumentIdentifier { return s } -// Parameters specified in the SSM document that execute on the server when -// the command is run. +// Parameters specified in a System Manager document that execute on the server +// when the command is run. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/DocumentParameter type DocumentParameter struct { _ struct{} `type:"structure"` @@ -12559,8 +13905,8 @@ type GetCommandInvocationInput struct { InstanceId *string `type:"string" required:"true"` // (Optional) The name of the plugin for which you want detailed results. If - // the SSM document contains only one plugin, the name can be omitted and the - // details will be returned. + // the document contains only one plugin, the name can be omitted and the details + // will be returned. PluginName *string `min:"4" type:"string"` } @@ -12624,8 +13970,7 @@ type GetCommandInvocationOutput struct { // The comment text for the command. Comment *string `type:"string"` - // The name of the SSM document that was executed. For example, AWS-RunShellScript - // is an SSM document. + // The name of the document that was executed. For example, AWS-RunShellScript. DocumentName *string `type:"string"` // Duration since ExecutionStartDateTime. @@ -12679,10 +14024,9 @@ type GetCommandInvocationOutput struct { // A detailed status of the command execution for an invocation. StatusDetails // includes more information than Status because it includes states resulting // from error and concurrency control parameters. StatusDetails can show different - // results than Status. For more information about these statuses, see Monitor - // Commands (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitor-commands.html) - // (Linux) or Monitor Commands (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/monitor-commands.html) - // (Windows). StatusDetails can be one of the following values: + // results than Status. For more information about these statuses, see Run Command + // Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). + // StatusDetails can be one of the following values: // // * Pending – The command has not been sent to the instance. // @@ -13904,7 +15248,7 @@ type GetParametersOutput struct { // executed. InvalidParameters []*string `min:"1" type:"list"` - // A list of parameters used by the AWS account. + // A list of details for a parameter. Parameters []*Parameter `type:"list"` } @@ -14409,7 +15753,7 @@ type InstanceInformation struct { // The activation ID created by Systems Manager when the server or VM was registered. ActivationId *string `type:"string"` - // The version of the SSM agent running on your Linux instance. + // The version of the SSM Agent running on your Linux instance. AgentVersion *string `type:"string"` // Information about the association. @@ -14431,7 +15775,7 @@ type InstanceInformation struct { // The instance ID. InstanceId *string `type:"string"` - // Indicates whether latest version of the SSM agent is running on your instance. + // Indicates whether latest version of the SSM Agent is running on your instance. IsLatestVersion *bool `type:"boolean"` // The date the association was last executed. @@ -14446,7 +15790,7 @@ type InstanceInformation struct { // The name of the managed instance. Name *string `type:"string"` - // Connection status of the SSM agent. + // Connection status of the SSM Agent. PingStatus *string `type:"string" enum:"PingStatus"` // The name of the operating system platform running on your instance. @@ -16894,8 +18238,9 @@ type NotificationConfig struct { // The different events for which you can receive notifications. These events // include the following: All (events), InProgress, Success, TimedOut, Cancelled, - // Failed. To learn more about these events, see Monitoring Commands (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitor-commands.html) - // in the Amazon Elastic Compute Cloud User Guide . + // Failed. To learn more about these events, see Setting Up Events and Notifications + // (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-commands.html) + // in the Amazon EC2 Systems Manager User Guide. NotificationEvents []*string `type:"list"` // Command: Receive notification when the status of a command changes. Invocation: @@ -17879,7 +19224,7 @@ type PutParameterInput struct { // Name is a required field Name *string `min:"1" type:"string" required:"true"` - // Overwrite an existing parameter. + // Overwrite an existing parameter. If not specified, will default to "false". Overwrite *bool `type:"boolean"` // The type of parameter that you want to add to the system. @@ -18720,8 +20065,8 @@ type SendCommandInput struct { // Sha1 hashes have been deprecated. DocumentHashType *string `type:"string" enum:"DocumentHashType"` - // Required. The name of the SSM document to execute. This can be an SSM public - // document or a custom document. + // Required. The name of the Systems Manager document to execute. This can be + // a public document or a custom document. // // DocumentName is a required field DocumentName *string `type:"string" required:"true"` @@ -18733,20 +20078,16 @@ type SendCommandInput struct { // (Optional) The maximum number of instances that are allowed to execute the // command at the same time. You can specify a number such as “10” or a percentage // such as “10%”. The default value is 50. For more information about how to - // use MaxConcurrency, see Executing a Command Using Amazon EC2 Run Command - // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/run-command.html) (Linux) - // or Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/run-command.html) - // (Windows). + // use MaxConcurrency, see Executing a Command Using Systems Manager Run Command + // (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). MaxConcurrency *string `min:"1" type:"string"` // The maximum number of errors allowed without the command failing. When the // command fails one more time beyond the value of MaxErrors, the systems stops // sending the command to additional targets. You can specify a number like // “10” or a percentage like “10%”. The default value is 50. For more information - // about how to use MaxErrors, see Executing a Command Using Amazon EC2 Run - // Command (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/run-command.html) - // (Linux) or Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/run-command.html) - // (Windows). + // about how to use MaxErrors, see Executing a Command Using Systems Manager + // Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). MaxErrors *string `min:"1" type:"string"` // Configurations for sending notifications. @@ -18764,19 +20105,16 @@ type SendCommandInput struct { // is being called. OutputS3Region *string `min:"3" type:"string"` - // The required and optional parameters specified in the SSM document being - // executed. + // The required and optional parameters specified in the document being executed. Parameters map[string][]*string `type:"map"` // The IAM role that Systems Manager uses to send notifications. ServiceRoleArn *string `type:"string"` - // (Optional) An array of search criteria that targets instances using a Key;Value + // (Optional) An array of search criteria that targets instances using a Key,Value // combination that you specify. Targets is required if you don't provide one // or more instance IDs in the call. For more information about how to use Targets, - // see Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/run-command.html) - // (Linux) or Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/run-command.html) - // (Windows). + // see Executing a Command Using Systems Manager Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). Targets []*Target `type:"list"` // If this time is reached and the command has not already started executing, @@ -19261,7 +20599,7 @@ func (s *Tag) SetValue(v string) *Tag { return s } -// An array of search criteria that targets instances using a Key;Value combination +// An array of search criteria that targets instances using a Key,Value combination // that you specify. Targets is required if you don't provide one or more instance // IDs in the call. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/Target @@ -19269,21 +20607,16 @@ type Target struct { _ struct{} `type:"structure"` // User-defined criteria for sending commands that target instances that meet - // the criteria. Key can be tag: or name:. For example, tag:ServerRole or name:0123456789012345. For more information - // about how to send commands that target instances using Key;Value parameters, - // see Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/run-command.html) - // (Linux) or Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/run-command.html) - // (Windows). + // the criteria. Key can be tag: or InstanceIds. For more information + // about how to send commands that target instances using Key,Value parameters, + // see Executing a Command Using Systems Manager Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). Key *string `min:"1" type:"string"` // User-defined criteria that maps to Key. For example, if you specified tag:ServerRole, // you could specify value:WebServer to execute a command on instances that - // include Amazon EC2 tags of ServerRole;WebServer. For more information about - // how to send commands that target instances using Key;Value parameters, see - // Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/run-command.html) - // (Linux) or Executing a Command Using Amazon EC2 Run Command (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/run-command.html) - // (Windows). + // include Amazon EC2 tags of ServerRole,WebServer. For more information about + // how to send commands that target instances using Key,Value parameters, see + // Executing a Command Using Systems Manager Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). Values []*string `type:"list"` } diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go index bea03cfa95..2107a874ff 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ssm @@ -14,7 +14,7 @@ const ( // ErrCodeAssociatedInstances for service response error code // "AssociatedInstances". // - // You must disassociate an SSM document from all instances before you can delete + // You must disassociate a document from all instances before you can delete // it. ErrCodeAssociatedInstances = "AssociatedInstances" @@ -72,7 +72,7 @@ const ( // ErrCodeDocumentAlreadyExists for service response error code // "DocumentAlreadyExists". // - // The specified SSM document already exists. + // The specified document already exists. ErrCodeDocumentAlreadyExists = "DocumentAlreadyExists" // ErrCodeDocumentLimitExceeded for service response error code @@ -164,7 +164,7 @@ const ( // ErrCodeInvalidDocumentContent for service response error code // "InvalidDocumentContent". // - // The content for the SSM document is not valid. + // The content for the document is not valid. ErrCodeInvalidDocumentContent = "InvalidDocumentContent" // ErrCodeInvalidDocumentOperation for service response error code @@ -212,12 +212,12 @@ const ( // // You do not have permission to access the instance. // - // The SSM agent is not running. On managed instances and Linux instances, verify - // that the SSM agent is running. On EC2 Windows instances, verify that the + // The SSM Agent is not running. On managed instances and Linux instances, verify + // that the SSM Agent is running. On EC2 Windows instances, verify that the // EC2Config service is running. // - // The SSM agent or EC2Config service is not registered to the SSM endpoint. - // Try reinstalling the SSM agent or EC2Config service. + // The SSM Agent or EC2Config service is not registered to the SSM endpoint. + // Try reinstalling the SSM Agent or EC2Config service. // // The instance is not in valid state. Valid states are: Running, Pending, Stopped, // Stopping. Invalid states are: Shutting-down and Terminated. @@ -312,8 +312,8 @@ const ( // The role name can't contain invalid characters. Also verify that you specified // an IAM role for notifications that includes the required trust policy. For // information about configuring the IAM role for Run Command notifications, - // see Getting Amazon SNS Notifications When a Command Changes Status (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/rc-sns.html) - // in the Amazon Elastic Compute Cloud User Guide . + // see Configuring Amazon SNS Notifications for Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/rc-sns-notifications.html) + // in the Amazon EC2 Systems Manager User Guide. ErrCodeInvalidRole = "InvalidRole" // ErrCodeInvalidSchedule for service response error code @@ -363,7 +363,7 @@ const ( // ErrCodeMaxDocumentSizeExceeded for service response error code // "MaxDocumentSizeExceeded". // - // The size limit of an SSM document is 64 KB. + // The size limit of a document is 64 KB. ErrCodeMaxDocumentSizeExceeded = "MaxDocumentSizeExceeded" // ErrCodeParameterAlreadyExists for service response error code @@ -443,6 +443,6 @@ const ( // "UnsupportedPlatformType". // // The document does not support the platform type of the given instance ID(s). - // For example, you sent an SSM document for a Windows instance to a Linux instance. + // For example, you sent an document for a Windows instance to a Linux instance. ErrCodeUnsupportedPlatformType = "UnsupportedPlatformType" ) diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/service.go index 9e90268831..7fa443f988 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/ssm/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package ssm @@ -15,17 +15,15 @@ import ( // automate management tasks such as collecting system inventory, applying operating // system (OS) patches, automating the creation of Amazon Machine Images (AMIs), // and configuring operating systems (OSs) and applications at scale. Systems -// Manager works with managed instances: Amazon EC2 instances and servers or -// virtual machines (VMs) in your on-premises environment that are configured -// for Systems Manager. +// Manager lets you remotely and securely manage the configuration of your managed +// instances. A managed instance is any Amazon EC2 instance or on-premises machine +// in your hybrid environment that has been configured for Systems Manager. // -// This references is intended to be used with the EC2 Systems Manager User -// Guide (Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/systems-manager.html)) -// (Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/systems-manager.html)). +// This reference is intended to be used with the Amazon EC2 Systems Manager +// User Guide (http://docs.aws.amazon.com/systems-manager/latest/userguide/). // -// To get started, verify prerequisites and configure managed instances (Linux -// (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/systems-manager-prereqs.html)) -// (Windows (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/systems-manager-prereqs.html)). +// To get started, verify prerequisites and configure managed instances. For +// more information, see Systems Manager Prerequisites (http://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-prereqs.html). // The service client's operations are safe to be used concurrently. // It is not safe to mutate any of the client's properties though. // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06 diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sts/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sts/api.go index ad42b4c973..19dd0bf8e5 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sts/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package sts provides a client for AWS Security Token Service. package sts @@ -6,6 +6,7 @@ package sts import ( "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/request" ) @@ -172,8 +173,23 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole func (c *STS) AssumeRole(input *AssumeRoleInput) (*AssumeRoleOutput, error) { req, out := c.AssumeRoleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssumeRoleWithContext is the same as AssumeRole with the addition of +// the ability to pass a context and additional request options. +// +// See AssumeRole 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 *STS) AssumeRoleWithContext(ctx aws.Context, input *AssumeRoleInput, opts ...request.Option) (*AssumeRoleOutput, error) { + req, out := c.AssumeRoleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssumeRoleWithSAML = "AssumeRoleWithSAML" @@ -331,8 +347,23 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWithSAMLOutput, error) { req, out := c.AssumeRoleWithSAMLRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssumeRoleWithSAMLWithContext is the same as AssumeRoleWithSAML with the addition of +// the ability to pass a context and additional request options. +// +// See AssumeRoleWithSAML 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 *STS) AssumeRoleWithSAMLWithContext(ctx aws.Context, input *AssumeRoleWithSAMLInput, opts ...request.Option) (*AssumeRoleWithSAMLOutput, error) { + req, out := c.AssumeRoleWithSAMLRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity" @@ -519,8 +550,23 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) (*AssumeRoleWithWebIdentityOutput, error) { req, out := c.AssumeRoleWithWebIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// AssumeRoleWithWebIdentityWithContext is the same as AssumeRoleWithWebIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See AssumeRoleWithWebIdentity 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 *STS) AssumeRoleWithWebIdentityWithContext(ctx aws.Context, input *AssumeRoleWithWebIdentityInput, opts ...request.Option) (*AssumeRoleWithWebIdentityOutput, error) { + req, out := c.AssumeRoleWithWebIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage" @@ -617,8 +663,23 @@ func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessag // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage func (c *STS) DecodeAuthorizationMessage(input *DecodeAuthorizationMessageInput) (*DecodeAuthorizationMessageOutput, error) { req, out := c.DecodeAuthorizationMessageRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DecodeAuthorizationMessageWithContext is the same as DecodeAuthorizationMessage with the addition of +// the ability to pass a context and additional request options. +// +// See DecodeAuthorizationMessage 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 *STS) DecodeAuthorizationMessageWithContext(ctx aws.Context, input *DecodeAuthorizationMessageInput, opts ...request.Option) (*DecodeAuthorizationMessageOutput, error) { + req, out := c.DecodeAuthorizationMessageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetCallerIdentity = "GetCallerIdentity" @@ -678,8 +739,23 @@ func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity func (c *STS) GetCallerIdentity(input *GetCallerIdentityInput) (*GetCallerIdentityOutput, error) { req, out := c.GetCallerIdentityRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetCallerIdentityWithContext is the same as GetCallerIdentity with the addition of +// the ability to pass a context and additional request options. +// +// See GetCallerIdentity 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 *STS) GetCallerIdentityWithContext(ctx aws.Context, input *GetCallerIdentityInput, opts ...request.Option) (*GetCallerIdentityOutput, error) { + req, out := c.GetCallerIdentityRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetFederationToken = "GetFederationToken" @@ -833,8 +909,23 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken func (c *STS) GetFederationToken(input *GetFederationTokenInput) (*GetFederationTokenOutput, error) { req, out := c.GetFederationTokenRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetFederationTokenWithContext is the same as GetFederationToken with the addition of +// the ability to pass a context and additional request options. +// +// See GetFederationToken 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 *STS) GetFederationTokenWithContext(ctx aws.Context, input *GetFederationTokenInput, opts ...request.Option) (*GetFederationTokenOutput, error) { + req, out := c.GetFederationTokenRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSessionToken = "GetSessionToken" @@ -947,8 +1038,23 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken func (c *STS) GetSessionToken(input *GetSessionTokenInput) (*GetSessionTokenOutput, error) { req, out := c.GetSessionTokenRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSessionTokenWithContext is the same as GetSessionToken with the addition of +// the ability to pass a context and additional request options. +// +// See GetSessionToken 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 *STS) GetSessionTokenWithContext(ctx aws.Context, input *GetSessionTokenInput, opts ...request.Option) (*GetSessionTokenOutput, error) { + req, out := c.GetSessionTokenRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleRequest diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go index dbcd66759c..e24884ef37 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sts diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/sts/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/sts/service.go index 9c4bfb838b..be2183846e 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/sts/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/sts/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package sts diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/waf/api.go b/installer/vendor/github.com/aws/aws-sdk-go/service/waf/api.go index f9719ceeb1..62d8d7f403 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/waf/api.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/waf/api.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package waf provides a client for AWS WAF. package waf @@ -7,6 +7,7 @@ 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" ) @@ -137,8 +138,23 @@ func (c *WAF) CreateByteMatchSetRequest(input *CreateByteMatchSetInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateByteMatchSet func (c *WAF) CreateByteMatchSet(input *CreateByteMatchSetInput) (*CreateByteMatchSetOutput, error) { req, out := c.CreateByteMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateByteMatchSetWithContext is the same as CreateByteMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateByteMatchSet 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 *WAF) CreateByteMatchSetWithContext(ctx aws.Context, input *CreateByteMatchSetInput, opts ...request.Option) (*CreateByteMatchSetOutput, error) { + req, out := c.CreateByteMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateIPSet = "CreateIPSet" @@ -267,8 +283,23 @@ func (c *WAF) CreateIPSetRequest(input *CreateIPSetInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateIPSet func (c *WAF) CreateIPSet(input *CreateIPSetInput) (*CreateIPSetOutput, error) { req, out := c.CreateIPSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateIPSetWithContext is the same as CreateIPSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateIPSet 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 *WAF) CreateIPSetWithContext(ctx aws.Context, input *CreateIPSetInput, opts ...request.Option) (*CreateIPSetOutput, error) { + req, out := c.CreateIPSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateRule = "CreateRule" @@ -407,8 +438,23 @@ func (c *WAF) CreateRuleRequest(input *CreateRuleInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRule func (c *WAF) CreateRule(input *CreateRuleInput) (*CreateRuleOutput, error) { req, out := c.CreateRuleRequest(input) - err := req.Send() - return out, err + 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 *WAF) 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 opCreateSizeConstraintSet = "CreateSizeConstraintSet" @@ -538,8 +584,23 @@ func (c *WAF) CreateSizeConstraintSetRequest(input *CreateSizeConstraintSetInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSizeConstraintSet func (c *WAF) CreateSizeConstraintSet(input *CreateSizeConstraintSetInput) (*CreateSizeConstraintSetOutput, error) { req, out := c.CreateSizeConstraintSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSizeConstraintSetWithContext is the same as CreateSizeConstraintSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSizeConstraintSet 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 *WAF) CreateSizeConstraintSetWithContext(ctx aws.Context, input *CreateSizeConstraintSetInput, opts ...request.Option) (*CreateSizeConstraintSetOutput, error) { + req, out := c.CreateSizeConstraintSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateSqlInjectionMatchSet = "CreateSqlInjectionMatchSet" @@ -665,8 +726,23 @@ func (c *WAF) CreateSqlInjectionMatchSetRequest(input *CreateSqlInjectionMatchSe // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateSqlInjectionMatchSet func (c *WAF) CreateSqlInjectionMatchSet(input *CreateSqlInjectionMatchSetInput) (*CreateSqlInjectionMatchSetOutput, error) { req, out := c.CreateSqlInjectionMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateSqlInjectionMatchSetWithContext is the same as CreateSqlInjectionMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateSqlInjectionMatchSet 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 *WAF) CreateSqlInjectionMatchSetWithContext(ctx aws.Context, input *CreateSqlInjectionMatchSetInput, opts ...request.Option) (*CreateSqlInjectionMatchSetOutput, error) { + req, out := c.CreateSqlInjectionMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateWebACL = "CreateWebACL" @@ -804,8 +880,23 @@ func (c *WAF) CreateWebACLRequest(input *CreateWebACLInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateWebACL func (c *WAF) CreateWebACL(input *CreateWebACLInput) (*CreateWebACLOutput, error) { req, out := c.CreateWebACLRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateWebACLWithContext is the same as CreateWebACL with the addition of +// the ability to pass a context and additional request options. +// +// See CreateWebACL 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 *WAF) CreateWebACLWithContext(ctx aws.Context, input *CreateWebACLInput, opts ...request.Option) (*CreateWebACLOutput, error) { + req, out := c.CreateWebACLRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opCreateXssMatchSet = "CreateXssMatchSet" @@ -932,8 +1023,23 @@ func (c *WAF) CreateXssMatchSetRequest(input *CreateXssMatchSetInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateXssMatchSet func (c *WAF) CreateXssMatchSet(input *CreateXssMatchSetInput) (*CreateXssMatchSetOutput, error) { req, out := c.CreateXssMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// CreateXssMatchSetWithContext is the same as CreateXssMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See CreateXssMatchSet 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 *WAF) CreateXssMatchSetWithContext(ctx aws.Context, input *CreateXssMatchSetInput, opts ...request.Option) (*CreateXssMatchSetOutput, error) { + req, out := c.CreateXssMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteByteMatchSet = "DeleteByteMatchSet" @@ -1045,8 +1151,23 @@ func (c *WAF) DeleteByteMatchSetRequest(input *DeleteByteMatchSetInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteByteMatchSet func (c *WAF) DeleteByteMatchSet(input *DeleteByteMatchSetInput) (*DeleteByteMatchSetOutput, error) { req, out := c.DeleteByteMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteByteMatchSetWithContext is the same as DeleteByteMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteByteMatchSet 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 *WAF) DeleteByteMatchSetWithContext(ctx aws.Context, input *DeleteByteMatchSetInput, opts ...request.Option) (*DeleteByteMatchSetOutput, error) { + req, out := c.DeleteByteMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteIPSet = "DeleteIPSet" @@ -1157,8 +1278,23 @@ func (c *WAF) DeleteIPSetRequest(input *DeleteIPSetInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteIPSet func (c *WAF) DeleteIPSet(input *DeleteIPSetInput) (*DeleteIPSetOutput, error) { req, out := c.DeleteIPSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteIPSetWithContext is the same as DeleteIPSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteIPSet 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 *WAF) DeleteIPSetWithContext(ctx aws.Context, input *DeleteIPSetInput, opts ...request.Option) (*DeleteIPSetOutput, error) { + req, out := c.DeleteIPSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteRule = "DeleteRule" @@ -1269,8 +1405,23 @@ func (c *WAF) DeleteRuleRequest(input *DeleteRuleInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRule func (c *WAF) DeleteRule(input *DeleteRuleInput) (*DeleteRuleOutput, error) { req, out := c.DeleteRuleRequest(input) - err := req.Send() - return out, err + 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 *WAF) 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 opDeleteSizeConstraintSet = "DeleteSizeConstraintSet" @@ -1382,8 +1533,23 @@ func (c *WAF) DeleteSizeConstraintSetRequest(input *DeleteSizeConstraintSetInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSizeConstraintSet func (c *WAF) DeleteSizeConstraintSet(input *DeleteSizeConstraintSetInput) (*DeleteSizeConstraintSetOutput, error) { req, out := c.DeleteSizeConstraintSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSizeConstraintSetWithContext is the same as DeleteSizeConstraintSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSizeConstraintSet 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 *WAF) DeleteSizeConstraintSetWithContext(ctx aws.Context, input *DeleteSizeConstraintSetInput, opts ...request.Option) (*DeleteSizeConstraintSetOutput, error) { + req, out := c.DeleteSizeConstraintSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteSqlInjectionMatchSet = "DeleteSqlInjectionMatchSet" @@ -1496,8 +1662,23 @@ func (c *WAF) DeleteSqlInjectionMatchSetRequest(input *DeleteSqlInjectionMatchSe // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteSqlInjectionMatchSet func (c *WAF) DeleteSqlInjectionMatchSet(input *DeleteSqlInjectionMatchSetInput) (*DeleteSqlInjectionMatchSetOutput, error) { req, out := c.DeleteSqlInjectionMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteSqlInjectionMatchSetWithContext is the same as DeleteSqlInjectionMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSqlInjectionMatchSet 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 *WAF) DeleteSqlInjectionMatchSetWithContext(ctx aws.Context, input *DeleteSqlInjectionMatchSetInput, opts ...request.Option) (*DeleteSqlInjectionMatchSetOutput, error) { + req, out := c.DeleteSqlInjectionMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteWebACL = "DeleteWebACL" @@ -1605,8 +1786,23 @@ func (c *WAF) DeleteWebACLRequest(input *DeleteWebACLInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteWebACL func (c *WAF) DeleteWebACL(input *DeleteWebACLInput) (*DeleteWebACLOutput, error) { req, out := c.DeleteWebACLRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteWebACLWithContext is the same as DeleteWebACL with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteWebACL 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 *WAF) DeleteWebACLWithContext(ctx aws.Context, input *DeleteWebACLInput, opts ...request.Option) (*DeleteWebACLOutput, error) { + req, out := c.DeleteWebACLRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opDeleteXssMatchSet = "DeleteXssMatchSet" @@ -1718,8 +1914,23 @@ func (c *WAF) DeleteXssMatchSetRequest(input *DeleteXssMatchSetInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteXssMatchSet func (c *WAF) DeleteXssMatchSet(input *DeleteXssMatchSetInput) (*DeleteXssMatchSetOutput, error) { req, out := c.DeleteXssMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// DeleteXssMatchSetWithContext is the same as DeleteXssMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteXssMatchSet 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 *WAF) DeleteXssMatchSetWithContext(ctx aws.Context, input *DeleteXssMatchSetInput, opts ...request.Option) (*DeleteXssMatchSetOutput, error) { + req, out := c.DeleteXssMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetByteMatchSet = "GetByteMatchSet" @@ -1791,8 +2002,23 @@ func (c *WAF) GetByteMatchSetRequest(input *GetByteMatchSetInput) (req *request. // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetByteMatchSet func (c *WAF) GetByteMatchSet(input *GetByteMatchSetInput) (*GetByteMatchSetOutput, error) { req, out := c.GetByteMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetByteMatchSetWithContext is the same as GetByteMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See GetByteMatchSet 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 *WAF) GetByteMatchSetWithContext(ctx aws.Context, input *GetByteMatchSetInput, opts ...request.Option) (*GetByteMatchSetOutput, error) { + req, out := c.GetByteMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetChangeToken = "GetChangeToken" @@ -1871,8 +2097,23 @@ func (c *WAF) GetChangeTokenRequest(input *GetChangeTokenInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeToken func (c *WAF) GetChangeToken(input *GetChangeTokenInput) (*GetChangeTokenOutput, error) { req, out := c.GetChangeTokenRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetChangeTokenWithContext is the same as GetChangeToken with the addition of +// the ability to pass a context and additional request options. +// +// See GetChangeToken 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 *WAF) GetChangeTokenWithContext(ctx aws.Context, input *GetChangeTokenInput, opts ...request.Option) (*GetChangeTokenOutput, error) { + req, out := c.GetChangeTokenRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetChangeTokenStatus = "GetChangeTokenStatus" @@ -1950,8 +2191,23 @@ func (c *WAF) GetChangeTokenStatusRequest(input *GetChangeTokenStatusInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetChangeTokenStatus func (c *WAF) GetChangeTokenStatus(input *GetChangeTokenStatusInput) (*GetChangeTokenStatusOutput, error) { req, out := c.GetChangeTokenStatusRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetChangeTokenStatusWithContext is the same as GetChangeTokenStatus with the addition of +// the ability to pass a context and additional request options. +// +// See GetChangeTokenStatus 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 *WAF) GetChangeTokenStatusWithContext(ctx aws.Context, input *GetChangeTokenStatusInput, opts ...request.Option) (*GetChangeTokenStatusOutput, error) { + req, out := c.GetChangeTokenStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetIPSet = "GetIPSet" @@ -2023,8 +2279,23 @@ func (c *WAF) GetIPSetRequest(input *GetIPSetInput) (req *request.Request, outpu // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetIPSet func (c *WAF) GetIPSet(input *GetIPSetInput) (*GetIPSetOutput, error) { req, out := c.GetIPSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetIPSetWithContext is the same as GetIPSet with the addition of +// the ability to pass a context and additional request options. +// +// See GetIPSet 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 *WAF) GetIPSetWithContext(ctx aws.Context, input *GetIPSetInput, opts ...request.Option) (*GetIPSetOutput, error) { + req, out := c.GetIPSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetRule = "GetRule" @@ -2097,8 +2368,23 @@ func (c *WAF) GetRuleRequest(input *GetRuleInput) (req *request.Request, output // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetRule func (c *WAF) GetRule(input *GetRuleInput) (*GetRuleOutput, error) { req, out := c.GetRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetRuleWithContext is the same as GetRule with the addition of +// the ability to pass a context and additional request options. +// +// See GetRule 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 *WAF) GetRuleWithContext(ctx aws.Context, input *GetRuleInput, opts ...request.Option) (*GetRuleOutput, error) { + req, out := c.GetRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSampledRequests = "GetSampledRequests" @@ -2149,7 +2435,7 @@ func (c *WAF) GetSampledRequestsRequest(input *GetSampledRequestsInput) (req *re // Gets detailed information about a specified number of requests--a sample--that // AWS WAF randomly selects from among the first 5,000 requests that your AWS // resource received during a time range that you choose. You can specify a -// sample size of up to 100 requests, and you can specify any time range in +// sample size of up to 500 requests, and you can specify any time range in // the previous three hours. // // GetSampledRequests returns a time range, which is usually the time range @@ -2176,8 +2462,23 @@ func (c *WAF) GetSampledRequestsRequest(input *GetSampledRequestsInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSampledRequests func (c *WAF) GetSampledRequests(input *GetSampledRequestsInput) (*GetSampledRequestsOutput, error) { req, out := c.GetSampledRequestsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSampledRequestsWithContext is the same as GetSampledRequests with the addition of +// the ability to pass a context and additional request options. +// +// See GetSampledRequests 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 *WAF) GetSampledRequestsWithContext(ctx aws.Context, input *GetSampledRequestsInput, opts ...request.Option) (*GetSampledRequestsOutput, error) { + req, out := c.GetSampledRequestsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSizeConstraintSet = "GetSizeConstraintSet" @@ -2249,8 +2550,23 @@ func (c *WAF) GetSizeConstraintSetRequest(input *GetSizeConstraintSetInput) (req // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSizeConstraintSet func (c *WAF) GetSizeConstraintSet(input *GetSizeConstraintSetInput) (*GetSizeConstraintSetOutput, error) { req, out := c.GetSizeConstraintSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSizeConstraintSetWithContext is the same as GetSizeConstraintSet with the addition of +// the ability to pass a context and additional request options. +// +// See GetSizeConstraintSet 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 *WAF) GetSizeConstraintSetWithContext(ctx aws.Context, input *GetSizeConstraintSetInput, opts ...request.Option) (*GetSizeConstraintSetOutput, error) { + req, out := c.GetSizeConstraintSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetSqlInjectionMatchSet = "GetSqlInjectionMatchSet" @@ -2322,8 +2638,23 @@ func (c *WAF) GetSqlInjectionMatchSetRequest(input *GetSqlInjectionMatchSetInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetSqlInjectionMatchSet func (c *WAF) GetSqlInjectionMatchSet(input *GetSqlInjectionMatchSetInput) (*GetSqlInjectionMatchSetOutput, error) { req, out := c.GetSqlInjectionMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetSqlInjectionMatchSetWithContext is the same as GetSqlInjectionMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See GetSqlInjectionMatchSet 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 *WAF) GetSqlInjectionMatchSetWithContext(ctx aws.Context, input *GetSqlInjectionMatchSetInput, opts ...request.Option) (*GetSqlInjectionMatchSetOutput, error) { + req, out := c.GetSqlInjectionMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetWebACL = "GetWebACL" @@ -2395,8 +2726,23 @@ func (c *WAF) GetWebACLRequest(input *GetWebACLInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetWebACL func (c *WAF) GetWebACL(input *GetWebACLInput) (*GetWebACLOutput, error) { req, out := c.GetWebACLRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetWebACLWithContext is the same as GetWebACL with the addition of +// the ability to pass a context and additional request options. +// +// See GetWebACL 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 *WAF) GetWebACLWithContext(ctx aws.Context, input *GetWebACLInput, opts ...request.Option) (*GetWebACLOutput, error) { + req, out := c.GetWebACLRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opGetXssMatchSet = "GetXssMatchSet" @@ -2468,8 +2814,23 @@ func (c *WAF) GetXssMatchSetRequest(input *GetXssMatchSetInput) (req *request.Re // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/GetXssMatchSet func (c *WAF) GetXssMatchSet(input *GetXssMatchSetInput) (*GetXssMatchSetOutput, error) { req, out := c.GetXssMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// GetXssMatchSetWithContext is the same as GetXssMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See GetXssMatchSet 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 *WAF) GetXssMatchSetWithContext(ctx aws.Context, input *GetXssMatchSetInput, opts ...request.Option) (*GetXssMatchSetOutput, error) { + req, out := c.GetXssMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListByteMatchSets = "ListByteMatchSets" @@ -2538,8 +2899,23 @@ func (c *WAF) ListByteMatchSetsRequest(input *ListByteMatchSetsInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListByteMatchSets func (c *WAF) ListByteMatchSets(input *ListByteMatchSetsInput) (*ListByteMatchSetsOutput, error) { req, out := c.ListByteMatchSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListByteMatchSetsWithContext is the same as ListByteMatchSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListByteMatchSets 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 *WAF) ListByteMatchSetsWithContext(ctx aws.Context, input *ListByteMatchSetsInput, opts ...request.Option) (*ListByteMatchSetsOutput, error) { + req, out := c.ListByteMatchSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListIPSets = "ListIPSets" @@ -2608,8 +2984,23 @@ func (c *WAF) ListIPSetsRequest(input *ListIPSetsInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListIPSets func (c *WAF) ListIPSets(input *ListIPSetsInput) (*ListIPSetsOutput, error) { req, out := c.ListIPSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListIPSetsWithContext is the same as ListIPSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListIPSets 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 *WAF) ListIPSetsWithContext(ctx aws.Context, input *ListIPSetsInput, opts ...request.Option) (*ListIPSetsOutput, error) { + req, out := c.ListIPSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListRules = "ListRules" @@ -2678,8 +3069,23 @@ func (c *WAF) ListRulesRequest(input *ListRulesInput) (req *request.Request, out // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListRules func (c *WAF) ListRules(input *ListRulesInput) (*ListRulesOutput, error) { req, out := c.ListRulesRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListRulesWithContext is the same as ListRules with the addition of +// the ability to pass a context and additional request options. +// +// See ListRules 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 *WAF) ListRulesWithContext(ctx aws.Context, input *ListRulesInput, opts ...request.Option) (*ListRulesOutput, error) { + req, out := c.ListRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListSizeConstraintSets = "ListSizeConstraintSets" @@ -2748,8 +3154,23 @@ func (c *WAF) ListSizeConstraintSetsRequest(input *ListSizeConstraintSetsInput) // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSizeConstraintSets func (c *WAF) ListSizeConstraintSets(input *ListSizeConstraintSetsInput) (*ListSizeConstraintSetsOutput, error) { req, out := c.ListSizeConstraintSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSizeConstraintSetsWithContext is the same as ListSizeConstraintSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListSizeConstraintSets 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 *WAF) ListSizeConstraintSetsWithContext(ctx aws.Context, input *ListSizeConstraintSetsInput, opts ...request.Option) (*ListSizeConstraintSetsOutput, error) { + req, out := c.ListSizeConstraintSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListSqlInjectionMatchSets = "ListSqlInjectionMatchSets" @@ -2818,8 +3239,23 @@ func (c *WAF) ListSqlInjectionMatchSetsRequest(input *ListSqlInjectionMatchSetsI // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListSqlInjectionMatchSets func (c *WAF) ListSqlInjectionMatchSets(input *ListSqlInjectionMatchSetsInput) (*ListSqlInjectionMatchSetsOutput, error) { req, out := c.ListSqlInjectionMatchSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListSqlInjectionMatchSetsWithContext is the same as ListSqlInjectionMatchSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListSqlInjectionMatchSets 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 *WAF) ListSqlInjectionMatchSetsWithContext(ctx aws.Context, input *ListSqlInjectionMatchSetsInput, opts ...request.Option) (*ListSqlInjectionMatchSetsOutput, error) { + req, out := c.ListSqlInjectionMatchSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListWebACLs = "ListWebACLs" @@ -2888,8 +3324,23 @@ func (c *WAF) ListWebACLsRequest(input *ListWebACLsInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListWebACLs func (c *WAF) ListWebACLs(input *ListWebACLsInput) (*ListWebACLsOutput, error) { req, out := c.ListWebACLsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListWebACLsWithContext is the same as ListWebACLs with the addition of +// the ability to pass a context and additional request options. +// +// See ListWebACLs 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 *WAF) ListWebACLsWithContext(ctx aws.Context, input *ListWebACLsInput, opts ...request.Option) (*ListWebACLsOutput, error) { + req, out := c.ListWebACLsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opListXssMatchSets = "ListXssMatchSets" @@ -2958,8 +3409,23 @@ func (c *WAF) ListXssMatchSetsRequest(input *ListXssMatchSetsInput) (req *reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListXssMatchSets func (c *WAF) ListXssMatchSets(input *ListXssMatchSetsInput) (*ListXssMatchSetsOutput, error) { req, out := c.ListXssMatchSetsRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// ListXssMatchSetsWithContext is the same as ListXssMatchSets with the addition of +// the ability to pass a context and additional request options. +// +// See ListXssMatchSets 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 *WAF) ListXssMatchSetsWithContext(ctx aws.Context, input *ListXssMatchSetsInput, opts ...request.Option) (*ListXssMatchSetsOutput, error) { + req, out := c.ListXssMatchSetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateByteMatchSet = "UpdateByteMatchSet" @@ -3140,8 +3606,23 @@ func (c *WAF) UpdateByteMatchSetRequest(input *UpdateByteMatchSetInput) (req *re // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateByteMatchSet func (c *WAF) UpdateByteMatchSet(input *UpdateByteMatchSetInput) (*UpdateByteMatchSetOutput, error) { req, out := c.UpdateByteMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateByteMatchSetWithContext is the same as UpdateByteMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateByteMatchSet 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 *WAF) UpdateByteMatchSetWithContext(ctx aws.Context, input *UpdateByteMatchSetInput, opts ...request.Option) (*UpdateByteMatchSetOutput, error) { + req, out := c.UpdateByteMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateIPSet = "UpdateIPSet" @@ -3342,8 +3823,23 @@ func (c *WAF) UpdateIPSetRequest(input *UpdateIPSetInput) (req *request.Request, // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateIPSet func (c *WAF) UpdateIPSet(input *UpdateIPSetInput) (*UpdateIPSetOutput, error) { req, out := c.UpdateIPSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateIPSetWithContext is the same as UpdateIPSet with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateIPSet 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 *WAF) UpdateIPSetWithContext(ctx aws.Context, input *UpdateIPSetInput, opts ...request.Option) (*UpdateIPSetOutput, error) { + req, out := c.UpdateIPSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateRule = "UpdateRule" @@ -3528,8 +4024,23 @@ func (c *WAF) UpdateRuleRequest(input *UpdateRuleInput) (req *request.Request, o // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateRule func (c *WAF) UpdateRule(input *UpdateRuleInput) (*UpdateRuleOutput, error) { req, out := c.UpdateRuleRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateRuleWithContext is the same as UpdateRule with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRule 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 *WAF) UpdateRuleWithContext(ctx aws.Context, input *UpdateRuleInput, opts ...request.Option) (*UpdateRuleOutput, error) { + req, out := c.UpdateRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateSizeConstraintSet = "UpdateSizeConstraintSet" @@ -3720,8 +4231,23 @@ func (c *WAF) UpdateSizeConstraintSetRequest(input *UpdateSizeConstraintSetInput // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSizeConstraintSet func (c *WAF) UpdateSizeConstraintSet(input *UpdateSizeConstraintSetInput) (*UpdateSizeConstraintSetOutput, error) { req, out := c.UpdateSizeConstraintSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateSizeConstraintSetWithContext is the same as UpdateSizeConstraintSet with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateSizeConstraintSet 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 *WAF) UpdateSizeConstraintSetWithContext(ctx aws.Context, input *UpdateSizeConstraintSetInput, opts ...request.Option) (*UpdateSizeConstraintSetOutput, error) { + req, out := c.UpdateSizeConstraintSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateSqlInjectionMatchSet = "UpdateSqlInjectionMatchSet" @@ -3897,8 +4423,23 @@ func (c *WAF) UpdateSqlInjectionMatchSetRequest(input *UpdateSqlInjectionMatchSe // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateSqlInjectionMatchSet func (c *WAF) UpdateSqlInjectionMatchSet(input *UpdateSqlInjectionMatchSetInput) (*UpdateSqlInjectionMatchSetOutput, error) { req, out := c.UpdateSqlInjectionMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateSqlInjectionMatchSetWithContext is the same as UpdateSqlInjectionMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateSqlInjectionMatchSet 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 *WAF) UpdateSqlInjectionMatchSetWithContext(ctx aws.Context, input *UpdateSqlInjectionMatchSetInput, opts ...request.Option) (*UpdateSqlInjectionMatchSetOutput, error) { + req, out := c.UpdateSqlInjectionMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateWebACL = "UpdateWebACL" @@ -3969,8 +4510,6 @@ func (c *WAF) UpdateWebACLRequest(input *UpdateWebACLInput) (req *request.Reques // and doesn't evaluate the request against the remaining Rules in the WebACL, // if any. // -// * The CloudFront distribution that you want to associate with the WebACL. -// // To create and configure a WebACL, perform the following steps: // // Create and update the predicates that you want to include in Rules. For more @@ -4095,8 +4634,23 @@ func (c *WAF) UpdateWebACLRequest(input *UpdateWebACLInput) (req *request.Reques // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateWebACL func (c *WAF) UpdateWebACL(input *UpdateWebACLInput) (*UpdateWebACLOutput, error) { req, out := c.UpdateWebACLRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateWebACLWithContext is the same as UpdateWebACL with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateWebACL 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 *WAF) UpdateWebACLWithContext(ctx aws.Context, input *UpdateWebACLInput, opts ...request.Option) (*UpdateWebACLOutput, error) { + req, out := c.UpdateWebACLRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } const opUpdateXssMatchSet = "UpdateXssMatchSet" @@ -4272,8 +4826,23 @@ func (c *WAF) UpdateXssMatchSetRequest(input *UpdateXssMatchSetInput) (req *requ // Please also see https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UpdateXssMatchSet func (c *WAF) UpdateXssMatchSet(input *UpdateXssMatchSetInput) (*UpdateXssMatchSetOutput, error) { req, out := c.UpdateXssMatchSetRequest(input) - err := req.Send() - return out, err + return out, req.Send() +} + +// UpdateXssMatchSetWithContext is the same as UpdateXssMatchSet with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateXssMatchSet 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 *WAF) UpdateXssMatchSetWithContext(ctx aws.Context, input *UpdateXssMatchSetInput, opts ...request.Option) (*UpdateXssMatchSetOutput, error) { + req, out := c.UpdateXssMatchSetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() } // The ActivatedRule object in an UpdateWebACL request specifies a Rule that diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go b/installer/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go index e5671e0501..9a4b8884ff 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package waf diff --git a/installer/vendor/github.com/aws/aws-sdk-go/service/waf/service.go b/installer/vendor/github.com/aws/aws-sdk-go/service/waf/service.go index 700ef9cfd2..dadb9ca7bd 100644 --- a/installer/vendor/github.com/aws/aws-sdk-go/service/waf/service.go +++ b/installer/vendor/github.com/aws/aws-sdk-go/service/waf/service.go @@ -1,4 +1,4 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package waf diff --git a/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/datasource_cloudinit_config.go b/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/datasource_cloudinit_config.go index edbe0d13ec..8a24c329a4 100644 --- a/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/datasource_cloudinit_config.go +++ b/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/datasource_cloudinit_config.go @@ -19,41 +19,41 @@ func dataSourceCloudinitConfig() *schema.Resource { Read: dataSourceCloudinitConfigRead, Schema: map[string]*schema.Schema{ - "part": &schema.Schema{ + "part": { Type: schema.TypeList, Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "content_type": &schema.Schema{ + "content_type": { Type: schema.TypeString, Optional: true, }, - "content": &schema.Schema{ + "content": { Type: schema.TypeString, Required: true, }, - "filename": &schema.Schema{ + "filename": { Type: schema.TypeString, Optional: true, }, - "merge_type": &schema.Schema{ + "merge_type": { Type: schema.TypeString, Optional: true, }, }, }, }, - "gzip": &schema.Schema{ + "gzip": { Type: schema.TypeBool, Optional: true, Default: true, }, - "base64_encode": &schema.Schema{ + "base64_encode": { Type: schema.TypeBool, Optional: true, Default: true, }, - "rendered": &schema.Schema{ + "rendered": { Type: schema.TypeString, Computed: true, Description: "rendered cloudinit configuration", @@ -84,7 +84,10 @@ func renderCloudinitConfig(d *schema.ResourceData) (string, error) { cloudInitParts := make(cloudInitParts, len(partsValue.([]interface{}))) for i, v := range partsValue.([]interface{}) { - p := v.(map[string]interface{}) + p, castOk := v.(map[string]interface{}) + if !castOk { + return "", fmt.Errorf("Unable to parse parts in cloudinit resource declaration") + } part := cloudInitPart{} if p, ok := p["content_type"]; ok { @@ -137,7 +140,7 @@ func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error { } writer.Write([]byte(fmt.Sprintf("Content-Type: multipart/mixed; boundary=\"%s\"\n", mimeWriter.Boundary()))) - writer.Write([]byte("MIME-Version: 1.0\r\n")) + writer.Write([]byte("MIME-Version: 1.0\r\n\r\n")) for _, part := range parts { header := textproto.MIMEHeader{} diff --git a/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/provider.go b/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/provider.go index ece6c9f34a..fb340754d8 100644 --- a/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/provider.go +++ b/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/provider.go @@ -20,6 +20,7 @@ func Provider() terraform.ResourceProvider { "template_cloudinit_config", dataSourceCloudinitConfig(), ), + "template_dir": resourceDir(), }, } } diff --git a/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/resource_template_dir.go b/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/resource_template_dir.go new file mode 100644 index 0000000000..63a2f18dc9 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/builtin/providers/template/resource_template_dir.go @@ -0,0 +1,234 @@ +package template + +import ( + "archive/tar" + "bytes" + "crypto/sha1" + "encoding/hex" + "fmt" + "io" + "io/ioutil" + "os" + "path" + "path/filepath" + + "github.com/hashicorp/terraform/helper/pathorcontents" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceDir() *schema.Resource { + return &schema.Resource{ + Create: resourceTemplateDirCreate, + Read: resourceTemplateDirRead, + Delete: resourceTemplateDirDelete, + + Schema: map[string]*schema.Schema{ + "source_dir": { + Type: schema.TypeString, + Description: "Path to the directory where the files to template reside", + Required: true, + ForceNew: true, + }, + "vars": { + Type: schema.TypeMap, + Optional: true, + Default: make(map[string]interface{}), + Description: "Variables to substitute", + ValidateFunc: validateVarsAttribute, + ForceNew: true, + }, + "destination_dir": { + Type: schema.TypeString, + Description: "Path to the directory where the templated files will be written", + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceTemplateDirRead(d *schema.ResourceData, meta interface{}) error { + sourceDir := d.Get("source_dir").(string) + destinationDir := d.Get("destination_dir").(string) + + // If the output doesn't exist, mark the resource for creation. + if _, err := os.Stat(destinationDir); os.IsNotExist(err) { + d.SetId("") + return nil + } + + // If the combined hash of the input and output directories is different from + // the stored one, mark the resource for re-creation. + // + // The output directory is technically enough for the general case, but by + // hashing the input directory as well, we make development much easier: when + // a developer modifies one of the input files, the generation is + // re-triggered. + hash, err := generateID(sourceDir, destinationDir) + if err != nil { + return err + } + if hash != d.Id() { + d.SetId("") + return nil + } + + return nil +} + +func resourceTemplateDirCreate(d *schema.ResourceData, meta interface{}) error { + sourceDir := d.Get("source_dir").(string) + destinationDir := d.Get("destination_dir").(string) + vars := d.Get("vars").(map[string]interface{}) + + // Always delete the output first, otherwise files that got deleted from the + // input directory might still be present in the output afterwards. + if err := resourceTemplateDirDelete(d, meta); err != nil { + return err + } + + // Create the destination directory and any other intermediate directories + // leading to it. + if _, err := os.Stat(destinationDir); err != nil { + if err := os.MkdirAll(destinationDir, 0777); err != nil { + return err + } + } + + // Recursively crawl the input files/directories and generate the output ones. + err := filepath.Walk(sourceDir, func(p string, f os.FileInfo, err error) error { + if err != nil { + return err + } + + if f.IsDir() { + return nil + } + + relPath, _ := filepath.Rel(sourceDir, p) + return generateDirFile(p, path.Join(destinationDir, relPath), f, vars) + }) + if err != nil { + return err + } + + // Compute ID. + hash, err := generateID(sourceDir, destinationDir) + if err != nil { + return err + } + d.SetId(hash) + + return nil +} + +func resourceTemplateDirDelete(d *schema.ResourceData, _ interface{}) error { + d.SetId("") + + destinationDir := d.Get("destination_dir").(string) + if _, err := os.Stat(destinationDir); os.IsNotExist(err) { + return nil + } + + if err := os.RemoveAll(destinationDir); err != nil { + return fmt.Errorf("could not delete directory %q: %s", destinationDir, err) + } + + return nil +} + +func generateDirFile(sourceDir, destinationDir string, f os.FileInfo, vars map[string]interface{}) error { + inputContent, _, err := pathorcontents.Read(sourceDir) + if err != nil { + return err + } + + outputContent, err := execute(inputContent, vars) + if err != nil { + return templateRenderError(fmt.Errorf("failed to render %v: %v", sourceDir, err)) + } + + outputDir := path.Dir(destinationDir) + if _, err := os.Stat(outputDir); err != nil { + if err := os.MkdirAll(outputDir, 0777); err != nil { + return err + } + } + + err = ioutil.WriteFile(destinationDir, []byte(outputContent), f.Mode()) + if err != nil { + return err + } + + return nil +} + +func generateID(sourceDir, destinationDir string) (string, error) { + inputHash, err := generateDirHash(sourceDir) + if err != nil { + return "", err + } + outputHash, err := generateDirHash(destinationDir) + if err != nil { + return "", err + } + checksum := sha1.Sum([]byte(inputHash + outputHash)) + return hex.EncodeToString(checksum[:]), nil +} + +func generateDirHash(directoryPath string) (string, error) { + tarData, err := tarDir(directoryPath) + if err != nil { + return "", fmt.Errorf("could not generate output checksum: %s", err) + } + + checksum := sha1.Sum(tarData) + return hex.EncodeToString(checksum[:]), nil +} + +func tarDir(directoryPath string) ([]byte, error) { + buf := new(bytes.Buffer) + tw := tar.NewWriter(buf) + + writeFile := func(p string, f os.FileInfo, err error) error { + if err != nil { + return err + } + + var header *tar.Header + var file *os.File + + header, err = tar.FileInfoHeader(f, f.Name()) + if err != nil { + return err + } + relPath, _ := filepath.Rel(directoryPath, p) + header.Name = relPath + + if err := tw.WriteHeader(header); err != nil { + return err + } + + if f.IsDir() { + return nil + } + + file, err = os.Open(p) + if err != nil { + return err + } + defer file.Close() + + _, err = io.Copy(tw, file) + return err + } + + if err := filepath.Walk(directoryPath, writeFile); err != nil { + return []byte{}, err + } + if err := tw.Flush(); err != nil { + return []byte{}, err + } + + return buf.Bytes(), nil +} diff --git a/installer/vendor/github.com/hashicorp/terraform/commands.go b/installer/vendor/github.com/hashicorp/terraform/commands.go index e4abaf0b24..409f4d85df 100644 --- a/installer/vendor/github.com/hashicorp/terraform/commands.go +++ b/installer/vendor/github.com/hashicorp/terraform/commands.go @@ -42,8 +42,9 @@ func init() { // that to match. PlumbingCommands = map[string]struct{}{ - "state": struct{}{}, // includes all subcommands - "debug": struct{}{}, // includes all subcommands + "state": struct{}{}, // includes all subcommands + "debug": struct{}{}, // includes all subcommands + "force-unlock": struct{}{}, } Commands = map[string]cli.CommandFactory{ @@ -69,6 +70,36 @@ func init() { }, nil }, + "env": func() (cli.Command, error) { + return &command.EnvCommand{ + Meta: meta, + }, nil + }, + + "env list": func() (cli.Command, error) { + return &command.EnvListCommand{ + Meta: meta, + }, nil + }, + + "env select": func() (cli.Command, error) { + return &command.EnvSelectCommand{ + Meta: meta, + }, nil + }, + + "env new": func() (cli.Command, error) { + return &command.EnvNewCommand{ + Meta: meta, + }, nil + }, + + "env delete": func() (cli.Command, error) { + return &command.EnvDeleteCommand{ + Meta: meta, + }, nil + }, + "fmt": func() (cli.Command, error) { return &command.FmtCommand{ Meta: meta, @@ -129,12 +160,6 @@ func init() { }, nil }, - "remote": func() (cli.Command, error) { - return &command.RemoteCommand{ - Meta: meta, - }, nil - }, - "show": func() (cli.Command, error) { return &command.ShowCommand{ Meta: meta, @@ -185,12 +210,16 @@ func init() { }, nil }, - "state": func() (cli.Command, error) { - return &command.StateCommand{ + "force-unlock": func() (cli.Command, error) { + return &command.UnlockCommand{ Meta: meta, }, nil }, + "state": func() (cli.Command, error) { + return &command.StateCommand{}, nil + }, + "state list": func() (cli.Command, error) { return &command.StateListCommand{ Meta: meta, @@ -209,6 +238,18 @@ func init() { }, nil }, + "state pull": func() (cli.Command, error) { + return &command.StatePullCommand{ + Meta: meta, + }, nil + }, + + "state push": func() (cli.Command, error) { + return &command.StatePushCommand{ + Meta: meta, + }, nil + }, + "state show": func() (cli.Command, error) { return &command.StateShowCommand{ Meta: meta, diff --git a/installer/vendor/github.com/hashicorp/terraform/config.go b/installer/vendor/github.com/hashicorp/terraform/config.go index dc843a9c69..d0df909a9b 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config.go +++ b/installer/vendor/github.com/hashicorp/terraform/config.go @@ -74,6 +74,14 @@ func LoadConfig(path string) (*Config, error) { return nil, err } + // Replace all env vars + for k, v := range result.Providers { + result.Providers[k] = os.ExpandEnv(v) + } + for k, v := range result.Provisioners { + result.Provisioners[k] = os.ExpandEnv(v) + } + return &result, nil } diff --git a/installer/vendor/github.com/hashicorp/terraform/config/append.go b/installer/vendor/github.com/hashicorp/terraform/config/append.go index a421df4a0d..5f4e89eef7 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/append.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/append.go @@ -35,8 +35,13 @@ func Append(c1, c2 *Config) (*Config, error) { c.Atlas = c2.Atlas } - c.Terraform = c1.Terraform - if c2.Terraform != nil { + // merge Terraform blocks + if c1.Terraform != nil { + c.Terraform = c1.Terraform + if c2.Terraform != nil { + c.Terraform.Merge(c2.Terraform) + } + } else { c.Terraform = c2.Terraform } diff --git a/installer/vendor/github.com/hashicorp/terraform/config/config.go b/installer/vendor/github.com/hashicorp/terraform/config/config.go index 655b006920..9a764ace31 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/config.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/config.go @@ -9,7 +9,6 @@ import ( "strings" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-version" "github.com/hashicorp/hil" "github.com/hashicorp/hil/ast" "github.com/hashicorp/terraform/helper/hilmapstructure" @@ -41,12 +40,6 @@ type Config struct { unknownKeys []string } -// Terraform is the Terraform meta-configuration that can be present -// in configuration files for configuring Terraform itself. -type Terraform struct { - RequiredVersion string `hcl:"required_version"` // Required Terraform version (constraint) -} - // AtlasConfig is the configuration for building in HashiCorp's Atlas. type AtlasConfig struct { Name string @@ -136,6 +129,9 @@ type Provisioner struct { Type string RawConfig *RawConfig ConnInfo *RawConfig + + When ProvisionerWhen + OnFailure ProvisionerOnFailure } // Copy returns a copy of this Provisioner @@ -144,6 +140,8 @@ func (p *Provisioner) Copy() *Provisioner { Type: p.Type, RawConfig: p.RawConfig.Copy(), ConnInfo: p.ConnInfo.Copy(), + When: p.When, + OnFailure: p.OnFailure, } } @@ -255,26 +253,7 @@ func (c *Config) Validate() error { // Validate the Terraform config if tf := c.Terraform; tf != nil { - if raw := tf.RequiredVersion; raw != "" { - // Check that the value has no interpolations - rc, err := NewRawConfig(map[string]interface{}{ - "root": raw, - }) - if err != nil { - errs = append(errs, fmt.Errorf( - "terraform.required_version: %s", err)) - } else if len(rc.Interpolations) > 0 { - errs = append(errs, fmt.Errorf( - "terraform.required_version: cannot contain interpolations")) - } else { - // Check it is valid - _, err := version.NewConstraint(raw) - if err != nil { - errs = append(errs, fmt.Errorf( - "terraform.required_version: invalid syntax: %s", err)) - } - } - } + errs = append(errs, c.Terraform.Validate()...) } vars := c.InterpolatedVariables() @@ -306,8 +285,15 @@ func (c *Config) Validate() error { } interp := false - fn := func(ast.Node) (interface{}, error) { - interp = true + fn := func(n ast.Node) (interface{}, error) { + // LiteralNode is a literal string (outside of a ${ ... } sequence). + // interpolationWalker skips most of these. but in particular it + // visits those that have escaped sequences (like $${foo}) as a + // signal that *some* processing is required on this string. For + // our purposes here though, this is fine and not an interpolation. + if _, ok := n.(*ast.LiteralNode); !ok { + interp = true + } return "", nil } @@ -513,25 +499,22 @@ func (c *Config) Validate() error { "%s: resource count can't reference count variable: %s", n, v.FullKey())) - case *ModuleVariable: - errs = append(errs, fmt.Errorf( - "%s: resource count can't reference module variable: %s", - n, - v.FullKey())) - case *ResourceVariable: - errs = append(errs, fmt.Errorf( - "%s: resource count can't reference resource variable: %s", - n, - v.FullKey())) case *SimpleVariable: errs = append(errs, fmt.Errorf( "%s: resource count can't reference variable: %s", n, v.FullKey())) + + // Good + case *ModuleVariable: + case *ResourceVariable: + case *TerraformVariable: case *UserVariable: - // Good + default: - panic(fmt.Sprintf("Unknown type in count var in %s: %T", n, v)) + errs = append(errs, fmt.Errorf( + "Internal error. Unknown type in count var in %s: %T", + n, v)) } } @@ -560,7 +543,7 @@ func (c *Config) Validate() error { // Validate DependsOn errs = append(errs, c.validateDependsOn(n, r.DependsOn, resources, modules)...) - // Verify provisioners don't contain any splats + // Verify provisioners for _, p := range r.Provisioners { // This validation checks that there are now splat variables // referencing ourself. This currently is not allowed. @@ -592,6 +575,17 @@ func (c *Config) Validate() error { break } } + + // Check for invalid when/onFailure values, though this should be + // picked up by the loader we check here just in case. + if p.When == ProvisionerWhenInvalid { + errs = append(errs, fmt.Errorf( + "%s: provisioner 'when' value is invalid", n)) + } + if p.OnFailure == ProvisionerOnFailureInvalid { + errs = append(errs, fmt.Errorf( + "%s: provisioner 'on_failure' value is invalid", n)) + } } // Verify ignore_changes contains valid entries @@ -1023,7 +1017,16 @@ func (v *Variable) ValidateTypeAndDefault() error { // If an explicit type is declared, ensure it is valid if v.DeclaredType != "" { if _, ok := typeStringMap[v.DeclaredType]; !ok { - return fmt.Errorf("Variable '%s' must be of type string or map - '%s' is not a valid type", v.Name, v.DeclaredType) + validTypes := []string{} + for k := range typeStringMap { + validTypes = append(validTypes, k) + } + return fmt.Errorf( + "Variable '%s' type must be one of [%s] - '%s' is not a valid type", + v.Name, + strings.Join(validTypes, ", "), + v.DeclaredType, + ) } } diff --git a/installer/vendor/github.com/hashicorp/terraform/config/config_string.go b/installer/vendor/github.com/hashicorp/terraform/config/config_string.go index f11290e87c..0b3abbcd53 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/config_string.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/config_string.go @@ -50,6 +50,26 @@ func (c *Config) TestString() string { return strings.TrimSpace(buf.String()) } +func terraformStr(t *Terraform) string { + result := "" + + if b := t.Backend; b != nil { + result += fmt.Sprintf("backend (%s)\n", b.Type) + + keys := make([]string, 0, len(b.RawConfig.Raw)) + for k, _ := range b.RawConfig.Raw { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, k := range keys { + result += fmt.Sprintf(" %s\n", k) + } + } + + return strings.TrimSpace(result) +} + func modulesStr(ms []*Module) string { result := "" order := make([]int, 0, len(ms)) @@ -214,7 +234,16 @@ func resourcesStr(rs []*Resource) string { if len(r.Provisioners) > 0 { result += fmt.Sprintf(" provisioners\n") for _, p := range r.Provisioners { - result += fmt.Sprintf(" %s\n", p.Type) + when := "" + if p.When != ProvisionerWhenCreate { + when = fmt.Sprintf(" (%s)", p.When.String()) + } + + result += fmt.Sprintf(" %s%s\n", p.Type, when) + + if p.OnFailure != ProvisionerOnFailureFail { + result += fmt.Sprintf(" on_failure = %s\n", p.OnFailure.String()) + } ks := make([]string, 0, len(p.RawConfig.Raw)) for k, _ := range p.RawConfig.Raw { diff --git a/installer/vendor/github.com/hashicorp/terraform/config/config_terraform.go b/installer/vendor/github.com/hashicorp/terraform/config/config_terraform.go new file mode 100644 index 0000000000..8535c96485 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/config/config_terraform.go @@ -0,0 +1,117 @@ +package config + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-version" + "github.com/mitchellh/hashstructure" +) + +// Terraform is the Terraform meta-configuration that can be present +// in configuration files for configuring Terraform itself. +type Terraform struct { + RequiredVersion string `hcl:"required_version"` // Required Terraform version (constraint) + Backend *Backend // See Backend struct docs +} + +// Validate performs the validation for just the Terraform configuration. +func (t *Terraform) Validate() []error { + var errs []error + + if raw := t.RequiredVersion; raw != "" { + // Check that the value has no interpolations + rc, err := NewRawConfig(map[string]interface{}{ + "root": raw, + }) + if err != nil { + errs = append(errs, fmt.Errorf( + "terraform.required_version: %s", err)) + } else if len(rc.Interpolations) > 0 { + errs = append(errs, fmt.Errorf( + "terraform.required_version: cannot contain interpolations")) + } else { + // Check it is valid + _, err := version.NewConstraint(raw) + if err != nil { + errs = append(errs, fmt.Errorf( + "terraform.required_version: invalid syntax: %s", err)) + } + } + } + + if t.Backend != nil { + errs = append(errs, t.Backend.Validate()...) + } + + return errs +} + +// Merge t with t2. +// Any conflicting fields are overwritten by t2. +func (t *Terraform) Merge(t2 *Terraform) { + if t2.RequiredVersion != "" { + t.RequiredVersion = t2.RequiredVersion + } + + if t2.Backend != nil { + t.Backend = t2.Backend + } +} + +// Backend is the configuration for the "backend" to use with Terraform. +// A backend is responsible for all major behavior of Terraform's core. +// The abstraction layer above the core (the "backend") allows for behavior +// such as remote operation. +type Backend struct { + Type string + RawConfig *RawConfig + + // Hash is a unique hash code representing the original configuration + // of the backend. This won't be recomputed unless Rehash is called. + Hash uint64 +} + +// Rehash returns a unique content hash for this backend's configuration +// as a uint64 value. +func (b *Backend) Rehash() uint64 { + // If we have no backend, the value is zero + if b == nil { + return 0 + } + + // Use hashstructure to hash only our type with the config. + code, err := hashstructure.Hash(map[string]interface{}{ + "type": b.Type, + "config": b.RawConfig.Raw, + }, nil) + + // This should never happen since we have just some basic primitives + // so panic if there is an error. + if err != nil { + panic(err) + } + + return code +} + +func (b *Backend) Validate() []error { + if len(b.RawConfig.Interpolations) > 0 { + return []error{fmt.Errorf(strings.TrimSpace(errBackendInterpolations))} + } + + return nil +} + +const errBackendInterpolations = ` +terraform.backend: configuration cannot contain interpolations + +The backend configuration is loaded by Terraform extremely early, before +the core of Terraform can be initialized. This is necessary because the backend +dictates the behavior of that core. The core is what handles interpolation +processing. Because of this, interpolations cannot be used in backend +configuration. + +If you'd like to parameterize backend configuration, we recommend using +partial configuration with the "-backend-config" flag to "terraform init". +` diff --git a/installer/vendor/github.com/hashicorp/terraform/config/interpolate.go b/installer/vendor/github.com/hashicorp/terraform/config/interpolate.go index 5867c6333c..bbb3555418 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/interpolate.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/interpolate.go @@ -84,6 +84,13 @@ type SimpleVariable struct { Key string } +// TerraformVariable is a "terraform."-prefixed variable used to access +// metadata about the Terraform run. +type TerraformVariable struct { + Field string + key string +} + // A UserVariable is a variable that is referencing a user variable // that is inputted from outside the configuration. This looks like // "${var.foo}" @@ -101,6 +108,8 @@ func NewInterpolatedVariable(v string) (InterpolatedVariable, error) { return NewPathVariable(v) } else if strings.HasPrefix(v, "self.") { return NewSelfVariable(v) + } else if strings.HasPrefix(v, "terraform.") { + return NewTerraformVariable(v) } else if strings.HasPrefix(v, "var.") { return NewUserVariable(v) } else if strings.HasPrefix(v, "module.") { @@ -278,6 +287,22 @@ func (v *SimpleVariable) GoString() string { return fmt.Sprintf("*%#v", *v) } +func NewTerraformVariable(key string) (*TerraformVariable, error) { + field := key[len("terraform."):] + return &TerraformVariable{ + Field: field, + key: key, + }, nil +} + +func (v *TerraformVariable) FullKey() string { + return v.key +} + +func (v *TerraformVariable) GoString() string { + return fmt.Sprintf("*%#v", *v) +} + func NewUserVariable(key string) (*UserVariable, error) { name := key[len("var."):] elem := "" diff --git a/installer/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go b/installer/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go index ad543c3086..b79334718b 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go @@ -11,6 +11,7 @@ import ( "io/ioutil" "math" "net" + "path/filepath" "regexp" "sort" "strconv" @@ -52,19 +53,24 @@ func listVariableValueToStringSlice(values []ast.Variable) ([]string, error) { // Funcs is the mapping of built-in functions for configuration. func Funcs() map[string]ast.Function { return map[string]ast.Function{ + "basename": interpolationFuncBasename(), "base64decode": interpolationFuncBase64Decode(), "base64encode": interpolationFuncBase64Encode(), "base64sha256": interpolationFuncBase64Sha256(), "ceil": interpolationFuncCeil(), + "chomp": interpolationFuncChomp(), "cidrhost": interpolationFuncCidrHost(), "cidrnetmask": interpolationFuncCidrNetmask(), "cidrsubnet": interpolationFuncCidrSubnet(), "coalesce": interpolationFuncCoalesce(), + "coalescelist": interpolationFuncCoalesceList(), "compact": interpolationFuncCompact(), "concat": interpolationFuncConcat(), + "dirname": interpolationFuncDirname(), "distinct": interpolationFuncDistinct(), "element": interpolationFuncElement(), "file": interpolationFuncFile(), + "matchkeys": interpolationFuncMatchKeys(), "floor": interpolationFuncFloor(), "format": interpolationFuncFormat(), "formatlist": interpolationFuncFormatList(), @@ -88,6 +94,7 @@ func Funcs() map[string]ast.Function { "slice": interpolationFuncSlice(), "sort": interpolationFuncSort(), "split": interpolationFuncSplit(), + "substr": interpolationFuncSubstr(), "timestamp": interpolationFuncTimestamp(), "title": interpolationFuncTitle(), "trimspace": interpolationFuncTrimSpace(), @@ -318,6 +325,30 @@ func interpolationFuncCoalesce() ast.Function { } } +// interpolationFuncCoalesceList implements the "coalescelist" function that +// returns the first non empty list from the provided input +func interpolationFuncCoalesceList() ast.Function { + return ast.Function{ + ArgTypes: []ast.Type{ast.TypeList}, + ReturnType: ast.TypeList, + Variadic: true, + VariadicType: ast.TypeList, + Callback: func(args []interface{}) (interface{}, error) { + if len(args) < 2 { + return nil, fmt.Errorf("must provide at least two arguments") + } + for _, arg := range args { + argument := arg.([]ast.Variable) + + if len(argument) > 0 { + return argument, nil + } + } + return make([]ast.Variable, 0), nil + }, + } +} + // interpolationFuncConcat implements the "concat" function that concatenates // multiple lists. func interpolationFuncConcat() ast.Function { @@ -455,6 +486,18 @@ func interpolationFuncCeil() ast.Function { } } +// interpolationFuncChomp removes trailing newlines from the given string +func interpolationFuncChomp() ast.Function { + newlines := regexp.MustCompile(`(?:\r\n?|\n)*\z`) + return ast.Function{ + ArgTypes: []ast.Type{ast.TypeString}, + ReturnType: ast.TypeString, + Callback: func(args []interface{}) (interface{}, error) { + return newlines.ReplaceAllString(args[0].(string), ""), nil + }, + } +} + // interpolationFuncFloorreturns returns the greatest integer value less than or equal to the argument func interpolationFuncFloor() ast.Function { return ast.Function{ @@ -599,6 +642,17 @@ func interpolationFuncIndex() ast.Function { } } +// interpolationFuncBasename implements the "dirname" function. +func interpolationFuncDirname() ast.Function { + return ast.Function{ + ArgTypes: []ast.Type{ast.TypeString}, + ReturnType: ast.TypeString, + Callback: func(args []interface{}) (interface{}, error) { + return filepath.Dir(args[0].(string)), nil + }, + } +} + // interpolationFuncDistinct implements the "distinct" function that // removes duplicate elements from a list. func interpolationFuncDistinct() ast.Function { @@ -640,6 +694,57 @@ func appendIfMissing(slice []string, element string) []string { return append(slice, element) } +// for two lists `keys` and `values` of equal length, returns all elements +// from `values` where the corresponding element from `keys` is in `searchset`. +func interpolationFuncMatchKeys() ast.Function { + return ast.Function{ + ArgTypes: []ast.Type{ast.TypeList, ast.TypeList, ast.TypeList}, + ReturnType: ast.TypeList, + Callback: func(args []interface{}) (interface{}, error) { + output := make([]ast.Variable, 0) + + values, _ := args[0].([]ast.Variable) + keys, _ := args[1].([]ast.Variable) + searchset, _ := args[2].([]ast.Variable) + + if len(keys) != len(values) { + return nil, fmt.Errorf("length of keys and values should be equal") + } + + for i, key := range keys { + for _, search := range searchset { + if res, err := compareSimpleVariables(key, search); err != nil { + return nil, err + } else if res == true { + output = append(output, values[i]) + break + } + } + } + // if searchset is empty, then output is an empty list as well. + // if we haven't matched any key, then output is an empty list. + return output, nil + }, + } +} + +// compare two variables of the same type, i.e. non complex one, such as TypeList or TypeMap +func compareSimpleVariables(a, b ast.Variable) (bool, error) { + if a.Type != b.Type { + return false, fmt.Errorf( + "won't compare items of different types %s and %s", + a.Type.Printable(), b.Type.Printable()) + } + switch a.Type { + case ast.TypeString: + return a.Value.(string) == b.Value.(string), nil + default: + return false, fmt.Errorf( + "can't compare items of type %s", + a.Type.Printable()) + } +} + // interpolationFuncJoin implements the "join" function that allows // multi-variable values to be joined by some character. func interpolationFuncJoin() ast.Function { @@ -1005,6 +1110,17 @@ func interpolationFuncValues(vs map[string]ast.Variable) ast.Function { } } +// interpolationFuncBasename implements the "basename" function. +func interpolationFuncBasename() ast.Function { + return ast.Function{ + ArgTypes: []ast.Type{ast.TypeString}, + ReturnType: ast.TypeString, + Callback: func(args []interface{}) (interface{}, error) { + return filepath.Base(args[0].(string)), nil + }, + } +} + // interpolationFuncBase64Encode implements the "base64encode" function that // allows Base64 encoding. func interpolationFuncBase64Encode() ast.Function { @@ -1183,3 +1299,48 @@ func interpolationFuncTitle() ast.Function { }, } } + +// interpolationFuncSubstr implements the "substr" function that allows strings +// to be truncated. +func interpolationFuncSubstr() ast.Function { + return ast.Function{ + ArgTypes: []ast.Type{ + ast.TypeString, // input string + ast.TypeInt, // offset + ast.TypeInt, // length + }, + ReturnType: ast.TypeString, + Callback: func(args []interface{}) (interface{}, error) { + str := args[0].(string) + offset := args[1].(int) + length := args[2].(int) + + // Interpret a negative offset as being equivalent to a positive + // offset taken from the end of the string. + if offset < 0 { + offset += len(str) + } + + // Interpret a length of `-1` as indicating that the substring + // should start at `offset` and continue until the end of the + // string. Any other negative length (other than `-1`) is invalid. + if length == -1 { + length = len(str) + } else if length >= 0 { + length += offset + } else { + return nil, fmt.Errorf("length should be a non-negative integer") + } + + if offset > len(str) { + return nil, fmt.Errorf("offset cannot be larger than the length of the string") + } + + if length > len(str) { + return nil, fmt.Errorf("'offset + length' cannot be larger than the length of the string") + } + + return str[offset:length], nil + }, + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/config/interpolate_walk.go b/installer/vendor/github.com/hashicorp/terraform/config/interpolate_walk.go index 81fa812087..ead3d102e1 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/interpolate_walk.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/interpolate_walk.go @@ -206,6 +206,12 @@ func (w *interpolationWalker) Primitive(v reflect.Value) error { } func (w *interpolationWalker) replaceCurrent(v reflect.Value) { + // if we don't have at least 2 values, we're not going to find a map, but + // we could panic. + if len(w.cs) < 2 { + return + } + c := w.cs[len(w.cs)-2] switch c.Kind() { case reflect.Map: diff --git a/installer/vendor/github.com/hashicorp/terraform/config/loader_hcl.go b/installer/vendor/github.com/hashicorp/terraform/config/loader_hcl.go index 88f6fd0cfe..a40ad5ba77 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/loader_hcl.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/loader_hcl.go @@ -209,6 +209,27 @@ func loadTerraformHcl(list *ast.ObjectList) (*Terraform, error) { // Get our one item item := list.Items[0] + // This block should have an empty top level ObjectItem. If there are keys + // here, it's likely because we have a flattened JSON object, and we can + // lift this into a nested ObjectList to decode properly. + if len(item.Keys) > 0 { + item = &ast.ObjectItem{ + Val: &ast.ObjectType{ + List: &ast.ObjectList{ + Items: []*ast.ObjectItem{item}, + }, + }, + } + } + + // We need the item value as an ObjectList + var listVal *ast.ObjectList + if ot, ok := item.Val.(*ast.ObjectType); ok { + listVal = ot.List + } else { + return nil, fmt.Errorf("terraform block: should be an object") + } + // NOTE: We purposely don't validate unknown HCL keys here so that // we can potentially read _future_ Terraform version config (to // still be able to validate the required version). @@ -223,9 +244,62 @@ func loadTerraformHcl(list *ast.ObjectList) (*Terraform, error) { err) } + // If we have provisioners, then parse those out + if os := listVal.Filter("backend"); len(os.Items) > 0 { + var err error + config.Backend, err = loadTerraformBackendHcl(os) + if err != nil { + return nil, fmt.Errorf( + "Error reading backend config for terraform block: %s", + err) + } + } + return &config, nil } +// Loads the Backend configuration from an object list. +func loadTerraformBackendHcl(list *ast.ObjectList) (*Backend, error) { + if len(list.Items) > 1 { + return nil, fmt.Errorf("only one 'backend' block allowed") + } + + // Get our one item + item := list.Items[0] + + // Verify the keys + if len(item.Keys) != 1 { + return nil, fmt.Errorf( + "position %s: 'backend' must be followed by exactly one string: a type", + item.Pos()) + } + + typ := item.Keys[0].Token.Value().(string) + + // Decode the raw config + var config map[string]interface{} + if err := hcl.DecodeObject(&config, item.Val); err != nil { + return nil, fmt.Errorf( + "Error reading backend config: %s", + err) + } + + rawConfig, err := NewRawConfig(config) + if err != nil { + return nil, fmt.Errorf( + "Error reading backend config: %s", + err) + } + + b := &Backend{ + Type: typ, + RawConfig: rawConfig, + } + b.Hash = b.Rehash() + + return b, nil +} + // Given a handle to a HCL object, this transforms it into the Atlas // configuration. func loadAtlasHcl(list *ast.ObjectList) (*AtlasConfig, error) { @@ -849,8 +923,40 @@ func loadProvisionersHcl(list *ast.ObjectList, connInfo map[string]interface{}) return nil, err } - // Delete the "connection" section, handle separately + // Parse the "when" value + when := ProvisionerWhenCreate + if v, ok := config["when"]; ok { + switch v { + case "create": + when = ProvisionerWhenCreate + case "destroy": + when = ProvisionerWhenDestroy + default: + return nil, fmt.Errorf( + "position %s: 'provisioner' when must be 'create' or 'destroy'", + item.Pos()) + } + } + + // Parse the "on_failure" value + onFailure := ProvisionerOnFailureFail + if v, ok := config["on_failure"]; ok { + switch v { + case "continue": + onFailure = ProvisionerOnFailureContinue + case "fail": + onFailure = ProvisionerOnFailureFail + default: + return nil, fmt.Errorf( + "position %s: 'provisioner' on_failure must be 'continue' or 'fail'", + item.Pos()) + } + } + + // Delete fields we special case delete(config, "connection") + delete(config, "when") + delete(config, "on_failure") rawConfig, err := NewRawConfig(config) if err != nil { @@ -889,6 +995,8 @@ func loadProvisionersHcl(list *ast.ObjectList, connInfo map[string]interface{}) Type: n, RawConfig: rawConfig, ConnInfo: connRaw, + When: when, + OnFailure: onFailure, }) } diff --git a/installer/vendor/github.com/hashicorp/terraform/config/merge.go b/installer/vendor/github.com/hashicorp/terraform/config/merge.go index 2e7686594d..db214be456 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/merge.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/merge.go @@ -32,9 +32,13 @@ func Merge(c1, c2 *Config) (*Config, error) { c.Atlas = c2.Atlas } - // Merge the Terraform configuration, which is a complete overwrite. - c.Terraform = c1.Terraform - if c2.Terraform != nil { + // Merge the Terraform configuration + if c1.Terraform != nil { + c.Terraform = c1.Terraform + if c2.Terraform != nil { + c.Terraform.Merge(c2.Terraform) + } + } else { c.Terraform = c2.Terraform } diff --git a/installer/vendor/github.com/hashicorp/terraform/config/module/inode.go b/installer/vendor/github.com/hashicorp/terraform/config/module/inode.go index b9be7e385b..8603ee268e 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/module/inode.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/module/inode.go @@ -1,4 +1,4 @@ -// +build linux darwin openbsd solaris +// +build linux darwin openbsd netbsd solaris package module diff --git a/installer/vendor/github.com/hashicorp/terraform/config/module/testing.go b/installer/vendor/github.com/hashicorp/terraform/config/module/testing.go new file mode 100644 index 0000000000..fc9e7331af --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/config/module/testing.go @@ -0,0 +1,38 @@ +package module + +import ( + "io/ioutil" + "os" + "testing" + + "github.com/hashicorp/go-getter" +) + +// TestTree loads a module at the given path and returns the tree as well +// as a function that should be deferred to clean up resources. +func TestTree(t *testing.T, path string) (*Tree, func()) { + // Create a temporary directory for module storage + dir, err := ioutil.TempDir("", "tf") + if err != nil { + t.Fatalf("err: %s", err) + return nil, nil + } + + // Load the module + mod, err := NewTreeModule("", path) + if err != nil { + t.Fatalf("err: %s", err) + return nil, nil + } + + // Get the child modules + s := &getter.FolderStorage{StorageDir: dir} + if err := mod.Load(s, GetModeGet); err != nil { + t.Fatalf("err: %s", err) + return nil, nil + } + + return mod, func() { + os.RemoveAll(dir) + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/config/module/tree.go b/installer/vendor/github.com/hashicorp/terraform/config/module/tree.go index d20f163a49..b6f90fd930 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/module/tree.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/module/tree.go @@ -259,7 +259,7 @@ func (t *Tree) Validate() error { } // If something goes wrong, here is our error template - newErr := &TreeError{Name: []string{t.Name()}} + newErr := &treeError{Name: []string{t.Name()}} // Terraform core does not handle root module children named "root". // We plan to fix this in the future but this bug was brought up in @@ -271,15 +271,14 @@ func (t *Tree) Validate() error { // Validate our configuration first. if err := t.config.Validate(); err != nil { - newErr.Err = err - return newErr + newErr.Add(err) } // If we're the root, we do extra validation. This validation usually // requires the entire tree (since children don't have parent pointers). if len(t.path) == 0 { if err := t.validateProviderAlias(); err != nil { - return err + newErr.Add(err) } } @@ -293,7 +292,7 @@ func (t *Tree) Validate() error { continue } - verr, ok := err.(*TreeError) + verr, ok := err.(*treeError) if !ok { // Unknown error, just return... return err @@ -301,7 +300,7 @@ func (t *Tree) Validate() error { // Append ourselves to the error and then return verr.Name = append(verr.Name, t.Name()) - return verr + newErr.AddChild(verr) } // Go over all the modules and verify that any parameters are valid @@ -327,10 +326,9 @@ func (t *Tree) Validate() error { // Compare to the keys in our raw config for the module for k, _ := range m.RawConfig.Raw { if _, ok := varMap[k]; !ok { - newErr.Err = fmt.Errorf( + newErr.Add(fmt.Errorf( "module %s: %s is not a valid parameter", - m.Name, k) - return newErr + m.Name, k)) } // Remove the required @@ -339,10 +337,9 @@ func (t *Tree) Validate() error { // If we have any required left over, they aren't set. for k, _ := range requiredMap { - newErr.Err = fmt.Errorf( - "module %s: required variable %s not set", - m.Name, k) - return newErr + newErr.Add(fmt.Errorf( + "module %s: required variable %q not set", + m.Name, k)) } } @@ -357,8 +354,10 @@ func (t *Tree) Validate() error { tree, ok := children[mv.Name] if !ok { - // This should never happen because Load watches us - panic("module not found in children: " + mv.Name) + newErr.Add(fmt.Errorf( + "%s: undefined module referenced %s", + source, mv.Name)) + continue } found := false @@ -369,33 +368,61 @@ func (t *Tree) Validate() error { } } if !found { - newErr.Err = fmt.Errorf( + newErr.Add(fmt.Errorf( "%s: %s is not a valid output for module %s", - source, mv.Field, mv.Name) - return newErr + source, mv.Field, mv.Name)) } } } - return nil + return newErr.ErrOrNil() +} + +// treeError is an error use by Tree.Validate to accumulates all +// validation errors. +type treeError struct { + Name []string + Errs []error + Children []*treeError } -// TreeError is an error returned by Tree.Validate if an error occurs -// with validation. -type TreeError struct { - Name []string - Err error +func (e *treeError) Add(err error) { + e.Errs = append(e.Errs, err) } -func (e *TreeError) Error() string { - // Build up the name - var buf bytes.Buffer - for _, n := range e.Name { - buf.WriteString(n) - buf.WriteString(".") +func (e *treeError) AddChild(err *treeError) { + e.Children = append(e.Children, err) +} + +func (e *treeError) ErrOrNil() error { + if len(e.Errs) > 0 || len(e.Children) > 0 { + return e + } + return nil +} + +func (e *treeError) Error() string { + name := strings.Join(e.Name, ".") + var out bytes.Buffer + fmt.Fprintf(&out, "module %s: ", name) + + if len(e.Errs) == 1 { + // single like error + out.WriteString(e.Errs[0].Error()) + } else { + // multi-line error + for _, err := range e.Errs { + fmt.Fprintf(&out, "\n %s", err) + } + } + + if len(e.Children) > 0 { + // start the next error on a new line + out.WriteString("\n ") + } + for _, child := range e.Children { + out.WriteString(child.Error()) } - buf.Truncate(buf.Len() - 1) - // Format the value - return fmt.Sprintf("module %s: %s", buf.String(), e.Err) + return out.String() } diff --git a/installer/vendor/github.com/hashicorp/terraform/config/provisioner_enums.go b/installer/vendor/github.com/hashicorp/terraform/config/provisioner_enums.go new file mode 100644 index 0000000000..00fd43fce4 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/config/provisioner_enums.go @@ -0,0 +1,40 @@ +package config + +// ProvisionerWhen is an enum for valid values for when to run provisioners. +type ProvisionerWhen int + +const ( + ProvisionerWhenInvalid ProvisionerWhen = iota + ProvisionerWhenCreate + ProvisionerWhenDestroy +) + +var provisionerWhenStrs = map[ProvisionerWhen]string{ + ProvisionerWhenInvalid: "invalid", + ProvisionerWhenCreate: "create", + ProvisionerWhenDestroy: "destroy", +} + +func (v ProvisionerWhen) String() string { + return provisionerWhenStrs[v] +} + +// ProvisionerOnFailure is an enum for valid values for on_failure options +// for provisioners. +type ProvisionerOnFailure int + +const ( + ProvisionerOnFailureInvalid ProvisionerOnFailure = iota + ProvisionerOnFailureContinue + ProvisionerOnFailureFail +) + +var provisionerOnFailureStrs = map[ProvisionerOnFailure]string{ + ProvisionerOnFailureInvalid: "invalid", + ProvisionerOnFailureContinue: "continue", + ProvisionerOnFailureFail: "fail", +} + +func (v ProvisionerOnFailure) String() string { + return provisionerOnFailureStrs[v] +} diff --git a/installer/vendor/github.com/hashicorp/terraform/config/resource_mode_string.go b/installer/vendor/github.com/hashicorp/terraform/config/resource_mode_string.go index 930645fa87..ea68b4fcdb 100644 --- a/installer/vendor/github.com/hashicorp/terraform/config/resource_mode_string.go +++ b/installer/vendor/github.com/hashicorp/terraform/config/resource_mode_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT +// Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT. package config diff --git a/installer/vendor/github.com/hashicorp/terraform/dag/dag.go b/installer/vendor/github.com/hashicorp/terraform/dag/dag.go index ed7d77e995..f8776bc511 100644 --- a/installer/vendor/github.com/hashicorp/terraform/dag/dag.go +++ b/installer/vendor/github.com/hashicorp/terraform/dag/dag.go @@ -2,11 +2,8 @@ package dag import ( "fmt" - "log" "sort" "strings" - "sync" - "time" "github.com/hashicorp/go-multierror" ) @@ -169,94 +166,9 @@ func (g *AcyclicGraph) Cycles() [][]Vertex { func (g *AcyclicGraph) Walk(cb WalkFunc) error { defer g.debug.BeginOperation(typeWalk, "").End("") - // Cache the vertices since we use it multiple times - vertices := g.Vertices() - - // Build the waitgroup that signals when we're done - var wg sync.WaitGroup - wg.Add(len(vertices)) - doneCh := make(chan struct{}) - go func() { - defer close(doneCh) - wg.Wait() - }() - - // The map of channels to watch to wait for vertices to finish - vertMap := make(map[Vertex]chan struct{}) - for _, v := range vertices { - vertMap[v] = make(chan struct{}) - } - - // The map of whether a vertex errored or not during the walk - var errLock sync.Mutex - var errs error - errMap := make(map[Vertex]bool) - for _, v := range vertices { - // Build our list of dependencies and the list of channels to - // wait on until we start executing for this vertex. - deps := AsVertexList(g.DownEdges(v)) - depChs := make([]<-chan struct{}, len(deps)) - for i, dep := range deps { - depChs[i] = vertMap[dep] - } - - // Get our channel so that we can close it when we're done - ourCh := vertMap[v] - - // Start the goroutine to wait for our dependencies - readyCh := make(chan bool) - go func(v Vertex, deps []Vertex, chs []<-chan struct{}, readyCh chan<- bool) { - // First wait for all the dependencies - for i, ch := range chs { - DepSatisfied: - for { - select { - case <-ch: - break DepSatisfied - case <-time.After(time.Second * 5): - log.Printf("[DEBUG] vertex %q, waiting for: %q", - VertexName(v), VertexName(deps[i])) - } - } - log.Printf("[DEBUG] vertex %q, got dep: %q", - VertexName(v), VertexName(deps[i])) - } - - // Then, check the map to see if any of our dependencies failed - errLock.Lock() - defer errLock.Unlock() - for _, dep := range deps { - if errMap[dep] { - errMap[v] = true - readyCh <- false - return - } - } - - readyCh <- true - }(v, deps, depChs, readyCh) - - // Start the goroutine that executes - go func(v Vertex, doneCh chan<- struct{}, readyCh <-chan bool) { - defer close(doneCh) - defer wg.Done() - - var err error - if ready := <-readyCh; ready { - err = cb(v) - } - - errLock.Lock() - defer errLock.Unlock() - if err != nil { - errMap[v] = true - errs = multierror.Append(errs, err) - } - }(v, ourCh, readyCh) - } - - <-doneCh - return errs + w := &Walker{Callback: cb, Reverse: true} + w.Update(g) + return w.Wait() } // simple convenience helper for converting a dag.Set to a []Vertex diff --git a/installer/vendor/github.com/hashicorp/terraform/dag/set.go b/installer/vendor/github.com/hashicorp/terraform/dag/set.go index d4b29226bf..3929c9d0e9 100644 --- a/installer/vendor/github.com/hashicorp/terraform/dag/set.go +++ b/installer/vendor/github.com/hashicorp/terraform/dag/set.go @@ -48,6 +48,9 @@ func (s *Set) Include(v interface{}) bool { // Intersection computes the set intersection with other. func (s *Set) Intersection(other *Set) *Set { result := new(Set) + if s == nil { + return result + } if other != nil { for _, v := range s.m { if other.Include(v) { @@ -59,6 +62,25 @@ func (s *Set) Intersection(other *Set) *Set { return result } +// Difference returns a set with the elements that s has but +// other doesn't. +func (s *Set) Difference(other *Set) *Set { + result := new(Set) + if s != nil { + for k, v := range s.m { + var ok bool + if other != nil { + _, ok = other.m[k] + } + if !ok { + result.Add(v) + } + } + } + + return result +} + // Len is the number of items in the set. func (s *Set) Len() int { if s == nil { diff --git a/installer/vendor/github.com/hashicorp/terraform/dag/walk.go b/installer/vendor/github.com/hashicorp/terraform/dag/walk.go new file mode 100644 index 0000000000..a74f1142af --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/dag/walk.go @@ -0,0 +1,445 @@ +package dag + +import ( + "errors" + "fmt" + "log" + "sync" + "time" + + "github.com/hashicorp/go-multierror" +) + +// Walker is used to walk every vertex of a graph in parallel. +// +// A vertex will only be walked when the dependencies of that vertex have +// been walked. If two vertices can be walked at the same time, they will be. +// +// Update can be called to update the graph. This can be called even during +// a walk, cahnging vertices/edges mid-walk. This should be done carefully. +// If a vertex is removed but has already been executed, the result of that +// execution (any error) is still returned by Wait. Changing or re-adding +// a vertex that has already executed has no effect. Changing edges of +// a vertex that has already executed has no effect. +// +// Non-parallelism can be enforced by introducing a lock in your callback +// function. However, the goroutine overhead of a walk will remain. +// Walker will create V*2 goroutines (one for each vertex, and dependency +// waiter for each vertex). In general this should be of no concern unless +// there are a huge number of vertices. +// +// The walk is depth first by default. This can be changed with the Reverse +// option. +// +// A single walker is only valid for one graph walk. After the walk is complete +// you must construct a new walker to walk again. State for the walk is never +// deleted in case vertices or edges are changed. +type Walker struct { + // Callback is what is called for each vertex + Callback WalkFunc + + // Reverse, if true, causes the source of an edge to depend on a target. + // When false (default), the target depends on the source. + Reverse bool + + // changeLock must be held to modify any of the fields below. Only Update + // should modify these fields. Modifying them outside of Update can cause + // serious problems. + changeLock sync.Mutex + vertices Set + edges Set + vertexMap map[Vertex]*walkerVertex + + // wait is done when all vertices have executed. It may become "undone" + // if new vertices are added. + wait sync.WaitGroup + + // errMap contains the errors recorded so far for execution. Reading + // and writing should hold errLock. + errMap map[Vertex]error + errLock sync.Mutex +} + +type walkerVertex struct { + // These should only be set once on initialization and never written again. + // They are not protected by a lock since they don't need to be since + // they are write-once. + + // DoneCh is closed when this vertex has completed execution, regardless + // of success. + // + // CancelCh is closed when the vertex should cancel execution. If execution + // is already complete (DoneCh is closed), this has no effect. Otherwise, + // execution is cancelled as quickly as possible. + DoneCh chan struct{} + CancelCh chan struct{} + + // Dependency information. Any changes to any of these fields requires + // holding DepsLock. + // + // DepsCh is sent a single value that denotes whether the upstream deps + // were successful (no errors). Any value sent means that the upstream + // dependencies are complete. No other values will ever be sent again. + // + // DepsUpdateCh is closed when there is a new DepsCh set. + DepsCh chan bool + DepsUpdateCh chan struct{} + DepsLock sync.Mutex + + // Below is not safe to read/write in parallel. This behavior is + // enforced by changes only happening in Update. Nothing else should + // ever modify these. + deps map[Vertex]chan struct{} + depsCancelCh chan struct{} +} + +// errWalkUpstream is used in the errMap of a walk to note that an upstream +// dependency failed so this vertex wasn't run. This is not shown in the final +// user-returned error. +var errWalkUpstream = errors.New("upstream dependency failed") + +// Wait waits for the completion of the walk and returns any errors ( +// in the form of a multierror) that occurred. Update should be called +// to populate the walk with vertices and edges prior to calling this. +// +// Wait will return as soon as all currently known vertices are complete. +// If you plan on calling Update with more vertices in the future, you +// should not call Wait until after this is done. +func (w *Walker) Wait() error { + // Wait for completion + w.wait.Wait() + + // Grab the error lock + w.errLock.Lock() + defer w.errLock.Unlock() + + // Build the error + var result error + for v, err := range w.errMap { + if err != nil && err != errWalkUpstream { + result = multierror.Append(result, fmt.Errorf( + "%s: %s", VertexName(v), err)) + } + } + + return result +} + +// Update updates the currently executing walk with the given graph. +// This will perform a diff of the vertices and edges and update the walker. +// Already completed vertices remain completed (including any errors during +// their execution). +// +// This returns immediately once the walker is updated; it does not wait +// for completion of the walk. +// +// Multiple Updates can be called in parallel. Update can be called at any +// time during a walk. +func (w *Walker) Update(g *AcyclicGraph) { + var v, e *Set + if g != nil { + v, e = g.vertices, g.edges + } + + // Grab the change lock so no more updates happen but also so that + // no new vertices are executed during this time since we may be + // removing them. + w.changeLock.Lock() + defer w.changeLock.Unlock() + + // Initialize fields + if w.vertexMap == nil { + w.vertexMap = make(map[Vertex]*walkerVertex) + } + + // Calculate all our sets + newEdges := e.Difference(&w.edges) + oldEdges := w.edges.Difference(e) + newVerts := v.Difference(&w.vertices) + oldVerts := w.vertices.Difference(v) + + // Add the new vertices + for _, raw := range newVerts.List() { + v := raw.(Vertex) + + // Add to the waitgroup so our walk is not done until everything finishes + w.wait.Add(1) + + // Add to our own set so we know about it already + log.Printf("[DEBUG] dag/walk: added new vertex: %q", VertexName(v)) + w.vertices.Add(raw) + + // Initialize the vertex info + info := &walkerVertex{ + DoneCh: make(chan struct{}), + CancelCh: make(chan struct{}), + deps: make(map[Vertex]chan struct{}), + } + + // Add it to the map and kick off the walk + w.vertexMap[v] = info + } + + // Remove the old vertices + for _, raw := range oldVerts.List() { + v := raw.(Vertex) + + // Get the vertex info so we can cancel it + info, ok := w.vertexMap[v] + if !ok { + // This vertex for some reason was never in our map. This + // shouldn't be possible. + continue + } + + // Cancel the vertex + close(info.CancelCh) + + // Delete it out of the map + delete(w.vertexMap, v) + + log.Printf("[DEBUG] dag/walk: removed vertex: %q", VertexName(v)) + w.vertices.Delete(raw) + } + + // Add the new edges + var changedDeps Set + for _, raw := range newEdges.List() { + edge := raw.(Edge) + waiter, dep := w.edgeParts(edge) + + // Get the info for the waiter + waiterInfo, ok := w.vertexMap[waiter] + if !ok { + // Vertex doesn't exist... shouldn't be possible but ignore. + continue + } + + // Get the info for the dep + depInfo, ok := w.vertexMap[dep] + if !ok { + // Vertex doesn't exist... shouldn't be possible but ignore. + continue + } + + // Add the dependency to our waiter + waiterInfo.deps[dep] = depInfo.DoneCh + + // Record that the deps changed for this waiter + changedDeps.Add(waiter) + + log.Printf( + "[DEBUG] dag/walk: added edge: %q waiting on %q", + VertexName(waiter), VertexName(dep)) + w.edges.Add(raw) + } + + // Process reoved edges + for _, raw := range oldEdges.List() { + edge := raw.(Edge) + waiter, dep := w.edgeParts(edge) + + // Get the info for the waiter + waiterInfo, ok := w.vertexMap[waiter] + if !ok { + // Vertex doesn't exist... shouldn't be possible but ignore. + continue + } + + // Delete the dependency from the waiter + delete(waiterInfo.deps, dep) + + // Record that the deps changed for this waiter + changedDeps.Add(waiter) + + log.Printf( + "[DEBUG] dag/walk: removed edge: %q waiting on %q", + VertexName(waiter), VertexName(dep)) + w.edges.Delete(raw) + } + + // For each vertex with changed dependencies, we need to kick off + // a new waiter and notify the vertex of the changes. + for _, raw := range changedDeps.List() { + v := raw.(Vertex) + info, ok := w.vertexMap[v] + if !ok { + // Vertex doesn't exist... shouldn't be possible but ignore. + continue + } + + // Create a new done channel + doneCh := make(chan bool, 1) + + // Create the channel we close for cancellation + cancelCh := make(chan struct{}) + + // Build a new deps copy + deps := make(map[Vertex]<-chan struct{}) + for k, v := range info.deps { + deps[k] = v + } + + // Update the update channel + info.DepsLock.Lock() + if info.DepsUpdateCh != nil { + close(info.DepsUpdateCh) + } + info.DepsCh = doneCh + info.DepsUpdateCh = make(chan struct{}) + info.DepsLock.Unlock() + + // Cancel the older waiter + if info.depsCancelCh != nil { + close(info.depsCancelCh) + } + info.depsCancelCh = cancelCh + + log.Printf( + "[DEBUG] dag/walk: dependencies changed for %q, sending new deps", + VertexName(v)) + + // Start the waiter + go w.waitDeps(v, deps, doneCh, cancelCh) + } + + // Start all the new vertices. We do this at the end so that all + // the edge waiters and changes are setup above. + for _, raw := range newVerts.List() { + v := raw.(Vertex) + go w.walkVertex(v, w.vertexMap[v]) + } +} + +// edgeParts returns the waiter and the dependency, in that order. +// The waiter is waiting on the dependency. +func (w *Walker) edgeParts(e Edge) (Vertex, Vertex) { + if w.Reverse { + return e.Source(), e.Target() + } + + return e.Target(), e.Source() +} + +// walkVertex walks a single vertex, waiting for any dependencies before +// executing the callback. +func (w *Walker) walkVertex(v Vertex, info *walkerVertex) { + // When we're done executing, lower the waitgroup count + defer w.wait.Done() + + // When we're done, always close our done channel + defer close(info.DoneCh) + + // Wait for our dependencies. We create a [closed] deps channel so + // that we can immediately fall through to load our actual DepsCh. + var depsSuccess bool + var depsUpdateCh chan struct{} + depsCh := make(chan bool, 1) + depsCh <- true + close(depsCh) + for { + select { + case <-info.CancelCh: + // Cancel + return + + case depsSuccess = <-depsCh: + // Deps complete! Mark as nil to trigger completion handling. + depsCh = nil + + case <-depsUpdateCh: + // New deps, reloop + } + + // Check if we have updated dependencies. This can happen if the + // dependencies were satisfied exactly prior to an Update occuring. + // In that case, we'd like to take into account new dependencies + // if possible. + info.DepsLock.Lock() + if info.DepsCh != nil { + depsCh = info.DepsCh + info.DepsCh = nil + } + if info.DepsUpdateCh != nil { + depsUpdateCh = info.DepsUpdateCh + } + info.DepsLock.Unlock() + + // If we still have no deps channel set, then we're done! + if depsCh == nil { + break + } + } + + // If we passed dependencies, we just want to check once more that + // we're not cancelled, since this can happen just as dependencies pass. + select { + case <-info.CancelCh: + // Cancelled during an update while dependencies completed. + return + default: + } + + // Run our callback or note that our upstream failed + var err error + if depsSuccess { + log.Printf("[DEBUG] dag/walk: walking %q", VertexName(v)) + err = w.Callback(v) + } else { + log.Printf("[DEBUG] dag/walk: upstream errored, not walking %q", VertexName(v)) + err = errWalkUpstream + } + + // Record the error + if err != nil { + w.errLock.Lock() + defer w.errLock.Unlock() + + if w.errMap == nil { + w.errMap = make(map[Vertex]error) + } + w.errMap[v] = err + } +} + +func (w *Walker) waitDeps( + v Vertex, + deps map[Vertex]<-chan struct{}, + doneCh chan<- bool, + cancelCh <-chan struct{}) { + // For each dependency given to us, wait for it to complete + for dep, depCh := range deps { + DepSatisfied: + for { + select { + case <-depCh: + // Dependency satisfied! + break DepSatisfied + + case <-cancelCh: + // Wait cancelled. Note that we didn't satisfy dependencies + // so that anything waiting on us also doesn't run. + doneCh <- false + return + + case <-time.After(time.Second * 5): + log.Printf("[DEBUG] dag/walk: vertex %q, waiting for: %q", + VertexName(v), VertexName(dep)) + } + } + } + + // Dependencies satisfied! We need to check if any errored + w.errLock.Lock() + defer w.errLock.Unlock() + for dep, _ := range deps { + if w.errMap[dep] != nil { + // One of our dependencies failed, so return false + doneCh <- false + return + } + } + + // All dependencies satisfied and successful + doneCh <- true +} diff --git a/installer/vendor/github.com/hashicorp/terraform/flatmap/expand.go b/installer/vendor/github.com/hashicorp/terraform/flatmap/expand.go index 331357ff34..2bfb3fe3d2 100644 --- a/installer/vendor/github.com/hashicorp/terraform/flatmap/expand.go +++ b/installer/vendor/github.com/hashicorp/terraform/flatmap/expand.go @@ -5,6 +5,8 @@ import ( "sort" "strconv" "strings" + + "github.com/hashicorp/hil" ) // Expand takes a map and a key (prefix) and expands that value into @@ -22,13 +24,20 @@ func Expand(m map[string]string, key string) interface{} { } // Check if the key is an array, and if so, expand the array - if _, ok := m[key+".#"]; ok { + if v, ok := m[key+".#"]; ok { + // If the count of the key is unknown, then just put the unknown + // value in the value itself. This will be detected by Terraform + // core later. + if v == hil.UnknownValue { + return v + } + return expandArray(m, key) } // Check if this is a prefix in the map prefix := key + "." - for k, _ := range m { + for k := range m { if strings.HasPrefix(k, prefix) { return expandMap(m, prefix) } @@ -43,11 +52,20 @@ func expandArray(m map[string]string, prefix string) []interface{} { panic(err) } - // The Schema "Set" type stores its values in an array format, but using - // numeric hash values instead of ordinal keys. Take the set of keys - // regardless of value, and expand them in numeric order. + // If the number of elements in this array is 0, then return an + // empty slice as there is nothing to expand. Trying to expand it + // anyway could lead to crashes as any child maps, arrays or sets + // that no longer exist are still shown as empty with a count of 0. + if num == 0 { + return []interface{}{} + } + + // The Schema "Set" type stores its values in an array format, but + // using numeric hash values instead of ordinal keys. Take the set + // of keys regardless of value, and expand them in numeric order. // See GH-11042 for more details. keySet := map[int]bool{} + computed := map[string]bool{} for k := range m { if !strings.HasPrefix(k, prefix+".") { continue @@ -64,6 +82,12 @@ func expandArray(m map[string]string, prefix string) []interface{} { continue } + // strip the computed flag if there is one + if strings.HasPrefix(key, "~") { + key = key[1:] + computed[key] = true + } + k, err := strconv.Atoi(key) if err != nil { panic(err) @@ -79,15 +103,25 @@ func expandArray(m map[string]string, prefix string) []interface{} { result := make([]interface{}, num) for i, key := range keysList { - result[i] = Expand(m, fmt.Sprintf("%s.%d", prefix, key)) + keyString := strconv.Itoa(key) + if computed[keyString] { + keyString = "~" + keyString + } + result[i] = Expand(m, fmt.Sprintf("%s.%s", prefix, keyString)) } return result } func expandMap(m map[string]string, prefix string) map[string]interface{} { + // Submaps may not have a '%' key, so we can't count on this value being + // here. If we don't have a count, just procede as if we have have a map. + if count, ok := m[prefix+"%"]; ok && count == "0" { + return map[string]interface{}{} + } + result := make(map[string]interface{}) - for k, _ := range m { + for k := range m { if !strings.HasPrefix(k, prefix) { continue } @@ -105,6 +139,7 @@ func expandMap(m map[string]string, prefix string) map[string]interface{} { if key == "%" { continue } + result[key] = Expand(m, k[:len(prefix)+len(key)]) } diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/acctest/random.go b/installer/vendor/github.com/hashicorp/terraform/helper/acctest/random.go index fbc4428d79..3ddc078d39 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/acctest/random.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/acctest/random.go @@ -1,8 +1,18 @@ package acctest import ( + "bufio" + "bytes" + crand "crypto/rand" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "fmt" "math/rand" + "strings" "time" + + "golang.org/x/crypto/ssh" ) // Helpers for generating random tidbits for use in identifiers to prevent @@ -14,6 +24,21 @@ func RandInt() int { return rand.New(rand.NewSource(time.Now().UnixNano())).Int() } +// RandomWithPrefix is used to generate a unique name with a prefix, for +// randomizing names in acceptance tests +func RandomWithPrefix(name string) string { + reseed() + return fmt.Sprintf("%s-%d", name, rand.New(rand.NewSource(time.Now().UnixNano())).Int()) +} + +func RandIntRange(min int, max int) int { + reseed() + source := rand.New(rand.NewSource(time.Now().UnixNano())) + rangeMax := max - min + + return int(source.Int31n(int32(rangeMax))) +} + // RandString generates a random alphanumeric string of the length specified func RandString(strlen int) string { return RandStringFromCharSet(strlen, CharSetAlphaNum) @@ -30,6 +55,28 @@ func RandStringFromCharSet(strlen int, charSet string) string { return string(result) } +// RandSSHKeyPair generates a public and private SSH key pair. The public key is +// returned in OpenSSH format, and the private key is PEM encoded. +func RandSSHKeyPair(comment string) (string, string, error) { + privateKey, err := rsa.GenerateKey(crand.Reader, 1024) + if err != nil { + return "", "", err + } + + var privateKeyBuffer bytes.Buffer + privateKeyPEM := &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)} + if err := pem.Encode(bufio.NewWriter(&privateKeyBuffer), privateKeyPEM); err != nil { + return "", "", err + } + + publicKey, err := ssh.NewPublicKey(&privateKey.PublicKey) + if err != nil { + return "", "", err + } + keyMaterial := strings.TrimSpace(string(ssh.MarshalAuthorizedKey(publicKey))) + return fmt.Sprintf("%s %s", keyMaterial, comment), privateKeyBuffer.String(), nil +} + // Seeds random with current timestamp func reseed() { rand.Seed(time.Now().UTC().UnixNano()) diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/experiment/experiment.go b/installer/vendor/github.com/hashicorp/terraform/helper/experiment/experiment.go index 08b0d34544..18b8837cc5 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/experiment/experiment.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/experiment/experiment.go @@ -50,9 +50,6 @@ import ( // of definition and use. This allows the compiler to enforce references // so it becomes easy to remove the features. var ( - // Reuse the old graphs from TF 0.7.x. These will be removed at some point. - X_legacyGraph = newBasicID("legacy-graph", "LEGACY_GRAPH", false) - // Shadow graph. This is already on by default. Disabling it will be // allowed for awhile in order for it to not block operations. X_shadow = newBasicID("shadow", "SHADOW", false) @@ -75,7 +72,6 @@ var ( func init() { // The list of all experiments, update this when an experiment is added. All = []ID{ - X_legacyGraph, X_shadow, x_force, } diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/resource/state.go b/installer/vendor/github.com/hashicorp/terraform/helper/resource/state.go index aafa7f3bc6..37c586a11a 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/resource/state.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/resource/state.go @@ -2,10 +2,11 @@ package resource import ( "log" - "sync/atomic" "time" ) +var refreshGracePeriod = 30 * time.Second + // StateRefreshFunc is a function type used for StateChangeConf that is // responsible for refreshing the item being watched for a state change. // @@ -62,58 +63,76 @@ func (conf *StateChangeConf) WaitForState() (interface{}, error) { conf.ContinuousTargetOccurence = 1 } - // We can't safely read the result values if we timeout, so store them in - // an atomic.Value type Result struct { Result interface{} State string Error error + Done bool } - var lastResult atomic.Value - lastResult.Store(Result{}) - doneCh := make(chan struct{}) + // Read every result from the refresh loop, waiting for a positive result.Done. + resCh := make(chan Result, 1) + // cancellation channel for the refresh loop + cancelCh := make(chan struct{}) + + result := Result{} + go func() { - defer close(doneCh) + defer close(resCh) - // Wait for the delay time.Sleep(conf.Delay) - wait := 100 * time.Millisecond + // start with 0 delay for the first loop + var wait time.Duration for { + // store the last result + resCh <- result + + // wait and watch for cancellation + select { + case <-cancelCh: + return + case <-time.After(wait): + // first round had no wait + if wait == 0 { + wait = 100 * time.Millisecond + } + } + res, currentState, err := conf.Refresh() - result := Result{ + result = Result{ Result: res, State: currentState, Error: err, } - lastResult.Store(result) if err != nil { + resCh <- result return } // If we're waiting for the absence of a thing, then return if res == nil && len(conf.Target) == 0 { - targetOccurence += 1 + targetOccurence++ if conf.ContinuousTargetOccurence == targetOccurence { + result.Done = true + resCh <- result return - } else { - continue } + continue } if res == nil { // If we didn't find the resource, check if we have been // not finding it for awhile, and if so, report an error. - notfoundTick += 1 + notfoundTick++ if notfoundTick > conf.NotFoundChecks { result.Error = &NotFoundError{ LastError: err, Retries: notfoundTick, } - lastResult.Store(result) + resCh <- result return } } else { @@ -124,12 +143,13 @@ func (conf *StateChangeConf) WaitForState() (interface{}, error) { for _, allowed := range conf.Target { if currentState == allowed { found = true - targetOccurence += 1 + targetOccurence++ if conf.ContinuousTargetOccurence == targetOccurence { + result.Done = true + resCh <- result return - } else { - continue } + continue } } @@ -141,17 +161,23 @@ func (conf *StateChangeConf) WaitForState() (interface{}, error) { } } - if !found { + if !found && len(conf.Pending) > 0 { result.Error = &UnexpectedStateError{ LastError: err, State: result.State, ExpectedState: conf.Target, } - lastResult.Store(result) + resCh <- result return } } + // Wait between refreshes using exponential backoff, except when + // waiting for the target state to reoccur. + if targetOccurence == 0 { + wait *= 2 + } + // If a poll interval has been specified, choose that interval. // Otherwise bound the default value. if conf.PollInterval > 0 && conf.PollInterval < 180*time.Second { @@ -165,27 +191,69 @@ func (conf *StateChangeConf) WaitForState() (interface{}, error) { } log.Printf("[TRACE] Waiting %s before next try", wait) - time.Sleep(wait) - - // Wait between refreshes using exponential backoff, except when - // waiting for the target state to reoccur. - if targetOccurence == 0 { - wait *= 2 - } } }() - select { - case <-doneCh: - r := lastResult.Load().(Result) - return r.Result, r.Error - case <-time.After(conf.Timeout): - r := lastResult.Load().(Result) - return nil, &TimeoutError{ - LastError: r.Error, - LastState: r.State, - Timeout: conf.Timeout, - ExpectedState: conf.Target, + // store the last value result from the refresh loop + lastResult := Result{} + + timeout := time.After(conf.Timeout) + for { + select { + case r, ok := <-resCh: + // channel closed, so return the last result + if !ok { + return lastResult.Result, lastResult.Error + } + + // we reached the intended state + if r.Done { + return r.Result, r.Error + } + + // still waiting, store the last result + lastResult = r + + case <-timeout: + log.Printf("[WARN] WaitForState timeout after %s", conf.Timeout) + log.Printf("[WARN] WaitForState starting %s refresh grace period", refreshGracePeriod) + + // cancel the goroutine and start our grace period timer + close(cancelCh) + timeout := time.After(refreshGracePeriod) + + // we need a for loop and a label to break on, because we may have + // an extra response value to read, but still want to wait for the + // channel to close. + forSelect: + for { + select { + case r, ok := <-resCh: + if r.Done { + // the last refresh loop reached the desired state + return r.Result, r.Error + } + + if !ok { + // the goroutine returned + break forSelect + } + + // target state not reached, save the result for the + // TimeoutError and wait for the channel to close + lastResult = r + case <-timeout: + log.Println("[ERROR] WaitForState exceeded refresh grace period") + break forSelect + } + } + + return nil, &TimeoutError{ + LastError: lastResult.Error, + LastState: lastResult.State, + Timeout: conf.Timeout, + ExpectedState: conf.Target, + } } } } diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing.go b/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing.go index 6d2deb9e53..04367c53ca 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing.go @@ -22,6 +22,13 @@ import ( const TestEnvVar = "TF_ACC" +// TestProvider can be implemented by any ResourceProvider to provide custom +// reset functionality at the start of an acceptance test. +// The helper/schema Provider implements this interface. +type TestProvider interface { + TestReset() error +} + // TestCheckFunc is the callback type used with acceptance tests to check // the state of a resource. The state passed in is the latest state known, // or in the case of being after a destroy, it is the last known state when @@ -144,6 +151,11 @@ type TestStep struct { // test to pass. ExpectError *regexp.Regexp + // PlanOnly can be set to only run `plan` with this configuration, and not + // actually apply it. This is useful for ensuring config changes result in + // no-op plans + PlanOnly bool + // PreventPostDestroyRefresh can be set to true for cases where data sources // are tested alongside real resources PreventPostDestroyRefresh bool @@ -162,6 +174,13 @@ type TestStep struct { // determined by inspecting the state for ResourceName's ID. ImportStateId string + // ImportStateIdPrefix is the prefix added in front of ImportStateId. + // This can be useful in complex import cases, where more than one + // attribute needs to be passed on as the Import ID. Mainly in cases + // where the ID is not known, and a known prefix needs to be added to + // the unset ImportStateId field. + ImportStateIdPrefix string + // ImportStateCheck checks the results of ImportState. It should be // used to verify that the resulting value of ImportState has the // proper resources, IDs, and attributes. @@ -216,13 +235,9 @@ func Test(t TestT, c TestCase) { c.PreCheck() } - // Build our context options that we can - ctxProviders := c.ProviderFactories - if ctxProviders == nil { - ctxProviders = make(map[string]terraform.ResourceProviderFactory) - for k, p := range c.Providers { - ctxProviders[k] = terraform.ResourceProviderFactoryFixed(p) - } + ctxProviders, err := testProviderFactories(c) + if err != nil { + t.Fatal(err) } opts := terraform.ContextOpts{Providers: ctxProviders} @@ -333,6 +348,40 @@ func Test(t TestT, c TestCase) { } } +// testProviderFactories is a helper to build the ResourceProviderFactory map +// with pre instantiated ResourceProviders, so that we can reset them for the +// test, while only calling the factory function once. +// Any errors are stored so that they can be returned by the factory in +// terraform to match non-test behavior. +func testProviderFactories(c TestCase) (map[string]terraform.ResourceProviderFactory, error) { + ctxProviders := c.ProviderFactories // make(map[string]terraform.ResourceProviderFactory) + if ctxProviders == nil { + ctxProviders = make(map[string]terraform.ResourceProviderFactory) + } + // add any fixed providers + for k, p := range c.Providers { + ctxProviders[k] = terraform.ResourceProviderFactoryFixed(p) + } + + // reset the providers if needed + for k, pf := range ctxProviders { + // we can ignore any errors here, if we don't have a provider to reset + // the error will be handled later + p, err := pf() + if err != nil { + return nil, err + } + if p, ok := p.(TestProvider); ok { + err := p.TestReset() + if err != nil { + return nil, fmt.Errorf("[ERROR] failed to reset provider %q: %s", k, err) + } + } + } + + return ctxProviders, nil +} + // UnitTest is a helper to force the acceptance testing harness to run in the // normal unit test suite. This should only be used for resource that don't // have any external dependencies. diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_config.go b/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_config.go index b49fdc7940..537a11c34a 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_config.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_config.go @@ -53,34 +53,38 @@ func testStep( "Error refreshing: %s", err) } - // Plan! - if p, err := ctx.Plan(); err != nil { - return state, fmt.Errorf( - "Error planning: %s", err) - } else { - log.Printf("[WARN] Test: Step plan: %s", p) - } + // If this step is a PlanOnly step, skip over this first Plan and subsequent + // Apply, and use the follow up Plan that checks for perpetual diffs + if !step.PlanOnly { + // Plan! + if p, err := ctx.Plan(); err != nil { + return state, fmt.Errorf( + "Error planning: %s", err) + } else { + log.Printf("[WARN] Test: Step plan: %s", p) + } - // We need to keep a copy of the state prior to destroying - // such that destroy steps can verify their behaviour in the check - // function - stateBeforeApplication := state.DeepCopy() + // We need to keep a copy of the state prior to destroying + // such that destroy steps can verify their behaviour in the check + // function + stateBeforeApplication := state.DeepCopy() - // Apply! - state, err = ctx.Apply() - if err != nil { - return state, fmt.Errorf("Error applying: %s", err) - } + // Apply! + state, err = ctx.Apply() + if err != nil { + return state, fmt.Errorf("Error applying: %s", err) + } - // Check! Excitement! - if step.Check != nil { - if step.Destroy { - if err := step.Check(stateBeforeApplication); err != nil { - return state, fmt.Errorf("Check failed: %s", err) - } - } else { - if err := step.Check(state); err != nil { - return state, fmt.Errorf("Check failed: %s", err) + // Check! Excitement! + if step.Check != nil { + if step.Destroy { + if err := step.Check(stateBeforeApplication); err != nil { + return state, fmt.Errorf("Check failed: %s", err) + } + } else { + if err := step.Check(state); err != nil { + return state, fmt.Errorf("Check failed: %s", err) + } } } } diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go b/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go index d5c579629b..28ad105267 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go @@ -25,6 +25,10 @@ func testStepImportState( importId = resource.Primary.ID } + importPrefix := step.ImportStateIdPrefix + if importPrefix != "" { + importId = fmt.Sprintf("%s%s", importPrefix, importId) + } // Setup the context. We initialize with an empty state. We use the // full config for provider configurations. diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/backend.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/backend.go new file mode 100644 index 0000000000..a0729c02c4 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/backend.go @@ -0,0 +1,94 @@ +package schema + +import ( + "context" + + "github.com/hashicorp/terraform/terraform" +) + +// Backend represents a partial backend.Backend implementation and simplifies +// the creation of configuration loading and validation. +// +// Unlike other schema structs such as Provider, this struct is meant to be +// embedded within your actual implementation. It provides implementations +// only for Input and Configure and gives you a method for accessing the +// configuration in the form of a ResourceData that you're expected to call +// from the other implementation funcs. +type Backend struct { + // Schema is the schema for the configuration of this backend. If this + // Backend has no configuration this can be omitted. + Schema map[string]*Schema + + // ConfigureFunc is called to configure the backend. Use the + // FromContext* methods to extract information from the context. + // This can be nil, in which case nothing will be called but the + // config will still be stored. + ConfigureFunc func(context.Context) error + + config *ResourceData +} + +var ( + backendConfigKey = contextKey("backend config") +) + +// FromContextBackendConfig extracts a ResourceData with the configuration +// from the context. This should only be called by Backend functions. +func FromContextBackendConfig(ctx context.Context) *ResourceData { + return ctx.Value(backendConfigKey).(*ResourceData) +} + +func (b *Backend) Input( + input terraform.UIInput, + c *terraform.ResourceConfig) (*terraform.ResourceConfig, error) { + if b == nil { + return c, nil + } + + return schemaMap(b.Schema).Input(input, c) +} + +func (b *Backend) Validate(c *terraform.ResourceConfig) ([]string, []error) { + if b == nil { + return nil, nil + } + + return schemaMap(b.Schema).Validate(c) +} + +func (b *Backend) Configure(c *terraform.ResourceConfig) error { + if b == nil { + return nil + } + + sm := schemaMap(b.Schema) + + // Get a ResourceData for this configuration. To do this, we actually + // generate an intermediary "diff" although that is never exposed. + diff, err := sm.Diff(nil, c) + if err != nil { + return err + } + + data, err := sm.Data(nil, diff) + if err != nil { + return err + } + b.config = data + + if b.ConfigureFunc != nil { + err = b.ConfigureFunc(context.WithValue( + context.Background(), backendConfigKey, data)) + if err != nil { + return err + } + } + + return nil +} + +// Config returns the configuration. This is available after Configure is +// called. +func (b *Backend) Config() *ResourceData { + return b.config +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go index 53ff5208f9..f958bbcb12 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go @@ -79,10 +79,35 @@ func (r *ConfigFieldReader) readField( k := strings.Join(address, ".") schema := schemaList[len(schemaList)-1] + + // If we're getting the single element of a promoted list, then + // check to see if we have a single element we need to promote. + if address[len(address)-1] == "0" && len(schemaList) > 1 { + lastSchema := schemaList[len(schemaList)-2] + if lastSchema.Type == TypeList && lastSchema.PromoteSingle { + k := strings.Join(address[:len(address)-1], ".") + result, err := r.readPrimitive(k, schema) + if err == nil { + return result, nil + } + } + } + switch schema.Type { case TypeBool, TypeFloat, TypeInt, TypeString: return r.readPrimitive(k, schema) case TypeList: + // If we support promotion then we first check if we have a lone + // value that we must promote. + // a value that is alone. + if schema.PromoteSingle { + result, err := r.readPrimitive(k, schema.Elem.(*Schema)) + if err == nil && result.Exists { + result.Value = []interface{}{result.Value} + return result, nil + } + } + return readListField(&nestedConfigFieldReader{r}, address, schema) case TypeMap: return r.readMap(k, schema) diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/getsource_string.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/getsource_string.go index 790dbff919..3a97629394 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/schema/getsource_string.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/getsource_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=getSource resource_data_get_source.go"; DO NOT EDIT +// Code generated by "stringer -type=getSource resource_data_get_source.go"; DO NOT EDIT. package schema diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/provider.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/provider.go index 5b50d54a1f..d52d2f5f06 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/schema/provider.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/provider.go @@ -50,8 +50,15 @@ type Provider struct { // See the ConfigureFunc documentation for more information. ConfigureFunc ConfigureFunc + // MetaReset is called by TestReset to reset any state stored in the meta + // interface. This is especially important if the StopContext is stored by + // the provider. + MetaReset func() error + meta interface{} + // a mutex is required because TestReset can directly repalce the stopCtx + stopMu sync.Mutex stopCtx context.Context stopCtxCancel context.CancelFunc stopOnce sync.Once @@ -124,20 +131,43 @@ func (p *Provider) Stopped() bool { // StopCh returns a channel that is closed once the provider is stopped. func (p *Provider) StopContext() context.Context { p.stopOnce.Do(p.stopInit) + + p.stopMu.Lock() + defer p.stopMu.Unlock() + return p.stopCtx } func (p *Provider) stopInit() { + p.stopMu.Lock() + defer p.stopMu.Unlock() + p.stopCtx, p.stopCtxCancel = context.WithCancel(context.Background()) } // Stop implementation of terraform.ResourceProvider interface. func (p *Provider) Stop() error { p.stopOnce.Do(p.stopInit) + + p.stopMu.Lock() + defer p.stopMu.Unlock() + p.stopCtxCancel() return nil } +// TestReset resets any state stored in the Provider, and will call TestReset +// on Meta if it implements the TestProvider interface. +// This may be used to reset the schema.Provider at the start of a test, and is +// automatically called by resource.Test. +func (p *Provider) TestReset() error { + p.stopInit() + if p.MetaReset != nil { + return p.MetaReset() + } + return nil +} + // Input implementation of terraform.ResourceProvider interface. func (p *Provider) Input( input terraform.UIInput, diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go new file mode 100644 index 0000000000..c1564a2156 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go @@ -0,0 +1,180 @@ +package schema + +import ( + "context" + "errors" + "fmt" + "sync" + + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/terraform/config" + "github.com/hashicorp/terraform/terraform" +) + +// Provisioner represents a resource provisioner in Terraform and properly +// implements all of the ResourceProvisioner API. +// +// This higher level structure makes it much easier to implement a new or +// custom provisioner for Terraform. +// +// The function callbacks for this structure are all passed a context object. +// This context object has a number of pre-defined values that can be accessed +// via the global functions defined in context.go. +type Provisioner struct { + // ConnSchema is the schema for the connection settings for this + // provisioner. + // + // The keys of this map are the configuration keys, and the value is + // the schema describing the value of the configuration. + // + // NOTE: The value of connection keys can only be strings for now. + ConnSchema map[string]*Schema + + // Schema is the schema for the usage of this provisioner. + // + // The keys of this map are the configuration keys, and the value is + // the schema describing the value of the configuration. + Schema map[string]*Schema + + // ApplyFunc is the function for executing the provisioner. This is required. + // It is given a context. See the Provisioner struct docs for more + // information. + ApplyFunc func(ctx context.Context) error + + stopCtx context.Context + stopCtxCancel context.CancelFunc + stopOnce sync.Once +} + +// Keys that can be used to access data in the context parameters for +// Provisioners. +var ( + connDataInvalid = contextKey("data invalid") + + // This returns a *ResourceData for the connection information. + // Guaranteed to never be nil. + ProvConnDataKey = contextKey("provider conn data") + + // This returns a *ResourceData for the config information. + // Guaranteed to never be nil. + ProvConfigDataKey = contextKey("provider config data") + + // This returns a terraform.UIOutput. Guaranteed to never be nil. + ProvOutputKey = contextKey("provider output") + + // This returns the raw InstanceState passed to Apply. Guaranteed to + // be set, but may be nil. + ProvRawStateKey = contextKey("provider raw state") +) + +// InternalValidate should be called to validate the structure +// of the provisioner. +// +// This should be called in a unit test to verify before release that this +// structure is properly configured for use. +func (p *Provisioner) InternalValidate() error { + if p == nil { + return errors.New("provisioner is nil") + } + + var validationErrors error + { + sm := schemaMap(p.ConnSchema) + if err := sm.InternalValidate(sm); err != nil { + validationErrors = multierror.Append(validationErrors, err) + } + } + + { + sm := schemaMap(p.Schema) + if err := sm.InternalValidate(sm); err != nil { + validationErrors = multierror.Append(validationErrors, err) + } + } + + if p.ApplyFunc == nil { + validationErrors = multierror.Append(validationErrors, fmt.Errorf( + "ApplyFunc must not be nil")) + } + + return validationErrors +} + +// StopContext returns a context that checks whether a provisioner is stopped. +func (p *Provisioner) StopContext() context.Context { + p.stopOnce.Do(p.stopInit) + return p.stopCtx +} + +func (p *Provisioner) stopInit() { + p.stopCtx, p.stopCtxCancel = context.WithCancel(context.Background()) +} + +// Stop implementation of terraform.ResourceProvisioner interface. +func (p *Provisioner) Stop() error { + p.stopOnce.Do(p.stopInit) + p.stopCtxCancel() + return nil +} + +func (p *Provisioner) Validate(c *terraform.ResourceConfig) ([]string, []error) { + return schemaMap(p.Schema).Validate(c) +} + +// Apply implementation of terraform.ResourceProvisioner interface. +func (p *Provisioner) Apply( + o terraform.UIOutput, + s *terraform.InstanceState, + c *terraform.ResourceConfig) error { + var connData, configData *ResourceData + + { + // We first need to turn the connection information into a + // terraform.ResourceConfig so that we can use that type to more + // easily build a ResourceData structure. We do this by simply treating + // the conn info as configuration input. + raw := make(map[string]interface{}) + if s != nil { + for k, v := range s.Ephemeral.ConnInfo { + raw[k] = v + } + } + + c, err := config.NewRawConfig(raw) + if err != nil { + return err + } + + sm := schemaMap(p.ConnSchema) + diff, err := sm.Diff(nil, terraform.NewResourceConfig(c)) + if err != nil { + return err + } + connData, err = sm.Data(nil, diff) + if err != nil { + return err + } + } + + { + // Build the configuration data. Doing this requires making a "diff" + // even though that's never used. We use that just to get the correct types. + configMap := schemaMap(p.Schema) + diff, err := configMap.Diff(nil, c) + if err != nil { + return err + } + configData, err = configMap.Data(nil, diff) + if err != nil { + return err + } + } + + // Build the context and call the function + ctx := p.StopContext() + ctx = context.WithValue(ctx, ProvConnDataKey, connData) + ctx = context.WithValue(ctx, ProvConfigDataKey, configData) + ctx = context.WithValue(ctx, ProvOutputKey, o) + ctx = context.WithValue(ctx, ProvRawStateKey, s) + return p.ApplyFunc(ctx) +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource.go index 9087c69322..c8105588c8 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource.go @@ -3,6 +3,7 @@ package schema import ( "errors" "fmt" + "log" "strconv" "github.com/hashicorp/terraform/terraform" @@ -94,6 +95,15 @@ type Resource struct { // This is a private interface for now, for use by DataSourceResourceShim, // and not for general use. (But maybe later...) deprecationMessage string + + // Timeouts allow users to specify specific time durations in which an + // operation should time out, to allow them to extend an action to suit their + // usage. For example, a user may specify a large Creation timeout for their + // AWS RDS Instance due to it's size, or restoring from a snapshot. + // Resource implementors must enable Timeout support by adding the allowed + // actions (Create, Read, Update, Delete, Default) to the Resource struct, and + // accessing them in the matching methods. + Timeouts *ResourceTimeout } // See Resource documentation. @@ -125,6 +135,18 @@ func (r *Resource) Apply( return s, err } + // Instance Diff shoould have the timeout info, need to copy it over to the + // ResourceData meta + rt := ResourceTimeout{} + if _, ok := d.Meta[TimeoutKey]; ok { + if err := rt.DiffDecode(d); err != nil { + log.Printf("[ERR] Error decoding ResourceTimeout: %s", err) + } + } else { + log.Printf("[DEBUG] No meta timeoutkey found in Apply()") + } + data.timeouts = &rt + if s == nil { // The Terraform API dictates that this should never happen, but // it doesn't hurt to be safe in this case. @@ -150,6 +172,8 @@ func (r *Resource) Apply( // Reset the data to be stateless since we just destroyed data, err = schemaMap(r.Schema).Data(nil, d) + // data was reset, need to re-apply the parsed timeouts + data.timeouts = &rt if err != nil { return nil, err } @@ -176,7 +200,28 @@ func (r *Resource) Apply( func (r *Resource) Diff( s *terraform.InstanceState, c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { - return schemaMap(r.Schema).Diff(s, c) + + t := &ResourceTimeout{} + err := t.ConfigDecode(r, c) + + if err != nil { + return nil, fmt.Errorf("[ERR] Error decoding timeout: %s", err) + } + + instanceDiff, err := schemaMap(r.Schema).Diff(s, c) + if err != nil { + return instanceDiff, err + } + + if instanceDiff != nil { + if err := t.DiffEncode(instanceDiff); err != nil { + log.Printf("[ERR] Error encoding timeout to instance diff: %s", err) + } + } else { + log.Printf("[DEBUG] Instance Diff is nil in Diff()") + } + + return instanceDiff, err } // Validate validates the resource configuration against the schema. @@ -226,10 +271,19 @@ func (r *Resource) Refresh( return nil, nil } + rt := ResourceTimeout{} + if _, ok := s.Meta[TimeoutKey]; ok { + if err := rt.StateDecode(s); err != nil { + log.Printf("[ERR] Error decoding ResourceTimeout: %s", err) + } + } + if r.Exists != nil { // Make a copy of data so that if it is modified it doesn't // affect our Read later. data, err := schemaMap(r.Schema).Data(s, nil) + data.timeouts = &rt + if err != nil { return s, err } @@ -252,6 +306,7 @@ func (r *Resource) Refresh( } data, err := schemaMap(r.Schema).Data(s, nil) + data.timeouts = &rt if err != nil { return s, err } @@ -353,7 +408,7 @@ func (r *Resource) Data(s *terraform.InstanceState) *ResourceData { } // Set the schema version to latest by default - result.meta = map[string]string{ + result.meta = map[string]interface{}{ "schema_version": strconv.Itoa(r.SchemaVersion), } @@ -378,7 +433,22 @@ func (r *Resource) isTopLevel() bool { // Determines if a given InstanceState needs to be migrated by checking the // stored version number with the current SchemaVersion func (r *Resource) checkSchemaVersion(is *terraform.InstanceState) (bool, int) { - stateSchemaVersion, _ := strconv.Atoi(is.Meta["schema_version"]) + // Get the raw interface{} value for the schema version. If it doesn't + // exist or is nil then set it to zero. + raw := is.Meta["schema_version"] + if raw == nil { + raw = "0" + } + + // Try to convert it to a string. If it isn't a string then we pretend + // that it isn't set at all. It should never not be a string unless it + // was manually tampered with. + rawString, ok := raw.(string) + if !ok { + rawString = "0" + } + + stateSchemaVersion, _ := strconv.Atoi(rawString) return stateSchemaVersion < r.SchemaVersion, stateSchemaVersion } @@ -386,7 +456,7 @@ func (r *Resource) recordCurrentSchemaVersion( state *terraform.InstanceState) *terraform.InstanceState { if state != nil && r.SchemaVersion > 0 { if state.Meta == nil { - state.Meta = make(map[string]string) + state.Meta = make(map[string]interface{}) } state.Meta["schema_version"] = strconv.Itoa(r.SchemaVersion) } diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go index b040b63ee5..b2bc8f6c7c 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go @@ -5,6 +5,7 @@ import ( "reflect" "strings" "sync" + "time" "github.com/hashicorp/terraform/terraform" ) @@ -19,11 +20,12 @@ import ( // The most relevant methods to take a look at are Get, Set, and Partial. type ResourceData struct { // Settable (internally) - schema map[string]*Schema - config *terraform.ResourceConfig - state *terraform.InstanceState - diff *terraform.InstanceDiff - meta map[string]string + schema map[string]*Schema + config *terraform.ResourceConfig + state *terraform.InstanceState + diff *terraform.InstanceDiff + meta map[string]interface{} + timeouts *ResourceTimeout // Don't set multiReader *MultiLevelFieldReader @@ -250,6 +252,12 @@ func (d *ResourceData) State() *terraform.InstanceState { return nil } + if d.timeouts != nil { + if err := d.timeouts.StateEncode(&result); err != nil { + log.Printf("[ERR] Error encoding Timeout meta to Instance State: %s", err) + } + } + // Look for a magic key in the schema that determines we skip the // integrity check of fields existing in the schema, allowing dynamic // keys to be created. @@ -331,6 +339,35 @@ func (d *ResourceData) State() *terraform.InstanceState { return &result } +// Timeout returns the data for the given timeout key +// Returns a duration of 20 minutes for any key not found, or not found and no default. +func (d *ResourceData) Timeout(key string) time.Duration { + key = strings.ToLower(key) + + var timeout *time.Duration + switch key { + case TimeoutCreate: + timeout = d.timeouts.Create + case TimeoutRead: + timeout = d.timeouts.Read + case TimeoutUpdate: + timeout = d.timeouts.Update + case TimeoutDelete: + timeout = d.timeouts.Delete + } + + if timeout != nil { + return *timeout + } + + if d.timeouts.Default != nil { + return *d.timeouts.Default + } + + // Return system default of 20 minutes + return 20 * time.Minute +} + func (d *ResourceData) init() { // Initialize the field that will store our new state var copyState terraform.InstanceState diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_timeout.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_timeout.go new file mode 100644 index 0000000000..445819f0f9 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/resource_timeout.go @@ -0,0 +1,237 @@ +package schema + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform/terraform" + "github.com/mitchellh/copystructure" +) + +const TimeoutKey = "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0" +const TimeoutsConfigKey = "timeouts" + +const ( + TimeoutCreate = "create" + TimeoutRead = "read" + TimeoutUpdate = "update" + TimeoutDelete = "delete" + TimeoutDefault = "default" +) + +func timeoutKeys() []string { + return []string{ + TimeoutCreate, + TimeoutRead, + TimeoutUpdate, + TimeoutDelete, + TimeoutDefault, + } +} + +// could be time.Duration, int64 or float64 +func DefaultTimeout(tx interface{}) *time.Duration { + var td time.Duration + switch raw := tx.(type) { + case time.Duration: + return &raw + case int64: + td = time.Duration(raw) + case float64: + td = time.Duration(int64(raw)) + default: + log.Printf("[WARN] Unknown type in DefaultTimeout: %#v", tx) + } + return &td +} + +type ResourceTimeout struct { + Create, Read, Update, Delete, Default *time.Duration +} + +// ConfigDecode takes a schema and the configuration (available in Diff) and +// validates, parses the timeouts into `t` +func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig) error { + if s.Timeouts != nil { + raw, err := copystructure.Copy(s.Timeouts) + if err != nil { + log.Printf("[DEBUG] Error with deep copy: %s", err) + } + *t = *raw.(*ResourceTimeout) + } + + if raw, ok := c.Config[TimeoutsConfigKey]; ok { + if configTimeouts, ok := raw.([]map[string]interface{}); ok { + for _, timeoutValues := range configTimeouts { + // loop through each Timeout given in the configuration and validate they + // the Timeout defined in the resource + for timeKey, timeValue := range timeoutValues { + // validate that we're dealing with the normal CRUD actions + var found bool + for _, key := range timeoutKeys() { + if timeKey == key { + found = true + break + } + } + + if !found { + return fmt.Errorf("Unsupported Timeout configuration key found (%s)", timeKey) + } + + // Get timeout + rt, err := time.ParseDuration(timeValue.(string)) + if err != nil { + return fmt.Errorf("Error parsing Timeout for (%s): %s", timeKey, err) + } + + var timeout *time.Duration + switch timeKey { + case TimeoutCreate: + timeout = t.Create + case TimeoutUpdate: + timeout = t.Update + case TimeoutRead: + timeout = t.Read + case TimeoutDelete: + timeout = t.Delete + case TimeoutDefault: + timeout = t.Default + } + + // If the resource has not delcared this in the definition, then error + // with an unsupported message + if timeout == nil { + return unsupportedTimeoutKeyError(timeKey) + } + + *timeout = rt + } + } + } else { + log.Printf("[WARN] Invalid Timeout structure found, skipping timeouts") + } + } + + return nil +} + +func unsupportedTimeoutKeyError(key string) error { + return fmt.Errorf("Timeout Key (%s) is not supported", key) +} + +// DiffEncode, StateEncode, and MetaDecode are analogous to the Go stdlib JSONEncoder +// interface: they encode/decode a timeouts struct from an instance diff, which is +// where the timeout data is stored after a diff to pass into Apply. +// +// StateEncode encodes the timeout into the ResourceData's InstanceState for +// saving to state +// +func (t *ResourceTimeout) DiffEncode(id *terraform.InstanceDiff) error { + return t.metaEncode(id) +} + +func (t *ResourceTimeout) StateEncode(is *terraform.InstanceState) error { + return t.metaEncode(is) +} + +// metaEncode encodes the ResourceTimeout into a map[string]interface{} format +// and stores it in the Meta field of the interface it's given. +// Assumes the interface is either *terraform.InstanceState or +// *terraform.InstanceDiff, returns an error otherwise +func (t *ResourceTimeout) metaEncode(ids interface{}) error { + m := make(map[string]interface{}) + + if t.Create != nil { + m[TimeoutCreate] = t.Create.Nanoseconds() + } + if t.Read != nil { + m[TimeoutRead] = t.Read.Nanoseconds() + } + if t.Update != nil { + m[TimeoutUpdate] = t.Update.Nanoseconds() + } + if t.Delete != nil { + m[TimeoutDelete] = t.Delete.Nanoseconds() + } + if t.Default != nil { + m[TimeoutDefault] = t.Default.Nanoseconds() + // for any key above that is nil, if default is specified, we need to + // populate it with the default + for _, k := range timeoutKeys() { + if _, ok := m[k]; !ok { + m[k] = t.Default.Nanoseconds() + } + } + } + + // only add the Timeout to the Meta if we have values + if len(m) > 0 { + switch instance := ids.(type) { + case *terraform.InstanceDiff: + if instance.Meta == nil { + instance.Meta = make(map[string]interface{}) + } + instance.Meta[TimeoutKey] = m + case *terraform.InstanceState: + if instance.Meta == nil { + instance.Meta = make(map[string]interface{}) + } + instance.Meta[TimeoutKey] = m + default: + return fmt.Errorf("Error matching type for Diff Encode") + } + } + + return nil +} + +func (t *ResourceTimeout) StateDecode(id *terraform.InstanceState) error { + return t.metaDecode(id) +} +func (t *ResourceTimeout) DiffDecode(is *terraform.InstanceDiff) error { + return t.metaDecode(is) +} + +func (t *ResourceTimeout) metaDecode(ids interface{}) error { + var rawMeta interface{} + var ok bool + switch rawInstance := ids.(type) { + case *terraform.InstanceDiff: + rawMeta, ok = rawInstance.Meta[TimeoutKey] + if !ok { + return nil + } + case *terraform.InstanceState: + rawMeta, ok = rawInstance.Meta[TimeoutKey] + if !ok { + return nil + } + default: + return fmt.Errorf("Unknown or unsupported type in metaDecode: %#v", ids) + } + + times := rawMeta.(map[string]interface{}) + if len(times) == 0 { + return nil + } + + if v, ok := times[TimeoutCreate]; ok { + t.Create = DefaultTimeout(v) + } + if v, ok := times[TimeoutRead]; ok { + t.Read = DefaultTimeout(v) + } + if v, ok := times[TimeoutUpdate]; ok { + t.Update = DefaultTimeout(v) + } + if v, ok := times[TimeoutDelete]; ok { + t.Delete = DefaultTimeout(v) + } + if v, ok := times[TimeoutDefault]; ok { + t.Default = DefaultTimeout(v) + } + + return nil +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/schema.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/schema.go index 7c8bed10ce..32d1721395 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/schema/schema.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/schema.go @@ -23,6 +23,9 @@ import ( "github.com/mitchellh/mapstructure" ) +// type used for schema package context keys +type contextKey string + // Schema is used to describe the structure of a value. // // Read the documentation of the struct elements for important details. @@ -62,10 +65,20 @@ type Schema struct { DiffSuppressFunc SchemaDiffSuppressFunc // If this is non-nil, then this will be a default value that is used - // when this item is not set in the configuration/state. + // when this item is not set in the configuration. + // + // DefaultFunc can be specified to compute a dynamic default. + // Only one of Default or DefaultFunc can be set. If DefaultFunc is + // used then its return value should be stable to avoid generating + // confusing/perpetual diffs. // - // DefaultFunc can be specified if you want a dynamic default value. - // Only one of Default or DefaultFunc can be set. + // Changing either Default or the return value of DefaultFunc can be + // a breaking change, especially if the attribute in question has + // ForceNew set. If a default needs to change to align with changing + // assumptions in an upstream API then it may be necessary to also use + // the MigrateState function on the resource to change the state to match, + // or have the Read function adjust the state value to align with the + // new default. // // If Required is true above, then Default cannot be set. DefaultFunc // can be set with Required. If the DefaultFunc returns nil, then there @@ -118,9 +131,16 @@ type Schema struct { // TypeSet or TypeList. Specific use cases would be if a TypeSet is being // used to wrap a complex structure, however less than one instance would // cause instability. - Elem interface{} - MaxItems int - MinItems int + // + // PromoteSingle, if true, will allow single elements to be standalone + // and promote them to a list. For example "foo" would be promoted to + // ["foo"] automatically. This is primarily for legacy reasons and the + // ambiguity is not recommended for new usage. Promotion is only allowed + // for primitive element types. + Elem interface{} + MaxItems int + MinItems int + PromoteSingle bool // The following fields are only valid for a TypeSet type. // @@ -470,7 +490,9 @@ func (m schemaMap) Input( // Skip things that don't require config, if that is even valid // for a provider schema. - if !v.Required && !v.Optional { + // Required XOR Optional must always be true to validate, so we only + // need to check one. + if v.Optional { continue } @@ -623,6 +645,19 @@ func (m schemaMap) InternalValidate(topSchemaMap schemaMap) error { } } + // Computed-only field + if v.Computed && !v.Optional { + if v.ValidateFunc != nil { + return fmt.Errorf("%s: ValidateFunc is for validating user input, "+ + "there's nothing to validate on computed-only field", k) + } + if v.DiffSuppressFunc != nil { + return fmt.Errorf("%s: DiffSuppressFunc is for suppressing differences"+ + " between config and state representation. "+ + "There is no config for computed-only field, nothing to compare.", k) + } + } + if v.ValidateFunc != nil { switch v.Type { case TypeList, TypeSet: @@ -634,19 +669,6 @@ func (m schemaMap) InternalValidate(topSchemaMap schemaMap) error { return nil } -func (m schemaMap) markAsRemoved(k string, schema *Schema, diff *terraform.InstanceDiff) { - existingDiff, ok := diff.Attributes[k] - if ok { - existingDiff.NewRemoved = true - diff.Attributes[k] = schema.finalizeDiff(existingDiff) - return - } - - diff.Attributes[k] = schema.finalizeDiff(&terraform.ResourceAttrDiff{ - NewRemoved: true, - }) -} - func (m schemaMap) diff( k string, schema *Schema, @@ -735,6 +757,7 @@ func (m schemaMap) diffList( diff.Attributes[k+".#"] = &terraform.ResourceAttrDiff{ Old: oldStr, NewComputed: true, + RequiresNew: schema.ForceNew, } return nil } @@ -770,7 +793,6 @@ func (m schemaMap) diffList( switch t := schema.Elem.(type) { case *Resource: - countDiff, cOk := diff.GetAttribute(k + ".#") // This is a complex resource for i := 0; i < maxLen; i++ { for k2, schema := range t.Schema { @@ -779,15 +801,6 @@ func (m schemaMap) diffList( if err != nil { return err } - - // If parent list is being removed - // remove all subfields which were missed by the diff func - // We process these separately because type-specific diff functions - // lack the context (hierarchy of fields) - subKeyIsCount := strings.HasSuffix(subK, ".#") - if cOk && countDiff.New == "0" && !subKeyIsCount { - m.markAsRemoved(subK, schema, diff) - } } } case *Schema: @@ -912,6 +925,7 @@ func (m schemaMap) diffSet( diff *terraform.InstanceDiff, d *ResourceData, all bool) error { + o, n, _, computedSet := d.diffChange(k) if computedSet { n = nil @@ -1163,6 +1177,14 @@ func (m schemaMap) validateList( // We use reflection to verify the slice because you can't // case to []interface{} unless the slice is exactly that type. rawV := reflect.ValueOf(raw) + + // If we support promotion and the raw value isn't a slice, wrap + // it in []interface{} and check again. + if schema.PromoteSingle && rawV.Kind() != reflect.Slice { + raw = []interface{}{raw} + rawV = reflect.ValueOf(raw) + } + if rawV.Kind() != reflect.Slice { return nil, []error{fmt.Errorf( "%s: should be a list", k)} @@ -1190,6 +1212,13 @@ func (m schemaMap) validateList( for i, raw := range raws { key := fmt.Sprintf("%s.%d", k, i) + // Reify the key value from the ResourceConfig. + // If the list was computed we have all raw values, but some of these + // may be known in the config, and aren't individually marked as Computed. + if r, ok := c.Get(key); ok { + raw = r + } + var ws2 []string var es2 []error switch t := schema.Elem.(type) { @@ -1235,8 +1264,15 @@ func (m schemaMap) validateMap( return nil, []error{fmt.Errorf("%s: should be a map", k)} } - // If it is not a slice, it is valid + // If it is not a slice, validate directly if rawV.Kind() != reflect.Slice { + mapIface := rawV.Interface() + if _, errs := validateMapValues(k, mapIface.(map[string]interface{}), schema); len(errs) > 0 { + return nil, errs + } + if schema.ValidateFunc != nil { + return schema.ValidateFunc(mapIface, k) + } return nil, nil } @@ -1252,6 +1288,10 @@ func (m schemaMap) validateMap( return nil, []error{fmt.Errorf( "%s: should be a map", k)} } + mapIface := v.Interface() + if _, errs := validateMapValues(k, mapIface.(map[string]interface{}), schema); len(errs) > 0 { + return nil, errs + } } if schema.ValidateFunc != nil { @@ -1268,6 +1308,67 @@ func (m schemaMap) validateMap( return nil, nil } +func validateMapValues(k string, m map[string]interface{}, schema *Schema) ([]string, []error) { + for key, raw := range m { + valueType, err := getValueType(k, schema) + if err != nil { + return nil, []error{err} + } + + switch valueType { + case TypeBool: + var n bool + if err := mapstructure.WeakDecode(raw, &n); err != nil { + return nil, []error{fmt.Errorf("%s (%s): %s", k, key, err)} + } + case TypeInt: + var n int + if err := mapstructure.WeakDecode(raw, &n); err != nil { + return nil, []error{fmt.Errorf("%s (%s): %s", k, key, err)} + } + case TypeFloat: + var n float64 + if err := mapstructure.WeakDecode(raw, &n); err != nil { + return nil, []error{fmt.Errorf("%s (%s): %s", k, key, err)} + } + case TypeString: + var n string + if err := mapstructure.WeakDecode(raw, &n); err != nil { + return nil, []error{fmt.Errorf("%s (%s): %s", k, key, err)} + } + default: + panic(fmt.Sprintf("Unknown validation type: %#v", schema.Type)) + } + } + return nil, nil +} + +func getValueType(k string, schema *Schema) (ValueType, error) { + if schema.Elem == nil { + return TypeString, nil + } + if vt, ok := schema.Elem.(ValueType); ok { + return vt, nil + } + + if s, ok := schema.Elem.(*Schema); ok { + if s.Elem == nil { + return TypeString, nil + } + if vt, ok := s.Elem.(ValueType); ok { + return vt, nil + } + } + + if _, ok := schema.Elem.(*Resource); ok { + // TODO: We don't actually support this (yet) + // but silently pass the validation, until we decide + // how to handle nested structures in maps + return TypeString, nil + } + return 0, fmt.Errorf("%s: unexpected map value type: %#v", k, schema.Elem) +} + func (m schemaMap) validateObject( k string, schema map[string]*Schema, @@ -1300,6 +1401,9 @@ func (m schemaMap) validateObject( if m, ok := raw.(map[string]interface{}); ok { for subk, _ := range m { if _, ok := schema[subk]; !ok { + if subk == TimeoutsConfigKey { + continue + } es = append(es, fmt.Errorf( "%s: invalid or unknown key: %s", k, subk)) } @@ -1342,28 +1446,28 @@ func (m schemaMap) validatePrimitive( // Verify that we can parse this as the correct type var n bool if err := mapstructure.WeakDecode(raw, &n); err != nil { - return nil, []error{err} + return nil, []error{fmt.Errorf("%s: %s", k, err)} } decoded = n case TypeInt: // Verify that we can parse this as an int var n int if err := mapstructure.WeakDecode(raw, &n); err != nil { - return nil, []error{err} + return nil, []error{fmt.Errorf("%s: %s", k, err)} } decoded = n case TypeFloat: // Verify that we can parse this as an int var n float64 if err := mapstructure.WeakDecode(raw, &n); err != nil { - return nil, []error{err} + return nil, []error{fmt.Errorf("%s: %s", k, err)} } decoded = n case TypeString: // Verify that we can parse this as a string var n string if err := mapstructure.WeakDecode(raw, &n); err != nil { - return nil, []error{err} + return nil, []error{fmt.Errorf("%s: %s", k, err)} } decoded = n default: diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/testing.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/testing.go new file mode 100644 index 0000000000..9765bdbc6d --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/testing.go @@ -0,0 +1,30 @@ +package schema + +import ( + "testing" + + "github.com/hashicorp/terraform/config" + "github.com/hashicorp/terraform/terraform" +) + +// TestResourceDataRaw creates a ResourceData from a raw configuration map. +func TestResourceDataRaw( + t *testing.T, schema map[string]*Schema, raw map[string]interface{}) *ResourceData { + c, err := config.NewRawConfig(raw) + if err != nil { + t.Fatalf("err: %s", err) + } + + sm := schemaMap(schema) + diff, err := sm.Diff(nil, terraform.NewResourceConfig(c)) + if err != nil { + t.Fatalf("err: %s", err) + } + + result, err := sm.Data(nil, diff) + if err != nil { + t.Fatalf("err: %s", err) + } + + return result +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/schema/valuetype_string.go b/installer/vendor/github.com/hashicorp/terraform/helper/schema/valuetype_string.go index 08f008450f..1610cec2d3 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/schema/valuetype_string.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/schema/valuetype_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=ValueType valuetype.go"; DO NOT EDIT +// Code generated by "stringer -type=ValueType valuetype.go"; DO NOT EDIT. package schema diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/structure/expand_json.go b/installer/vendor/github.com/hashicorp/terraform/helper/structure/expand_json.go new file mode 100644 index 0000000000..b3eb90fdff --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/structure/expand_json.go @@ -0,0 +1,11 @@ +package structure + +import "encoding/json" + +func ExpandJsonFromString(jsonString string) (map[string]interface{}, error) { + var result map[string]interface{} + + err := json.Unmarshal([]byte(jsonString), &result) + + return result, err +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/structure/flatten_json.go b/installer/vendor/github.com/hashicorp/terraform/helper/structure/flatten_json.go new file mode 100644 index 0000000000..578ad2eade --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/structure/flatten_json.go @@ -0,0 +1,16 @@ +package structure + +import "encoding/json" + +func FlattenJsonToString(input map[string]interface{}) (string, error) { + if len(input) == 0 { + return "", nil + } + + result, err := json.Marshal(input) + if err != nil { + return "", err + } + + return string(result), nil +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/structure/normalize_json.go b/installer/vendor/github.com/hashicorp/terraform/helper/structure/normalize_json.go new file mode 100644 index 0000000000..3256b476dd --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/structure/normalize_json.go @@ -0,0 +1,24 @@ +package structure + +import "encoding/json" + +// Takes a value containing JSON string and passes it through +// the JSON parser to normalize it, returns either a parsing +// error or normalized JSON string. +func NormalizeJsonString(jsonString interface{}) (string, error) { + var j interface{} + + if jsonString == nil || jsonString.(string) == "" { + return "", nil + } + + s := jsonString.(string) + + err := json.Unmarshal([]byte(s), &j) + if err != nil { + return s, err + } + + bytes, _ := json.Marshal(j) + return string(bytes[:]), nil +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/structure/suppress_json_diff.go b/installer/vendor/github.com/hashicorp/terraform/helper/structure/suppress_json_diff.go new file mode 100644 index 0000000000..46f794a71b --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/helper/structure/suppress_json_diff.go @@ -0,0 +1,21 @@ +package structure + +import ( + "reflect" + + "github.com/hashicorp/terraform/helper/schema" +) + +func SuppressJsonDiff(k, old, new string, d *schema.ResourceData) bool { + oldMap, err := ExpandJsonFromString(old) + if err != nil { + return false + } + + newMap, err := ExpandJsonFromString(new) + if err != nil { + return false + } + + return reflect.DeepEqual(oldMap, newMap) +} diff --git a/installer/vendor/github.com/hashicorp/terraform/helper/validation/validation.go b/installer/vendor/github.com/hashicorp/terraform/helper/validation/validation.go index 484f7d7dae..7b894f5409 100644 --- a/installer/vendor/github.com/hashicorp/terraform/helper/validation/validation.go +++ b/installer/vendor/github.com/hashicorp/terraform/helper/validation/validation.go @@ -2,9 +2,11 @@ package validation import ( "fmt" + "net" "strings" "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/structure" ) // IntBetween returns a SchemaValidateFunc which tests if the provided value @@ -47,3 +49,60 @@ func StringInSlice(valid []string, ignoreCase bool) schema.SchemaValidateFunc { return } } + +// StringLenBetween returns a SchemaValidateFunc which tests if the provided value +// is of type string and has length between min and max (inclusive) +func StringLenBetween(min, max int) schema.SchemaValidateFunc { + return func(i interface{}, k string) (s []string, es []error) { + v, ok := i.(string) + if !ok { + es = append(es, fmt.Errorf("expected type of %s to be string", k)) + return + } + if len(v) < min || len(v) > max { + es = append(es, fmt.Errorf("expected length of %s to be in the range (%d - %d), got %s", k, min, max, v)) + } + return + } +} + +// CIDRNetwork returns a SchemaValidateFunc which tests if the provided value +// is of type string, is in valid CIDR network notation, and has significant bits between min and max (inclusive) +func CIDRNetwork(min, max int) schema.SchemaValidateFunc { + return func(i interface{}, k string) (s []string, es []error) { + v, ok := i.(string) + if !ok { + es = append(es, fmt.Errorf("expected type of %s to be string", k)) + return + } + + _, ipnet, err := net.ParseCIDR(v) + if err != nil { + es = append(es, fmt.Errorf( + "expected %s to contain a valid CIDR, got: %s with err: %s", k, v, err)) + return + } + + if ipnet == nil || v != ipnet.String() { + es = append(es, fmt.Errorf( + "expected %s to contain a valid network CIDR, expected %s, got %s", + k, ipnet, v)) + } + + sigbits, _ := ipnet.Mask.Size() + if sigbits < min || sigbits > max { + es = append(es, fmt.Errorf( + "expected %q to contain a network CIDR with between %d and %d significant bits, got: %d", + k, min, max, sigbits)) + } + + return + } +} + +func ValidateJsonString(v interface{}, k string) (ws []string, errors []error) { + if _, err := structure.NormalizeJsonString(v); err != nil { + errors = append(errors, fmt.Errorf("%q contains an invalid JSON: %s", k, err)) + } + return +} diff --git a/installer/vendor/github.com/hashicorp/terraform/main.go b/installer/vendor/github.com/hashicorp/terraform/main.go index bcf6a3f588..b94de2ebc1 100644 --- a/installer/vendor/github.com/hashicorp/terraform/main.go +++ b/installer/vendor/github.com/hashicorp/terraform/main.go @@ -7,17 +7,24 @@ import ( "log" "os" "runtime" + "strings" "sync" "github.com/hashicorp/go-plugin" "github.com/hashicorp/terraform/helper/logging" "github.com/hashicorp/terraform/terraform" "github.com/mattn/go-colorable" + "github.com/mattn/go-shellwords" "github.com/mitchellh/cli" "github.com/mitchellh/panicwrap" "github.com/mitchellh/prefixedio" ) +const ( + // EnvCLI is the environment variable name to set additional CLI args. + EnvCLI = "TF_CLI_ARGS" +) + func main() { // Override global prefix set by go-dynect during init() log.SetPrefix("") @@ -96,6 +103,7 @@ func wrappedMain() int { log.Printf( "[INFO] Terraform version: %s %s %s", Version, VersionPrerelease, GitCommit) + log.Printf("[INFO] Go runtime version: %s", runtime.Version()) log.Printf("[INFO] CLI args: %#v", os.Args) // Load the configuration @@ -129,9 +137,35 @@ func wrappedMain() int { // Make sure we clean up any managed plugins at the end of this defer plugin.CleanupClients() - // Get the command line args. We shortcut "--version" and "-v" to - // just show the version. + // Get the command line args. args := os.Args[1:] + + // Build the CLI so far, we do this so we can query the subcommand. + cliRunner := &cli.CLI{ + Args: args, + Commands: Commands, + HelpFunc: helpFunc, + HelpWriter: os.Stdout, + } + + // Prefix the args with any args from the EnvCLI + args, err = mergeEnvArgs(EnvCLI, cliRunner.Subcommand(), args) + if err != nil { + Ui.Error(err.Error()) + return 1 + } + + // Prefix the args with any args from the EnvCLI targeting this command + suffix := strings.Replace(strings.Replace( + cliRunner.Subcommand(), "-", "_", -1), " ", "_", -1) + args, err = mergeEnvArgs( + fmt.Sprintf("%s_%s", EnvCLI, suffix), cliRunner.Subcommand(), args) + if err != nil { + Ui.Error(err.Error()) + return 1 + } + + // We shortcut "--version" and "-v" to just show the version for _, arg := range args { if arg == "-v" || arg == "-version" || arg == "--version" { newArgs := make([]string, len(args)+1) @@ -142,7 +176,9 @@ func wrappedMain() int { } } - cli := &cli.CLI{ + // Rebuild the CLI with any modified args. + log.Printf("[INFO] CLI command args: %#v", args) + cliRunner = &cli.CLI{ Args: args, Commands: Commands, HelpFunc: helpFunc, @@ -153,7 +189,7 @@ func wrappedMain() int { ContextOpts.Providers = config.ProviderFactories() ContextOpts.Provisioners = config.ProvisionerFactories() - exitCode, err := cli.Run() + exitCode, err := cliRunner.Run() if err != nil { Ui.Error(fmt.Sprintf("Error executing CLI: %s", err.Error())) return 1 @@ -241,3 +277,47 @@ func copyOutput(r io.Reader, doneCh chan<- struct{}) { wg.Wait() } + +func mergeEnvArgs(envName string, cmd string, args []string) ([]string, error) { + v := os.Getenv(envName) + if v == "" { + return args, nil + } + + log.Printf("[INFO] %s value: %q", envName, v) + extra, err := shellwords.Parse(v) + if err != nil { + return nil, fmt.Errorf( + "Error parsing extra CLI args from %s: %s", + envName, err) + } + + // Find the command to look for in the args. If there is a space, + // we need to find the last part. + search := cmd + if idx := strings.LastIndex(search, " "); idx >= 0 { + search = cmd[idx+1:] + } + + // Find the index to place the flags. We put them exactly + // after the first non-flag arg. + idx := -1 + for i, v := range args { + if v == search { + idx = i + break + } + } + + // idx points to the exact arg that isn't a flag. We increment + // by one so that all the copying below expects idx to be the + // insertion point. + idx++ + + // Copy the args + newArgs := make([]string, len(args)+len(extra)) + copy(newArgs, args[:idx]) + copy(newArgs[idx:], extra) + copy(newArgs[len(extra)+idx:], args[idx:]) + return newArgs, nil +} diff --git a/installer/vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go b/installer/vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go index 9823095803..8fce9d8ae7 100644 --- a/installer/vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go +++ b/installer/vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go @@ -77,6 +77,19 @@ func (p *ResourceProvisioner) Apply( return err } +func (p *ResourceProvisioner) Stop() error { + var resp ResourceProvisionerStopResponse + err := p.Client.Call("Plugin.Stop", new(interface{}), &resp) + if err != nil { + return err + } + if resp.Error != nil { + err = resp.Error + } + + return err +} + func (p *ResourceProvisioner) Close() error { return p.Client.Close() } @@ -100,6 +113,10 @@ type ResourceProvisionerApplyResponse struct { Error *plugin.BasicError } +type ResourceProvisionerStopResponse struct { + Error *plugin.BasicError +} + // ResourceProvisionerServer is a net/rpc compatible structure for serving // a ResourceProvisioner. This should not be used directly. type ResourceProvisionerServer struct { @@ -143,3 +160,14 @@ func (s *ResourceProvisionerServer) Validate( } return nil } + +func (s *ResourceProvisionerServer) Stop( + _ interface{}, + reply *ResourceProvisionerStopResponse) error { + err := s.Provisioner.Stop() + *reply = ResourceProvisionerStopResponse{ + Error: plugin.NewBasicError(err), + } + + return nil +} diff --git a/installer/vendor/github.com/hashicorp/terraform/plugin/serve.go b/installer/vendor/github.com/hashicorp/terraform/plugin/serve.go index 932728c971..2028a613ff 100644 --- a/installer/vendor/github.com/hashicorp/terraform/plugin/serve.go +++ b/installer/vendor/github.com/hashicorp/terraform/plugin/serve.go @@ -19,7 +19,7 @@ var Handshake = plugin.HandshakeConfig{ // one or the other that makes it so that they can't safely communicate. // This could be adding a new interface value, it could be how // helper/schema computes diffs, etc. - ProtocolVersion: 2, + ProtocolVersion: 4, // The magic cookie values should NEVER be changed. MagicCookieKey: "TF_PLUGIN_MAGIC_COOKIE", diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/context.go b/installer/vendor/github.com/hashicorp/terraform/terraform/context.go index ea76c4203b..306128edfb 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/context.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/context.go @@ -1,6 +1,7 @@ package terraform import ( + "context" "fmt" "log" "sort" @@ -48,6 +49,7 @@ var ( // ContextOpts are the user-configurable options to create a context with // NewContext. type ContextOpts struct { + Meta *ContextMeta Destroy bool Diff *Diff Hooks []Hook @@ -64,6 +66,14 @@ type ContextOpts struct { UIInput UIInput } +// ContextMeta is metadata about the running context. This is information +// that this package or structure cannot determine on its own but exposes +// into Terraform in various ways. This must be provided by the Context +// initializer. +type ContextMeta struct { + Env string // Env is the state environment +} + // Context represents all the context that Terraform needs in order to // perform operations on infrastructure. This structure is built using // NewContext. See the documentation for that. @@ -79,6 +89,7 @@ type Context struct { diff *Diff diffLock sync.RWMutex hooks []Hook + meta *ContextMeta module *module.Tree sh *stopHook shadow bool @@ -91,8 +102,10 @@ type Context struct { l sync.Mutex // Lock acquired during any task parallelSem Semaphore providerInputConfig map[string]map[string]interface{} - runCh <-chan struct{} - stopCh chan struct{} + runLock sync.Mutex + runCond *sync.Cond + runContext context.Context + runContextCancel context.CancelFunc shadowErr error } @@ -175,6 +188,7 @@ func NewContext(opts *ContextOpts) (*Context, error) { destroy: opts.Destroy, diff: diff, hooks: hooks, + meta: opts.Meta, module: opts.Module, shadow: opts.Shadow, state: state, @@ -204,6 +218,7 @@ func (c *Context) Graph(typ GraphType, opts *ContextGraphOpts) (*Graph, error) { opts = &ContextGraphOpts{Validate: true} } + log.Printf("[INFO] terraform: building graph: %s", typ) switch typ { case GraphTypeApply: return (&ApplyGraphBuilder{ @@ -217,14 +232,35 @@ func (c *Context) Graph(typ GraphType, opts *ContextGraphOpts) (*Graph, error) { Validate: opts.Validate, }).Build(RootModulePath) + case GraphTypeInput: + // The input graph is just a slightly modified plan graph + fallthrough + case GraphTypeValidate: + // The validate graph is just a slightly modified plan graph + fallthrough case GraphTypePlan: - return (&PlanGraphBuilder{ + // Create the plan graph builder + p := &PlanGraphBuilder{ Module: c.module, State: c.state, Providers: c.components.ResourceProviders(), Targets: c.targets, Validate: opts.Validate, - }).Build(RootModulePath) + } + + // Some special cases for other graph types shared with plan currently + var b GraphBuilder = p + switch typ { + case GraphTypeInput: + b = InputGraphBuilder(p) + case GraphTypeValidate: + // We need to set the provisioners so those can be validated + p.Provisioners = c.components.ResourceProvisioners() + + b = ValidateGraphBuilder(p) + } + + return b.Build(RootModulePath) case GraphTypePlanDestroy: return (&DestroyPlanGraphBuilder{ @@ -234,29 +270,19 @@ func (c *Context) Graph(typ GraphType, opts *ContextGraphOpts) (*Graph, error) { Validate: opts.Validate, }).Build(RootModulePath) - case GraphTypeLegacy: - return c.graphBuilder(opts).Build(RootModulePath) + case GraphTypeRefresh: + return (&RefreshGraphBuilder{ + Module: c.module, + State: c.state, + Providers: c.components.ResourceProviders(), + Targets: c.targets, + Validate: opts.Validate, + }).Build(RootModulePath) } return nil, fmt.Errorf("unknown graph type: %s", typ) } -// GraphBuilder returns the GraphBuilder that will be used to create -// the graphs for this context. -func (c *Context) graphBuilder(g *ContextGraphOpts) GraphBuilder { - return &BuiltinGraphBuilder{ - Root: c.module, - Diff: c.diff, - Providers: c.components.ResourceProviders(), - Provisioners: c.components.ResourceProvisioners(), - State: c.state, - Targets: c.targets, - Destroy: c.destroy, - Validate: g.Validate, - Verbose: g.Verbose, - } -} - // ShadowError returns any errors caught during a shadow operation. // // A shadow operation is an operation run in parallel to a real operation @@ -284,6 +310,13 @@ func (c *Context) ShadowError() error { return c.shadowErr } +// State returns a copy of the current state associated with this context. +// +// This cannot safely be called in parallel with any other Context function. +func (c *Context) State() *State { + return c.state.DeepCopy() +} + // Interpolater returns an Interpolater built on a copy of the state // that can be used to test interpolation values. func (c *Context) Interpolater() *Interpolater { @@ -291,6 +324,7 @@ func (c *Context) Interpolater() *Interpolater { var stateLock sync.RWMutex return &Interpolater{ Operation: walkApply, + Meta: c.meta, Module: c.module, State: c.state.DeepCopy(), StateLock: &stateLock, @@ -303,8 +337,7 @@ func (c *Context) Interpolater() *Interpolater { // This modifies the configuration in-place, so asking for Input twice // may result in different UI output showing different current values. func (c *Context) Input(mode InputMode) error { - v := c.acquireRun("input") - defer c.releaseRun(v) + defer c.acquireRun("input")() if mode&InputModeVar != 0 { // Walk the variables first for the root module. We walk them in @@ -403,7 +436,7 @@ func (c *Context) Input(mode InputMode) error { if mode&InputModeProvider != 0 { // Build the graph - graph, err := c.Graph(GraphTypeLegacy, nil) + graph, err := c.Graph(GraphTypeInput, nil) if err != nil { return err } @@ -420,24 +453,25 @@ func (c *Context) Input(mode InputMode) error { // Apply applies the changes represented by this context and returns // the resulting state. // -// In addition to returning the resulting state, this context is updated -// with the latest state. +// Even in the case an error is returned, the state may be returned and will +// potentially be partially updated. In addition to returning the resulting +// state, this context is updated with the latest state. +// +// If the state is required after an error, the caller should call +// Context.State, rather than rely on the return value. +// +// TODO: Apply and Refresh should either always return a state, or rely on the +// State() method. Currently the helper/resource testing framework relies +// on the absence of a returned state to determine if Destroy can be +// called, so that will need to be refactored before this can be changed. func (c *Context) Apply() (*State, error) { - v := c.acquireRun("apply") - defer c.releaseRun(v) + defer c.acquireRun("apply")() // Copy our own state c.state = c.state.DeepCopy() - // Enable the new graph by default - X_legacyGraph := experiment.Enabled(experiment.X_legacyGraph) - // Build the graph. - graphType := GraphTypeLegacy - if !X_legacyGraph { - graphType = GraphTypeApply - } - graph, err := c.Graph(graphType, nil) + graph, err := c.Graph(GraphTypeApply, nil) if err != nil { return nil, err } @@ -468,8 +502,7 @@ func (c *Context) Apply() (*State, error) { // Plan also updates the diff of this context to be the diff generated // by the plan, so Apply can be called after. func (c *Context) Plan() (*Plan, error) { - v := c.acquireRun("plan") - defer c.releaseRun(v) + defer c.acquireRun("plan")() p := &Plan{ Module: c.module, @@ -505,17 +538,10 @@ func (c *Context) Plan() (*Plan, error) { c.diff.init() c.diffLock.Unlock() - // Used throughout below - X_legacyGraph := experiment.Enabled(experiment.X_legacyGraph) - // Build the graph. - graphType := GraphTypeLegacy - if !X_legacyGraph { - if c.destroy { - graphType = GraphTypePlanDestroy - } else { - graphType = GraphTypePlan - } + graphType := GraphTypePlan + if c.destroy { + graphType = GraphTypePlanDestroy } graph, err := c.Graph(graphType, nil) if err != nil { @@ -540,15 +566,17 @@ func (c *Context) Plan() (*Plan, error) { p.Diff.DeepCopy() } - // We don't do the reverification during the new destroy plan because - // it will use a different apply process. - if X_legacyGraph { - // Now that we have a diff, we can build the exact graph that Apply will use - // and catch any possible cycles during the Plan phase. - if _, err := c.Graph(GraphTypeLegacy, nil); err != nil { - return nil, err + /* + // We don't do the reverification during the new destroy plan because + // it will use a different apply process. + if X_legacyGraph { + // Now that we have a diff, we can build the exact graph that Apply will use + // and catch any possible cycles during the Plan phase. + if _, err := c.Graph(GraphTypeLegacy, nil); err != nil { + return nil, err + } } - } + */ var errs error if len(walker.ValidationErrors) > 0 { @@ -561,17 +589,16 @@ func (c *Context) Plan() (*Plan, error) { // to their latest state. This will update the state that this context // works with, along with returning it. // -// Even in the case an error is returned, the state will be returned and +// Even in the case an error is returned, the state may be returned and // will potentially be partially updated. func (c *Context) Refresh() (*State, error) { - v := c.acquireRun("refresh") - defer c.releaseRun(v) + defer c.acquireRun("refresh")() // Copy our own state c.state = c.state.DeepCopy() - // Build the graph - graph, err := c.Graph(GraphTypeLegacy, nil) + // Build the graph. + graph, err := c.Graph(GraphTypeRefresh, nil) if err != nil { return nil, err } @@ -591,30 +618,34 @@ func (c *Context) Refresh() (*State, error) { // // Stop will block until the task completes. func (c *Context) Stop() { + log.Printf("[WARN] terraform: Stop called, initiating interrupt sequence") + c.l.Lock() - ch := c.runCh + defer c.l.Unlock() - // If we aren't running, then just return - if ch == nil { - c.l.Unlock() - return - } + // If we're running, then stop + if c.runContextCancel != nil { + log.Printf("[WARN] terraform: run context exists, stopping") + + // Tell the hook we want to stop + c.sh.Stop() - // Tell the hook we want to stop - c.sh.Stop() + // Stop the context + c.runContextCancel() + c.runContextCancel = nil + } - // Close the stop channel - close(c.stopCh) + // Grab the condition var before we exit + if cond := c.runCond; cond != nil { + cond.Wait() + } - // Wait for us to stop - c.l.Unlock() - <-ch + log.Printf("[WARN] terraform: stop complete") } // Validate validates the configuration and returns any warnings or errors. func (c *Context) Validate() ([]string, []error) { - v := c.acquireRun("validate") - defer c.releaseRun(v) + defer c.acquireRun("validate")() var errs error @@ -642,7 +673,7 @@ func (c *Context) Validate() ([]string, []error) { // We also validate the graph generated here, but this graph doesn't // necessarily match the graph that Plan will generate, so we'll validate the // graph again later after Planning. - graph, err := c.Graph(GraphTypeLegacy, nil) + graph, err := c.Graph(GraphTypeValidate, nil) if err != nil { return nil, []error{err} } @@ -655,6 +686,12 @@ func (c *Context) Validate() ([]string, []error) { // Return the result rerrs := multierror.Append(errs, walker.ValidationErrors...) + + sort.Strings(walker.ValidationWarnings) + sort.Slice(rerrs.Errors, func(i, j int) bool { + return rerrs.Errors[i].Error() < rerrs.Errors[j].Error() + }) + return walker.ValidationWarnings, rerrs.Errors } @@ -675,26 +712,25 @@ func (c *Context) SetVariable(k string, v interface{}) { c.variables[k] = v } -func (c *Context) acquireRun(phase string) chan<- struct{} { +func (c *Context) acquireRun(phase string) func() { + // With the run lock held, grab the context lock to make changes + // to the run context. c.l.Lock() defer c.l.Unlock() - dbug.SetPhase(phase) - - // Wait for no channel to exist - for c.runCh != nil { - c.l.Unlock() - ch := c.runCh - <-ch - c.l.Lock() + // Wait until we're no longer running + for c.runCond != nil { + c.runCond.Wait() } - // Create the new channel - ch := make(chan struct{}) - c.runCh = ch + // Build our lock + c.runCond = sync.NewCond(&c.l) - // Reset the stop channel so we can watch that - c.stopCh = make(chan struct{}) + // Setup debugging + dbug.SetPhase(phase) + + // Create a new run context + c.runContext, c.runContextCancel = context.WithCancel(context.Background()) // Reset the stop hook so we're not stopped c.sh.Reset() @@ -702,10 +738,11 @@ func (c *Context) acquireRun(phase string) chan<- struct{} { // Reset the shadow errors c.shadowErr = nil - return ch + return c.releaseRun } -func (c *Context) releaseRun(ch chan<- struct{}) { +func (c *Context) releaseRun() { + // Grab the context lock so that we can make modifications to fields c.l.Lock() defer c.l.Unlock() @@ -714,9 +751,19 @@ func (c *Context) releaseRun(ch chan<- struct{}) { // phase dbug.SetPhase("INVALID") - close(ch) - c.runCh = nil - c.stopCh = nil + // End our run. We check if runContext is non-nil because it can be + // set to nil if it was cancelled via Stop() + if c.runContextCancel != nil { + c.runContextCancel() + } + + // Unlock all waiting our condition + cond := c.runCond + c.runCond = nil + cond.Broadcast() + + // Unset the context + c.runContext = nil } func (c *Context) walk( @@ -749,19 +796,20 @@ func (c *Context) walk( log.Printf("[DEBUG] Starting graph walk: %s", operation.String()) walker := &ContextGraphWalker{ - Context: realCtx, - Operation: operation, + Context: realCtx, + Operation: operation, + StopContext: c.runContext, } // Watch for a stop so we can call the provider Stop() API. - doneCh := make(chan struct{}) - go c.watchStop(walker, c.stopCh, doneCh) + watchStop, watchWait := c.watchStop(walker) // Walk the real graph, this will block until it completes realErr := graph.Walk(walker) - // Close the done channel so the watcher stops - close(doneCh) + // Close the channel so the watcher stops, and wait for it to return. + close(watchStop) + <-watchWait // If we have a shadow graph and we interrupted the real graph, then // we just close the shadow and never verify it. It is non-trivial to @@ -850,33 +898,74 @@ func (c *Context) walk( return walker, realErr } -func (c *Context) watchStop(walker *ContextGraphWalker, stopCh, doneCh <-chan struct{}) { - // Wait for a stop or completion - select { - case <-stopCh: - // Stop was triggered. Fall out of the select - case <-doneCh: - // Done, just exit completely - return - } +// watchStop immediately returns a `stop` and a `wait` chan after dispatching +// the watchStop goroutine. This will watch the runContext for cancellation and +// stop the providers accordingly. When the watch is no longer needed, the +// `stop` chan should be closed before waiting on the `wait` chan. +// The `wait` chan is important, because without synchronizing with the end of +// the watchStop goroutine, the runContext may also be closed during the select +// incorrectly causing providers to be stopped. Even if the graph walk is done +// at that point, stopping a provider permanently cancels its StopContext which +// can cause later actions to fail. +func (c *Context) watchStop(walker *ContextGraphWalker) (chan struct{}, <-chan struct{}) { + stop := make(chan struct{}) + wait := make(chan struct{}) + + // get the runContext cancellation channel now, because releaseRun will + // write to the runContext field. + done := c.runContext.Done() + + go func() { + defer close(wait) + // Wait for a stop or completion + select { + case <-done: + // done means the context was canceled, so we need to try and stop + // providers. + case <-stop: + // our own stop channel was closed. + return + } - // If we're here, we're stopped, trigger the call. + // If we're here, we're stopped, trigger the call. - // Copy the providers so that a misbehaved blocking Stop doesn't - // completely hang Terraform. - walker.providerLock.Lock() - ps := make([]ResourceProvider, 0, len(walker.providerCache)) - for _, p := range walker.providerCache { - ps = append(ps, p) - } - defer walker.providerLock.Unlock() + { + // Copy the providers so that a misbehaved blocking Stop doesn't + // completely hang Terraform. + walker.providerLock.Lock() + ps := make([]ResourceProvider, 0, len(walker.providerCache)) + for _, p := range walker.providerCache { + ps = append(ps, p) + } + defer walker.providerLock.Unlock() - for _, p := range ps { - // We ignore the error for now since there isn't any reasonable - // action to take if there is an error here, since the stop is still - // advisory: Terraform will exit once the graph node completes. - p.Stop() - } + for _, p := range ps { + // We ignore the error for now since there isn't any reasonable + // action to take if there is an error here, since the stop is still + // advisory: Terraform will exit once the graph node completes. + p.Stop() + } + } + + { + // Call stop on all the provisioners + walker.provisionerLock.Lock() + ps := make([]ResourceProvisioner, 0, len(walker.provisionerCache)) + for _, p := range walker.provisionerCache { + ps = append(ps, p) + } + defer walker.provisionerLock.Unlock() + + for _, p := range ps { + // We ignore the error for now since there isn't any reasonable + // action to take if there is an error here, since the stop is still + // advisory: Terraform will exit once the graph node completes. + p.Stop() + } + } + }() + + return stop, wait } // parseVariableAsHCL parses the value of a single variable as would have been specified diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/context_graph_type.go b/installer/vendor/github.com/hashicorp/terraform/terraform/context_graph_type.go index a204969ff1..084f0105dd 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/context_graph_type.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/context_graph_type.go @@ -10,9 +10,12 @@ type GraphType byte const ( GraphTypeInvalid GraphType = 0 GraphTypeLegacy GraphType = iota + GraphTypeRefresh GraphTypePlan GraphTypePlanDestroy GraphTypeApply + GraphTypeInput + GraphTypeValidate ) // GraphTypeMap is a mapping of human-readable string to GraphType. This @@ -20,7 +23,10 @@ const ( // graph types. var GraphTypeMap = map[string]GraphType{ "apply": GraphTypeApply, + "input": GraphTypeInput, "plan": GraphTypePlan, "plan-destroy": GraphTypePlanDestroy, + "refresh": GraphTypeRefresh, "legacy": GraphTypeLegacy, + "validate": GraphTypeValidate, } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/context_import.go b/installer/vendor/github.com/hashicorp/terraform/terraform/context_import.go index afc9a43c0c..f1d57760df 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/context_import.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/context_import.go @@ -40,8 +40,7 @@ type ImportTarget struct { // imported. func (c *Context) Import(opts *ImportOpts) (*State, error) { // Hold a lock since we can modify our own state here - v := c.acquireRun("import") - defer c.releaseRun(v) + defer c.acquireRun("import")() // Copy our own state c.state = c.state.DeepCopy() diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/debug.go b/installer/vendor/github.com/hashicorp/terraform/terraform/debug.go index 168bbd55f1..265339f636 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/debug.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/debug.go @@ -413,7 +413,7 @@ func (*DebugHook) PreProvision(ii *InstanceInfo, s string) (HookAction, error) { return HookActionContinue, nil } -func (*DebugHook) PostProvision(ii *InstanceInfo, s string) (HookAction, error) { +func (*DebugHook) PostProvision(ii *InstanceInfo, s string, err error) (HookAction, error) { if dbug == nil { return HookActionContinue, nil } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/diff.go b/installer/vendor/github.com/hashicorp/terraform/terraform/diff.go index bafb498352..a9fae6c2c8 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/diff.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/diff.go @@ -25,6 +25,9 @@ const ( DiffDestroyCreate ) +// multiVal matches the index key to a flatmapped set, list or map +var multiVal = regexp.MustCompile(`\.(#|%)$`) + // Diff trackes the changes that are necessary to apply a configuration // to an existing infrastructure. type Diff struct { @@ -364,6 +367,12 @@ type InstanceDiff struct { Destroy bool DestroyDeposed bool DestroyTainted bool + + // Meta is a simple K/V map that is stored in a diff and persisted to + // plans but otherwise is completely ignored by Terraform core. It is + // mean to be used for additional data a resource may want to pass through. + // The value here must only contain Go primitives and collections. + Meta map[string]interface{} } func (d *InstanceDiff) Lock() { d.mu.Lock() } @@ -802,7 +811,6 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) { } // search for the suffix of the base of a [computed] map, list or set. - multiVal := regexp.MustCompile(`\.(#|~#|%)$`) match := multiVal.FindStringSubmatch(k) if diffOld.NewComputed && len(match) == 2 { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go index f8a42ed470..2f6a4973e4 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go @@ -52,16 +52,6 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) { *n.CreateNew = state.ID == "" && !diff.GetDestroy() || diff.RequiresNew() } - { - // Call pre-apply hook - err := ctx.Hook(func(h Hook) (HookAction, error) { - return h.PreApply(n.Info, state, diff) - }) - if err != nil { - return nil, err - } - } - // With the completed diff, apply! log.Printf("[DEBUG] apply: %s: executing Apply", n.Info.Id) state, err := provider.Apply(n.Info, state, diff) @@ -104,6 +94,37 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) { return nil, nil } +// EvalApplyPre is an EvalNode implementation that does the pre-Apply work +type EvalApplyPre struct { + Info *InstanceInfo + State **InstanceState + Diff **InstanceDiff +} + +// TODO: test +func (n *EvalApplyPre) Eval(ctx EvalContext) (interface{}, error) { + state := *n.State + diff := *n.Diff + + // If the state is nil, make it non-nil + if state == nil { + state = new(InstanceState) + } + state.init() + + { + // Call post-apply hook + err := ctx.Hook(func(h Hook) (HookAction, error) { + return h.PreApply(n.Info, state, diff) + }) + if err != nil { + return nil, err + } + } + + return nil, nil +} + // EvalApplyPost is an EvalNode implementation that does the post-Apply work type EvalApplyPost struct { Info *InstanceInfo @@ -140,25 +161,33 @@ type EvalApplyProvisioners struct { InterpResource *Resource CreateNew *bool Error *error + + // When is the type of provisioner to run at this point + When config.ProvisionerWhen } // TODO: test func (n *EvalApplyProvisioners) Eval(ctx EvalContext) (interface{}, error) { state := *n.State - if !*n.CreateNew { + if n.CreateNew != nil && !*n.CreateNew { // If we're not creating a new resource, then don't run provisioners return nil, nil } - if len(n.Resource.Provisioners) == 0 { + provs := n.filterProvisioners() + if len(provs) == 0 { // We have no provisioners, so don't do anything return nil, nil } + // taint tells us whether to enable tainting. + taint := n.When == config.ProvisionerWhenCreate + if n.Error != nil && *n.Error != nil { - // We're already errored creating, so mark as tainted and continue - state.Tainted = true + if taint { + state.Tainted = true + } // We're already tainted, so just return out return nil, nil @@ -176,10 +205,11 @@ func (n *EvalApplyProvisioners) Eval(ctx EvalContext) (interface{}, error) { // If there are no errors, then we append it to our output error // if we have one, otherwise we just output it. - err := n.apply(ctx) + err := n.apply(ctx, provs) if err != nil { - // Provisioning failed, so mark the resource as tainted - state.Tainted = true + if taint { + state.Tainted = true + } if n.Error != nil { *n.Error = multierror.Append(*n.Error, err) @@ -201,7 +231,29 @@ func (n *EvalApplyProvisioners) Eval(ctx EvalContext) (interface{}, error) { return nil, nil } -func (n *EvalApplyProvisioners) apply(ctx EvalContext) error { +// filterProvisioners filters the provisioners on the resource to only +// the provisioners specified by the "when" option. +func (n *EvalApplyProvisioners) filterProvisioners() []*config.Provisioner { + // Fast path the zero case + if n.Resource == nil { + return nil + } + + if len(n.Resource.Provisioners) == 0 { + return nil + } + + result := make([]*config.Provisioner, 0, len(n.Resource.Provisioners)) + for _, p := range n.Resource.Provisioners { + if p.When == n.When { + result = append(result, p) + } + } + + return result +} + +func (n *EvalApplyProvisioners) apply(ctx EvalContext, provs []*config.Provisioner) error { state := *n.State // Store the original connection info, restore later @@ -210,7 +262,7 @@ func (n *EvalApplyProvisioners) apply(ctx EvalContext) error { state.Ephemeral.ConnInfo = origConnInfo }() - for _, prov := range n.Resource.Provisioners { + for _, prov := range provs { // Get the provisioner provisioner := ctx.Provisioner(prov.Type) @@ -275,19 +327,31 @@ func (n *EvalApplyProvisioners) apply(ctx EvalContext) error { // Invoke the Provisioner output := CallbackUIOutput{OutputFn: outputFn} - if err := provisioner.Apply(&output, state, provConfig); err != nil { - return err - } + applyErr := provisioner.Apply(&output, state, provConfig) - { - // Call post hook - err := ctx.Hook(func(h Hook) (HookAction, error) { - return h.PostProvision(n.Info, prov.Type) - }) - if err != nil { - return err + // Call post hook + hookErr := ctx.Hook(func(h Hook) (HookAction, error) { + return h.PostProvision(n.Info, prov.Type, applyErr) + }) + + // Handle the error before we deal with the hook + if applyErr != nil { + // Determine failure behavior + switch prov.OnFailure { + case config.ProvisionerOnFailureContinue: + log.Printf( + "[INFO] apply: %s [%s]: error during provision, continue requested", + n.Info.Id, prov.Type) + + case config.ProvisionerOnFailureFail: + return applyErr } } + + // Deal with the hook + if hookErr != nil { + return hookErr + } } return nil diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context.go index f2867511d7..a1f815b7d4 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context.go @@ -8,6 +8,10 @@ import ( // EvalContext is the interface that is given to eval nodes to execute. type EvalContext interface { + // Stopped returns a channel that is closed when evaluation is stopped + // via Terraform.Context.Stop() + Stopped() <-chan struct{} + // Path is the current module path. Path() []string diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_builtin.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_builtin.go index 032f79f9d9..3dcfb2275b 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_builtin.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_builtin.go @@ -1,6 +1,7 @@ package terraform import ( + "context" "fmt" "log" "strings" @@ -12,6 +13,9 @@ import ( // BuiltinEvalContext is an EvalContext implementation that is used by // Terraform by default. type BuiltinEvalContext struct { + // StopContext is the context used to track whether we're complete + StopContext context.Context + // PathValue is the Path that this context is operating within. PathValue []string @@ -43,6 +47,15 @@ type BuiltinEvalContext struct { once sync.Once } +func (ctx *BuiltinEvalContext) Stopped() <-chan struct{} { + // This can happen during tests. During tests, we just block forever. + if ctx.StopContext == nil { + return nil + } + + return ctx.StopContext.Done() +} + func (ctx *BuiltinEvalContext) Hook(fn func(Hook) (HookAction, error)) error { for _, h := range ctx.Hooks { action, err := fn(h) diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_mock.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_mock.go index 4f5c23bc49..4f90d5b129 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_mock.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_context_mock.go @@ -9,6 +9,9 @@ import ( // MockEvalContext is a mock version of EvalContext that can be used // for tests. type MockEvalContext struct { + StoppedCalled bool + StoppedValue <-chan struct{} + HookCalled bool HookHook Hook HookError error @@ -85,6 +88,11 @@ type MockEvalContext struct { StateLock *sync.RWMutex } +func (c *MockEvalContext) Stopped() <-chan struct{} { + c.StoppedCalled = true + return c.StoppedValue +} + func (c *MockEvalContext) Hook(fn func(Hook) (HookAction, error)) error { c.HookCalled = true if c.HookHook != nil { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go index 717d951053..6f09526a4c 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go @@ -152,6 +152,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) { }) } + // filter out ignored resources if err := n.processIgnoreChanges(diff); err != nil { return nil, err } @@ -190,72 +191,81 @@ func (n *EvalDiff) processIgnoreChanges(diff *InstanceDiff) error { return nil } - changeType := diff.ChangeType() - // If we're just creating the resource, we shouldn't alter the // Diff at all - if changeType == DiffCreate { + if diff.ChangeType() == DiffCreate { return nil } // If the resource has been tainted then we don't process ignore changes // since we MUST recreate the entire resource. - if diff.DestroyTainted { + if diff.GetDestroyTainted() { return nil } + attrs := diff.CopyAttributes() + + // get the complete set of keys we want to ignore ignorableAttrKeys := make(map[string]bool) for _, ignoredKey := range ignoreChanges { - for k := range diff.CopyAttributes() { + for k := range attrs { if ignoredKey == "*" || strings.HasPrefix(k, ignoredKey) { ignorableAttrKeys[k] = true } } } - // If we are replacing the resource, then we expect there to be a bunch of - // extraneous attribute diffs we need to filter out for the other - // non-requires-new attributes going from "" -> "configval" or "" -> - // "". Filtering these out allows us to see if we might be able to - // skip this diff altogether. - if changeType == DiffDestroyCreate { - for k, v := range diff.CopyAttributes() { - if v.Empty() || v.NewComputed { - ignorableAttrKeys[k] = true - } - } - - // Here we emulate the implementation of diff.RequiresNew() with one small - // tweak, we ignore the "id" attribute diff that gets added by EvalDiff, - // since that was added in reaction to RequiresNew being true. - requiresNewAfterIgnores := false - for k, v := range diff.CopyAttributes() { + // If the resource was being destroyed, check to see if we can ignore the + // reason for it being destroyed. + if diff.GetDestroy() { + for k, v := range attrs { if k == "id" { + // id will always be changed if we intended to replace this instance continue } - if _, ok := ignorableAttrKeys[k]; ok { + if v.Empty() || v.NewComputed { continue } - if v.RequiresNew == true { - requiresNewAfterIgnores = true + + // If any RequiresNew attribute isn't ignored, we need to keep the diff + // as-is to be able to replace the resource. + if v.RequiresNew && !ignorableAttrKeys[k] { + return nil } } - // If we still require resource replacement after ignores, we - // can't touch the diff, as all of the attributes will be - // required to process the replacement. - if requiresNewAfterIgnores { - return nil + // Now that we know that we aren't replacing the instance, we can filter + // out all the empty and computed attributes. There may be a bunch of + // extraneous attribute diffs for the other non-requires-new attributes + // going from "" -> "configval" or "" -> "". + // We must make sure any flatmapped containers are filterred (or not) as a + // whole. + containers := groupContainers(diff) + keep := map[string]bool{} + for _, v := range containers { + if v.keepDiff() { + // At least one key has changes, so list all the sibling keys + // to keep in the diff. + for k := range v { + keep[k] = true + } + } } - // Here we undo the two reactions to RequireNew in EvalDiff - the "id" - // attribute diff and the Destroy boolean field - log.Printf("[DEBUG] Removing 'id' diff and setting Destroy to false " + - "because after ignore_changes, this diff no longer requires replacement") - diff.DelAttribute("id") - diff.SetDestroy(false) + for k, v := range attrs { + if (v.Empty() || v.NewComputed) && !keep[k] { + ignorableAttrKeys[k] = true + } + } } + // Here we undo the two reactions to RequireNew in EvalDiff - the "id" + // attribute diff and the Destroy boolean field + log.Printf("[DEBUG] Removing 'id' diff and setting Destroy to false " + + "because after ignore_changes, this diff no longer requires replacement") + diff.DelAttribute("id") + diff.SetDestroy(false) + // If we didn't hit any of our early exit conditions, we can filter the diff. for k := range ignorableAttrKeys { log.Printf("[DEBUG] [EvalIgnoreChanges] %s - Ignoring diff attribute: %s", @@ -266,6 +276,46 @@ func (n *EvalDiff) processIgnoreChanges(diff *InstanceDiff) error { return nil } +// a group of key-*ResourceAttrDiff pairs from the same flatmapped container +type flatAttrDiff map[string]*ResourceAttrDiff + +// we need to keep all keys if any of them have a diff +func (f flatAttrDiff) keepDiff() bool { + for _, v := range f { + if !v.Empty() && !v.NewComputed { + return true + } + } + return false +} + +// sets, lists and maps need to be compared for diff inclusion as a whole, so +// group the flatmapped keys together for easier comparison. +func groupContainers(d *InstanceDiff) map[string]flatAttrDiff { + isIndex := multiVal.MatchString + containers := map[string]flatAttrDiff{} + attrs := d.CopyAttributes() + // we need to loop once to find the index key + for k := range attrs { + if isIndex(k) { + // add the key, always including the final dot to fully qualify it + containers[k[:len(k)-1]] = flatAttrDiff{} + } + } + + // loop again to find all the sub keys + for prefix, values := range containers { + for k, attrDiff := range attrs { + // we include the index value as well, since it could be part of the diff + if strings.HasPrefix(k, prefix) { + values[k] = attrDiff + } + } + } + + return containers +} + // EvalDiffDestroy is an EvalNode implementation that returns a plain // destroy diff. type EvalDiffDestroy struct { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_provider.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_provider.go index 61efcc2352..092fd18d83 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_provider.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_provider.go @@ -30,6 +30,11 @@ func (n *EvalBuildProviderConfig) Eval(ctx EvalContext) (interface{}, error) { // If we have a configuration set, then merge that in if input := ctx.ProviderInput(n.Provider); input != nil { + // "input" is a map of the subset of config values that were known + // during the input walk, set by EvalInputProvider. Note that + // in particular it does *not* include attributes that had + // computed values at input time; those appear *only* in + // "cfg" here. rc, err := config.NewRawConfig(input) if err != nil { return nil, err @@ -136,7 +141,21 @@ func (n *EvalInputProvider) Eval(ctx EvalContext) (interface{}, error) { // Set the input that we received so that child modules don't attempt // to ask for input again. if config != nil && len(config.Config) > 0 { - ctx.SetProviderInput(n.Name, config.Config) + // This repository of provider input results on the context doesn't + // retain config.ComputedKeys, so we need to filter those out here + // in order that later users of this data won't try to use the unknown + // value placeholder as if it were a literal value. This map is just + // of known values we've been able to complete so far; dynamic stuff + // will be merged in by EvalBuildProviderConfig on subsequent + // (post-input) walks. + confMap := config.Config + if config.ComputedKeys != nil { + for _, key := range config.ComputedKeys { + delete(confMap, key) + } + } + + ctx.SetProviderInput(n.Name, confMap) } else { ctx.SetProviderInput(n.Name, map[string]interface{}{}) } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go index 6c3c6a6202..82d81782af 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go @@ -7,6 +7,10 @@ type EvalSequence struct { func (n *EvalSequence) Eval(ctx EvalContext) (interface{}, error) { for _, n := range n.Nodes { + if n == nil { + continue + } + if _, err := EvalRaw(n, ctx); err != nil { return nil, err } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate.go index 9ae221aa1e..478aa64005 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/hashicorp/terraform/config" + "github.com/mitchellh/mapstructure" ) // EvalValidateError is the error structure returned if there were @@ -42,6 +43,7 @@ func (n *EvalValidateCount) Eval(ctx EvalContext) (interface{}, error) { c[n.Resource.RawCount.Key] = "1" count = 1 } + err = nil if count < 0 { errs = append(errs, fmt.Errorf( @@ -84,12 +86,31 @@ func (n *EvalValidateProvider) Eval(ctx EvalContext) (interface{}, error) { type EvalValidateProvisioner struct { Provisioner *ResourceProvisioner Config **ResourceConfig + ConnConfig **ResourceConfig } func (n *EvalValidateProvisioner) Eval(ctx EvalContext) (interface{}, error) { provisioner := *n.Provisioner config := *n.Config - warns, errs := provisioner.Validate(config) + var warns []string + var errs []error + + { + // Validate the provisioner's own config first + w, e := provisioner.Validate(config) + warns = append(warns, w...) + errs = append(errs, e...) + } + + { + // Now validate the connection config, which might either be from + // the provisioner block itself or inherited from the resource's + // shared connection info. + w, e := n.validateConnConfig(*n.ConnConfig) + warns = append(warns, w...) + errs = append(errs, e...) + } + if len(warns) == 0 && len(errs) == 0 { return nil, nil } @@ -100,6 +121,64 @@ func (n *EvalValidateProvisioner) Eval(ctx EvalContext) (interface{}, error) { } } +func (n *EvalValidateProvisioner) validateConnConfig(connConfig *ResourceConfig) (warns []string, errs []error) { + // We can't comprehensively validate the connection config since its + // final structure is decided by the communicator and we can't instantiate + // that until we have a complete instance state. However, we *can* catch + // configuration keys that are not valid for *any* communicator, catching + // typos early rather than waiting until we actually try to run one of + // the resource's provisioners. + + type connConfigSuperset struct { + // All attribute types are interface{} here because at this point we + // may still have unresolved interpolation expressions, which will + // appear as strings regardless of the final goal type. + + Type interface{} `mapstructure:"type"` + User interface{} `mapstructure:"user"` + Password interface{} `mapstructure:"password"` + Host interface{} `mapstructure:"host"` + Port interface{} `mapstructure:"port"` + Timeout interface{} `mapstructure:"timeout"` + ScriptPath interface{} `mapstructure:"script_path"` + + // For type=ssh only (enforced in ssh communicator) + PrivateKey interface{} `mapstructure:"private_key"` + Agent interface{} `mapstructure:"agent"` + BastionHost interface{} `mapstructure:"bastion_host"` + BastionPort interface{} `mapstructure:"bastion_port"` + BastionUser interface{} `mapstructure:"bastion_user"` + BastionPassword interface{} `mapstructure:"bastion_password"` + BastionPrivateKey interface{} `mapstructure:"bastion_private_key"` + + // For type=winrm only (enforced in winrm communicator) + HTTPS interface{} `mapstructure:"https"` + Insecure interface{} `mapstructure:"insecure"` + CACert interface{} `mapstructure:"cacert"` + } + + var metadata mapstructure.Metadata + decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ + Metadata: &metadata, + Result: &connConfigSuperset{}, // result is disregarded; we only care about unused keys + }) + if err != nil { + // should never happen + errs = append(errs, err) + return + } + + if err := decoder.Decode(connConfig.Config); err != nil { + errs = append(errs, err) + return + } + + for _, attrName := range metadata.Unused { + errs = append(errs, fmt.Errorf("unknown 'connection' argument %q", attrName)) + } + return +} + // EvalValidateResource is an EvalNode implementation that validates // the configuration of a resource. type EvalValidateResource struct { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate_selfref.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate_selfref.go new file mode 100644 index 0000000000..ae4436a2ee --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_validate_selfref.go @@ -0,0 +1,74 @@ +package terraform + +import ( + "fmt" + + "github.com/hashicorp/terraform/config" +) + +// EvalValidateResourceSelfRef is an EvalNode implementation that validates that +// a configuration doesn't contain a reference to the resource itself. +// +// This must be done prior to interpolating configuration in order to avoid +// any infinite loop scenarios. +type EvalValidateResourceSelfRef struct { + Addr **ResourceAddress + Config **config.RawConfig +} + +func (n *EvalValidateResourceSelfRef) Eval(ctx EvalContext) (interface{}, error) { + addr := *n.Addr + conf := *n.Config + + // Go through the variables and find self references + var errs []error + for k, raw := range conf.Variables { + rv, ok := raw.(*config.ResourceVariable) + if !ok { + continue + } + + // Build an address from the variable + varAddr := &ResourceAddress{ + Path: addr.Path, + Mode: rv.Mode, + Type: rv.Type, + Name: rv.Name, + Index: rv.Index, + InstanceType: TypePrimary, + } + + // If the variable access is a multi-access (*), then we just + // match the index so that we'll match our own addr if everything + // else matches. + if rv.Multi && rv.Index == -1 { + varAddr.Index = addr.Index + } + + // This is a weird thing where ResourceAddres has index "-1" when + // index isn't set at all. This means index "0" for resource access. + // So, if we have this scenario, just set our varAddr to -1 so it + // matches. + if addr.Index == -1 && varAddr.Index == 0 { + varAddr.Index = -1 + } + + // If the addresses match, then this is a self reference + if varAddr.Equals(addr) && varAddr.Index == addr.Index { + errs = append(errs, fmt.Errorf( + "%s: self reference not allowed: %q", + addr, k)) + } + } + + // If no errors, no errors! + if len(errs) == 0 { + return nil, nil + } + + // Wrap the errors in the proper wrapper so we can handle validation + // formatting properly upstream. + return nil, &EvalValidateError{ + Errors: errs, + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_variable.go b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_variable.go index 47bd2ea2b6..e39a33c2a9 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/eval_variable.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/eval_variable.go @@ -114,7 +114,6 @@ type EvalVariableBlock struct { VariableValues map[string]interface{} } -// TODO: test func (n *EvalVariableBlock) Eval(ctx EvalContext) (interface{}, error) { // Clear out the existing mapping for k, _ := range n.VariableValues { @@ -124,22 +123,27 @@ func (n *EvalVariableBlock) Eval(ctx EvalContext) (interface{}, error) { // Get our configuration rc := *n.Config for k, v := range rc.Config { - var vString string - if err := hilmapstructure.WeakDecode(v, &vString); err == nil { - n.VariableValues[k] = vString - continue - } - - var vMap map[string]interface{} - if err := hilmapstructure.WeakDecode(v, &vMap); err == nil { - n.VariableValues[k] = vMap - continue - } + vKind := reflect.ValueOf(v).Type().Kind() - var vSlice []interface{} - if err := hilmapstructure.WeakDecode(v, &vSlice); err == nil { - n.VariableValues[k] = vSlice - continue + switch vKind { + case reflect.Slice: + var vSlice []interface{} + if err := hilmapstructure.WeakDecode(v, &vSlice); err == nil { + n.VariableValues[k] = vSlice + continue + } + case reflect.Map: + var vMap map[string]interface{} + if err := hilmapstructure.WeakDecode(v, &vMap); err == nil { + n.VariableValues[k] = vMap + continue + } + default: + var vString string + if err := hilmapstructure.WeakDecode(v, &vString); err == nil { + n.VariableValues[k] = vString + continue + } } return nil, fmt.Errorf("Variable value for %s is not a string, list or map type", k) @@ -174,9 +178,15 @@ func (n *EvalVariableBlock) setUnknownVariableValueForPath(path string) error { // Otherwise find the correct point in the tree and then set to unknown var current interface{} = n.VariableValues[pathComponents[0]] for i := 1; i < len(pathComponents); i++ { - switch current.(type) { - case []interface{}, []map[string]interface{}: - tCurrent := current.([]interface{}) + switch tCurrent := current.(type) { + case []interface{}: + index, err := strconv.Atoi(pathComponents[i]) + if err != nil { + return fmt.Errorf("Cannot convert %s to slice index in path %s", + pathComponents[i], path) + } + current = tCurrent[index] + case []map[string]interface{}: index, err := strconv.Atoi(pathComponents[i]) if err != nil { return fmt.Errorf("Cannot convert %s to slice index in path %s", @@ -184,7 +194,6 @@ func (n *EvalVariableBlock) setUnknownVariableValueForPath(path string) error { } current = tCurrent[index] case map[string]interface{}: - tCurrent := current.(map[string]interface{}) if val, hasVal := tCurrent[pathComponents[i]]; hasVal { current = val continue diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph.go index 60258490dd..48ce6a3366 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph.go @@ -5,7 +5,6 @@ import ( "log" "runtime/debug" "strings" - "sync" "github.com/hashicorp/terraform/dag" ) @@ -17,8 +16,7 @@ const RootModuleName = "root" var RootModulePath = []string{RootModuleName} // Graph represents the graph that Terraform uses to represent resources -// and their dependencies. Each graph represents only one module, but it -// can contain further modules, which themselves have their own graph. +// and their dependencies. type Graph struct { // Graph is the actual DAG. This is embedded so you can call the DAG // methods directly. @@ -29,179 +27,16 @@ type Graph struct { // RootModuleName Path []string - // annotations are the annotations that are added to vertices. Annotations - // are arbitrary metadata taht is used for various logic. Annotations - // should have unique keys that are referenced via constants. - annotations map[dag.Vertex]map[string]interface{} - - // dependableMap is a lookaside table for fast lookups for connecting - // dependencies by their GraphNodeDependable value to avoid O(n^3)-like - // situations and turn them into O(1) with respect to the number of new - // edges. - dependableMap map[string]dag.Vertex - // debugName is a name for reference in the debug output. This is usually // to indicate what topmost builder was, and if this graph is a shadow or // not. debugName string - - once sync.Once } func (g *Graph) DirectedGraph() dag.Grapher { return &g.AcyclicGraph } -// Annotations returns the annotations that are configured for the -// given vertex. The map is guaranteed to be non-nil but may be empty. -// -// The returned map may be modified to modify the annotations of the -// vertex. -func (g *Graph) Annotations(v dag.Vertex) map[string]interface{} { - g.once.Do(g.init) - - // If this vertex isn't in the graph, then just return an empty map - if !g.HasVertex(v) { - return map[string]interface{}{} - } - - // Get the map, if it doesn't exist yet then initialize it - m, ok := g.annotations[v] - if !ok { - m = make(map[string]interface{}) - g.annotations[v] = m - } - - return m -} - -// Add is the same as dag.Graph.Add. -func (g *Graph) Add(v dag.Vertex) dag.Vertex { - g.once.Do(g.init) - - // Call upwards to add it to the actual graph - g.Graph.Add(v) - - // If this is a depend-able node, then store the lookaside info - if dv, ok := v.(GraphNodeDependable); ok { - for _, n := range dv.DependableName() { - g.dependableMap[n] = v - } - } - - // If this initializes annotations, then do that - if av, ok := v.(GraphNodeAnnotationInit); ok { - as := g.Annotations(v) - for k, v := range av.AnnotationInit() { - as[k] = v - } - } - - return v -} - -// Remove is the same as dag.Graph.Remove -func (g *Graph) Remove(v dag.Vertex) dag.Vertex { - g.once.Do(g.init) - - // If this is a depend-able node, then remove the lookaside info - if dv, ok := v.(GraphNodeDependable); ok { - for _, n := range dv.DependableName() { - delete(g.dependableMap, n) - } - } - - // Remove the annotations - delete(g.annotations, v) - - // Call upwards to remove it from the actual graph - return g.Graph.Remove(v) -} - -// Replace is the same as dag.Graph.Replace -func (g *Graph) Replace(o, n dag.Vertex) bool { - g.once.Do(g.init) - - // Go through and update our lookaside to point to the new vertex - for k, v := range g.dependableMap { - if v == o { - if _, ok := n.(GraphNodeDependable); ok { - g.dependableMap[k] = n - } else { - delete(g.dependableMap, k) - } - } - } - - // Move the annotation if it exists - if m, ok := g.annotations[o]; ok { - g.annotations[n] = m - delete(g.annotations, o) - } - - return g.Graph.Replace(o, n) -} - -// ConnectDependent connects a GraphNodeDependent to all of its -// GraphNodeDependables. It returns the list of dependents it was -// unable to connect to. -func (g *Graph) ConnectDependent(raw dag.Vertex) []string { - v, ok := raw.(GraphNodeDependent) - if !ok { - return nil - } - - return g.ConnectTo(v, v.DependentOn()) -} - -// ConnectDependents goes through the graph, connecting all the -// GraphNodeDependents to GraphNodeDependables. This is safe to call -// multiple times. -// -// To get details on whether dependencies could be found/made, the more -// specific ConnectDependent should be used. -func (g *Graph) ConnectDependents() { - for _, v := range g.Vertices() { - if dv, ok := v.(GraphNodeDependent); ok { - g.ConnectDependent(dv) - } - } -} - -// ConnectFrom creates an edge by finding the source from a DependableName -// and connecting it to the specific vertex. -func (g *Graph) ConnectFrom(source string, target dag.Vertex) { - g.once.Do(g.init) - - if source := g.dependableMap[source]; source != nil { - g.Connect(dag.BasicEdge(source, target)) - } -} - -// ConnectTo connects a vertex to a raw string of targets that are the -// result of DependableName, and returns the list of targets that are missing. -func (g *Graph) ConnectTo(v dag.Vertex, targets []string) []string { - g.once.Do(g.init) - - var missing []string - for _, t := range targets { - if dest := g.dependableMap[t]; dest != nil { - g.Connect(dag.BasicEdge(v, dest)) - } else { - missing = append(missing, t) - } - } - - return missing -} - -// Dependable finds the vertices in the graph that have the given dependable -// names and returns them. -func (g *Graph) Dependable(n string) dag.Vertex { - // TODO: do we need this? - return nil -} - // Walk walks the graph with the given walker for callbacks. The graph // will be walked with full parallelism, so the walker should expect // to be called in concurrently. @@ -209,16 +44,6 @@ func (g *Graph) Walk(walker GraphWalker) error { return g.walk(walker) } -func (g *Graph) init() { - if g.annotations == nil { - g.annotations = make(map[dag.Vertex]map[string]interface{}) - } - - if g.dependableMap == nil { - g.dependableMap = make(map[string]dag.Vertex) - } -} - func (g *Graph) walk(walker GraphWalker) error { // The callbacks for enter/exiting a graph ctx := walker.EnterPath(g.Path) @@ -345,30 +170,3 @@ func (g *Graph) walk(walker GraphWalker) error { return g.AcyclicGraph.Walk(walkFn) } - -// GraphNodeAnnotationInit is an interface that allows a node to -// initialize it's annotations. -// -// AnnotationInit will be called _once_ when the node is added to a -// graph for the first time and is expected to return it's initial -// annotations. -type GraphNodeAnnotationInit interface { - AnnotationInit() map[string]interface{} -} - -// GraphNodeDependable is an interface which says that a node can be -// depended on (an edge can be placed between this node and another) according -// to the well-known name returned by DependableName. -// -// DependableName can return multiple names it is known by. -type GraphNodeDependable interface { - DependableName() []string -} - -// GraphNodeDependent is an interface which says that a node depends -// on another GraphNodeDependable by some name. By implementing this -// interface, Graph.ConnectDependents() can be called multiple times -// safely and efficiently. -type GraphNodeDependent interface { - DependentOn() []string -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder.go index fb850df18b..6374bb9045 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder.go @@ -4,8 +4,6 @@ import ( "fmt" "log" "strings" - - "github.com/hashicorp/terraform/config/module" ) // GraphBuilder is an interface that can be implemented and used with @@ -77,160 +75,3 @@ func (b *BasicGraphBuilder) Build(path []string) (*Graph, error) { return g, nil } - -// BuiltinGraphBuilder is responsible for building the complete graph that -// Terraform uses for execution. It is an opinionated builder that defines -// the step order required to build a complete graph as is used and expected -// by Terraform. -// -// If you require a custom graph, you'll have to build it up manually -// on your own by building a new GraphBuilder implementation. -type BuiltinGraphBuilder struct { - // Root is the root module of the graph to build. - Root *module.Tree - - // Diff is the diff. The proper module diffs will be looked up. - Diff *Diff - - // State is the global state. The proper module states will be looked - // up by graph path. - State *State - - // Providers is the list of providers supported. - Providers []string - - // Provisioners is the list of provisioners supported. - Provisioners []string - - // Targets is the user-specified list of resources to target. - Targets []string - - // Destroy is set to true when we're in a `terraform destroy` or a - // `terraform plan -destroy` - Destroy bool - - // Determines whether the GraphBuilder should perform graph validation before - // returning the Graph. Generally you want this to be done, except when you'd - // like to inspect a problematic graph. - Validate bool - - // Verbose is set to true when the graph should be built "worst case", - // skipping any prune steps. This is used for early cycle detection during - // Validate and for manual inspection via `terraform graph -verbose`. - Verbose bool -} - -// Build builds the graph according to the steps returned by Steps. -func (b *BuiltinGraphBuilder) Build(path []string) (*Graph, error) { - basic := &BasicGraphBuilder{ - Steps: b.Steps(path), - Validate: b.Validate, - Name: "BuiltinGraphBuilder", - } - - return basic.Build(path) -} - -// Steps returns the ordered list of GraphTransformers that must be executed -// to build a complete graph. -func (b *BuiltinGraphBuilder) Steps(path []string) []GraphTransformer { - steps := []GraphTransformer{ - // Create all our resources from the configuration and state - &ConfigTransformerOld{Module: b.Root}, - &OrphanTransformer{ - State: b.State, - Module: b.Root, - }, - - // Output-related transformations - &AddOutputOrphanTransformer{State: b.State}, - - // Provider-related transformations - &MissingProviderTransformer{Providers: b.Providers}, - &ProviderTransformer{}, - &DisableProviderTransformerOld{}, - - // Provisioner-related transformations - &MissingProvisionerTransformer{Provisioners: b.Provisioners}, - &ProvisionerTransformer{}, - - // Run our vertex-level transforms - &VertexTransformer{ - Transforms: []GraphVertexTransformer{ - // Expand any statically expanded nodes, such as module graphs - &ExpandTransform{ - Builder: b, - }, - }, - }, - - // Flatten stuff - &FlattenTransformer{}, - - // Make sure all the connections that are proxies are connected through - &ProxyTransformer{}, - } - - // If we're on the root path, then we do a bunch of other stuff. - // We don't do the following for modules. - if len(path) <= 1 { - steps = append(steps, - // Optionally reduces the graph to a user-specified list of targets and - // their dependencies. - &TargetsTransformer{Targets: b.Targets, Destroy: b.Destroy}, - - // Create orphan output nodes - &OrphanOutputTransformer{Module: b.Root, State: b.State}, - - // Prune the providers. This must happen only once because flattened - // modules might depend on empty providers. - &PruneProviderTransformer{}, - - // Create the destruction nodes - &DestroyTransformer{FullDestroy: b.Destroy}, - b.conditional(&conditionalOpts{ - If: func() bool { return !b.Destroy }, - Then: &CreateBeforeDestroyTransformer{}, - }), - b.conditional(&conditionalOpts{ - If: func() bool { return !b.Verbose }, - Then: &PruneDestroyTransformer{Diff: b.Diff, State: b.State}, - }), - - // Remove the noop nodes - &PruneNoopTransformer{Diff: b.Diff, State: b.State}, - - // Insert nodes to close opened plugin connections - &CloseProviderTransformer{}, - &CloseProvisionerTransformer{}, - - // Perform the transitive reduction to make our graph a bit - // more sane if possible (it usually is possible). - &TransitiveReductionTransformer{}, - ) - } - - // Make sure we have a single root - steps = append(steps, &RootTransformer{}) - - // Remove nils - for i, s := range steps { - if s == nil { - steps = append(steps[:i], steps[i+1:]...) - } - } - - return steps -} - -type conditionalOpts struct { - If func() bool - Then GraphTransformer -} - -func (b *BuiltinGraphBuilder) conditional(o *conditionalOpts) GraphTransformer { - if o.If != nil && o.Then != nil && o.If() { - return o.Then - } - return nil -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_apply.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_apply.go index ec413a9374..38a90f2775 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_apply.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_apply.go @@ -102,13 +102,8 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer { ), // Provisioner-related transformations - GraphTransformIf( - func() bool { return !b.Destroy }, - GraphTransformMulti( - &MissingProvisionerTransformer{Provisioners: b.Provisioners}, - &ProvisionerTransformer{}, - ), - ), + &MissingProvisionerTransformer{Provisioners: b.Provisioners}, + &ProvisionerTransformer{}, // Add root variables &RootVariableTransformer{Module: b.Module}, @@ -128,6 +123,10 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer { // Target &TargetsTransformer{Targets: b.Targets}, + // Close opened plugin connections + &CloseProviderTransformer{}, + &CloseProvisionerTransformer{}, + // Single root &RootTransformer{}, } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go index 7fa76ded7c..7070c59e40 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go @@ -62,6 +62,9 @@ func (b *ImportGraphBuilder) Steps() []GraphTransformer { // This validates that the providers only depend on variables &ImportProviderValidateTransformer{}, + // Close opened plugin connections + &CloseProviderTransformer{}, + // Single root &RootTransformer{}, diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_input.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_input.go new file mode 100644 index 0000000000..0df48cdb87 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_input.go @@ -0,0 +1,27 @@ +package terraform + +import ( + "github.com/hashicorp/terraform/dag" +) + +// InputGraphBuilder creates the graph for the input operation. +// +// Unlike other graph builders, this is a function since it currently modifies +// and is based on the PlanGraphBuilder. The PlanGraphBuilder passed in will be +// modified and should not be used for any other operations. +func InputGraphBuilder(p *PlanGraphBuilder) GraphBuilder { + // We're going to customize the concrete functions + p.CustomConcrete = true + + // Set the provider to the normal provider. This will ask for input. + p.ConcreteProvider = func(a *NodeAbstractProvider) dag.Vertex { + return &NodeApplyableProvider{ + NodeAbstractProvider: a, + } + } + + // We purposely don't set any more concrete fields since the remainder + // should be no-ops. + + return p +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_plan.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_plan.go index 35961ee466..02d869700e 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_plan.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_plan.go @@ -1,6 +1,8 @@ package terraform import ( + "sync" + "github.com/hashicorp/terraform/config/module" "github.com/hashicorp/terraform/dag" ) @@ -26,6 +28,9 @@ type PlanGraphBuilder struct { // Providers is the list of providers supported. Providers []string + // Provisioners is the list of provisioners supported. + Provisioners []string + // Targets are resources to target Targets []string @@ -34,6 +39,16 @@ type PlanGraphBuilder struct { // Validate will do structural validation of the graph. Validate bool + + // CustomConcrete can be set to customize the node types created + // for various parts of the plan. This is useful in order to customize + // the plan behavior. + CustomConcrete bool + ConcreteProvider ConcreteProviderNodeFunc + ConcreteResource ConcreteResourceNodeFunc + ConcreteResourceOrphan ConcreteResourceNodeFunc + + once sync.Once } // See GraphBuilder @@ -47,29 +62,12 @@ func (b *PlanGraphBuilder) Build(path []string) (*Graph, error) { // See GraphBuilder func (b *PlanGraphBuilder) Steps() []GraphTransformer { - // Custom factory for creating providers. - concreteProvider := func(a *NodeAbstractProvider) dag.Vertex { - return &NodeApplyableProvider{ - NodeAbstractProvider: a, - } - } - - concreteResource := func(a *NodeAbstractResource) dag.Vertex { - return &NodePlannableResource{ - NodeAbstractResource: a, - } - } - - concreteResourceOrphan := func(a *NodeAbstractResource) dag.Vertex { - return &NodePlannableResourceOrphan{ - NodeAbstractResource: a, - } - } + b.once.Do(b.init) steps := []GraphTransformer{ // Creates all the resources represented in the config &ConfigTransformer{ - Concrete: concreteResource, + Concrete: b.ConcreteResource, Module: b.Module, }, @@ -78,7 +76,7 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { // Add orphan resources &OrphanResourceTransformer{ - Concrete: concreteResourceOrphan, + Concrete: b.ConcreteResourceOrphan, State: b.State, Module: b.Module, }, @@ -93,12 +91,21 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { &RootVariableTransformer{Module: b.Module}, // Create all the providers - &MissingProviderTransformer{Providers: b.Providers, Concrete: concreteProvider}, + &MissingProviderTransformer{Providers: b.Providers, Concrete: b.ConcreteProvider}, &ProviderTransformer{}, &DisableProviderTransformer{}, &ParentProviderTransformer{}, &AttachProviderConfigTransformer{Module: b.Module}, + // Provisioner-related transformations. Only add these if requested. + GraphTransformIf( + func() bool { return b.Provisioners != nil }, + GraphTransformMulti( + &MissingProvisionerTransformer{Provisioners: b.Provisioners}, + &ProvisionerTransformer{}, + ), + ), + // Add module variables &ModuleVariableTransformer{Module: b.Module}, @@ -109,6 +116,10 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { // Target &TargetsTransformer{Targets: b.Targets}, + // Close opened plugin connections + &CloseProviderTransformer{}, + &CloseProvisionerTransformer{}, + // Single root &RootTransformer{}, } @@ -121,3 +132,30 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { return steps } + +func (b *PlanGraphBuilder) init() { + // Do nothing if the user requests customizing the fields + if b.CustomConcrete { + return + } + + b.ConcreteProvider = func(a *NodeAbstractProvider) dag.Vertex { + return &NodeApplyableProvider{ + NodeAbstractProvider: a, + } + } + + b.ConcreteResource = func(a *NodeAbstractResource) dag.Vertex { + return &NodePlannableResource{ + NodeAbstractCountResource: &NodeAbstractCountResource{ + NodeAbstractResource: a, + }, + } + } + + b.ConcreteResourceOrphan = func(a *NodeAbstractResource) dag.Vertex { + return &NodePlannableResourceOrphan{ + NodeAbstractResource: a, + } + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_refresh.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_refresh.go new file mode 100644 index 0000000000..88ae3380c4 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_refresh.go @@ -0,0 +1,132 @@ +package terraform + +import ( + "github.com/hashicorp/terraform/config" + "github.com/hashicorp/terraform/config/module" + "github.com/hashicorp/terraform/dag" +) + +// RefreshGraphBuilder implements GraphBuilder and is responsible for building +// a graph for refreshing (updating the Terraform state). +// +// The primary difference between this graph and others: +// +// * Based on the state since it represents the only resources that +// need to be refreshed. +// +// * Ignores lifecycle options since no lifecycle events occur here. This +// simplifies the graph significantly since complex transforms such as +// create-before-destroy can be completely ignored. +// +type RefreshGraphBuilder struct { + // Module is the root module for the graph to build. + Module *module.Tree + + // State is the current state + State *State + + // Providers is the list of providers supported. + Providers []string + + // Targets are resources to target + Targets []string + + // DisableReduce, if true, will not reduce the graph. Great for testing. + DisableReduce bool + + // Validate will do structural validation of the graph. + Validate bool +} + +// See GraphBuilder +func (b *RefreshGraphBuilder) Build(path []string) (*Graph, error) { + return (&BasicGraphBuilder{ + Steps: b.Steps(), + Validate: b.Validate, + Name: "RefreshGraphBuilder", + }).Build(path) +} + +// See GraphBuilder +func (b *RefreshGraphBuilder) Steps() []GraphTransformer { + // Custom factory for creating providers. + concreteProvider := func(a *NodeAbstractProvider) dag.Vertex { + return &NodeApplyableProvider{ + NodeAbstractProvider: a, + } + } + + concreteResource := func(a *NodeAbstractResource) dag.Vertex { + return &NodeRefreshableResource{ + NodeAbstractResource: a, + } + } + + concreteDataResource := func(a *NodeAbstractResource) dag.Vertex { + return &NodeRefreshableDataResource{ + NodeAbstractCountResource: &NodeAbstractCountResource{ + NodeAbstractResource: a, + }, + } + } + + steps := []GraphTransformer{ + // Creates all the resources represented in the state + &StateTransformer{ + Concrete: concreteResource, + State: b.State, + }, + + // Creates all the data resources that aren't in the state + &ConfigTransformer{ + Concrete: concreteDataResource, + Module: b.Module, + Unique: true, + ModeFilter: true, + Mode: config.DataResourceMode, + }, + + // Attach the state + &AttachStateTransformer{State: b.State}, + + // Attach the configuration to any resources + &AttachResourceConfigTransformer{Module: b.Module}, + + // Add root variables + &RootVariableTransformer{Module: b.Module}, + + // Create all the providers + &MissingProviderTransformer{Providers: b.Providers, Concrete: concreteProvider}, + &ProviderTransformer{}, + &DisableProviderTransformer{}, + &ParentProviderTransformer{}, + &AttachProviderConfigTransformer{Module: b.Module}, + + // Add the outputs + &OutputTransformer{Module: b.Module}, + + // Add module variables + &ModuleVariableTransformer{Module: b.Module}, + + // Connect so that the references are ready for targeting. We'll + // have to connect again later for providers and so on. + &ReferenceTransformer{}, + + // Target + &TargetsTransformer{Targets: b.Targets}, + + // Close opened plugin connections + &CloseProviderTransformer{}, + + // Single root + &RootTransformer{}, + } + + if !b.DisableReduce { + // Perform the transitive reduction to make our graph a bit + // more sane if possible (it usually is possible). + steps = append(steps, &TransitiveReductionTransformer{}) + } + + return steps +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_validate.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_validate.go new file mode 100644 index 0000000000..645ec7be96 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_builder_validate.go @@ -0,0 +1,36 @@ +package terraform + +import ( + "github.com/hashicorp/terraform/dag" +) + +// ValidateGraphBuilder creates the graph for the validate operation. +// +// ValidateGraphBuilder is based on the PlanGraphBuilder. We do this so that +// we only have to validate what we'd normally plan anyways. The +// PlanGraphBuilder given will be modified so it shouldn't be used for anything +// else after calling this function. +func ValidateGraphBuilder(p *PlanGraphBuilder) GraphBuilder { + // We're going to customize the concrete functions + p.CustomConcrete = true + + // Set the provider to the normal provider. This will ask for input. + p.ConcreteProvider = func(a *NodeAbstractProvider) dag.Vertex { + return &NodeApplyableProvider{ + NodeAbstractProvider: a, + } + } + + p.ConcreteResource = func(a *NodeAbstractResource) dag.Vertex { + return &NodeValidatableResource{ + NodeAbstractCountResource: &NodeAbstractCountResource{ + NodeAbstractResource: a, + }, + } + } + + // We purposely don't set any other concrete types since they don't + // require validation. + + return p +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node.go deleted file mode 100644 index 57d565ca27..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node.go +++ /dev/null @@ -1,37 +0,0 @@ -package terraform - -import ( - "github.com/hashicorp/terraform/dag" -) - -// graphNodeConfig is an interface that all graph nodes for the -// configuration graph need to implement in order to build the variable -// dependencies properly. -type graphNodeConfig interface { - dag.NamedVertex - - // All graph nodes should be dependent on other things, and able to - // be depended on. - GraphNodeDependable - GraphNodeDependent - - // ConfigType returns the type of thing in the configuration that - // this node represents, such as a resource, module, etc. - ConfigType() GraphNodeConfigType -} - -// GraphNodeAddressable is an interface that all graph nodes for the -// configuration graph need to implement in order to be be addressed / targeted -// properly. -type GraphNodeAddressable interface { - ResourceAddress() *ResourceAddress -} - -// GraphNodeTargetable is an interface for graph nodes to implement when they -// need to be told about incoming targets. This is useful for nodes that need -// to respect targets as they dynamically expand. Note that the list of targets -// provided will contain every target provided, and each implementing graph -// node must filter this list to targets considered relevant. -type GraphNodeTargetable interface { - SetTargets([]ResourceAddress) -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_module.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_module.go deleted file mode 100644 index 8a6b522019..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_module.go +++ /dev/null @@ -1,215 +0,0 @@ -package terraform - -import ( - "fmt" - "strings" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/config/module" - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeConfigModule represents a module within the configuration graph. -type GraphNodeConfigModule struct { - Path []string - Module *config.Module - Tree *module.Tree -} - -func (n *GraphNodeConfigModule) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeModule -} - -func (n *GraphNodeConfigModule) DependableName() []string { - config := n.Tree.Config() - - result := make([]string, 1, len(config.Outputs)+1) - result[0] = n.Name() - for _, o := range config.Outputs { - result = append(result, fmt.Sprintf("%s.output.%s", n.Name(), o.Name)) - } - - return result -} - -func (n *GraphNodeConfigModule) DependentOn() []string { - vars := n.Module.RawConfig.Variables - result := make([]string, 0, len(vars)) - for _, v := range vars { - if vn := varNameForVar(v); vn != "" { - result = append(result, vn) - } - } - - return result -} - -func (n *GraphNodeConfigModule) Name() string { - return fmt.Sprintf("module.%s", n.Module.Name) -} - -// GraphNodeExpandable -func (n *GraphNodeConfigModule) Expand(b GraphBuilder) (GraphNodeSubgraph, error) { - // Build the graph first - graph, err := b.Build(n.Path) - if err != nil { - return nil, err - } - - { - // Add the destroy marker to the graph - t := &ModuleDestroyTransformerOld{} - if err := t.Transform(graph); err != nil { - return nil, err - } - } - - // Build the actual subgraph node - return &graphNodeModuleExpanded{ - Original: n, - Graph: graph, - Variables: make(map[string]interface{}), - }, nil -} - -// GraphNodeExpandable -func (n *GraphNodeConfigModule) ProvidedBy() []string { - // Build up the list of providers by simply going over our configuration - // to find the providers that are configured there as well as the - // providers that the resources use. - config := n.Tree.Config() - providers := make(map[string]struct{}) - for _, p := range config.ProviderConfigs { - providers[p.Name] = struct{}{} - } - for _, r := range config.Resources { - providers[resourceProvider(r.Type, r.Provider)] = struct{}{} - } - - // Turn the map into a string. This makes sure that the list is - // de-dupped since we could be going over potentially many resources. - result := make([]string, 0, len(providers)) - for p, _ := range providers { - result = append(result, p) - } - - return result -} - -// graphNodeModuleExpanded represents a module where the graph has -// been expanded. It stores the graph of the module as well as a reference -// to the map of variables. -type graphNodeModuleExpanded struct { - Original *GraphNodeConfigModule - Graph *Graph - - // Variables is a map of the input variables. This reference should - // be shared with ModuleInputTransformer in order to create a connection - // where the variables are set properly. - Variables map[string]interface{} -} - -func (n *graphNodeModuleExpanded) Name() string { - return fmt.Sprintf("%s (expanded)", dag.VertexName(n.Original)) -} - -func (n *graphNodeModuleExpanded) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeModule -} - -// GraphNodeDependable -func (n *graphNodeModuleExpanded) DependableName() []string { - return n.Original.DependableName() -} - -// GraphNodeDependent -func (n *graphNodeModuleExpanded) DependentOn() []string { - return n.Original.DependentOn() -} - -// GraphNodeDotter impl. -func (n *graphNodeModuleExpanded) DotNode(name string, opts *dag.DotOpts) *dag.DotNode { - return &dag.DotNode{ - Name: name, - Attrs: map[string]string{ - "label": dag.VertexName(n.Original), - "shape": "component", - }, - } -} - -// GraphNodeEvalable impl. -func (n *graphNodeModuleExpanded) EvalTree() EvalNode { - var resourceConfig *ResourceConfig - return &EvalSequence{ - Nodes: []EvalNode{ - &EvalInterpolate{ - Config: n.Original.Module.RawConfig, - Output: &resourceConfig, - }, - - &EvalVariableBlock{ - Config: &resourceConfig, - VariableValues: n.Variables, - }, - }, - } -} - -// GraphNodeFlattenable impl. -func (n *graphNodeModuleExpanded) FlattenGraph() *Graph { - graph := n.Subgraph().(*Graph) - input := n.Original.Module.RawConfig - - // Go over each vertex and do some modifications to the graph for - // flattening. We have to skip some nodes (graphNodeModuleSkippable) - // as well as setup the variable values. - for _, v := range graph.Vertices() { - // If this is a variable, then look it up in the raw configuration. - // If it exists in the raw configuration, set the value of it. - if vn, ok := v.(*GraphNodeConfigVariable); ok && input != nil { - key := vn.VariableName() - if v, ok := input.Raw[key]; ok { - config, err := config.NewRawConfig(map[string]interface{}{ - key: v, - }) - if err != nil { - // This shouldn't happen because it is already in - // a RawConfig above meaning it worked once before. - panic(err) - } - - // Set the variable value so it is interpolated properly. - // Also set the module so we set the value on it properly. - vn.Module = graph.Path[len(graph.Path)-1] - vn.Value = config - } - } - } - - return graph -} - -// GraphNodeSubgraph impl. -func (n *graphNodeModuleExpanded) Subgraph() dag.Grapher { - return n.Graph -} - -func modulePrefixStr(p []string) string { - parts := make([]string, 0, len(p)*2) - for _, p := range p[1:] { - parts = append(parts, "module", p) - } - - return strings.Join(parts, ".") -} - -func modulePrefixList(result []string, prefix string) []string { - if prefix != "" { - for i, v := range result { - result[i] = fmt.Sprintf("%s.%s", prefix, v) - } - } - - return result -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_output.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_output.go deleted file mode 100644 index 0704a0cb75..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_output.go +++ /dev/null @@ -1,106 +0,0 @@ -package terraform - -import ( - "fmt" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeConfigOutput represents an output configured within the -// configuration. -type GraphNodeConfigOutput struct { - Output *config.Output -} - -func (n *GraphNodeConfigOutput) Name() string { - return fmt.Sprintf("output.%s", n.Output.Name) -} - -func (n *GraphNodeConfigOutput) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeOutput -} - -func (n *GraphNodeConfigOutput) OutputName() string { - return n.Output.Name -} - -func (n *GraphNodeConfigOutput) DependableName() []string { - return []string{n.Name()} -} - -func (n *GraphNodeConfigOutput) DependentOn() []string { - vars := n.Output.RawConfig.Variables - result := make([]string, 0, len(vars)) - for _, v := range vars { - if vn := varNameForVar(v); vn != "" { - result = append(result, vn) - } - } - - return result -} - -// GraphNodeEvalable impl. -func (n *GraphNodeConfigOutput) EvalTree() EvalNode { - return &EvalOpFilter{ - Ops: []walkOperation{walkRefresh, walkPlan, walkApply, - walkDestroy, walkInput, walkValidate}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalWriteOutput{ - Name: n.Output.Name, - Sensitive: n.Output.Sensitive, - Value: n.Output.RawConfig, - }, - }, - }, - } -} - -// GraphNodeProxy impl. -func (n *GraphNodeConfigOutput) Proxy() bool { - return true -} - -// GraphNodeDestroyEdgeInclude impl. -func (n *GraphNodeConfigOutput) DestroyEdgeInclude(dag.Vertex) bool { - return false -} - -// GraphNodeFlattenable impl. -func (n *GraphNodeConfigOutput) Flatten(p []string) (dag.Vertex, error) { - return &GraphNodeConfigOutputFlat{ - GraphNodeConfigOutput: n, - PathValue: p, - }, nil -} - -// Same as GraphNodeConfigOutput, but for flattening -type GraphNodeConfigOutputFlat struct { - *GraphNodeConfigOutput - - PathValue []string -} - -func (n *GraphNodeConfigOutputFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.GraphNodeConfigOutput.Name()) -} - -func (n *GraphNodeConfigOutputFlat) Path() []string { - return n.PathValue -} - -func (n *GraphNodeConfigOutputFlat) DependableName() []string { - return modulePrefixList( - n.GraphNodeConfigOutput.DependableName(), - modulePrefixStr(n.PathValue)) -} - -func (n *GraphNodeConfigOutputFlat) DependentOn() []string { - prefix := modulePrefixStr(n.PathValue) - return modulePrefixList( - n.GraphNodeConfigOutput.DependentOn(), - prefix) -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_provider.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_provider.go deleted file mode 100644 index 59fbfcb0b9..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_provider.go +++ /dev/null @@ -1,133 +0,0 @@ -package terraform - -import ( - "fmt" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeConfigProvider represents a configured provider within the -// configuration graph. These are only immediately in the graph when an -// explicit `provider` configuration block is in the configuration. -type GraphNodeConfigProvider struct { - Provider *config.ProviderConfig -} - -func (n *GraphNodeConfigProvider) Name() string { - return fmt.Sprintf("provider.%s", n.ProviderName()) -} - -func (n *GraphNodeConfigProvider) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeProvider -} - -func (n *GraphNodeConfigProvider) DependableName() []string { - return []string{n.Name()} -} - -func (n *GraphNodeConfigProvider) DependentOn() []string { - vars := n.Provider.RawConfig.Variables - result := make([]string, 0, len(vars)) - for _, v := range vars { - if vn := varNameForVar(v); vn != "" { - result = append(result, vn) - } - } - - return result -} - -// GraphNodeEvalable impl. -func (n *GraphNodeConfigProvider) EvalTree() EvalNode { - return ProviderEvalTree(n.ProviderName(), n.Provider.RawConfig) -} - -// GraphNodeProvider implementation -func (n *GraphNodeConfigProvider) ProviderName() string { - if n.Provider.Alias == "" { - return n.Provider.Name - } else { - return fmt.Sprintf("%s.%s", n.Provider.Name, n.Provider.Alias) - } -} - -// GraphNodeProvider implementation -func (n *GraphNodeConfigProvider) ProviderConfig() *config.RawConfig { - return n.Provider.RawConfig -} - -// GraphNodeDotter impl. -func (n *GraphNodeConfigProvider) DotNode(name string, opts *dag.DotOpts) *dag.DotNode { - return &dag.DotNode{ - Name: name, - Attrs: map[string]string{ - "label": n.Name(), - "shape": "diamond", - }, - } -} - -// GraphNodeDotterOrigin impl. -func (n *GraphNodeConfigProvider) DotOrigin() bool { - return true -} - -// GraphNodeFlattenable impl. -func (n *GraphNodeConfigProvider) Flatten(p []string) (dag.Vertex, error) { - return &GraphNodeConfigProviderFlat{ - GraphNodeConfigProvider: n, - PathValue: p, - }, nil -} - -// Same as GraphNodeConfigProvider, but for flattening -type GraphNodeConfigProviderFlat struct { - *GraphNodeConfigProvider - - PathValue []string -} - -func (n *GraphNodeConfigProviderFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.GraphNodeConfigProvider.Name()) -} - -func (n *GraphNodeConfigProviderFlat) Path() []string { - return n.PathValue -} - -func (n *GraphNodeConfigProviderFlat) DependableName() []string { - return modulePrefixList( - n.GraphNodeConfigProvider.DependableName(), - modulePrefixStr(n.PathValue)) -} - -func (n *GraphNodeConfigProviderFlat) DependentOn() []string { - prefixed := modulePrefixList( - n.GraphNodeConfigProvider.DependentOn(), - modulePrefixStr(n.PathValue)) - - result := make([]string, len(prefixed), len(prefixed)+1) - copy(result, prefixed) - - // If we're in a module, then depend on our parent's provider - if len(n.PathValue) > 1 { - prefix := modulePrefixStr(n.PathValue[:len(n.PathValue)-1]) - if prefix != "" { - prefix += "." - } - - result = append(result, fmt.Sprintf( - "%s%s", - prefix, n.GraphNodeConfigProvider.Name())) - } - - return result -} - -func (n *GraphNodeConfigProviderFlat) ProviderName() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), - n.GraphNodeConfigProvider.ProviderName()) -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_resource.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_resource.go deleted file mode 100644 index cecedb6ec6..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_resource.go +++ /dev/null @@ -1,539 +0,0 @@ -package terraform - -import ( - "fmt" - "log" - "strings" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeCountDependent is implemented by resources for giving only -// the dependencies they have from the "count" field. -type GraphNodeCountDependent interface { - CountDependentOn() []string -} - -// GraphNodeConfigResource represents a resource within the config graph. -type GraphNodeConfigResource struct { - Resource *config.Resource - - // If set to true, this resource represents a resource - // that will be destroyed in some way. - Destroy bool - - // Used during DynamicExpand to target indexes - Targets []ResourceAddress - - Path []string -} - -func (n *GraphNodeConfigResource) Copy() *GraphNodeConfigResource { - ncr := &GraphNodeConfigResource{ - Resource: n.Resource.Copy(), - Destroy: n.Destroy, - Targets: make([]ResourceAddress, 0, len(n.Targets)), - Path: make([]string, 0, len(n.Path)), - } - for _, t := range n.Targets { - ncr.Targets = append(ncr.Targets, *t.Copy()) - } - for _, p := range n.Path { - ncr.Path = append(ncr.Path, p) - } - return ncr -} - -func (n *GraphNodeConfigResource) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeResource -} - -func (n *GraphNodeConfigResource) DependableName() []string { - return []string{n.Resource.Id()} -} - -// GraphNodeCountDependent impl. -func (n *GraphNodeConfigResource) CountDependentOn() []string { - result := make([]string, 0, len(n.Resource.RawCount.Variables)) - for _, v := range n.Resource.RawCount.Variables { - if vn := varNameForVar(v); vn != "" { - result = append(result, vn) - } - } - - return result -} - -// GraphNodeDependent impl. -func (n *GraphNodeConfigResource) DependentOn() []string { - result := make([]string, len(n.Resource.DependsOn), - (len(n.Resource.RawCount.Variables)+ - len(n.Resource.RawConfig.Variables)+ - len(n.Resource.DependsOn))*2) - copy(result, n.Resource.DependsOn) - - for _, v := range n.Resource.RawCount.Variables { - if vn := varNameForVar(v); vn != "" { - result = append(result, vn) - } - } - for _, v := range n.Resource.RawConfig.Variables { - if vn := varNameForVar(v); vn != "" { - result = append(result, vn) - } - } - for _, p := range n.Resource.Provisioners { - for _, v := range p.ConnInfo.Variables { - if vn := varNameForVar(v); vn != "" && vn != n.Resource.Id() { - result = append(result, vn) - } - } - for _, v := range p.RawConfig.Variables { - if vn := varNameForVar(v); vn != "" && vn != n.Resource.Id() { - result = append(result, vn) - } - } - } - - return result -} - -// VarWalk calls a callback for all the variables that this resource -// depends on. -func (n *GraphNodeConfigResource) VarWalk(fn func(config.InterpolatedVariable)) { - for _, v := range n.Resource.RawCount.Variables { - fn(v) - } - for _, v := range n.Resource.RawConfig.Variables { - fn(v) - } - for _, p := range n.Resource.Provisioners { - for _, v := range p.ConnInfo.Variables { - fn(v) - } - for _, v := range p.RawConfig.Variables { - fn(v) - } - } -} - -func (n *GraphNodeConfigResource) Name() string { - result := n.Resource.Id() - if n.Destroy { - result += " (destroy)" - } - return result -} - -// GraphNodeDotter impl. -func (n *GraphNodeConfigResource) DotNode(name string, opts *dag.DotOpts) *dag.DotNode { - if n.Destroy && !opts.Verbose { - return nil - } - return &dag.DotNode{ - Name: name, - Attrs: map[string]string{ - "label": n.Name(), - "shape": "box", - }, - } -} - -// GraphNodeFlattenable impl. -func (n *GraphNodeConfigResource) Flatten(p []string) (dag.Vertex, error) { - return &GraphNodeConfigResourceFlat{ - GraphNodeConfigResource: n, - PathValue: p, - }, nil -} - -// GraphNodeDynamicExpandable impl. -func (n *GraphNodeConfigResource) DynamicExpand(ctx EvalContext) (*Graph, error) { - state, lock := ctx.State() - lock.RLock() - defer lock.RUnlock() - - // Start creating the steps - steps := make([]GraphTransformer, 0, 5) - - // Expand counts. - steps = append(steps, &ResourceCountTransformerOld{ - Resource: n.Resource, - Destroy: n.Destroy, - Targets: n.Targets, - }) - - // Additional destroy modifications. - if n.Destroy { - // If we're destroying a primary or tainted resource, we want to - // expand orphans, which have all the same semantics in a destroy - // as a primary or tainted resource. - steps = append(steps, &OrphanTransformer{ - Resource: n.Resource, - State: state, - View: n.Resource.Id(), - }) - - steps = append(steps, &DeposedTransformer{ - State: state, - View: n.Resource.Id(), - }) - } - - // We always want to apply targeting - steps = append(steps, &TargetsTransformer{ - ParsedTargets: n.Targets, - Destroy: n.Destroy, - }) - - // Always end with the root being added - steps = append(steps, &RootTransformer{}) - - // Build the graph - b := &BasicGraphBuilder{ - Steps: steps, - Validate: true, - Name: "GraphNodeConfigResource", - } - return b.Build(ctx.Path()) -} - -// GraphNodeAddressable impl. -func (n *GraphNodeConfigResource) ResourceAddress() *ResourceAddress { - return &ResourceAddress{ - Path: n.Path[1:], - Index: -1, - InstanceType: TypePrimary, - Name: n.Resource.Name, - Type: n.Resource.Type, - Mode: n.Resource.Mode, - } -} - -// GraphNodeTargetable impl. -func (n *GraphNodeConfigResource) SetTargets(targets []ResourceAddress) { - n.Targets = targets -} - -// GraphNodeEvalable impl. -func (n *GraphNodeConfigResource) EvalTree() EvalNode { - return &EvalSequence{ - Nodes: []EvalNode{ - &EvalInterpolate{Config: n.Resource.RawCount}, - &EvalCountCheckComputed{Resource: n.Resource}, - &EvalOpFilter{ - Ops: []walkOperation{walkValidate}, - Node: &EvalValidateCount{Resource: n.Resource}, - }, - &EvalCountFixZeroOneBoundary{Resource: n.Resource}, - }, - } -} - -// GraphNodeProviderConsumer -func (n *GraphNodeConfigResource) ProvidedBy() []string { - return []string{resourceProvider(n.Resource.Type, n.Resource.Provider)} -} - -// GraphNodeProvisionerConsumer -func (n *GraphNodeConfigResource) ProvisionedBy() []string { - result := make([]string, len(n.Resource.Provisioners)) - for i, p := range n.Resource.Provisioners { - result[i] = p.Type - } - - return result -} - -// GraphNodeDestroyable -func (n *GraphNodeConfigResource) DestroyNode() GraphNodeDestroy { - // If we're already a destroy node, then don't do anything - if n.Destroy { - return nil - } - - result := &graphNodeResourceDestroy{ - GraphNodeConfigResource: *n.Copy(), - Original: n, - } - result.Destroy = true - - return result -} - -// GraphNodeNoopPrunable -func (n *GraphNodeConfigResource) Noop(opts *NoopOpts) bool { - log.Printf("[DEBUG] Checking resource noop: %s", n.Name()) - // We don't have any noop optimizations for destroy nodes yet - if n.Destroy { - log.Printf("[DEBUG] Destroy node, not a noop") - return false - } - - // If there is no diff, then we aren't a noop since something needs to - // be done (such as a plan). We only check if we're a noop in a diff. - if opts.Diff == nil || opts.Diff.Empty() { - log.Printf("[DEBUG] No diff, not a noop") - return false - } - - // If the count has any interpolations, we can't prune this node since - // we need to be sure to evaluate the count so that splat variables work - // later (which need to know the full count). - if len(n.Resource.RawCount.Interpolations) > 0 { - log.Printf("[DEBUG] Count has interpolations, not a noop") - return false - } - - // If we have no module diff, we're certainly a noop. This is because - // it means there is a diff, and that the module we're in just isn't - // in it, meaning we're not doing anything. - if opts.ModDiff == nil || opts.ModDiff.Empty() { - log.Printf("[DEBUG] No mod diff, treating resource as a noop") - return true - } - - // Grab the ID which is the prefix (in the case count > 0 at some point) - prefix := n.Resource.Id() - - // Go through the diff and if there are any with our name on it, keep us - found := false - for k, _ := range opts.ModDiff.Resources { - if strings.HasPrefix(k, prefix) { - log.Printf("[DEBUG] Diff has %s, resource is not a noop", k) - found = true - break - } - } - - log.Printf("[DEBUG] Final noop value: %t", !found) - return !found -} - -// Same as GraphNodeConfigResource, but for flattening -type GraphNodeConfigResourceFlat struct { - *GraphNodeConfigResource - - PathValue []string -} - -func (n *GraphNodeConfigResourceFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.GraphNodeConfigResource.Name()) -} - -func (n *GraphNodeConfigResourceFlat) Path() []string { - return n.PathValue -} - -func (n *GraphNodeConfigResourceFlat) DependableName() []string { - return modulePrefixList( - n.GraphNodeConfigResource.DependableName(), - modulePrefixStr(n.PathValue)) -} - -func (n *GraphNodeConfigResourceFlat) DependentOn() []string { - prefix := modulePrefixStr(n.PathValue) - return modulePrefixList( - n.GraphNodeConfigResource.DependentOn(), - prefix) -} - -func (n *GraphNodeConfigResourceFlat) ProvidedBy() []string { - prefix := modulePrefixStr(n.PathValue) - return modulePrefixList( - n.GraphNodeConfigResource.ProvidedBy(), - prefix) -} - -func (n *GraphNodeConfigResourceFlat) ProvisionedBy() []string { - prefix := modulePrefixStr(n.PathValue) - return modulePrefixList( - n.GraphNodeConfigResource.ProvisionedBy(), - prefix) -} - -// GraphNodeDestroyable impl. -func (n *GraphNodeConfigResourceFlat) DestroyNode() GraphNodeDestroy { - // Get our parent destroy node. If we don't have any, just return - raw := n.GraphNodeConfigResource.DestroyNode() - if raw == nil { - return nil - } - - node, ok := raw.(*graphNodeResourceDestroy) - if !ok { - panic(fmt.Sprintf("unknown destroy node: %s %T", dag.VertexName(raw), raw)) - } - - // Otherwise, wrap it so that it gets the proper module treatment. - return &graphNodeResourceDestroyFlat{ - graphNodeResourceDestroy: node, - PathValue: n.PathValue, - FlatCreateNode: n, - } -} - -type graphNodeResourceDestroyFlat struct { - *graphNodeResourceDestroy - - PathValue []string - - // Needs to be able to properly yield back a flattened create node to prevent - FlatCreateNode *GraphNodeConfigResourceFlat -} - -func (n *graphNodeResourceDestroyFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeResourceDestroy.Name()) -} - -func (n *graphNodeResourceDestroyFlat) Path() []string { - return n.PathValue -} - -func (n *graphNodeResourceDestroyFlat) CreateNode() dag.Vertex { - return n.FlatCreateNode -} - -func (n *graphNodeResourceDestroyFlat) ProvidedBy() []string { - prefix := modulePrefixStr(n.PathValue) - return modulePrefixList( - n.GraphNodeConfigResource.ProvidedBy(), - prefix) -} - -// graphNodeResourceDestroy represents the logical destruction of a -// resource. This node doesn't mean it will be destroyed for sure, but -// instead that if a destroy were to happen, it must happen at this point. -type graphNodeResourceDestroy struct { - GraphNodeConfigResource - Original *GraphNodeConfigResource -} - -func (n *graphNodeResourceDestroy) CreateBeforeDestroy() bool { - // CBD is enabled if the resource enables it - return n.Original.Resource.Lifecycle.CreateBeforeDestroy && n.Destroy -} - -func (n *graphNodeResourceDestroy) CreateNode() dag.Vertex { - return n.Original -} - -func (n *graphNodeResourceDestroy) DestroyInclude(d *ModuleDiff, s *ModuleState) bool { - if n.Destroy { - return n.destroyInclude(d, s) - } - - return true -} - -func (n *graphNodeResourceDestroy) destroyInclude( - d *ModuleDiff, s *ModuleState) bool { - // Get the count, and specifically the raw value of the count - // (with interpolations and all). If the count is NOT a static "1", - // then we keep the destroy node no matter what. - // - // The reasoning for this is complicated and not intuitively obvious, - // but I attempt to explain it below. - // - // The destroy transform works by generating the worst case graph, - // with worst case being the case that every resource already exists - // and needs to be destroy/created (force-new). There is a single important - // edge case where this actually results in a real-life cycle: if a - // create-before-destroy (CBD) resource depends on a non-CBD resource. - // Imagine a EC2 instance "foo" with CBD depending on a security - // group "bar" without CBD, and conceptualize the worst case destroy - // order: - // - // 1.) SG must be destroyed (non-CBD) - // 2.) SG must be created/updated - // 3.) EC2 instance must be created (CBD, requires the SG be made) - // 4.) EC2 instance must be destroyed (requires SG be destroyed) - // - // Except, #1 depends on #4, since the SG can't be destroyed while - // an EC2 instance is using it (AWS API requirements). As you can see, - // this is a real life cycle that can't be automatically reconciled - // except under two conditions: - // - // 1.) SG is also CBD. This doesn't work 100% of the time though - // since the non-CBD resource might not support CBD. To make matters - // worse, the entire transitive closure of dependencies must be - // CBD (if the SG depends on a VPC, you have the same problem). - // 2.) EC2 must not CBD. This can't happen automatically because CBD - // is used as a way to ensure zero (or minimal) downtime Terraform - // applies, and it isn't acceptable for TF to ignore this request, - // since it can result in unexpected downtime. - // - // Therefore, we compromise with this edge case here: if there is - // a static count of "1", we prune the diff to remove cycles during a - // graph optimization path if we don't see the resource in the diff. - // If the count is set to ANYTHING other than a static "1" (variable, - // computed attribute, static number greater than 1), then we keep the - // destroy, since it is required for dynamic graph expansion to find - // orphan count objects. - // - // This isn't ideal logic, but its strictly better without introducing - // new impossibilities. It breaks the cycle in practical cases, and the - // cycle comes back in no cases we've found to be practical, but just - // as the cycle would already exist without this anyways. - count := n.Original.Resource.RawCount - if raw := count.Raw[count.Key]; raw != "1" { - return true - } - - // Okay, we're dealing with a static count. There are a few ways - // to include this resource. - prefix := n.Original.Resource.Id() - - // If we're present in the diff proper, then keep it. We're looking - // only for resources in the diff that match our resource or a count-index - // of our resource that are marked for destroy. - if d != nil { - for k, v := range d.Resources { - match := k == prefix || strings.HasPrefix(k, prefix+".") - if match && v.GetDestroy() { - return true - } - } - } - - // If we're in the state as a primary in any form, then keep it. - // This does a prefix check so it will also catch orphans on count - // decreases to "1". - if s != nil { - for k, v := range s.Resources { - // Ignore exact matches - if k == prefix { - continue - } - - // Ignore anything that doesn't have a "." afterwards so that - // we only get our own resource and any counts on it. - if !strings.HasPrefix(k, prefix+".") { - continue - } - - // Ignore exact matches and the 0'th index. We only care - // about if there is a decrease in count. - if k == prefix+".0" { - continue - } - - if v.Primary != nil { - return true - } - } - - // If we're in the state as _both_ "foo" and "foo.0", then - // keep it, since we treat the latter as an orphan. - _, okOne := s.Resources[prefix] - _, okTwo := s.Resources[prefix+".0"] - if okOne && okTwo { - return true - } - } - - return false -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_type.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_type.go deleted file mode 100644 index 42dd8dc9fc..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_type.go +++ /dev/null @@ -1,16 +0,0 @@ -package terraform - -//go:generate stringer -type=GraphNodeConfigType graph_config_node_type.go - -// GraphNodeConfigType is an enum for the type of thing that a graph -// node represents from the configuration. -type GraphNodeConfigType int - -const ( - GraphNodeConfigTypeInvalid GraphNodeConfigType = 0 - GraphNodeConfigTypeResource GraphNodeConfigType = iota - GraphNodeConfigTypeProvider - GraphNodeConfigTypeModule - GraphNodeConfigTypeOutput - GraphNodeConfigTypeVariable -) diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_variable.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_variable.go deleted file mode 100644 index ba62eb0567..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_config_node_variable.go +++ /dev/null @@ -1,274 +0,0 @@ -package terraform - -import ( - "fmt" - "log" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/config/module" - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeConfigVariable represents a Variable in the config. -type GraphNodeConfigVariable struct { - Variable *config.Variable - - // Value, if non-nil, will be used to set the value of the variable - // during evaluation. If this is nil, evaluation will do nothing. - // - // Module is the name of the module to set the variables on. - Module string - Value *config.RawConfig - - ModuleTree *module.Tree - ModulePath []string -} - -func (n *GraphNodeConfigVariable) Name() string { - return fmt.Sprintf("var.%s", n.Variable.Name) -} - -func (n *GraphNodeConfigVariable) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeVariable -} - -func (n *GraphNodeConfigVariable) DependableName() []string { - return []string{n.Name()} -} - -// RemoveIfNotTargeted implements RemovableIfNotTargeted. -// When targeting is active, variables that are not targeted should be removed -// from the graph, because otherwise module variables trying to interpolate -// their references can fail when they're missing the referent resource node. -func (n *GraphNodeConfigVariable) RemoveIfNotTargeted() bool { - return true -} - -func (n *GraphNodeConfigVariable) DependentOn() []string { - // If we don't have any value set, we don't depend on anything - if n.Value == nil { - return nil - } - - // Get what we depend on based on our value - vars := n.Value.Variables - result := make([]string, 0, len(vars)) - for _, v := range vars { - if vn := varNameForVar(v); vn != "" { - result = append(result, vn) - } - } - - return result -} - -func (n *GraphNodeConfigVariable) VariableName() string { - return n.Variable.Name -} - -// GraphNodeDestroyEdgeInclude impl. -func (n *GraphNodeConfigVariable) DestroyEdgeInclude(v dag.Vertex) bool { - // Only include this variable in a destroy edge if the source vertex - // "v" has a count dependency on this variable. - log.Printf("[DEBUG] DestroyEdgeInclude: Checking: %s", dag.VertexName(v)) - cv, ok := v.(GraphNodeCountDependent) - if !ok { - log.Printf("[DEBUG] DestroyEdgeInclude: Not GraphNodeCountDependent: %s", dag.VertexName(v)) - return false - } - - for _, d := range cv.CountDependentOn() { - for _, d2 := range n.DependableName() { - log.Printf("[DEBUG] DestroyEdgeInclude: d = %s : d2 = %s", d, d2) - if d == d2 { - return true - } - } - } - - return false -} - -// GraphNodeNoopPrunable -func (n *GraphNodeConfigVariable) Noop(opts *NoopOpts) bool { - log.Printf("[DEBUG] Checking variable noop: %s", n.Name()) - // If we have no diff, always keep this in the graph. We have to do - // this primarily for validation: we want to validate that variable - // interpolations are valid even if there are no resources that - // depend on them. - if opts.Diff == nil || opts.Diff.Empty() { - log.Printf("[DEBUG] No diff, not a noop") - return false - } - - // We have to find our our module diff since we do funky things with - // the flat node's implementation of Path() below. - modDiff := opts.Diff.ModuleByPath(n.ModulePath) - - // If we're destroying, we have no need of variables unless they are depended - // on by the count of a resource. - if modDiff != nil && modDiff.Destroy { - if n.hasDestroyEdgeInPath(opts, nil) { - log.Printf("[DEBUG] Variable has destroy edge from %s, not a noop", - dag.VertexName(opts.Vertex)) - return false - } - log.Printf("[DEBUG] Variable has no included destroy edges: noop!") - return true - } - - for _, v := range opts.Graph.UpEdges(opts.Vertex).List() { - // This is terrible, but I can't think of a better way to do this. - if dag.VertexName(v) == rootNodeName { - continue - } - - log.Printf("[DEBUG] Found up edge to %s, var is not noop", dag.VertexName(v)) - return false - } - - log.Printf("[DEBUG] No up edges, treating variable as a noop") - return true -} - -// hasDestroyEdgeInPath recursively walks for a destroy edge, ensuring that -// a variable both has no immediate destroy edges or any in its full module -// path, ensuring that links do not get severed in the middle. -func (n *GraphNodeConfigVariable) hasDestroyEdgeInPath(opts *NoopOpts, vertex dag.Vertex) bool { - if vertex == nil { - vertex = opts.Vertex - } - - log.Printf("[DEBUG] hasDestroyEdgeInPath: Looking for destroy edge: %s - %T", dag.VertexName(vertex), vertex) - for _, v := range opts.Graph.UpEdges(vertex).List() { - if len(opts.Graph.UpEdges(v).List()) > 1 { - if n.hasDestroyEdgeInPath(opts, v) == true { - return true - } - } - - // Here we borrow the implementation of DestroyEdgeInclude, whose logic - // and semantics are exactly what we want here. We add a check for the - // the root node, since we have to always depend on its existance. - if cv, ok := vertex.(*GraphNodeConfigVariableFlat); ok { - if dag.VertexName(v) == rootNodeName || cv.DestroyEdgeInclude(v) { - return true - } - } - } - return false -} - -// GraphNodeProxy impl. -func (n *GraphNodeConfigVariable) Proxy() bool { - return true -} - -// GraphNodeEvalable impl. -func (n *GraphNodeConfigVariable) EvalTree() EvalNode { - // If we have no value, do nothing - if n.Value == nil { - return &EvalNoop{} - } - - // Otherwise, interpolate the value of this variable and set it - // within the variables mapping. - var config *ResourceConfig - variables := make(map[string]interface{}) - return &EvalSequence{ - Nodes: []EvalNode{ - &EvalInterpolate{ - Config: n.Value, - Output: &config, - }, - - &EvalVariableBlock{ - Config: &config, - VariableValues: variables, - }, - - &EvalCoerceMapVariable{ - Variables: variables, - ModulePath: n.ModulePath, - ModuleTree: n.ModuleTree, - }, - - &EvalTypeCheckVariable{ - Variables: variables, - ModulePath: n.ModulePath, - ModuleTree: n.ModuleTree, - }, - - &EvalSetVariables{ - Module: &n.Module, - Variables: variables, - }, - }, - } -} - -// GraphNodeFlattenable impl. -func (n *GraphNodeConfigVariable) Flatten(p []string) (dag.Vertex, error) { - return &GraphNodeConfigVariableFlat{ - GraphNodeConfigVariable: n, - PathValue: p, - }, nil -} - -type GraphNodeConfigVariableFlat struct { - *GraphNodeConfigVariable - - PathValue []string -} - -func (n *GraphNodeConfigVariableFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.GraphNodeConfigVariable.Name()) -} - -func (n *GraphNodeConfigVariableFlat) DependableName() []string { - return []string{n.Name()} -} - -func (n *GraphNodeConfigVariableFlat) DependentOn() []string { - // We only wrap the dependencies and such if we have a path that is - // longer than 2 elements (root, child, more). This is because when - // flattened, variables can point outside the graph. - prefix := "" - if len(n.PathValue) > 2 { - prefix = modulePrefixStr(n.PathValue[:len(n.PathValue)-1]) - } - - return modulePrefixList( - n.GraphNodeConfigVariable.DependentOn(), - prefix) -} - -func (n *GraphNodeConfigVariableFlat) Path() []string { - if len(n.PathValue) > 2 { - return n.PathValue[:len(n.PathValue)-1] - } - - return nil -} - -func (n *GraphNodeConfigVariableFlat) Noop(opts *NoopOpts) bool { - // First look for provider nodes that depend on this variable downstream - modDiff := opts.Diff.ModuleByPath(n.ModulePath) - if modDiff != nil && modDiff.Destroy { - ds, err := opts.Graph.Descendents(n) - if err != nil { - log.Printf("[ERROR] Error looking up descendents of %s: %s", n.Name(), err) - } else { - for _, d := range ds.List() { - if _, ok := d.(GraphNodeProvider); ok { - log.Printf("[DEBUG] This variable is depended on by a provider, can't be a noop.") - return false - } - } - } - } - - // Then fall back to existing impl - return n.GraphNodeConfigVariable.Noop(opts) -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_walk_context.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_walk_context.go index 459fcdec99..e63b460356 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graph_walk_context.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graph_walk_context.go @@ -1,6 +1,7 @@ package terraform import ( + "context" "fmt" "log" "sync" @@ -15,8 +16,9 @@ type ContextGraphWalker struct { NullGraphWalker // Configurable values - Context *Context - Operation walkOperation + Context *Context + Operation walkOperation + StopContext context.Context // Outputs, do not set these. Do not read these while the graph // is being walked. @@ -65,6 +67,7 @@ func (w *ContextGraphWalker) EnterPath(path []string) EvalContext { w.interpolaterVarLock.Unlock() ctx := &BuiltinEvalContext{ + StopContext: w.StopContext, PathValue: path, Hooks: w.Context.hooks, InputValue: w.Context.uiInput, @@ -81,6 +84,7 @@ func (w *ContextGraphWalker) EnterPath(path []string) EvalContext { StateLock: &w.Context.stateLock, Interpolater: &Interpolater{ Operation: w.Operation, + Meta: w.Context.meta, Module: w.Context.module, State: w.Context.state, StateLock: &w.Context.stateLock, diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graphnodeconfigtype_string.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graphnodeconfigtype_string.go deleted file mode 100644 index 9ea0acbebe..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graphnodeconfigtype_string.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by "stringer -type=GraphNodeConfigType graph_config_node_type.go"; DO NOT EDIT - -package terraform - -import "fmt" - -const _GraphNodeConfigType_name = "GraphNodeConfigTypeInvalidGraphNodeConfigTypeResourceGraphNodeConfigTypeProviderGraphNodeConfigTypeModuleGraphNodeConfigTypeOutputGraphNodeConfigTypeVariable" - -var _GraphNodeConfigType_index = [...]uint8{0, 26, 53, 80, 105, 130, 157} - -func (i GraphNodeConfigType) String() string { - if i < 0 || i >= GraphNodeConfigType(len(_GraphNodeConfigType_index)-1) { - return fmt.Sprintf("GraphNodeConfigType(%d)", i) - } - return _GraphNodeConfigType_name[_GraphNodeConfigType_index[i]:_GraphNodeConfigType_index[i+1]] -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/graphtype_string.go b/installer/vendor/github.com/hashicorp/terraform/terraform/graphtype_string.go index 8e644abb91..e97b4855a9 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/graphtype_string.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/graphtype_string.go @@ -1,12 +1,12 @@ -// Code generated by "stringer -type=GraphType context_graph_type.go"; DO NOT EDIT +// Code generated by "stringer -type=GraphType context_graph_type.go"; DO NOT EDIT. package terraform import "fmt" -const _GraphType_name = "GraphTypeInvalidGraphTypeLegacyGraphTypePlanGraphTypePlanDestroyGraphTypeApply" +const _GraphType_name = "GraphTypeInvalidGraphTypeLegacyGraphTypeRefreshGraphTypePlanGraphTypePlanDestroyGraphTypeApplyGraphTypeInputGraphTypeValidate" -var _GraphType_index = [...]uint8{0, 16, 31, 44, 64, 78} +var _GraphType_index = [...]uint8{0, 16, 31, 47, 60, 80, 94, 108, 125} func (i GraphType) String() string { if i >= GraphType(len(_GraphType_index)-1) { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/hook.go b/installer/vendor/github.com/hashicorp/terraform/terraform/hook.go index 81a68842ff..ab11e8ee01 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/hook.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/hook.go @@ -42,7 +42,7 @@ type Hook interface { PreProvisionResource(*InstanceInfo, *InstanceState) (HookAction, error) PostProvisionResource(*InstanceInfo, *InstanceState) (HookAction, error) PreProvision(*InstanceInfo, string) (HookAction, error) - PostProvision(*InstanceInfo, string) (HookAction, error) + PostProvision(*InstanceInfo, string, error) (HookAction, error) ProvisionOutput(*InstanceInfo, string, string) // PreRefresh and PostRefresh are called before and after a single @@ -92,7 +92,7 @@ func (*NilHook) PreProvision(*InstanceInfo, string) (HookAction, error) { return HookActionContinue, nil } -func (*NilHook) PostProvision(*InstanceInfo, string) (HookAction, error) { +func (*NilHook) PostProvision(*InstanceInfo, string, error) (HookAction, error) { return HookActionContinue, nil } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/hook_mock.go b/installer/vendor/github.com/hashicorp/terraform/terraform/hook_mock.go index b0bb94e576..0e46400678 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/hook_mock.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/hook_mock.go @@ -55,6 +55,7 @@ type MockHook struct { PostProvisionCalled bool PostProvisionInfo *InstanceInfo PostProvisionProvisionerId string + PostProvisionErrorArg error PostProvisionReturn HookAction PostProvisionError error @@ -170,13 +171,14 @@ func (h *MockHook) PreProvision(n *InstanceInfo, provId string) (HookAction, err return h.PreProvisionReturn, h.PreProvisionError } -func (h *MockHook) PostProvision(n *InstanceInfo, provId string) (HookAction, error) { +func (h *MockHook) PostProvision(n *InstanceInfo, provId string, err error) (HookAction, error) { h.Lock() defer h.Unlock() h.PostProvisionCalled = true h.PostProvisionInfo = n h.PostProvisionProvisionerId = provId + h.PostProvisionErrorArg = err return h.PostProvisionReturn, h.PostProvisionError } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/hook_stop.go b/installer/vendor/github.com/hashicorp/terraform/terraform/hook_stop.go index 4c9bbb7b33..104d0098a1 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/hook_stop.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/hook_stop.go @@ -38,7 +38,7 @@ func (h *stopHook) PreProvision(*InstanceInfo, string) (HookAction, error) { return h.hook() } -func (h *stopHook) PostProvision(*InstanceInfo, string) (HookAction, error) { +func (h *stopHook) PostProvision(*InstanceInfo, string, error) (HookAction, error) { return h.hook() } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go b/installer/vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go index f65414b347..f69267cd52 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=InstanceType instancetype.go"; DO NOT EDIT +// Code generated by "stringer -type=InstanceType instancetype.go"; DO NOT EDIT. package terraform diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/interpolate.go b/installer/vendor/github.com/hashicorp/terraform/terraform/interpolate.go index 4cbfab78ef..855548c055 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/interpolate.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/interpolate.go @@ -25,6 +25,7 @@ const ( // for interpolations such as `aws_instance.foo.bar`. type Interpolater struct { Operation walkOperation + Meta *ContextMeta Module *module.Tree State *State StateLock *sync.RWMutex @@ -87,6 +88,8 @@ func (i *Interpolater) Values( err = i.valueSelfVar(scope, n, v, result) case *config.SimpleVariable: err = i.valueSimpleVar(scope, n, v, result) + case *config.TerraformVariable: + err = i.valueTerraformVar(scope, n, v, result) case *config.UserVariable: err = i.valueUserVar(scope, n, v, result) default: @@ -259,7 +262,7 @@ func (i *Interpolater) valueResourceVar( // If it truly is missing, we'll catch it on a later walk. // This applies only to graph nodes that interpolate during the // config walk, e.g. providers. - if i.Operation == walkInput { + if i.Operation == walkInput || i.Operation == walkRefresh { result[n] = unknownVariable() return nil } @@ -303,10 +306,29 @@ func (i *Interpolater) valueSimpleVar( // relied on this for their template_file data sources. We should // remove this at some point but there isn't any rush. return fmt.Errorf( - "invalid variable syntax: %q. If this is part of inline `template` parameter\n"+ + "invalid variable syntax: %q. Did you mean 'var.%s'? If this is part of inline `template` parameter\n"+ "then you must escape the interpolation with two dollar signs. For\n"+ "example: ${a} becomes $${a}.", - n) + n, n) +} + +func (i *Interpolater) valueTerraformVar( + scope *InterpolationScope, + n string, + v *config.TerraformVariable, + result map[string]ast.Variable) error { + if v.Field != "env" { + return fmt.Errorf( + "%s: only supported key for 'terraform.X' interpolations is 'env'", n) + } + + if i.Meta == nil { + return fmt.Errorf( + "%s: internal error: nil Meta. Please report a bug.", n) + } + + result[n] = ast.Variable{Type: ast.TypeString, Value: i.Meta.Env} + return nil } func (i *Interpolater) valueUserVar( @@ -498,7 +520,7 @@ MISSING: // // For an input walk, computed values are okay to return because we're only // looking for missing variables to prompt the user for. - if i.Operation == walkRefresh || i.Operation == walkPlanDestroy || i.Operation == walkDestroy || i.Operation == walkInput { + if i.Operation == walkRefresh || i.Operation == walkPlanDestroy || i.Operation == walkInput { return &unknownVariable, nil } @@ -518,6 +540,13 @@ func (i *Interpolater) computeResourceMultiVariable( unknownVariable := unknownVariable() + // If we're only looking for input, we don't need to expand a + // multi-variable. This prevents us from encountering things that should be + // known but aren't because the state has yet to be refreshed. + if i.Operation == walkInput { + return &unknownVariable, nil + } + // Get the information about this resource variable, and verify // that it exists and such. module, cr, err := i.resourceVariableInfo(scope, v) @@ -698,6 +727,10 @@ func (i *Interpolater) resourceCountMax( // from the state. Plan and so on may not have any state yet so // we do a full interpolation. if i.Operation != walkApply { + if cr == nil { + return 0, nil + } + count, err := cr.Count() if err != nil { return 0, err diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_data_destroy.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_data_destroy.go new file mode 100644 index 0000000000..e32cea8825 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_data_destroy.go @@ -0,0 +1,22 @@ +package terraform + +// NodeDestroyableDataResource represents a resource that is "plannable": +// it is ready to be planned in order to create a diff. +type NodeDestroyableDataResource struct { + *NodeAbstractResource +} + +// GraphNodeEvalable +func (n *NodeDestroyableDataResource) EvalTree() EvalNode { + addr := n.NodeAbstractResource.Addr + + // stateId is the ID to put into the state + stateId := addr.stateId() + + // Just destroy it. + var state *InstanceState + return &EvalWriteState{ + Name: stateId, + State: &state, // state is nil here + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_data_refresh.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_data_refresh.go new file mode 100644 index 0000000000..d504c892c4 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_data_refresh.go @@ -0,0 +1,198 @@ +package terraform + +import ( + "github.com/hashicorp/terraform/dag" +) + +// NodeRefreshableDataResource represents a resource that is "plannable": +// it is ready to be planned in order to create a diff. +type NodeRefreshableDataResource struct { + *NodeAbstractCountResource +} + +// GraphNodeDynamicExpandable +func (n *NodeRefreshableDataResource) DynamicExpand(ctx EvalContext) (*Graph, error) { + // Grab the state which we read + state, lock := ctx.State() + lock.RLock() + defer lock.RUnlock() + + // Expand the resource count which must be available by now from EvalTree + count, err := n.Config.Count() + if err != nil { + return nil, err + } + + // The concrete resource factory we'll use + concreteResource := func(a *NodeAbstractResource) dag.Vertex { + // Add the config and state since we don't do that via transforms + a.Config = n.Config + + return &NodeRefreshableDataResourceInstance{ + NodeAbstractResource: a, + } + } + + // Start creating the steps + steps := []GraphTransformer{ + // Expand the count. + &ResourceCountTransformer{ + Concrete: concreteResource, + Count: count, + Addr: n.ResourceAddr(), + }, + + // Attach the state + &AttachStateTransformer{State: state}, + + // Targeting + &TargetsTransformer{ParsedTargets: n.Targets}, + + // Connect references so ordering is correct + &ReferenceTransformer{}, + + // Make sure there is a single root + &RootTransformer{}, + } + + // Build the graph + b := &BasicGraphBuilder{ + Steps: steps, + Validate: true, + Name: "NodeRefreshableDataResource", + } + + return b.Build(ctx.Path()) +} + +// NodeRefreshableDataResourceInstance represents a _single_ resource instance +// that is refreshable. +type NodeRefreshableDataResourceInstance struct { + *NodeAbstractResource +} + +// GraphNodeEvalable +func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode { + addr := n.NodeAbstractResource.Addr + + // stateId is the ID to put into the state + stateId := addr.stateId() + + // Build the instance info. More of this will be populated during eval + info := &InstanceInfo{ + Id: stateId, + Type: addr.Type, + } + + // Get the state if we have it, if not we build it + rs := n.ResourceState + if rs == nil { + rs = &ResourceState{} + } + + // If the config isn't empty we update the state + if n.Config != nil { + rs = &ResourceState{ + Type: n.Config.Type, + Provider: n.Config.Provider, + Dependencies: n.StateReferences(), + } + } + + // Build the resource for eval + resource := &Resource{ + Name: addr.Name, + Type: addr.Type, + CountIndex: addr.Index, + } + if resource.CountIndex < 0 { + resource.CountIndex = 0 + } + + // Declare a bunch of variables that are used for state during + // evaluation. Most of this are written to by-address below. + var config *ResourceConfig + var diff *InstanceDiff + var provider ResourceProvider + var state *InstanceState + + return &EvalSequence{ + Nodes: []EvalNode{ + // Always destroy the existing state first, since we must + // make sure that values from a previous read will not + // get interpolated if we end up needing to defer our + // loading until apply time. + &EvalWriteState{ + Name: stateId, + ResourceType: rs.Type, + Provider: rs.Provider, + Dependencies: rs.Dependencies, + State: &state, // state is nil here + }, + + &EvalInterpolate{ + Config: n.Config.RawConfig.Copy(), + Resource: resource, + Output: &config, + }, + + // The rest of this pass can proceed only if there are no + // computed values in our config. + // (If there are, we'll deal with this during the plan and + // apply phases.) + &EvalIf{ + If: func(ctx EvalContext) (bool, error) { + if config.ComputedKeys != nil && len(config.ComputedKeys) > 0 { + return true, EvalEarlyExitError{} + } + + // If the config explicitly has a depends_on for this + // data source, assume the intention is to prevent + // refreshing ahead of that dependency. + if len(n.Config.DependsOn) > 0 { + return true, EvalEarlyExitError{} + } + + return true, nil + }, + + Then: EvalNoop{}, + }, + + // The remainder of this pass is the same as running + // a "plan" pass immediately followed by an "apply" pass, + // populating the state early so it'll be available to + // provider configurations that need this data during + // refresh/plan. + &EvalGetProvider{ + Name: n.ProvidedBy()[0], + Output: &provider, + }, + + &EvalReadDataDiff{ + Info: info, + Config: &config, + Provider: &provider, + Output: &diff, + OutputState: &state, + }, + + &EvalReadDataApply{ + Info: info, + Diff: &diff, + Provider: &provider, + Output: &state, + }, + + &EvalWriteState{ + Name: stateId, + ResourceType: rs.Type, + Provider: rs.Provider, + Dependencies: rs.Dependencies, + State: &state, + }, + + &EvalUpdateStateHook{}, + }, + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go index f82c3f3986..6cc836560c 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go @@ -38,6 +38,13 @@ func (n *NodeAbstractProvider) Path() []string { return n.PathValue } +// RemovableIfNotTargeted +func (n *NodeAbstractProvider) RemoveIfNotTargeted() bool { + // We need to add this so that this node will be removed if + // it isn't targeted or a dependency of a target. + return true +} + // GraphNodeReferencer func (n *NodeAbstractProvider) References() []string { if n.Config == nil { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_provisioner.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_provisioner.go new file mode 100644 index 0000000000..bb117c1d6f --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_provisioner.go @@ -0,0 +1,44 @@ +package terraform + +import ( + "fmt" + + "github.com/hashicorp/terraform/config" +) + +// NodeProvisioner represents a provider that has no associated operations. +// It registers all the common interfaces across operations for providers. +type NodeProvisioner struct { + NameValue string + PathValue []string + + // The fields below will be automatically set using the Attach + // interfaces if you're running those transforms, but also be explicitly + // set if you already have that information. + + Config *config.ProviderConfig +} + +func (n *NodeProvisioner) Name() string { + result := fmt.Sprintf("provisioner.%s", n.NameValue) + if len(n.PathValue) > 1 { + result = fmt.Sprintf("%s.%s", modulePrefixStr(n.PathValue), result) + } + + return result +} + +// GraphNodeSubPath +func (n *NodeProvisioner) Path() []string { + return n.PathValue +} + +// GraphNodeProvisioner +func (n *NodeProvisioner) ProvisionerName() string { + return n.NameValue +} + +// GraphNodeEvalable impl. +func (n *NodeProvisioner) EvalTree() EvalNode { + return &EvalInitProvisioner{Name: n.NameValue} +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract.go index faa2e85570..50bb70792a 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract.go @@ -2,6 +2,7 @@ package terraform import ( "fmt" + "strings" "github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/dag" @@ -95,11 +96,13 @@ func (n *NodeAbstractResource) References() []string { result = append(result, ReferencesFromConfig(c.RawCount)...) result = append(result, ReferencesFromConfig(c.RawConfig)...) for _, p := range c.Provisioners { - result = append(result, ReferencesFromConfig(p.ConnInfo)...) - result = append(result, ReferencesFromConfig(p.RawConfig)...) + if p.When == config.ProvisionerWhenCreate { + result = append(result, ReferencesFromConfig(p.ConnInfo)...) + result = append(result, ReferencesFromConfig(p.RawConfig)...) + } } - return result + return uniqueStrings(result) } // If we have state, that is our next source @@ -110,6 +113,63 @@ func (n *NodeAbstractResource) References() []string { return nil } +// StateReferences returns the dependencies to put into the state for +// this resource. +func (n *NodeAbstractResource) StateReferences() []string { + self := n.ReferenceableName() + + // Determine what our "prefix" is for checking for references to + // ourself. + addrCopy := n.Addr.Copy() + addrCopy.Index = -1 + selfPrefix := addrCopy.String() + "." + + depsRaw := n.References() + deps := make([]string, 0, len(depsRaw)) + for _, d := range depsRaw { + // Ignore any variable dependencies + if strings.HasPrefix(d, "var.") { + continue + } + + // If this has a backup ref, ignore those for now. The old state + // file never contained those and I'd rather store the rich types we + // add in the future. + if idx := strings.IndexRune(d, '/'); idx != -1 { + d = d[:idx] + } + + // If we're referencing ourself, then ignore it + found := false + for _, s := range self { + if d == s { + found = true + } + } + if found { + continue + } + + // If this is a reference to ourself and a specific index, we keep + // it. For example, if this resource is "foo.bar" and the reference + // is "foo.bar.0" then we keep it exact. Otherwise, we strip it. + if strings.HasSuffix(d, ".0") && !strings.HasPrefix(d, selfPrefix) { + d = d[:len(d)-2] + } + + // This is sad. The dependencies are currently in the format of + // "module.foo.bar" (the full field). This strips the field off. + if strings.HasPrefix(d, "module.") { + parts := strings.SplitN(d, ".", 3) + d = strings.Join(parts[0:2], ".") + } + + deps = append(deps, d) + } + + return deps +} + // GraphNodeProviderConsumer func (n *NodeAbstractResource) ProvidedBy() []string { // If we have a config we prefer that above all else diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract_count.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract_count.go new file mode 100644 index 0000000000..573570d8e2 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract_count.go @@ -0,0 +1,50 @@ +package terraform + +// NodeAbstractCountResource should be embedded instead of NodeAbstractResource +// if the resource has a `count` value that needs to be expanded. +// +// The embedder should implement `DynamicExpand` to process the count. +type NodeAbstractCountResource struct { + *NodeAbstractResource + + // Validate, if true, will perform the validation for the count. + // This should only be turned on for the "validate" operation. + Validate bool +} + +// GraphNodeEvalable +func (n *NodeAbstractCountResource) EvalTree() EvalNode { + // We only check if the count is computed if we're not validating. + // If we're validating we allow computed counts since they just turn + // into more computed values. + var evalCountCheckComputed EvalNode + if !n.Validate { + evalCountCheckComputed = &EvalCountCheckComputed{Resource: n.Config} + } + + return &EvalSequence{ + Nodes: []EvalNode{ + // The EvalTree for a plannable resource primarily involves + // interpolating the count since it can contain variables + // we only just received access to. + // + // With the interpolated count, we can then DynamicExpand + // into the proper number of instances. + &EvalInterpolate{Config: n.Config.RawCount}, + + // Check if the count is computed + evalCountCheckComputed, + + // If validation is enabled, perform the validation + &EvalIf{ + If: func(ctx EvalContext) (bool, error) { + return n.Validate, nil + }, + + Then: &EvalValidateCount{Resource: n.Config}, + }, + + &EvalCountFixZeroOneBoundary{Resource: n.Config}, + }, + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply.go index a166836423..3599782b9d 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply.go @@ -70,16 +70,8 @@ func (n *NodeApplyableResource) EvalTree() EvalNode { resource.CountIndex = 0 } - // Determine the dependencies for the state. We use some older - // code for this that we've used for a long time. - var stateDeps []string - { - oldN := &graphNodeExpandedResource{ - Resource: n.Config, - Index: addr.Index, - } - stateDeps = oldN.StateDependencies() - } + // Determine the dependencies for the state. + stateDeps := n.StateReferences() // Eval info is different depending on what kind of resource this is switch n.Config.Mode { @@ -298,6 +290,12 @@ func (n *NodeApplyableResource) evalTreeManagedResource( Name: stateId, Output: &state, }, + // Call pre-apply hook + &EvalApplyPre{ + Info: info, + State: &state, + Diff: &diffApply, + }, &EvalApply{ Info: info, State: &state, @@ -321,6 +319,7 @@ func (n *NodeApplyableResource) evalTreeManagedResource( InterpResource: resource, CreateNew: &createNew, Error: &err, + When: config.ProvisionerWhenCreate, }, &EvalIf{ If: func(ctx EvalContext) (bool, error) { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy.go index 58454f7886..c2efd2c384 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy.go @@ -68,6 +68,21 @@ func (n *NodeDestroyResource) ReferenceableName() []string { // GraphNodeReferencer, overriding NodeAbstractResource func (n *NodeDestroyResource) References() []string { + // If we have a config, then we need to include destroy-time dependencies + if c := n.Config; c != nil { + var result []string + for _, p := range c.Provisioners { + // We include conn info and config for destroy time provisioners + // as dependencies that we have. + if p.When == config.ProvisionerWhenDestroy { + result = append(result, ReferencesFromConfig(p.ConnInfo)...) + result = append(result, ReferencesFromConfig(p.RawConfig)...) + } + } + + return result + } + return nil } @@ -119,6 +134,17 @@ func (n *NodeDestroyResource) EvalTree() EvalNode { uniqueExtra: "destroy", } + // Build the resource for eval + addr := n.Addr + resource := &Resource{ + Name: addr.Name, + Type: addr.Type, + CountIndex: addr.Index, + } + if resource.CountIndex < 0 { + resource.CountIndex = 0 + } + // Get our state rs := n.ResourceState if rs == nil { @@ -172,6 +198,48 @@ func (n *NodeDestroyResource) EvalTree() EvalNode { &EvalRequireState{ State: &state, }, + + // Call pre-apply hook + &EvalApplyPre{ + Info: info, + State: &state, + Diff: &diffApply, + }, + + // Run destroy provisioners if not tainted + &EvalIf{ + If: func(ctx EvalContext) (bool, error) { + if state != nil && state.Tainted { + return false, nil + } + + return true, nil + }, + + Then: &EvalApplyProvisioners{ + Info: info, + State: &state, + Resource: n.Config, + InterpResource: resource, + Error: &err, + When: config.ProvisionerWhenDestroy, + }, + }, + + // If we have a provisioning error, then we just call + // the post-apply hook now. + &EvalIf{ + If: func(ctx EvalContext) (bool, error) { + return err != nil, nil + }, + + Then: &EvalApplyPost{ + Info: info, + State: &state, + Error: &err, + }, + }, + // Make sure we handle data sources properly. &EvalIf{ If: func(ctx EvalContext) (bool, error) { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan.go index c4694d4930..52bbf88a1b 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan.go @@ -7,34 +7,7 @@ import ( // NodePlannableResource represents a resource that is "plannable": // it is ready to be planned in order to create a diff. type NodePlannableResource struct { - *NodeAbstractResource - - // Set by GraphNodeTargetable and used during DynamicExpand to - // forward targets downwards. - targets []ResourceAddress -} - -// GraphNodeTargetable -func (n *NodePlannableResource) SetTargets(targets []ResourceAddress) { - n.targets = targets -} - -// GraphNodeEvalable -func (n *NodePlannableResource) EvalTree() EvalNode { - return &EvalSequence{ - Nodes: []EvalNode{ - // The EvalTree for a plannable resource primarily involves - // interpolating the count since it can contain variables - // we only just received access to. - // - // With the interpolated count, we can then DynamicExpand - // into the proper number of instances. - &EvalInterpolate{Config: n.Config.RawCount}, - - &EvalCountCheckComputed{Resource: n.Config}, - &EvalCountFixZeroOneBoundary{Resource: n.Config}, - }, - } + *NodeAbstractCountResource } // GraphNodeDynamicExpandable @@ -91,7 +64,7 @@ func (n *NodePlannableResource) DynamicExpand(ctx EvalContext) (*Graph, error) { &AttachStateTransformer{State: state}, // Targeting - &TargetsTransformer{ParsedTargets: n.targets}, + &TargetsTransformer{ParsedTargets: n.Targets}, // Connect references so ordering is correct &ReferenceTransformer{}, diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_instance.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_instance.go index 418d0f657e..b52956908b 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_instance.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_instance.go @@ -37,13 +37,8 @@ func (n *NodePlannableResourceInstance) EvalTree() EvalNode { resource.CountIndex = 0 } - // Determine the dependencies for the state. We use some older - // code for this that we've used for a long time. - var stateDeps []string - { - oldN := &graphNodeExpandedResource{Resource: n.Config} - stateDeps = oldN.StateDependencies() - } + // Determine the dependencies for the state. + stateDeps := n.StateReferences() // Eval info is different depending on what kind of resource this is switch n.Config.Mode { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_refresh.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_refresh.go new file mode 100644 index 0000000000..3a44926cef --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_refresh.go @@ -0,0 +1,100 @@ +package terraform + +import ( + "fmt" + + "github.com/hashicorp/terraform/config" +) + +// NodeRefreshableResource represents a resource that is "applyable": +// it is ready to be applied and is represented by a diff. +type NodeRefreshableResource struct { + *NodeAbstractResource +} + +// GraphNodeDestroyer +func (n *NodeRefreshableResource) DestroyAddr() *ResourceAddress { + return n.Addr +} + +// GraphNodeEvalable +func (n *NodeRefreshableResource) EvalTree() EvalNode { + // Eval info is different depending on what kind of resource this is + switch mode := n.Addr.Mode; mode { + case config.ManagedResourceMode: + return n.evalTreeManagedResource() + + case config.DataResourceMode: + // Get the data source node. If we don't have a configuration + // then it is an orphan so we destroy it (remove it from the state). + var dn GraphNodeEvalable + if n.Config != nil { + dn = &NodeRefreshableDataResourceInstance{ + NodeAbstractResource: n.NodeAbstractResource, + } + } else { + dn = &NodeDestroyableDataResource{ + NodeAbstractResource: n.NodeAbstractResource, + } + } + + return dn.EvalTree() + default: + panic(fmt.Errorf("unsupported resource mode %s", mode)) + } +} + +func (n *NodeRefreshableResource) evalTreeManagedResource() EvalNode { + addr := n.NodeAbstractResource.Addr + + // stateId is the ID to put into the state + stateId := addr.stateId() + + // Build the instance info. More of this will be populated during eval + info := &InstanceInfo{ + Id: stateId, + Type: addr.Type, + } + + // Declare a bunch of variables that are used for state during + // evaluation. Most of this are written to by-address below. + var provider ResourceProvider + var state *InstanceState + + // This happened during initial development. All known cases were + // fixed and tested but as a sanity check let's assert here. + if n.ResourceState == nil { + err := fmt.Errorf( + "No resource state attached for addr: %s\n\n"+ + "This is a bug. Please report this to Terraform with your configuration\n"+ + "and state attached. Please be careful to scrub any sensitive information.", + addr) + return &EvalReturnError{Error: &err} + } + + return &EvalSequence{ + Nodes: []EvalNode{ + &EvalGetProvider{ + Name: n.ProvidedBy()[0], + Output: &provider, + }, + &EvalReadState{ + Name: stateId, + Output: &state, + }, + &EvalRefresh{ + Info: info, + Provider: &provider, + State: &state, + Output: &state, + }, + &EvalWriteState{ + Name: stateId, + ResourceType: n.ResourceState.Type, + Provider: n.ResourceState.Provider, + Dependencies: n.ResourceState.Dependencies, + State: &state, + }, + }, + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_validate.go b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_validate.go new file mode 100644 index 0000000000..f528f24b19 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/node_resource_validate.go @@ -0,0 +1,158 @@ +package terraform + +import ( + "github.com/hashicorp/terraform/dag" +) + +// NodeValidatableResource represents a resource that is used for validation +// only. +type NodeValidatableResource struct { + *NodeAbstractCountResource +} + +// GraphNodeEvalable +func (n *NodeValidatableResource) EvalTree() EvalNode { + // Ensure we're validating + c := n.NodeAbstractCountResource + c.Validate = true + return c.EvalTree() +} + +// GraphNodeDynamicExpandable +func (n *NodeValidatableResource) DynamicExpand(ctx EvalContext) (*Graph, error) { + // Grab the state which we read + state, lock := ctx.State() + lock.RLock() + defer lock.RUnlock() + + // Expand the resource count which must be available by now from EvalTree + count := 1 + if n.Config.RawCount.Value() != unknownValue() { + var err error + count, err = n.Config.Count() + if err != nil { + return nil, err + } + } + + // The concrete resource factory we'll use + concreteResource := func(a *NodeAbstractResource) dag.Vertex { + // Add the config and state since we don't do that via transforms + a.Config = n.Config + + return &NodeValidatableResourceInstance{ + NodeAbstractResource: a, + } + } + + // Start creating the steps + steps := []GraphTransformer{ + // Expand the count. + &ResourceCountTransformer{ + Concrete: concreteResource, + Count: count, + Addr: n.ResourceAddr(), + }, + + // Attach the state + &AttachStateTransformer{State: state}, + + // Targeting + &TargetsTransformer{ParsedTargets: n.Targets}, + + // Connect references so ordering is correct + &ReferenceTransformer{}, + + // Make sure there is a single root + &RootTransformer{}, + } + + // Build the graph + b := &BasicGraphBuilder{ + Steps: steps, + Validate: true, + Name: "NodeValidatableResource", + } + + return b.Build(ctx.Path()) +} + +// This represents a _single_ resource instance to validate. +type NodeValidatableResourceInstance struct { + *NodeAbstractResource +} + +// GraphNodeEvalable +func (n *NodeValidatableResourceInstance) EvalTree() EvalNode { + addr := n.NodeAbstractResource.Addr + + // Build the resource for eval + resource := &Resource{ + Name: addr.Name, + Type: addr.Type, + CountIndex: addr.Index, + } + if resource.CountIndex < 0 { + resource.CountIndex = 0 + } + + // Declare a bunch of variables that are used for state during + // evaluation. Most of this are written to by-address below. + var config *ResourceConfig + var provider ResourceProvider + + seq := &EvalSequence{ + Nodes: []EvalNode{ + &EvalValidateResourceSelfRef{ + Addr: &addr, + Config: &n.Config.RawConfig, + }, + &EvalGetProvider{ + Name: n.ProvidedBy()[0], + Output: &provider, + }, + &EvalInterpolate{ + Config: n.Config.RawConfig.Copy(), + Resource: resource, + Output: &config, + }, + &EvalValidateResource{ + Provider: &provider, + Config: &config, + ResourceName: n.Config.Name, + ResourceType: n.Config.Type, + ResourceMode: n.Config.Mode, + }, + }, + } + + // Validate all the provisioners + for _, p := range n.Config.Provisioners { + var provisioner ResourceProvisioner + var connConfig *ResourceConfig + seq.Nodes = append( + seq.Nodes, + &EvalGetProvisioner{ + Name: p.Type, + Output: &provisioner, + }, + &EvalInterpolate{ + Config: p.RawConfig.Copy(), + Resource: resource, + Output: &config, + }, + &EvalInterpolate{ + Config: p.ConnInfo.Copy(), + Resource: resource, + Output: &connConfig, + }, + &EvalValidateProvisioner{ + Provisioner: &provisioner, + Config: &config, + ConnConfig: &connConfig, + }, + ) + } + + return seq +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/plan.go b/installer/vendor/github.com/hashicorp/terraform/terraform/plan.go index 75023a0c6f..ea0884505a 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/plan.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/plan.go @@ -20,6 +20,10 @@ func init() { // Plan represents a single Terraform execution plan, which contains // all the information necessary to make an infrastructure change. +// +// A plan has to contain basically the entire state of the world +// necessary to make a change: the state, diff, config, backend config, etc. +// This is so that it can run alone without any other data. type Plan struct { Diff *Diff Module *module.Tree @@ -27,6 +31,9 @@ type Plan struct { Vars map[string]interface{} Targets []string + // Backend is the backend that this plan should use and store data with. + Backend *BackendState + once sync.Once } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/resource_address.go b/installer/vendor/github.com/hashicorp/terraform/terraform/resource_address.go index aa35dbb41a..a8a0c95530 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/resource_address.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/resource_address.go @@ -285,14 +285,17 @@ func tokenizeResourceAddress(s string) (map[string]string, error) { // "1" (optional, omission implies: "0") `(?:\[(?P\d+)\])?` + `\z`) + groupNames := re.SubexpNames() rawMatches := re.FindAllStringSubmatch(s, -1) if len(rawMatches) != 1 { return nil, fmt.Errorf("Problem parsing address: %q", s) } + matches := make(map[string]string) for i, m := range rawMatches[0] { matches[groupNames[i]] = m } + return matches, nil } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go b/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go index 3327e30007..361ec1ec09 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go @@ -21,6 +21,26 @@ type ResourceProvisioner interface { // is provided since provisioners only run after a resource has been // newly created. Apply(UIOutput, *InstanceState, *ResourceConfig) error + + // Stop is called when the provisioner should halt any in-flight actions. + // + // This can be used to make a nicer Ctrl-C experience for Terraform. + // Even if this isn't implemented to do anything (just returns nil), + // Terraform will still cleanly stop after the currently executing + // graph node is complete. However, this API can be used to make more + // efficient halts. + // + // Stop doesn't have to and shouldn't block waiting for in-flight actions + // to complete. It should take any action it wants and return immediately + // acknowledging it has received the stop request. Terraform core will + // automatically not make any further API calls to the provider soon + // after Stop is called (technically exactly once the currently executing + // graph nodes are complete). + // + // The error returned, if non-nil, is assumed to mean that signaling the + // stop somehow failed and that the user should expect potentially waiting + // a longer period of time. + Stop() error } // ResourceProvisionerCloser is an interface that provisioners that can close diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go b/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go index be04e98146..f471a5182b 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go @@ -21,6 +21,10 @@ type MockResourceProvisioner struct { ValidateFn func(c *ResourceConfig) ([]string, []error) ValidateReturnWarns []string ValidateReturnErrors []error + + StopCalled bool + StopFn func() error + StopReturnError error } func (p *MockResourceProvisioner) Validate(c *ResourceConfig) ([]string, []error) { @@ -40,14 +44,29 @@ func (p *MockResourceProvisioner) Apply( state *InstanceState, c *ResourceConfig) error { p.Lock() - defer p.Unlock() p.ApplyCalled = true p.ApplyOutput = output p.ApplyState = state p.ApplyConfig = c if p.ApplyFn != nil { - return p.ApplyFn(state, c) + fn := p.ApplyFn + p.Unlock() + return fn(state, c) } + + defer p.Unlock() return p.ApplyReturnError } + +func (p *MockResourceProvisioner) Stop() error { + p.Lock() + defer p.Unlock() + + p.StopCalled = true + if p.StopFn != nil { + return p.StopFn() + } + + return p.StopReturnError +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/semantics.go b/installer/vendor/github.com/hashicorp/terraform/terraform/semantics.go index 6d99875cd0..20f1d8a274 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/semantics.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/semantics.go @@ -49,25 +49,6 @@ type SemanticChecker interface { Check(*dag.Graph, dag.Vertex) error } -// SemanticCheckModulesExist is an implementation of SemanticChecker that -// verifies that all the modules that are referenced in the graph exist. -type SemanticCheckModulesExist struct{} - -// TODO: test -func (*SemanticCheckModulesExist) Check(g *dag.Graph, v dag.Vertex) error { - mn, ok := v.(*GraphNodeConfigModule) - if !ok { - return nil - } - - if mn.Tree == nil { - return fmt.Errorf( - "module '%s' not found", mn.Module.Name) - } - - return nil -} - // smcUserVariables does all the semantic checks to verify that the // variables given satisfy the configuration itself. func smcUserVariables(c *config.Config, vs map[string]interface{}) []error { diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_context.go b/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_context.go index 5e0e31609d..5588af252c 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_context.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_context.go @@ -46,6 +46,7 @@ func newShadowContext(c *Context) (*Context, *Context, Shadow) { destroy: c.destroy, diff: c.diff.DeepCopy(), hooks: nil, + meta: c.meta, module: c.module, state: c.state.DeepCopy(), targets: targetRaw.([]string), @@ -77,6 +78,7 @@ func newShadowContext(c *Context) (*Context, *Context, Shadow) { diff: c.diff, // diffLock - no copy hooks: c.hooks, + meta: c.meta, module: c.module, sh: c.sh, state: c.state, @@ -88,7 +90,8 @@ func newShadowContext(c *Context) (*Context, *Context, Shadow) { // l - no copy parallelSem: c.parallelSem, providerInputConfig: c.providerInputConfig, - runCh: c.runCh, + runContext: c.runContext, + runContextCancel: c.runContextCancel, shadowErr: c.shadowErr, } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_resource_provisioner.go b/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_resource_provisioner.go index 6e405c09db..60a4908896 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_resource_provisioner.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/shadow_resource_provisioner.go @@ -112,6 +112,10 @@ func (p *shadowResourceProvisionerReal) Apply( return err } +func (p *shadowResourceProvisionerReal) Stop() error { + return p.ResourceProvisioner.Stop() +} + // shadowResourceProvisionerShadow is the shadow resource provisioner. Function // calls never affect real resources. This is paired with the "real" side // which must be called properly to enable recording. @@ -228,6 +232,13 @@ func (p *shadowResourceProvisionerShadow) Apply( return result.ResultErr } +func (p *shadowResourceProvisionerShadow) Stop() error { + // For the shadow, we always just return nil since a Stop indicates + // that we were interrupted and shadows are disabled during interrupts + // anyways. + return nil +} + // The structs for the various function calls are put below. These structs // are used to carry call information across the real/shadow boundaries. diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/state.go b/installer/vendor/github.com/hashicorp/terraform/terraform/state.go index 7acdd51a34..074b682454 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/state.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/state.go @@ -4,12 +4,12 @@ import ( "bufio" "bytes" "encoding/json" + "errors" "fmt" "io" "io/ioutil" "log" "reflect" - "regexp" "sort" "strconv" "strings" @@ -79,6 +79,11 @@ type State struct { // pull and push state files from a remote storage endpoint. Remote *RemoteState `json:"remote,omitempty"` + // Backend tracks the configuration for the backend in use with + // this state. This is used to track any changes in the backend + // configuration. + Backend *BackendState `json:"backend,omitempty"` + // Modules contains all the modules in a breadth-first order Modules []*ModuleState `json:"modules"` @@ -579,7 +584,7 @@ func (s *State) CompareAges(other *State) (StateAgeComparison, error) { } // SameLineage returns true only if the state given in argument belongs -// to the same "lineage" of states as the reciever. +// to the same "lineage" of states as the receiver. func (s *State) SameLineage(other *State) bool { s.Lock() defer s.Unlock() @@ -779,6 +784,43 @@ func (s *State) String() string { return strings.TrimSpace(buf.String()) } +// BackendState stores the configuration to connect to a remote backend. +type BackendState struct { + Type string `json:"type"` // Backend type + Config map[string]interface{} `json:"config"` // Backend raw config + + // Hash is the hash code to uniquely identify the original source + // configuration. We use this to detect when there is a change in + // configuration even when "type" isn't changed. + Hash uint64 `json:"hash"` +} + +// Empty returns true if BackendState has no state. +func (s *BackendState) Empty() bool { + return s == nil || s.Type == "" +} + +// Rehash returns a unique content hash for this backend's configuration +// as a uint64 value. +// The Hash stored in the backend state needs to match the config itself, but +// we need to compare the backend config after it has been combined with all +// options. +// This function must match the implementation used by config.Backend. +func (s *BackendState) Rehash() uint64 { + if s == nil { + return 0 + } + + cfg := config.Backend{ + Type: s.Type, + RawConfig: &config.RawConfig{ + Raw: s.Config, + }, + } + + return cfg.Rehash() +} + // RemoteState is used to track the information about a remote // state store that we push/pull state to. type RemoteState struct { @@ -1120,6 +1162,8 @@ func (m *ModuleState) prune() { delete(m.Outputs, k) } } + + m.Dependencies = uniqueStrings(m.Dependencies) } func (m *ModuleState) sort() { @@ -1142,7 +1186,8 @@ func (m *ModuleState) String() string { for name, _ := range m.Resources { names = append(names, name) } - sort.Strings(names) + + sort.Sort(resourceNameSort(names)) for _, k := range names { rs := m.Resources[k] @@ -1182,6 +1227,7 @@ func (m *ModuleState) String() string { attrKeys = append(attrKeys, ak) } + sort.Strings(attrKeys) for _, ak := range attrKeys { @@ -1212,6 +1258,7 @@ func (m *ModuleState) String() string { for k, _ := range m.Outputs { ks = append(ks, k) } + sort.Strings(ks) for _, k := range ks { @@ -1480,8 +1527,9 @@ func (s *ResourceState) prune() { i-- } } - s.Deposed = s.Deposed[:n] + + s.Dependencies = uniqueStrings(s.Dependencies) } func (s *ResourceState) sort() { @@ -1519,8 +1567,9 @@ type InstanceState struct { // Meta is a simple K/V map that is persisted to the State but otherwise // ignored by Terraform core. It's meant to be used for accounting by - // external client code. - Meta map[string]string `json:"meta"` + // external client code. The value here must only contain Go primitives + // and collections. + Meta map[string]interface{} `json:"meta"` // Tainted is used to mark a resource for recreation. Tainted bool `json:"tainted"` @@ -1539,7 +1588,7 @@ func (s *InstanceState) init() { s.Attributes = make(map[string]string) } if s.Meta == nil { - s.Meta = make(map[string]string) + s.Meta = make(map[string]interface{}) } s.Ephemeral.init() } @@ -1610,13 +1659,11 @@ func (s *InstanceState) Equal(other *InstanceState) bool { if len(s.Meta) != len(other.Meta) { return false } - for k, v := range s.Meta { - otherV, ok := other.Meta[k] - if !ok { - return false - } - - if v != otherV { + if s.Meta != nil && other.Meta != nil { + // We only do the deep check if both are non-nil. If one is nil + // we treat it as equal since their lengths are both zero (check + // above). + if !reflect.DeepEqual(s.Meta, other.Meta) { return false } } @@ -1665,32 +1712,6 @@ func (s *InstanceState) MergeDiff(d *InstanceDiff) *InstanceState { } } - // Remove any now empty array, maps or sets because a parent structure - // won't include these entries in the count value. - isCount := regexp.MustCompile(`\.[%#]$`).MatchString - var deleted []string - - for k, v := range result.Attributes { - if isCount(k) && v == "0" { - delete(result.Attributes, k) - deleted = append(deleted, k) - } - } - - for _, k := range deleted { - // Sanity check for invalid structures. - // If we removed the primary count key, there should have been no - // other keys left with this prefix. - - // this must have a "#" or "%" which we need to remove - base := k[:len(k)-1] - for k, _ := range result.Attributes { - if strings.HasPrefix(k, base) { - panic(fmt.Sprintf("empty structure %q has entry %q", base, k)) - } - } - } - return result } @@ -1779,10 +1800,18 @@ func testForV0State(buf *bufio.Reader) error { return nil } +// ErrNoState is returned by ReadState when the io.Reader contains no data +var ErrNoState = errors.New("no state") + // ReadState reads a state structure out of a reader in the format that // was written by WriteState. func ReadState(src io.Reader) (*State, error) { buf := bufio.NewReader(src) + if _, err := buf.Peek(1); err != nil { + // the error is either io.EOF or "invalid argument", and both are from + // an empty state. + return nil, ErrNoState + } if err := testForV0State(buf); err != nil { return nil, err @@ -1904,12 +1933,12 @@ func ReadStateV2(jsonBytes []byte) (*State, error) { } } - // Sort it - state.sort() - // catch any unitialized fields in the state state.init() + // Sort it + state.sort() + return state, nil } @@ -1939,12 +1968,12 @@ func ReadStateV3(jsonBytes []byte) (*State, error) { } } - // Sort it - state.sort() - // catch any unitialized fields in the state state.init() + // Sort it + state.sort() + // Now we write the state back out to detect any changes in normaliztion. // If our state is now written out differently, bump the serial number to // prevent conflicts. @@ -1964,12 +1993,17 @@ func ReadStateV3(jsonBytes []byte) (*State, error) { // WriteState writes a state somewhere in a binary format. func WriteState(d *State, dst io.Writer) error { - // Make sure it is sorted - d.sort() + // writing a nil state is a noop. + if d == nil { + return nil + } // make sure we have no uninitialized fields d.init() + // Make sure it is sorted + d.sort() + // Ensure the version is set d.Version = StateVersion @@ -2003,6 +2037,48 @@ func WriteState(d *State, dst io.Writer) error { return nil } +// resourceNameSort implements the sort.Interface to sort name parts lexically for +// strings and numerically for integer indexes. +type resourceNameSort []string + +func (r resourceNameSort) Len() int { return len(r) } +func (r resourceNameSort) Swap(i, j int) { r[i], r[j] = r[j], r[i] } + +func (r resourceNameSort) Less(i, j int) bool { + iParts := strings.Split(r[i], ".") + jParts := strings.Split(r[j], ".") + + end := len(iParts) + if len(jParts) < end { + end = len(jParts) + } + + for idx := 0; idx < end; idx++ { + if iParts[idx] == jParts[idx] { + continue + } + + // sort on the first non-matching part + iInt, iIntErr := strconv.Atoi(iParts[idx]) + jInt, jIntErr := strconv.Atoi(jParts[idx]) + + switch { + case iIntErr == nil && jIntErr == nil: + // sort numerically if both parts are integers + return iInt < jInt + case iIntErr == nil: + // numbers sort before strings + return true + case jIntErr == nil: + return false + default: + return iParts[idx] < jParts[idx] + } + } + + return r[i] < r[j] +} + // moduleStateSort implements sort.Interface to sort module states type moduleStateSort []*ModuleState diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/state_filter.go b/installer/vendor/github.com/hashicorp/terraform/terraform/state_filter.go index 1b41a3b7ed..2dcb11b76b 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/state_filter.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/state_filter.go @@ -34,7 +34,7 @@ func (f *StateFilter) Filter(fs ...string) ([]*StateFilterResult, error) { as[i] = a } - // If we werent given any filters, then we list all + // If we weren't given any filters, then we list all if len(fs) == 0 { as = append(as, &ResourceAddress{Index: -1}) } @@ -85,15 +85,22 @@ func (f *StateFilter) filterSingle(a *ResourceAddress) []*StateFilterResult { // the modules to find relevant resources. for _, m := range modules { for n, r := range m.Resources { - if f.relevant(a, r) { - // The name in the state contains valuable information. Parse. - key, err := ParseResourceStateKey(n) - if err != nil { - // If we get an error parsing, then just ignore it - // out of the state. - continue - } + // The name in the state contains valuable information. Parse. + key, err := ParseResourceStateKey(n) + if err != nil { + // If we get an error parsing, then just ignore it + // out of the state. + continue + } + // Older states and test fixtures often don't contain the + // type directly on the ResourceState. We add this so StateFilter + // is a bit more robust. + if r.Type == "" { + r.Type = key.Type + } + + if f.relevant(a, r) { if a.Name != "" && a.Name != key.Name { // Name doesn't match continue @@ -243,6 +250,13 @@ func (s StateFilterResultSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s StateFilterResultSlice) Less(i, j int) bool { a, b := s[i], s[j] + // if these address contain an index, we want to sort by index rather than name + addrA, errA := ParseResourceAddress(a.Address) + addrB, errB := ParseResourceAddress(b.Address) + if errA == nil && errB == nil && addrA.Name == addrB.Name && addrA.Index != addrB.Index { + return addrA.Index < addrB.Index + } + // If the addresses are different it is just lexographic sorting if a.Address != b.Address { return a.Address < b.Address diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v1_to_v2.go b/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v1_to_v2.go index 0386153369..aa13cce803 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v1_to_v2.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v1_to_v2.go @@ -64,10 +64,19 @@ func (old *moduleStateV1) upgradeToV2() (*ModuleState, error) { return nil, nil } - path, err := copystructure.Copy(old.Path) + pathRaw, err := copystructure.Copy(old.Path) if err != nil { return nil, fmt.Errorf("Error upgrading ModuleState V1: %v", err) } + path, ok := pathRaw.([]string) + if !ok { + return nil, fmt.Errorf("Error upgrading ModuleState V1: path is not a list of strings") + } + if len(path) == 0 { + // We found some V1 states with a nil path. Assume root and catch + // duplicate path errors later (as part of Validate). + path = rootModulePath + } // Outputs needs upgrading to use the new structure outputs := make(map[string]*OutputState) @@ -94,7 +103,7 @@ func (old *moduleStateV1) upgradeToV2() (*ModuleState, error) { } return &ModuleState{ - Path: path.([]string), + Path: path, Outputs: outputs, Resources: resources, Dependencies: dependencies.([]string), @@ -150,16 +159,22 @@ func (old *instanceStateV1) upgradeToV2() (*InstanceState, error) { if err != nil { return nil, fmt.Errorf("Error upgrading InstanceState V1: %v", err) } + meta, err := copystructure.Copy(old.Meta) if err != nil { return nil, fmt.Errorf("Error upgrading InstanceState V1: %v", err) } + newMeta := make(map[string]interface{}) + for k, v := range meta.(map[string]string) { + newMeta[k] = v + } + return &InstanceState{ ID: old.ID, Attributes: attributes.(map[string]string), Ephemeral: *ephemeral, - Meta: meta.(map[string]string), + Meta: newMeta, }, nil } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v2_to_v3.go b/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v2_to_v3.go index 1fc458d150..e52d35fcd1 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v2_to_v3.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v2_to_v3.go @@ -18,7 +18,7 @@ func upgradeStateV2ToV3(old *State) (*State, error) { // Ensure the copied version is v2 before attempting to upgrade if new.Version != 2 { - return nil, fmt.Errorf("Cannot appply v2->v3 state upgrade to " + + return nil, fmt.Errorf("Cannot apply v2->v3 state upgrade to " + "a state which is not version 2.") } diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/testing.go b/installer/vendor/github.com/hashicorp/terraform/terraform/testing.go new file mode 100644 index 0000000000..3f0418d927 --- /dev/null +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/testing.go @@ -0,0 +1,19 @@ +package terraform + +import ( + "os" + "testing" +) + +// TestStateFile writes the given state to the path. +func TestStateFile(t *testing.T, path string, state *State) { + f, err := os.Create(path) + if err != nil { + t.Fatalf("err: %s", err) + } + defer f.Close() + + if err := WriteState(state, f); err != nil { + t.Fatalf("err: %s", err) + } +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_attach_state.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_attach_state.go index 623f843dee..564ff08f1f 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_attach_state.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_attach_state.go @@ -49,7 +49,7 @@ func (t *AttachStateTransformer) Transform(g *Graph) error { for _, result := range results { if rs, ok := result.Value.(*ResourceState); ok { log.Printf( - "[DEBUG] Attaching resource state to %q: %s", + "[DEBUG] Attaching resource state to %q: %#v", dag.VertexName(v), rs) an.AttachResourceState(rs) found = true diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config.go index c2dad20c96..61bce8532a 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config.go @@ -4,7 +4,9 @@ import ( "errors" "fmt" "log" + "sync" + "github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/config/module" "github.com/hashicorp/terraform/dag" ) @@ -23,10 +25,25 @@ import ( type ConfigTransformer struct { Concrete ConcreteResourceNodeFunc + // Module is the module to add resources from. Module *module.Tree + + // Unique will only add resources that aren't already present in the graph. + Unique bool + + // Mode will only add resources that match the given mode + ModeFilter bool + Mode config.ResourceMode + + l sync.Mutex + uniqueMap map[string]struct{} } func (t *ConfigTransformer) Transform(g *Graph) error { + // Lock since we use some internal state + t.l.Lock() + defer t.l.Unlock() + // If no module is given, we don't do anything if t.Module == nil { return nil @@ -37,6 +54,18 @@ func (t *ConfigTransformer) Transform(g *Graph) error { return errors.New("module must be loaded for ConfigTransformer") } + // Reset the uniqueness map. If we're tracking uniques, then populate + // it with addresses. + t.uniqueMap = make(map[string]struct{}) + defer func() { t.uniqueMap = nil }() + if t.Unique { + for _, v := range g.Vertices() { + if rn, ok := v.(GraphNodeResource); ok { + t.uniqueMap[rn.ResourceAddr().String()] = struct{}{} + } + } + } + // Start the transformation process return t.transform(g, t.Module) } @@ -66,13 +95,13 @@ func (t *ConfigTransformer) transformSingle(g *Graph, m *module.Tree) error { log.Printf("[TRACE] ConfigTransformer: Starting for path: %v", m.Path()) // Get the configuration for this module - config := m.Config() + conf := m.Config() // Build the path we're at path := m.Path() // Write all the resources out - for _, r := range config.Resources { + for _, r := range conf.Resources { // Build the resource address addr, err := parseResourceAddressConfig(r) if err != nil { @@ -81,6 +110,16 @@ func (t *ConfigTransformer) transformSingle(g *Graph, m *module.Tree) error { } addr.Path = path + // If this is already in our uniqueness map, don't add it again + if _, ok := t.uniqueMap[addr.String()]; ok { + continue + } + + // Remove non-matching modes + if t.ModeFilter && addr.Mode != t.Mode { + continue + } + // Build the abstract node and the concrete one abstract := &NodeAbstractResource{Addr: addr} var node dag.Vertex = abstract diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config_old.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config_old.go index 5f9851681a..ec4125822e 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config_old.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_config_old.go @@ -1,111 +1,11 @@ package terraform import ( - "errors" "fmt" - "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/config/module" ) -// ConfigTransformerOld is a GraphTransformer that adds the configuration -// to the graph. The module used to configure this transformer must be -// the root module. We'll look up the child module by the Path in the -// Graph. -type ConfigTransformerOld struct { - Module *module.Tree -} - -func (t *ConfigTransformerOld) Transform(g *Graph) error { - // A module is required and also must be completely loaded. - if t.Module == nil { - return errors.New("module must not be nil") - } - if !t.Module.Loaded() { - return errors.New("module must be loaded") - } - - // Get the module we care about - module := t.Module.Child(g.Path[1:]) - if module == nil { - return nil - } - - // Get the configuration for this module - config := module.Config() - - // Create the node list we'll use for the graph - nodes := make([]graphNodeConfig, 0, - (len(config.Variables)+ - len(config.ProviderConfigs)+ - len(config.Modules)+ - len(config.Resources)+ - len(config.Outputs))*2) - - // Write all the variables out - for _, v := range config.Variables { - nodes = append(nodes, &GraphNodeConfigVariable{ - Variable: v, - ModuleTree: t.Module, - ModulePath: g.Path, - }) - } - - // Write all the provider configs out - for _, pc := range config.ProviderConfigs { - nodes = append(nodes, &GraphNodeConfigProvider{Provider: pc}) - } - - // Write all the resources out - for _, r := range config.Resources { - nodes = append(nodes, &GraphNodeConfigResource{ - Resource: r, - Path: g.Path, - }) - } - - // Write all the modules out - children := module.Children() - for _, m := range config.Modules { - path := make([]string, len(g.Path), len(g.Path)+1) - copy(path, g.Path) - path = append(path, m.Name) - - nodes = append(nodes, &GraphNodeConfigModule{ - Path: path, - Module: m, - Tree: children[m.Name], - }) - } - - // Write all the outputs out - for _, o := range config.Outputs { - nodes = append(nodes, &GraphNodeConfigOutput{Output: o}) - } - - // Err is where the final error value will go if there is one - var err error - - // Build the graph vertices - for _, n := range nodes { - g.Add(n) - } - - // Build up the dependencies. We have to do this outside of the above - // loop since the nodes need to be in place for us to build the deps. - for _, n := range nodes { - if missing := g.ConnectDependent(n); len(missing) > 0 { - for _, m := range missing { - err = multierror.Append(err, fmt.Errorf( - "%s: missing dependency: %s", n.Name(), m)) - } - } - } - - return err -} - // varNameForVar returns the VarName value for an interpolated variable. // This value is compared to the VarName() value for the nodes within the // graph to build the graph edges. diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go index 456e8bfd35..2148cef479 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_deposed.go @@ -127,6 +127,12 @@ func (n *graphNodeDeposedResource) EvalTree() EvalNode { State: &state, Output: &diff, }, + // Call pre-apply hook + &EvalApplyPre{ + Info: info, + State: &state, + Diff: &diff, + }, &EvalApply{ Info: info, State: &state, diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy.go deleted file mode 100644 index 64e295805d..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy.go +++ /dev/null @@ -1,284 +0,0 @@ -package terraform - -import ( - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeDestroyable is the interface that nodes that can be destroyed -// must implement. This is used to automatically handle the creation of -// destroy nodes in the graph and the dependency ordering of those destroys. -type GraphNodeDestroyable interface { - // DestroyNode returns the node used for the destroy with the given - // mode. If this returns nil, then a destroy node for that mode - // will not be added. - DestroyNode() GraphNodeDestroy -} - -// GraphNodeDestroy is the interface that must implemented by -// nodes that destroy. -type GraphNodeDestroy interface { - dag.Vertex - - // CreateBeforeDestroy is called to check whether this node - // should be created before it is destroyed. The CreateBeforeDestroy - // transformer uses this information to setup the graph. - CreateBeforeDestroy() bool - - // CreateNode returns the node used for the create side of this - // destroy. This must already exist within the graph. - CreateNode() dag.Vertex -} - -// GraphNodeDestroyPrunable is the interface that can be implemented to -// signal that this node can be pruned depending on state. -type GraphNodeDestroyPrunable interface { - // DestroyInclude is called to check if this node should be included - // with the given state. The state and diff must NOT be modified. - DestroyInclude(*ModuleDiff, *ModuleState) bool -} - -// GraphNodeEdgeInclude can be implemented to not include something -// as an edge within the destroy graph. This is usually done because it -// might cause unnecessary cycles. -type GraphNodeDestroyEdgeInclude interface { - DestroyEdgeInclude(dag.Vertex) bool -} - -// DestroyTransformer is a GraphTransformer that creates the destruction -// nodes for things that _might_ be destroyed. -type DestroyTransformer struct { - FullDestroy bool -} - -func (t *DestroyTransformer) Transform(g *Graph) error { - var connect, remove []dag.Edge - nodeToCn := make(map[dag.Vertex]dag.Vertex, len(g.Vertices())) - nodeToDn := make(map[dag.Vertex]dag.Vertex, len(g.Vertices())) - for _, v := range g.Vertices() { - // If it is not a destroyable, we don't care - cn, ok := v.(GraphNodeDestroyable) - if !ok { - continue - } - - // Grab the destroy side of the node and connect it through - n := cn.DestroyNode() - if n == nil { - continue - } - - // Store it - nodeToCn[n] = cn - nodeToDn[cn] = n - - // If the creation node is equal to the destroy node, then - // don't do any of the edge jump rope below. - if n.(interface{}) == cn.(interface{}) { - continue - } - - // Add it to the graph - g.Add(n) - - // Inherit all the edges from the old node - downEdges := g.DownEdges(v).List() - for _, edgeRaw := range downEdges { - // If this thing specifically requests to not be depended on - // by destroy nodes, then don't. - if i, ok := edgeRaw.(GraphNodeDestroyEdgeInclude); ok && - !i.DestroyEdgeInclude(v) { - continue - } - - g.Connect(dag.BasicEdge(n, edgeRaw.(dag.Vertex))) - } - - // Add a new edge to connect the node to be created to - // the destroy node. - connect = append(connect, dag.BasicEdge(v, n)) - } - - // Go through the nodes we added and determine if they depend - // on any nodes with a destroy node. If so, depend on that instead. - for n, _ := range nodeToCn { - for _, downRaw := range g.DownEdges(n).List() { - target := downRaw.(dag.Vertex) - cn2, ok := target.(GraphNodeDestroyable) - if !ok { - continue - } - - newTarget := nodeToDn[cn2] - if newTarget == nil { - continue - } - - // Make the new edge and transpose - connect = append(connect, dag.BasicEdge(newTarget, n)) - - // Remove the old edge - remove = append(remove, dag.BasicEdge(n, target)) - } - } - - // Atomatically add/remove the edges - for _, e := range connect { - g.Connect(e) - } - for _, e := range remove { - g.RemoveEdge(e) - } - - return nil -} - -// CreateBeforeDestroyTransformer is a GraphTransformer that modifies -// the destroys of some nodes so that the creation happens before the -// destroy. -type CreateBeforeDestroyTransformer struct{} - -func (t *CreateBeforeDestroyTransformer) Transform(g *Graph) error { - // We "stage" the edge connections/destroys in these slices so that - // while we're doing the edge transformations (transpositions) in - // the graph, we're not affecting future edge transpositions. These - // slices let us stage ALL the changes that WILL happen so that all - // of the transformations happen atomically. - var connect, destroy []dag.Edge - - for _, v := range g.Vertices() { - // We only care to use the destroy nodes - dn, ok := v.(GraphNodeDestroy) - if !ok { - continue - } - - // If the node doesn't need to create before destroy, then continue - if !dn.CreateBeforeDestroy() { - if noCreateBeforeDestroyAncestors(g, dn) { - continue - } - - // PURPOSELY HACKY FIX SINCE THIS TRANSFORM IS DEPRECATED. - // This is a hacky way to fix GH-10439. For a detailed description - // of the fix, see CBDEdgeTransformer, which is the equivalent - // transform used by the new graphs. - // - // This transform is deprecated because it is only used by the - // old graphs which are going to be removed. - var update *config.Resource - if dn, ok := v.(*graphNodeResourceDestroy); ok { - update = dn.Original.Resource - } - if dn, ok := v.(*graphNodeResourceDestroyFlat); ok { - update = dn.Original.Resource - } - if update != nil { - update.Lifecycle.CreateBeforeDestroy = true - } - } - - // Get the creation side of this node - cn := dn.CreateNode() - - // Take all the things which depend on the creation node and - // make them dependencies on the destruction. Clarifying this - // with an example: if you have a web server and a load balancer - // and the load balancer depends on the web server, then when we - // do a create before destroy, we want to make sure the steps are: - // - // 1.) Create new web server - // 2.) Update load balancer - // 3.) Delete old web server - // - // This ensures that. - for _, sourceRaw := range g.UpEdges(cn).List() { - source := sourceRaw.(dag.Vertex) - - // If the graph has a "root" node (one added by a RootTransformer and not - // just a resource that happens to have no ancestors), we don't want to - // add any edges to it, because then it ceases to be a root. - if _, ok := source.(graphNodeRoot); ok { - continue - } - - connect = append(connect, dag.BasicEdge(dn, source)) - } - - // Swap the edge so that the destroy depends on the creation - // happening... - connect = append(connect, dag.BasicEdge(dn, cn)) - destroy = append(destroy, dag.BasicEdge(cn, dn)) - } - - for _, edge := range connect { - g.Connect(edge) - } - for _, edge := range destroy { - g.RemoveEdge(edge) - } - - return nil -} - -// noCreateBeforeDestroyAncestors verifies that a vertex has no ancestors that -// are CreateBeforeDestroy. -// If this vertex has an ancestor with CreateBeforeDestroy, we will need to -// inherit that behavior and re-order the edges even if this node type doesn't -// directly implement CreateBeforeDestroy. -func noCreateBeforeDestroyAncestors(g *Graph, v dag.Vertex) bool { - s, _ := g.Ancestors(v) - if s == nil { - return true - } - for _, v := range s.List() { - dn, ok := v.(GraphNodeDestroy) - if !ok { - continue - } - - if dn.CreateBeforeDestroy() { - // some ancestor is CreateBeforeDestroy, so we need to follow suit - return false - } - } - return true -} - -// PruneDestroyTransformer is a GraphTransformer that removes the destroy -// nodes that aren't in the diff. -type PruneDestroyTransformer struct { - Diff *Diff - State *State -} - -func (t *PruneDestroyTransformer) Transform(g *Graph) error { - for _, v := range g.Vertices() { - // If it is not a destroyer, we don't care - dn, ok := v.(GraphNodeDestroyPrunable) - if !ok { - continue - } - - path := g.Path - if pn, ok := v.(GraphNodeSubPath); ok { - path = pn.Path() - } - - var modDiff *ModuleDiff - var modState *ModuleState - if t.Diff != nil { - modDiff = t.Diff.ModuleByPath(path) - } - if t.State != nil { - modState = t.State.ModuleByPath(path) - } - - // Remove it if we should - if !dn.DestroyInclude(modDiff, modState) { - g.Remove(v) - } - } - - return nil -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_edge.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_edge.go index c837cf1725..22be1ab62a 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_edge.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_edge.go @@ -159,9 +159,15 @@ func (t *DestroyEdgeTransformer) Transform(g *Graph) error { // This part is a little bit weird but is the best way to // find the dependencies we need to: build a graph and use the // attach config and state transformers then ask for references. - node := &NodeAbstractResource{Addr: addr} - tempG.Add(node) - tempDestroyed = append(tempDestroyed, node) + abstract := &NodeAbstractResource{Addr: addr} + tempG.Add(abstract) + tempDestroyed = append(tempDestroyed, abstract) + + // We also add the destroy version here since the destroy can + // depend on things that the creation doesn't (destroy provisioners). + destroy := &NodeDestroyResource{NodeAbstractResource: abstract} + tempG.Add(destroy) + tempDestroyed = append(tempDestroyed, destroy) } // Run the graph transforms so we have the information we need to diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_expand.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_expand.go index b58c6bf17a..982c098b81 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_expand.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_expand.go @@ -46,20 +46,3 @@ func (t *ExpandTransform) Transform(v dag.Vertex) (dag.Vertex, error) { log.Printf("[DEBUG] vertex %q: static expanding", dag.VertexName(ev)) return ev.Expand(t.Builder) } - -type GraphNodeBasicSubgraph struct { - NameValue string - Graph *Graph -} - -func (n *GraphNodeBasicSubgraph) Name() string { - return n.NameValue -} - -func (n *GraphNodeBasicSubgraph) Subgraph() dag.Grapher { - return n.Graph -} - -func (n *GraphNodeBasicSubgraph) FlattenGraph() *Graph { - return n.Graph -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_flatten.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_flatten.go deleted file mode 100644 index 206bf97bb4..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_flatten.go +++ /dev/null @@ -1,107 +0,0 @@ -package terraform - -import ( - "fmt" - - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeFlatGraph must be implemented by nodes that have subgraphs -// that they want flattened into the graph. -type GraphNodeFlatGraph interface { - FlattenGraph() *Graph -} - -// GraphNodeFlattenable must be implemented by all nodes that can be -// flattened. If a FlattenGraph returns any nodes that can't be flattened, -// it will be an error. -// -// If Flatten returns nil for the Vertex along with a nil error, it will -// removed from the graph. -type GraphNodeFlattenable interface { - Flatten(path []string) (dag.Vertex, error) -} - -// FlattenTransformer is a transformer that goes through the graph, finds -// subgraphs that can be flattened, and flattens them into this graph, -// removing the prior subgraph node. -type FlattenTransformer struct{} - -func (t *FlattenTransformer) Transform(g *Graph) error { - for _, v := range g.Vertices() { - fn, ok := v.(GraphNodeFlatGraph) - if !ok { - continue - } - - // If we don't want to be flattened, don't do it - subgraph := fn.FlattenGraph() - if subgraph == nil { - continue - } - - // Get all the things that depend on this node. We'll re-connect - // dependents later. We have to copy these here since the UpEdges - // value will be deleted after the Remove below. - dependents := make([]dag.Vertex, 0, 5) - for _, v := range g.UpEdges(v).List() { - dependents = append(dependents, v) - } - - // Remove the old node - g.Remove(v) - - // Go through the subgraph and flatten all the nodes - for _, sv := range subgraph.Vertices() { - // If the vertex already has a subpath then we assume it has - // already been flattened. Ignore it. - if _, ok := sv.(GraphNodeSubPath); ok { - continue - } - - fn, ok := sv.(GraphNodeFlattenable) - if !ok { - return fmt.Errorf( - "unflattenable node: %s %T", - dag.VertexName(sv), sv) - } - - v, err := fn.Flatten(subgraph.Path) - if err != nil { - return fmt.Errorf( - "error flattening %s (%T): %s", - dag.VertexName(sv), sv, err) - } - - if v == nil { - subgraph.Remove(v) - } else { - subgraph.Replace(sv, v) - } - } - - // Now that we've handled any changes to the graph that are - // needed, we can add them all to our graph along with their edges. - for _, sv := range subgraph.Vertices() { - g.Add(sv) - } - for _, se := range subgraph.Edges() { - g.Connect(se) - } - - // Connect the dependencies for all the new nodes that we added. - // This will properly connect variables to their sources, for example. - for _, sv := range subgraph.Vertices() { - g.ConnectDependent(sv) - } - - // Re-connect all the things that dependent on the graph - // we just flattened. This should connect them back into the - // correct nodes if their DependentOn() is setup correctly. - for _, v := range dependents { - g.ConnectDependent(v) - } - } - - return nil -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_module_destroy_old.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_module_destroy_old.go deleted file mode 100644 index e971838f1c..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_module_destroy_old.go +++ /dev/null @@ -1,62 +0,0 @@ -package terraform - -import ( - "fmt" - - "github.com/hashicorp/terraform/dag" -) - -// ModuleDestroyTransformer is a GraphTransformer that adds a node -// to the graph that will just mark the full module for destroy in -// the destroy scenario. -type ModuleDestroyTransformerOld struct{} - -func (t *ModuleDestroyTransformerOld) Transform(g *Graph) error { - // Create the node - n := &graphNodeModuleDestroy{Path: g.Path} - - // Add it to the graph. We don't need any edges because - // it can happen whenever. - g.Add(n) - - return nil -} - -type graphNodeModuleDestroy struct { - Path []string -} - -func (n *graphNodeModuleDestroy) Name() string { - return "plan-destroy" -} - -// GraphNodeEvalable impl. -func (n *graphNodeModuleDestroy) EvalTree() EvalNode { - return &EvalOpFilter{ - Ops: []walkOperation{walkPlanDestroy}, - Node: &EvalDiffDestroyModule{Path: n.Path}, - } -} - -// GraphNodeFlattenable impl. -func (n *graphNodeModuleDestroy) Flatten(p []string) (dag.Vertex, error) { - return &graphNodeModuleDestroyFlat{ - graphNodeModuleDestroy: n, - PathValue: p, - }, nil -} - -type graphNodeModuleDestroyFlat struct { - *graphNodeModuleDestroy - - PathValue []string -} - -func (n *graphNodeModuleDestroyFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeModuleDestroy.Name()) -} - -func (n *graphNodeModuleDestroyFlat) Path() []string { - return n.PathValue -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_noop.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_noop.go deleted file mode 100644 index e36b619377..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_noop.go +++ /dev/null @@ -1,104 +0,0 @@ -package terraform - -import ( - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeNoopPrunable can be implemented by nodes that can be -// pruned if they are noops. -type GraphNodeNoopPrunable interface { - Noop(*NoopOpts) bool -} - -// NoopOpts are the options available to determine if your node is a noop. -type NoopOpts struct { - Graph *Graph - Vertex dag.Vertex - Diff *Diff - State *State - ModDiff *ModuleDiff - ModState *ModuleState -} - -// PruneNoopTransformer is a graph transform that prunes nodes that -// consider themselves no-ops. This is done to both simplify the graph -// as well as to remove graph nodes that might otherwise cause problems -// during the graph run. Therefore, this transformer isn't completely -// an optimization step, and can instead be considered critical to -// Terraform operations. -// -// Example of the above case: variables for modules interpolate their values. -// Interpolation will fail on destruction (since attributes are being deleted), -// but variables shouldn't even eval if there is nothing that will consume -// the variable. Therefore, variables can note that they can be omitted -// safely in this case. -// -// The PruneNoopTransformer will prune nodes depth first, and will automatically -// create connect through the dependencies of pruned nodes. For example, -// if we have a graph A => B => C (A depends on B, etc.), and B decides to -// be removed, we'll still be left with A => C; the edge will be properly -// connected. -type PruneNoopTransformer struct { - Diff *Diff - State *State -} - -func (t *PruneNoopTransformer) Transform(g *Graph) error { - // Find the leaves. - leaves := make([]dag.Vertex, 0, 10) - for _, v := range g.Vertices() { - if g.DownEdges(v).Len() == 0 { - leaves = append(leaves, v) - } - } - - // Do a depth first walk from the leaves and remove things. - return g.ReverseDepthFirstWalk(leaves, func(v dag.Vertex, depth int) error { - // We need a prunable - pn, ok := v.(GraphNodeNoopPrunable) - if !ok { - return nil - } - - // Start building the noop opts - path := g.Path - if pn, ok := v.(GraphNodeSubPath); ok { - path = pn.Path() - } - - var modDiff *ModuleDiff - var modState *ModuleState - if t.Diff != nil { - modDiff = t.Diff.ModuleByPath(path) - } - if t.State != nil { - modState = t.State.ModuleByPath(path) - } - - // Determine if its a noop. If it isn't, just return - noop := pn.Noop(&NoopOpts{ - Graph: g, - Vertex: v, - Diff: t.Diff, - State: t.State, - ModDiff: modDiff, - ModState: modState, - }) - if !noop { - return nil - } - - // It is a noop! We first preserve edges. - up := g.UpEdges(v).List() - for _, downV := range g.DownEdges(v).List() { - for _, upV := range up { - g.Connect(dag.BasicEdge(upV, downV)) - } - } - - // Then remove it - g.Remove(v) - - return nil - }) -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_orphan.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_orphan.go deleted file mode 100644 index 83a4f6d57e..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_orphan.go +++ /dev/null @@ -1,432 +0,0 @@ -package terraform - -import ( - "fmt" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/config/module" - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeStateRepresentative is an interface that can be implemented by -// a node to say that it is representing a resource in the state. -type GraphNodeStateRepresentative interface { - StateId() []string -} - -// OrphanTransformer is a GraphTransformer that adds orphans to the -// graph. This transformer adds both resource and module orphans. -type OrphanTransformer struct { - // Resource is resource configuration. This is only non-nil when - // expanding a resource that is in the configuration. It can't be - // dependend on. - Resource *config.Resource - - // State is the global state. We require the global state to - // properly find module orphans at our path. - State *State - - // Module is the root module. We'll look up the proper configuration - // using the graph path. - Module *module.Tree - - // View, if non-nil will set a view on the module state. - View string -} - -func (t *OrphanTransformer) Transform(g *Graph) error { - if t.State == nil { - // If the entire state is nil, there can't be any orphans - return nil - } - - // Build up all our state representatives - resourceRep := make(map[string]struct{}) - for _, v := range g.Vertices() { - if sr, ok := v.(GraphNodeStateRepresentative); ok { - for _, k := range sr.StateId() { - resourceRep[k] = struct{}{} - } - } - } - - var config *config.Config - if t.Module != nil { - if module := t.Module.Child(g.Path[1:]); module != nil { - config = module.Config() - } - } - - var resourceVertexes []dag.Vertex - if state := t.State.ModuleByPath(g.Path); state != nil { - // If we have state, then we can have orphan resources - - // If we have a view, get the view - if t.View != "" { - state = state.View(t.View) - } - - resourceOrphans := state.Orphans(config) - - resourceVertexes = make([]dag.Vertex, len(resourceOrphans)) - for i, k := range resourceOrphans { - // If this orphan is represented by some other node somehow, - // then ignore it. - if _, ok := resourceRep[k]; ok { - continue - } - - rs := state.Resources[k] - - rsk, err := ParseResourceStateKey(k) - if err != nil { - return err - } - resourceVertexes[i] = g.Add(&graphNodeOrphanResource{ - Path: g.Path, - ResourceKey: rsk, - Resource: t.Resource, - Provider: rs.Provider, - dependentOn: rs.Dependencies, - }) - } - } - - // Go over each module orphan and add it to the graph. We store the - // vertexes and states outside so that we can connect dependencies later. - moduleOrphans := t.State.ModuleOrphans(g.Path, config) - moduleVertexes := make([]dag.Vertex, len(moduleOrphans)) - for i, path := range moduleOrphans { - var deps []string - if s := t.State.ModuleByPath(path); s != nil { - deps = s.Dependencies - } - - moduleVertexes[i] = g.Add(&graphNodeOrphanModule{ - Path: path, - dependentOn: deps, - }) - } - - // Now do the dependencies. We do this _after_ adding all the orphan - // nodes above because there are cases in which the orphans themselves - // depend on other orphans. - - // Resource dependencies - for _, v := range resourceVertexes { - g.ConnectDependent(v) - } - - // Module dependencies - for _, v := range moduleVertexes { - g.ConnectDependent(v) - } - - return nil -} - -// graphNodeOrphanModule is the graph vertex representing an orphan resource.. -type graphNodeOrphanModule struct { - Path []string - - dependentOn []string -} - -func (n *graphNodeOrphanModule) DependableName() []string { - return []string{n.dependableName()} -} - -func (n *graphNodeOrphanModule) DependentOn() []string { - return n.dependentOn -} - -func (n *graphNodeOrphanModule) Name() string { - return fmt.Sprintf("%s (orphan)", n.dependableName()) -} - -func (n *graphNodeOrphanModule) dependableName() string { - return fmt.Sprintf("module.%s", n.Path[len(n.Path)-1]) -} - -// GraphNodeExpandable -func (n *graphNodeOrphanModule) Expand(b GraphBuilder) (GraphNodeSubgraph, error) { - g, err := b.Build(n.Path) - if err != nil { - return nil, err - } - - return &GraphNodeBasicSubgraph{ - NameValue: n.Name(), - Graph: g, - }, nil -} - -// graphNodeOrphanResource is the graph vertex representing an orphan resource.. -type graphNodeOrphanResource struct { - Path []string - ResourceKey *ResourceStateKey - Resource *config.Resource - Provider string - - dependentOn []string -} - -func (n *graphNodeOrphanResource) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeResource -} - -func (n *graphNodeOrphanResource) ResourceAddress() *ResourceAddress { - return &ResourceAddress{ - Index: n.ResourceKey.Index, - InstanceType: TypePrimary, - Name: n.ResourceKey.Name, - Path: n.Path[1:], - Type: n.ResourceKey.Type, - Mode: n.ResourceKey.Mode, - } -} - -func (n *graphNodeOrphanResource) DependableName() []string { - return []string{n.dependableName()} -} - -func (n *graphNodeOrphanResource) DependentOn() []string { - return n.dependentOn -} - -func (n *graphNodeOrphanResource) Flatten(p []string) (dag.Vertex, error) { - return &graphNodeOrphanResourceFlat{ - graphNodeOrphanResource: n, - PathValue: p, - }, nil -} - -func (n *graphNodeOrphanResource) Name() string { - return fmt.Sprintf("%s (orphan)", n.ResourceKey) -} - -func (n *graphNodeOrphanResource) ProvidedBy() []string { - return []string{resourceProvider(n.ResourceKey.Type, n.Provider)} -} - -// GraphNodeEvalable impl. -func (n *graphNodeOrphanResource) EvalTree() EvalNode { - - seq := &EvalSequence{Nodes: make([]EvalNode, 0, 5)} - - // Build instance info - info := &InstanceInfo{Id: n.ResourceKey.String(), Type: n.ResourceKey.Type} - info.uniqueExtra = "destroy" - - seq.Nodes = append(seq.Nodes, &EvalInstanceInfo{Info: info}) - - // Each resource mode has its own lifecycle - switch n.ResourceKey.Mode { - case config.ManagedResourceMode: - seq.Nodes = append( - seq.Nodes, - n.managedResourceEvalNodes(info)..., - ) - case config.DataResourceMode: - seq.Nodes = append( - seq.Nodes, - n.dataResourceEvalNodes(info)..., - ) - default: - panic(fmt.Errorf("unsupported resource mode %s", n.ResourceKey.Mode)) - } - - return seq -} - -func (n *graphNodeOrphanResource) managedResourceEvalNodes(info *InstanceInfo) []EvalNode { - var provider ResourceProvider - var state *InstanceState - - nodes := make([]EvalNode, 0, 3) - - // Refresh the resource - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkRefresh}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - &EvalReadState{ - Name: n.ResourceKey.String(), - Output: &state, - }, - &EvalRefresh{ - Info: info, - Provider: &provider, - State: &state, - Output: &state, - }, - &EvalWriteState{ - Name: n.ResourceKey.String(), - ResourceType: n.ResourceKey.Type, - Provider: n.Provider, - Dependencies: n.DependentOn(), - State: &state, - }, - }, - }, - }) - - // Diff the resource - var diff *InstanceDiff - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkPlan, walkPlanDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalReadState{ - Name: n.ResourceKey.String(), - Output: &state, - }, - &EvalDiffDestroy{ - Info: info, - State: &state, - Output: &diff, - }, - &EvalCheckPreventDestroy{ - Resource: n.Resource, - ResourceId: n.ResourceKey.String(), - Diff: &diff, - }, - &EvalWriteDiff{ - Name: n.ResourceKey.String(), - Diff: &diff, - }, - }, - }, - }) - - // Apply - var err error - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkApply, walkDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalReadDiff{ - Name: n.ResourceKey.String(), - Diff: &diff, - }, - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - &EvalReadState{ - Name: n.ResourceKey.String(), - Output: &state, - }, - &EvalApply{ - Info: info, - State: &state, - Diff: &diff, - Provider: &provider, - Output: &state, - Error: &err, - }, - &EvalWriteState{ - Name: n.ResourceKey.String(), - ResourceType: n.ResourceKey.Type, - Provider: n.Provider, - Dependencies: n.DependentOn(), - State: &state, - }, - &EvalApplyPost{ - Info: info, - State: &state, - Error: &err, - }, - &EvalUpdateStateHook{}, - }, - }, - }) - - return nodes -} - -func (n *graphNodeOrphanResource) dataResourceEvalNodes(info *InstanceInfo) []EvalNode { - nodes := make([]EvalNode, 0, 3) - - // This will remain nil, since we don't retain states for orphaned - // data resources. - var state *InstanceState - - // On both refresh and apply we just drop our state altogether, - // since the config resource validation pass will have proven that the - // resources remaining in the configuration don't need it. - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkRefresh, walkApply}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalWriteState{ - Name: n.ResourceKey.String(), - ResourceType: n.ResourceKey.Type, - Provider: n.Provider, - Dependencies: n.DependentOn(), - State: &state, // state is nil - }, - }, - }, - }) - - return nodes -} - -func (n *graphNodeOrphanResource) dependableName() string { - return n.ResourceKey.String() -} - -// GraphNodeDestroyable impl. -func (n *graphNodeOrphanResource) DestroyNode() GraphNodeDestroy { - return n -} - -// GraphNodeDestroy impl. -func (n *graphNodeOrphanResource) CreateBeforeDestroy() bool { - return false -} - -func (n *graphNodeOrphanResource) CreateNode() dag.Vertex { - return n -} - -// Same as graphNodeOrphanResource, but for flattening -type graphNodeOrphanResourceFlat struct { - *graphNodeOrphanResource - - PathValue []string -} - -func (n *graphNodeOrphanResourceFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeOrphanResource.Name()) -} - -func (n *graphNodeOrphanResourceFlat) Path() []string { - return n.PathValue -} - -// GraphNodeDestroyable impl. -func (n *graphNodeOrphanResourceFlat) DestroyNode() GraphNodeDestroy { - return n -} - -// GraphNodeDestroy impl. -func (n *graphNodeOrphanResourceFlat) CreateBeforeDestroy() bool { - return false -} - -func (n *graphNodeOrphanResourceFlat) CreateNode() dag.Vertex { - return n -} - -func (n *graphNodeOrphanResourceFlat) ProvidedBy() []string { - return modulePrefixList( - n.graphNodeOrphanResource.ProvidedBy(), - modulePrefixStr(n.PathValue)) -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_output_orphan.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_output_orphan.go deleted file mode 100644 index ffaa0b7e26..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_output_orphan.go +++ /dev/null @@ -1,101 +0,0 @@ -package terraform - -import ( - "fmt" - - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeOutput is an interface that nodes that are outputs must -// implement. The OutputName returned is the name of the output key -// that they manage. -type GraphNodeOutput interface { - OutputName() string -} - -// AddOutputOrphanTransformer is a transformer that adds output orphans -// to the graph. Output orphans are outputs that are no longer in the -// configuration and therefore need to be removed from the state. -// -// NOTE: This is the _old_ way to add output orphans that is used with -// legacy graph builders. The new way is OrphanOutputTransformer. -type AddOutputOrphanTransformer struct { - State *State -} - -func (t *AddOutputOrphanTransformer) Transform(g *Graph) error { - // Get the state for this module. If we have no state, we have no orphans - state := t.State.ModuleByPath(g.Path) - if state == nil { - return nil - } - - // Create the set of outputs we do have in the graph - found := make(map[string]struct{}) - for _, v := range g.Vertices() { - on, ok := v.(GraphNodeOutput) - if !ok { - continue - } - - found[on.OutputName()] = struct{}{} - } - - // Go over all the outputs. If we don't have a graph node for it, - // create it. It doesn't need to depend on anything, since its just - // setting it empty. - for k, _ := range state.Outputs { - if _, ok := found[k]; ok { - continue - } - - g.Add(&graphNodeOrphanOutput{OutputName: k}) - } - - return nil -} - -type graphNodeOrphanOutput struct { - OutputName string -} - -func (n *graphNodeOrphanOutput) Name() string { - return fmt.Sprintf("output.%s (orphan)", n.OutputName) -} - -func (n *graphNodeOrphanOutput) EvalTree() EvalNode { - return &EvalOpFilter{ - Ops: []walkOperation{walkApply, walkDestroy, walkRefresh}, - Node: &EvalDeleteOutput{ - Name: n.OutputName, - }, - } -} - -// GraphNodeFlattenable impl. -func (n *graphNodeOrphanOutput) Flatten(p []string) (dag.Vertex, error) { - return &graphNodeOrphanOutputFlat{ - graphNodeOrphanOutput: n, - PathValue: p, - }, nil -} - -type graphNodeOrphanOutputFlat struct { - *graphNodeOrphanOutput - - PathValue []string -} - -func (n *graphNodeOrphanOutputFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeOrphanOutput.Name()) -} - -func (n *graphNodeOrphanOutputFlat) EvalTree() EvalNode { - return &EvalOpFilter{ - Ops: []walkOperation{walkApply, walkDestroy, walkRefresh}, - Node: &EvalDeleteOutput{ - Name: n.OutputName, - }, - } -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider.go index ac13bb9a5c..b9695d5242 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/dag" ) @@ -15,7 +14,6 @@ import ( // they satisfy. type GraphNodeProvider interface { ProviderName() string - ProviderConfig() *config.RawConfig } // GraphNodeCloseProvider is an interface that nodes that can be a close @@ -126,7 +124,7 @@ func (t *MissingProviderTransformer) Transform(g *Graph) error { // Initialize factory if t.Concrete == nil { t.Concrete = func(a *NodeAbstractProvider) dag.Vertex { - return &graphNodeProvider{ProviderNameValue: a.NameValue} + return a } } @@ -188,14 +186,6 @@ func (t *MissingProviderTransformer) Transform(g *Graph) error { PathValue: path, }).(dag.Vertex) if len(path) > 0 { - if fn, ok := v.(GraphNodeFlattenable); ok { - var err error - v, err = fn.Flatten(path) - if err != nil { - return err - } - } - // We'll need the parent provider as well, so let's // add a dummy node to check to make sure that we add // that parent provider. @@ -230,9 +220,6 @@ func (t *ParentProviderTransformer) Transform(g *Graph) error { // We eventually want to get rid of the flat version entirely so // this is a stop-gap while it still exists. var v dag.Vertex = raw - if f, ok := v.(*graphNodeProviderFlat); ok { - v = f.graphNodeProvider - } // Only care about providers pn, ok := v.(GraphNodeProvider) @@ -313,15 +300,7 @@ func providerVertexMap(g *Graph) map[string]dag.Vertex { m := make(map[string]dag.Vertex) for _, v := range g.Vertices() { if pv, ok := v.(GraphNodeProvider); ok { - key := pv.ProviderName() - - // This special case is because the new world view of providers - // is that they should return only their pure name (not the full - // module path with ProviderName). Working towards this future. - if _, ok := v.(*NodeApplyableProvider); ok { - key = providerMapKey(pv.ProviderName(), v) - } - + key := providerMapKey(pv.ProviderName(), v) m[key] = v } } @@ -376,97 +355,13 @@ func (n *graphNodeCloseProvider) DotNode(name string, opts *dag.DotOpts) *dag.Do } } -type graphNodeProvider struct { - ProviderNameValue string -} - -func (n *graphNodeProvider) Name() string { - return fmt.Sprintf("provider.%s", n.ProviderNameValue) -} - -// GraphNodeEvalable impl. -func (n *graphNodeProvider) EvalTree() EvalNode { - return ProviderEvalTree(n.ProviderNameValue, nil) -} - -// GraphNodeDependable impl. -func (n *graphNodeProvider) DependableName() []string { - return []string{n.Name()} -} - -// GraphNodeProvider -func (n *graphNodeProvider) ProviderName() string { - return n.ProviderNameValue -} - -func (n *graphNodeProvider) ProviderConfig() *config.RawConfig { - return nil -} - -// GraphNodeDotter impl. -func (n *graphNodeProvider) DotNode(name string, opts *dag.DotOpts) *dag.DotNode { - return &dag.DotNode{ - Name: name, - Attrs: map[string]string{ - "label": n.Name(), - "shape": "diamond", - }, - } -} - -// GraphNodeDotterOrigin impl. -func (n *graphNodeProvider) DotOrigin() bool { +// RemovableIfNotTargeted +func (n *graphNodeCloseProvider) RemoveIfNotTargeted() bool { + // We need to add this so that this node will be removed if + // it isn't targeted or a dependency of a target. return true } -// GraphNodeFlattenable impl. -func (n *graphNodeProvider) Flatten(p []string) (dag.Vertex, error) { - return &graphNodeProviderFlat{ - graphNodeProvider: n, - PathValue: p, - }, nil -} - -// Same as graphNodeMissingProvider, but for flattening -type graphNodeProviderFlat struct { - *graphNodeProvider - - PathValue []string -} - -func (n *graphNodeProviderFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeProvider.Name()) -} - -func (n *graphNodeProviderFlat) Path() []string { - return n.PathValue -} - -func (n *graphNodeProviderFlat) ProviderName() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), - n.graphNodeProvider.ProviderName()) -} - -// GraphNodeDependable impl. -func (n *graphNodeProviderFlat) DependableName() []string { - return []string{n.Name()} -} - -func (n *graphNodeProviderFlat) DependentOn() []string { - var result []string - - // If we're in a module, then depend on all parent providers. Some of - // these may not exist, hence we depend on all of them. - for i := len(n.PathValue); i > 1; i-- { - prefix := modulePrefixStr(n.PathValue[:i-1]) - result = modulePrefixList(n.graphNodeProvider.DependableName(), prefix) - } - - return result -} - // graphNodeProviderConsumerDummy is a struct that never enters the real // graph (though it could to no ill effect). It implements // GraphNodeProviderConsumer and GraphNodeSubpath as a way to force diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider_old.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider_old.go deleted file mode 100644 index 50b4522591..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provider_old.go +++ /dev/null @@ -1,174 +0,0 @@ -package terraform - -import ( - "fmt" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/dag" -) - -// DisableProviderTransformer "disables" any providers that are only -// depended on by modules. -// -// NOTE: "old" = used by old graph builders, will be removed one day -type DisableProviderTransformerOld struct{} - -func (t *DisableProviderTransformerOld) Transform(g *Graph) error { - // Since we're comparing against edges, we need to make sure we connect - g.ConnectDependents() - - for _, v := range g.Vertices() { - // We only care about providers - pn, ok := v.(GraphNodeProvider) - if !ok || pn.ProviderName() == "" { - continue - } - - // Go through all the up-edges (things that depend on this - // provider) and if any is not a module, then ignore this node. - nonModule := false - for _, sourceRaw := range g.UpEdges(v).List() { - source := sourceRaw.(dag.Vertex) - cn, ok := source.(graphNodeConfig) - if !ok { - nonModule = true - break - } - - if cn.ConfigType() != GraphNodeConfigTypeModule { - nonModule = true - break - } - } - if nonModule { - // We found something that depends on this provider that - // isn't a module, so skip it. - continue - } - - // Disable the provider by replacing it with a "disabled" provider - disabled := &graphNodeDisabledProvider{GraphNodeProvider: pn} - if !g.Replace(v, disabled) { - panic(fmt.Sprintf( - "vertex disappeared from under us: %s", - dag.VertexName(v))) - } - } - - return nil -} - -type graphNodeDisabledProvider struct { - GraphNodeProvider -} - -// GraphNodeEvalable impl. -func (n *graphNodeDisabledProvider) EvalTree() EvalNode { - var resourceConfig *ResourceConfig - - return &EvalOpFilter{ - Ops: []walkOperation{walkInput, walkValidate, walkRefresh, walkPlan, walkApply, walkDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalInterpolate{ - Config: n.ProviderConfig(), - Output: &resourceConfig, - }, - &EvalBuildProviderConfig{ - Provider: n.ProviderName(), - Config: &resourceConfig, - Output: &resourceConfig, - }, - &EvalSetProviderConfig{ - Provider: n.ProviderName(), - Config: &resourceConfig, - }, - }, - }, - } -} - -// GraphNodeFlattenable impl. -func (n *graphNodeDisabledProvider) Flatten(p []string) (dag.Vertex, error) { - return &graphNodeDisabledProviderFlat{ - graphNodeDisabledProvider: n, - PathValue: p, - }, nil -} - -func (n *graphNodeDisabledProvider) Name() string { - return fmt.Sprintf("%s (disabled)", dag.VertexName(n.GraphNodeProvider)) -} - -// GraphNodeDotter impl. -func (n *graphNodeDisabledProvider) DotNode(name string, opts *dag.DotOpts) *dag.DotNode { - return &dag.DotNode{ - Name: name, - Attrs: map[string]string{ - "label": n.Name(), - "shape": "diamond", - }, - } -} - -// GraphNodeDotterOrigin impl. -func (n *graphNodeDisabledProvider) DotOrigin() bool { - return true -} - -// GraphNodeDependable impl. -func (n *graphNodeDisabledProvider) DependableName() []string { - return []string{"provider." + n.ProviderName()} -} - -// GraphNodeProvider impl. -func (n *graphNodeDisabledProvider) ProviderName() string { - return n.GraphNodeProvider.ProviderName() -} - -// GraphNodeProvider impl. -func (n *graphNodeDisabledProvider) ProviderConfig() *config.RawConfig { - return n.GraphNodeProvider.ProviderConfig() -} - -// Same as graphNodeDisabledProvider, but for flattening -type graphNodeDisabledProviderFlat struct { - *graphNodeDisabledProvider - - PathValue []string -} - -func (n *graphNodeDisabledProviderFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeDisabledProvider.Name()) -} - -func (n *graphNodeDisabledProviderFlat) Path() []string { - return n.PathValue -} - -func (n *graphNodeDisabledProviderFlat) ProviderName() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), - n.graphNodeDisabledProvider.ProviderName()) -} - -// GraphNodeDependable impl. -func (n *graphNodeDisabledProviderFlat) DependableName() []string { - return modulePrefixList( - n.graphNodeDisabledProvider.DependableName(), - modulePrefixStr(n.PathValue)) -} - -func (n *graphNodeDisabledProviderFlat) DependentOn() []string { - var result []string - - // If we're in a module, then depend on our parent's provider - if len(n.PathValue) > 1 { - prefix := modulePrefixStr(n.PathValue[:len(n.PathValue)-1]) - result = modulePrefixList( - n.graphNodeDisabledProvider.DependableName(), prefix) - } - - return result -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provisioner.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provisioner.go index 5bd3f65a17..f49d824107 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provisioner.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_provisioner.go @@ -107,18 +107,9 @@ func (t *MissingProvisionerTransformer) Transform(g *Graph) error { } // Build the vertex - var newV dag.Vertex = &graphNodeProvisioner{ProvisionerNameValue: p} - if len(path) > 0 { - // If we have a path, we do the flattening immediately. This - // is to support new-style graph nodes that are already - // flattened. - if fn, ok := newV.(GraphNodeFlattenable); ok { - var err error - newV, err = fn.Flatten(path) - if err != nil { - return err - } - } + var newV dag.Vertex = &NodeProvisioner{ + NameValue: p, + PathValue: path, } // Add the missing provisioner node to the graph @@ -178,7 +169,8 @@ func provisionerVertexMap(g *Graph) map[string]dag.Vertex { m := make(map[string]dag.Vertex) for _, v := range g.Vertices() { if pv, ok := v.(GraphNodeProvisioner); ok { - m[pv.ProvisionerName()] = v + key := provisionerMapKey(pv.ProvisionerName(), v) + m[key] = v } } @@ -212,50 +204,3 @@ func (n *graphNodeCloseProvisioner) EvalTree() EvalNode { func (n *graphNodeCloseProvisioner) CloseProvisionerName() string { return n.ProvisionerNameValue } - -type graphNodeProvisioner struct { - ProvisionerNameValue string -} - -func (n *graphNodeProvisioner) Name() string { - return fmt.Sprintf("provisioner.%s", n.ProvisionerNameValue) -} - -// GraphNodeEvalable impl. -func (n *graphNodeProvisioner) EvalTree() EvalNode { - return &EvalInitProvisioner{Name: n.ProvisionerNameValue} -} - -func (n *graphNodeProvisioner) ProvisionerName() string { - return n.ProvisionerNameValue -} - -// GraphNodeFlattenable impl. -func (n *graphNodeProvisioner) Flatten(p []string) (dag.Vertex, error) { - return &graphNodeProvisionerFlat{ - graphNodeProvisioner: n, - PathValue: p, - }, nil -} - -// Same as graphNodeMissingProvisioner, but for flattening -type graphNodeProvisionerFlat struct { - *graphNodeProvisioner - - PathValue []string -} - -func (n *graphNodeProvisionerFlat) Name() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeProvisioner.Name()) -} - -func (n *graphNodeProvisionerFlat) Path() []string { - return n.PathValue -} - -func (n *graphNodeProvisionerFlat) ProvisionerName() string { - return fmt.Sprintf( - "%s.%s", modulePrefixStr(n.PathValue), - n.graphNodeProvisioner.ProvisionerName()) -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_proxy.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_proxy.go deleted file mode 100644 index db7b34ed8a..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_proxy.go +++ /dev/null @@ -1,62 +0,0 @@ -package terraform - -import ( - "github.com/hashicorp/terraform/dag" -) - -// GraphNodeProxy must be implemented by nodes that are proxies. -// -// A node that is a proxy says that anything that depends on this -// node (the proxy), should also copy all the things that the proxy -// itself depends on. Example: -// -// A => proxy => C -// -// Should transform into (two edges): -// -// A => proxy => C -// A => C -// -// The purpose for this is because some transforms only look at direct -// edge connections and the proxy generally isn't meaningful in those -// situations, so we should complete all the edges. -type GraphNodeProxy interface { - Proxy() bool -} - -// ProxyTransformer is a transformer that goes through the graph, finds -// vertices that are marked as proxies, and connects through their -// dependents. See above for what a proxy is. -type ProxyTransformer struct{} - -func (t *ProxyTransformer) Transform(g *Graph) error { - for _, v := range g.Vertices() { - pn, ok := v.(GraphNodeProxy) - if !ok { - continue - } - - // If we don't want to be proxies, don't do it - if !pn.Proxy() { - continue - } - - // Connect all the things that depend on this to things that - // we depend on as the proxy. See docs for GraphNodeProxy for - // a visual explanation. - for _, s := range g.UpEdges(v).List() { - for _, t := range g.DownEdges(v).List() { - g.Connect(GraphProxyEdge{ - Edge: dag.BasicEdge(s, t), - }) - } - } - } - - return nil -} - -// GraphProxyEdge is the edge that is used for proxied edges. -type GraphProxyEdge struct { - dag.Edge -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_reference.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_reference.go index 7d8a5445db..c5452354d4 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_reference.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_reference.go @@ -300,3 +300,22 @@ func ReferenceFromInterpolatedVar(v config.InterpolatedVariable) []string { return nil } } + +func modulePrefixStr(p []string) string { + parts := make([]string, 0, len(p)*2) + for _, p := range p[1:] { + parts = append(parts, "module", p) + } + + return strings.Join(parts, ".") +} + +func modulePrefixList(result []string, prefix string) []string { + if prefix != "" { + for i, v := range result { + result[i] = fmt.Sprintf("%s.%s", prefix, v) + } + } + + return result +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_resource.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_resource.go deleted file mode 100644 index 00628c7c3a..0000000000 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_resource.go +++ /dev/null @@ -1,962 +0,0 @@ -package terraform - -import ( - "fmt" - "strings" - - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/dag" -) - -// ResourceCountTransformerOld is a GraphTransformer that expands the count -// out for a specific resource. -type ResourceCountTransformerOld struct { - Resource *config.Resource - Destroy bool - Targets []ResourceAddress -} - -func (t *ResourceCountTransformerOld) Transform(g *Graph) error { - // Expand the resource count - count, err := t.Resource.Count() - if err != nil { - return err - } - - // Don't allow the count to be negative - if count < 0 { - return fmt.Errorf("negative count: %d", count) - } - - // For each count, build and add the node - nodes := make([]dag.Vertex, 0, count) - for i := 0; i < count; i++ { - // Set the index. If our count is 1 we special case it so that - // we handle the "resource.0" and "resource" boundary properly. - index := i - if count == 1 { - index = -1 - } - - // Save the node for later so we can do connections. Make the - // proper node depending on if we're just a destroy node or if - // were a regular node. - var node dag.Vertex = &graphNodeExpandedResource{ - Index: index, - Resource: t.Resource, - Path: g.Path, - } - if t.Destroy { - node = &graphNodeExpandedResourceDestroy{ - graphNodeExpandedResource: node.(*graphNodeExpandedResource), - } - } - - // Skip nodes if targeting excludes them - if !t.nodeIsTargeted(node) { - continue - } - - // Add the node now - nodes = append(nodes, node) - g.Add(node) - } - - // Make the dependency connections - for _, n := range nodes { - // Connect the dependents. We ignore the return value for missing - // dependents since that should've been caught at a higher level. - g.ConnectDependent(n) - } - - return nil -} - -func (t *ResourceCountTransformerOld) nodeIsTargeted(node dag.Vertex) bool { - // no targets specified, everything stays in the graph - if len(t.Targets) == 0 { - return true - } - addressable, ok := node.(GraphNodeAddressable) - if !ok { - return false - } - - addr := addressable.ResourceAddress() - for _, targetAddr := range t.Targets { - if targetAddr.Equals(addr) { - return true - } - } - return false -} - -type graphNodeExpandedResource struct { - Index int - Resource *config.Resource - Path []string -} - -func (n *graphNodeExpandedResource) Name() string { - if n.Index == -1 { - return n.Resource.Id() - } - - return fmt.Sprintf("%s #%d", n.Resource.Id(), n.Index) -} - -// GraphNodeAddressable impl. -func (n *graphNodeExpandedResource) ResourceAddress() *ResourceAddress { - // We want this to report the logical index properly, so we must undo the - // special case from the expand - index := n.Index - if index == -1 { - index = 0 - } - return &ResourceAddress{ - Path: n.Path[1:], - Index: index, - InstanceType: TypePrimary, - Name: n.Resource.Name, - Type: n.Resource.Type, - Mode: n.Resource.Mode, - } -} - -// graphNodeConfig impl. -func (n *graphNodeExpandedResource) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeResource -} - -// GraphNodeDependable impl. -func (n *graphNodeExpandedResource) DependableName() []string { - return []string{ - n.Resource.Id(), - n.stateId(), - } -} - -// GraphNodeDependent impl. -func (n *graphNodeExpandedResource) DependentOn() []string { - configNode := &GraphNodeConfigResource{Resource: n.Resource} - result := configNode.DependentOn() - - // Walk the variables to find any count-specific variables we depend on. - configNode.VarWalk(func(v config.InterpolatedVariable) { - rv, ok := v.(*config.ResourceVariable) - if !ok { - return - } - - // We only want ourselves - if rv.ResourceId() != n.Resource.Id() { - return - } - - // If this isn't a multi-access (which shouldn't be allowed but - // is verified elsewhere), then we depend on the specific count - // of this resource, ignoring ourself (which again should be - // validated elsewhere). - if rv.Index > -1 { - id := fmt.Sprintf("%s.%d", rv.ResourceId(), rv.Index) - if id != n.stateId() && id != n.stateId()+".0" { - result = append(result, id) - } - } - }) - - return result -} - -// GraphNodeProviderConsumer -func (n *graphNodeExpandedResource) ProvidedBy() []string { - return []string{resourceProvider(n.Resource.Type, n.Resource.Provider)} -} - -func (n *graphNodeExpandedResource) StateDependencies() []string { - depsRaw := n.DependentOn() - deps := make([]string, 0, len(depsRaw)) - for _, d := range depsRaw { - // Ignore any variable dependencies - if strings.HasPrefix(d, "var.") { - continue - } - - // This is sad. The dependencies are currently in the format of - // "module.foo.bar" (the full field). This strips the field off. - if strings.HasPrefix(d, "module.") { - parts := strings.SplitN(d, ".", 3) - d = strings.Join(parts[0:2], ".") - } - deps = append(deps, d) - } - - return deps -} - -// GraphNodeEvalable impl. -func (n *graphNodeExpandedResource) EvalTree() EvalNode { - var provider ResourceProvider - var resourceConfig *ResourceConfig - - // Build the resource. If we aren't part of a multi-resource, then - // we still consider ourselves as count index zero. - index := n.Index - if index < 0 { - index = 0 - } - resource := &Resource{ - Name: n.Resource.Name, - Type: n.Resource.Type, - CountIndex: index, - } - - seq := &EvalSequence{Nodes: make([]EvalNode, 0, 5)} - - // Validate the resource - vseq := &EvalSequence{Nodes: make([]EvalNode, 0, 5)} - vseq.Nodes = append(vseq.Nodes, &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }) - vseq.Nodes = append(vseq.Nodes, &EvalInterpolate{ - Config: n.Resource.RawConfig.Copy(), - Resource: resource, - Output: &resourceConfig, - }) - vseq.Nodes = append(vseq.Nodes, &EvalValidateResource{ - Provider: &provider, - Config: &resourceConfig, - ResourceName: n.Resource.Name, - ResourceType: n.Resource.Type, - ResourceMode: n.Resource.Mode, - }) - - // Validate all the provisioners - for _, p := range n.Resource.Provisioners { - var provisioner ResourceProvisioner - vseq.Nodes = append(vseq.Nodes, &EvalGetProvisioner{ - Name: p.Type, - Output: &provisioner, - }, &EvalInterpolate{ - Config: p.RawConfig.Copy(), - Resource: resource, - Output: &resourceConfig, - }, &EvalValidateProvisioner{ - Provisioner: &provisioner, - Config: &resourceConfig, - }) - } - - // Add the validation operations - seq.Nodes = append(seq.Nodes, &EvalOpFilter{ - Ops: []walkOperation{walkValidate}, - Node: vseq, - }) - - // Build instance info - info := n.instanceInfo() - seq.Nodes = append(seq.Nodes, &EvalInstanceInfo{Info: info}) - - // Each resource mode has its own lifecycle - switch n.Resource.Mode { - case config.ManagedResourceMode: - seq.Nodes = append( - seq.Nodes, - n.managedResourceEvalNodes(resource, info, resourceConfig)..., - ) - case config.DataResourceMode: - seq.Nodes = append( - seq.Nodes, - n.dataResourceEvalNodes(resource, info, resourceConfig)..., - ) - default: - panic(fmt.Errorf("unsupported resource mode %s", n.Resource.Mode)) - } - - return seq -} - -func (n *graphNodeExpandedResource) managedResourceEvalNodes(resource *Resource, info *InstanceInfo, resourceConfig *ResourceConfig) []EvalNode { - var diff *InstanceDiff - var provider ResourceProvider - var state *InstanceState - - nodes := make([]EvalNode, 0, 5) - - // Refresh the resource - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkRefresh}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - &EvalRefresh{ - Info: info, - Provider: &provider, - State: &state, - Output: &state, - }, - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - }, - }, - }) - - // Diff the resource - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkPlan}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalInterpolate{ - Config: n.Resource.RawConfig.Copy(), - Resource: resource, - Output: &resourceConfig, - }, - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - // Re-run validation to catch any errors we missed, e.g. type - // mismatches on computed values. - &EvalValidateResource{ - Provider: &provider, - Config: &resourceConfig, - ResourceName: n.Resource.Name, - ResourceType: n.Resource.Type, - ResourceMode: n.Resource.Mode, - IgnoreWarnings: true, - }, - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - &EvalDiff{ - Info: info, - Config: &resourceConfig, - Resource: n.Resource, - Provider: &provider, - State: &state, - OutputDiff: &diff, - OutputState: &state, - }, - &EvalCheckPreventDestroy{ - Resource: n.Resource, - Diff: &diff, - }, - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - &EvalWriteDiff{ - Name: n.stateId(), - Diff: &diff, - }, - }, - }, - }) - - // Diff the resource for destruction - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkPlanDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - &EvalDiffDestroy{ - Info: info, - State: &state, - Output: &diff, - }, - &EvalCheckPreventDestroy{ - Resource: n.Resource, - Diff: &diff, - }, - &EvalWriteDiff{ - Name: n.stateId(), - Diff: &diff, - }, - }, - }, - }) - - // Apply - var diffApply *InstanceDiff - var err error - var createNew bool - var createBeforeDestroyEnabled bool - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkApply, walkDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - // Get the saved diff for apply - &EvalReadDiff{ - Name: n.stateId(), - Diff: &diffApply, - }, - - // We don't want to do any destroys - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - if diffApply == nil { - return true, EvalEarlyExitError{} - } - - if diffApply.GetDestroy() && diffApply.GetAttributesLen() == 0 { - return true, EvalEarlyExitError{} - } - - diffApply.SetDestroy(false) - return true, nil - }, - Then: EvalNoop{}, - }, - - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - destroy := false - if diffApply != nil { - destroy = diffApply.GetDestroy() || diffApply.RequiresNew() - } - - createBeforeDestroyEnabled = - n.Resource.Lifecycle.CreateBeforeDestroy && - destroy - - return createBeforeDestroyEnabled, nil - }, - Then: &EvalDeposeState{ - Name: n.stateId(), - }, - }, - - &EvalInterpolate{ - Config: n.Resource.RawConfig.Copy(), - Resource: resource, - Output: &resourceConfig, - }, - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - // Re-run validation to catch any errors we missed, e.g. type - // mismatches on computed values. - &EvalValidateResource{ - Provider: &provider, - Config: &resourceConfig, - ResourceName: n.Resource.Name, - ResourceType: n.Resource.Type, - ResourceMode: n.Resource.Mode, - IgnoreWarnings: true, - }, - &EvalDiff{ - Info: info, - Config: &resourceConfig, - Resource: n.Resource, - Provider: &provider, - Diff: &diffApply, - State: &state, - OutputDiff: &diffApply, - }, - - // Get the saved diff - &EvalReadDiff{ - Name: n.stateId(), - Diff: &diff, - }, - - // Compare the diffs - &EvalCompareDiff{ - Info: info, - One: &diff, - Two: &diffApply, - }, - - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - &EvalApply{ - Info: info, - State: &state, - Diff: &diffApply, - Provider: &provider, - Output: &state, - Error: &err, - CreateNew: &createNew, - }, - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - &EvalApplyProvisioners{ - Info: info, - State: &state, - Resource: n.Resource, - InterpResource: resource, - CreateNew: &createNew, - Error: &err, - }, - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - return createBeforeDestroyEnabled && err != nil, nil - }, - Then: &EvalUndeposeState{ - Name: n.stateId(), - State: &state, - }, - Else: &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - }, - - // We clear the diff out here so that future nodes - // don't see a diff that is already complete. There - // is no longer a diff! - &EvalWriteDiff{ - Name: n.stateId(), - Diff: nil, - }, - - &EvalApplyPost{ - Info: info, - State: &state, - Error: &err, - }, - &EvalUpdateStateHook{}, - }, - }, - }) - - return nodes -} - -func (n *graphNodeExpandedResource) dataResourceEvalNodes(resource *Resource, info *InstanceInfo, resourceConfig *ResourceConfig) []EvalNode { - //var diff *InstanceDiff - var provider ResourceProvider - var config *ResourceConfig - var diff *InstanceDiff - var state *InstanceState - - nodes := make([]EvalNode, 0, 5) - - // Refresh the resource - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkRefresh}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - - // Always destroy the existing state first, since we must - // make sure that values from a previous read will not - // get interpolated if we end up needing to defer our - // loading until apply time. - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, // state is nil here - }, - - &EvalInterpolate{ - Config: n.Resource.RawConfig.Copy(), - Resource: resource, - Output: &config, - }, - - // The rest of this pass can proceed only if there are no - // computed values in our config. - // (If there are, we'll deal with this during the plan and - // apply phases.) - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - - if config.ComputedKeys != nil && len(config.ComputedKeys) > 0 { - return true, EvalEarlyExitError{} - } - - // If the config explicitly has a depends_on for this - // data source, assume the intention is to prevent - // refreshing ahead of that dependency. - if len(n.Resource.DependsOn) > 0 { - return true, EvalEarlyExitError{} - } - - return true, nil - }, - Then: EvalNoop{}, - }, - - // The remainder of this pass is the same as running - // a "plan" pass immediately followed by an "apply" pass, - // populating the state early so it'll be available to - // provider configurations that need this data during - // refresh/plan. - - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - - &EvalReadDataDiff{ - Info: info, - Config: &config, - Provider: &provider, - Output: &diff, - OutputState: &state, - }, - - &EvalReadDataApply{ - Info: info, - Diff: &diff, - Provider: &provider, - Output: &state, - }, - - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - - &EvalUpdateStateHook{}, - }, - }, - }) - - // Diff the resource - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkPlan}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - - // We need to re-interpolate the config here because some - // of the attributes may have become computed during - // earlier planning, due to other resources having - // "requires new resource" diffs. - &EvalInterpolate{ - Config: n.Resource.RawConfig.Copy(), - Resource: resource, - Output: &config, - }, - - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - computed := config.ComputedKeys != nil && len(config.ComputedKeys) > 0 - - // If the configuration is complete and we - // already have a state then we don't need to - // do any further work during apply, because we - // already populated the state during refresh. - if !computed && state != nil { - return true, EvalEarlyExitError{} - } - - return true, nil - }, - Then: EvalNoop{}, - }, - - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - - &EvalReadDataDiff{ - Info: info, - Config: &config, - Provider: &provider, - Output: &diff, - OutputState: &state, - }, - - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - - &EvalWriteDiff{ - Name: n.stateId(), - Diff: &diff, - }, - }, - }, - }) - - // Diff the resource for destruction - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkPlanDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - - // Since EvalDiffDestroy doesn't interact with the - // provider at all, we can safely share the same - // implementation for data vs. managed resources. - &EvalDiffDestroy{ - Info: info, - State: &state, - Output: &diff, - }, - - &EvalWriteDiff{ - Name: n.stateId(), - Diff: &diff, - }, - }, - }, - }) - - // Apply - nodes = append(nodes, &EvalOpFilter{ - Ops: []walkOperation{walkApply, walkDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - // Get the saved diff for apply - &EvalReadDiff{ - Name: n.stateId(), - Diff: &diff, - }, - - // Stop here if we don't actually have a diff - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - if diff == nil { - return true, EvalEarlyExitError{} - } - - if diff.GetAttributesLen() == 0 { - return true, EvalEarlyExitError{} - } - - return true, nil - }, - Then: EvalNoop{}, - }, - - // We need to re-interpolate the config here, rather than - // just using the diff's values directly, because we've - // potentially learned more variable values during the - // apply pass that weren't known when the diff was produced. - &EvalInterpolate{ - Config: n.Resource.RawConfig.Copy(), - Resource: resource, - Output: &config, - }, - - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - - // Make a new diff with our newly-interpolated config. - &EvalReadDataDiff{ - Info: info, - Config: &config, - Previous: &diff, - Provider: &provider, - Output: &diff, - }, - - &EvalReadDataApply{ - Info: info, - Diff: &diff, - Provider: &provider, - Output: &state, - }, - - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - - // Clear the diff now that we've applied it, so - // later nodes won't see a diff that's now a no-op. - &EvalWriteDiff{ - Name: n.stateId(), - Diff: nil, - }, - - &EvalUpdateStateHook{}, - }, - }, - }) - - return nodes -} - -// instanceInfo is used for EvalTree. -func (n *graphNodeExpandedResource) instanceInfo() *InstanceInfo { - return &InstanceInfo{Id: n.stateId(), Type: n.Resource.Type} -} - -// stateId is the name used for the state key -func (n *graphNodeExpandedResource) stateId() string { - if n.Index == -1 { - return n.Resource.Id() - } - - return fmt.Sprintf("%s.%d", n.Resource.Id(), n.Index) -} - -// GraphNodeStateRepresentative impl. -func (n *graphNodeExpandedResource) StateId() []string { - return []string{n.stateId()} -} - -// graphNodeExpandedResourceDestroy represents an expanded resource that -// is to be destroyed. -type graphNodeExpandedResourceDestroy struct { - *graphNodeExpandedResource -} - -func (n *graphNodeExpandedResourceDestroy) Name() string { - return fmt.Sprintf("%s (destroy)", n.graphNodeExpandedResource.Name()) -} - -// graphNodeConfig impl. -func (n *graphNodeExpandedResourceDestroy) ConfigType() GraphNodeConfigType { - return GraphNodeConfigTypeResource -} - -// GraphNodeEvalable impl. -func (n *graphNodeExpandedResourceDestroy) EvalTree() EvalNode { - info := n.instanceInfo() - info.uniqueExtra = "destroy" - - var diffApply *InstanceDiff - var provider ResourceProvider - var state *InstanceState - var err error - return &EvalOpFilter{ - Ops: []walkOperation{walkApply, walkDestroy}, - Node: &EvalSequence{ - Nodes: []EvalNode{ - // Get the saved diff for apply - &EvalReadDiff{ - Name: n.stateId(), - Diff: &diffApply, - }, - - // Filter the diff so we only get the destroy - &EvalFilterDiff{ - Diff: &diffApply, - Output: &diffApply, - Destroy: true, - }, - - // If we're not destroying, then compare diffs - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - if diffApply != nil && diffApply.GetDestroy() { - return true, nil - } - - return true, EvalEarlyExitError{} - }, - Then: EvalNoop{}, - }, - - // Load the instance info so we have the module path set - &EvalInstanceInfo{Info: info}, - - &EvalGetProvider{ - Name: n.ProvidedBy()[0], - Output: &provider, - }, - &EvalReadState{ - Name: n.stateId(), - Output: &state, - }, - &EvalRequireState{ - State: &state, - }, - // Make sure we handle data sources properly. - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - if n.Resource.Mode == config.DataResourceMode { - return true, nil - } - - return false, nil - }, - - Then: &EvalReadDataApply{ - Info: info, - Diff: &diffApply, - Provider: &provider, - Output: &state, - }, - Else: &EvalApply{ - Info: info, - State: &state, - Diff: &diffApply, - Provider: &provider, - Output: &state, - Error: &err, - }, - }, - &EvalWriteState{ - Name: n.stateId(), - ResourceType: n.Resource.Type, - Provider: n.Resource.Provider, - Dependencies: n.StateDependencies(), - State: &state, - }, - &EvalApplyPost{ - Info: info, - State: &state, - Error: &err, - }, - }, - }, - } -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_root.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_root.go index 7a422b8264..aee053d175 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_root.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_root.go @@ -36,7 +36,3 @@ type graphNodeRoot struct{} func (n graphNodeRoot) Name() string { return rootNodeName } - -func (n graphNodeRoot) Flatten(p []string) (dag.Vertex, error) { - return n, nil -} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go index 0ba98ee153..225ac4b4ae 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go @@ -6,6 +6,15 @@ import ( "github.com/hashicorp/terraform/dag" ) +// GraphNodeTargetable is an interface for graph nodes to implement when they +// need to be told about incoming targets. This is useful for nodes that need +// to respect targets as they dynamically expand. Note that the list of targets +// provided will contain every target provided, and each implementing graph +// node must filter this list to targets considered relevant. +type GraphNodeTargetable interface { + SetTargets([]ResourceAddress) +} + // TargetsTransformer is a GraphTransformer that, when the user specifies a // list of resources to target, limits the graph to only those resources and // their dependencies. @@ -40,7 +49,7 @@ func (t *TargetsTransformer) Transform(g *Graph) error { for _, v := range g.Vertices() { removable := false - if _, ok := v.(GraphNodeAddressable); ok { + if _, ok := v.(GraphNodeResource); ok { removable = true } if vr, ok := v.(RemovableIfNotTargeted); ok { @@ -90,15 +99,6 @@ func (t *TargetsTransformer) selectTargetedNodes( var err error if t.Destroy { deps, err = g.Descendents(v) - - // Select any variables that we depend on in case we need them later for - // interpolating in the count - ancestors, _ := g.Ancestors(v) - for _, a := range ancestors.List() { - if _, ok := a.(*GraphNodeConfigVariableFlat); ok { - deps.Add(a) - } - } } else { deps, err = g.Ancestors(v) } @@ -117,12 +117,12 @@ func (t *TargetsTransformer) selectTargetedNodes( func (t *TargetsTransformer) nodeIsTarget( v dag.Vertex, addrs []ResourceAddress) bool { - r, ok := v.(GraphNodeAddressable) + r, ok := v.(GraphNodeResource) if !ok { return false } - addr := r.ResourceAddress() + addr := r.ResourceAddr() for _, targetAddr := range addrs { if targetAddr.Equals(addr) { return true diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/util.go b/installer/vendor/github.com/hashicorp/terraform/terraform/util.go index e1d951c01a..f41f0d7d63 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/util.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/util.go @@ -1,6 +1,7 @@ package terraform import ( + "sort" "strings" ) @@ -73,3 +74,20 @@ func strSliceContains(haystack []string, needle string) bool { } return false } + +// deduplicate a slice of strings +func uniqueStrings(s []string) []string { + if len(s) < 2 { + return s + } + + sort.Strings(s) + result := make([]string, 1, len(s)) + result[0] = s[0] + for i := 1; i < len(s); i++ { + if s[i] != result[len(result)-1] { + result = append(result, s[i]) + } + } + return result +} diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/version.go b/installer/vendor/github.com/hashicorp/terraform/terraform/version.go index e7f42ade13..e184dc5a64 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/version.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/version.go @@ -7,7 +7,7 @@ import ( ) // The main version number that is being run at the moment. -const Version = "0.8.8" +const Version = "0.9.4" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/installer/vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go b/installer/vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go index 8fb33d7b5a..cbd78dd93f 100644 --- a/installer/vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go +++ b/installer/vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=walkOperation graph_walk_operation.go"; DO NOT EDIT +// Code generated by "stringer -type=walkOperation graph_walk_operation.go"; DO NOT EDIT. package terraform diff --git a/installer/vendor/github.com/mitchellh/hashstructure/LICENSE b/installer/vendor/github.com/mitchellh/hashstructure/LICENSE new file mode 100644 index 0000000000..a3866a291f --- /dev/null +++ b/installer/vendor/github.com/mitchellh/hashstructure/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Mitchell Hashimoto + +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/installer/vendor/github.com/mitchellh/hashstructure/hashstructure.go b/installer/vendor/github.com/mitchellh/hashstructure/hashstructure.go new file mode 100644 index 0000000000..1800f43543 --- /dev/null +++ b/installer/vendor/github.com/mitchellh/hashstructure/hashstructure.go @@ -0,0 +1,335 @@ +package hashstructure + +import ( + "encoding/binary" + "fmt" + "hash" + "hash/fnv" + "reflect" +) + +// HashOptions are options that are available for hashing. +type HashOptions struct { + // Hasher is the hash function to use. If this isn't set, it will + // default to FNV. + Hasher hash.Hash64 + + // TagName is the struct tag to look at when hashing the structure. + // By default this is "hash". + TagName string + + // ZeroNil is flag determining if nil pointer should be treated equal + // to a zero value of pointed type. By default this is false. + ZeroNil bool +} + +// Hash returns the hash value of an arbitrary value. +// +// If opts is nil, then default options will be used. See HashOptions +// for the default values. The same *HashOptions value cannot be used +// concurrently. None of the values within a *HashOptions struct are +// safe to read/write while hashing is being done. +// +// Notes on the value: +// +// * Unexported fields on structs are ignored and do not affect the +// hash value. +// +// * Adding an exported field to a struct with the zero value will change +// the hash value. +// +// For structs, the hashing can be controlled using tags. For example: +// +// struct { +// Name string +// UUID string `hash:"ignore"` +// } +// +// The available tag values are: +// +// * "ignore" or "-" - The field will be ignored and not affect the hash code. +// +// * "set" - The field will be treated as a set, where ordering doesn't +// affect the hash code. This only works for slices. +// +func Hash(v interface{}, opts *HashOptions) (uint64, error) { + // Create default options + if opts == nil { + opts = &HashOptions{} + } + if opts.Hasher == nil { + opts.Hasher = fnv.New64() + } + if opts.TagName == "" { + opts.TagName = "hash" + } + + // Reset the hash + opts.Hasher.Reset() + + // Create our walker and walk the structure + w := &walker{ + h: opts.Hasher, + tag: opts.TagName, + zeronil: opts.ZeroNil, + } + return w.visit(reflect.ValueOf(v), nil) +} + +type walker struct { + h hash.Hash64 + tag string + zeronil bool +} + +type visitOpts struct { + // Flags are a bitmask of flags to affect behavior of this visit + Flags visitFlag + + // Information about the struct containing this field + Struct interface{} + StructField string +} + +func (w *walker) visit(v reflect.Value, opts *visitOpts) (uint64, error) { + t := reflect.TypeOf(0) + + // Loop since these can be wrapped in multiple layers of pointers + // and interfaces. + for { + // If we have an interface, dereference it. We have to do this up + // here because it might be a nil in there and the check below must + // catch that. + if v.Kind() == reflect.Interface { + v = v.Elem() + continue + } + + if v.Kind() == reflect.Ptr { + if w.zeronil { + t = v.Type().Elem() + } + v = reflect.Indirect(v) + continue + } + + break + } + + // If it is nil, treat it like a zero. + if !v.IsValid() { + v = reflect.Zero(t) + } + + // Binary writing can use raw ints, we have to convert to + // a sized-int, we'll choose the largest... + switch v.Kind() { + case reflect.Int: + v = reflect.ValueOf(int64(v.Int())) + case reflect.Uint: + v = reflect.ValueOf(uint64(v.Uint())) + case reflect.Bool: + var tmp int8 + if v.Bool() { + tmp = 1 + } + v = reflect.ValueOf(tmp) + } + + k := v.Kind() + + // We can shortcut numeric values by directly binary writing them + if k >= reflect.Int && k <= reflect.Complex64 { + // A direct hash calculation + w.h.Reset() + err := binary.Write(w.h, binary.LittleEndian, v.Interface()) + return w.h.Sum64(), err + } + + switch k { + case reflect.Array: + var h uint64 + l := v.Len() + for i := 0; i < l; i++ { + current, err := w.visit(v.Index(i), nil) + if err != nil { + return 0, err + } + + h = hashUpdateOrdered(w.h, h, current) + } + + return h, nil + + case reflect.Map: + var includeMap IncludableMap + if opts != nil && opts.Struct != nil { + if v, ok := opts.Struct.(IncludableMap); ok { + includeMap = v + } + } + + // Build the hash for the map. We do this by XOR-ing all the key + // and value hashes. This makes it deterministic despite ordering. + var h uint64 + for _, k := range v.MapKeys() { + v := v.MapIndex(k) + if includeMap != nil { + incl, err := includeMap.HashIncludeMap( + opts.StructField, k.Interface(), v.Interface()) + if err != nil { + return 0, err + } + if !incl { + continue + } + } + + kh, err := w.visit(k, nil) + if err != nil { + return 0, err + } + vh, err := w.visit(v, nil) + if err != nil { + return 0, err + } + + fieldHash := hashUpdateOrdered(w.h, kh, vh) + h = hashUpdateUnordered(h, fieldHash) + } + + return h, nil + + case reflect.Struct: + var include Includable + parent := v.Interface() + if impl, ok := parent.(Includable); ok { + include = impl + } + + t := v.Type() + h, err := w.visit(reflect.ValueOf(t.Name()), nil) + if err != nil { + return 0, err + } + + l := v.NumField() + for i := 0; i < l; i++ { + if v := v.Field(i); v.CanSet() || t.Field(i).Name != "_" { + var f visitFlag + fieldType := t.Field(i) + if fieldType.PkgPath != "" { + // Unexported + continue + } + + tag := fieldType.Tag.Get(w.tag) + if tag == "ignore" || tag == "-" { + // Ignore this field + continue + } + + // Check if we implement includable and check it + if include != nil { + incl, err := include.HashInclude(fieldType.Name, v) + if err != nil { + return 0, err + } + if !incl { + continue + } + } + + switch tag { + case "set": + f |= visitFlagSet + } + + kh, err := w.visit(reflect.ValueOf(fieldType.Name), nil) + if err != nil { + return 0, err + } + + vh, err := w.visit(v, &visitOpts{ + Flags: f, + Struct: parent, + StructField: fieldType.Name, + }) + if err != nil { + return 0, err + } + + fieldHash := hashUpdateOrdered(w.h, kh, vh) + h = hashUpdateUnordered(h, fieldHash) + } + } + + return h, nil + + case reflect.Slice: + // We have two behaviors here. If it isn't a set, then we just + // visit all the elements. If it is a set, then we do a deterministic + // hash code. + var h uint64 + var set bool + if opts != nil { + set = (opts.Flags & visitFlagSet) != 0 + } + l := v.Len() + for i := 0; i < l; i++ { + current, err := w.visit(v.Index(i), nil) + if err != nil { + return 0, err + } + + if set { + h = hashUpdateUnordered(h, current) + } else { + h = hashUpdateOrdered(w.h, h, current) + } + } + + return h, nil + + case reflect.String: + // Directly hash + w.h.Reset() + _, err := w.h.Write([]byte(v.String())) + return w.h.Sum64(), err + + default: + return 0, fmt.Errorf("unknown kind to hash: %s", k) + } + + return 0, nil +} + +func hashUpdateOrdered(h hash.Hash64, a, b uint64) uint64 { + // For ordered updates, use a real hash function + h.Reset() + + // We just panic if the binary writes fail because we are writing + // an int64 which should never be fail-able. + e1 := binary.Write(h, binary.LittleEndian, a) + e2 := binary.Write(h, binary.LittleEndian, b) + if e1 != nil { + panic(e1) + } + if e2 != nil { + panic(e2) + } + + return h.Sum64() +} + +func hashUpdateUnordered(a, b uint64) uint64 { + return a ^ b +} + +// visitFlag is used as a bitmask for affecting visit behavior +type visitFlag uint + +const ( + visitFlagInvalid visitFlag = iota + visitFlagSet = iota << 1 +) diff --git a/installer/vendor/github.com/mitchellh/hashstructure/include.go b/installer/vendor/github.com/mitchellh/hashstructure/include.go new file mode 100644 index 0000000000..b6289c0bee --- /dev/null +++ b/installer/vendor/github.com/mitchellh/hashstructure/include.go @@ -0,0 +1,15 @@ +package hashstructure + +// Includable is an interface that can optionally be implemented by +// a struct. It will be called for each field in the struct to check whether +// it should be included in the hash. +type Includable interface { + HashInclude(field string, v interface{}) (bool, error) +} + +// IncludableMap is an interface that can optionally be implemented by +// a struct. It will be called when a map-type field is found to ask the +// struct if the map item should be included in the hash. +type IncludableMap interface { + HashIncludeMap(field string, k, v interface{}) (bool, error) +} diff --git a/installer/vendor/github.com/satori/uuid/LICENSE b/installer/vendor/github.com/satori/uuid/LICENSE new file mode 100644 index 0000000000..488357b8af --- /dev/null +++ b/installer/vendor/github.com/satori/uuid/LICENSE @@ -0,0 +1,20 @@ +Copyright (C) 2013-2016 by Maxim Bublis + +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/installer/vendor/github.com/satori/uuid/uuid.go b/installer/vendor/github.com/satori/uuid/uuid.go new file mode 100644 index 0000000000..295f3fc2c5 --- /dev/null +++ b/installer/vendor/github.com/satori/uuid/uuid.go @@ -0,0 +1,481 @@ +// Copyright (C) 2013-2015 by Maxim Bublis +// +// 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. + +// Package uuid provides implementation of Universally Unique Identifier (UUID). +// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and +// version 2 (as specified in DCE 1.1). +package uuid + +import ( + "bytes" + "crypto/md5" + "crypto/rand" + "crypto/sha1" + "database/sql/driver" + "encoding/binary" + "encoding/hex" + "fmt" + "hash" + "net" + "os" + "sync" + "time" +) + +// UUID layout variants. +const ( + VariantNCS = iota + VariantRFC4122 + VariantMicrosoft + VariantFuture +) + +// UUID DCE domains. +const ( + DomainPerson = iota + DomainGroup + DomainOrg +) + +// Difference in 100-nanosecond intervals between +// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). +const epochStart = 122192928000000000 + +// Used in string method conversion +const dash byte = '-' + +// UUID v1/v2 storage. +var ( + storageMutex sync.Mutex + storageOnce sync.Once + epochFunc = unixTimeFunc + clockSequence uint16 + lastTime uint64 + hardwareAddr [6]byte + posixUID = uint32(os.Getuid()) + posixGID = uint32(os.Getgid()) +) + +// String parse helpers. +var ( + urnPrefix = []byte("urn:uuid:") + byteGroups = []int{8, 4, 4, 4, 12} +) + +func initClockSequence() { + buf := make([]byte, 2) + safeRandom(buf) + clockSequence = binary.BigEndian.Uint16(buf) +} + +func initHardwareAddr() { + interfaces, err := net.Interfaces() + if err == nil { + for _, iface := range interfaces { + if len(iface.HardwareAddr) >= 6 { + copy(hardwareAddr[:], iface.HardwareAddr) + return + } + } + } + + // Initialize hardwareAddr randomly in case + // of real network interfaces absence + safeRandom(hardwareAddr[:]) + + // Set multicast bit as recommended in RFC 4122 + hardwareAddr[0] |= 0x01 +} + +func initStorage() { + initClockSequence() + initHardwareAddr() +} + +func safeRandom(dest []byte) { + if _, err := rand.Read(dest); err != nil { + panic(err) + } +} + +// Returns difference in 100-nanosecond intervals between +// UUID epoch (October 15, 1582) and current time. +// This is default epoch calculation function. +func unixTimeFunc() uint64 { + return epochStart + uint64(time.Now().UnixNano()/100) +} + +// UUID representation compliant with specification +// described in RFC 4122. +type UUID [16]byte + +// NullUUID can be used with the standard sql package to represent a +// UUID value that can be NULL in the database +type NullUUID struct { + UUID UUID + Valid bool +} + +// The nil UUID is special form of UUID that is specified to have all +// 128 bits set to zero. +var Nil = UUID{} + +// Predefined namespace UUIDs. +var ( + NamespaceDNS, _ = FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + NamespaceURL, _ = FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8") + NamespaceOID, _ = FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8") + NamespaceX500, _ = FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8") +) + +// And returns result of binary AND of two UUIDs. +func And(u1 UUID, u2 UUID) UUID { + u := UUID{} + for i := 0; i < 16; i++ { + u[i] = u1[i] & u2[i] + } + return u +} + +// Or returns result of binary OR of two UUIDs. +func Or(u1 UUID, u2 UUID) UUID { + u := UUID{} + for i := 0; i < 16; i++ { + u[i] = u1[i] | u2[i] + } + return u +} + +// Equal returns true if u1 and u2 equals, otherwise returns false. +func Equal(u1 UUID, u2 UUID) bool { + return bytes.Equal(u1[:], u2[:]) +} + +// Version returns algorithm version used to generate UUID. +func (u UUID) Version() uint { + return uint(u[6] >> 4) +} + +// Variant returns UUID layout variant. +func (u UUID) Variant() uint { + switch { + case (u[8] & 0x80) == 0x00: + return VariantNCS + case (u[8]&0xc0)|0x80 == 0x80: + return VariantRFC4122 + case (u[8]&0xe0)|0xc0 == 0xc0: + return VariantMicrosoft + } + return VariantFuture +} + +// Bytes returns bytes slice representation of UUID. +func (u UUID) Bytes() []byte { + return u[:] +} + +// Returns canonical string representation of UUID: +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. +func (u UUID) String() string { + buf := make([]byte, 36) + + hex.Encode(buf[0:8], u[0:4]) + buf[8] = dash + hex.Encode(buf[9:13], u[4:6]) + buf[13] = dash + hex.Encode(buf[14:18], u[6:8]) + buf[18] = dash + hex.Encode(buf[19:23], u[8:10]) + buf[23] = dash + hex.Encode(buf[24:], u[10:]) + + return string(buf) +} + +// SetVersion sets version bits. +func (u *UUID) SetVersion(v byte) { + u[6] = (u[6] & 0x0f) | (v << 4) +} + +// SetVariant sets variant bits as described in RFC 4122. +func (u *UUID) SetVariant() { + u[8] = (u[8] & 0xbf) | 0x80 +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The encoding is the same as returned by String. +func (u UUID) MarshalText() (text []byte, err error) { + text = []byte(u.String()) + return +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// Following formats are supported: +// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", +// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", +// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" +func (u *UUID) UnmarshalText(text []byte) (err error) { + if len(text) < 32 { + err = fmt.Errorf("uuid: UUID string too short: %s", text) + return + } + + t := text[:] + braced := false + + if bytes.Equal(t[:9], urnPrefix) { + t = t[9:] + } else if t[0] == '{' { + braced = true + t = t[1:] + } + + b := u[:] + + for i, byteGroup := range byteGroups { + if i > 0 { + if t[0] != '-' { + err = fmt.Errorf("uuid: invalid string format") + return + } + t = t[1:] + } + + if len(t) < byteGroup { + err = fmt.Errorf("uuid: UUID string too short: %s", text) + return + } + + if i == 4 && len(t) > byteGroup && + ((braced && t[byteGroup] != '}') || len(t[byteGroup:]) > 1 || !braced) { + err = fmt.Errorf("uuid: UUID string too long: %s", text) + return + } + + _, err = hex.Decode(b[:byteGroup/2], t[:byteGroup]) + if err != nil { + return + } + + t = t[byteGroup:] + b = b[byteGroup/2:] + } + + return +} + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (u UUID) MarshalBinary() (data []byte, err error) { + data = u.Bytes() + return +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +// It will return error if the slice isn't 16 bytes long. +func (u *UUID) UnmarshalBinary(data []byte) (err error) { + if len(data) != 16 { + err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) + return + } + copy(u[:], data) + + return +} + +// Value implements the driver.Valuer interface. +func (u UUID) Value() (driver.Value, error) { + return u.String(), nil +} + +// Scan implements the sql.Scanner interface. +// A 16-byte slice is handled by UnmarshalBinary, while +// a longer byte slice or a string is handled by UnmarshalText. +func (u *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case []byte: + if len(src) == 16 { + return u.UnmarshalBinary(src) + } + return u.UnmarshalText(src) + + case string: + return u.UnmarshalText([]byte(src)) + } + + return fmt.Errorf("uuid: cannot convert %T to UUID", src) +} + +// Value implements the driver.Valuer interface. +func (u NullUUID) Value() (driver.Value, error) { + if !u.Valid { + return nil, nil + } + // Delegate to UUID Value function + return u.UUID.Value() +} + +// Scan implements the sql.Scanner interface. +func (u *NullUUID) Scan(src interface{}) error { + if src == nil { + u.UUID, u.Valid = Nil, false + return nil + } + + // Delegate to UUID Scan function + u.Valid = true + return u.UUID.Scan(src) +} + +// FromBytes returns UUID converted from raw byte slice input. +// It will return error if the slice isn't 16 bytes long. +func FromBytes(input []byte) (u UUID, err error) { + err = u.UnmarshalBinary(input) + return +} + +// FromBytesOrNil returns UUID converted from raw byte slice input. +// Same behavior as FromBytes, but returns a Nil UUID on error. +func FromBytesOrNil(input []byte) UUID { + uuid, err := FromBytes(input) + if err != nil { + return Nil + } + return uuid +} + +// FromString returns UUID parsed from string input. +// Input is expected in a form accepted by UnmarshalText. +func FromString(input string) (u UUID, err error) { + err = u.UnmarshalText([]byte(input)) + return +} + +// FromStringOrNil returns UUID parsed from string input. +// Same behavior as FromString, but returns a Nil UUID on error. +func FromStringOrNil(input string) UUID { + uuid, err := FromString(input) + if err != nil { + return Nil + } + return uuid +} + +// Returns UUID v1/v2 storage state. +// Returns epoch timestamp, clock sequence, and hardware address. +func getStorage() (uint64, uint16, []byte) { + storageOnce.Do(initStorage) + + storageMutex.Lock() + defer storageMutex.Unlock() + + timeNow := epochFunc() + // Clock changed backwards since last UUID generation. + // Should increase clock sequence. + if timeNow <= lastTime { + clockSequence++ + } + lastTime = timeNow + + return timeNow, clockSequence, hardwareAddr[:] +} + +// NewV1 returns UUID based on current timestamp and MAC address. +func NewV1() UUID { + u := UUID{} + + timeNow, clockSeq, hardwareAddr := getStorage() + + binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) + binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) + binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) + binary.BigEndian.PutUint16(u[8:], clockSeq) + + copy(u[10:], hardwareAddr) + + u.SetVersion(1) + u.SetVariant() + + return u +} + +// NewV2 returns DCE Security UUID based on POSIX UID/GID. +func NewV2(domain byte) UUID { + u := UUID{} + + timeNow, clockSeq, hardwareAddr := getStorage() + + switch domain { + case DomainPerson: + binary.BigEndian.PutUint32(u[0:], posixUID) + case DomainGroup: + binary.BigEndian.PutUint32(u[0:], posixGID) + } + + binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) + binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) + binary.BigEndian.PutUint16(u[8:], clockSeq) + u[9] = domain + + copy(u[10:], hardwareAddr) + + u.SetVersion(2) + u.SetVariant() + + return u +} + +// NewV3 returns UUID based on MD5 hash of namespace UUID and name. +func NewV3(ns UUID, name string) UUID { + u := newFromHash(md5.New(), ns, name) + u.SetVersion(3) + u.SetVariant() + + return u +} + +// NewV4 returns random generated UUID. +func NewV4() UUID { + u := UUID{} + safeRandom(u[:]) + u.SetVersion(4) + u.SetVariant() + + return u +} + +// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. +func NewV5(ns UUID, name string) UUID { + u := newFromHash(sha1.New(), ns, name) + u.SetVersion(5) + u.SetVariant() + + return u +} + +// Returns UUID based on hashing of namespace UUID and name. +func newFromHash(h hash.Hash, ns UUID, name string) UUID { + u := UUID{} + h.Write(ns[:]) + h.Write([]byte(name)) + copy(u[:], h.Sum(nil)) + + return u +} From c245b77c3f69819c0ad058b8d45205e69bdb2b86 Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Wed, 26 Apr 2017 17:10:23 -0700 Subject: [PATCH 5/7] installer/server/terraform: remove the vendored template/local plugins they are now included in TerraForm upstream as of v0.9.4. --- installer/server/terraform/plugin.go | 12 +- .../terraform/plugins/local/provider.go | 16 -- .../terraform/plugins/local/provider_test.go | 18 -- .../plugins/local/resource_local_file.go | 84 ------- .../plugins/local/resource_local_file_test.go | 56 ----- .../template/datasource_cloudinit_config.go | 185 -------------- .../datasource_cloudinit_config_test.go | 92 ------- .../template/datasource_template_file.go | 165 ------------- .../template/datasource_template_file_test.go | 124 ---------- .../terraform/plugins/template/provider.go | 27 --- .../plugins/template/provider_test.go | 13 - .../plugins/template/resource_template_dir.go | 225 ------------------ .../template/resource_template_dir_test.go | 104 -------- terraformrc.example | 2 - 14 files changed, 2 insertions(+), 1121 deletions(-) delete mode 100644 installer/server/terraform/plugins/local/provider.go delete mode 100644 installer/server/terraform/plugins/local/provider_test.go delete mode 100644 installer/server/terraform/plugins/local/resource_local_file.go delete mode 100644 installer/server/terraform/plugins/local/resource_local_file_test.go delete mode 100644 installer/server/terraform/plugins/template/datasource_cloudinit_config.go delete mode 100644 installer/server/terraform/plugins/template/datasource_cloudinit_config_test.go delete mode 100644 installer/server/terraform/plugins/template/datasource_template_file.go delete mode 100644 installer/server/terraform/plugins/template/datasource_template_file_test.go delete mode 100644 installer/server/terraform/plugins/template/provider.go delete mode 100644 installer/server/terraform/plugins/template/provider_test.go delete mode 100644 installer/server/terraform/plugins/template/resource_template_dir.go delete mode 100644 installer/server/terraform/plugins/template/resource_template_dir_test.go diff --git a/installer/server/terraform/plugin.go b/installer/server/terraform/plugin.go index e12a55978a..69f3ae6919 100644 --- a/installer/server/terraform/plugin.go +++ b/installer/server/terraform/plugin.go @@ -4,23 +4,15 @@ import ( "bytes" gtemplate "text/template" - "github.com/coreos/tectonic-installer/installer/server/terraform/plugins/aws" - "github.com/coreos/tectonic-installer/installer/server/terraform/plugins/local" - "github.com/coreos/tectonic-installer/installer/server/terraform/plugins/template" - log "github.com/Sirupsen/logrus" "github.com/coreos/terraform-provider-matchbox/matchbox" "github.com/hashicorp/terraform/plugin" "github.com/kardianos/osext" + + "github.com/coreos/tectonic-installer/installer/server/terraform/plugins/aws" ) var plugins = map[string]*plugin.ServeOpts{ - // https://github.com/hashicorp/terraform/pull/12757 (bf8d932) - "local": {ProviderFunc: local.Provider}, - - // https://github.com/hashicorp/terraform/pull/13652 (7a6759e) - "template": {ProviderFunc: template.Provider}, - // https://github.com/hashicorp/terraform/pull/13574 (82bda74) "aws": {ProviderFunc: aws.Provider}, diff --git a/installer/server/terraform/plugins/local/provider.go b/installer/server/terraform/plugins/local/provider.go deleted file mode 100644 index 4c02182da6..0000000000 --- a/installer/server/terraform/plugins/local/provider.go +++ /dev/null @@ -1,16 +0,0 @@ -package local - -import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" -) - -// Provider returns the provider definition. -func Provider() terraform.ResourceProvider { - return &schema.Provider{ - Schema: map[string]*schema.Schema{}, - ResourcesMap: map[string]*schema.Resource{ - "local_file": resourceLocalFile(), - }, - } -} diff --git a/installer/server/terraform/plugins/local/provider_test.go b/installer/server/terraform/plugins/local/provider_test.go deleted file mode 100644 index 7385ffe3a1..0000000000 --- a/installer/server/terraform/plugins/local/provider_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package local - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" -) - -var testProviders = map[string]terraform.ResourceProvider{ - "local": Provider(), -} - -func TestProvider(t *testing.T) { - if err := Provider().(*schema.Provider).InternalValidate(); err != nil { - t.Fatalf("err: %s", err) - } -} diff --git a/installer/server/terraform/plugins/local/resource_local_file.go b/installer/server/terraform/plugins/local/resource_local_file.go deleted file mode 100644 index 6f6da1b948..0000000000 --- a/installer/server/terraform/plugins/local/resource_local_file.go +++ /dev/null @@ -1,84 +0,0 @@ -package local - -import ( - "crypto/sha1" - "encoding/hex" - "io/ioutil" - "os" - "path" - - "github.com/hashicorp/terraform/helper/schema" -) - -func resourceLocalFile() *schema.Resource { - return &schema.Resource{ - Create: resourceLocalFileCreate, - Read: resourceLocalFileRead, - Delete: resourceLocalFileDelete, - - Schema: map[string]*schema.Schema{ - "content": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "filename": { - Type: schema.TypeString, - Description: "Path to the output file", - Required: true, - ForceNew: true, - }, - }, - } -} - -func resourceLocalFileRead(d *schema.ResourceData, _ interface{}) error { - // If the output file doesn't exist, mark the resource for creation. - outputPath := d.Get("filename").(string) - if _, err := os.Stat(outputPath); os.IsNotExist(err) { - d.SetId("") - return nil - } - - // Verify that the content of the destination file matches the content we - // expect. Otherwise, the file might have been modified externally and we - // must reconcile. - outputContent, err := ioutil.ReadFile(outputPath) - if err != nil { - return err - } - - outputChecksum := sha1.Sum([]byte(outputContent)) - if hex.EncodeToString(outputChecksum[:]) != d.Id() { - d.SetId("") - return nil - } - - return nil -} - -func resourceLocalFileCreate(d *schema.ResourceData, _ interface{}) error { - content := d.Get("content").(string) - destination := d.Get("filename").(string) - - destinationDir := path.Dir(destination) - if _, err := os.Stat(destinationDir); err != nil { - if err := os.MkdirAll(destinationDir, 0777); err != nil { - return err - } - } - - if err := ioutil.WriteFile(destination, []byte(content), 0777); err != nil { - return err - } - - checksum := sha1.Sum([]byte(content)) - d.SetId(hex.EncodeToString(checksum[:])) - - return nil -} - -func resourceLocalFileDelete(d *schema.ResourceData, _ interface{}) error { - os.Remove(d.Get("filename").(string)) - return nil -} diff --git a/installer/server/terraform/plugins/local/resource_local_file_test.go b/installer/server/terraform/plugins/local/resource_local_file_test.go deleted file mode 100644 index 33a44f0bb6..0000000000 --- a/installer/server/terraform/plugins/local/resource_local_file_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package local - -import ( - "errors" - "fmt" - "io/ioutil" - "os" - "testing" - - r "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" -) - -func TestLocalFile_Basic(t *testing.T) { - var cases = []struct { - path string - content string - config string - }{ - { - "local_file", - "This is some content", - `resource "local_file" "file" { - content = "This is some content" - filename = "local_file" - }`, - }, - } - - for _, tt := range cases { - r.UnitTest(t, r.TestCase{ - Providers: testProviders, - Steps: []r.TestStep{ - { - Config: tt.config, - Check: func(s *terraform.State) error { - content, err := ioutil.ReadFile(tt.path) - if err != nil { - return fmt.Errorf("config:\n%s\n,got: %s\n", tt.config, err) - } - if string(content) != tt.content { - return fmt.Errorf("config:\n%s\ngot:\n%s\nwant:\n%s\n", tt.config, content, tt.content) - } - return nil - }, - }, - }, - CheckDestroy: func(*terraform.State) error { - if _, err := os.Stat(tt.path); os.IsNotExist(err) { - return nil - } - return errors.New("local_file did not get destroyed") - }, - }) - } -} diff --git a/installer/server/terraform/plugins/template/datasource_cloudinit_config.go b/installer/server/terraform/plugins/template/datasource_cloudinit_config.go deleted file mode 100644 index 9fee9fb492..0000000000 --- a/installer/server/terraform/plugins/template/datasource_cloudinit_config.go +++ /dev/null @@ -1,185 +0,0 @@ -package template - -import ( - "bytes" - "compress/gzip" - "encoding/base64" - "fmt" - "io" - "mime/multipart" - "net/textproto" - "strconv" - - "github.com/hashicorp/terraform/helper/hashcode" - "github.com/hashicorp/terraform/helper/schema" -) - -func dataSourceCloudinitConfig() *schema.Resource { - return &schema.Resource{ - Read: dataSourceCloudinitConfigRead, - - Schema: map[string]*schema.Schema{ - "part": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "content_type": { - Type: schema.TypeString, - Optional: true, - }, - "content": { - Type: schema.TypeString, - Required: true, - }, - "filename": { - Type: schema.TypeString, - Optional: true, - }, - "merge_type": { - Type: schema.TypeString, - Optional: true, - }, - }, - }, - }, - "gzip": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "base64_encode": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "rendered": { - Type: schema.TypeString, - Computed: true, - Description: "rendered cloudinit configuration", - }, - }, - } -} - -func dataSourceCloudinitConfigRead(d *schema.ResourceData, meta interface{}) error { - rendered, err := renderCloudinitConfig(d) - if err != nil { - return err - } - - d.Set("rendered", rendered) - d.SetId(strconv.Itoa(hashcode.String(rendered))) - return nil -} - -func renderCloudinitConfig(d *schema.ResourceData) (string, error) { - gzipOutput := d.Get("gzip").(bool) - base64Output := d.Get("base64_encode").(bool) - - partsValue, hasParts := d.GetOk("part") - if !hasParts { - return "", fmt.Errorf("No parts found in the cloudinit resource declaration") - } - - cloudInitParts := make(cloudInitParts, len(partsValue.([]interface{}))) - for i, v := range partsValue.([]interface{}) { - p, castOk := v.(map[string]interface{}) - if !castOk { - return "", fmt.Errorf("Unable to parse parts in cloudinit resource declaration") - } - - part := cloudInitPart{} - if p, ok := p["content_type"]; ok { - part.ContentType = p.(string) - } - if p, ok := p["content"]; ok { - part.Content = p.(string) - } - if p, ok := p["merge_type"]; ok { - part.MergeType = p.(string) - } - if p, ok := p["filename"]; ok { - part.Filename = p.(string) - } - cloudInitParts[i] = part - } - - var buffer bytes.Buffer - - var err error - if gzipOutput { - gzipWriter := gzip.NewWriter(&buffer) - err = renderPartsToWriter(cloudInitParts, gzipWriter) - gzipWriter.Close() - } else { - err = renderPartsToWriter(cloudInitParts, &buffer) - } - if err != nil { - return "", err - } - - output := "" - if base64Output { - output = base64.StdEncoding.EncodeToString(buffer.Bytes()) - } else { - output = buffer.String() - } - - return output, nil -} - -func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error { - mimeWriter := multipart.NewWriter(writer) - defer mimeWriter.Close() - - // we need to set the boundary explictly, otherwise the boundary is random - // and this causes terraform to complain about the resource being different - if err := mimeWriter.SetBoundary("MIMEBOUNDARY"); err != nil { - return err - } - - writer.Write([]byte(fmt.Sprintf("Content-Type: multipart/mixed; boundary=\"%s\"\n", mimeWriter.Boundary()))) - writer.Write([]byte("MIME-Version: 1.0\r\n")) - - for _, part := range parts { - header := textproto.MIMEHeader{} - if part.ContentType == "" { - header.Set("Content-Type", "text/plain") - } else { - header.Set("Content-Type", part.ContentType) - } - - header.Set("MIME-Version", "1.0") - header.Set("Content-Transfer-Encoding", "7bit") - - if part.Filename != "" { - header.Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, part.Filename)) - } - - if part.MergeType != "" { - header.Set("X-Merge-Type", part.MergeType) - } - - partWriter, err := mimeWriter.CreatePart(header) - if err != nil { - return err - } - - _, err = partWriter.Write([]byte(part.Content)) - if err != nil { - return err - } - } - - return nil -} - -type cloudInitPart struct { - ContentType string - MergeType string - Filename string - Content string -} - -type cloudInitParts []cloudInitPart diff --git a/installer/server/terraform/plugins/template/datasource_cloudinit_config_test.go b/installer/server/terraform/plugins/template/datasource_cloudinit_config_test.go deleted file mode 100644 index 672383b06b..0000000000 --- a/installer/server/terraform/plugins/template/datasource_cloudinit_config_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package template - -import ( - "regexp" - "testing" - - r "github.com/hashicorp/terraform/helper/resource" -) - -func TestRender(t *testing.T) { - testCases := []struct { - ResourceBlock string - Expected string - }{ - { - `data "template_cloudinit_config" "foo" { - gzip = false - base64_encode = false - - part { - content_type = "text/x-shellscript" - content = "baz" - } - }`, - "Content-Type: multipart/mixed; boundary=\"MIMEBOUNDARY\"\nMIME-Version: 1.0\r\n--MIMEBOUNDARY\r\nContent-Transfer-Encoding: 7bit\r\nContent-Type: text/x-shellscript\r\nMime-Version: 1.0\r\n\r\nbaz\r\n--MIMEBOUNDARY--\r\n", - }, - { - `data "template_cloudinit_config" "foo" { - gzip = false - base64_encode = false - - part { - content_type = "text/x-shellscript" - content = "baz" - filename = "foobar.sh" - } - }`, - "Content-Type: multipart/mixed; boundary=\"MIMEBOUNDARY\"\nMIME-Version: 1.0\r\n--MIMEBOUNDARY\r\nContent-Disposition: attachment; filename=\"foobar.sh\"\r\nContent-Transfer-Encoding: 7bit\r\nContent-Type: text/x-shellscript\r\nMime-Version: 1.0\r\n\r\nbaz\r\n--MIMEBOUNDARY--\r\n", - }, - { - `data "template_cloudinit_config" "foo" { - gzip = false - base64_encode = false - - part { - content_type = "text/x-shellscript" - content = "baz" - } - part { - content_type = "text/x-shellscript" - content = "ffbaz" - } - }`, - "Content-Type: multipart/mixed; boundary=\"MIMEBOUNDARY\"\nMIME-Version: 1.0\r\n--MIMEBOUNDARY\r\nContent-Transfer-Encoding: 7bit\r\nContent-Type: text/x-shellscript\r\nMime-Version: 1.0\r\n\r\nbaz\r\n--MIMEBOUNDARY\r\nContent-Transfer-Encoding: 7bit\r\nContent-Type: text/x-shellscript\r\nMime-Version: 1.0\r\n\r\nffbaz\r\n--MIMEBOUNDARY--\r\n", - }, - } - - for _, tt := range testCases { - r.UnitTest(t, r.TestCase{ - Providers: testProviders, - Steps: []r.TestStep{ - { - Config: tt.ResourceBlock, - Check: r.ComposeTestCheckFunc( - r.TestCheckResourceAttr("data.template_cloudinit_config.foo", "rendered", tt.Expected), - ), - }, - }, - }) - } -} - -// From GH-13572, Correctly handle panic on a misconfigured cloudinit part -func TestRender_handlePanic(t *testing.T) { - r.UnitTest(t, r.TestCase{ - Providers: testProviders, - Steps: []r.TestStep{ - { - Config: testCloudInitConfigMisconfiguredParts, - ExpectError: regexp.MustCompile("Unable to parse parts in cloudinit resource declaration"), - }, - }, - }) -} - -var testCloudInitConfigMisconfiguredParts = ` -data "template_cloudinit_config" "foo" { - part { - content = "" - } -} -` diff --git a/installer/server/terraform/plugins/template/datasource_template_file.go b/installer/server/terraform/plugins/template/datasource_template_file.go deleted file mode 100644 index a6f44606bf..0000000000 --- a/installer/server/terraform/plugins/template/datasource_template_file.go +++ /dev/null @@ -1,165 +0,0 @@ -package template - -import ( - "crypto/sha256" - "encoding/hex" - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/hashicorp/hil" - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/helper/pathorcontents" - "github.com/hashicorp/terraform/helper/schema" -) - -func dataSourceFile() *schema.Resource { - return &schema.Resource{ - Read: dataSourceFileRead, - - Schema: map[string]*schema.Schema{ - "template": { - Type: schema.TypeString, - Optional: true, - Description: "Contents of the template", - ConflictsWith: []string{"filename"}, - }, - "filename": { - Type: schema.TypeString, - Optional: true, - Description: "file to read template from", - // Make a "best effort" attempt to relativize the file path. - StateFunc: func(v interface{}) string { - if v == nil || v.(string) == "" { - return "" - } - pwd, err := os.Getwd() - if err != nil { - return v.(string) - } - rel, err := filepath.Rel(pwd, v.(string)) - if err != nil { - return v.(string) - } - return rel - }, - Deprecated: "Use the 'template' attribute instead.", - ConflictsWith: []string{"template"}, - }, - "vars": { - Type: schema.TypeMap, - Optional: true, - Default: make(map[string]interface{}), - Description: "variables to substitute", - ValidateFunc: validateVarsAttribute, - }, - "rendered": { - Type: schema.TypeString, - Computed: true, - Description: "rendered template", - }, - }, - } -} - -func dataSourceFileRead(d *schema.ResourceData, meta interface{}) error { - rendered, err := renderFile(d) - if err != nil { - return err - } - d.Set("rendered", rendered) - d.SetId(hash(rendered)) - return nil -} - -type templateRenderError error - -func renderFile(d *schema.ResourceData) (string, error) { - template := d.Get("template").(string) - filename := d.Get("filename").(string) - vars := d.Get("vars").(map[string]interface{}) - - contents := template - if template == "" && filename != "" { - data, _, err := pathorcontents.Read(filename) - if err != nil { - return "", err - } - - contents = data - } - - rendered, err := execute(contents, vars) - if err != nil { - return "", templateRenderError( - fmt.Errorf("failed to render %v: %v", filename, err), - ) - } - - return rendered, nil -} - -// execute parses and executes a template using vars. -func execute(s string, vars map[string]interface{}) (string, error) { - root, err := hil.Parse(s) - if err != nil { - return "", err - } - - varmap := make(map[string]ast.Variable) - for k, v := range vars { - // As far as I can tell, v is always a string. - // If it's not, tell the user gracefully. - s, ok := v.(string) - if !ok { - return "", fmt.Errorf("unexpected type for variable %q: %T", k, v) - } - varmap[k] = ast.Variable{ - Value: s, - Type: ast.TypeString, - } - } - - cfg := hil.EvalConfig{ - GlobalScope: &ast.BasicScope{ - VarMap: varmap, - FuncMap: config.Funcs(), - }, - } - - result, err := hil.Eval(root, &cfg) - if err != nil { - return "", err - } - if result.Type != hil.TypeString { - return "", fmt.Errorf("unexpected output hil.Type: %v", result.Type) - } - - return result.Value.(string), nil -} - -func hash(s string) string { - sha := sha256.Sum256([]byte(s)) - return hex.EncodeToString(sha[:]) -} - -func validateVarsAttribute(v interface{}, key string) (ws []string, es []error) { - // vars can only be primitives right now - var badVars []string - for k, v := range v.(map[string]interface{}) { - switch v.(type) { - case []interface{}: - badVars = append(badVars, fmt.Sprintf("%s (list)", k)) - case map[string]interface{}: - badVars = append(badVars, fmt.Sprintf("%s (map)", k)) - } - } - if len(badVars) > 0 { - es = append(es, fmt.Errorf( - "%s: cannot contain non-primitives; bad keys: %s", - key, strings.Join(badVars, ", "))) - } - return -} diff --git a/installer/server/terraform/plugins/template/datasource_template_file_test.go b/installer/server/terraform/plugins/template/datasource_template_file_test.go deleted file mode 100644 index 5838a79b2a..0000000000 --- a/installer/server/terraform/plugins/template/datasource_template_file_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package template - -import ( - "fmt" - "strings" - "sync" - "testing" - - r "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" -) - -var testProviders = map[string]terraform.ResourceProvider{ - "template": Provider(), -} - -func TestTemplateRendering(t *testing.T) { - var cases = []struct { - vars string - template string - want string - }{ - {`{}`, `ABC`, `ABC`}, - {`{a="foo"}`, `$${a}`, `foo`}, - {`{a="hello"}`, `$${replace(a, "ello", "i")}`, `hi`}, - {`{}`, `${1+2+3}`, `6`}, - {`{}`, `/`, `/`}, - } - - for _, tt := range cases { - r.UnitTest(t, r.TestCase{ - Providers: testProviders, - Steps: []r.TestStep{ - { - Config: testTemplateConfig(tt.template, tt.vars), - Check: func(s *terraform.State) error { - got := s.RootModule().Outputs["rendered"] - if tt.want != got.Value { - return fmt.Errorf("template:\n%s\nvars:\n%s\ngot:\n%s\nwant:\n%s\n", tt.template, tt.vars, got, tt.want) - } - return nil - }, - }, - }, - }) - } -} - -func TestValidateVarsAttribute(t *testing.T) { - cases := map[string]struct { - Vars map[string]interface{} - ExpectErr string - }{ - "lists are invalid": { - map[string]interface{}{ - "list": []interface{}{}, - }, - `vars: cannot contain non-primitives`, - }, - "maps are invalid": { - map[string]interface{}{ - "map": map[string]interface{}{}, - }, - `vars: cannot contain non-primitives`, - }, - "strings, integers, floats, and bools are AOK": { - map[string]interface{}{ - "string": "foo", - "int": 1, - "bool": true, - "float": float64(1.0), - }, - ``, - }, - } - - for tn, tc := range cases { - _, es := validateVarsAttribute(tc.Vars, "vars") - if len(es) > 0 { - if tc.ExpectErr == "" { - t.Fatalf("%s: expected no err, got: %#v", tn, es) - } - if !strings.Contains(es[0].Error(), tc.ExpectErr) { - t.Fatalf("%s: expected\n%s\nto contain\n%s", tn, es[0], tc.ExpectErr) - } - } else if tc.ExpectErr != "" { - t.Fatalf("%s: expected err containing %q, got none!", tn, tc.ExpectErr) - } - } -} - -// This test covers a panic due to config.Func formerly being a -// shared map, causing multiple template_file resources to try and -// accessing it parallel during their lang.Eval() runs. -// -// Before fix, test fails under `go test -race` -func TestTemplateSharedMemoryRace(t *testing.T) { - var wg sync.WaitGroup - for i := 0; i < 100; i++ { - wg.Add(1) - go func(t *testing.T, i int) { - out, err := execute("don't panic!", map[string]interface{}{}) - if err != nil { - t.Fatalf("err: %s", err) - } - if out != "don't panic!" { - t.Fatalf("bad output: %s", out) - } - wg.Done() - }(t, i) - } - wg.Wait() -} - -func testTemplateConfig(template, vars string) string { - return fmt.Sprintf(` - data "template_file" "t0" { - template = "%s" - vars = %s - } - output "rendered" { - value = "${data.template_file.t0.rendered}" - }`, template, vars) -} diff --git a/installer/server/terraform/plugins/template/provider.go b/installer/server/terraform/plugins/template/provider.go deleted file mode 100644 index 75e19efc74..0000000000 --- a/installer/server/terraform/plugins/template/provider.go +++ /dev/null @@ -1,27 +0,0 @@ -package template - -import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" -) - -// Provider returns the provider definition. -func Provider() terraform.ResourceProvider { - return &schema.Provider{ - DataSourcesMap: map[string]*schema.Resource{ - "template_file": dataSourceFile(), - "template_cloudinit_config": dataSourceCloudinitConfig(), - }, - ResourcesMap: map[string]*schema.Resource{ - "template_file": schema.DataSourceResourceShim( - "template_file", - dataSourceFile(), - ), - "template_cloudinit_config": schema.DataSourceResourceShim( - "template_cloudinit_config", - dataSourceCloudinitConfig(), - ), - "template_dir": resourceDir(), - }, - } -} diff --git a/installer/server/terraform/plugins/template/provider_test.go b/installer/server/terraform/plugins/template/provider_test.go deleted file mode 100644 index 37c02bb4a4..0000000000 --- a/installer/server/terraform/plugins/template/provider_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package template - -import ( - "testing" - - "github.com/hashicorp/terraform/helper/schema" -) - -func TestProvider(t *testing.T) { - if err := Provider().(*schema.Provider).InternalValidate(); err != nil { - t.Fatalf("err: %s", err) - } -} diff --git a/installer/server/terraform/plugins/template/resource_template_dir.go b/installer/server/terraform/plugins/template/resource_template_dir.go deleted file mode 100644 index 583926bb08..0000000000 --- a/installer/server/terraform/plugins/template/resource_template_dir.go +++ /dev/null @@ -1,225 +0,0 @@ -package template - -import ( - "archive/tar" - "bytes" - "crypto/sha1" - "encoding/hex" - "fmt" - "io" - "io/ioutil" - "os" - "path" - "path/filepath" - - "github.com/hashicorp/terraform/helper/pathorcontents" - "github.com/hashicorp/terraform/helper/schema" -) - -func resourceDir() *schema.Resource { - return &schema.Resource{ - Create: resourceTemplateDirCreate, - Read: resourceTemplateDirRead, - Delete: resourceTemplateDirDelete, - - Schema: map[string]*schema.Schema{ - "source_dir": { - Type: schema.TypeString, - Description: "Path to the directory where the files to template reside", - Required: true, - ForceNew: true, - }, - "vars": { - Type: schema.TypeMap, - Optional: true, - Default: make(map[string]interface{}), - Description: "Variables to substitute", - ValidateFunc: validateVarsAttribute, - ForceNew: true, - }, - "destination_dir": { - Type: schema.TypeString, - Description: "Path to the directory where the templated files will be written", - Required: true, - ForceNew: true, - }, - }, - } -} - -func resourceTemplateDirRead(d *schema.ResourceData, meta interface{}) error { - sourceDir := d.Get("source_dir").(string) - destinationDir := d.Get("destination_dir").(string) - - // If the output doesn't exist, mark the resource for creation. - if _, err := os.Stat(destinationDir); os.IsNotExist(err) { - d.SetId("") - return nil - } - - // If the combined hash of the input and output directories is different from - // the stored one, mark the resource for re-creation. - // - // The output directory is technically enough for the general case, but by - // hashing the input directory as well, we make development much easier: when - // a developer modifies one of the input files, the generation is - // re-triggered. - hash, err := generateID(sourceDir, destinationDir) - if err != nil { - return err - } - if hash != d.Id() { - d.SetId("") - return nil - } - - return nil -} - -func resourceTemplateDirCreate(d *schema.ResourceData, meta interface{}) error { - sourceDir := d.Get("source_dir").(string) - destinationDir := d.Get("destination_dir").(string) - vars := d.Get("vars").(map[string]interface{}) - - // Always delete the output first, otherwise files that got deleted from the - // input directory might still be present in the output afterwards. - if err := resourceTemplateDirDelete(d, meta); err != nil { - return err - } - - // Recursively crawl the input files/directories and generate the output ones. - err := filepath.Walk(sourceDir, func(p string, f os.FileInfo, err error) error { - if f.IsDir() { - return nil - } - if err != nil { - return err - } - - relPath, _ := filepath.Rel(sourceDir, p) - return generateDirFile(p, path.Join(destinationDir, relPath), f, vars) - }) - if err != nil { - return err - } - - // Compute ID. - hash, err := generateID(sourceDir, destinationDir) - if err != nil { - return err - } - d.SetId(hash) - - return nil -} - -func resourceTemplateDirDelete(d *schema.ResourceData, _ interface{}) error { - d.SetId("") - - destinationDir := d.Get("destination_dir").(string) - if _, err := os.Stat(destinationDir); os.IsNotExist(err) { - return nil - } - - if err := os.RemoveAll(destinationDir); err != nil { - return fmt.Errorf("could not delete directory %q: %s", destinationDir, err) - } - - return nil -} - -func generateDirFile(sourceDir, destinationDir string, f os.FileInfo, vars map[string]interface{}) error { - inputContent, _, err := pathorcontents.Read(sourceDir) - if err != nil { - return err - } - - outputContent, err := execute(inputContent, vars) - if err != nil { - return templateRenderError(fmt.Errorf("failed to render %v: %v", sourceDir, err)) - } - - outputDir := path.Dir(destinationDir) - if _, err := os.Stat(outputDir); err != nil { - if err := os.MkdirAll(outputDir, 0777); err != nil { - return err - } - } - - err = ioutil.WriteFile(destinationDir, []byte(outputContent), f.Mode()) - if err != nil { - return err - } - - return nil -} - -func generateID(sourceDir, destinationDir string) (string, error) { - inputHash, err := generateDirHash(sourceDir) - if err != nil { - return "", err - } - outputHash, err := generateDirHash(destinationDir) - if err != nil { - return "", err - } - checksum := sha1.Sum([]byte(inputHash + outputHash)) - return hex.EncodeToString(checksum[:]), nil -} - -func generateDirHash(directoryPath string) (string, error) { - tarData, err := tarDir(directoryPath) - if err != nil { - return "", fmt.Errorf("could not generate output checksum: %s", err) - } - - checksum := sha1.Sum(tarData) - return hex.EncodeToString(checksum[:]), nil -} - -func tarDir(directoryPath string) ([]byte, error) { - buf := new(bytes.Buffer) - tw := tar.NewWriter(buf) - - writeFile := func(p string, f os.FileInfo, err error) error { - if err != nil { - return err - } - - var header *tar.Header - var file *os.File - - header, err = tar.FileInfoHeader(f, f.Name()) - if err != nil { - return err - } - relPath, _ := filepath.Rel(directoryPath, p) - header.Name = relPath - - if err := tw.WriteHeader(header); err != nil { - return err - } - - if f.IsDir() { - return nil - } - - file, err = os.Open(p) - if err != nil { - return err - } - defer file.Close() - - _, err = io.Copy(tw, file) - return err - } - - if err := filepath.Walk(directoryPath, writeFile); err != nil { - return []byte{}, err - } - if err := tw.Flush(); err != nil { - return []byte{}, err - } - - return buf.Bytes(), nil -} diff --git a/installer/server/terraform/plugins/template/resource_template_dir_test.go b/installer/server/terraform/plugins/template/resource_template_dir_test.go deleted file mode 100644 index 716a5f0af9..0000000000 --- a/installer/server/terraform/plugins/template/resource_template_dir_test.go +++ /dev/null @@ -1,104 +0,0 @@ -package template - -import ( - "fmt" - "testing" - - "errors" - r "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" - "io/ioutil" - "os" - "path/filepath" -) - -const templateDirRenderingConfig = ` -resource "template_dir" "dir" { - source_dir = "%s" - destination_dir = "%s" - vars = %s -}` - -type testTemplate struct { - template string - want string -} - -func testTemplateDirWriteFiles(files map[string]testTemplate) (in, out string, err error) { - in, err = ioutil.TempDir(os.TempDir(), "terraform_template_dir") - if err != nil { - return - } - - for name, file := range files { - path := filepath.Join(in, name) - - err = os.MkdirAll(filepath.Dir(path), 0777) - if err != nil { - return - } - - err = ioutil.WriteFile(path, []byte(file.template), 0777) - if err != nil { - return - } - } - - out = fmt.Sprintf("%s.out", in) - return -} - -func TestTemplateDirRendering(t *testing.T) { - var cases = []struct { - vars string - files map[string]testTemplate - }{ - { - files: map[string]testTemplate{ - "foo.txt": {"${bar}", "bar"}, - "nested/monkey.txt": {"ooh-ooh-ooh-eee-eee", "ooh-ooh-ooh-eee-eee"}, - "maths.txt": {"${1+2+3}", "6"}, - }, - vars: `{bar = "bar"}`, - }, - } - - for _, tt := range cases { - // Write the desired templates in a temporary directory. - in, out, err := testTemplateDirWriteFiles(tt.files) - if err != nil { - t.Skipf("could not write templates to temporary directory: %s", err) - continue - } - defer os.RemoveAll(in) - defer os.RemoveAll(out) - - // Run test case. - r.UnitTest(t, r.TestCase{ - Providers: testProviders, - Steps: []r.TestStep{ - { - Config: fmt.Sprintf(templateDirRenderingConfig, in, out, tt.vars), - Check: func(s *terraform.State) error { - for name, file := range tt.files { - content, err := ioutil.ReadFile(filepath.Join(out, name)) - if err != nil { - return fmt.Errorf("template:\n%s\nvars:\n%s\ngot:\n%s\nwant:\n%s\n", file.template, tt.vars, err, file.want) - } - if string(content) != file.want { - return fmt.Errorf("template:\n%s\nvars:\n%s\ngot:\n%s\nwant:\n%s\n", file.template, tt.vars, content, file.want) - } - } - return nil - }, - }, - }, - CheckDestroy: func(*terraform.State) error { - if _, err := os.Stat(out); os.IsNotExist(err) { - return nil - } - return errors.New("template_dir did not get destroyed") - }, - }) - } -} diff --git a/terraformrc.example b/terraformrc.example index b12270cae1..947aa20e6f 100644 --- a/terraformrc.example +++ b/terraformrc.example @@ -1,6 +1,4 @@ providers { - local = "-TFSPACE-local" - template = "-TFSPACE-template" aws = "-TFSPACE-aws" matchbox = "-TFSPACE-matchbox" } \ No newline at end of file From 029cf8e7cb0ee2ac63ea818799ac63067406e36e Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Wed, 26 Apr 2017 17:13:16 -0700 Subject: [PATCH 6/7] *: update remaining mentions of TerraForm v0.8.8 --- Dockerfile | 4 ++-- README.md | 2 +- installer/scripts/release/common.env.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73be6f7244..216212ec4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM golang:alpine -ENV TERRAFORM_VERSION=0.8.8-coreos.1 +ENV TERRAFORM_VERSION=0.9.4 RUN apk add --update git bash make RUN go get github.com/coreos/bcrypt-tool WORKDIR $GOPATH/src/github.com/hashicorp/terraform -RUN git clone https://github.com/coreos/terraform.git ./ && \ +RUN git clone https://github.com/hashicorp/terraform.git ./ && \ git checkout v${TERRAFORM_VERSION} && \ go run scripts/generate-plugins.go && \ XC_ARCH=amd64 XC_OS=linux ./scripts/build.sh diff --git a/README.md b/README.md index 347b1ad9c8..00b831762c 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ At a high level, using the installer follows the workflow below. See each platfo **Install Terraform** -This project is built on Terraform and requires version 0.8.8. Download and install an [official Terraform binary](https://releases.hashicorp.com/terraform/0.8.8/) for your OS or use your favorite package manager. +This project is built on Terraform and requires version 0.9.4. Download and install an [official Terraform binary](https://releases.hashicorp.com/terraform/0.8.8/) for your OS or use your favorite package manager. **Choose your platform** diff --git a/installer/scripts/release/common.env.sh b/installer/scripts/release/common.env.sh index cafa2ee0ec..afe91cfac5 100644 --- a/installer/scripts/release/common.env.sh +++ b/installer/scripts/release/common.env.sh @@ -22,5 +22,5 @@ MATCHBOX_RELEASE_URL="https://github.com/coreos/matchbox/releases/download/${MAT MATCHBOX_ARCHIVE_TOP_DIR="matchbox-${MATCHBOX_RELEASE_VERSION}-linux-amd64" TERRAFORM_BIN_TMP_DIR="$TMP_DIR/terraform-bin" -TERRAFORM_BIN_VERSION=0.8.8 +TERRAFORM_BIN_VERSION=0.9.4 TERRAFORM_BIN_BASE_URL="https://releases.hashicorp.com/terraform/${TERRAFORM_BIN_VERSION}/terraform_${TERRAFORM_BIN_VERSION}" From a7951fd70beb3109bcd8966829a80807a9cca5db Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Wed, 26 Apr 2017 19:06:47 -0700 Subject: [PATCH 7/7] Jenkinsfile: bump the builder image to 1.7 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index eda3125025..8fdef2f12f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { agent { docker { - image 'quay.io/coreos/tectonic-builder:v1.6' + image 'quay.io/coreos/tectonic-builder:v1.7' label 'worker' } }