Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ExitCodeNotFound is an exit code that indicates a Not Found error ExitCodeNotFound int = 30 // ExitCodeDuplicate is an exit code that indicates a duplicate error ExitCodeDuplicate int = 31 )
Variables ¶
This section is empty.
Functions ¶
func ResolveErrorToExitCode ¶
func Run ¶
func Run(ctx context.Context, provider ExternalProvider, env Environment) (string, error)
Types ¶
type Environment ¶
type Environment struct { Command ExecutionCommand ControllerID string PoolID string ProviderConfigFile string InstanceID string BootstrapParams params.BootstrapInstance }
func GetEnvironment ¶
func GetEnvironment() (Environment, error)
func (Environment) Validate ¶
func (e Environment) Validate() error
type ExecutionCommand ¶
type ExecutionCommand string
const ( CreateInstanceCommand ExecutionCommand = "CreateInstance" DeleteInstanceCommand ExecutionCommand = "DeleteInstance" GetInstanceCommand ExecutionCommand = "GetInstance" ListInstancesCommand ExecutionCommand = "ListInstances" StartInstanceCommand ExecutionCommand = "StartInstance" StopInstanceCommand ExecutionCommand = "StopInstance" RemoveAllInstancesCommand ExecutionCommand = "RemoveAllInstances" )
type ExternalProvider ¶
type ExternalProvider interface { // CreateInstance creates a new compute instance in the provider. CreateInstance(ctx context.Context, bootstrapParams params.BootstrapInstance) (params.Instance, error) // Delete instance will delete the instance in a provider. DeleteInstance(ctx context.Context, instance string) error // GetInstance will return details about one instance. GetInstance(ctx context.Context, instance string) (params.Instance, error) // ListInstances will list all instances for a provider. ListInstances(ctx context.Context, poolID string) ([]params.Instance, error) // RemoveAllInstances will remove all instances created by this provider. RemoveAllInstances(ctx context.Context) error // Stop shuts down the instance. Stop(ctx context.Context, instance string, force bool) error // Start boots up an instance. Start(ctx context.Context, instance string) error }
ExternalProvider defines an interface that external providers need to implement. This is very similar to the common.Provider interface, and was redefined here to decouple it, in case it may diverge from native providers.
Click to show internal directories.
Click to hide internal directories.