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


Golang Scope.DefaultConvert方法代码示例

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


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

示例1: convert_v1_BuildOutput_To_api_BuildOutput

func convert_v1_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	if in.To != nil && in.To.Kind == "ImageStreamTag" {
		name, tag, ok := imageapi.SplitImageStreamTag(in.To.Name)
		if !ok {
			return fmt.Errorf("ImageStreamTag object references must be in the form <name>:<tag>: %s", in.To.Name)
		}
		out.To.Kind = "ImageStream"
		out.To.Name = name
		out.Tag = tag
		return nil
	}
	if in.To != nil && in.To.Kind == "DockerImage" {
		out.To = nil
		if ref, err := imageapi.ParseDockerImageReference(in.To.Name); err == nil {
			out.Tag = ref.Tag
			ref.Tag = ""
			out.DockerImageReference = ref.String()
		} else {
			out.DockerImageReference = in.To.Name
		}
	}
	return nil
}
开发者ID:pombredanne,项目名称:atomic-enterprise,代码行数:26,代码来源:conversion.go

示例2: convert_api_SubjectAccessReview_To_v1_SubjectAccessReview

func convert_api_SubjectAccessReview_To_v1_SubjectAccessReview(in *newer.SubjectAccessReview, out *SubjectAccessReview, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	out.GroupsSlice = in.Groups.List()

	return nil
}
开发者ID:cjnygard,项目名称:origin,代码行数:9,代码来源:conversion.go

示例3: convert_v1_SubjectAccessReview_To_api_SubjectAccessReview

func convert_v1_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccessReview, out *newer.SubjectAccessReview, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	out.Groups = util.NewStringSet(in.GroupsSlice...)

	return nil
}
开发者ID:cjnygard,项目名称:origin,代码行数:9,代码来源:conversion.go

示例4: convert_api_Template_To_v1_Template

func convert_api_Template_To_v1_Template(in *newer.Template, out *Template, s conversion.Scope) error {
	//FIXME: DefaultConvert should not overwrite the Labels field on the
	//       the base object. This is likely a bug in the DefaultConvert
	//       code. For now, it is called before converting the labels.
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	return s.Convert(&in.ObjectLabels, &out.Labels, 0)
}
开发者ID:cjnygard,项目名称:origin,代码行数:9,代码来源:conversion.go

示例5: convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse

func convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse(in *ResourceAccessReviewResponse, out *newer.ResourceAccessReviewResponse, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	out.Users = util.NewStringSet(in.UsersSlice...)
	out.Groups = util.NewStringSet(in.GroupsSlice...)

	return nil
}
开发者ID:cjnygard,项目名称:origin,代码行数:10,代码来源:conversion.go

示例6: convert_v1_BuildOutput_To_api_BuildOutput

func convert_v1_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	if in.To != nil && (in.To.Kind == "ImageStream" || len(in.To.Kind) == 0) {
		out.To.Kind = "ImageStreamTag"
		out.To.Name = imageapi.JoinImageStreamTag(in.To.Name, "")
	}
	return nil
}
开发者ID:jstrachan,项目名称:kubernetes-model,代码行数:10,代码来源:conversion.go

示例7: convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding

func convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *newer.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
		return err
	}

	out.UserNames = in.Users.List()
	out.GroupNames = in.Groups.List()

	return nil
}
开发者ID:cjnygard,项目名称:origin,代码行数:10,代码来源:conversion.go

示例8: convert_v1_RoleBinding_To_api_RoleBinding

func convert_v1_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer.RoleBinding, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil {
		return err
	}

	out.Users = util.NewStringSet(in.UserNames...)
	out.Groups = util.NewStringSet(in.GroupNames...)

	return nil
}
开发者ID:cjnygard,项目名称:origin,代码行数:10,代码来源:conversion.go

示例9: convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy

func convert_api_CustomBuildStrategy_To_v1_CustomBuildStrategy(in *newer.CustomBuildStrategy, out *CustomBuildStrategy, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	if in.From != nil && in.From.Kind == "ImageStream" {
		out.From.Kind = "ImageStreamTag"
		out.From.Name = imageapi.JoinImageStreamTag(in.From.Name, "")
	}
	return nil
}
开发者ID:pombredanne,项目名称:atomic-enterprise,代码行数:10,代码来源:conversion.go

示例10: convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse

func convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse(in *newer.ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	out.UsersSlice = in.Users.List()
	out.GroupsSlice = in.Groups.List()

	return nil
}
开发者ID:cjnygard,项目名称:origin,代码行数:10,代码来源:conversion.go

示例11: convert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy

func convert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy(in *SourceBuildStrategy, out *newer.SourceBuildStrategy, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	switch in.From.Kind {
	case "ImageStream":
		out.From.Kind = "ImageStreamTag"
		out.From.Name = imageapi.JoinImageStreamTag(in.From.Name, "")
	}
	return nil
}
开发者ID:jstrachan,项目名称:kubernetes-model,代码行数:11,代码来源:conversion.go

示例12: convert_api_Route_To_v1_Route

func convert_api_Route_To_v1_Route(in *newer.Route, out *Route, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	out.Spec.Path = in.Path
	out.Spec.Host = in.Host
	out.Spec.To.Kind = "Service"
	out.Spec.To.Name = in.ServiceName
	return s.Convert(&in.TLS, &out.Spec.TLS, 0)
}
开发者ID:cjnygard,项目名称:origin,代码行数:11,代码来源:conversion.go

示例13: convert_v1beta3_Route_To_api_Route

func convert_v1beta3_Route_To_api_Route(in *Route, out *newer.Route, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	out.Path = in.Spec.Path
	out.Host = in.Spec.Host
	if in.Spec.To.Kind == "Service" || len(in.Spec.To.Kind) == 0 {
		out.ServiceName = in.Spec.To.Name
	}
	return s.Convert(&in.Spec.TLS, &out.TLS, 0)
}
开发者ID:cjnygard,项目名称:origin,代码行数:12,代码来源:conversion.go

示例14: convert_v1_BuildConfig_To_api_BuildConfig

func convert_v1_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer.BuildConfig, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	if err := s.Convert(&in.Spec, &out.Parameters, 0); err != nil {
		return err
	}
	if err := s.Convert(&in.Spec.Triggers, &out.Triggers, 0); err != nil {
		return err
	}
	out.LastVersion = in.Status.LastVersion
	return nil
}
开发者ID:pombredanne,项目名称:atomic-enterprise,代码行数:13,代码来源:conversion.go

示例15: convert_v1_BuildTriggerPolicy_To_api_BuildTriggerPolicy

func convert_v1_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTriggerPolicy, out *newer.BuildTriggerPolicy, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.DestFromSource); err != nil {
		return err
	}
	switch in.Type {
	case ImageChangeBuildTriggerTypeDeprecated:
		out.Type = newer.ImageChangeBuildTriggerType
	case GenericWebHookBuildTriggerTypeDeprecated:
		out.Type = newer.GenericWebHookBuildTriggerType
	case GitHubWebHookBuildTriggerTypeDeprecated:
		out.Type = newer.GitHubWebHookBuildTriggerType
	}
	return nil
}
开发者ID:pombredanne,项目名称:atomic-enterprise,代码行数:14,代码来源:conversion.go


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