github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/plugin/v7/plugin.go (about) 1 // +build V7 2 3 package v7 4 5 import plugin_models "code.cloudfoundry.org/cli/plugin/v7/models" 6 7 /** 8 Command interface needs to be implemented for a runnable plugin of `cf` 9 **/ 10 type Plugin interface { 11 Run(cliConnection CliConnection, args []string) 12 GetMetadata() PluginMetadata 13 } 14 15 /** 16 List of commands available to CliConnection variable passed into run 17 **/ 18 type CliConnection interface { 19 AccessToken() (string, error) 20 ApiEndpoint() (string, error) 21 GetApp(string) (plugin_models.DetailedApplicationSummary, error) 22 GetApps() ([]plugin_models.Application, error) 23 GetCurrentOrg() (plugin_models.Org, error) 24 GetCurrentSpace() (plugin_models.Space, error) 25 GetOrg(string) (plugin_models.OrgSummary, error) 26 IsLoggedIn() (bool, error) 27 IsSkipSSLValidation() (bool, error) 28 Username() (string, error) 29 } 30 31 type VersionType struct { 32 Major int 33 Minor int 34 Build int 35 } 36 37 type PluginMetadata struct { 38 Name string 39 Version VersionType 40 LibraryVersion VersionType 41 MinCliVersion VersionType 42 Commands []Command 43 } 44 45 type Usage struct { 46 Usage string 47 Options map[string]string 48 } 49 50 type Command struct { 51 Name string 52 Alias string 53 HelpText string 54 UsageDetails Usage //Detail usage to be displayed in `cf help <cmd>` 55 }