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


Golang Cloner.DeepCopy方法代碼示例

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


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

示例1: DeepCopy_api_ResourceAccessReviewResponse

func DeepCopy_api_ResourceAccessReviewResponse(in ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, c *conversion.Cloner) error {
	if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
		return err
	}
	out.Namespace = in.Namespace
	if in.Users != nil {
		in, out := in.Users, &out.Users
		*out = make(sets.String)
		for key, val := range in {
			if newVal, err := c.DeepCopy(val); err != nil {
				return err
			} else {
				(*out)[key] = newVal.(sets.Empty)
			}
		}
	} else {
		out.Users = nil
	}
	if in.Groups != nil {
		in, out := in.Groups, &out.Groups
		*out = make(sets.String)
		for key, val := range in {
			if newVal, err := c.DeepCopy(val); err != nil {
				return err
			} else {
				(*out)[key] = newVal.(sets.Empty)
			}
		}
	} else {
		out.Groups = nil
	}
	out.EvaluationError = in.EvaluationError
	return nil
}
開發者ID:Xmagicer,項目名稱:origin,代碼行數:34,代碼來源:deep_copy_generated.go

示例2: DeepCopy_v1beta1_UserInfo

func DeepCopy_v1beta1_UserInfo(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*UserInfo)
		out := out.(*UserInfo)
		out.Username = in.Username
		out.UID = in.UID
		if in.Groups != nil {
			in, out := &in.Groups, &out.Groups
			*out = make([]string, len(*in))
			copy(*out, *in)
		} else {
			out.Groups = nil
		}
		if in.Extra != nil {
			in, out := &in.Extra, &out.Extra
			*out = make(map[string]ExtraValue)
			for key, val := range *in {
				if newVal, err := c.DeepCopy(&val); err != nil {
					return err
				} else {
					(*out)[key] = *newVal.(*ExtraValue)
				}
			}
		} else {
			out.Extra = nil
		}
		return nil
	}
}
開發者ID:stensonb,項目名稱:kubernetes,代碼行數:29,代碼來源:zz_generated.deepcopy.go

示例3: DeepCopy_api_Policy

func DeepCopy_api_Policy(in Policy, out *Policy, c *conversion.Cloner) error {
	if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
		return err
	}
	if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
		return err
	}
	if err := unversioned.DeepCopy_unversioned_Time(in.LastModified, &out.LastModified, c); err != nil {
		return err
	}
	if in.Roles != nil {
		in, out := in.Roles, &out.Roles
		*out = make(map[string]*Role)
		for key, val := range in {
			if newVal, err := c.DeepCopy(val); err != nil {
				return err
			} else {
				(*out)[key] = newVal.(*Role)
			}
		}
	} else {
		out.Roles = nil
	}
	return nil
}
開發者ID:ZenoRewn,項目名稱:origin,代碼行數:25,代碼來源:deep_copy_generated.go

示例4: DeepCopy_api_SubjectAccessReview

func DeepCopy_api_SubjectAccessReview(in SubjectAccessReview, out *SubjectAccessReview, c *conversion.Cloner) error {
	if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
		return err
	}
	if err := DeepCopy_api_Action(in.Action, &out.Action, c); err != nil {
		return err
	}
	out.User = in.User
	if in.Groups != nil {
		in, out := in.Groups, &out.Groups
		*out = make(sets.String)
		for key, val := range in {
			if newVal, err := c.DeepCopy(val); err != nil {
				return err
			} else {
				(*out)[key] = newVal.(sets.Empty)
			}
		}
	} else {
		out.Groups = nil
	}
	if in.Scopes != nil {
		in, out := in.Scopes, &out.Scopes
		*out = make([]string, len(in))
		copy(*out, in)
	} else {
		out.Scopes = nil
	}
	return nil
}
開發者ID:Xmagicer,項目名稱:origin,代碼行數:30,代碼來源:deep_copy_generated.go

示例5: DeepCopy_api_ClusterPolicyBinding

func DeepCopy_api_ClusterPolicyBinding(in ClusterPolicyBinding, out *ClusterPolicyBinding, c *conversion.Cloner) error {
	if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
		return err
	}
	if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
		return err
	}
	if err := unversioned.DeepCopy_unversioned_Time(in.LastModified, &out.LastModified, c); err != nil {
		return err
	}
	if err := api.DeepCopy_api_ObjectReference(in.PolicyRef, &out.PolicyRef, c); err != nil {
		return err
	}
	if in.RoleBindings != nil {
		in, out := in.RoleBindings, &out.RoleBindings
		*out = make(map[string]*ClusterRoleBinding)
		for key, val := range in {
			if newVal, err := c.DeepCopy(val); err != nil {
				return err
			} else {
				(*out)[key] = newVal.(*ClusterRoleBinding)
			}
		}
	} else {
		out.RoleBindings = nil
	}
	return nil
}
開發者ID:ZenoRewn,項目名稱:origin,代碼行數:28,代碼來源:deep_copy_generated.go

示例6: DeepCopy_v1beta1_UserInfo

func DeepCopy_v1beta1_UserInfo(in UserInfo, out *UserInfo, c *conversion.Cloner) error {
	out.Username = in.Username
	out.UID = in.UID
	if in.Groups != nil {
		in, out := in.Groups, &out.Groups
		*out = make([]string, len(in))
		copy(*out, in)
	} else {
		out.Groups = nil
	}
	if in.Extra != nil {
		in, out := in.Extra, &out.Extra
		*out = make(map[string][]string)
		for key, val := range in {
			if newVal, err := c.DeepCopy(val); err != nil {
				return err
			} else {
				(*out)[key] = newVal.([]string)
			}
		}
	} else {
		out.Extra = nil
	}
	return nil
}
開發者ID:apcera,項目名稱:kubernetes,代碼行數:25,代碼來源:deep_copy_generated.go

示例7: DeepCopy_api_ResourceQuotasStatusByNamespace

func DeepCopy_api_ResourceQuotasStatusByNamespace(in ResourceQuotasStatusByNamespace, out *ResourceQuotasStatusByNamespace, c *conversion.Cloner) error {
	if newVal, err := c.DeepCopy(in.orderedMap); err != nil {
		return err
	} else {
		out.orderedMap = newVal.(orderedMap)
	}
	return nil
}
開發者ID:Xmagicer,項目名稱:origin,代碼行數:8,代碼來源:deep_copy_generated.go

示例8: deepCopy_unversioned_Time

func deepCopy_unversioned_Time(in unversioned.Time, out *unversioned.Time, c *conversion.Cloner) error {
	if newVal, err := c.DeepCopy(in.Time); err != nil {
		return err
	} else {
		out.Time = newVal.(time.Time)
	}
	return nil
}
開發者ID:alena1108,項目名稱:kubernetes,代碼行數:8,代碼來源:deep_copy_generated.go

示例9: DeepCopy_runtime_SerializerInfo

func DeepCopy_runtime_SerializerInfo(in SerializerInfo, out *SerializerInfo, c *conversion.Cloner) error {
	if in.Serializer == nil {
		out.Serializer = nil
	} else if newVal, err := c.DeepCopy(in.Serializer); err != nil {
		return err
	} else {
		out.Serializer = newVal.(Serializer)
	}
	out.EncodesAsText = in.EncodesAsText
	out.MediaType = in.MediaType
	return nil
}
開發者ID:40a,項目名稱:bootkube,代碼行數:12,代碼來源:deep_copy_generated.go

示例10: DeepCopy_unversioned_Time

func DeepCopy_unversioned_Time(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*Time)
		out := out.(*Time)
		if newVal, err := c.DeepCopy(&in.Time); err != nil {
			return err
		} else {
			out.Time = *newVal.(*time.Time)
		}
		return nil
	}
}
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:12,代碼來源:zz_generated.deepcopy.go

示例11: DeepCopy_api_ResourceQuotasStatusByNamespace

func DeepCopy_api_ResourceQuotasStatusByNamespace(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*ResourceQuotasStatusByNamespace)
		out := out.(*ResourceQuotasStatusByNamespace)
		if newVal, err := c.DeepCopy(&in.orderedMap); err != nil {
			return err
		} else {
			out.orderedMap = *newVal.(*orderedMap)
		}
		return nil
	}
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:12,代碼來源:zz_generated.deepcopy.go

示例12: DeepCopy_v1_Image

func DeepCopy_v1_Image(in interface{}, out interface{}, c *conversion.Cloner) error {
	{
		in := in.(*Image)
		out := out.(*Image)
		out.TypeMeta = in.TypeMeta
		if err := api_v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
			return err
		}
		out.DockerImageReference = in.DockerImageReference
		if err := runtime.DeepCopy_runtime_RawExtension(&in.DockerImageMetadata, &out.DockerImageMetadata, c); err != nil {
			return err
		}
		out.DockerImageMetadataVersion = in.DockerImageMetadataVersion
		out.DockerImageManifest = in.DockerImageManifest
		if in.DockerImageLayers != nil {
			in, out := &in.DockerImageLayers, &out.DockerImageLayers
			*out = make([]ImageLayer, len(*in))
			for i := range *in {
				(*out)[i] = (*in)[i]
			}
		} else {
			out.DockerImageLayers = nil
		}
		if in.Signatures != nil {
			in, out := &in.Signatures, &out.Signatures
			*out = make([]ImageSignature, len(*in))
			for i := range *in {
				if err := DeepCopy_v1_ImageSignature(&(*in)[i], &(*out)[i], c); err != nil {
					return err
				}
			}
		} else {
			out.Signatures = nil
		}
		if in.DockerImageSignatures != nil {
			in, out := &in.DockerImageSignatures, &out.DockerImageSignatures
			*out = make([][]byte, len(*in))
			for i := range *in {
				if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
					return err
				} else {
					(*out)[i] = *newVal.(*[]byte)
				}
			}
		} else {
			out.DockerImageSignatures = nil
		}
		out.DockerImageManifestMediaType = in.DockerImageManifestMediaType
		out.DockerImageConfig = in.DockerImageConfig
		return nil
	}
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:52,代碼來源:zz_generated.deepcopy.go

示例13: DeepCopy_v1_Image

func DeepCopy_v1_Image(in Image, out *Image, c *conversion.Cloner) error {
	if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
		return err
	}
	if err := api_v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
		return err
	}
	out.DockerImageReference = in.DockerImageReference
	if err := runtime.DeepCopy_runtime_RawExtension(in.DockerImageMetadata, &out.DockerImageMetadata, c); err != nil {
		return err
	}
	out.DockerImageMetadataVersion = in.DockerImageMetadataVersion
	out.DockerImageManifest = in.DockerImageManifest
	if in.DockerImageLayers != nil {
		in, out := in.DockerImageLayers, &out.DockerImageLayers
		*out = make([]ImageLayer, len(in))
		for i := range in {
			if err := DeepCopy_v1_ImageLayer(in[i], &(*out)[i], c); err != nil {
				return err
			}
		}
	} else {
		out.DockerImageLayers = nil
	}
	if in.Signatures != nil {
		in, out := in.Signatures, &out.Signatures
		*out = make([]ImageSignature, len(in))
		for i := range in {
			if err := DeepCopy_v1_ImageSignature(in[i], &(*out)[i], c); err != nil {
				return err
			}
		}
	} else {
		out.Signatures = nil
	}
	if in.DockerImageSignatures != nil {
		in, out := in.DockerImageSignatures, &out.DockerImageSignatures
		*out = make([][]byte, len(in))
		for i := range in {
			if newVal, err := c.DeepCopy(in[i]); err != nil {
				return err
			} else {
				(*out)[i] = newVal.([]byte)
			}
		}
	} else {
		out.DockerImageSignatures = nil
	}
	out.DockerImageManifestMediaType = in.DockerImageManifestMediaType
	out.DockerImageConfig = in.DockerImageConfig
	return nil
}
開發者ID:ZenoRewn,項目名稱:origin,代碼行數:52,代碼來源:deep_copy_generated.go

示例14: deepCopy_resource_Quantity

func deepCopy_resource_Quantity(in resource.Quantity, out *resource.Quantity, c *conversion.Cloner) error {
	if in.Amount != nil {
		if newVal, err := c.DeepCopy(in.Amount); err != nil {
			return err
		} else {
			out.Amount = newVal.(*inf.Dec)
		}
	} else {
		out.Amount = nil
	}
	out.Format = in.Format
	return nil
}
開發者ID:xachca,項目名稱:kubernetes-1.2,代碼行數:13,代碼來源:deep_copy_generated.go

示例15: DeepCopy_resource_Quantity

func DeepCopy_resource_Quantity(in Quantity, out *Quantity, c *conversion.Cloner) error {
	if in.Amount != nil {
		in, out := in.Amount, &out.Amount
		*out = new(inf_v0.Dec)
		if newVal, err := c.DeepCopy(*in); err != nil {
			return err
		} else {
			**out = newVal.(inf_v0.Dec)
		}
	} else {
		out.Amount = nil
	}
	out.Format = in.Format
	return nil
}
開發者ID:caesarxuchao,項目名稱:heapster,代碼行數:15,代碼來源:deep_copy_generated.go


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