本文整理汇总了Golang中k8s/io/kubernetes/cmd/libs/go2idl/namer.Orderer.OrderTypes方法的典型用法代码示例。如果您正苦于以下问题:Golang Orderer.OrderTypes方法的具体用法?Golang Orderer.OrderTypes怎么用?Golang Orderer.OrderTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/cmd/libs/go2idl/namer.Orderer
的用法示例。
在下文中一共展示了Orderer.OrderTypes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Packages
// Packages makes the client package definition.
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
boilerplate, err := arguments.LoadGoBoilerplate()
if err != nil {
glog.Fatalf("Failed loading boilerplate: %v", err)
}
groupToTypes := map[string][]*types.Type{}
for _, inputDir := range arguments.InputDirs {
p := context.Universe.Package(inputDir)
for _, t := range p.Types {
if types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] != "true" {
continue
}
group := filepath.Base(t.Name.Package)
// Special case for the legacy API.
if group == "api" {
group = "legacy"
}
if _, found := groupToTypes[group]; !found {
groupToTypes[group] = []*types.Type{}
}
groupToTypes[group] = append(groupToTypes[group], t)
}
}
var packageList []generator.Package
orderer := namer.Orderer{namer.NewPrivateNamer(0)}
for group, types := range groupToTypes {
packageList = append(packageList, packageForGroup(group, "unversioned", orderer.OrderTypes(types), arguments.OutputPackagePath, boilerplate))
}
return generator.Packages(packageList)
}
示例2: Packages
// Packages makes the client package definition.
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
boilerplate, err := arguments.LoadGoBoilerplate()
if err != nil {
glog.Fatalf("Failed loading boilerplate: %v", err)
}
customArgs, ok := arguments.CustomArgs.(clientgenargs.Args)
if !ok {
glog.Fatalf("cannot convert arguments.CustomArgs to clientgenargs.Args")
}
if len(customArgs.CmdArgs) != 0 {
boilerplate = append(boilerplate, []byte(fmt.Sprintf("\n// This file is generated by client-gen with arguments: %s\n\n", customArgs.CmdArgs))...)
} else {
boilerplate = append(boilerplate, []byte(fmt.Sprintf("\n// This file is generated by client-gen with the default arguments.\n\n"))...)
}
gvToTypes := map[unversioned.GroupVersion][]*types.Type{}
for gv, inputDir := range customArgs.GroupVersionToInputPath {
p := context.Universe.Package(inputDir)
for _, t := range p.Types {
if types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] != "true" {
continue
}
if _, found := gvToTypes[gv]; !found {
gvToTypes[gv] = []*types.Type{}
}
gvToTypes[gv] = append(gvToTypes[gv], t)
}
}
var packageList []generator.Package
typedClientBasePath := filepath.Join(customArgs.ClientsetOutputPath, customArgs.ClientsetName, "typed")
packageList = append(packageList, packageForClientset(customArgs, typedClientBasePath, boilerplate))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForClientset(customArgs, typedClientBasePath, boilerplate))
}
// If --clientset-only=true, we don't regenerate the individual typed clients.
if customArgs.ClientsetOnly {
return generator.Packages(packageList)
}
orderer := namer.Orderer{namer.NewPrivateNamer(0)}
for _, gv := range customArgs.GroupVersions {
types := gvToTypes[gv]
packageList = append(packageList, packageForGroup(normalization.GroupVersion(gv), orderer.OrderTypes(types), typedClientBasePath, arguments.OutputBase, boilerplate))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForGroup(normalization.GroupVersion(gv), orderer.OrderTypes(types), typedClientBasePath, arguments.OutputBase, boilerplate))
}
}
return generator.Packages(packageList)
}
示例3: Packages
// Packages makes the client package definition.
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
boilerplate, err := arguments.LoadGoBoilerplate()
if err != nil {
glog.Fatalf("Failed loading boilerplate: %v", err)
}
groupToTypes := map[string][]*types.Type{}
for _, inputDir := range arguments.InputDirs {
p := context.Universe.Package(inputDir)
for _, t := range p.Types {
if types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] != "true" {
continue
}
group := filepath.Base(t.Name.Package)
// Special case for the core API.
if group == "api" {
group = "core"
}
if _, found := groupToTypes[group]; !found {
groupToTypes[group] = []*types.Type{}
}
groupToTypes[group] = append(groupToTypes[group], t)
}
}
customArgs, ok := arguments.CustomArgs.(ClientGenArgs)
if !ok {
glog.Fatalf("cannot convert arguments.CustomArgs to ClientGenArgs")
}
var packageList []generator.Package
packageList = append(packageList, packageForClientset(customArgs, arguments.OutputPackagePath, boilerplate))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForClientset(arguments.OutputPackagePath, customArgs.GroupVersions, boilerplate))
}
// If --clientset-only=true, we don't regenerate the individual typed clients.
if customArgs.ClientsetOnly {
return generator.Packages(packageList)
}
orderer := namer.Orderer{namer.NewPrivateNamer(0)}
for group, types := range groupToTypes {
packageList = append(packageList, packageForGroup(group, "unversioned", orderer.OrderTypes(types), arguments.OutputPackagePath, arguments.OutputBase, boilerplate))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForGroup(group, "unversioned", orderer.OrderTypes(types), arguments.OutputPackagePath, arguments.OutputBase, boilerplate))
}
}
return generator.Packages(packageList)
}
示例4: Packages
// Packages makes the client package definition.
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
boilerplate, err := arguments.LoadGoBoilerplate()
if err != nil {
glog.Fatalf("Failed loading boilerplate: %v", err)
}
customArgs, ok := arguments.CustomArgs.(ClientGenArgs)
if !ok {
glog.Fatalf("cannot convert arguments.CustomArgs to ClientGenArgs")
}
gvToTypes := map[unversioned.GroupVersion][]*types.Type{}
for gv, inputDir := range customArgs.GroupVersionToInputPath {
p := context.Universe.Package(inputDir)
for _, t := range p.Types {
if types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] != "true" {
continue
}
if _, found := gvToTypes[gv]; !found {
gvToTypes[gv] = []*types.Type{}
}
gvToTypes[gv] = append(gvToTypes[gv], t)
}
}
var packageList []generator.Package
packageList = append(packageList, packageForClientset(customArgs, arguments.OutputPackagePath, boilerplate))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForClientset(arguments.OutputPackagePath, customArgs.GroupVersions, boilerplate))
}
// If --clientset-only=true, we don't regenerate the individual typed clients.
if customArgs.ClientsetOnly {
return generator.Packages(packageList)
}
orderer := namer.Orderer{namer.NewPrivateNamer(0)}
for _, gv := range customArgs.GroupVersions {
types := gvToTypes[gv]
packageList = append(packageList, packageForGroup(normalization.GroupVersion(gv), orderer.OrderTypes(types), arguments.OutputPackagePath, arguments.OutputBase, boilerplate))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForGroup(normalization.GroupVersion(gv), orderer.OrderTypes(types), arguments.OutputPackagePath, arguments.OutputBase, boilerplate))
}
}
return generator.Packages(packageList)
}
示例5: Packages
// Packages makes the client package definition.
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
boilerplate, err := arguments.LoadGoBoilerplate()
if err != nil {
glog.Fatalf("Failed loading boilerplate: %v", err)
}
customArgs, ok := arguments.CustomArgs.(clientgenargs.Args)
if !ok {
glog.Fatalf("cannot convert arguments.CustomArgs to clientgenargs.Args")
}
includedTypesOverrides := customArgs.IncludedTypesOverrides
generatedBy := generatedBy(customArgs)
gvToTypes := map[unversioned.GroupVersion][]*types.Type{}
for gv, inputDir := range customArgs.GroupVersionToInputPath {
p := context.Universe.Package(inputDir)
for n, t := range p.Types {
// filter out types which are not included in user specified overrides.
typesOverride, ok := includedTypesOverrides[gv]
if ok {
found := false
for _, typeStr := range typesOverride {
if typeStr == n {
found = true
}
}
if !found {
continue
}
} else {
// User has not specified any override for this group version.
// filter out types which dont have genclient=true.
if types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] != "true" {
continue
}
}
if _, found := gvToTypes[gv]; !found {
gvToTypes[gv] = []*types.Type{}
}
gvToTypes[gv] = append(gvToTypes[gv], t)
}
}
var packageList []generator.Package
typedClientBasePath := filepath.Join(customArgs.ClientsetOutputPath, customArgs.ClientsetName, "typed")
packageList = append(packageList, packageForClientset(customArgs, typedClientBasePath, boilerplate, generatedBy))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForClientset(customArgs, typedClientBasePath, boilerplate, generatedBy))
}
// If --clientset-only=true, we don't regenerate the individual typed clients.
if customArgs.ClientsetOnly {
return generator.Packages(packageList)
}
orderer := namer.Orderer{Namer: namer.NewPrivateNamer(0)}
for _, gv := range customArgs.GroupVersions {
types := gvToTypes[gv]
inputPath := customArgs.GroupVersionToInputPath[gv]
packageList = append(packageList, packageForGroup(normalization.GroupVersion(gv), orderer.OrderTypes(types), typedClientBasePath, arguments.OutputBase, inputPath, boilerplate, generatedBy))
if customArgs.FakeClient {
packageList = append(packageList, fake.PackageForGroup(normalization.GroupVersion(gv), orderer.OrderTypes(types), typedClientBasePath, arguments.OutputBase, inputPath, boilerplate, generatedBy))
}
}
return generator.Packages(packageList)
}