go-azure-sdk icon indicating copy to clipboard operation
go-azure-sdk copied to clipboard

DataProtection / API Version 2023-05-01 deletedbackupinstances.UndeleteThenPoll fails with 404 after the item gets undeleted

Open mbfrahry opened this issue 1 year ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Service Used

Data Protection

API Versions Used

2023-05-01

Description

I am running UndeleteThenPoll and it looks like the command errors with 404 after the specified item is undeleted.

I believe that 404 should actually be our success trigger for when the Undelete finishes as the item no longer exists in that deletedbackupinstances api and should now show up in the backupinstances api.

References

No response

mbfrahry avatar Feb 16 '24 22:02 mbfrahry

Presumably this is a duplicate of https://github.com/hashicorp/go-azure-sdk/issues/740?

tombuildsstuff avatar Feb 19 '24 07:02 tombuildsstuff

I don't believe so. The issue you linked is on first poll. This one is when the operation succeeds. UnDelete seems to just be a Delete

mbfrahry avatar Feb 20 '24 18:02 mbfrahry

@mbfrahry if you've got them handy, mind posting the Request/Responses?

tombuildsstuff avatar Feb 20 '24 18:02 tombuildsstuff

Here is the Request

:authority: management.azure.com
:method: POST
:path: /subscriptions/XXXX-XXXX-XXXX/resourceGroups/acctest-dataprotection-240220010123990118/providers/Microsoft.DataProtection/backupVaults/acctest-dataprotection-vault-240220010123990118/deletedBackupInstances/acctest-dbi-240220010123990118/undelete?api-version=2023-05-01
:scheme: https
authorization: bearer-token
content-type: application/json; charset=utf-8
user-agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 deletedbackupinstances/2023-05-01)
content-length: 0
accept-encoding: gzip

And the response

:status: 200
cache-control: no-cache
pragma: no-cache
expires: -1
x-content-type-options: nosniff
x-ms-ratelimit-remaining-subscription-resource-requests: 1999
x-ms-request-id: e0286909-e544-4035-aa8e-95df30c6bc1d
x-ms-correlation-request-id: e0286909-e544-4035-aa8e-95df30c6bc1d
x-ms-routing-request-id: WESTUS2:20240220T190455Z:e0286909-e544-4035-aa8e-95df30c6bc1d
strict-transport-security: max-age=31536000; includeSubDomains
x-cache: CONFIG_NOCACHE
x-msedge-ref: Ref A: A873213E615F497B95221F26EED32CDF Ref B: CO6AA3150220029 Ref C: 2024-02-20T19:04:53Z
date: Tue, 20 Feb 2024 19:04:54 GMT
content-length: 0

And then we do a Get:

:authority: management.azure.com
:method: GET
:path: /subscriptions/XXXX-XXX-XXX/resourceGroups/acctest-dataprotection-240220010123990118/providers/Microsoft.DataProtection/backupVaults/acctest-dataprotection-vault-240220010123990118/deletedBackupInstances/acctest-dbi-240220010123990118?api-version=2023-05-01
:scheme: https
content-type: application/json; charset=utf-8
user-agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 deletedbackupinstances/2023-05-01)
accept: application/json; charset=utf-8; IEEE754Compatible=false
odata-maxversion: 4.0
odata-version: 4.0
authorization: bearer-token
accept-encoding: gzip

And that returns

:status: 404
cache-control: no-cache
pragma: no-cache
content-length: 218
content-type: application/json
content-language: en-US
expires: -1
x-ms-ratelimit-remaining-subscription-resource-requests: 1999
x-content-type-options: nosniff
x-ms-error-code: UserErrorGenericResourceNotFound
x-ms-request-id: 7a01ad74-47c9-4b5b-86af-b8140191e190
x-ms-correlation-request-id: 7a01ad74-47c9-4b5b-86af-b8140191e190
x-ms-routing-request-id: WESTUS:20240220T190506Z:7a01ad74-47c9-4b5b-86af-b8140191e190
strict-transport-security: max-age=31536000; includeSubDomains
x-cache: CONFIG_NOCACHE
x-msedge-ref: Ref A: B3EBB63BD7BE414E8490D3C5E3A7EBD7 Ref B: CO6AA3150218011 Ref C: 2024-02-20T19:05:05Z
date: Tue, 20 Feb 2024 19:05:05 GMT

{"error":{"code":"UserErrorGenericResourceNotFound","message":"Azure resource does not exist. Please make sure required resources exist. If the issue persists, contact Microsoft support.","target":null,"details":null}}

So I guess that does make it like the other issue 🤔 except we aren't waiting for it to be created as subsequent Get calls will always return resource not found since it's moved from deletedbackupinstances to backupinstances

mbfrahry avatar Feb 20 '24 19:02 mbfrahry

tl;dr 404 should be treated as success for UndeleteThenPoll

mbfrahry avatar Feb 20 '24 19:02 mbfrahry

Ah fun, so it appears to be a Delete LRO masquerading as Regular LRO? We'll likely need to update the Regular vs Delete LRO logic to check if the URI contains delete to handle this, I suspect.

tombuildsstuff avatar Feb 21 '24 17:02 tombuildsstuff