Open neil-yechenwei opened 2 years ago
@neil-yechenwei this is because the Status Codes in the Swagger appear to be defined incorrectly
It's defined both as an immediate response (non-LRO) with the return object you're expecting and as a Long Running Operation (without one) - as such we treat this as an LRO.
It's surprising that that API doesn't have a "GetAccess" method? Can we file an API issue about that, since that's how every other API works with an LRO (Create the thing, then retrieve the thing elsewhere)?
With regards to working around that, for now you can manually unmarshal the HTTP response returned from the last LRO Poll:
result, err := c.GrantAccess(ctx, id, input)
if err != nil {
return fmt.Errorf("performing GrantAccess: %+v", err)
}
if err := result.Poller.PollUntilDone(); err != nil {
return fmt.Errorf("polling after GrantAccess: %+v", err)
}
var out disks.AccessUri
if err := json.Unmarshal(result.Poller.HttpResponse, &out); err != nil {
return fmt.Errorf("unmarshaling response from LRO response: %+v", err
}
// at which point `out.AccessSAS` should be populated
Same issue: https://github.com/hashicorp/pandora/issues/2828
azurerm_managed_disk_sas_token would retrieve the AccessUri.AccessSAS from the result returned by service API. But after tested, seems we cannot get the AccessUri.AccessSAS via disks package generated by Pandora. Could you double confirm whether it's expected? Thanks.
The result returned by API: https://github.com/Azure/azure-rest-api-specs/blob/c34f3432002f53b5a8b0a0da5a975974007be152/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2022-03-02/disk.json#L395