示例#1
0
//Delete a location in a given region for the particular provider
func Delete(cmd *cli.Cmd) {
	provider := cmd.String(cli.StringArg{
		Name:      "PROVIDER",
		Desc:      "Cloud provider(i.e. amazon)",
		HideValue: true,
	})

	identifier := cmd.String(cli.StringArg{
		Name:      "IDENTIFIER",
		Desc:      "Cloud provider specific region/zone/etc identifier (i.e. us-east-1)",
		HideValue: true,
	})

	cmd.Action = func() {
		l := location.Location{
			Provider: *provider,
			Region:   *identifier,
		}

		//TODO determine if there are any applications in the location and prompt user to remove them
		errs := l.Delete()

		if len(errs) > 0 {
			log.Fatalf("Could not delete location: %s", errs)
		}

		fmt.Printf("Deleting location %s-%s", *provider, *identifier)
	}
}