From: Peter Amstutz Date: Thu, 23 Aug 2018 20:38:28 +0000 (-0400) Subject: 13964: InstanceTags type X-Git-Tag: 1.4.0~174^2~16 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/137f46c8040d22e70e4b17a495e4171c59a8033f 13964: InstanceTags type Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/lib/dispatchcloud/azure.go b/lib/dispatchcloud/azure.go index dcfcf0564b..21e8d28d83 100644 --- a/lib/dispatchcloud/azure.go +++ b/lib/dispatchcloud/azure.go @@ -245,7 +245,7 @@ func (az *AzureProvider) setup(azcfg AzureProviderConfig, arvcfg arvados.Cluster func (az *AzureProvider) Create(ctx context.Context, instanceType arvados.InstanceType, imageId ImageID, - newTags map[string]string) (Instance, error) { + newTags InstanceTags) (Instance, error) { name, err := randutil.String(15, "abcdefghijklmnopqrstuvwxyz0123456789") if err != nil { @@ -537,7 +537,7 @@ func (ai *AzureInstance) InstanceType() arvados.InstanceType { return ai.instanceType } -func (ai *AzureInstance) SetTags(ctx context.Context, newTags map[string]string) error { +func (ai *AzureInstance) SetTags(ctx context.Context, newTags InstanceTags) error { tags := make(map[string]*string) for k, v := range ai.vm.Tags { @@ -562,7 +562,7 @@ func (ai *AzureInstance) SetTags(ctx context.Context, newTags map[string]string) return nil } -func (ai *AzureInstance) GetTags(ctx context.Context) (map[string]string, error) { +func (ai *AzureInstance) GetTags(ctx context.Context) (InstanceTags, error) { tags := make(map[string]string) for k, v := range ai.vm.Tags { diff --git a/lib/dispatchcloud/provider.go b/lib/dispatchcloud/provider.go index efaf2a6c33..3322575dcd 100644 --- a/lib/dispatchcloud/provider.go +++ b/lib/dispatchcloud/provider.go @@ -32,7 +32,7 @@ type QuotaError interface { error } -type InstanceTag string +type InstanceTags map[string]string type InstanceID string type ImageID string @@ -43,9 +43,9 @@ type Instance interface { // Configured Arvados instance type InstanceType() arvados.InstanceType // Get tags - GetTags(context.Context) (map[string]string, error) + GetTags(context.Context) (InstanceTags, error) // Replace tags with the given tags - SetTags(context.Context, map[string]string) error + SetTags(context.Context, InstanceTags) error // Shut down the node Destroy(context.Context) error // SSH server hostname or IP address, or empty string if unknown pending creation. @@ -53,6 +53,6 @@ type Instance interface { } type Provider interface { - Create(context.Context, arvados.InstanceType, ImageID, map[string]string) (Instance, error) + Create(context.Context, arvados.InstanceType, ImageID, InstanceTags) (Instance, error) Instances(context.Context) ([]Instance, error) }