commands

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name    string
	Version string
	Changed string
	Public  bool
}

App app struct

type BaseCommand

type BaseCommand struct {
	Name          string
	CliConnection plugin.CliConnection
}

BaseCommand base command for all commands

func (*BaseCommand) Dispose added in v1.4.2

func (c *BaseCommand) Dispose(name string)

Dispose default dispose method which may be overriden in more specific commands

func (*BaseCommand) DisposeBase added in v1.4.2

func (c *BaseCommand) DisposeBase(_ string)

DisposeBase dispose command

func (*BaseCommand) GetContext

func (c *BaseCommand) GetContext() (Context, error)

GetContext initializes and retrieves the Context

func (*BaseCommand) GetOrg

GetOrg gets the current org name from the CLI connection

func (*BaseCommand) GetSpace

func (c *BaseCommand) GetSpace() (plugin_models.Space, error)

GetSpace gets the current space name from the CLI connection

func (*BaseCommand) GetUsername

func (c *BaseCommand) GetUsername() (string, error)

GetUsername gets the username from the CLI connection

func (*BaseCommand) Initialize

func (c *BaseCommand) Initialize(name string, cliConnection plugin.CliConnection) error

Initialize default initialization method which may be overriden in more specific commands

func (*BaseCommand) InitializeBase added in v1.4.2

func (c *BaseCommand) InitializeBase(name string, cliConnection plugin.CliConnection) error

InitializeBase initializes the command with the specified name and CLI connection.

type Command

type Command interface {
	GetPluginCommand() plugin.Command
	Initialize(name string, cliConnection plugin.CliConnection) error
	Execute(args []string) ExecutionStatus
	Dispose(name string)
}

Command is an interface that should be implemented by all commands

type Context

type Context struct {
	Username string
	Org      string
	OrgID    string
	Space    string
	SpaceID  string
}

Context holding the username, Org and Space of the current used

type DeleteCommand added in v1.1.0

type DeleteCommand struct {
	HTML5Command
}

DeleteCommand delete service instances and all dependent service keys

func (*DeleteCommand) DeleteServiceInstances added in v1.1.0

func (c *DeleteCommand) DeleteServiceInstances(appHostGUIDs []string, appHostNames []string, deleteDestinations bool, destinationInstance string) ExecutionStatus

DeleteServiceInstances delete service instances by app-host-ids, including all dependent service keys

func (*DeleteCommand) DeleteServiceInstancesContent added in v1.1.0

func (c *DeleteCommand) DeleteServiceInstancesContent(appHostGUIDs []string, appHostNames []string) ExecutionStatus

DeleteServiceInstancesContent delete service instances content by app-host-ids

func (*DeleteCommand) Execute added in v1.1.0

func (c *DeleteCommand) Execute(args []string) ExecutionStatus

Execute executes plugin command

func (*DeleteCommand) GetPluginCommand added in v1.1.0

func (c *DeleteCommand) GetPluginCommand() plugin.Command

GetPluginCommand returns the plugin command details

type DestinationContext added in v1.4.0

type DestinationContext struct {
	// Pointer to destination service
	DestinationService *models.CFService
	// Pointer to 'lite' plan of destination service
	DestinationServicePlan *models.CFServicePlan
	// List of destination service instances
	DestinationServiceInstances []models.CFServiceInstance
	// Pointer to destination service instance created during context initialization
	DestinationServiceInstance *models.CFServiceInstance
	// Pointer to destination service key created during context initialization
	DestinationServiceInstanceKey *models.CFServiceKey
	// Access token of destination service key
	DestinationServiceInstanceKeyToken string
}

DestinationContext Destination context struct

type ExecutionStatus

type ExecutionStatus int

ExecutionStatus command execution status

const (
	// Success command executed sucessfully
	Success ExecutionStatus = 0
	// Failure command failed to execute
	Failure ExecutionStatus = 1
)

func (ExecutionStatus) ToInt

func (status ExecutionStatus) ToInt() int

ToInt returns integer representation of command execution status

type GetCommand

type GetCommand struct {
	HTML5Command
}

GetCommand fetches the HTML5 application file contents

func (*GetCommand) Execute

func (c *GetCommand) Execute(args []string) ExecutionStatus

Execute executes plugin command

func (*GetCommand) GetAppHostFilesContents

func (c *GetCommand) GetAppHostFilesContents(output string, appHostNameOrGUID string, isName bool) ExecutionStatus

GetAppHostFilesContents get files contents of all applications of app-host-id

func (*GetCommand) GetApplicationFilesContents

func (c *GetCommand) GetApplicationFilesContents(output string, appName string, appVersion string, appHostNameOrGUID string, isName bool) ExecutionStatus

GetApplicationFilesContents get application files contents

func (*GetCommand) GetFileContents

func (c *GetCommand) GetFileContents(output string, filePath string, appHostNameOrGUID string, isName bool) ExecutionStatus

GetFileContents get file contents

func (*GetCommand) GetPluginCommand

func (c *GetCommand) GetPluginCommand() plugin.Command

GetPluginCommand returns the plugin command details

type HTML5Command

type HTML5Command struct {
	BaseCommand
}

HTML5Command base struct for HTML5 repository operations

func (*HTML5Command) CleanDestinationContext added in v1.4.0

func (c *HTML5Command) CleanDestinationContext(destinationContext DestinationContext) error

CleanDestinationContext clean destination context

func (*HTML5Command) CleanHTML5Context

func (c *HTML5Command) CleanHTML5Context(html5Context HTML5Context) error

CleanHTML5Context clean-up temporary service keys and service instances created to form HTML5 context

func (*HTML5Command) Dispose added in v1.4.2

func (c *HTML5Command) Dispose(name string)

Dispose disposes command and saves cache if needed

func (*HTML5Command) GetDestinationContext added in v1.4.0

func (c *HTML5Command) GetDestinationContext(context Context, destinationInstanceName string) (DestinationContext, error)

GetDestinationContext get destination context

func (*HTML5Command) GetHTML5Context

func (c *HTML5Command) GetHTML5Context(context Context) (HTML5Context, error)

GetHTML5Context get HTML5 context

func (*HTML5Command) Initialize added in v1.4.2

func (c *HTML5Command) Initialize(name string, cliConnection plugin.CliConnection) (err error)

Initialize initializes the command with the specified name and CLI connection

type HTML5Context

type HTML5Context struct {
	// Name of html5-apps-repo service in marketplace
	ServiceName string
	// All available CF services
	Services []models.CFService
	// Pointer to html5-apps-repo service
	HTML5AppsRepoService *models.CFService
	// List of html5-apps-repo service plans
	HTML5AppsRepoServicePlans []models.CFServicePlan
	// Pointer to html5-apps-repo app-runtime service plan
	HTML5AppRuntimeServicePlan *models.CFServicePlan
	// Service instances of html5-apps-repo app-runtime service plan
	HTML5AppRuntimeServiceInstances []models.CFServiceInstance
	// Pointer to html5-apps-repo app-runtime service instance
	HTML5AppRuntimeServiceInstance *models.CFServiceInstance
	// Service key of html5-apps-repo app-runtime service plan
	HTML5AppRuntimeServiceInstanceKeys []models.CFServiceKey
	// Pointer to html5-apps-repo app-runtime service key
	HTML5AppRuntimeServiceInstanceKey *models.CFServiceKey
	// Access token of html5-apps-repo app-runtime service key
	HTML5AppRuntimeServiceInstanceKeyToken string
}

HTML5Context HTML5 context struct

func (*HTML5Context) GetRuntimeURL added in v1.4.6

func (ctx *HTML5Context) GetRuntimeURL(runtime string) string

GetRuntimeURL base runtime URL for HTML5 applications

type InfoCommand added in v1.1.0

type InfoCommand struct {
	HTML5Command
}

InfoCommand get service instance information dependent service keys

func (*InfoCommand) Execute added in v1.1.0

func (c *InfoCommand) Execute(args []string) ExecutionStatus

Execute executes plugin command

func (*InfoCommand) GetPluginCommand added in v1.1.0

func (c *InfoCommand) GetPluginCommand() plugin.Command

GetPluginCommand returns the plugin command details

func (*InfoCommand) GetServiceInfos added in v1.1.0

func (c *InfoCommand) GetServiceInfos(appHostGUIDs []string, appHostNames []string) ExecutionStatus

GetServiceInfos get html5-apps-repo service app-host plan info

type InfoRecord added in v1.1.0

type InfoRecord struct {
	AppHostName string
	AppHostGUID string
	SizeLimit   int
	Used        int
	Status      string
	ChangedOn   string
}

InfoRecord service information record

type ListCommand

type ListCommand struct {
	HTML5Command
}

ListCommand prints the list of HTML5 applications deployed using multiple instances of html5-apps-repo service app-host plan

func (*ListCommand) Execute

func (c *ListCommand) Execute(args []string) ExecutionStatus

Execute executes plugin command

func (*ListCommand) GetPluginCommand

func (c *ListCommand) GetPluginCommand() plugin.Command

GetPluginCommand returns the plugin command details

func (*ListCommand) ListAppApps

func (c *ListCommand) ListAppApps(appName string, showUrls bool) ExecutionStatus

ListAppApps get list of HTML5 applications available in CF application context

func (*ListCommand) ListAppFiles

func (c *ListCommand) ListAppFiles(appName string, appVersion string, appHostNameOrID string, isName bool) ExecutionStatus

ListAppFiles get list of application files

func (*ListCommand) ListApps added in v1.4.0

func (c *ListCommand) ListApps(appHostGUID *string) ExecutionStatus

ListApps get list of applications for given app-host-id or current space

func (*ListCommand) ListDestinationApps added in v1.4.0

func (c *ListCommand) ListDestinationApps(destinationInstance string, showUrls bool, runtime string) ExecutionStatus

ListDestinationApps get list of HTML5 applications available via destinations

type Model

type Model struct {
	Services []Service
}

Model model struct

type PushCommand

type PushCommand struct {
	HTML5Command
}

PushCommand fetches the HTML5 application file contents

func (*PushCommand) CreateHTML5Destination added in v1.4.0

func (c *PushCommand) CreateHTML5Destination(context Context, credentials models.CFCredentials, destinationInstance string) error

CreateHTML5Destination cretes destination with XSUAA credentials, "sap.cloud.service" and "app-host-id"

func (*PushCommand) Execute

func (c *PushCommand) Execute(args []string) ExecutionStatus

Execute executes plugin command

func (*PushCommand) GetPluginCommand

func (c *PushCommand) GetPluginCommand() plugin.Command

GetPluginCommand returns the plugin command details

func (*PushCommand) PushHTML5Applications

func (c *PushCommand) PushHTML5Applications(appPaths []string, appHostGUID string, redeploy bool, destination bool, businessServiceName string, destinationInstance string, runtime string) ExecutionStatus

PushHTML5Applications push HTML5 applications to app-host-id

type Service

type Service struct {
	UpdatedAt string
	Name      string
	GUID      string
	Apps      []App
	Prefix    string
}

Service service struct

Jump to

Keyboard shortcuts

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