本文整理匯總了Golang中github.com/juju/juju/environs/configstore.APIEndpoint.ServerUUID方法的典型用法代碼示例。如果您正苦於以下問題:Golang APIEndpoint.ServerUUID方法的具體用法?Golang APIEndpoint.ServerUUID怎麽用?Golang APIEndpoint.ServerUUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/environs/configstore.APIEndpoint
的用法示例。
在下文中一共展示了APIEndpoint.ServerUUID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: decorateAndWriteInfo
// decorateAndWriteInfo decorates the info struct with information
// from the given cfg, and the writes that out to the filesystem.
func decorateAndWriteInfo(info configstore.EnvironInfo, cfg *config.Config) error {
// Sanity check our config.
var endpoint configstore.APIEndpoint
if cert, ok := cfg.CACert(); !ok {
return errors.Errorf("CACert is not set")
} else if uuid, ok := cfg.UUID(); !ok {
return errors.Errorf("UUID is not set")
} else if adminSecret := cfg.AdminSecret(); adminSecret == "" {
return errors.Errorf("admin-secret is not set")
} else {
endpoint = configstore.APIEndpoint{
CACert: cert,
EnvironUUID: uuid,
}
}
creds := configstore.APICredentials{
User: configstore.DefaultAdminUsername,
Password: cfg.AdminSecret(),
}
endpoint.ServerUUID = endpoint.EnvironUUID
info.SetAPICredentials(creds)
info.SetAPIEndpoint(endpoint)
info.SetBootstrapConfig(cfg.AllAttrs())
if err := info.Write(); err != nil {
return errors.Annotatef(err, "cannot create environment info %q", cfg.Name())
}
return nil
}