package main

import (
	"flag"
	"fmt"
	"github.com/rackspace/gophercloud"
)

var quiet = flag.Bool("quiet", false, "Quiet mode, for acceptance testing.  $? still indicates errors though.")
var serverId = flag.String("i", "", "ID of server whose admin password is to be changed.")
var newPass = flag.String("p", "", "New password for the server.")

func main() {
	flag.Parse()

	withIdentity(false, func(acc gophercloud.AccessProvider) {
		withServerApi(acc, func(api gophercloud.CloudServersProvider) {
			// If user doesn't explicitly provide a server ID, create one dynamically.
			if *serverId == "" {
				var err error
				*serverId, err = createServer(api, "", "", "", "")
				if err != nil {
					panic(err)
				}
				waitForServerState(api, *serverId, "ACTIVE")
			}

			// If no password is provided, create one dynamically.
			if *newPass == "" {
				*newPass = randomString("", 16)
			}

			// Submit the request for changing the admin password.
			// Note that we don't verify this actually completes;
			// doing so is beyond the scope of the SDK, and should be
			// the responsibility of your specific OpenStack provider.
			err := api.SetAdminPassword(*serverId, *newPass)
			if err != nil {
				panic(err)
			}

			if !*quiet {
				fmt.Println("Password change request submitted.")
			}
		})
	})
}
