azure-libraries-for-java/notes/prepare-for-1.0.0.md

10 KiB

Prepare for Azure Management Libraries for Java 1.0.0

Steps to migrate code that uses Azure Management Libraries for Java from beta 5 to 1.0.0 …

If this note missed any breaking changes, please open a pull request.

App service plan adds new required parameter: operating system

To create an AppServicePlan in beta5:

appServiceManager.appServicePlans().define(APP_SERVICE_PLAN_NAME)
    .withRegion(Region.US_WEST)
    .withNewResourceGroup(RG_NAME)
    .withPricingTier(PricingTier.PREMIUM_P1)
    .create();

To create an AppServicePlan in 1.0.0:

appServiceManager.appServicePlans().define(APP_SERVICE_PLAN_NAME)
    .withRegion(Region.US_WEST)
    .withNewResourceGroup(RG_NAME)
    .withPricingTier(PricingTier.PREMIUM_P1)
    .withOperatingSystem(OperatingSystem.WINDOWS)
    .create();

Parameters for WebApp creation are re-ordered

In beta5, we create a WebApp with a new plan as following:

azure.webApps().define(app1Name)
    .withNewResourceGroup(rg1Name)
    .withNewAppServicePlan(planName)
    .withRegion(Region.US_WEST)
    .withPricingTier(AppServicePricingTier.STANDARD_S1)
    .create();

or with an existing plan as following:

azure.webApps().define(app2Name)
    .withExistingResourceGroup(rg1Name)
    .withExistingAppServicePlan(plan)
    .create();

In 1.0, there are a few breaking changes:

  • region is the first required parameter for a new app service plan
  • the app service plan is the first required parameter for an existing app service plan
  • the app service plan parameter doesn't require a name (if its name is important, define an app service plan separately in its own define() flow)
  • withNewAppServicePlan() is separated into withNewWindowsPlan() and withNewLinuxPlan() depending on the operating system of the plan. Same applies for withExistingAppServicePlan().

To create one with a new app service plan

WebApp app1 = azure.webApps()
    .define(app1Name)
    .withRegion(Region.US_WEST)
    .withNewResourceGroup(rg1Name)
    .withNewWindowsPlan(PricingTier.STANDARD_S1)
    .create();

To create one with an existing app service plan

azure.webApps()
    .define(app2Name)
    .withExistingWindowsPlan(plan)
    .withExistingResourceGroup(rg1Name)
    .create();

Change Method or Interface Names

From To Ref
VirtualMachine.extensions() VirtualMachine.getExtensions() #1466
VirtualMachine.withOsDiskCaching() VirtualMachine.withOSDiskCaching() #1598
VirtualMachine.withOsDiskSizeInGB() VirtualMachine.withOSDiskSizeInGB() #1598
VirtualMachine.withSpecializedOsUnmanagedDisk() VirtualMachine.withSpecializedOSUnmanagedDisk() #1598
VirtualMachine.withOsDiskName() VirtualMachine.withOSDiskName() #1598
VirtualMachine.withOsDiskEncryptionSettings() VirtualMachine.withOSDiskEncryptionSettings() #1598
VirtualMachine.withOsDiskStorageAccountType() VirtualMachine.withOSDiskStorageAccountType() #1598
VirtualMachine.withOsDiskVhdLocation() VirtualMachine.withOSDiskVhdLocation() #1598
VirtualMachine.withoutVmAgent() VirtualMachine.withoutVMAgent() #1549
VirtualMachine.withWinRm() VirtualMachine.withWinRM() #1549
VirtualMachineScaleSet.withWinRm() VirtualMachineScaleSet.withWinRM() #1549
VirtualMachineScaleSet.withoutVmAgent() VirtualMachineScaleSet.withoutVMAgent() #1549
VirtualMachineScaleSet.withVmAgent() VirtualMachineScaleSet.withVMAgent() #1549
VirtualMachineScaleSet.withOsDiskStorageAccountType() VirtualMachineScaleSet.withOSDiskStorageAccountType() #1598
VirtualMachineScaleSet.withOsDiskCaching() VirtualMachineScaleSet.withOSDiskCaching() #1598
VirtualMachineScaleSet.withOsDiskName() VirtualMachineScaleSet.withOSDiskName() #1598
All *ByGroup* in names All *ByResourceGroup* in names #1566
Enumeration CountryISOCode Enumeration CountryIsoCode #1558
Interface Wrapper<T> Interface HasInner<T> #1439
Any types or methods *Ip* in names Any types or methods *IP* in names #1439
Any types or methods *Mx* in names Any types or methods *MX* in names #1439
Any types or methods *Ns* in names Any types or methods *NS* in names #1439
Any types or methods *Vm* in names Any types or methods *VM* in names #1439

Change Receiving Variable Type

From To For Method Ref
Observable<Void> Completable SupportDeletingByName.deleteByNameAsync() #1388
Observable<Void> Completable SupportDeletingById.deleteByIdAsync() #1388
Observable<Void> Completable SupportDeletingByGroup.deleteByGroupAsync() #1388
List<DataDiskImage> Map<Integer, DataDiskImage> VirtualMachineImage.dataDiskImages() #1409
List<ResourceT> Map<String, ResourceT> {ResourceCollection}.create(List<Creatable<ResourceT>>)

e.g. VirtualMachines.create(List<Creatable<VirtualMachine>>)
#1381
List<String>> Set<String> AvailabilitySet.virtualMachineIds() 1558
List<String>> Set<String> NetworkSecurityGroup.networkInterfaceIds() 1439

Drop Method Usage or Use Alternate

Drop Method Use Alternate Ref
StorageAccount.withoutCustomDomain() 58eb1a5
VirtualMachine.withDataDiskUpdated() Disks can not longer be updated as part of virtual machine update. They should be updated directly via Disks API. 1579
VirtualMachineScaleSet.withDataDiskUpdated() Disks can not longer be updated as part of virtual machine scale set update. They should be updated directly via Disks API. 1579