Esempio n. 1
0
// WaitUntilInstanceDeregistered uses the Elastic Load Balancing API operation
// DescribeInstanceHealth 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 *ELB) WaitUntilInstanceDeregistered(input *DescribeInstanceHealthInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeInstanceHealth",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "InstanceStates[].State",
				Expected: "OutOfService",
			},
			{
				State:    "success",
				Matcher:  "error",
				Argument: "",
				Expected: "InvalidInstance",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 2
0
func (c *ElastiCache) WaitUntilReplicationGroupAvailable(input *DescribeReplicationGroupsInput) error {
	if waiterReplicationGroupAvailable == nil {
		waiterReplicationGroupAvailable = &waiter.Config{
			Operation:   "DescribeReplicationGroups",
			Delay:       15,
			MaxAttempts: 40,
			Acceptors: []waiter.WaitAcceptor{
				{
					State:    "success",
					Matcher:  "pathAll",
					Argument: "ReplicationGroups[].Status",
					Expected: "available",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "ReplicationGroups[].Status",
					Expected: "deleted",
				},
			},
		}
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterReplicationGroupAvailable,
	}
	return w.Wait()
}
Esempio n. 3
0
func (c *Redshift) WaitUntilSnapshotAvailable(input *DescribeClusterSnapshotsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeClusterSnapshots",
		Delay:       15,
		MaxAttempts: 20,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "Snapshots[].Status",
				Expected: "available",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Snapshots[].Status",
				Expected: "failed",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Snapshots[].Status",
				Expected: "deleted",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 4
0
// WaitUntilEvaluationAvailable uses the Amazon Machine Learning API operation
// DescribeEvaluations 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 *MachineLearning) WaitUntilEvaluationAvailable(input *DescribeEvaluationsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeEvaluations",
		Delay:       30,
		MaxAttempts: 60,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "Results[].Status",
				Expected: "COMPLETED",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Results[].Status",
				Expected: "FAILED",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 5
0
func (c *OpsWorks) WaitUntilDeploymentSuccessful(input *DescribeDeploymentsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeDeployments",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "Deployments[].Status",
				Expected: "successful",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Deployments[].Status",
				Expected: "failed",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 6
0
// WaitUntilTableExists uses the DynamoDB API operation
// DescribeTable 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 *DynamoDB) WaitUntilTableExists(input *DescribeTableInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeTable",
		Delay:       20,
		MaxAttempts: 25,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "path",
				Argument: "Table.TableStatus",
				Expected: "ACTIVE",
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "ResourceNotFoundException",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 7
0
func (c *ECS) WaitUntilTasksRunning(input *DescribeTasksInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeTasks",
		Delay:       6,
		MaxAttempts: 100,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "tasks[].lastStatus",
				Expected: "STOPPED",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "failures[].reason",
				Expected: "MISSING",
			},
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "tasks[].lastStatus",
				Expected: "RUNNING",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 8
0
func (c *EC2) WaitUntilNetworkInterfaceAvailable(input *DescribeNetworkInterfacesInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeNetworkInterfaces",
		Delay:       20,
		MaxAttempts: 10,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "NetworkInterfaces[].Status",
				Expected: "available",
			},
			{
				State:    "failure",
				Matcher:  "error",
				Argument: "",
				Expected: "InvalidNetworkInterfaceIDNotFound",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 9
0
func (c *EC2) WaitUntilVolumeDeleted(input *DescribeVolumesInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeVolumes",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "Volumes[].State",
				Expected: "deleted",
			},
			{
				State:    "success",
				Matcher:  "error",
				Argument: "",
				Expected: "InvalidVolumeNotFound",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 10
0
func (c *EC2) WaitUntilInstanceTerminated(input *DescribeInstancesInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeInstances",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "Reservations[].Instances[].State.Name",
				Expected: "terminated",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Reservations[].Instances[].State.Name",
				Expected: "pending",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Reservations[].Instances[].State.Name",
				Expected: "stopping",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 11
0
func (c *EC2) WaitUntilKeyPairExists(input *DescribeKeyPairsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeKeyPairs",
		Delay:       5,
		MaxAttempts: 6,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "length(KeyPairs[].KeyName) > `0`",
				Expected: true,
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "InvalidKeyPairNotFound",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 12
0
func (c *EC2) WaitUntilInstanceStatusOk(input *DescribeInstanceStatusInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeInstanceStatus",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "InstanceStatuses[].InstanceStatus.Status",
				Expected: "ok",
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "InvalidInstanceIDNotFound",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 13
0
func (c *EC2) WaitUntilInstanceExists(input *DescribeInstancesInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeInstances",
		Delay:       5,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "path",
				Argument: "length(Reservations[]) > `0`",
				Expected: true,
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "InvalidInstanceIDNotFound",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 14
0
func (c *EC2) WaitUntilCustomerGatewayAvailable(input *DescribeCustomerGatewaysInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeCustomerGateways",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "CustomerGateways[].State",
				Expected: "available",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "CustomerGateways[].State",
				Expected: "deleted",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "CustomerGateways[].State",
				Expected: "deleting",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 15
0
func (c *IAM) WaitUntilInstanceProfileExists(input *GetInstanceProfileInput) error {
	waiterCfg := waiter.Config{
		Operation:   "GetInstanceProfile",
		Delay:       1,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "status",
				Argument: "",
				Expected: 200,
			},
			{
				State:    "retry",
				Matcher:  "status",
				Argument: "",
				Expected: 404,
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 16
0
func (c *EC2) WaitUntilVpcPeeringConnectionExists(input *DescribeVpcPeeringConnectionsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeVpcPeeringConnections",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "status",
				Argument: "",
				Expected: 200,
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "InvalidVpcPeeringConnectionIDNotFound",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 17
0
func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeStacks",
		Delay:       5,
		MaxAttempts: 20,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "status",
				Argument: "",
				Expected: 200,
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "ValidationError",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 18
0
func (c *EC2) WaitUntilBundleTaskComplete(input *DescribeBundleTasksInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeBundleTasks",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "BundleTasks[].State",
				Expected: "complete",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "BundleTasks[].State",
				Expected: "failed",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 19
0
// WaitUntilJobComplete uses the Amazon Elastic Transcoder API operation
// ReadJob 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 *ElasticTranscoder) WaitUntilJobComplete(input *ReadJobInput) error {
	waiterCfg := waiter.Config{
		Operation:   "ReadJob",
		Delay:       30,
		MaxAttempts: 120,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "path",
				Argument: "Job.Status",
				Expected: "Complete",
			},
			{
				State:    "failure",
				Matcher:  "path",
				Argument: "Job.Status",
				Expected: "Canceled",
			},
			{
				State:    "failure",
				Matcher:  "path",
				Argument: "Job.Status",
				Expected: "Error",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 20
0
func (c *EC2) WaitUntilVpnConnectionDeleted(input *DescribeVpnConnectionsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeVpnConnections",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "VpnConnections[].State",
				Expected: "deleted",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "VpnConnections[].State",
				Expected: "pending",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 21
0
func (c *ECS) WaitUntilServicesInactive(input *DescribeServicesInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeServices",
		Delay:       15,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "failures[].reason",
				Expected: "MISSING",
			},
			{
				State:    "success",
				Matcher:  "pathAny",
				Argument: "services[].status",
				Expected: "INACTIVE",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 22
0
func (c *Redshift) WaitUntilClusterRestored(input *DescribeClustersInput) error {
	if waiterClusterRestored == nil {
		waiterClusterRestored = &waiter.Config{
			Operation:   "DescribeClusters",
			Delay:       60,
			MaxAttempts: 30,
			Acceptors: []waiter.WaitAcceptor{
				{
					State:    "success",
					Matcher:  "pathAll",
					Argument: "Clusters[].RestoreStatus.Status",
					Expected: "completed",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "Clusters[].ClusterStatus",
					Expected: "deleting",
				},
			},
		}
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterClusterRestored,
	}
	return w.Wait()
}
Esempio n. 23
0
func (c *S3) WaitUntilObjectExists(input *HeadObjectInput) error {
	if waiterObjectExists == nil {
		waiterObjectExists = &waiter.Config{
			Operation:   "HeadObject",
			Delay:       5,
			MaxAttempts: 20,
			Acceptors: []waiter.WaitAcceptor{
				{
					State:    "success",
					Matcher:  "status",
					Argument: "",
					Expected: 200,
				},
				{
					State:    "retry",
					Matcher:  "status",
					Argument: "",
					Expected: 404,
				},
			},
		}
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterObjectExists,
	}
	return w.Wait()
}
Esempio n. 24
0
func (c *RDS) WaitUntilDBInstanceAvailable(input *DescribeDBInstancesInput) error {
	if waiterDBInstanceAvailable == nil {
		waiterDBInstanceAvailable = &waiter.Config{
			Operation:   "DescribeDBInstances",
			Delay:       30,
			MaxAttempts: 60,
			Acceptors: []waiter.WaitAcceptor{
				{
					State:    "success",
					Matcher:  "pathAll",
					Argument: "DBInstances[].DBInstanceStatus",
					Expected: "available",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "DBInstances[].DBInstanceStatus",
					Expected: "deleted",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "DBInstances[].DBInstanceStatus",
					Expected: "deleting",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "DBInstances[].DBInstanceStatus",
					Expected: "failed",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "DBInstances[].DBInstanceStatus",
					Expected: "incompatible-restore",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "DBInstances[].DBInstanceStatus",
					Expected: "incompatible-parameters",
				},
				{
					State:    "failure",
					Matcher:  "pathAny",
					Argument: "DBInstances[].DBInstanceStatus",
					Expected: "incompatible-restore",
				},
			},
		}
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterDBInstanceAvailable,
	}
	return w.Wait()
}
Esempio n. 25
0
func (c *OpsWorks) WaitUntilAppExists(input *DescribeAppsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeApps",
		Delay:       1,
		MaxAttempts: 40,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "status",
				Argument: "",
				Expected: 200,
			},
			{
				State:    "failure",
				Matcher:  "status",
				Argument: "",
				Expected: 400,
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 26
0
func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeStacks",
		Delay:       30,
		MaxAttempts: 50,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "Stacks[].StackStatus",
				Expected: "CREATE_COMPLETE",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Stacks[].StackStatus",
				Expected: "CREATE_FAILED",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 27
0
func (c *Glacier) WaitUntilVaultExists(input *DescribeVaultInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeVault",
		Delay:       3,
		MaxAttempts: 15,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "status",
				Argument: "",
				Expected: 200,
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "ResourceNotFoundException",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 28
0
func (c *IAM) WaitUntilUserExists(input *GetUserInput) error {
	waiterCfg := waiter.Config{
		Operation:   "GetUser",
		Delay:       1,
		MaxAttempts: 20,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "status",
				Argument: "",
				Expected: 200,
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "NoSuchEntity",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 29
0
func (c *Redshift) WaitUntilClusterAvailable(input *DescribeClustersInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeClusters",
		Delay:       60,
		MaxAttempts: 30,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "Clusters[].ClusterStatus",
				Expected: "available",
			},
			{
				State:    "failure",
				Matcher:  "pathAny",
				Argument: "Clusters[].ClusterStatus",
				Expected: "deleting",
			},
			{
				State:    "retry",
				Matcher:  "error",
				Argument: "",
				Expected: "ClusterNotFound",
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}
Esempio n. 30
0
func (c *AutoScaling) WaitUntilGroupExists(input *DescribeAutoScalingGroupsInput) error {
	waiterCfg := waiter.Config{
		Operation:   "DescribeAutoScalingGroups",
		Delay:       5,
		MaxAttempts: 10,
		Acceptors: []waiter.WaitAcceptor{
			{
				State:    "success",
				Matcher:  "pathAll",
				Argument: "length(AutoScalingGroups)",
				Expected: 1,
			},
			{
				State:    "retry",
				Matcher:  "pathAll",
				Argument: "length(AutoScalingGroups)",
				Expected: 0,
			},
		},
	}

	w := waiter.Waiter{
		Client: c,
		Input:  input,
		Config: waiterCfg,
	}
	return w.Wait()
}