sigs.k8s.io/cluster-api@v1.7.1/internal/runtime/test/v1alpha2/fake_types.go (about)

     1  /*
     2  Copyright 2022 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 v1alpha2
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  
    22  	clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
    23  	runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog"
    24  	runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
    25  )
    26  
    27  // FakeRequest is a response for testing
    28  // +kubebuilder:object:root=true
    29  type FakeRequest struct {
    30  	metav1.TypeMeta `json:",inline"`
    31  
    32  	// CommonRequest contains Settings field common to all request types.
    33  	runtimehooksv1.CommonRequest `json:",inline"`
    34  
    35  	Cluster clusterv1.Cluster
    36  
    37  	Second string
    38  	First  int
    39  }
    40  
    41  var _ runtimehooksv1.ResponseObject = &FakeResponse{}
    42  
    43  // FakeResponse is a response for testing.
    44  // +kubebuilder:object:root=true
    45  type FakeResponse struct {
    46  	metav1.TypeMeta `json:",inline"`
    47  
    48  	runtimehooksv1.CommonResponse `json:",inline"`
    49  
    50  	Second string
    51  	First  int
    52  }
    53  
    54  func FakeHook(*FakeRequest, *FakeResponse) {}
    55  
    56  func init() {
    57  	catalogBuilder.RegisterHook(FakeHook, &runtimecatalog.HookMeta{
    58  		Tags:        []string{"fake-tag"},
    59  		Summary:     "FakeHook summary",
    60  		Description: "FakeHook description",
    61  		Deprecated:  true,
    62  	})
    63  }