Skip to content

Commit

Permalink
Add redeploy command
Browse files Browse the repository at this point in the history
  • Loading branch information
krutten authored and jhunt committed Nov 25, 2020
1 parent 1b9d144 commit a284c4f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,7 @@ func (c Client) Manifest(id string) (string, error) {
func (c Client) Creds(id string) (string, error) {
return c.text("/b/%s/creds.yml", id)
}

func (c Client) Redeploy(id string) (string, error) {
return c.text("/b/%s/redeploy", id)
}
24 changes: 24 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ var opt struct {
Manifest struct{} `cli:"manifest"`

Creds struct{} `cli:"creds"`

Redeploy struct{} `cli:"redeploy"`
}

func usage(f string, args ...interface{}) {
Expand All @@ -79,6 +81,7 @@ func commands() {
fmt.Printf("\n")
fmt.Printf(" @G{creds} Print out credentials for a service instance.\n")
fmt.Printf(" @G{manifest} Print an instance's BOSH deployment manifest.\n")
fmt.Printf(" @G{redeploy} Redeploy service instance from saved deployment manifest\n")
fmt.Printf(" @G{task} Show the BOSH deployment task for an instance.\n")
fmt.Printf("\n")
}
Expand Down Expand Up @@ -436,6 +439,27 @@ func main() {
fmt.Printf("%s\n", creds)
os.Exit(0)

case "redeploy":
if opt.Help {
usage("@C{redeploy} @M{instance}")
options()
os.Exit(0)
}

if len(args) != 1 {
bad("manifest", "@R{The `instance' argument is required.}")
os.Exit(1)
}

c := connect()
id, err := c.Resolve(args[0])
bail(err)
task, err := c.Redeploy(id)
bail(err)
fmt.Printf("# @M{%s}\n", id)
fmt.Printf("%s\n", task)
os.Exit(0)

case "creds":
if opt.Help {
usage("@C{creds} @M{instance}")
Expand Down

0 comments on commit a284c4f

Please sign in to comment.