本文整理汇总了Golang中github.com/vmware/vic/lib/config.VirtualContainerHostConfigSpec.Target方法的典型用法代码示例。如果您正苦于以下问题:Golang VirtualContainerHostConfigSpec.Target方法的具体用法?Golang VirtualContainerHostConfigSpec.Target怎么用?Golang VirtualContainerHostConfigSpec.Target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/vmware/vic/lib/config.VirtualContainerHostConfigSpec
的用法示例。
在下文中一共展示了VirtualContainerHostConfigSpec.Target方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: target
func (v *Validator) target(ctx context.Context, input *data.Data, conf *config.VirtualContainerHostConfigSpec) {
defer trace.End(trace.Begin(""))
targetURL := input.Target.URLWithoutPassword()
if !v.IsVC() {
var err error
targetURL, err = url.Parse(v.Session.Service)
if err != nil {
v.NoteIssue(fmt.Errorf("Error processing target after transformation to SOAP endpoint: %q: %s", v.Session.Service, err))
return
}
// ESXi requires user/password to be encoded in the Target URL
// However, this gets lost when the URL is Marshaled
conf.UserPassword = targetURL.User.String()
}
// bridge network params
var err error
_, conf.BridgeIPRange, err = net.ParseCIDR(input.BridgeIPRange)
if err != nil {
v.NoteIssue(fmt.Errorf("Error parsing bridge network ip range: %s. Range must be in CIDR format, e.g., 172.16.0.0/12", err))
}
conf.Target = *targetURL
conf.Insecure = input.Insecure
// TODO: more checks needed here if specifying service account for VCH
}
示例2: target
func (v *Validator) target(ctx context.Context, input *data.Data, conf *config.VirtualContainerHostConfigSpec) {
defer trace.End(trace.Begin(""))
targetURL := input.Target.URLWithoutPassword()
if !v.IsVC() {
var err error
targetURL, err = url.Parse(v.Session.Service)
if err != nil {
v.NoteIssue(fmt.Errorf("Error processing target after transformation to SOAP endpoint: %q: %s", v.Session.Service, err))
return
}
// ESXi requires user/password to be encoded in the Target URL
// However, this gets lost when the URL is Marshaled
conf.UserPassword = targetURL.User.String()
}
// check if host is managed by VC
v.managedbyVC(ctx)
conf.Target = *targetURL
conf.TargetThumbprint = input.Thumbprint
// TODO: more checks needed here if specifying service account for VCH
}