本文整理汇总了Golang中github.com/vmware/govmomi/vim25/types.Extension类的典型用法代码示例。如果您正苦于以下问题:Golang Extension类的具体用法?Golang Extension怎么用?Golang Extension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Extension类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Run
func (cmd *register) Run(f *flag.FlagSet) error {
ctx := context.TODO()
c, err := cmd.Client()
if err != nil {
return err
}
m, err := object.GetExtensionManager(c)
if err != nil {
return err
}
b, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return err
}
var e types.Extension
e.Description = new(types.Description)
if err = json.Unmarshal(b, &e); err != nil {
return err
}
e.LastHeartbeatTime = time.Now().UTC()
if cmd.update {
return m.Update(ctx, e)
}
return m.Register(ctx, e)
}
开发者ID:hickeng,项目名称:govmomi,代码行数:33,代码来源:register.go
示例2: Run
func (cmd *register) Run(ctx context.Context, f *flag.FlagSet) error {
c, err := cmd.Client()
if err != nil {
return err
}
m, err := object.GetExtensionManager(c)
if err != nil {
return err
}
var e types.Extension
e.Description = new(types.Description)
if err = json.NewDecoder(os.Stdin).Decode(&e); err != nil {
return err
}
e.LastHeartbeatTime = time.Now().UTC()
if cmd.update {
return m.Update(ctx, e)
}
return m.Register(ctx, e)
}
开发者ID:jak-atx,项目名称:vic,代码行数:26,代码来源:register.go
示例3: RegisterExtension
func (d *Dispatcher) RegisterExtension(conf *config.VirtualContainerHostConfigSpec, extension types.Extension) error {
defer trace.End(trace.Begin(conf.ExtensionName))
log.Infoln("Registering VCH as a vSphere extension")
// vSphere confusingly calls the 'name' of the extension a 'key'
// This variable is named IdKey as to not confuse it with its private key
if conf.ExtensionCert == "" {
return errors.Errorf("Extension certificate does not exist")
}
extensionManager := object.NewExtensionManager(d.session.Vim25())
extension.LastHeartbeatTime = time.Now().UTC()
if err := extensionManager.Register(d.ctx, extension); err != nil {
log.Errorf("Could not register the vSphere extension due to err: %s", err)
return err
}
if err := extensionManager.SetCertificate(d.ctx, conf.ExtensionName, conf.ExtensionCert); err != nil {
log.Errorf("Could not set the certificate on the vSphere extension due to error: %s", err)
return err
}
return nil
}
开发者ID:vmware,项目名称:vic,代码行数:26,代码来源:create.go
示例4: 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
}
开发者ID:vmware,项目名称:vic,代码行数:67,代码来源:register.go
注:本文中的github.com/vmware/govmomi/vim25/types.Extension类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论