| 1 |
package testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/ |
| 2 |
|
| 3 |
import ( |
| 4 |
"contextscip-go gomod github.com/golang/go/src go1.13 context/" |
| 5 |
"fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 6 |
"osscip-go gomod github.com/golang/go/src go1.13 os/" |
| 7 |
"testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 8 |
"timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 9 |
|
| 10 |
"github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resourcesscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources`/" |
| 11 |
"github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/" |
| 12 |
"github.com/Azure/go-autorest/autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/" |
| 13 |
"github.com/Azure/go-autorest/autorest/azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/" |
| 14 |
"github.com/hashicorp/go-azure-helpers/authenticationscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/" |
| 15 |
) |
| 16 |
|
| 17 |
type Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client# struct { |
| 18 |
ResourceGroupsClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#ResourceGroupsClient. resourcesscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources`/.GroupsClientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources`/GroupsClient# |
| 19 |
StorageClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#StorageClient. storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.AccountsClientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/AccountsClient# |
| 20 |
|
| 21 |
authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#auth. *autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Authorizerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Authorizer# |
| 22 |
Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment. azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.Environmentscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/Environment# |
| 23 |
} |
| 24 |
|
| 25 |
func toPointeredStringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/toPointeredString().(input string) *string { |
| 26 |
return &input |
| 27 |
} |
| 28 |
|
| 29 |
type TestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources# struct { |
| 30 |
ResourceGroupscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#ResourceGroup. string |
| 31 |
StorageAccountNamescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#StorageAccountName. string |
| 32 |
StorageAccountKeyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#StorageAccountKey. string |
| 33 |
} |
| 34 |
|
| 35 |
func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#) BuildTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#BuildTestResources().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, resourceGroup, name string, kind storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.Kindscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/Kind#) (*TestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#, error) { |
| 36 |
return client.buildTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#buildTestResources().(ctx, resourceGroup, name, kind, false, "") |
| 37 |
} |
| 38 |
func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#) BuildTestResourcesWithHnsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#BuildTestResourcesWithHns().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, resourceGroup, name string, kind storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.Kindscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/Kind#) (*TestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#, error) { |
| 39 |
return client.buildTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#buildTestResources().(ctx, resourceGroup, name, kind, true, "") |
| 40 |
} |
| 41 |
func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#) BuildTestResourcesWithSkuscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#BuildTestResourcesWithSku().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, resourceGroup, name string, kind storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.Kindscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/Kind#, sku storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.SkuNamescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/SkuName#) (*TestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#, error) { |
| 42 |
return client.buildTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#buildTestResources().(ctx, resourceGroup, name, kind, false, sku) |
| 43 |
} |
| 44 |
func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#) buildTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#buildTestResources().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, resourceGroup, name string, kind storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.Kindscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/Kind#, enableHns bool, sku storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.SkuNamescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/SkuName#) (*TestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#, error) { |
| 45 |
location := toPointeredStringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/toPointeredString().(osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ARM_TEST_LOCATION")) |
| 46 |
_, err := client.ResourceGroupsClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#ResourceGroupsClient..CreateOrUpdatescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-04-01/resources`/GroupsClient#CreateOrUpdate().(ctx, resourceGroup, resourcesscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources`/.Groupscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources`/Group#{ |
| 47 |
Locationscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-04-01/resources`/Group#Location.: location, |
| 48 |
}) |
| 49 |
if err != nil { |
| 50 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error creating Resource Group %q: %s", resourceGroup, err) |
| 51 |
} |
| 52 |
|
| 53 |
props := storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.AccountPropertiesCreateParametersscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/AccountPropertiesCreateParameters#{} |
| •54 |
if kind == storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.BlobStoragescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/BlobStorage. { |
| 55 |
props.AccessTierscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountPropertiesCreateParameters#AccessTier. = storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.Hotscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/Hot. |
| 56 |
} |
| 57 |
if enableHns { |
| 58 |
props.IsHnsEnabledscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountPropertiesCreateParameters#IsHnsEnabled. = &enableHns |
| 59 |
} |
| 60 |
if sku == "" { |
| •61 |
sku = storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.StandardLRSscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/StandardLRS. |
| 62 |
} |
| 63 |
|
| 64 |
future, err := client.StorageClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#StorageClient..Createscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountsClient#Create().(ctx, resourceGroup, name, storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.AccountCreateParametersscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/AccountCreateParameters#{ |
| 65 |
Locationscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountCreateParameters#Location.: location, |
| 66 |
Skuscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountCreateParameters#Sku.: &storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.Skuscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/Sku#{ |
| 67 |
Namescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/Sku#Name.: sku, |
| 68 |
}, |
| 69 |
Kindscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountCreateParameters#Kind.: kind, |
| 70 |
AccountPropertiesCreateParametersscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountCreateParameters#AccountPropertiesCreateParameters.: &props, |
| 71 |
}) |
| 72 |
|
| 73 |
if err != nil { |
| 74 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error creating Account %q (Resource Group %q): %s", name, resourceGroup, err) |
| 75 |
} |
| 76 |
|
| 77 |
err = future.WaitForCompletionRefscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/FutureAPI#WaitForCompletionRef().(ctx, client.StorageClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#StorageClient..Clientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/BaseClient#Client.) |
| 78 |
if err != nil { |
| 79 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error waiting for the creation of Account %q (Resource Group %q): %s", name, resourceGroup, err) |
| 80 |
} |
| 81 |
|
| 82 |
keys, err := client.StorageClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#StorageClient..ListKeysscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountsClient#ListKeys().(ctx, resourceGroup, name, "") |
| 83 |
if err != nil { |
| 84 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error listing keys for Storage Account %q (Resource Group %q): %s", name, resourceGroup, err) |
| 85 |
} |
| 86 |
|
| 87 |
// sure we could poll to get around the inconsistency, but where's the fun in that |
| 88 |
timescip-go gomod github.com/golang/go/src go1.13 time/.Sleepscip-go gomod github.com/golang/go/src go1.13 time/Sleep().(5 * timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 89 |
|
| 90 |
accountKeys := *keys.Keysscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountListKeysResult#Keys. |
| 91 |
return &TestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#{ |
| 92 |
ResourceGroupscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#ResourceGroup.: resourceGroup, |
| 93 |
StorageAccountNamescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#StorageAccountName.: name, |
| 94 |
StorageAccountKeyscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/TestResources#StorageAccountKey.: *(accountKeys[0]).Valuescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountKey#Value., |
| 95 |
}, nil |
| 96 |
} |
| 97 |
|
| 98 |
func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#) DestroyTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#DestroyTestResources().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, resourceGroup, name string) error { |
| 99 |
_, err := client.StorageClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#StorageClient..Deletescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/AccountsClient#Delete().(ctx, resourceGroup, name) |
| 100 |
if err != nil { |
| 101 |
return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error deleting Account %q (Resource Group %q): %s", name, resourceGroup, err) |
| 102 |
} |
| 103 |
|
| •104 |
future, err := client.ResourceGroupsClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#ResourceGroupsClient..Deletescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-04-01/resources`/GroupsClient#Delete().(ctx, resourceGroup, "") |
| 105 |
if err != nil { |
| 106 |
return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error deleting Resource Group %q: %s", resourceGroup, err) |
| 107 |
} |
| 108 |
|
| 109 |
err = future.WaitForCompletionRefscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/FutureAPI#WaitForCompletionRef().(ctx, client.ResourceGroupsClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#ResourceGroupsClient..Clientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-04-01/resources`/BaseClient#Client.) |
| 110 |
if err != nil { |
| 111 |
return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error waiting for deletion of Resource Group %q: %s", resourceGroup, err) |
| 112 |
} |
| 113 |
|
| 114 |
return nil |
| 115 |
} |
| 116 |
|
| 117 |
func Buildscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Build().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) (*Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#, error) { |
| 118 |
if osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ACCTEST") == "" { |
| 119 |
t.Skipscip-go gomod github.com/golang/go/src go1.13 testing/common#Skip().("Skipping as `ACCTEST` hasn't been set") |
| 120 |
} |
| 121 |
|
| 122 |
authClient, env, err := buildAuthClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/buildAuthClient().() |
| 123 |
if err != nil { |
| 124 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error building Auth Client: %s", err) |
| 125 |
} |
| 126 |
|
| 127 |
if env == nil { |
| 128 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Environment was nil: %s", err) |
| 129 |
} |
| 130 |
|
| 131 |
apiClient, err := buildAPIClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/buildAPIClient().(authClient, *env) |
| 132 |
if err != nil { |
| 133 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error building API Client: %s", err) |
| 134 |
} |
| 135 |
|
| 136 |
return apiClient, nil |
| 137 |
} |
| 138 |
|
| 139 |
func buildAPIClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/buildAPIClient().(config *authenticationscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/.Configscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#, env azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.Environmentscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/Environment#) (*Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#, error) { |
| 140 |
oauthConfig, err := config.BuildOAuthConfigscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#BuildOAuthConfig().(env.ActiveDirectoryEndpointscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/Environment#ActiveDirectoryEndpoint.) |
| 141 |
if err != nil { |
| 142 |
return nil, err |
| 143 |
} |
| 144 |
|
| 145 |
// OAuthConfigForTenant returns a pointer, which can be nil. |
| 146 |
if oauthConfig == nil { |
| 147 |
return nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Unable to configure OAuthConfig for tenant %s", config.TenantIDscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#TenantID.) |
| 148 |
} |
| 149 |
|
| 150 |
sender := buildSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/buildSender().() |
| 151 |
armAuth, err := config.GetAuthorizationTokenscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#GetAuthorizationToken().(sender, oauthConfig, env.ResourceManagerEndpointscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/Environment#ResourceManagerEndpoint.) |
| 152 |
if err != nil { |
| 153 |
return nil, err |
| 154 |
} |
| 155 |
|
| 156 |
storageAuth, err := config.GetAuthorizationTokenscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#GetAuthorizationToken().(sender, oauthConfig, "https://storage.azure.com/") |
| 157 |
if err != nil { |
| 158 |
return nil, err |
| 159 |
} |
| 160 |
|
| 161 |
client := Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#{ |
| 162 |
Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment.: env, |
| 163 |
authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#auth.: &storageAuth, |
| 164 |
} |
| 165 |
|
| 166 |
resourceGroupsClient := resourcesscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources`/.NewGroupsClientWithBaseURIscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources`/NewGroupsClientWithBaseURI().(env.ResourceManagerEndpointscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/Environment#ResourceManagerEndpoint., config.SubscriptionIDscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#SubscriptionID.) |
| 167 |
resourceGroupsClient.Clientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-04-01/resources`/BaseClient#Client. = client.PrepareWithStorageResourceManagerAuthscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithStorageResourceManagerAuth().(resourceGroupsClient.Clientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-04-01/resources`/BaseClient#Client.) |
| 168 |
resourceGroupsClient.Authorizerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#Authorizer. = armAuth |
| 169 |
client.ResourceGroupsClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#ResourceGroupsClient. = resourceGroupsClient |
| 170 |
|
| 171 |
storageClient := storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.NewAccountsClientWithBaseURIscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/NewAccountsClientWithBaseURI().(env.ResourceManagerEndpointscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/Environment#ResourceManagerEndpoint., config.SubscriptionIDscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#SubscriptionID.) |
| 172 |
storageClient.Clientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/BaseClient#Client. = client.PrepareWithStorageResourceManagerAuthscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithStorageResourceManagerAuth().(storageClient.Clientscip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2022-05-01/storage`/BaseClient#Client.) |
| 173 |
storageClient.Authorizerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#Authorizer. = armAuth |
| 174 |
client.StorageClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#StorageClient. = storageClient |
| 175 |
|
| 176 |
return &client, nil |
| 177 |
} |
| 178 |
|
| 179 |
func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#) PrepareWithStorageResourceManagerAuthscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithStorageResourceManagerAuth().(input autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Clientscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#) autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Clientscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client# { |
| 180 |
return client.PrepareWithAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithAuthorizer().(input, *client.authscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#auth.) |
| 181 |
} |
| 182 |
|
| 183 |
func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#) PrepareWithAuthorizerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithAuthorizer().(input autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Clientscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#, authorizer autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Authorizerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Authorizer#) autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Clientscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client# { |
| 184 |
input.Authorizerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#Authorizer. = authorizer |
| 185 |
input.Senderscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#Sender. = buildSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/buildSender().() |
| 186 |
input.SkipResourceProviderRegistrationscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#SkipResourceProviderRegistration. = true |
| 187 |
return input |
| 188 |
} |
| 189 |
|
| 190 |
func buildAuthClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/buildAuthClient().() (*authenticationscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/.Configscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#, *azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.Environmentscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/Environment#, error) { |
| 191 |
builder := &authenticationscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/.Builderscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#{ |
| 192 |
SubscriptionIDscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#SubscriptionID.: osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ARM_SUBSCRIPTION_ID"), |
| 193 |
ClientIDscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#ClientID.: osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ARM_CLIENT_ID"), |
| 194 |
ClientSecretscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#ClientSecret.: osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ARM_CLIENT_SECRET"), |
| 195 |
TenantIDscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#TenantID.: osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ARM_TENANT_ID"), |
| 196 |
Environmentscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#Environment.: osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ARM_ENVIRONMENT"), |
| 197 |
|
| 198 |
// Feature Toggles |
| 199 |
SupportsClientSecretAuthscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#SupportsClientSecretAuth.: true, |
| 200 |
} |
| 201 |
|
| 202 |
c, err := builder.Buildscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Builder#Build().() |
| 203 |
if err != nil { |
| 204 |
return nil, nil, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error building AzureRM Client: %s", err) |
| 205 |
} |
| 206 |
|
| 207 |
env, err := authenticationscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/.DetermineEnvironmentscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/DetermineEnvironment().(c.Environmentscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/Config#Environment.) |
| 208 |
if err != nil { |
| 209 |
return nil, nil, err |
| 210 |
} |
| 211 |
|
| 212 |
return c, env, nil |
| 213 |
} |