-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DeleteOptions on Public Ip Address (issue#38806) #38987
Conversation
API change check APIView has identified API level changes in this PR and created following API reviews. com.azure.resourcemanager:azure-resourcemanager-compute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is too many issue in the PR.
Please book a meeting next week to discuss.
for (NicIpConfiguration ipConfiguration : this.nicIPConfigurations.values()) { | ||
if (ipConfigName.equals(ipConfiguration.name())) { | ||
specifiedIPConfig = (NicIpConfigurationImpl) ipConfiguration; | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is just ipConfigurations().get(ipConfigName)
?
if (specifiedIPConfig == null) { | ||
specifiedIPConfig = prepareNewNicIPConfiguration(ipConfigName); | ||
withIPConfiguration(specifiedIPConfig); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we don't want to modify anything in a getter API.
* @param ipConfigName the name of th specified ip configuration | ||
* @return the specified IP configuration of this network interface | ||
*/ | ||
NicIpConfiguration specifiedIPConfiguration(String ipConfigName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to ipConfigurations().get(ipoConfigName)
?
DeleteOptions deleteOptions, PublicIpAddress publicIpAddress, String ipConfigName) { | ||
this.specifiedIPConfiguration(ipConfigName).withExistingPublicIpAddress(publicIpAddress); | ||
this.specifiedIPConfiguration(ipConfigName).withPrivateIpVersion(publicIpAddress.version()); | ||
this.publicIPAddressDeleteOption = deleteOptions; | ||
return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation seems to differ from the interface declaration?
In interface, it's Update delete option for specified public ip address of specified network interface ip config
, but here it seems to attach an existing PublicIpAddress to the NetworkInterface.
/** | ||
* Update delete option for the primary public ip address of the primary network interface. | ||
* | ||
* @param deleteOptions what happens to the public IP address when the VM using it is deleted | ||
* @return the next stage of the update | ||
*/ | ||
Update withPrimaryNicPrimaryPipDeleteOption(DeleteOptions deleteOptions); | ||
|
||
/** | ||
* Update delete option for the primary public ip address of the specified network interface. | ||
* | ||
* @param deleteOptions what happens to the public IP address when the VM using it is deleted | ||
* @param nicIds resource Ids of the specified network interface | ||
* @return the next stage of the update | ||
*/ | ||
Update withSpecifiedNicPrimaryPIpDeleteOption(DeleteOptions deleteOptions, String... nicIds); | ||
|
||
/** | ||
* Update delete option for the specified public ip address of the specified network interface. | ||
* | ||
* @param deleteOptions what happens to the public IP address when the VM using it is deleted | ||
* @param nicId resource id of the specified network interfac | ||
* @param ipConfigIds resource Ids of specified network interface ip configs | ||
* @return the next stage of the update | ||
*/ | ||
Update withSpecifiedNicSpecifiedPIpDeleteOption(DeleteOptions deleteOptions, String nicId, String... ipConfigIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether user really needs these APIs.
IMHO, two types are needed:
withPublicIPAddressDeleteOptions(DeleteOptions deleteOptions)
to update all attached PublicIpAddress'es deleteOptionwithPublicIPAddressDeleteOption(PublicIpAddress(/String) publicIpAddress(id))
, like what user specifies in the creation flow.
.withNewResourceGroup(rgName) | ||
.withNewPrimaryNetwork("10.0.0.0/28") | ||
.withPrimaryPrivateIPAddressDynamic() | ||
.withExistingPrimaryPublicIPAddress(publicIPAddress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do .withExistingPrimaryPublicIPAddress(publicIPAddress, deleteOptions)
?
.withAdminPassword(password()) | ||
.withNewDataDisk(127) | ||
.withSize(VirtualMachineSizeTypes.fromString("Standard_D2a_v4")) | ||
.withPublicIPAddressDeleteOptions(DeleteOptions.DELETE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether we should use this in creation flow. I think it's for update flow.
.withPrivateIpAddressDynamic() | ||
.withExistingPublicIpAddress(publicIPAddress2) | ||
.attach() | ||
.withPublicIPAddressDeleteOptions(DeleteOptions.DELETE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update flow.
.withExistingPrimaryNetwork(vnet) | ||
.withSubnet(subnetName) | ||
.withPrimaryPrivateIPAddressDynamic() | ||
.withExistingPrimaryPublicIPAddress(publicIPAddress1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withExistingPrimaryPublicIPAddress(publicIPAddress1, deleteOption)
?
.withExistingNetwork(vnet) | ||
.withSubnet(subnetName) | ||
.withPrivateIpAddressDynamic() | ||
.withExistingPublicIpAddress(publicIPAddress2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withExistingPublicIpAddress(publicIPAddress2, deleteOption)
?
* @param deleteOptions the delete options for primary network interfaces | ||
* @return the next stage of the definition | ||
*/ | ||
WithCreate withPublicIPAddressDeleteOptions(DeleteOptions deleteOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update flow?
* @param ipConfigName the name of specified network interface ip config | ||
* @return the next stage of the update | ||
*/ | ||
Update withSpecifiedNicSpecifiedPipDeleteOption(DeleteOptions deleteOptions, PublicIpAddress publicIpAddress, String ipConfigName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`withPublicIpAddressDeleteOption(PublicIpAddress pip, DeleteOptions deleteOption)?
relate to issue#38806
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines