本文整理汇总了Golang中github.com/openshift/origin/pkg/authorization/api.ClusterPolicy类的典型用法代码示例。如果您正苦于以下问题:Golang ClusterPolicy类的具体用法?Golang ClusterPolicy怎么用?Golang ClusterPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClusterPolicy类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: autoConvert_v1_ClusterPolicy_To_api_ClusterPolicy
func autoConvert_v1_ClusterPolicy_To_api_ClusterPolicy(in *ClusterPolicy, out *api.ClusterPolicy, s conversion.Scope) error {
if err := api_v1.Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil {
return err
}
out.LastModified = in.LastModified
if err := Convert_v1_NamedClusterRoles_To_api_ClusterRolesByName(&in.Roles, &out.Roles, s); err != nil {
return err
}
return nil
}
示例2: addClusterPolicy
func addClusterPolicy(policies map[string]map[string]authorizationapi.ClusterPolicy, policy authorizationapi.ClusterPolicy) {
resourceVersion += 1
policy.ResourceVersion = fmt.Sprintf("%d", resourceVersion)
namespacedClusterPolicies, ok := policies[policy.Namespace]
if !ok {
namespacedClusterPolicies = make(map[string]authorizationapi.ClusterPolicy)
policies[policy.Namespace] = namespacedClusterPolicies
}
namespacedClusterPolicies[policy.Name] = policy
}
示例3: convert_v1_ClusterPolicy_To_api_ClusterPolicy
// and now the globals
func convert_v1_ClusterPolicy_To_api_ClusterPolicy(in *ClusterPolicy, out *newer.ClusterPolicy, s conversion.Scope) error {
out.LastModified = in.LastModified
out.Roles = make(map[string]*newer.ClusterRole)
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields)
}