Generate ABAC conversions

parent 2b0a1f2b
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/abac
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
// +groupName=abac.authorization.kubernetes.io
package v1beta1 // import "k8s.io/kubernetes/pkg/apis/abac/v1beta1"
// +build !ignore_autogenerated
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
package v1beta1
import (
abac "k8s.io/kubernetes/pkg/apis/abac"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
)
func init() {
SchemeBuilder.Register(RegisterConversions)
}
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v1beta1_Policy_To_abac_Policy,
Convert_abac_Policy_To_v1beta1_Policy,
Convert_v1beta1_PolicySpec_To_abac_PolicySpec,
Convert_abac_PolicySpec_To_v1beta1_PolicySpec,
)
}
func autoConvert_v1beta1_Policy_To_abac_Policy(in *Policy, out *abac.Policy, s conversion.Scope) error {
if err := Convert_v1beta1_PolicySpec_To_abac_PolicySpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
func Convert_v1beta1_Policy_To_abac_Policy(in *Policy, out *abac.Policy, s conversion.Scope) error {
return autoConvert_v1beta1_Policy_To_abac_Policy(in, out, s)
}
func autoConvert_abac_Policy_To_v1beta1_Policy(in *abac.Policy, out *Policy, s conversion.Scope) error {
if err := Convert_abac_PolicySpec_To_v1beta1_PolicySpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
func Convert_abac_Policy_To_v1beta1_Policy(in *abac.Policy, out *Policy, s conversion.Scope) error {
return autoConvert_abac_Policy_To_v1beta1_Policy(in, out, s)
}
func autoConvert_v1beta1_PolicySpec_To_abac_PolicySpec(in *PolicySpec, out *abac.PolicySpec, s conversion.Scope) error {
out.User = in.User
out.Group = in.Group
out.Readonly = in.Readonly
out.APIGroup = in.APIGroup
out.Resource = in.Resource
out.Namespace = in.Namespace
out.NonResourcePath = in.NonResourcePath
return nil
}
func Convert_v1beta1_PolicySpec_To_abac_PolicySpec(in *PolicySpec, out *abac.PolicySpec, s conversion.Scope) error {
return autoConvert_v1beta1_PolicySpec_To_abac_PolicySpec(in, out, s)
}
func autoConvert_abac_PolicySpec_To_v1beta1_PolicySpec(in *abac.PolicySpec, out *PolicySpec, s conversion.Scope) error {
out.User = in.User
out.Group = in.Group
out.Readonly = in.Readonly
out.APIGroup = in.APIGroup
out.Resource = in.Resource
out.Namespace = in.Namespace
out.NonResourcePath = in.NonResourcePath
return nil
}
func Convert_abac_PolicySpec_To_v1beta1_PolicySpec(in *abac.PolicySpec, out *PolicySpec, s conversion.Scope) error {
return autoConvert_abac_PolicySpec_To_v1beta1_PolicySpec(in, out, s)
}
// +build !ignore_autogenerated
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package v1beta1
import (
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
reflect "reflect"
)
func init() {
SchemeBuilder.Register(RegisterDeepCopies)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_Policy, InType: reflect.TypeOf(&Policy{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_PolicySpec, InType: reflect.TypeOf(&PolicySpec{})},
)
}
func DeepCopy_v1beta1_Policy(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Policy)
out := out.(*Policy)
out.TypeMeta = in.TypeMeta
out.Spec = in.Spec
return nil
}
}
func DeepCopy_v1beta1_PolicySpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*PolicySpec)
out := out.(*PolicySpec)
out.User = in.User
out.Group = in.Group
out.Readonly = in.Readonly
out.APIGroup = in.APIGroup
out.Resource = in.Resource
out.Namespace = in.Namespace
out.NonResourcePath = in.NonResourcePath
return nil
}
}
......@@ -11406,6 +11406,83 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
Dependencies: []string{
"v1beta1.FSGroupStrategyOptions", "v1beta1.HostPortRange", "v1beta1.RunAsUserStrategyOptions", "v1beta1.SELinuxStrategyOptions", "v1beta1.SupplementalGroupsStrategyOptions"},
},
"v1beta1.Policy": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Policy contains a single ABAC policy rule",
Properties: map[string]spec.Schema{
"spec": {
SchemaProps: spec.SchemaProps{
Description: "Spec describes the policy rule",
Ref: spec.MustCreateRef("#/definitions/v1beta1.PolicySpec"),
},
},
},
Required: []string{"spec"},
},
},
Dependencies: []string{
"v1beta1.PolicySpec"},
},
"v1beta1.PolicySpec": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "PolicySpec contains the attributes for a policy rule",
Properties: map[string]spec.Schema{
"user": {
SchemaProps: spec.SchemaProps{
Description: "User is the username this rule applies to. Either user or group is required to match the request. \"*\" matches all users.",
Type: []string{"string"},
Format: "",
},
},
"group": {
SchemaProps: spec.SchemaProps{
Description: "Group is the group this rule applies to. Either user or group is required to match the request. \"*\" matches all groups.",
Type: []string{"string"},
Format: "",
},
},
"readonly": {
SchemaProps: spec.SchemaProps{
Description: "Readonly matches readonly requests when true, and all requests when false",
Type: []string{"boolean"},
Format: "",
},
},
"apiGroup": {
SchemaProps: spec.SchemaProps{
Description: "APIGroup is the name of an API group. APIGroup, Resource, and Namespace are required to match resource requests. \"*\" matches all API groups",
Type: []string{"string"},
Format: "",
},
},
"resource": {
SchemaProps: spec.SchemaProps{
Description: "Resource is the name of a resource. APIGroup, Resource, and Namespace are required to match resource requests. \"*\" matches all resources",
Type: []string{"string"},
Format: "",
},
},
"namespace": {
SchemaProps: spec.SchemaProps{
Description: "Namespace is the name of a namespace. APIGroup, Resource, and Namespace are required to match resource requests. \"*\" matches all namespaces (including unnamespaced requests)",
Type: []string{"string"},
Format: "",
},
},
"nonResourcePath": {
SchemaProps: spec.SchemaProps{
Description: "NonResourcePath matches non-resource request paths. \"*\" matches all paths \"/foo/*\" matches all subpaths of foo",
Type: []string{"string"},
Format: "",
},
},
},
},
},
Dependencies: []string{},
},
"v1beta1.ReplicaSet": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment