当前位置: 首页>>代码示例>>Golang>>正文


Golang VirtualContainerHostConfigSpec.UserPassword方法代码示例

本文整理汇总了Golang中github.com/vmware/vic/lib/config.VirtualContainerHostConfigSpec.UserPassword方法的典型用法代码示例。如果您正苦于以下问题:Golang VirtualContainerHostConfigSpec.UserPassword方法的具体用法?Golang VirtualContainerHostConfigSpec.UserPassword怎么用?Golang VirtualContainerHostConfigSpec.UserPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/vmware/vic/lib/config.VirtualContainerHostConfigSpec的用法示例。


在下文中一共展示了VirtualContainerHostConfigSpec.UserPassword方法的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
}
开发者ID:kjplatz,项目名称:vic,代码行数:29,代码来源:validator.go

示例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
}
开发者ID:vmware,项目名称:vic,代码行数:25,代码来源:validator.go


注:本文中的github.com/vmware/vic/lib/config.VirtualContainerHostConfigSpec.UserPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。