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


Golang normalization.Version函数代码示例

本文整理汇总了Golang中k8s/io/kubernetes/cmd/libs/go2idl/client-gen/generators/normalization.Version函数的典型用法代码示例。如果您正苦于以下问题:Golang Version函数的具体用法?Golang Version怎么用?Golang Version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Version函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GenerateType

func (g *genClientset) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
	// TODO: We actually don't need any type information to generate the clientset,
	// perhaps we can adapt the go2ild framework to this kind of usage.
	sw := generator.NewSnippetWriter(w, c, "$", "$")

	sw.Do(common, nil)

	sw.Do(checkImpl, nil)

	type arg struct {
		Group       string
		PackageName string
	}
	allGroups := []arg{}
	for _, gv := range g.groupVersions {
		group := normalization.Group(gv.Group)
		version := normalization.Version(gv.Version)
		allGroups = append(allGroups, arg{namer.IC(group), version + group})
	}

	for _, g := range allGroups {
		sw.Do(clientsetInterfaceImplTemplate, g)
	}

	return sw.Error()
}
开发者ID:RomainVabre,项目名称:origin,代码行数:26,代码来源:generator_fake_for_clientset.go

示例2: Imports

func (g *genClientset) Imports(c *generator.Context) (imports []string) {
	imports = append(imports, g.imports.ImportLines()...)
	for _, gv := range g.groupVersions {
		group := normalization.Group(gv.Group)
		version := normalization.Version(gv.Version)
		typedClientPath := filepath.Join(g.typedClientPath, group, version)
		imports = append(imports, fmt.Sprintf("%s%s \"%s\"", version, group, typedClientPath))
		fakeTypedClientPath := filepath.Join(typedClientPath, "fake")
		imports = append(imports, fmt.Sprintf("fake%s%s \"%s\"", version, group, fakeTypedClientPath))
	}
	// the package that has the clientset Interface
	imports = append(imports, fmt.Sprintf("clientset \"%s\"", g.clientsetPath))
	// imports for the code in commonTemplate
	imports = append(imports,
		"k8s.io/kubernetes/pkg/api",
		"k8s.io/kubernetes/pkg/apimachinery/registered",
		"k8s.io/kubernetes/pkg/client/testing/core",
		"k8s.io/kubernetes/pkg/client/typed/discovery",
		"fakediscovery \"k8s.io/kubernetes/pkg/client/typed/discovery/fake\"",
		"k8s.io/kubernetes/pkg/runtime",
		"k8s.io/kubernetes/pkg/watch",
	)

	return
}
开发者ID:RomainVabre,项目名称:origin,代码行数:25,代码来源:generator_fake_for_clientset.go

示例3: Imports

func (g *genClientset) Imports(c *generator.Context) (imports []string) {
	imports = append(imports, g.imports.ImportLines()...)
	for _, gv := range g.groupVersions {
		group := normalization.Group(gv.Group)
		version := normalization.Version(gv.Version)
		typedClientPath := filepath.Join(g.typedClientPath, group, version)
		imports = append(imports, fmt.Sprintf("%s_%s \"%s\"", group, version, typedClientPath))
	}
	return
}
开发者ID:kolyshkin,项目名称:kubernetes,代码行数:10,代码来源:generator-for-clientset.go

示例4: Imports

func (g *genClientset) Imports(c *generator.Context) (imports []string) {
	imports = append(imports, g.imports.ImportLines()...)
	for _, gv := range g.groupVersions {
		group := normalization.Group(gv.Group)
		version := normalization.Version(gv.Version)
		typedClientPath := filepath.Join(g.typedClientPath, group, version)
		group = normalization.BeforeFirstDot(group)
		imports = append(imports, fmt.Sprintf("%s%s \"%s\"", version, group, typedClientPath))
		imports = append(imports, "github.com/golang/glog")
	}
	return
}
开发者ID:jeremyeder,项目名称:kubernetes,代码行数:12,代码来源:generator_for_clientset.go

示例5: GenerateType

func (g *genClientset) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
	// TODO: We actually don't need any type information to generate the clientset,
	// perhaps we can adapt the go2ild framework to this kind of usage.
	sw := generator.NewSnippetWriter(w, c, "$", "$")
	const pkgDiscovery = "k8s.io/kubernetes/pkg/client/typed/discovery"
	const pkgRESTClient = "k8s.io/kubernetes/pkg/client/restclient"

	type arg struct {
		Group       string
		PackageName string
	}

	allGroups := []arg{}
	for _, gv := range g.groupVersions {
		group := normalization.BeforeFirstDot(normalization.Group(gv.Group))
		version := normalization.Version(gv.Version)
		allGroups = append(allGroups, arg{namer.IC(group), version + group})
	}

	m := map[string]interface{}{
		"allGroups":                        allGroups,
		"Config":                           c.Universe.Type(types.Name{Package: pkgRESTClient, Name: "Config"}),
		"DefaultKubernetesUserAgent":       c.Universe.Function(types.Name{Package: pkgRESTClient, Name: "DefaultKubernetesUserAgent"}),
		"RESTClient":                       c.Universe.Type(types.Name{Package: pkgRESTClient, Name: "RESTClient"}),
		"DiscoveryInterface":               c.Universe.Type(types.Name{Package: pkgDiscovery, Name: "DiscoveryInterface"}),
		"DiscoveryClient":                  c.Universe.Type(types.Name{Package: pkgDiscovery, Name: "DiscoveryClient"}),
		"NewDiscoveryClientForConfig":      c.Universe.Function(types.Name{Package: pkgDiscovery, Name: "NewDiscoveryClientForConfig"}),
		"NewDiscoveryClientForConfigOrDie": c.Universe.Function(types.Name{Package: pkgDiscovery, Name: "NewDiscoveryClientForConfigOrDie"}),
		"NewDiscoveryClient":               c.Universe.Function(types.Name{Package: pkgDiscovery, Name: "NewDiscoveryClient"}),
	}
	sw.Do(clientsetInterfaceTemplate, m)
	sw.Do(clientsetTemplate, m)
	for _, g := range allGroups {
		sw.Do(clientsetInterfaceImplTemplate, g)
	}
	sw.Do(getDiscoveryTemplate, m)
	sw.Do(newClientsetForConfigTemplate, m)
	sw.Do(newClientsetForConfigOrDieTemplate, m)
	sw.Do(newClientsetForRESTClientTemplate, m)

	return sw.Error()
}
开发者ID:Xmagicer,项目名称:origin,代码行数:42,代码来源:generator_for_clientset.go


注:本文中的k8s/io/kubernetes/cmd/libs/go2idl/client-gen/generators/normalization.Version函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。