sigs.k8s.io/kubebuilder/v3@v3.14.0/pkg/plugins/optional/grafana/v1alpha/plugin.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 v1alpha
    18  
    19  import (
    20  	"sigs.k8s.io/kubebuilder/v3/pkg/config"
    21  	cfgv3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3"
    22  	"sigs.k8s.io/kubebuilder/v3/pkg/model/stage"
    23  	"sigs.k8s.io/kubebuilder/v3/pkg/plugin"
    24  	"sigs.k8s.io/kubebuilder/v3/pkg/plugins"
    25  )
    26  
    27  const pluginName = "grafana." + plugins.DefaultNameQualifier
    28  
    29  var (
    30  	pluginVersion            = plugin.Version{Number: 1, Stage: stage.Alpha}
    31  	supportedProjectVersions = []config.Version{cfgv3.Version}
    32  	pluginKey                = plugin.KeyFor(Plugin{})
    33  )
    34  
    35  // Plugin implements the plugin.Full interface
    36  type Plugin struct {
    37  	initSubcommand
    38  	editSubcommand
    39  }
    40  
    41  var (
    42  	_ plugin.Init = Plugin{}
    43  )
    44  
    45  // Name returns the name of the plugin
    46  func (Plugin) Name() string { return pluginName }
    47  
    48  // Version returns the version of the grafana plugin
    49  func (Plugin) Version() plugin.Version { return pluginVersion }
    50  
    51  // SupportedProjectVersions returns an array with all project versions supported by the plugin
    52  func (Plugin) SupportedProjectVersions() []config.Version { return supportedProjectVersions }
    53  
    54  // GetInitSubcommand will return the subcommand which is responsible for initializing and scaffolding grafana manifests
    55  func (p Plugin) GetInitSubcommand() plugin.InitSubcommand { return &p.initSubcommand }
    56  
    57  // GetEditSubcommand will return the subcommand which is responsible for adding grafana manifests
    58  func (p Plugin) GetEditSubcommand() plugin.EditSubcommand { return &p.editSubcommand }
    59  
    60  type pluginConfig struct{}
    61  
    62  func (p Plugin) DeprecationWarning() string {
    63  	return ""
    64  }