gcsupload

package
v0.0.0-...-fe50fa5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package gcsupload uploads artifacts to a GCS path resolved from job configuration

Index

Constants

View Source
const (
	// JSONConfigEnvVar is the environment variable that
	// utilities expect to find a full JSON configuration
	// in when run.
	JSONConfigEnvVar = "GCSUPLOAD_OPTIONS"
)

Variables

This section is empty.

Functions

func BindOptions

func BindOptions(options *Options, fs *flag.FlagSet)

BindOptions adds flags to the FlagSet that populate the GCS upload options struct given.

func Encode

func Encode(options Options) (string, error)

Encode will encode the set of options in the format that is expected for the configuration environment variable

Types

type Options

type Options struct {
	// Items are files or directories to upload
	Items []string `json:"items,omitempty"`

	// SubDir is appended to the GCS path
	SubDir string `json:"sub_dir,omitempty"`

	*kube.GCSConfiguration

	// GcsCredentialsFile is the path to the JSON
	// credentials for pushing to GCS
	GcsCredentialsFile string `json:"gcs_credentials_file,omitempty"`
	DryRun             bool   `json:"dry_run"`
	// contains filtered or unexported fields
}

Options exposes the configuration necessary for defining where in GCS an upload will land.

func NewOptions

func NewOptions() *Options

NewOptions returns an empty Options with no nil fields

func (*Options) BindOptions

func (o *Options) BindOptions(flags *flag.FlagSet)

BindOptions binds flags to options

func (*Options) Complete

func (o *Options) Complete(args []string)

Complete internalizes command line arguments

func (*Options) ConfigVar

func (o *Options) ConfigVar() string

ConfigVar exposes the environment variable used to store serialized configuration

func (*Options) LoadConfig

func (o *Options) LoadConfig(config string) error

LoadConfig loads options from serialized config

func (Options) Run

func (o Options) Run(spec *downwardapi.JobSpec, extra map[string]gcs.UploadFunc) error

Run will upload files to GCS as prescribed by the options. Any extra files can be passed as a parameter and will have the prefix prepended to their destination in GCS, so the caller can operate relative to the base of the GCS dir.

func (*Options) Validate

func (o *Options) Validate() error

Validate ensures that the set of options are self-consistent and valid

Jump to

Keyboard shortcuts

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