Documentation ¶
Index ¶
- Variables
- func FindRoot(path string) (string, error)
- func GetAPIClient() (*http.Client, error)
- func Login() error
- type Environment
- type Project
- func (p *Project) EnvironmentVariable(env *Environment, service string, name string) (string, error)
- func (p *Project) Fetch() error
- func (p *Project) FetchEnvironments() error
- func (p *Project) GetEnvironment(name string) *Environment
- func (p *Project) PlatformRelationships(env *Environment, service string) (map[string]interface{}, error)
- func (p *Project) PlatformVariables(env *Environment, service string) (map[string]interface{}, error)
- func (p *Project) SSHCertficiate() ([]byte, error)
- func (p *Project) SSHCommand(env *Environment, service string, command string) ([]byte, error)
- func (p *Project) SSHDownload(env *Environment, service string, path string) (string, error)
- func (p *Project) SSHTerminal(env *Environment, service string) error
- func (p Project) SSHUrl(env *Environment, service string) string
- func (p Project) SSHUser(env *Environment, service string) string
- func (p Project) SSHWorkerURL(env *Environment, service string, worker string) string
- func (p *Project) Variables(env *Environment, service string) (map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrProjectNotFound is an error returned when a Platform.sh project is not found. ErrProjectNotFound = errors.New("platform.sh project not found") // ErrBadAPIResponse is an error returned when an unexpected response is returned from the Platform.sh API. ErrBadAPIResponse = errors.New("platform.sh api returned unexpected response") // ErrMissingAPIToken is an error returned when the Platform.sh API token is missing. ErrMissingAPIToken = errors.New("platform.sh api token not found, please use the platformsh:login command to generate it") // ErrInvalidEnvironment is an error returned when an invalid Platform.sh environment is specified. ErrInvalidEnvironment = errors.New("invalid platform.sh environment") // ErrEnvironmentNotFound is an error returned when a specified Platform.sh environment is not found. ErrEnvironmentNotFound = errors.New("platform.sh environment not found") )
Functions ¶
func GetAPIClient ¶
GetAPIClient returns the HTTP client used for API transactions.
Types ¶
type Environment ¶
type Environment struct { Name string `json:"name"` Title string `json:"title"` IsMain bool `json:"is_main"` Status string `json:"status"` MachineName string `json:"machine_name"` EdgeHostname string `json:"edge_hostname"` Links struct { SSHApp struct { HREF string `json:"href"` } `json:"pf:ssh:app"` SSH struct { HREF string `json:"href"` } `json:"ssh"` PublicURL struct { HREF string `json:"href"` } `json:"public-url"` } `json:"_links"` }
Environment defines a Platform.sh environment.
type Project ¶
type Project struct { LocalPath string Host string ID string Title string Environments []Environment // contains filtered or unexported fields }
Project contains information about a Platform.sh project.
func LoadProjectFromPath ¶
LoadProjectFromPath returns information about a Platform.sh from a path.
func (*Project) EnvironmentVariable ¶
func (p *Project) EnvironmentVariable(env *Environment, service string, name string) (string, error)
EnvironmentVariable returns the value of the given environment variable.
func (*Project) FetchEnvironments ¶
FetchEnvironments populates environments list.
func (*Project) GetEnvironment ¶
func (p *Project) GetEnvironment(name string) *Environment
GetEnvironment returns environment matching given name.
func (*Project) PlatformRelationships ¶
func (p *Project) PlatformRelationships(env *Environment, service string) (map[string]interface{}, error)
PlatformRelationships returns the value of then PLATFORM_RELATIONSHIPS environment variable.
func (*Project) PlatformVariables ¶
func (p *Project) PlatformVariables(env *Environment, service string) (map[string]interface{}, error)
PlatformVariables returns the value of then PLATFORM_VARIABLES environment variable.
func (*Project) SSHCertficiate ¶
SSHCertficiate returns the ssh certficiate to be used with Platform.sh.
func (*Project) SSHCommand ¶
SSHCommand sends a command to given Platform.sh environment over SSH and returns the output.
func (*Project) SSHDownload ¶
SSHDownload downloads given remote file local and returns path to downloaded file.
func (*Project) SSHTerminal ¶
func (p *Project) SSHTerminal(env *Environment, service string) error
SSHTerminal creates an interactive SSH terminal.
func (Project) SSHUrl ¶
func (p Project) SSHUrl(env *Environment, service string) string
SSHUrl returns the SSH url for the environment.
func (Project) SSHUser ¶
func (p Project) SSHUser(env *Environment, service string) string
SSHUser returns the SSH username for given environment and service.
func (Project) SSHWorkerURL ¶
func (p Project) SSHWorkerURL(env *Environment, service string, worker string) string
SSHWorkerURL returns the SSH url for a worker in the environment.