本文整理匯總了Golang中github.com/openshift/origin/pkg/authorization/api.Policy類的典型用法代碼示例。如果您正苦於以下問題:Golang Policy類的具體用法?Golang Policy怎麽用?Golang Policy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Policy類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: autoConvert_v1_Policy_To_api_Policy
func autoConvert_v1_Policy_To_api_Policy(in *Policy, out *api.Policy, 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_NamedRoles_To_api_RolesByName(&in.Roles, &out.Roles, s); err != nil {
return err
}
return nil
}
示例2: addPolicy
func addPolicy(policies map[string]map[string]authorizationapi.Policy, policy authorizationapi.Policy) {
resourceVersion += 1
policy.ResourceVersion = fmt.Sprintf("%d", resourceVersion)
namespacedPolicies, ok := policies[policy.Namespace]
if !ok {
namespacedPolicies = make(map[string]authorizationapi.Policy)
policies[policy.Namespace] = namespacedPolicies
}
namespacedPolicies[policy.Name] = policy
}
示例3: convert_v1_Policy_To_api_Policy
func convert_v1_Policy_To_api_Policy(in *Policy, out *newer.Policy, s conversion.Scope) error {
out.LastModified = in.LastModified
out.Roles = make(map[string]*newer.Role)
return s.DefaultConvert(in, out, conversion.IgnoreMissingFields)
}