Azure / Azure/azure-libraries-for-java
Please consistently support .WithExistingXXX(*string resourceId*)
- Dominant language
- Java
- Stars
- 97
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
_From @TimLovellSmith on August 7, 2017 19:51_
Some Fluent APIs only give you a single overload of WithExistingXXX, such as the WithExistingSubnet(INetwork network, string subnetName) for defining ILoadBalancer private frontend which requires you to pass an INetwork object. Could these 'WithExisting' please be consistently implemented with an overload that works with just the resource ID?
```
loadBalancerDefWithFrontEnd = loadBalancerDefBlank
.DefinePrivateFrontend("frontend")
.WithExistingSubnet(vnet, subnetName)
.WithPrivateIPAddressStatic(StaticIP)
.Attach();
```
Not only is it sometimes simpler to implement with a resourceId string, requiring INetwork causes worse reliability as it requires extra GET calls to ARM to get resource state as the easiest way in order to satisfy these API signatures.
And finally, in some advanced RBAC scenarios, the authentication model required to do GET IFoo and then WithExisting(IFoo) is actually an added difficulty, because 'foo' another subscription. In the worst case you might even *fail* authentication on the GET even though the PUT request could in theory succeed (due to specific RBAC permissions granted you)!
(BTW this feedback is based on "Microsoft.Azure.Management.Network.Fluent" version="1.1.2")
_Copied from original issue: Azure/azure-sdk-for-net#3552_
Contributor guide
Assessment
This issue has not been assessed yet.