sigs.k8s.io/cluster-api-provider-aws@v1.5.5/api/v1alpha3/awsidentity_conversion.go (about)

     1  /*
     2  Copyright 2021 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8  	http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1alpha3
    18  
    19  import (
    20  	apiconversion "k8s.io/apimachinery/pkg/conversion"
    21  	infrav1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
    22  	"sigs.k8s.io/controller-runtime/pkg/conversion"
    23  )
    24  
    25  // ConvertTo converts the v1alpha3 AWSClusterStaticIdentity receiver to a v1beta1 AWSClusterStaticIdentity.
    26  func (r *AWSClusterStaticIdentity) ConvertTo(dstRaw conversion.Hub) error {
    27  	dst := dstRaw.(*infrav1.AWSClusterStaticIdentity)
    28  	if err := Convert_v1alpha3_AWSClusterStaticIdentity_To_v1beta1_AWSClusterStaticIdentity(r, dst, nil); err != nil {
    29  		return err
    30  	}
    31  
    32  	dst.Spec.SecretRef = r.Spec.SecretRef.Name
    33  	return nil
    34  }
    35  
    36  // ConvertFrom converts the v1beta1 AWSClusterStaticIdentity receiver to a v1alpha3 AWSClusterStaticIdentity.
    37  func (r *AWSClusterStaticIdentity) ConvertFrom(srcRaw conversion.Hub) error {
    38  	src := srcRaw.(*infrav1.AWSClusterStaticIdentity)
    39  
    40  	if err := Convert_v1beta1_AWSClusterStaticIdentity_To_v1alpha3_AWSClusterStaticIdentity(src, r, nil); err != nil {
    41  		return err
    42  	}
    43  
    44  	r.Spec.SecretRef.Name = src.Spec.SecretRef
    45  	return nil
    46  }
    47  
    48  // ConvertTo converts the v1alpha3 AWSClusterStaticIdentityList receiver to a v1beta1 AWSClusterStaticIdentityList.
    49  func (r *AWSClusterStaticIdentityList) ConvertTo(dstRaw conversion.Hub) error {
    50  	dst := dstRaw.(*infrav1.AWSClusterStaticIdentityList)
    51  
    52  	return Convert_v1alpha3_AWSClusterStaticIdentityList_To_v1beta1_AWSClusterStaticIdentityList(r, dst, nil)
    53  }
    54  
    55  // ConvertFrom converts the v1beta1 AWSClusterStaticIdentityList receiver to a v1alpha3 AWSClusterStaticIdentityList.
    56  func (r *AWSClusterStaticIdentityList) ConvertFrom(srcRaw conversion.Hub) error {
    57  	src := srcRaw.(*infrav1.AWSClusterStaticIdentityList)
    58  
    59  	return Convert_v1beta1_AWSClusterStaticIdentityList_To_v1alpha3_AWSClusterStaticIdentityList(src, r, nil)
    60  }
    61  
    62  // ConvertTo converts the v1alpha3 AWSClusterRoleIdentity receiver to a v1beta1 AWSClusterRoleIdentity.
    63  func (r *AWSClusterRoleIdentity) ConvertTo(dstRaw conversion.Hub) error {
    64  	dst := dstRaw.(*infrav1.AWSClusterRoleIdentity)
    65  
    66  	return Convert_v1alpha3_AWSClusterRoleIdentity_To_v1beta1_AWSClusterRoleIdentity(r, dst, nil)
    67  }
    68  
    69  // ConvertFrom converts the v1beta1 AWSClusterRoleIdentity receiver to a v1alpha3 AWSClusterRoleIdentity.
    70  func (r *AWSClusterRoleIdentity) ConvertFrom(srcRaw conversion.Hub) error {
    71  	src := srcRaw.(*infrav1.AWSClusterRoleIdentity)
    72  
    73  	return Convert_v1beta1_AWSClusterRoleIdentity_To_v1alpha3_AWSClusterRoleIdentity(src, r, nil)
    74  }
    75  
    76  // ConvertTo converts the v1alpha3 AWSClusterRoleIdentityList receiver to a v1beta1 AWSClusterRoleIdentityList.
    77  func (r *AWSClusterRoleIdentityList) ConvertTo(dstRaw conversion.Hub) error {
    78  	dst := dstRaw.(*infrav1.AWSClusterRoleIdentityList)
    79  
    80  	return Convert_v1alpha3_AWSClusterRoleIdentityList_To_v1beta1_AWSClusterRoleIdentityList(r, dst, nil)
    81  }
    82  
    83  // ConvertFrom converts the v1beta1 AWSClusterRoleIdentityList receiver to a v1alpha3 AWSClusterRoleIdentityList.
    84  func (r *AWSClusterRoleIdentityList) ConvertFrom(srcRaw conversion.Hub) error {
    85  	src := srcRaw.(*infrav1.AWSClusterRoleIdentityList)
    86  
    87  	return Convert_v1beta1_AWSClusterRoleIdentityList_To_v1alpha3_AWSClusterRoleIdentityList(src, r, nil)
    88  }
    89  
    90  // ConvertTo converts the v1alpha3 AWSClusterControllerIdentity receiver to a v1beta1 AWSClusterControllerIdentity.
    91  func (r *AWSClusterControllerIdentity) ConvertTo(dstRaw conversion.Hub) error {
    92  	dst := dstRaw.(*infrav1.AWSClusterControllerIdentity)
    93  
    94  	return Convert_v1alpha3_AWSClusterControllerIdentity_To_v1beta1_AWSClusterControllerIdentity(r, dst, nil)
    95  }
    96  
    97  // ConvertFrom converts the v1beta1 AWSClusterControllerIdentity receiver to a v1alpha3 AWSClusterControllerIdentity.
    98  func (r *AWSClusterControllerIdentity) ConvertFrom(srcRaw conversion.Hub) error {
    99  	src := srcRaw.(*infrav1.AWSClusterControllerIdentity)
   100  
   101  	return Convert_v1beta1_AWSClusterControllerIdentity_To_v1alpha3_AWSClusterControllerIdentity(src, r, nil)
   102  }
   103  
   104  // ConvertTo converts the v1alpha3 AWSClusterControllerIdentityList receiver to a v1beta1 AWSClusterControllerIdentityList.
   105  func (r *AWSClusterControllerIdentityList) ConvertTo(dstRaw conversion.Hub) error {
   106  	dst := dstRaw.(*infrav1.AWSClusterControllerIdentityList)
   107  
   108  	return Convert_v1alpha3_AWSClusterControllerIdentityList_To_v1beta1_AWSClusterControllerIdentityList(r, dst, nil)
   109  }
   110  
   111  // ConvertFrom converts the v1beta1 AWSClusterControllerIdentityList receiver to a v1alpha3 AWSClusterControllerIdentityList.
   112  func (r *AWSClusterControllerIdentityList) ConvertFrom(srcRaw conversion.Hub) error {
   113  	src := srcRaw.(*infrav1.AWSClusterControllerIdentityList)
   114  
   115  	return Convert_v1beta1_AWSClusterControllerIdentityList_To_v1alpha3_AWSClusterControllerIdentityList(src, r, nil)
   116  }
   117  
   118  // Convert_v1alpha3_AWSClusterStaticIdentitySpec_To_v1beta1_AWSClusterStaticIdentitySpec .
   119  func Convert_v1alpha3_AWSClusterStaticIdentitySpec_To_v1beta1_AWSClusterStaticIdentitySpec(in *AWSClusterStaticIdentitySpec, out *infrav1.AWSClusterStaticIdentitySpec, s apiconversion.Scope) error {
   120  	return autoConvert_v1alpha3_AWSClusterStaticIdentitySpec_To_v1beta1_AWSClusterStaticIdentitySpec(in, out, s)
   121  }
   122  
   123  // Convert_v1beta1_AWSClusterStaticIdentitySpec_To_v1alpha3_AWSClusterStaticIdentitySpec .
   124  func Convert_v1beta1_AWSClusterStaticIdentitySpec_To_v1alpha3_AWSClusterStaticIdentitySpec(in *infrav1.AWSClusterStaticIdentitySpec, out *AWSClusterStaticIdentitySpec, s apiconversion.Scope) error {
   125  	return autoConvert_v1beta1_AWSClusterStaticIdentitySpec_To_v1alpha3_AWSClusterStaticIdentitySpec(in, out, s)
   126  }