sharedaction

package
v6.34.0+incompatible Latest Latest
Warning

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

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

Documentation

Overview

Package sharedaction handles all operations that do not require a cloud controller

Index

Constants

View Source
const (
	DefaultFolderPermissions      = 0755
	DefaultArchiveFilePermissions = 0744
	MaxResourceMatchChunkSize     = 1000
)

Variables

View Source
var DefaultIgnoreLines = []string{
	".cfignore",
	".DS_Store",
	".git",
	".gitignore",
	".hg",
	".svn",
	"_darcs",
	"manifest.yaml",
	"manifest.yml",
}

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Config Config
}

Actor handles all shared actions

func NewActor

func NewActor(config Config) *Actor

NewActor returns an Actor with default settings

func (Actor) CheckTarget

func (actor Actor) CheckTarget(targetedOrganizationRequired bool, targetedSpaceRequired bool) error

CheckTarget confirms that the user is logged in. Optionally it will also check if an organization and space are targeted.

func (Actor) CommandInfoByName

func (Actor) CommandInfoByName(commandList interface{}, commandName string) (CommandInfo, error)

CommandInfoByName returns the help information for a particular commandName in the commandList.

func (Actor) CommandInfos

func (Actor) CommandInfos(commandList interface{}) map[string]CommandInfo

CommandInfos returns a slice of CommandInfo that only fills in the Name and Description for all the commands in commandList

func (Actor) ExecuteSecureShell

func (actor Actor) ExecuteSecureShell(sshClient SecureShellClient, sshOptions SSHOptions) error

func (Actor) GatherArchiveResources

func (actor Actor) GatherArchiveResources(archivePath string) ([]Resource, error)

GatherArchiveResources returns a list of resources for an archive.

func (Actor) GatherDirectoryResources

func (actor Actor) GatherDirectoryResources(sourceDir string) ([]Resource, error)

GatherDirectoryResources returns a list of resources for a directory.

func (Actor) ZipArchiveResources

func (actor Actor) ZipArchiveResources(sourceArchivePath string, filesToInclude []Resource) (string, error)

ZipArchiveResources zips an archive and a sorted (based on full path/filename) list of resources and returns the location. On Windows, the filemode for user is forced to be readable and executable.

func (Actor) ZipDirectoryResources

func (actor Actor) ZipDirectoryResources(sourceDir string, filesToInclude []Resource) (string, error)

ZipDirectoryResources zips a directory and a sorted (based on full path/filename) list of resources and returns the location. On Windows, the filemode for user is forced to be readable and executable.

type CommandFlag

type CommandFlag struct {
	// Short is the short form of the flag
	Short string

	// Long is the long form of the flag
	Long string

	// Description is the description of the flag
	Description string

	// Default is the flag's default value
	Default string
}

CommandFlag contains the help details of a command's flag

type CommandInfo

type CommandInfo struct {
	// Name is the command name
	Name string

	// Description is the command description
	Description string

	// Alias is the command alias
	Alias string

	// Usage is the command usage string, may contain examples and flavor text
	Usage string

	// RelatedCommands is a list of commands related to the command
	RelatedCommands []string

	// Flags contains the list of flags for this command
	Flags []CommandFlag

	// Environment is a list of environment variables specific for this command
	Environment []EnvironmentVariable
}

CommandInfo contains the help details of a command

type Config

type Config interface {
	AccessToken() string
	BinaryName() string
	HasTargetedOrganization() bool
	HasTargetedSpace() bool
	RefreshToken() string
	Verbose() (bool, []string)
}

Config a way of getting basic CF configuration

type EnvironmentVariable

type EnvironmentVariable struct {
	Name         string
	Description  string
	DefaultValue string
}

Environment contains env vars specific for this command

type LocalPortForward

type LocalPortForward clissh.LocalPortForward

type Resource

type Resource struct {
	Filename string      `json:"fn"`
	Mode     os.FileMode `json:"mode"`
	SHA1     string      `json:"sha1"`
	Size     int64       `json:"size"`
}

type SSHOptions

type SSHOptions struct {
	Commands              []string
	Username              string
	Passcode              string
	Endpoint              string
	HostKeyFingerprint    string
	SkipHostValidation    bool
	SkipRemoteExecution   bool
	TTYOption             TTYOption
	LocalPortForwardSpecs []LocalPortForward
}

type SecureShellClient

type SecureShellClient interface {
	Connect(username string, passcode string, sshEndpoint string, sshHostKeyFingerprint string, skipHostValidation bool) error
	Close() error
	InteractiveSession(commands []string, terminalRequest clissh.TTYRequest) error
	LocalPortForward(localPortForwardSpecs []clissh.LocalPortForward) error
	Wait() error
}

type TTYOption

type TTYOption clissh.TTYRequest
const (
	RequestTTYAuto TTYOption = iota
	RequestTTYNo
	RequestTTYYes
	RequestTTYForce
)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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