util

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright 2019 GramLabs, Inc.

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.

Copyright 2019 GramLabs, Inc.

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.

Copyright 2019 GramLabs, Inc.

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.

Copyright 2019 GramLabs, Inc.

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.

Copyright 2019 GramLabs, Inc.

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.

Copyright 2019 GramLabs, Inc.

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.

Copyright 2019 GramLabs, Inc.

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

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

CheckErr ensures the supplied error is reported and handled correctly. Errors may be reported and/or may cause the process to exit.

func IsNoPrinterError added in v1.1.1

func IsNoPrinterError(err error) bool

Types

type CSVPrinter added in v1.1.1

type CSVPrinter struct {
	// contains filtered or unexported fields
}

func (*CSVPrinter) PrintObj added in v1.1.1

func (p *CSVPrinter) PrintObj(obj interface{}, w io.Writer) error

type ConfigFlags

type ConfigFlags struct {
	KubeConfig *string
	Context    *string
	Namespace  *string
}

func NewConfigFlags

func NewConfigFlags() *ConfigFlags

func (*ConfigFlags) AddFlags

func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)

func (*ConfigFlags) ToRESTConfig

func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error)

func (*ConfigFlags) ToRawKubeConfigLoader added in v1.1.2

func (f *ConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig

type Factory

type Factory interface {
	ToRawKubeConfigLoader() clientcmd.ClientConfig
	ToRESTConfig() (*rest.Config, error)
	ToClientConfig(bool) (*client.Config, error)

	KubernetesClientSet() (*kubernetes.Clientset, error)
	RedSkyClientSet() (*redskykube.Clientset, error)
	RedSkyAPI() (redsky.API, error)
}

func NewFactory

func NewFactory(cf *ConfigFlags, sf *ServerFlags) Factory

type IOStreams

type IOStreams struct {
	In     io.Reader
	Out    io.Writer
	ErrOut io.Writer
}

type JSONPrinter added in v1.1.1

type JSONPrinter struct{}

func (*JSONPrinter) PrintObj added in v1.1.1

func (p *JSONPrinter) PrintObj(obj interface{}, w io.Writer) error

type JSONYAMLPrintFlags added in v1.1.1

type JSONYAMLPrintFlags struct{}

func NewJSONYAMLPrintFlags added in v1.1.1

func NewJSONYAMLPrintFlags() *JSONYAMLPrintFlags

func (*JSONYAMLPrintFlags) AddFlags added in v1.1.1

func (f *JSONYAMLPrintFlags) AddFlags(cmd *cobra.Command)

func (*JSONYAMLPrintFlags) AllowedFormats added in v1.1.1

func (f *JSONYAMLPrintFlags) AllowedFormats() []string

func (*JSONYAMLPrintFlags) ToPrinter added in v1.1.1

func (f *JSONYAMLPrintFlags) ToPrinter(outputFormat string) (ResourcePrinter, error)

type NoPrinterError added in v1.1.1

type NoPrinterError struct {
	OutputFormat   *string
	AllowedFormats []string
}

func (NoPrinterError) Error added in v1.1.1

func (e NoPrinterError) Error() string

type PrintFlags added in v1.1.1

type PrintFlags struct {
	JSONYAMLPrintFlags *JSONYAMLPrintFlags
	TablePrintFlags    *TablePrintFlags

	OutputFormat *string
}

func NewPrintFlags added in v1.1.1

func NewPrintFlags(meta TableMeta) *PrintFlags

func (*PrintFlags) AddFlags added in v1.1.1

func (f *PrintFlags) AddFlags(cmd *cobra.Command)

func (*PrintFlags) AllowedFormats added in v1.1.1

func (f *PrintFlags) AllowedFormats() []string

func (*PrintFlags) ToPrinter added in v1.1.1

func (f *PrintFlags) ToPrinter() (ResourcePrinter, error)

type ResourcePrinter added in v1.1.1

type ResourcePrinter interface {
	PrintObj(interface{}, io.Writer) error
}

type RuntimeObjectTableMeta added in v1.1.4

type RuntimeObjectTableMeta interface {
	ExtractValue(obj runtime.Object, column string) (string, error)
	Allow(outputFormat string) bool
	Columns(outputFormat string) []string
	Header(outputFormat string, column string) string
}

RuntimeObjectTableMeta is a subset of functionality needed for runtime.Object

type ServerFlags

type ServerFlags struct {
	Address *string
}

func NewServerFlags

func NewServerFlags() *ServerFlags

func (*ServerFlags) AddFlags

func (f *ServerFlags) AddFlags(flags *pflag.FlagSet)

func (*ServerFlags) ToClientConfig

func (f *ServerFlags) ToClientConfig() (*client.Config, error)

type TableMeta added in v1.1.1

type TableMeta interface {
	IsListType(obj interface{}) bool
	ExtractList(obj interface{}) ([]interface{}, error)
	ExtractValue(obj interface{}, column string) (string, error)
	Allow(outputFormat string) bool
	Columns(outputFormat string) []string
	Header(outputFormat string, column string) string
}

func NewTableMeta added in v1.1.4

func NewTableMeta(rt RuntimeObjectTableMeta) TableMeta

type TablePrintFlags added in v1.1.1

type TablePrintFlags struct {
	Meta     TableMeta
	Columns  []string
	NoHeader *bool
}

func NewTablePrintFlags added in v1.1.1

func NewTablePrintFlags(meta TableMeta) *TablePrintFlags

func (*TablePrintFlags) AddFlags added in v1.1.1

func (f *TablePrintFlags) AddFlags(cmd *cobra.Command)

func (*TablePrintFlags) AllowedFormats added in v1.1.1

func (f *TablePrintFlags) AllowedFormats() []string

func (*TablePrintFlags) ToPrinter added in v1.1.1

func (f *TablePrintFlags) ToPrinter(outputFormat string) (ResourcePrinter, error)

type TablePrinter added in v1.1.1

type TablePrinter struct {
	// contains filtered or unexported fields
}

func (*TablePrinter) PrintObj added in v1.1.1

func (p *TablePrinter) PrintObj(obj interface{}, w io.Writer) error

type YAMLPrinter added in v1.1.1

type YAMLPrinter struct{}

func (*YAMLPrinter) PrintObj added in v1.1.1

func (p *YAMLPrinter) PrintObj(obj interface{}, w io.Writer) error

Jump to

Keyboard shortcuts

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