createServicePush

package
v0.0.0-...-60089aa Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateServicePush

type CreateServicePush struct {
	Parser         serviceManifest.ParserInterface
	ArgProcessor   cspArguments.Interface
	ServiceCreator serviceCreator.CreatorInterface
	Exit           ExitInterface
}

CreateServicePush is the struct implementing the interface defined by the core CLI. It can be found at "code.cloudfoundry.org/cli/plugin/plugin.go"

func Create

func Create() *CreateServicePush

Create instantiates a new CreateServicePush struct and returns it as a pointer

func (*CreateServicePush) GetMetadata

func (c *CreateServicePush) 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 seperate 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 (*CreateServicePush) Run

func (c *CreateServicePush) 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 paramter, 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.

type ExitHandler

type ExitHandler struct {
	Exit ExitInterface
}

ExitHandler is the struct holding the exit hander

func NewExitHandler

func NewExitHandler() *ExitHandler

NewExitHandler creates the default ExitHandler

func (*ExitHandler) HandleError

func (eh *ExitHandler) HandleError()

HandleError is the method to deal with errors on exit.

func (*ExitHandler) HandleOK

func (eh *ExitHandler) HandleOK()

HandleOK is the method to deal with exiting the plugin while it was ok to

type ExitInterface

type ExitInterface interface {
	HandleError()
	HandleOK()
}

ExitInterface is an interface to an Exit Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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