Ejemplo n.º 1
0
func deleteTable(db *dynamodb.DynamoDB, table string) error {
	params := &dynamodb.DeleteTableInput{
		TableName: aws.String(table),
	}
	_, err := db.DeleteTable(params)
	if err != nil {
		return err
	}
	return nil

}
Ejemplo n.º 2
0
func deleteTable(db *dynamodb.DynamoDB, tableName string) error {
	params := &dynamodb.DeleteTableInput{
		TableName: aws.String(tableName),
	}
	_, err := db.DeleteTable(params)
	if err != nil {
		return err
	}

	describeParams := &dynamodb.DescribeTableInput{
		TableName: aws.String(tableName),
	}
	if err := db.WaitUntilTableNotExists(describeParams); err != nil {
		return err
	}

	return nil
}
Ejemplo n.º 3
0
func teardownTables(t *testing.T, db *dynamodb.DynamoDB) {

	resp, err := db.ListTables(&dynamodb.ListTablesInput{})
	if err != nil {
		t.Fatalf("teardown tables list: %s", err.Error())
	}
	for _, table := range resp.TableNames {
		_, err = db.DeleteTable(&dynamodb.DeleteTableInput{
			TableName: table,
		})
		if err != nil {
			t.Logf("teardown table %s: %s", *table, err.Error())
		}
	}
	if err != nil {
		t.FailNow()
	}
}
Ejemplo n.º 4
0
func DeleteTable(tableName string) {

	localAddr := os.Getenv("LOCAL_DYNAMO_ADDR")
	if localAddr == "" {
		log.Info("DeleteAppTable will only attempt to delete a local dynamodb table... returning.")
		return
	}

	var svc *dynamodb.DynamoDB = dbutil.CreateDynamoDBClient()

	params := &dynamodb.DeleteTableInput{
		TableName: aws.String(tableName),
	}
	resp, err := svc.DeleteTable(params)

	if err != nil {
		log.Info(err.Error())
		return
	}

	log.Printf("Table %s deleted:\n%s\n", tableName, resp.String())
}
Ejemplo n.º 5
0
func deleteAccountsTable(db *dynamodb.DynamoDB) error {
	var input = new(dynamodb.DeleteTableInput)
	input.TableName = aws.String("Accounts")
	var _, err = db.DeleteTable(input)
	return err
}