本文整理汇总了Golang中github.com/openshift/origin/pkg/image/api.TagReference类的典型用法代码示例。如果您正苦于以下问题:Golang TagReference类的具体用法?Golang TagReference怎么用?Golang TagReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TagReference类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: autoConvert_v1_TagReference_To_api_TagReference
func autoConvert_v1_TagReference_To_api_TagReference(in *TagReference, out *image_api.TagReference, s conversion.Scope) error {
out.Name = in.Name
if in.Annotations != nil {
in, out := &in.Annotations, &out.Annotations
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
} else {
out.Annotations = nil
}
if in.From != nil {
in, out := &in.From, &out.From
*out = new(api.ObjectReference)
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(*in, *out, 0); err != nil {
return err
}
} else {
out.From = nil
}
out.Reference = in.Reference
if in.Generation != nil {
in, out := &in.Generation, &out.Generation
*out = new(int64)
**out = **in
} else {
out.Generation = nil
}
if err := Convert_v1_TagImportPolicy_To_api_TagImportPolicy(&in.ImportPolicy, &out.ImportPolicy, s); err != nil {
return err
}
return nil
}
开发者ID:rhamilto,项目名称:origin,代码行数:34,代码来源:conversion_generated.go
示例2: autoConvert_v1_TagReference_To_api_TagReference
func autoConvert_v1_TagReference_To_api_TagReference(in *TagReference, out *api.TagReference, s conversion.Scope) error {
out.Name = in.Name
out.Annotations = in.Annotations
if in.From != nil {
in, out := &in.From, &out.From
*out = new(pkg_api.ObjectReference)
if err := api_v1.Convert_v1_ObjectReference_To_api_ObjectReference(*in, *out, s); err != nil {
return err
}
} else {
out.From = nil
}
out.Reference = in.Reference
out.Generation = in.Generation
if err := Convert_v1_TagImportPolicy_To_api_TagImportPolicy(&in.ImportPolicy, &out.ImportPolicy, s); err != nil {
return err
}
return nil
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:19,代码来源:zz_generated.conversion.go
示例3: init
func init() {
err := kapi.Scheme.AddDefaultingFuncs(
func(obj *ImageImportSpec) {
if obj.To == nil {
if ref, err := newer.ParseDockerImageReference(obj.From.Name); err == nil {
if len(ref.Tag) > 0 {
obj.To = &v1.LocalObjectReference{Name: ref.Tag}
}
}
}
})
if err != nil {
// If one of the default functions is malformed, detect it immediately.
panic(err)
}
err = kapi.Scheme.AddConversionFuncs(
func(in *[]NamedTagEventList, out *map[string]newer.TagEventList, s conversion.Scope) error {
for _, curr := range *in {
newTagEventList := newer.TagEventList{}
if err := s.Convert(&curr.Conditions, &newTagEventList.Conditions, 0); err != nil {
return err
}
if err := s.Convert(&curr.Items, &newTagEventList.Items, 0); err != nil {
return err
}
(*out)[curr.Tag] = newTagEventList
}
return nil
},
func(in *map[string]newer.TagEventList, out *[]NamedTagEventList, s conversion.Scope) error {
allKeys := make([]string, 0, len(*in))
for key := range *in {
allKeys = append(allKeys, key)
}
sort.Strings(allKeys)
for _, key := range allKeys {
newTagEventList := (*in)[key]
oldTagEventList := &NamedTagEventList{Tag: key}
if err := s.Convert(&newTagEventList.Conditions, &oldTagEventList.Conditions, 0); err != nil {
return err
}
if err := s.Convert(&newTagEventList.Items, &oldTagEventList.Items, 0); err != nil {
return err
}
*out = append(*out, *oldTagEventList)
}
return nil
},
func(in *[]NamedTagReference, out *map[string]newer.TagReference, s conversion.Scope) error {
for _, curr := range *in {
r := newer.TagReference{
Annotations: curr.Annotations,
Reference: curr.Reference,
ImportPolicy: newer.TagImportPolicy{
Insecure: curr.ImportPolicy.Insecure,
},
}
if curr.Generation != nil {
gen := *curr.Generation
r.Generation = &gen
}
if err := s.Convert(&curr.From, &r.From, 0); err != nil {
return err
}
(*out)[curr.Name] = r
}
return nil
},
func(in *map[string]newer.TagReference, out *[]NamedTagReference, s conversion.Scope) error {
allTags := make([]string, 0, len(*in))
for tag := range *in {
allTags = append(allTags, tag)
}
sort.Strings(allTags)
for _, tag := range allTags {
newTagReference := (*in)[tag]
oldTagReference := NamedTagReference{
Name: tag,
Annotations: newTagReference.Annotations,
Reference: newTagReference.Reference,
ImportPolicy: TagImportPolicy{
Insecure: newTagReference.ImportPolicy.Insecure,
},
}
if newTagReference.Generation != nil {
gen := *newTagReference.Generation
oldTagReference.Generation = &gen
}
if err := s.Convert(&newTagReference.From, &oldTagReference.From, 0); err != nil {
return err
}
*out = append(*out, oldTagReference)
}
return nil
},
//.........这里部分代码省略.........
开发者ID:erinboyd,项目名称:origin,代码行数:101,代码来源:conversion.go
注:本文中的github.com/openshift/origin/pkg/image/api.TagReference类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论