Documentation ¶
Index ¶
- func ListOrgSyslogDrains(cliConnection plugin.CliConnection, log Logger, w io.Writer) error
- func ListSpaceSyslogDrains(cliConnection plugin.CliConnection, log Logger, w io.Writer) error
- func ListSyslogDrains(cliConnection plugin.CliConnection, log Logger, w io.Writer) error
- type Logger
- type SyslogDrainPlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListOrgSyslogDrains ¶
func ListSpaceSyslogDrains ¶
func ListSyslogDrains ¶
Types ¶
type Logger ¶
type Logger interface { Fatalf(format string, args ...interface{}) Printf(format string, args ...interface{}) }
Logger is used for outputting results and errors
type SyslogDrainPlugin ¶
type SyslogDrainPlugin struct{}
SyslogDrainPlugin is the struct implementing the interface defined by the core CLI. It can be found at "code.cloudfoundry.org/cli/plugin/plugin.go"
func (*SyslogDrainPlugin) GetMetadata ¶
func (c *SyslogDrainPlugin) GetMetadata() plugin.PluginMetadata
GetMetadata must be implemented as part of the plugin interface defined by the core CLI.
GetMetadata() returns a PluginMetadata struct. The first field, Name, determines the name of the plugin which should generally be without spaces. If there are spaces in the name a user will need to properly quote the name during uninstall otherwise the name will be treated as separate arguments. The second value is a slice of Command structs. Our slice only contains one Command Struct, but could contain any number of them. The first field Name defines the command `cf basic-plugin-command` once installed into the CLI. The second field, HelpText, is used by the core CLI to display help information to the user in the core commands `cf help`, `cf`, or `cf -h`.
func (*SyslogDrainPlugin) Run ¶
func (c *SyslogDrainPlugin) Run(cliConnection plugin.CliConnection, args []string)
Run must be implemented by any plugin because it is part of the plugin interface defined by the core CLI.
Run(....) is the entry point when the core CLI is invoking a command defined by a plugin. The first parameter, plugin.CliConnection, is a struct that can be used to invoke cli commands. The second parameter, args, is a slice of strings. args[0] will be the name of the command, and will be followed by any additional arguments a cli user typed in.
Any error handling should be handled with the plugin itself (this means printing user facing errors). The CLI will exit 0 if the plugin exits 0 and will exit 1 should the plugin exits nonzero.