本文整理匯總了Golang中github.com/vmware/govmomi/vim25/types.Extension.ResourceList方法的典型用法代碼示例。如果您正苦於以下問題:Golang Extension.ResourceList方法的具體用法?Golang Extension.ResourceList怎麽用?Golang Extension.ResourceList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/vmware/govmomi/vim25/types.Extension
的用法示例。
在下文中一共展示了Extension.ResourceList方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Register
// Register installs an extension to the target
func (p *Pluginator) Register() error {
defer trace.End(trace.Begin(""))
var err error
if !p.connected {
return errors.New("not connected")
}
desc := types.Description{
Label: p.info.Name,
Summary: p.info.Summary,
}
e := types.Extension{
Key: p.info.Key,
Version: p.info.Version,
Company: p.info.Company,
Description: &desc,
}
eci := types.ExtensionClientInfo{
Version: p.info.Version,
Company: p.info.Company,
Description: &desc,
Type: p.info.Type,
Url: p.info.URL,
}
e.Client = append(e.Client, eci)
d := types.KeyValue{
Key: "name",
Value: p.info.Name,
}
eri := types.ExtensionResourceInfo{
Locale: "en_US",
Module: "name",
}
eri.Data = append(eri.Data, d)
e.ResourceList = append(e.ResourceList, eri)
// HTTPS requires extension server info
if strings.HasPrefix(strings.ToLower(p.info.URL), "https://") {
esi := types.ExtensionServerInfo{
Url: p.info.URL,
Description: &desc,
Company: p.info.Company,
Type: "HTTPS",
AdminEmail: []string{"[email protected]"},
ServerThumbprint: p.info.ServerThumbprint,
}
e.Server = append(e.Server, esi)
}
e.ShownInSolutionManager = &p.info.ShowInSolutionManager
e.LastHeartbeatTime = time.Now().UTC()
err = p.ExtensionManager.Register(p.Context, e)
if err != nil {
return err
}
return nil
}