cloudapi: make location optional in Azure Upload Options

Providing the `location` is no longer required for Azure Upload Options.
If it is not provided, the implementation determines the location from
the provided Resource Group. This will make the API nicer for any
client, since they won't need to provide redundant information.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2022-10-24 14:13:55 +02:00 committed by Ondřej Budai
parent 4df3b0ca03
commit 1af01ad135
3 changed files with 123 additions and 118 deletions

View file

@ -470,9 +470,13 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
if err != nil {
return HTTPError(ErrorJSONUnMarshallingError)
}
rgLocation := ""
if azureUploadOptions.Location != nil {
rgLocation = *azureUploadOptions.Location
}
t := target.NewAzureImageTarget(&target.AzureImageTargetOptions{
TenantID: azureUploadOptions.TenantId,
Location: azureUploadOptions.Location,
Location: rgLocation,
SubscriptionID: azureUploadOptions.SubscriptionId,
ResourceGroup: azureUploadOptions.ResourceGroup,
})