From 3b708d2237f6cd59a5933908ea268e0be0a75960 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 6 Aug 2020 19:09:02 +0200 Subject: [PATCH 1/3] version: bumping to 0.12.0 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index 87e310c..9c7f8c2 100644 --- a/version/version.go +++ b/version/version.go @@ -1,3 +1,3 @@ package version -const Number = "v0.11.0" +const Number = "v0.12.0" From 2e230c307529a18aea16dcc6a2d65da3a4ddcea8 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 6 Aug 2020 19:10:19 +0200 Subject: [PATCH 2/3] dependencies: updating github.com/Azure/azure-sdk-for-go to v45.0.0 --- go.mod | 7 ++----- go.sum | 16 ++++------------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 1b60f22..c4a5f9f 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,11 @@ module github.com/tombuildsstuff/giovanni go 1.13 require ( - github.com/Azure/azure-sdk-for-go v32.5.0+incompatible + github.com/Azure/azure-sdk-for-go v45.0.0+incompatible github.com/Azure/go-autorest/autorest v0.11.3 github.com/Azure/go-autorest/autorest/adal v0.9.0 - github.com/Azure/go-autorest/autorest/azure/cli v0.4.0 // indirect - github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect github.com/Azure/go-autorest/autorest/validation v0.3.0 - github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/uuid v1.1.1 - github.com/hashicorp/go-azure-helpers v0.4.1 + github.com/hashicorp/go-azure-helpers v0.12.0 github.com/stretchr/testify v1.3.0 ) diff --git a/go.sum b/go.sum index 4fbe39d..aa69a7e 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,5 @@ -github.com/Azure/azure-sdk-for-go v21.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v32.5.0+incompatible h1:Hn/DsObfmw0M7dMGS/c0MlVrJuGFzHzOpBWL89acR68= -github.com/Azure/azure-sdk-for-go v32.5.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-autorest v10.15.4+incompatible h1:q+DRrRdbCnkY7f2WxQBx58TwCGkEdMAK/hkZ10g0Pzk= -github.com/Azure/go-autorest v10.15.4+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/azure-sdk-for-go v45.0.0+incompatible h1:/bZYPaJLCqXeCqQqEeEIQg/p7RNafOhaVFhC6IWxZ/8= +github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.3 h1:fyYnmYujkIXUgv88D9/Wo2ybE4Zwd/TmQd5sSI5u2Ws= @@ -28,20 +25,16 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dimchansky/utfbom v1.0.0 h1:fGC2kkf4qOoKqZ4q7iIh+Vef4ubC1c38UDsEyZynZPc= -github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-azure-helpers v0.4.1 h1:aEWYW4hxAVVmxmq7nPXGK8F44A6HBXQ4m0vB1M3/20g= -github.com/hashicorp/go-azure-helpers v0.4.1/go.mod h1:lu62V//auUow6k0IykxLK2DCNW8qTmpm8KqhYVWattA= +github.com/hashicorp/go-azure-helpers v0.12.0 h1:7D0mFSyP3EfHu1ySubserIsnUWY87HMzzTWOB7ASwRU= +github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -49,7 +42,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= From 4e88bf3d74206040ecf39b57914c2b51cf2b973b Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 6 Aug 2020 19:36:16 +0200 Subject: [PATCH 3/3] fixing the code for the hashicorp/go-azure-helpers update --- example/azuread-auth/main.go | 3 +-- testhelpers/client.go | 12 +++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/example/azuread-auth/main.go b/example/azuread-auth/main.go index e72537c..b44f3ce 100644 --- a/example/azuread-auth/main.go +++ b/example/azuread-auth/main.go @@ -8,7 +8,6 @@ import ( "os" "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/adal" "github.com/hashicorp/go-azure-helpers/authentication" "github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers" ) @@ -76,7 +75,7 @@ func buildClient() (*Client, error) { return nil, err } - oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, config.TenantID) + oauthConfig, err := config.BuildOAuthConfig(env.ActiveDirectoryEndpoint) if err != nil { return nil, err } diff --git a/testhelpers/client.go b/testhelpers/client.go index a955c93..fc62836 100644 --- a/testhelpers/client.go +++ b/testhelpers/client.go @@ -10,7 +10,6 @@ import ( "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources" "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/adal" "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-helpers/authentication" ) @@ -19,7 +18,7 @@ type Client struct { ResourceGroupsClient resources.GroupsClient StorageClient storage.AccountsClient - auth *autorest.BearerAuthorizer + auth *autorest.Authorizer Environment azure.Environment } @@ -74,7 +73,7 @@ func (client Client) buildTestResources(ctx context.Context, resourceGroup, name return nil, fmt.Errorf("Error waiting for the creation of Account %q (Resource Group %q): %s", name, resourceGroup, err) } - keys, err := client.StorageClient.ListKeys(ctx, resourceGroup, name) + keys, err := client.StorageClient.ListKeys(ctx, resourceGroup, name, "") if err != nil { return nil, fmt.Errorf("Error listing keys for Storage Account %q (Resource Group %q): %s", name, resourceGroup, err) } @@ -132,7 +131,7 @@ func Build(t *testing.T) (*Client, error) { } func buildAPIClient(config *authentication.Config, env azure.Environment) (*Client, error) { - oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, config.TenantID) + oauthConfig, err := config.BuildOAuthConfig(env.ActiveDirectoryEndpoint) if err != nil { return nil, err } @@ -143,7 +142,6 @@ func buildAPIClient(config *authentication.Config, env azure.Environment) (*Clie } sender := buildSender() - armAuth, err := config.GetAuthorizationToken(sender, oauthConfig, env.ResourceManagerEndpoint) if err != nil { return nil, err @@ -156,7 +154,7 @@ func buildAPIClient(config *authentication.Config, env azure.Environment) (*Clie client := Client{ Environment: env, - auth: storageAuth, + auth: &storageAuth, } resourceGroupsClient := resources.NewGroupsClientWithBaseURI(env.ResourceManagerEndpoint, config.SubscriptionID) @@ -173,7 +171,7 @@ func buildAPIClient(config *authentication.Config, env azure.Environment) (*Clie } func (client Client) PrepareWithStorageResourceManagerAuth(input autorest.Client) autorest.Client { - return client.PrepareWithAuthorizer(input, client.auth) + return client.PrepareWithAuthorizer(input, *client.auth) } func (client Client) PrepareWithAuthorizer(input autorest.Client, authorizer autorest.Authorizer) autorest.Client {