mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
generated: alternative unsafe conversions
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
authorization "k8s.io/kubernetes/pkg/apis/authorization"
|
||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
||||
runtime "k8s.io/kubernetes/pkg/runtime"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -176,24 +177,8 @@ func Convert_authorization_SelfSubjectAccessReview_To_v1beta1_SelfSubjectAccessR
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SelfSubjectAccessReviewSpec_To_authorization_SelfSubjectAccessReviewSpec(in *SelfSubjectAccessReviewSpec, out *authorization.SelfSubjectAccessReviewSpec, s conversion.Scope) error {
|
||||
if in.ResourceAttributes != nil {
|
||||
in, out := &in.ResourceAttributes, &out.ResourceAttributes
|
||||
*out = new(authorization.ResourceAttributes)
|
||||
if err := Convert_v1beta1_ResourceAttributes_To_authorization_ResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ResourceAttributes = nil
|
||||
}
|
||||
if in.NonResourceAttributes != nil {
|
||||
in, out := &in.NonResourceAttributes, &out.NonResourceAttributes
|
||||
*out = new(authorization.NonResourceAttributes)
|
||||
if err := Convert_v1beta1_NonResourceAttributes_To_authorization_NonResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NonResourceAttributes = nil
|
||||
}
|
||||
out.ResourceAttributes = (*authorization.ResourceAttributes)(unsafe.Pointer(in.ResourceAttributes))
|
||||
out.NonResourceAttributes = (*authorization.NonResourceAttributes)(unsafe.Pointer(in.NonResourceAttributes))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -202,24 +187,8 @@ func Convert_v1beta1_SelfSubjectAccessReviewSpec_To_authorization_SelfSubjectAcc
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SelfSubjectAccessReviewSpec_To_v1beta1_SelfSubjectAccessReviewSpec(in *authorization.SelfSubjectAccessReviewSpec, out *SelfSubjectAccessReviewSpec, s conversion.Scope) error {
|
||||
if in.ResourceAttributes != nil {
|
||||
in, out := &in.ResourceAttributes, &out.ResourceAttributes
|
||||
*out = new(ResourceAttributes)
|
||||
if err := Convert_authorization_ResourceAttributes_To_v1beta1_ResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ResourceAttributes = nil
|
||||
}
|
||||
if in.NonResourceAttributes != nil {
|
||||
in, out := &in.NonResourceAttributes, &out.NonResourceAttributes
|
||||
*out = new(NonResourceAttributes)
|
||||
if err := Convert_authorization_NonResourceAttributes_To_v1beta1_NonResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NonResourceAttributes = nil
|
||||
}
|
||||
out.ResourceAttributes = (*ResourceAttributes)(unsafe.Pointer(in.ResourceAttributes))
|
||||
out.NonResourceAttributes = (*NonResourceAttributes)(unsafe.Pointer(in.NonResourceAttributes))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -264,40 +233,11 @@ func Convert_authorization_SubjectAccessReview_To_v1beta1_SubjectAccessReview(in
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SubjectAccessReviewSpec_To_authorization_SubjectAccessReviewSpec(in *SubjectAccessReviewSpec, out *authorization.SubjectAccessReviewSpec, s conversion.Scope) error {
|
||||
if in.ResourceAttributes != nil {
|
||||
in, out := &in.ResourceAttributes, &out.ResourceAttributes
|
||||
*out = new(authorization.ResourceAttributes)
|
||||
if err := Convert_v1beta1_ResourceAttributes_To_authorization_ResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ResourceAttributes = nil
|
||||
}
|
||||
if in.NonResourceAttributes != nil {
|
||||
in, out := &in.NonResourceAttributes, &out.NonResourceAttributes
|
||||
*out = new(authorization.NonResourceAttributes)
|
||||
if err := Convert_v1beta1_NonResourceAttributes_To_authorization_NonResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NonResourceAttributes = nil
|
||||
}
|
||||
out.ResourceAttributes = (*authorization.ResourceAttributes)(unsafe.Pointer(in.ResourceAttributes))
|
||||
out.NonResourceAttributes = (*authorization.NonResourceAttributes)(unsafe.Pointer(in.NonResourceAttributes))
|
||||
out.User = in.User
|
||||
out.Groups = in.Groups
|
||||
if in.Extra != nil {
|
||||
in, out := &in.Extra, &out.Extra
|
||||
*out = make(map[string]authorization.ExtraValue, len(*in))
|
||||
for key, val := range *in {
|
||||
newVal := new(authorization.ExtraValue)
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&val, newVal, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
(*out)[key] = *newVal
|
||||
}
|
||||
} else {
|
||||
out.Extra = nil
|
||||
}
|
||||
out.Groups = *(*[]string)(unsafe.Pointer(&in.Groups))
|
||||
out.Extra = *(*map[string]authorization.ExtraValue)(unsafe.Pointer(&in.Extra))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -306,40 +246,11 @@ func Convert_v1beta1_SubjectAccessReviewSpec_To_authorization_SubjectAccessRevie
|
||||
}
|
||||
|
||||
func autoConvert_authorization_SubjectAccessReviewSpec_To_v1beta1_SubjectAccessReviewSpec(in *authorization.SubjectAccessReviewSpec, out *SubjectAccessReviewSpec, s conversion.Scope) error {
|
||||
if in.ResourceAttributes != nil {
|
||||
in, out := &in.ResourceAttributes, &out.ResourceAttributes
|
||||
*out = new(ResourceAttributes)
|
||||
if err := Convert_authorization_ResourceAttributes_To_v1beta1_ResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ResourceAttributes = nil
|
||||
}
|
||||
if in.NonResourceAttributes != nil {
|
||||
in, out := &in.NonResourceAttributes, &out.NonResourceAttributes
|
||||
*out = new(NonResourceAttributes)
|
||||
if err := Convert_authorization_NonResourceAttributes_To_v1beta1_NonResourceAttributes(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.NonResourceAttributes = nil
|
||||
}
|
||||
out.ResourceAttributes = (*ResourceAttributes)(unsafe.Pointer(in.ResourceAttributes))
|
||||
out.NonResourceAttributes = (*NonResourceAttributes)(unsafe.Pointer(in.NonResourceAttributes))
|
||||
out.User = in.User
|
||||
out.Groups = in.Groups
|
||||
if in.Extra != nil {
|
||||
in, out := &in.Extra, &out.Extra
|
||||
*out = make(map[string]ExtraValue, len(*in))
|
||||
for key, val := range *in {
|
||||
newVal := new(ExtraValue)
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&val, newVal, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
(*out)[key] = *newVal
|
||||
}
|
||||
} else {
|
||||
out.Extra = nil
|
||||
}
|
||||
out.Groups = *(*[]string)(unsafe.Pointer(&in.Groups))
|
||||
out.Extra = *(*map[string]ExtraValue)(unsafe.Pointer(&in.Extra))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user