本文整理汇总了Golang中github.com/juju/juju/jujuclient.ClientStore.RemoveAccount方法的典型用法代码示例。如果您正苦于以下问题:Golang ClientStore.RemoveAccount方法的具体用法?Golang ClientStore.RemoveAccount怎么用?Golang ClientStore.RemoveAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/jujuclient.ClientStore
的用法示例。
在下文中一共展示了ClientStore.RemoveAccount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: logout
func (c *logoutCommand) logout(store jujuclient.ClientStore, controllerName string) error {
accountDetails, err := store.AccountDetails(controllerName)
if errors.IsNotFound(err) {
// Not logged in; nothing else to do.
return nil
} else if err != nil {
return errors.Trace(err)
}
// We first ensure that the user has a macaroon, which implies
// they know their password. If they have just bootstrapped,
// they will have a randomly generated password which they will
// be unaware of.
if accountDetails.Password != "" && !c.Force {
return errors.New(`preventing account loss
It appears that you have not changed the password for
your account. If this is the case, change the password
first before logging out, so that you can log in again
afterwards. To change your password, run the command
"juju change-user-password".
If you are sure you want to log out, and it is safe to
clear the credentials from the client, then you can run
this command again with the "--force" flag.
`)
}
// Remove the account credentials.
if err := store.RemoveAccount(controllerName); err != nil {
return errors.Annotate(err, "failed to clear credentials")
}
return nil
}