From fe566d24e636934d42e0d63da0008dd182c9307b Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Mon, 23 Nov 2020 18:15:15 -0300 Subject: [PATCH] Bump `azure-sdk-for-go`: v43.3.0 -> v48.2.0 Signed-off-by: Ulysses Souza --- aci/aci.go | 9 ++++++--- aci/backend.go | 2 +- aci/containers.go | 2 +- aci/convert/convert.go | 2 +- aci/convert/convert_test.go | 2 +- aci/convert/ports.go | 2 +- aci/convert/ports_test.go | 2 +- aci/convert/restartpolicy.go | 2 +- aci/convert/restartpolicy_test.go | 2 +- aci/convert/secrets.go | 2 +- aci/convert/volume.go | 10 ++++++---- aci/convert/volume_test.go | 2 +- aci/login/client.go | 8 ++++---- aci/resources.go | 5 ++--- aci/volumes.go | 2 +- cli/cmd/prune.go | 12 ++++++++---- go.mod | 2 +- go.sum | 4 ++-- 18 files changed, 40 insertions(+), 32 deletions(-) diff --git a/aci/aci.go b/aci/aci.go index ecfd6ed91..1857c2c54 100644 --- a/aci/aci.go +++ b/aci/aci.go @@ -24,7 +24,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/to" tm "github.com/buger/goterm" @@ -198,8 +198,11 @@ func deleteACIContainerGroup(ctx context.Context, aciContext store.AciContext, c if err != nil { return containerinstance.ContainerGroup{}, fmt.Errorf("cannot get container group client: %v", err) } - - return containerGroupsClient.Delete(ctx, aciContext.ResourceGroup, containerGroupName) + result, err := containerGroupsClient.Delete(ctx, aciContext.ResourceGroup, containerGroupName) + if err != nil { + return containerinstance.ContainerGroup{}, fmt.Errorf("cannot delete container group: %v", err) + } + return result.Result(containerGroupsClient) } func stopACIContainerGroup(ctx context.Context, aciContext store.AciContext, containerGroupName string) error { diff --git a/aci/backend.go b/aci/backend.go index 0aeffb091..b28863928 100644 --- a/aci/backend.go +++ b/aci/backend.go @@ -20,7 +20,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest/to" "github.com/pkg/errors" diff --git a/aci/containers.go b/aci/containers.go index 2674298ae..1b8a926db 100644 --- a/aci/containers.go +++ b/aci/containers.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/to" "github.com/pkg/errors" diff --git a/aci/convert/convert.go b/aci/convert/convert.go index 8049e6027..733547cad 100644 --- a/aci/convert/convert.go +++ b/aci/convert/convert.go @@ -25,7 +25,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest/to" "github.com/compose-spec/compose-go/types" "github.com/pkg/errors" diff --git a/aci/convert/convert_test.go b/aci/convert/convert_test.go index 5032e301c..be7a72e56 100644 --- a/aci/convert/convert_test.go +++ b/aci/convert/convert_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest/to" "github.com/compose-spec/compose-go/types" "gotest.tools/v3/assert" diff --git a/aci/convert/ports.go b/aci/convert/ports.go index 1f6987469..4bb3693b0 100644 --- a/aci/convert/ports.go +++ b/aci/convert/ports.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest/to" "github.com/pkg/errors" diff --git a/aci/convert/ports_test.go b/aci/convert/ports_test.go index 65aace342..a5c1acc8a 100644 --- a/aci/convert/ports_test.go +++ b/aci/convert/ports_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/Azure/azure-sdk-for-go/profiles/latest/containerinstance/mgmt/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest/to" "github.com/compose-spec/compose-go/types" "gotest.tools/v3/assert" diff --git a/aci/convert/restartpolicy.go b/aci/convert/restartpolicy.go index 4ae5d9c55..83cb03a2c 100644 --- a/aci/convert/restartpolicy.go +++ b/aci/convert/restartpolicy.go @@ -17,7 +17,7 @@ package convert import ( - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/pkg/errors" "github.com/docker/compose-cli/api/containers" diff --git a/aci/convert/restartpolicy_test.go b/aci/convert/restartpolicy_test.go index d37671fac..7dcf88643 100644 --- a/aci/convert/restartpolicy_test.go +++ b/aci/convert/restartpolicy_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/compose-spec/compose-go/types" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" diff --git a/aci/convert/secrets.go b/aci/convert/secrets.go index 446ca8f61..343077b65 100644 --- a/aci/convert/secrets.go +++ b/aci/convert/secrets.go @@ -23,7 +23,7 @@ import ( "path" "strings" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest/to" "github.com/pkg/errors" ) diff --git a/aci/convert/volume.go b/aci/convert/volume.go index 8bb2e9a3b..c64aa53b6 100644 --- a/aci/convert/volume.go +++ b/aci/convert/volume.go @@ -22,12 +22,14 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" - "github.com/Azure/go-autorest/autorest/to" - "github.com/compose-spec/compose-go/types" - "github.com/docker/compose-cli/aci/login" "github.com/pkg/errors" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" + "github.com/Azure/go-autorest/autorest/to" + + "github.com/compose-spec/compose-go/types" + + "github.com/docker/compose-cli/aci/login" "github.com/docker/compose-cli/errdefs" ) diff --git a/aci/convert/volume_test.go b/aci/convert/volume_test.go index 1a8fea972..76e53c7aa 100644 --- a/aci/convert/volume_test.go +++ b/aci/convert/volume_test.go @@ -21,7 +21,7 @@ import ( "strconv" "testing" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/go-autorest/autorest/to" "github.com/compose-spec/compose-go/types" "github.com/stretchr/testify/mock" diff --git a/aci/login/client.go b/aci/login/client.go index 6b49c7328..635288b3e 100644 --- a/aci/login/client.go +++ b/aci/login/client.go @@ -21,7 +21,7 @@ import ( "github.com/Azure/azure-sdk-for-go/profiles/2019-03-01/resources/mgmt/resources" "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/subscription/mgmt/subscription" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" "github.com/Azure/go-autorest/autorest" "github.com/pkg/errors" @@ -100,11 +100,11 @@ func NewGroupsClient(subscriptionID string) (resources.GroupsClient, error) { } // NewContainerClient get client to manipulate containers -func NewContainerClient(subscriptionID string) (containerinstance.ContainerClient, error) { - containerClient := containerinstance.NewContainerClient(subscriptionID) +func NewContainerClient(subscriptionID string) (containerinstance.ContainersClient, error) { + containerClient := containerinstance.NewContainersClient(subscriptionID) err := setupClient(&containerClient.Client) if err != nil { - return containerinstance.ContainerClient{}, err + return containerinstance.ContainersClient{}, err } return containerClient, nil } diff --git a/aci/resources.go b/aci/resources.go index d3619a600..8732dbc65 100644 --- a/aci/resources.go +++ b/aci/resources.go @@ -57,9 +57,8 @@ func (cs *aciResourceService) Prune(ctx context.Context, request resources.Prune _, err := deleteACIContainerGroup(ctx, cs.aciContext, *containerGroup.Name) multierr = multierror.Append(multierr, err) } - if err == nil { - deleted = append(deleted, *containerGroup.Name) - } + + deleted = append(deleted, *containerGroup.Name) } result.DeletedIDs = deleted result.Summary = fmt.Sprintf("Total CPUs reclaimed: %.2f, total memory reclaimed: %.2f GB", cpus, mem) diff --git a/aci/volumes.go b/aci/volumes.go index 242e38659..d323dc1b3 100644 --- a/aci/volumes.go +++ b/aci/volumes.go @@ -24,7 +24,7 @@ import ( "github.com/pkg/errors" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2019-12-01/containerinstance" "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" "github.com/Azure/go-autorest/autorest/to" diff --git a/cli/cmd/prune.go b/cli/cmd/prune.go index 9fb23ff66..5b6710d44 100644 --- a/cli/cmd/prune.go +++ b/cli/cmd/prune.go @@ -57,11 +57,15 @@ func runPrune(ctx context.Context, opts pruneOpts) error { } result, err := c.ResourceService().Prune(ctx, resources.PruneRequest{Force: opts.force, DryRun: opts.dryRun}) - if opts.dryRun { - fmt.Println("Resources that would be deleted:") - } else { - fmt.Println("Deleted resources:") + if err != nil { + return err } + deletedResourcesMsg := "Deleted resources:" + if opts.dryRun { + deletedResourcesMsg = "Resources that would be deleted:" + } + fmt.Println(deletedResourcesMsg) + for _, id := range result.DeletedIDs { fmt.Println(id) } diff --git a/go.mod b/go.mod index a99959d13..815e82600 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ replace golang.org/x/sys => golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 require ( github.com/AlecAivazis/survey/v2 v2.2.3 - github.com/Azure/azure-sdk-for-go v43.3.0+incompatible + github.com/Azure/azure-sdk-for-go v48.2.0+incompatible github.com/Azure/azure-storage-file-go v0.8.0 github.com/Azure/go-autorest/autorest v0.11.12 github.com/Azure/go-autorest/autorest/adal v0.9.5 diff --git a/go.sum b/go.sum index 42bfee68d..af8bf1e1c 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ github.com/AlecAivazis/survey/v2 v2.2.3/go.mod h1:9FJRdMdDm8rnT+zHVbvQT2RTSTLq0T github.com/Azure/azure-pipeline-go v0.2.1 h1:OLBdZJ3yvOn2MezlWvbrBMTEUQC72zAftRZOMdj5HYo= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v43.3.0+incompatible h1:o0G4JAsOzeVJEwU0Ud9bh+lUHPUc0GkFENJ02dk51Uo= -github.com/Azure/azure-sdk-for-go v43.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v48.2.0+incompatible h1:+t2P1j1r5N6lYgPiiz7ZbEVZFkWjVe9WhHbMm0gg8hw= +github.com/Azure/azure-sdk-for-go v48.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-storage-file-go v0.8.0 h1:OX8DGsleWLUE6Mw4R/OeWEZMvsTIpwN94J59zqKQnTI= github.com/Azure/azure-storage-file-go v0.8.0/go.mod h1:3w3mufGcMjcOJ3w+4Gs+5wsSgkT7xDwWWqMMIrXtW4c= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=