cmd

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2019 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Copyright © 2019 Hua Zhihao <ihuazhihao@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrPodCompleted = fmt.Errorf("pod ran to completion")

ErrPodCompleted is returned by PodRunning or PodContainerRunning to indicate that the pod has already reached completed state.

Functions

func NewCmdSpy

func NewCmdSpy(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

Types

type DefaultRemoteExecutor

type DefaultRemoteExecutor struct{}

DefaultRemoteExecutor is the standard implementation of remote command execution

func (*DefaultRemoteExecutor) Execute

func (*DefaultRemoteExecutor) Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error

type RemoteExecutor

type RemoteExecutor interface {
	Execute(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error
}

RemoteExecutor defines the interface accepted by the Spy command - provided for test stubbing

type SpyOptions

type SpyOptions struct {
	exec.StreamOptions

	Resources []string

	ParentCommandName       string
	EnableSuggestedCmdUsage bool

	Builder         func() *resource.Builder
	ExecutablePodFn polymorphichelpers.AttachablePodForObjectFunc

	DynamicClient dynamic.Interface

	Pod           *corev1.Pod
	Executor      RemoteExecutor
	PodClient     corev1client.PodsGetter
	GetPodTimeout time.Duration
	Config        *restclient.Config
	// contains filtered or unexported fields
}

SpyOptions declare the arguments accepted by the Spy command

func (*SpyOptions) Complete

func (o *SpyOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error

Complete verifies command line arguments and loads data from the command environment

func (*SpyOptions) Run

func (o *SpyOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) error

func (*SpyOptions) Run1

func (o *SpyOptions) Run1() error

Run executes a validated remote execution against a pod.

func (*SpyOptions) Validate

func (o *SpyOptions) Validate() error

Validate checks that the provided spy options are specified.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL