當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Scope.DefaultConvert方法代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/pkg/conversion.Scope.DefaultConvert方法的典型用法代碼示例。如果您正苦於以下問題:Golang Scope.DefaultConvert方法的具體用法?Golang Scope.DefaultConvert怎麽用?Golang Scope.DefaultConvert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在k8s/io/kubernetes/pkg/conversion.Scope的用法示例。


在下文中一共展示了Scope.DefaultConvert方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: convert_api_SourceRevision_To_v1beta3_SourceRevision

func convert_api_SourceRevision_To_v1beta3_SourceRevision(in *newer.SourceRevision, out *SourceRevision, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	out.Type = BuildSourceGit
	return nil
}
開發者ID:rrati,項目名稱:origin,代碼行數:7,代碼來源:conversion.go

示例2: Convert_v1beta1_VolumeSource_To_api_VolumeSource

// This will Convert the v1 representation of VolumeSource to our internal representation
// Used for keeping backwards compatibility for the Metadata field
func Convert_v1beta1_VolumeSource_To_api_VolumeSource(in *v1.VolumeSource, out *api.VolumeSource, s conversion.Scope) error {
	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
		defaulting.(func(*v1.VolumeSource))(in)
	}

	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	// if specified Metadata will stomp DownwardAPI
	if in.Metadata != nil {
		out.DownwardAPI = new(api.DownwardAPIVolumeSource)
		if err := Convert_v1_MetadataVolumeSource_To_api_DownwardAPIVolumeSource(in.Metadata, out.DownwardAPI, s); err != nil {
			return err
		}
	} else {
		if in.DownwardAPI != nil {
			out.DownwardAPI = new(api.DownwardAPIVolumeSource)
			if err := Convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil {
				return err
			}
		} else {
			out.DownwardAPI = nil
		}
	}
	return nil
}
開發者ID:richm,項目名稱:origin,代碼行數:29,代碼來源:conversion.go

示例3: Convert_api_VolumeSource_To_v1beta1_VolumeSource

// This will Convert our internal represantation of VolumeSource to its v1 representation
// Used for keeping backwards compatibility for the Metadata field
func Convert_api_VolumeSource_To_v1beta1_VolumeSource(in *api.VolumeSource, out *v1.VolumeSource, s conversion.Scope) error {
	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
		defaulting.(func(*api.VolumeSource))(in)
	}

	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	if in.DownwardAPI != nil {
		out.DownwardAPI = new(v1.DownwardAPIVolumeSource)
		if err := Convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil {
			return err
		}

		// also copy to Metadata
		out.Metadata = new(v1.MetadataVolumeSource)
		if err := Convert_api_DownwardAPIVolumeSource_To_v1_MetadataVolumeSource(in.DownwardAPI, out.Metadata, s); err != nil {
			return err
		}
	} else {
		out.DownwardAPI = nil
	}
	return nil
}
開發者ID:richm,項目名稱:origin,代碼行數:27,代碼來源:conversion.go

示例4: Convert_api_Template_To_v1beta3_Template

func Convert_api_Template_To_v1beta3_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
	}
	if err := s.Convert(&in.ObjectLabels, &out.Labels, 0); err != nil {
		return err
	}

	// if we have runtime.Unstructured objects from the Process call.  We need to encode those
	// objects using the unstructured codec BEFORE the REST layers gets its shot at encoding to avoid a layered
	// encode being done.
	for i := range in.Objects {
		if unstructured, ok := in.Objects[i].(*runtime.Unstructured); ok {
			bytes, err := runtime.Encode(runtime.UnstructuredJSONScheme, unstructured)
			if err != nil {
				return err
			}
			out.Objects[i] = runtime.RawExtension{Raw: bytes}
		}
	}
	return nil
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:25,代碼來源:conversion.go

示例5: convert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview

func convert_api_SubjectAccessReview_To_v1beta3_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:dctse,項目名稱:openshift-cucumber,代碼行數:9,代碼來源:conversion.go

示例6: 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, out.GroupNames = newer.StringSubjectsFor(in.Namespace, in.Subjects)

	return nil
}
開發者ID:ncantor,項目名稱:origin,代碼行數:9,代碼來源:conversion.go

示例7: convert_api_Template_To_v1beta3_Template

func convert_api_Template_To_v1beta3_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:johnmccawley,項目名稱:origin,代碼行數:9,代碼來源:conversion.go

示例8: convert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview

func convert_v1beta3_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:dctse,項目名稱:openshift-cucumber,代碼行數:9,代碼來源:conversion.go

示例9: 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:ncantor,項目名稱:origin,代碼行數:10,代碼來源:conversion.go

示例10: 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:mkscala,項目名稱:origin,代碼行數:10,代碼來源:conversion.go

示例11: 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:mkscala,項目名稱:origin,代碼行數:10,代碼來源:conversion.go

示例12: convert_v1beta3_BuildOutput_To_api_BuildOutput

func convert_v1beta3_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:rrati,項目名稱:origin,代碼行數:10,代碼來源:conversion.go

示例13: 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 = sets.NewString(in.UsersSlice...)
	out.Groups = sets.NewString(in.GroupsSlice...)

	return nil
}
開發者ID:ncantor,項目名稱:origin,代碼行數:10,代碼來源:conversion.go

示例14: convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview

func convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview(in *newer.LocalResourceAccessReview, out *LocalResourceAccessReview, s conversion.Scope) error {
	if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
		return err
	}
	if err := s.DefaultConvert(&in.Action, &out.AuthorizationAttributes, conversion.IgnoreMissingFields); err != nil {
		return err
	}

	return nil
}
開發者ID:ncantor,項目名稱:origin,代碼行數:10,代碼來源:conversion.go

示例15: convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy

func convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, 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:rrati,項目名稱:origin,代碼行數:11,代碼來源:conversion.go


注:本文中的k8s/io/kubernetes/pkg/conversion.Scope.DefaultConvert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。