github.com/rakutentech/cli@v6.12.5-0.20151006231303-24468b65536e+incompatible/plugin/plugin.go (about) 1 package plugin 2 3 import "github.com/cloudfoundry/cli/plugin/models" 4 5 /** 6 Command interface needs to be implemented for a runnable plugin of `cf` 7 **/ 8 type Plugin interface { 9 Run(cliConnection CliConnection, args []string) 10 GetMetadata() PluginMetadata 11 } 12 13 /** 14 List of commands avaiable to CliConnection variable passed into run 15 **/ 16 type CliConnection interface { 17 CliCommandWithoutTerminalOutput(args ...string) ([]string, error) 18 CliCommand(args ...string) ([]string, error) 19 GetCurrentOrg() (plugin_models.Organization, error) 20 GetCurrentSpace() (plugin_models.Space, error) 21 Username() (string, error) 22 UserGuid() (string, error) 23 UserEmail() (string, error) 24 IsLoggedIn() (bool, error) 25 IsSSLDisabled() (bool, error) 26 HasOrganization() (bool, error) 27 HasSpace() (bool, error) 28 ApiEndpoint() (string, error) 29 ApiVersion() (string, error) 30 HasAPIEndpoint() (bool, error) 31 LoggregatorEndpoint() (string, error) 32 DopplerEndpoint() (string, error) 33 AccessToken() (string, error) 34 GetApp(string) (plugin_models.GetAppModel, error) 35 GetApps() ([]plugin_models.GetAppsModel, error) 36 GetOrgs() ([]plugin_models.GetOrgs_Model, error) 37 GetSpaces() ([]plugin_models.GetSpaces_Model, error) 38 GetOrgUsers(string, ...string) ([]plugin_models.GetOrgUsers_Model, error) 39 GetSpaceUsers(string, string) ([]plugin_models.GetSpaceUsers_Model, error) 40 GetServices() ([]plugin_models.GetServices_Model, error) 41 GetService(string) (plugin_models.GetService_Model, error) 42 GetOrg(string) (plugin_models.GetOrg_Model, error) 43 GetSpace(string) (plugin_models.GetSpace_Model, error) 44 } 45 46 type VersionType struct { 47 Major int 48 Minor int 49 Build int 50 } 51 52 type PluginMetadata struct { 53 Name string 54 Version VersionType 55 MinCliVersion VersionType 56 Commands []Command 57 } 58 59 type Usage struct { 60 Usage string 61 Options map[string]string 62 } 63 64 type Command struct { 65 Name string 66 Alias string 67 HelpText string 68 UsageDetails Usage //Detail usage to be displayed in `cf help <cmd>` 69 }