internal/upload/azure: add method for getting resource group location

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2022-10-24 14:10:59 +02:00 committed by Ondřej Budai
parent f2671e0074
commit 641f7a7d29

View file

@ -58,6 +58,19 @@ func (ac Client) GetResourceNameByTag(ctx context.Context, subscriptionID, resou
return *result.Values()[0].Name, nil
}
// GetResourceGroupLocation returns the location of the given resource group.
func (ac Client) GetResourceGroupLocation(ctx context.Context, subscriptionID, resourceGroup string) (string, error) {
c := resources.NewGroupsClient(subscriptionID)
c.Authorizer = ac.authorizer
group, err := c.Get(ctx, resourceGroup)
if err != nil {
return "", fmt.Errorf("retrieving resource group failed: %v", err)
}
return *group.Location, nil
}
// CreateStorageAccount creates a storage account in the specified resource
// group. The location parameter can be used to specify its location. The tag
// can be used to specify a tag attached to the account.