sigs.k8s.io/kubebuilder/v3@v3.14.0/pkg/plugins/external/plugin.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 external 18 19 import ( 20 "sigs.k8s.io/kubebuilder/v3/pkg/config" 21 "sigs.k8s.io/kubebuilder/v3/pkg/plugin" 22 ) 23 24 var _ plugin.Full = Plugin{} 25 26 // Plugin implements the plugin.Full interface 27 type Plugin struct { 28 PName string 29 PVersion plugin.Version 30 PSupportedProjectVersions []config.Version 31 32 Path string 33 Args []string 34 } 35 36 // Name returns the name of the plugin 37 func (p Plugin) Name() string { return p.PName } 38 39 // Version returns the version of the plugin 40 func (p Plugin) Version() plugin.Version { return p.PVersion } 41 42 // SupportedProjectVersions returns an array with all project versions supported by the plugin 43 func (p Plugin) SupportedProjectVersions() []config.Version { return p.PSupportedProjectVersions } 44 45 // GetInitSubcommand will return the subcommand which is responsible for initializing and common scaffolding 46 func (p Plugin) GetInitSubcommand() plugin.InitSubcommand { 47 return &initSubcommand{ 48 Path: p.Path, 49 Args: p.Args, 50 } 51 } 52 53 // GetCreateAPISubcommand will return the subcommand which is responsible for scaffolding apis 54 func (p Plugin) GetCreateAPISubcommand() plugin.CreateAPISubcommand { 55 return &createAPISubcommand{ 56 Path: p.Path, 57 Args: p.Args, 58 } 59 } 60 61 // GetCreateWebhookSubcommand will return the subcommand which is responsible for scaffolding webhooks 62 func (p Plugin) GetCreateWebhookSubcommand() plugin.CreateWebhookSubcommand { 63 return &createWebhookSubcommand{ 64 Path: p.Path, 65 Args: p.Args, 66 } 67 } 68 69 // GetEditSubcommand will return the subcommand which is responsible for editing the scaffold of the project 70 func (p Plugin) GetEditSubcommand() plugin.EditSubcommand { 71 return &editSubcommand{ 72 Path: p.Path, 73 Args: p.Args, 74 } 75 } 76 77 func (p Plugin) DeprecationWarning() string { 78 return "" 79 }