Skip to content

Commit

Permalink
Add 'zone delete' command to flarectl (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
tresni authored and patryk committed Sep 16, 2019
1 parent 4370482 commit a80f83b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/flarectl/flarectl.go
Expand Up @@ -93,6 +93,17 @@ func main() {
},
},
},
{
Name: "delete",
Action: zoneDelete,
Usage: "Delete a zone",
Flags: []cli.Flag{
cli.StringFlag{
Name: "zone",
Usage: "zone name",
},
},
},
{
Name: "check",
Action: zoneCheck,
Expand Down
18 changes: 18 additions & 0 deletions cmd/flarectl/zone.go
Expand Up @@ -80,6 +80,24 @@ func zoneList(c *cli.Context) {
writeTable(output, "ID", "Name", "Plan", "Status")
}

func zoneDelete(c *cli.Context) {
if err := checkFlags(c, "zone"); err != nil {
return
}

zoneID, err := api.ZoneIDByName(c.String("zone"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}

_, err = api.DeleteZone(zoneID)
if err != nil {
fmt.Fprintln(os.Stderr, fmt.Sprintf("%s", err))
return
}
}

func zoneCreateLockdown(c *cli.Context) {
if err := checkFlags(c, "zone", "urls", "targets", "values"); err != nil {
return
Expand Down

0 comments on commit a80f83b

Please sign in to comment.