13964: Can successfully create a VM, list existing VMs
[arvados.git] / lib / dispatchcloud / provider.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package dispatchcloud
6
7 import (
8         "context"
9
10         "git.curoverse.com/arvados.git/sdk/go/arvados"
11 )
12
13 type InstanceTag string
14 type InstanceID string
15 type ImageID string
16
17 // instance is implemented by the provider-specific instance types.
18 type Instance interface {
19         // String typically returns the cloud-provided instance ID.
20         String() string
21         // Cloud provider's "instance type" ID. Matches a key in
22         // configured arvados.InstanceTypeMap.
23         ProviderType() string
24         // Get tags
25         GetTags() ([]InstanceTag, error)
26         // Replace tags with the given tags
27         SetTags([]InstanceTag) error
28         // Shut down the node
29         Destroy(ctx context.Context) error
30         // SSH server hostname or IP address, or empty string if unknown pending creation.
31         Address() string
32 }
33
34 type Provider interface {
35         Create(context.Context, arvados.InstanceType, ImageID, []InstanceTag) (Instance, error)
36         Instances(context.Context) ([]Instance, error)
37 }