13964: InstanceTags type
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Thu, 23 Aug 2018 20:38:28 +0000 (16:38 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Wed, 9 Jan 2019 21:28:16 +0000 (16:28 -0500)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

lib/dispatchcloud/azure.go
lib/dispatchcloud/provider.go

index dcfcf0564bbfea379ee80566fe1732af08a319d1..21e8d28d8317cd76b0b3ebe6bbce9ad50aab64b5 100644 (file)
@@ -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 {
index efaf2a6c3372828bce14d34409058d17b9027297..3322575dcdb04339d2426798bfdfdf94b7491617 100644 (file)
@@ -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)
 }