Documentation ¶
Overview ¶
Package sharedaction handles all operations that do not require a cloud controller
Index ¶
- Constants
- Variables
- func GetStreamingLogs(appGUID string, client LogCacheClient) (<-chan LogMessage, <-chan error, context.CancelFunc)
- type Actor
- func (actor Actor) CheckTarget(targetedOrganizationRequired bool, targetedSpaceRequired bool) error
- func (Actor) CommandInfoByName(commandList interface{}, commandName string) (CommandInfo, error)
- func (Actor) CommandInfos(commandList interface{}) map[string]CommandInfo
- func (actor Actor) CreateArchive(bitsPath string, resources []Resource) (io.ReadCloser, int64, error)
- func (actor Actor) ExecuteSecureShell(sshClient SecureShellClient, sshOptions SSHOptions) error
- func (actor Actor) GatherArchiveResources(archivePath string) ([]Resource, error)
- func (actor Actor) GatherDirectoryResources(sourceDir string) ([]Resource, error)
- func (actor Actor) IsLoggedIn() bool
- func (actor Actor) IsOrgTargeted() bool
- func (actor Actor) IsSpaceTargeted() bool
- func (Actor) ReadArchive(archivePath string) (io.ReadCloser, int64, error)
- func (actor Actor) RequireCurrentUser() (string, error)
- func (actor Actor) RequireTargetedOrg() (string, error)
- func (actor Actor) ZipArchiveResources(sourceArchivePath string, filesToInclude []Resource) (string, error)
- func (actor Actor) ZipDirectoryResources(sourceDir string, filesToInclude []Resource) (string, error)
- type CommandFlag
- type CommandInfo
- type Config
- type EnvironmentVariable
- type HasExamples
- type HasUsage
- type LocalPortForward
- type LogCacheClient
- type LogMessage
- type LogMessages
- type Resource
- type SSHOptions
- type SecureShellClient
- type TTYOption
- type V3Resource
Constants ¶
const ( CommonCommandsIndent string = " " AllCommandsIndent string = " " CommandIndent string = " " )
const ( StagingLog = "STG" RecentLogsLines = 1000 )
const ( DefaultFolderPermissions = 0755 DefaultArchiveFilePermissions = 0744 MaxResourceMatchChunkSize = 1000 )
Variables ¶
var DefaultIgnoreLines = []string{
".cfignore",
".DS_Store",
".git",
".gitignore",
".hg",
".svn",
"_darcs",
"manifest.yaml",
"manifest.yml",
}
Functions ¶
func GetStreamingLogs ¶
func GetStreamingLogs(appGUID string, client LogCacheClient) (<-chan LogMessage, <-chan error, context.CancelFunc)
Types ¶
type Actor ¶
type Actor struct {
Config Config
}
Actor handles all shared actions
func (Actor) CheckTarget ¶
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) CreateArchive ¶
func (Actor) ExecuteSecureShell ¶
func (actor Actor) ExecuteSecureShell(sshClient SecureShellClient, sshOptions SSHOptions) error
func (Actor) GatherArchiveResources ¶
GatherArchiveResources returns a list of resources for an archive.
func (Actor) GatherDirectoryResources ¶
GatherDirectoryResources returns a list of resources for a directory.
func (Actor) IsLoggedIn ¶
IsLoggedIn checks whether a user has authenticated with CF
func (Actor) IsOrgTargeted ¶
IsOrgTargeted determines whether an org is being targeted by the CLI
func (Actor) IsSpaceTargeted ¶
IsSpaceTargeted determines whether a space is being targeted by the CLI
func (Actor) ReadArchive ¶
func (Actor) RequireCurrentUser ¶
func (Actor) RequireTargetedOrg ¶
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 Usage string // Examples is the command examples string Examples 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 CurrentUserName() (string, error) HasTargetedOrganization() bool HasTargetedSpace() bool RefreshToken() string TargetedOrganizationName() string Verbose() (bool, []string) }
Config a way of getting basic CF configuration
type EnvironmentVariable ¶
EnvironmentVariable contains env vars specific for this command
type HasExamples ¶
type HasExamples interface {
Examples() string
}
HasExamples is an interface that commands may implement if they want to define their examples text in a Examples() method, which gives them more flexibility than a struct tag.
type HasUsage ¶
type HasUsage interface {
Usage() string
}
HasUsage is an interface that commands may implement if they want to define their usage text in a Usage() method, which gives them more flexibility than a struct tag.
type LocalPortForward ¶
type LocalPortForward clissh.LocalPortForward
type LogCacheClient ¶
type LogCacheClient interface { Read( ctx context.Context, sourceID string, start time.Time, opts ...logcache.ReadOption, ) ([]*loggregator_v2.Envelope, error) }
LogCacheClient is a client for getting logs.
type LogMessage ¶
type LogMessage struct {
// contains filtered or unexported fields
}
func GetRecentLogs ¶
func GetRecentLogs(appGUID string, client LogCacheClient) ([]LogMessage, error)
func NewLogMessage ¶
func (LogMessage) Message ¶
func (log LogMessage) Message() string
func (LogMessage) SourceInstance ¶
func (log LogMessage) SourceInstance() string
func (LogMessage) SourceType ¶
func (log LogMessage) SourceType() string
func (LogMessage) Staging ¶
func (log LogMessage) Staging() bool
func (LogMessage) Timestamp ¶
func (log LogMessage) Timestamp() time.Time
func (LogMessage) Type ¶
func (log LogMessage) Type() string
type LogMessages ¶
type LogMessages []*LogMessage
func (LogMessages) Len ¶
func (lm LogMessages) Len() int
func (LogMessages) Less ¶
func (lm LogMessages) Less(i, j int) bool
func (LogMessages) Swap ¶
func (lm LogMessages) Swap(i, j int)
type Resource ¶
type Resource struct { Filename string `json:"fn"` Mode os.FileMode `json:"mode"` SHA1 string `json:"sha1"` Size int64 `json:"size"` }
func (Resource) ToV3Resource ¶
func (r Resource) ToV3Resource() V3Resource
ToV3Resource converts a sharedaction Resource to V3 Resource format
type SSHOptions ¶
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
type V3Resource ¶
func (V3Resource) ToV2Resource ¶
func (r V3Resource) ToV2Resource() Resource
ToV2Resource converts a V3 Resource to V2 Resource format