|
| 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 | +// PluginRequest contains all information kubebuilder received from the CLI |
| 20 | +// and plugins executed before it. |
| 21 | +type PluginRequest struct { |
| 22 | + // APIVersion defines the versioned schema of PluginRequest that is being sent from Kubebuilder. |
| 23 | + // Initially, this will be marked as alpha (v1alpha1). |
| 24 | + APIVersion string `json:"apiVersion"` |
| 25 | + |
| 26 | + // Args holds the plugin specific arguments that are received from the CLI |
| 27 | + // which are to be passed down to the external plugin. |
| 28 | + Args []string `json:"args"` |
| 29 | + |
| 30 | + // Command contains the command to be executed by the plugin such as init, create api, etc. |
| 31 | + Command string `json:"command"` |
| 32 | + |
| 33 | + // Universe represents the modified file contents that gets updated over a series of plugin runs |
| 34 | + // across the plugin chain. Initially, it starts out as empty. |
| 35 | + Universe map[string]string `json:"universe"` |
| 36 | +} |
| 37 | + |
| 38 | +// PluginResponse is returned to kubebuilder by the plugin and contains all files |
| 39 | +// written by the plugin following a certain command. |
| 40 | +type PluginResponse struct { |
| 41 | + // APIVersion defines the versioned schema of the PluginResponse that is back sent back to Kubebuilder. |
| 42 | + // Initially, this will be marked as alpha (v1alpha1) |
| 43 | + APIVersion string `json:"apiVersion"` |
| 44 | + |
| 45 | + // Command holds the command that gets executed by the plugin such as init, create api, etc. |
| 46 | + Command string `json:"command"` |
| 47 | + |
| 48 | + // Help contains the plugin specific help text that the plugin returns to Kubebuilder when it receives |
| 49 | + // `--help` flag from Kubebuilder. |
| 50 | + Help string `json:"help"` |
| 51 | + |
| 52 | + // Universe in the PluginResponse represents the updated file contents that was written by the plugin. |
| 53 | + Universe map[string]string `json:"universe"` |
| 54 | + |
| 55 | + // Error is a boolean type that indicates whether there were any errors due to plugin failures. |
| 56 | + Error bool `json:"error,omitempty"` |
| 57 | + |
| 58 | + // ErrorMsgs contains the specific error messages of the plugin failures. |
| 59 | + ErrorMsgs []string `json:"errorMsgs,omitempty"` |
| 60 | +} |
0 commit comments