github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+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.CurrentSpace, error)
    25  	GetOrg(string) (plugin_models.OrgSummary, error)
    26  	GetSpace(string) (plugin_models.Space, error)
    27  	GetSpaces() ([]plugin_models.Space, error)
    28  	IsLoggedIn() (bool, error)
    29  	IsSkipSSLValidation() (bool, error)
    30  	Username() (string, error)
    31  }
    32  
    33  type VersionType struct {
    34  	Major int
    35  	Minor int
    36  	Build int
    37  }
    38  
    39  type PluginMetadata struct {
    40  	Name           string
    41  	Version        VersionType
    42  	LibraryVersion VersionType
    43  	MinCliVersion  VersionType
    44  	Commands       []Command
    45  }
    46  
    47  type Usage struct {
    48  	Usage   string
    49  	Options map[string]string
    50  }
    51  
    52  type Command struct {
    53  	Name         string
    54  	Alias        string
    55  	HelpText     string
    56  	UsageDetails Usage //Detail usage to be displayed in `cf help <cmd>`
    57  }