mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Add assertions for types implementing interfaces (#5893)
This commit is contained in:
@@ -10,6 +10,8 @@ type Alizer struct {
|
||||
registryClient registry.Client
|
||||
}
|
||||
|
||||
var _ Client = (*Alizer)(nil)
|
||||
|
||||
func NewAlizerClient(registryClient registry.Client) *Alizer {
|
||||
return &Alizer{
|
||||
registryClient: registryClient,
|
||||
|
||||
@@ -15,6 +15,8 @@ import (
|
||||
|
||||
type KubernetesClient struct{}
|
||||
|
||||
var _ Client = (*KubernetesClient)(nil)
|
||||
|
||||
func NewKubernetesClient() *KubernetesClient {
|
||||
return &KubernetesClient{}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ const (
|
||||
|
||||
type Survey struct{}
|
||||
|
||||
var _ Asker = (*Survey)(nil)
|
||||
|
||||
func NewSurveyAsker() *Survey {
|
||||
return &Survey{}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ const (
|
||||
// FlagsBackend is a backend that will extract all needed information from flags passed to the command
|
||||
type FlagsBackend struct{}
|
||||
|
||||
var _ AddBindingBackend = (*FlagsBackend)(nil)
|
||||
|
||||
func NewFlagsBackend() *FlagsBackend {
|
||||
return &FlagsBackend{}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ type InteractiveBackend struct {
|
||||
kubernetesClient kclient.ClientInterface
|
||||
}
|
||||
|
||||
var _ AddBindingBackend = (*InteractiveBackend)(nil)
|
||||
|
||||
func NewInteractiveBackend(askerClient asker.Asker, kubernetesClient kclient.ClientInterface) *InteractiveBackend {
|
||||
return &InteractiveBackend{
|
||||
askerClient: askerClient,
|
||||
|
||||
@@ -34,6 +34,8 @@ type BindingClient struct {
|
||||
kubernetesClient kclient.ClientInterface
|
||||
}
|
||||
|
||||
var _ Client = (*BindingClient)(nil)
|
||||
|
||||
func NewBindingClient(kubernetesClient kclient.ClientInterface) *BindingClient {
|
||||
// We create the asker client and the backends here and not at the CLI level, as we want to hide these details to the CLI
|
||||
askerClient := asker.NewSurveyAsker()
|
||||
|
||||
@@ -24,6 +24,8 @@ type DeleteComponentClient struct {
|
||||
kubeClient kclient.ClientInterface
|
||||
}
|
||||
|
||||
var _ Client = (*DeleteComponentClient)(nil)
|
||||
|
||||
func NewDeleteComponentClient(kubeClient kclient.ClientInterface) *DeleteComponentClient {
|
||||
return &DeleteComponentClient{
|
||||
kubeClient: kubeClient,
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/kclient"
|
||||
"github.com/redhat-developer/odo/pkg/libdevfile"
|
||||
"github.com/redhat-developer/odo/pkg/log"
|
||||
"github.com/redhat-developer/odo/pkg/machineoutput"
|
||||
"github.com/redhat-developer/odo/pkg/remotecmd"
|
||||
@@ -22,6 +23,8 @@ type execHandler struct {
|
||||
show bool
|
||||
}
|
||||
|
||||
var _ libdevfile.Handler = (*execHandler)(nil)
|
||||
|
||||
const ShellExecutable string = "/bin/sh"
|
||||
|
||||
func NewExecHandler(kubeClient kclient.ClientInterface, appName, cmpName, podName, msg string, show bool) *execHandler {
|
||||
|
||||
@@ -44,6 +44,9 @@ type defaultPushedComponent struct {
|
||||
storageClient storage.Client
|
||||
}
|
||||
|
||||
var _ provider = (*defaultPushedComponent)(nil)
|
||||
var _ PushedComponent = (*defaultPushedComponent)(nil)
|
||||
|
||||
func (d defaultPushedComponent) GetLabels() map[string]string {
|
||||
return d.provider.GetLabels()
|
||||
}
|
||||
@@ -90,6 +93,8 @@ type devfileComponent struct {
|
||||
d v1.Deployment
|
||||
}
|
||||
|
||||
var _ provider = (*devfileComponent)(nil)
|
||||
|
||||
func (d devfileComponent) GetLinkedSecrets() (secretMounts []SecretMount) {
|
||||
for _, container := range d.d.Spec.Template.Spec.Containers {
|
||||
for _, env := range container.EnvFrom {
|
||||
|
||||
@@ -23,6 +23,8 @@ type DeployClient struct {
|
||||
kubeClient kclient.ClientInterface
|
||||
}
|
||||
|
||||
var _ Client = (*DeployClient)(nil)
|
||||
|
||||
func NewDeployClient(kubeClient kclient.ClientInterface) *DeployClient {
|
||||
return &DeployClient{
|
||||
kubeClient: kubeClient,
|
||||
@@ -41,6 +43,8 @@ type deployHandler struct {
|
||||
appName string
|
||||
}
|
||||
|
||||
var _ libdevfile.Handler = (*deployHandler)(nil)
|
||||
|
||||
func newDeployHandler(devfileObj parser.DevfileObj, path string, kubeClient kclient.ClientInterface, appName string) *deployHandler {
|
||||
return &deployHandler{
|
||||
devfileObj: devfileObj,
|
||||
|
||||
@@ -15,13 +15,12 @@ import (
|
||||
"github.com/redhat-developer/odo/pkg/watch"
|
||||
)
|
||||
|
||||
// this causes compilation to fail if DevClient struct doesn't implement Client interface
|
||||
var _ Client = (*DevClient)(nil)
|
||||
|
||||
type DevClient struct {
|
||||
watchClient watch.Client
|
||||
}
|
||||
|
||||
var _ Client = (*DevClient)(nil)
|
||||
|
||||
func NewDevClient(watchClient watch.Client) *DevClient {
|
||||
return &DevClient{
|
||||
watchClient: watchClient,
|
||||
|
||||
@@ -15,6 +15,8 @@ type Adapter struct {
|
||||
componentAdapter common.ComponentAdapter
|
||||
}
|
||||
|
||||
var _ common.ComponentAdapter = (*Adapter)(nil)
|
||||
|
||||
type KubernetesContext struct {
|
||||
Namespace string
|
||||
}
|
||||
|
||||
@@ -89,6 +89,9 @@ type Adapter struct {
|
||||
deployment *appsv1.Deployment
|
||||
}
|
||||
|
||||
var _ sync.SyncClient = (*Adapter)(nil)
|
||||
var _ common.ComponentAdapter = (*Adapter)(nil)
|
||||
|
||||
// Push updates the component if a matching component exists or creates one if it doesn't exist
|
||||
// Once the component has started, it will sync the source code to it.
|
||||
func (a Adapter) Push(parameters common.PushParameters) (err error) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/redhat-developer/odo/pkg/libdevfile"
|
||||
"github.com/redhat-developer/odo/pkg/log"
|
||||
"github.com/redhat-developer/odo/pkg/remotecmd"
|
||||
"github.com/redhat-developer/odo/pkg/sync"
|
||||
"github.com/redhat-developer/odo/pkg/task"
|
||||
"github.com/redhat-developer/odo/pkg/util"
|
||||
)
|
||||
@@ -26,6 +27,8 @@ type adapterHandler struct {
|
||||
}
|
||||
|
||||
var _ libdevfile.Handler = (*adapterHandler)(nil)
|
||||
var _ common.ComponentAdapter = (*adapterHandler)(nil)
|
||||
var _ sync.SyncClient = (*adapterHandler)(nil)
|
||||
|
||||
func (a *adapterHandler) ApplyImage(_ devfilev1.Component) error {
|
||||
klog.V(2).Info("this handler can only handle exec commands in container components, not image components")
|
||||
|
||||
@@ -19,6 +19,8 @@ type DockerCompatibleBackend struct {
|
||||
name string
|
||||
}
|
||||
|
||||
var _ Backend = (*DockerCompatibleBackend)(nil)
|
||||
|
||||
func NewDockerCompatibleBackend(name string) *DockerCompatibleBackend {
|
||||
return &DockerCompatibleBackend{name: name}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ type EnvSpecificInfo struct {
|
||||
envinfoFileExists bool
|
||||
}
|
||||
|
||||
var _ localConfigProvider.LocalConfigProvider = (*EnvSpecificInfo)(nil)
|
||||
|
||||
func (esi EnvSpecificInfo) GetDevfilePath() string {
|
||||
return esi.devfilePath
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import (
|
||||
|
||||
type Survey struct{}
|
||||
|
||||
var _ Asker = (*Survey)(nil)
|
||||
|
||||
func NewSurveyAsker() *Survey {
|
||||
return &Survey{}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ type AlizerBackend struct {
|
||||
alizerClient alizer.Client
|
||||
}
|
||||
|
||||
var _ InitBackend = (*AlizerBackend)(nil)
|
||||
|
||||
func NewAlizerBackend(askerClient asker.Asker, alizerClient alizer.Client) *AlizerBackend {
|
||||
return &AlizerBackend{
|
||||
askerClient: askerClient,
|
||||
|
||||
@@ -30,6 +30,8 @@ type FlagsBackend struct {
|
||||
preferenceClient preference.Client
|
||||
}
|
||||
|
||||
var _ InitBackend = (*FlagsBackend)(nil)
|
||||
|
||||
func NewFlagsBackend(preferenceClient preference.Client) *FlagsBackend {
|
||||
return &FlagsBackend{
|
||||
preferenceClient: preferenceClient,
|
||||
|
||||
@@ -29,6 +29,8 @@ type InteractiveBackend struct {
|
||||
registryClient registry.Client
|
||||
}
|
||||
|
||||
var _ InitBackend = (*InteractiveBackend)(nil)
|
||||
|
||||
func NewInteractiveBackend(askerClient asker.Asker, registryClient registry.Client) *InteractiveBackend {
|
||||
return &InteractiveBackend{
|
||||
askerClient: askerClient,
|
||||
|
||||
@@ -37,6 +37,8 @@ type InitClient struct {
|
||||
registryClient registry.Client
|
||||
}
|
||||
|
||||
var _ Client = (*InitClient)(nil)
|
||||
|
||||
func NewInitClient(fsys filesystem.Filesystem, preferenceClient preference.Client, registryClient registry.Client, alizerClient alizer.Client) *InitClient {
|
||||
// We create the asker client and the backends here and not at the CLI level, as we want to hide these details to the CLI
|
||||
askerClient := asker.NewSurveyAsker()
|
||||
|
||||
@@ -71,6 +71,8 @@ type Client struct {
|
||||
routeClient routeclientset.RouteV1Interface
|
||||
}
|
||||
|
||||
var _ ClientInterface = (*Client)(nil)
|
||||
|
||||
// New creates a new client
|
||||
func New() (*Client, error) {
|
||||
return NewForConfig(nil)
|
||||
|
||||
@@ -12,6 +12,8 @@ type applyCommand struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ command = (*applyCommand)(nil)
|
||||
|
||||
// newApplyCommand creates a new applyCommand instance
|
||||
func newApplyCommand(devfileObj parser.DevfileObj, command v1alpha2.Command) *applyCommand {
|
||||
return &applyCommand{
|
||||
|
||||
@@ -14,6 +14,8 @@ type compositeCommand struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ command = (*compositeCommand)(nil)
|
||||
|
||||
// newCompositeCommand creates a new command implementation which will execute the provided commands in the specified order
|
||||
func newCompositeCommand(devfileObj parser.DevfileObj, command v1alpha2.Command) *compositeCommand {
|
||||
return &compositeCommand{
|
||||
|
||||
@@ -15,6 +15,8 @@ type parallelCompositeCommand struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ command = (*parallelCompositeCommand)(nil)
|
||||
|
||||
// newParallelCompositeCommand creates a new command implementation which will execute the provided commands in parallel
|
||||
func newParallelCompositeCommand(devfileObj parser.DevfileObj, command v1alpha2.Command) *parallelCompositeCommand {
|
||||
return ¶llelCompositeCommand{
|
||||
|
||||
@@ -11,6 +11,8 @@ type execCommand struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ command = (*execCommand)(nil)
|
||||
|
||||
// newExecCommand creates a new execCommand instance, adapting the devfile-defined command to run in the target component's
|
||||
// container, modifying it to add environment variables or adapting the path as needed.
|
||||
func newExecCommand(devfileObj parser.DevfileObj, command v1alpha2.Command) *execCommand {
|
||||
|
||||
@@ -11,6 +11,8 @@ type containerComponent struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ component = (*containerComponent)(nil)
|
||||
|
||||
func newContainerComponent(devfileObj parser.DevfileObj, component v1alpha2.Component) *containerComponent {
|
||||
return &containerComponent{
|
||||
component: component,
|
||||
|
||||
@@ -11,6 +11,8 @@ type imageComponent struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ component = (*imageComponent)(nil)
|
||||
|
||||
func newImageComponent(devfileObj parser.DevfileObj, component v1alpha2.Component) *imageComponent {
|
||||
return &imageComponent{
|
||||
component: component,
|
||||
|
||||
@@ -11,6 +11,8 @@ type kubernetesComponent struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ component = (*kubernetesComponent)(nil)
|
||||
|
||||
func newKubernetesComponent(devfileObj parser.DevfileObj, component v1alpha2.Component) *kubernetesComponent {
|
||||
return &kubernetesComponent{
|
||||
component: component,
|
||||
|
||||
@@ -11,6 +11,8 @@ type openshiftComponent struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ component = (*openshiftComponent)(nil)
|
||||
|
||||
func newOpenshiftComponent(devfileObj parser.DevfileObj, component v1alpha2.Component) *openshiftComponent {
|
||||
return &openshiftComponent{
|
||||
component: component,
|
||||
|
||||
@@ -11,6 +11,8 @@ type volumeComponent struct {
|
||||
devfileObj parser.DevfileObj
|
||||
}
|
||||
|
||||
var _ component = (*volumeComponent)(nil)
|
||||
|
||||
func newVolumeComponent(devfileObj parser.DevfileObj, component v1alpha2.Component) *volumeComponent {
|
||||
return &volumeComponent{
|
||||
component: component,
|
||||
|
||||
@@ -19,6 +19,8 @@ type LogsClient struct {
|
||||
kubernetesClient kclient.ClientInterface
|
||||
}
|
||||
|
||||
var _ Client = (*LogsClient)(nil)
|
||||
|
||||
func NewLogsClient(kubernetesClient kclient.ClientInterface) *LogsClient {
|
||||
return &LogsClient{
|
||||
kubernetesClient: kubernetesClient,
|
||||
|
||||
@@ -134,9 +134,13 @@ type MachineEventLogEntry interface {
|
||||
type NoOpMachineEventLoggingClient struct {
|
||||
}
|
||||
|
||||
var _ MachineEventLoggingClient = (*NoOpMachineEventLoggingClient)(nil)
|
||||
|
||||
// ConsoleMachineEventLoggingClient will output all events to the console as JSON
|
||||
type ConsoleMachineEventLoggingClient struct {
|
||||
|
||||
// logFunc is an optional function that can be used instead of writing via the standard machine out logic
|
||||
logFunc func(machineOutput MachineEventWrapper)
|
||||
}
|
||||
|
||||
var _ MachineEventLoggingClient = (*ConsoleMachineEventLoggingClient)(nil)
|
||||
|
||||
@@ -53,6 +53,8 @@ type AddBindingOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*AddBindingOptions)(nil)
|
||||
|
||||
// NewAddBindingOptions returns new instance of ComponentOptions
|
||||
func NewAddBindingOptions() *AddBindingOptions {
|
||||
return &AddBindingOptions{}
|
||||
|
||||
@@ -22,6 +22,9 @@ type AlizerOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*AlizerOptions)(nil)
|
||||
var _ genericclioptions.JsonOutputter = (*AlizerOptions)(nil)
|
||||
|
||||
// NewAlizerOptions creates a new AlizerOptions instance
|
||||
func NewAlizerOptions() *AlizerOptions {
|
||||
return &AlizerOptions{}
|
||||
|
||||
@@ -28,6 +28,8 @@ type BuildImagesOptions struct {
|
||||
contextFlag string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*BuildImagesOptions)(nil)
|
||||
|
||||
var buildImagesExample = templates.Examples(`
|
||||
# Build images defined in the devfile
|
||||
%[1]s
|
||||
|
||||
@@ -53,6 +53,8 @@ type NamespaceCreateOptions struct {
|
||||
commandName string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*NamespaceCreateOptions)(nil)
|
||||
|
||||
// NewNamespaceCreateOptions creates a NamespaceCreateOptions instance
|
||||
func NewNamespaceCreateOptions() *NamespaceCreateOptions {
|
||||
return &NamespaceCreateOptions{}
|
||||
|
||||
@@ -52,6 +52,8 @@ type ComponentOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ComponentOptions)(nil)
|
||||
|
||||
// NewComponentOptions returns new instance of ComponentOptions
|
||||
func NewComponentOptions() *ComponentOptions {
|
||||
return &ComponentOptions{}
|
||||
|
||||
@@ -3,13 +3,14 @@ package namespace
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/log"
|
||||
"github.com/redhat-developer/odo/pkg/odo/cli/ui"
|
||||
scontext "github.com/redhat-developer/odo/pkg/segment/context"
|
||||
"github.com/spf13/cobra"
|
||||
ktemplates "k8s.io/kubectl/pkg/util/templates"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/odo/cmdline"
|
||||
"github.com/redhat-developer/odo/pkg/odo/genericclioptions"
|
||||
@@ -51,6 +52,8 @@ type DeleteOptions struct {
|
||||
commandName string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*DeleteOptions)(nil)
|
||||
|
||||
// NewDeleteOptions creates a new DeleteOptions instance
|
||||
func NewDeleteOptions() *DeleteOptions {
|
||||
return &DeleteOptions{}
|
||||
|
||||
@@ -48,6 +48,8 @@ type DeployOptions struct {
|
||||
contextDir string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*DeployOptions)(nil)
|
||||
|
||||
var deployExample = templates.Examples(`
|
||||
# Deploy components defined in the devfile
|
||||
%[1]s
|
||||
|
||||
@@ -43,6 +43,9 @@ type BindingOptions struct {
|
||||
contextDir string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*BindingOptions)(nil)
|
||||
var _ genericclioptions.JsonOutputter = (*BindingOptions)(nil)
|
||||
|
||||
// NewBindingOptions returns new instance of BindingOptions
|
||||
func NewBindingOptions() *BindingOptions {
|
||||
return &BindingOptions{}
|
||||
|
||||
@@ -47,6 +47,9 @@ type ComponentOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ComponentOptions)(nil)
|
||||
var _ genericclioptions.JsonOutputter = (*ComponentOptions)(nil)
|
||||
|
||||
// NewComponentOptions returns new instance of ComponentOptions
|
||||
func NewComponentOptions() *ComponentOptions {
|
||||
return &ComponentOptions{}
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
ktemplates "k8s.io/kubectl/pkg/util/templates"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/component"
|
||||
"github.com/redhat-developer/odo/pkg/dev"
|
||||
ododevfile "github.com/redhat-developer/odo/pkg/devfile"
|
||||
"github.com/redhat-developer/odo/pkg/devfile/adapters"
|
||||
"github.com/redhat-developer/odo/pkg/devfile/adapters/common"
|
||||
@@ -75,8 +76,13 @@ type DevOptions struct {
|
||||
variables map[string]string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*DevOptions)(nil)
|
||||
var _ genericclioptions.SignalHandler = (*DevOptions)(nil)
|
||||
|
||||
type Handler struct{}
|
||||
|
||||
var _ dev.Handler = (*Handler)(nil)
|
||||
|
||||
func NewDevOptions() *DevOptions {
|
||||
return &DevOptions{
|
||||
out: log.GetStdout(),
|
||||
|
||||
@@ -66,6 +66,9 @@ type InitOptions struct {
|
||||
contextDir string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*InitOptions)(nil)
|
||||
var _ genericclioptions.JsonOutputter = (*InitOptions)(nil)
|
||||
|
||||
// NewInitOptions creates a new InitOptions instance
|
||||
func NewInitOptions() *InitOptions {
|
||||
return &InitOptions{}
|
||||
|
||||
@@ -44,6 +44,9 @@ type BindingListOptions struct {
|
||||
contextDir string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*BindingListOptions)(nil)
|
||||
var _ genericclioptions.JsonOutputter = (*BindingListOptions)(nil)
|
||||
|
||||
// NewBindingListOptions creates a new BindingListOptions instance
|
||||
func NewBindingListOptions() *BindingListOptions {
|
||||
return &BindingListOptions{}
|
||||
|
||||
@@ -57,6 +57,9 @@ type ListOptions struct {
|
||||
namespaceFlag string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ListOptions)(nil)
|
||||
var _ genericclioptions.JsonOutputter = (*ListOptions)(nil)
|
||||
|
||||
// NewListOptions ...
|
||||
func NewListOptions() *ListOptions {
|
||||
return &ListOptions{}
|
||||
|
||||
@@ -38,6 +38,8 @@ type NamespaceListOptions struct {
|
||||
commandName string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*NamespaceListOptions)(nil)
|
||||
|
||||
// NewNamespaceListOptions creates a new NamespaceListOptions instance
|
||||
func NewNamespaceListOptions() *NamespaceListOptions {
|
||||
return &NamespaceListOptions{}
|
||||
|
||||
@@ -33,6 +33,8 @@ type LoginOptions struct {
|
||||
loginClient auth.Client
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*LoginOptions)(nil)
|
||||
|
||||
var loginExample = templates.Examples(`
|
||||
# Log in interactively
|
||||
%[1]s
|
||||
|
||||
@@ -26,6 +26,8 @@ type LogoutOptions struct {
|
||||
*genericclioptions.Context
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*LogoutOptions)(nil)
|
||||
|
||||
// NewLogoutOptions creates a new LogoutOptions instance
|
||||
func NewLogoutOptions() *LogoutOptions {
|
||||
return &LogoutOptions{}
|
||||
|
||||
@@ -46,6 +46,8 @@ type LogsOptions struct {
|
||||
follow bool
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*LogsOptions)(nil)
|
||||
|
||||
type logsMode string
|
||||
|
||||
const (
|
||||
|
||||
@@ -51,6 +51,8 @@ type ExecHandler struct {
|
||||
Exec execFunc
|
||||
}
|
||||
|
||||
var _ PluginHandler = (*ExecHandler)(nil)
|
||||
|
||||
// Lookup implements PluginHandler, using
|
||||
// https://golang.org/pkg/os/exec/#LookPath to search for the command.
|
||||
func (h *ExecHandler) Lookup(command string) string {
|
||||
|
||||
@@ -47,6 +47,8 @@ type RegistryOptions struct {
|
||||
user string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*RegistryOptions)(nil)
|
||||
|
||||
// NewRegistryOptions creates a new RegistryOptions instance
|
||||
func NewRegistryOptions() *RegistryOptions {
|
||||
return &RegistryOptions{}
|
||||
|
||||
@@ -45,6 +45,8 @@ type RegistryOptions struct {
|
||||
user string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*RegistryOptions)(nil)
|
||||
|
||||
// NewRegistryOptions creates a new RegistryOptions instance
|
||||
func NewRegistryOptions() *RegistryOptions {
|
||||
return &RegistryOptions{}
|
||||
|
||||
@@ -41,6 +41,8 @@ type SetOptions struct {
|
||||
paramValue string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*SetOptions)(nil)
|
||||
|
||||
// NewSetOptions creates a new SetOptions instance
|
||||
func NewSetOptions() *SetOptions {
|
||||
return &SetOptions{}
|
||||
|
||||
@@ -40,6 +40,8 @@ type UnsetOptions struct {
|
||||
forceFlag bool
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*UnsetOptions)(nil)
|
||||
|
||||
// NewUnsetOptions creates a new UnsetOptions instance
|
||||
func NewUnsetOptions() *UnsetOptions {
|
||||
return &UnsetOptions{}
|
||||
|
||||
@@ -29,6 +29,8 @@ type ViewOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ViewOptions)(nil)
|
||||
|
||||
// NewViewOptions creates a new ViewOptions instance
|
||||
func NewViewOptions() *ViewOptions {
|
||||
return &ViewOptions{}
|
||||
|
||||
@@ -46,6 +46,8 @@ type ProjectCreateOptions struct {
|
||||
waitFlag bool
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ProjectCreateOptions)(nil)
|
||||
|
||||
// NewProjectCreateOptions creates a ProjectCreateOptions instance
|
||||
func NewProjectCreateOptions() *ProjectCreateOptions {
|
||||
return &ProjectCreateOptions{}
|
||||
|
||||
@@ -47,6 +47,8 @@ type ProjectDeleteOptions struct {
|
||||
waitFlag bool
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ProjectDeleteOptions)(nil)
|
||||
|
||||
// NewProjectDeleteOptions creates a ProjectDeleteOptions instance
|
||||
func NewProjectDeleteOptions() *ProjectDeleteOptions {
|
||||
return &ProjectDeleteOptions{}
|
||||
|
||||
@@ -35,6 +35,8 @@ type ProjectGetOptions struct {
|
||||
shortFlag bool
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ProjectGetOptions)(nil)
|
||||
|
||||
// NewProjectGetOptions creates a ProjectGetOptions instance
|
||||
func NewProjectGetOptions() *ProjectGetOptions {
|
||||
return &ProjectGetOptions{}
|
||||
|
||||
@@ -35,6 +35,8 @@ type ProjectListOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ProjectListOptions)(nil)
|
||||
|
||||
// NewProjectListOptions creates a new ProjectListOptions instance
|
||||
func NewProjectListOptions() *ProjectListOptions {
|
||||
return &ProjectListOptions{}
|
||||
|
||||
@@ -47,6 +47,8 @@ type ProjectSetOptions struct {
|
||||
shortFlag bool
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ProjectSetOptions)(nil)
|
||||
|
||||
// NewProjectSetOptions creates a ProjectSetOptions instance
|
||||
func NewProjectSetOptions() *ProjectSetOptions {
|
||||
return &ProjectSetOptions{}
|
||||
|
||||
@@ -51,6 +51,9 @@ type ListOptions struct {
|
||||
detailsFlag bool
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*ListOptions)(nil)
|
||||
var _ genericclioptions.JsonOutputter = (*ListOptions)(nil)
|
||||
|
||||
// NewListOptions creates a new ListOptions instance
|
||||
func NewListOptions() *ListOptions {
|
||||
return &ListOptions{}
|
||||
|
||||
@@ -34,6 +34,8 @@ type RemoveBindingOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*RemoveBindingOptions)(nil)
|
||||
|
||||
// NewRemoveBindingOptions returns new instance of ComponentOptions
|
||||
func NewRemoveBindingOptions() *RemoveBindingOptions {
|
||||
return &RemoveBindingOptions{}
|
||||
|
||||
@@ -54,6 +54,8 @@ type SetOptions struct {
|
||||
commandName string
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*SetOptions)(nil)
|
||||
|
||||
// NewSetOptions creates a SetOptions instance
|
||||
func NewSetOptions() *SetOptions {
|
||||
return &SetOptions{}
|
||||
|
||||
@@ -3,6 +3,7 @@ package telemetry
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/odo/cmdline"
|
||||
"github.com/redhat-developer/odo/pkg/odo/genericclioptions"
|
||||
"github.com/redhat-developer/odo/pkg/odo/genericclioptions/clientset"
|
||||
@@ -21,6 +22,8 @@ type TelemetryOptions struct {
|
||||
telemetryData segment.TelemetryData
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*TelemetryOptions)(nil)
|
||||
|
||||
func NewTelemetryOptions() *TelemetryOptions {
|
||||
return &TelemetryOptions{}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ type VersionOptions struct {
|
||||
clientset *clientset.Clientset
|
||||
}
|
||||
|
||||
var _ genericclioptions.Runnable = (*VersionOptions)(nil)
|
||||
|
||||
// NewVersionOptions creates a new VersionOptions instance
|
||||
func NewVersionOptions() *VersionOptions {
|
||||
return &VersionOptions{}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cmdline
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
@@ -16,6 +17,8 @@ type Cobra struct {
|
||||
cmd *cobra.Command
|
||||
}
|
||||
|
||||
var _ Cmdline = (*Cobra)(nil)
|
||||
|
||||
func NewCobra(cmd *cobra.Command) *Cobra {
|
||||
return &Cobra{
|
||||
cmd: cmd,
|
||||
|
||||
@@ -67,6 +67,8 @@ type preferenceInfo struct {
|
||||
Preference `yaml:",omitempty"`
|
||||
}
|
||||
|
||||
var _ Client = (*preferenceInfo)(nil)
|
||||
|
||||
func getPreferenceFile() (string, error) {
|
||||
if env, ok := os.LookupEnv(GlobalConfigEnvName); ok {
|
||||
return env, nil
|
||||
|
||||
@@ -11,6 +11,8 @@ type kubernetesClient struct {
|
||||
client kclient.ClientInterface
|
||||
}
|
||||
|
||||
var _ Client = (*kubernetesClient)(nil)
|
||||
|
||||
func NewClient(client kclient.ClientInterface) Client {
|
||||
return kubernetesClient{
|
||||
client: client,
|
||||
|
||||
@@ -29,6 +29,8 @@ type RegistryClient struct {
|
||||
preferenceClient preference.Client
|
||||
}
|
||||
|
||||
var _ Client = (*RegistryClient)(nil)
|
||||
|
||||
func NewRegistryClient(fsys filesystem.Filesystem, preferenceClient preference.Client) RegistryClient {
|
||||
return RegistryClient{
|
||||
fsys: fsys,
|
||||
|
||||
@@ -14,6 +14,8 @@ type State struct {
|
||||
fs filesystem.Filesystem
|
||||
}
|
||||
|
||||
var _ Client = (*State)(nil)
|
||||
|
||||
func NewStateClient(fs filesystem.Filesystem) *State {
|
||||
return &State{
|
||||
fs: fs,
|
||||
|
||||
@@ -28,6 +28,8 @@ type kubernetesClient struct {
|
||||
deployment *v1.Deployment
|
||||
}
|
||||
|
||||
var _ Client = (*kubernetesClient)(nil)
|
||||
|
||||
// Create creates a pvc from the given Storage
|
||||
func (k kubernetesClient) Create(storage Storage) error {
|
||||
|
||||
|
||||
@@ -141,6 +141,8 @@ type defaultFile struct {
|
||||
file *os.File
|
||||
}
|
||||
|
||||
var _ File = (*defaultFile)(nil)
|
||||
|
||||
// Name via os.File.Name
|
||||
func (file *defaultFile) Name() string {
|
||||
return file.file.Name()
|
||||
|
||||
@@ -34,6 +34,8 @@ type fakeFs struct {
|
||||
a afero.Afero
|
||||
}
|
||||
|
||||
var _ Filesystem = (*fakeFs)(nil)
|
||||
|
||||
// NewFakeFs returns a fake Filesystem that exists in-memory, useful for unit tests
|
||||
func NewFakeFs() Filesystem {
|
||||
return &fakeFs{a: afero.Afero{Fs: afero.NewMemMapFs()}}
|
||||
@@ -144,6 +146,8 @@ type fakeFile struct {
|
||||
file afero.File
|
||||
}
|
||||
|
||||
var _ File = (*fakeFile)(nil)
|
||||
|
||||
// Name via afero.File.Name
|
||||
func (file *fakeFile) Name() string {
|
||||
return file.file.Name()
|
||||
|
||||
@@ -37,6 +37,8 @@ type WatchClient struct {
|
||||
stateClient state.Client
|
||||
}
|
||||
|
||||
var _ Client = (*WatchClient)(nil)
|
||||
|
||||
func NewWatchClient(deleteClient _delete.Client, stateClient state.Client) *WatchClient {
|
||||
return &WatchClient{
|
||||
deleteClient: deleteClient,
|
||||
|
||||
Reference in New Issue
Block a user