github.com/tigera/api@v0.0.0-20240320170621-278e89a8c5fb/pkg/apis/projectcalico/v3/globalalerttemplate.go (about)

     1  // Copyright (c) 2019,2021 Tigera, Inc. All rights reserved.
     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 v3
    16  
    17  import (
    18  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    19  )
    20  
    21  const (
    22  	KindGlobalAlertTemplate     = "GlobalAlertTemplate"
    23  	KindGlobalAlertTemplateList = "GlobalAlertTemplateList"
    24  )
    25  
    26  // +genclient
    27  // +genclient:nonNamespaced
    28  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    29  
    30  type GlobalAlertTemplate struct {
    31  	metav1.TypeMeta `json:",inline"`
    32  	// Standard object's metadata.
    33  	metav1.ObjectMeta `json:"metadata,omitempty"`
    34  	// Specification of the GlobalAlert.
    35  	Spec GlobalAlertSpec `json:"spec,omitempty"`
    36  }
    37  
    38  // +genclient:nonNamespaced
    39  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    40  
    41  // GlobalAlertList contains a list of GlobalAlert resources.
    42  type GlobalAlertTemplateList struct {
    43  	metav1.TypeMeta `json:",inline"`
    44  	metav1.ListMeta `json:"metadata"`
    45  	Items           []GlobalAlertTemplate `json:"items"`
    46  }
    47  
    48  // NewGlobalAlert creates a new (zeroed) GlobalAlert struct with the TypeMetadata
    49  // initialized to the current version.
    50  func NewGlobalAlertTemplate() *GlobalAlertTemplate {
    51  	return &GlobalAlertTemplate{
    52  		TypeMeta: metav1.TypeMeta{
    53  			Kind:       KindGlobalAlertTemplate,
    54  			APIVersion: GroupVersionCurrent,
    55  		},
    56  	}
    57  }
    58  
    59  // NewGlobalAlertTemplateList creates a new (zeroed) GlobalAlertTemplateList struct with the TypeMetadata
    60  // initialized to the current version.
    61  func NewGlobalAlertTemplateList() *GlobalAlertTemplateList {
    62  	return &GlobalAlertTemplateList{
    63  		TypeMeta: metav1.TypeMeta{
    64  			Kind:       KindGlobalAlertTemplateList,
    65  			APIVersion: GroupVersionCurrent,
    66  		},
    67  	}
    68  }