istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pilot/pkg/config/kube/crd/config.go (about)

     1  // Copyright Istio Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package crd
    16  
    17  import (
    18  	"encoding/json"
    19  
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  	"k8s.io/apimachinery/pkg/runtime"
    22  )
    23  
    24  // IstioKind is the generic Kubernetes API object wrapper
    25  type IstioKind struct {
    26  	metav1.TypeMeta
    27  	metav1.ObjectMeta `json:"metadata"`
    28  	Spec              json.RawMessage  `json:"spec"`
    29  	Status            *json.RawMessage `json:"status,omitempty"`
    30  }
    31  
    32  // GetSpec from a wrapper
    33  func (in *IstioKind) GetSpec() json.RawMessage {
    34  	return in.Spec
    35  }
    36  
    37  // GetStatus from a wrapper
    38  func (in *IstioKind) GetStatus() *json.RawMessage {
    39  	return in.Status
    40  }
    41  
    42  // GetObjectMeta from a wrapper
    43  func (in *IstioKind) GetObjectMeta() metav1.ObjectMeta {
    44  	return in.ObjectMeta
    45  }
    46  
    47  // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
    48  func (in *IstioKind) DeepCopyInto(out *IstioKind) {
    49  	*out = *in
    50  	out.TypeMeta = in.TypeMeta
    51  	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
    52  	out.Spec = in.Spec
    53  	out.Status = in.Status
    54  }
    55  
    56  // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IstioKind.
    57  func (in *IstioKind) DeepCopy() *IstioKind {
    58  	if in == nil {
    59  		return nil
    60  	}
    61  	out := new(IstioKind)
    62  	in.DeepCopyInto(out)
    63  	return out
    64  }
    65  
    66  // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
    67  func (in *IstioKind) DeepCopyObject() runtime.Object {
    68  	if c := in.DeepCopy(); c != nil {
    69  		return c
    70  	}
    71  
    72  	return nil
    73  }
    74  
    75  // IstioObject is a k8s wrapper interface for config objects
    76  type IstioObject interface {
    77  	runtime.Object
    78  	GetSpec() json.RawMessage
    79  	GetStatus() *json.RawMessage
    80  	GetObjectMeta() metav1.ObjectMeta
    81  }