Skip to content

Commit

Permalink
mgmt, compute, improve javadoc (Azure#27667)
Browse files Browse the repository at this point in the history
* mgmt, compute, improve javadoc

* compute, virtualMachineSizeType as typed alias of name in VirtualMachineSize
  • Loading branch information
weidongxu-microsoft authored Mar 15, 2022
1 parent 48cb91c commit 2a2a77d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
- Supported `virtualMachineSizeType()` in `VirtualMachineSize` as a typed alias of `name`.

## 2.13.0 (2022-03-11)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ComputeResourceType resourceType() {
@Override
public VirtualMachineSizeTypes virtualMachineSizeType() {
if (this.inner.resourceType() != null
&& this.inner.resourceType().equalsIgnoreCase("virtualMachines")
&& this.inner.resourceType().equalsIgnoreCase(ComputeResourceType.VIRTUALMACHINES.toString())
&& this.inner.name() != null) {
return VirtualMachineSizeTypes.fromString(this.inner.name());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.azure.resourcemanager.compute.models.VirtualMachineSize;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineSizeInner;
import com.azure.resourcemanager.compute.models.VirtualMachineSizeTypes;
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;

/** The implementation for {@link VirtualMachineSize}. */
Expand Down Expand Up @@ -43,4 +44,13 @@ public int memoryInMB() {
public int maxDataDiskCount() {
return ResourceManagerUtils.toPrimitiveInt(innerModel.maxDataDiskCount());
}

@Override
public VirtualMachineSizeTypes virtualMachineSizeType() {
if (this.innerModel.name() != null) {
return VirtualMachineSizeTypes.fromString(this.innerModel.name());
} else {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.azure.core.annotation.Fluent;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.Region;
import com.azure.resourcemanager.authorization.models.BuiltInRole;
import com.azure.resourcemanager.compute.ComputeManager;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner;
Expand Down Expand Up @@ -1233,6 +1234,9 @@ interface WithVMSize {
/**
* Selects the size of the virtual machine.
*
* See {@link ComputeSkus#listByRegion(Region)} for virtual machine sizes in region,
* and {@link AvailabilitySet#listVirtualMachineSizes()} for virtual machine sizes in availability set.
*
* @param sizeName the name of a size for the virtual machine as text
* @return the next stage of the definition
*/
Expand All @@ -1241,6 +1245,10 @@ interface WithVMSize {
/**
* Specifies the size of the virtual machine.
*
* {@link VirtualMachineSizeTypes} is not the complete list of virtual machine sizes.
* See {@link ComputeSkus#listByRegion(Region)} for virtual machine sizes in region,
* and {@link AvailabilitySet#listVirtualMachineSizes()} for virtual machine sizes in availability set.
*
* @param size a size from the list of available sizes for the virtual machine
* @return the next stage of the definition
*/
Expand Down Expand Up @@ -2440,6 +2448,8 @@ interface Update
/**
* Specifies a new size for the virtual machine.
*
* See {@link VirtualMachine#availableSizes()} for resizing.
*
* @param sizeName the name of a size for the virtual machine as text
* @return the next stage of the update
*/
Expand All @@ -2448,6 +2458,9 @@ interface Update
/**
* Specifies a new size for the virtual machine.
*
* {@link VirtualMachineSizeTypes} is not the complete list of virtual machine sizes.
* See {@link VirtualMachine#availableSizes()} for resizing.
*
* @param size a size from the list of available sizes for the virtual machine
* @return the next stage of the definition
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ public interface VirtualMachineSize extends HasName {

/** @return the maximum number of data disks allowed by a VM size */
int maxDataDiskCount();

/**
* The virtual machine size type if the sku describes sku for virtual machine resource type.
*
* <p>The size can be used for {@link VirtualMachine.DefinitionStages.WithVMSize#withSize(VirtualMachineSizeTypes)}
* and {@link VirtualMachine.Update#withSize(VirtualMachineSizeTypes)}.
*
* @return the virtual machine size type
*/
VirtualMachineSizeTypes virtualMachineSizeType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public AvailabilitySet createResource(AvailabilitySets availabilitySets) throws
Assertions.assertTrue(TestUtilities.getSize(vmSizes) > 0);
for (VirtualMachineSize vmSize : vmSizes) {
Assertions.assertNotNull(vmSize.name());
Assertions.assertNotNull(vmSize.virtualMachineSizeType());
}
return aset;
}
Expand Down

0 comments on commit 2a2a77d

Please sign in to comment.