Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.34k stars 1.98k forks source link

[BUG] Java SDK - Private DNS - Delete virtual link doesn't work #39088

Open AlexanderAshitkin opened 7 months ago

AlexanderAshitkin commented 7 months ago

Describe the bug Bug in implementation - parameters mismatch. com.azure.resourcemanager.privatedns.implementation.VirtualNetworkLinksImpl#deleteByResourceGroupNameAsync calls underlying com.azure.resourcemanager.privatedns.fluent.VirtualNetworkLinksClient#deleteAsync with mismatched parameters:

Exception or Stack Trace etag value appears in the URL instead of the expected VNL name image

    Suppressed: java.lang.Exception: #block terminated with an error
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:100)
        at reactor.core.publisher.Mono.block(Mono.java:1742)
        at com.azure.resourcemanager.privatedns.implementation.VirtualNetworkLinksImpl.deleteById(VirtualNetworkLinksImpl.java:56)

To Reproduce Use Azure Java SDK to delete an existing virtual network link in a privatedns zone

Code Snippet

                    privateDnsZone
                            .virtualNetworkLinks()
                            .deleteById(virtualNetworkLink.id(), virtualNetworkLink.etag());

Expected behavior API works properly. The link is deleted.

Screenshots See above

Setup (please complete the following information):

Additional context NA

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

XiaofeiCao commented 7 months ago

@AlexanderAshitkin

Thanks for reporting. This should be an implementation bug. Would you try following code to see if this works for you?

privateDnsZone.update()
    .withoutVirtualNetworkLink(virtualNetworkLink.name(), virtualNetworkLink.etag())
    .apply();