util

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackupIfPresent

func BackupIfPresent(fs afero.Afero, basePath string, logger log.Logger, ui cli.Ui) error

func BailIfPresent

func BailIfPresent(fs afero.Afero, basePath string, logger log.Logger) error

BailIfPresent returns an error if the path is present. Handy to prevent accidentally blowing away directories on the workstation.

func FindOnlySubdir

func FindOnlySubdir(dir string, fs afero.Afero) (string, error)

FindOnlySubdir finds the only subdirectory of a directory.

func GenerateNameFromMetadata added in v0.25.0

func GenerateNameFromMetadata(k8sYaml MinimalK8sYaml, idx int) string

func IsGithubURL

func IsGithubURL(url string) bool

returns true if this parses as a valid Github URL.

func MaybeSplitMultidocYaml added in v0.28.0

func MaybeSplitMultidocYaml(ctx context.Context, fs afero.Afero, localPath string) error

this function is not perfect, and has known limitations. One of these is that it does not account for `\n---\n` in multiline strings.

func NewKubernetesResource added in v0.28.0

func NewKubernetesResource(in []byte) (*resource.Resource, error)

Types

type AssetUploader added in v0.16.0

type AssetUploader interface {
	UploadAssets(target string) error
}

func NewAssetUploader added in v0.16.0

func NewAssetUploader(
	logger log.Logger,
	client *http.Client,
) AssetUploader

type CAType added in v0.26.0

type CAType struct {
	Cert string
	Key  string
}

func MakeCA added in v0.26.0

func MakeCA(caKind string) (CAType, error)

type CertType added in v0.26.0

type CertType struct {
	Cert string
	Key  string
}

func MakeCert added in v0.26.0

func MakeCert(host []string, certKind, CACert, CAKey string) (CertType, error)

type GithubURL

type GithubURL struct {
	Owner  string
	Repo   string
	Ref    string
	Subdir string
	IsBlob bool
}

func ParseGithubURL

func ParseGithubURL(url string, defaultRef string) (GithubURL, error)

type List added in v0.26.0

type List struct {
	APIVersion string           `json:"apiVersion" yaml:"apiVersion"`
	Path       string           `json:"path" yaml:"path"`
	Items      []MinimalK8sYaml `json:"items" yaml:"items"`
}

type MinimalK8sMetadata added in v0.26.0

type MinimalK8sMetadata struct {
	Name      string `json:"name" yaml:"name" hcl:"name"`
	Namespace string `json:"namespace" yaml:"namespace" hcl:"namespace"`
}

type MinimalK8sYaml added in v0.26.0

type MinimalK8sYaml struct {
	Kind     string             `json:"kind" yaml:"kind" hcl:"kind"`
	Metadata MinimalK8sMetadata `json:"metadata" yaml:"metadata" hcl:"metadata"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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