diff --git a/.travis.yml b/.travis.yml index 864d98c415c7..5746e3efbe9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,5 @@ jdk: - oraclejdk8 script: - - mvn compile + - mvn install -DskipTests=true + - mvn --projects runtimes,azure-mgmt-storage,azure-mgmt-network,azure-mgmt-compute checkstyle:check diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySet.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySet.java index 43c5c7a8cc0e..47d73b47acca 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySet.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySet.java @@ -1,5 +1,6 @@ package com.microsoft.azure.management.compute; +import com.microsoft.azure.CloudException; import com.microsoft.azure.management.compute.implementation.api.AvailabilitySetInner; import com.microsoft.azure.management.compute.implementation.api.InstanceViewStatus; import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource; @@ -10,10 +11,11 @@ import com.microsoft.azure.management.resources.fluentcore.model.Updatable; import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; +import java.io.IOException; import java.util.List; /** - * An immutable client-side representation of an Azure availability set. + * An immutable client-side representation of an Azure availability set. */ public interface AvailabilitySet extends GroupableResource, @@ -52,8 +54,11 @@ public interface AvailabilitySet extends * Lists the virtual machines in the availability set. * * @return list of virtual machines + * @throws CloudException exceptions thrown from the cloud + * @throws IOException exceptions thrown from serialization/deserialization + */ - List virtualMachines() throws Exception; + List virtualMachines() throws CloudException, IOException; /** * Lists the statuses of the existing virtual machines in the availability set. @@ -68,32 +73,32 @@ public interface AvailabilitySet extends **************************************************************/ /** - * Container interface for all the definitions + * Container interface for all the definitions. */ interface Definitions extends DefinitionBlank, DefinitionWithGroup, DefinitionCreatable { } - + /** - * The first stage of an availability set definition + * The first stage of an availability set definition. */ interface DefinitionBlank extends GroupableResource.DefinitionWithRegion { } /** - * The stage of the availability set definition allowing to specify the resource group + * The stage of the availability set definition allowing to specify the resource group. */ interface DefinitionWithGroup extends GroupableResource.DefinitionWithGroup { } - + /** * The stage of an availability set definition which contains all the minimum required inputs for - * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows + * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows * for any other optional settings to be specified. - */ - interface DefinitionCreatable extends + */ + interface DefinitionCreatable extends Creatable, Resource.DefinitionWithTags { /** @@ -102,7 +107,7 @@ interface DefinitionCreatable extends * @return the next stage of the resource definition */ DefinitionCreatable withUpdateDomainCount(int updateDomainCount); - + /** * Specifies the fault domain count for the availability set. * @param faultDomainCount fault domain count @@ -110,14 +115,14 @@ interface DefinitionCreatable extends */ DefinitionCreatable withFaultDomainCount(int faultDomainCount); } - + /** - * The template for an availability set update operation, containing all the settings that + * The template for an availability set update operation, containing all the settings that * can be modified. *

* Call {@link Update#apply()} to apply the changes to the resource in Azure. */ - interface Update extends + interface Update extends Appliable, Resource.UpdateWithTags { } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java index 54294e88bc21..dbe18114e8f9 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetImpl.java @@ -5,6 +5,7 @@ */ package com.microsoft.azure.management.compute.implementation; +import com.microsoft.azure.CloudException; import com.microsoft.azure.SubResource; import com.microsoft.azure.management.compute.AvailabilitySet; import com.microsoft.azure.management.compute.VirtualMachine; @@ -17,15 +18,17 @@ import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; import com.microsoft.rest.ServiceResponse; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** - * The type representing Azure availability set. + * The implementation for {@link AvailabilitySet} and its create and update interfaces. */ class AvailabilitySetImpl - extends GroupableResourceImpl + extends + GroupableResourceImpl implements AvailabilitySet, AvailabilitySet.Definitions, @@ -71,7 +74,7 @@ public List virtualMachineIds() { } @Override - public List virtualMachines() throws Exception { + public List virtualMachines() throws CloudException, IOException { if (vmsInSet == null) { vmsInSet = new ResourceLazyList<>(virtualMachineIds(), new ResourceLazyList.Loader() { @Override diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsImpl.java index 618fcb8bacdd..fbfff826c899 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsImpl.java @@ -25,9 +25,9 @@ import java.util.List; /** - * The type representing Azure Azure availability sets. + * The implementation for {@link AvailabilitySets}. */ -public class AvailabilitySetsImpl implements AvailabilitySets { +class AvailabilitySetsImpl implements AvailabilitySets { private final AvailabilitySetsInner client; private final ResourceGroups resourceGroups; private final VirtualMachines virtualMachines; @@ -99,7 +99,9 @@ public void delete(String groupName, String name) throws Exception { this.client.delete(groupName, name); } - /** Fluent model create helpers. **/ + /************************************************************** + * Fluent model helpers. + **************************************************************/ private AvailabilitySetImpl createFluentModel(String name) { AvailabilitySetInner availabilitySetInner = new AvailabilitySetInner(); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownVirtualMachineImage.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownVirtualMachineImage.java index df61b8575a0d..cdf3919634fc 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownVirtualMachineImage.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/KnownVirtualMachineImage.java @@ -6,32 +6,36 @@ * The popular Azure images. */ public enum KnownVirtualMachineImage { - /** Linux images*/ + /************************************************************** + * Linux images + **************************************************************/ - /** Ubuntu server 14.04 LTS. **/ + /** UbuntuServer 14.04LTS. */ UBUNTU_SERVER_14_04_LTS("Canonical", "UbuntuServer", "14.04.4-LTS"), - /** Ubuntu server 16.04 LTS. **/ + /** UbuntuServer 16.04LTS. */ UBUNTU_SERVER_16_04_LTS("Canonical", "UbuntuServer", "16.04.0-LTS"), - /** Debian 8. **/ + /** Debian 8. */ DEBIAN_8("credativ", "Debian", "8"), - /** OpenLogic CentOS 7.2. **/ + /** CentOS 7.2. */ CENTOS_7_2("OpenLogic", "CentOS", "7.2"), - /** OpenSUSE 42.1. **/ + /** OpenSUSE-Leap 42.1. */ OPENSUSE_LEAP_42_1("SUSE", "openSUSE-Leap", "42.1"), - /** SUSE 12-SP1. **/ + /** SLES 12-SP1. */ SLES_12_SP1("SUSE", "SLES", "12-SP1"), - /** WINDOWS images */ + /************************************************************** + * Windows images + **************************************************************/ - /** Windows Server 2008 R2 SP1. **/ + /** Windows Server 2008 R2 SP1. */ WINDOWS_SERVER_2008_R2_SP1("MicrosoftWindowsServer", "WindowsServer", "2008-R2-SP1"), - /** Windows Server 2012 data center. **/ + /** Windows Server 2012 Data center. */ WINDOWS_SERVER_2012_DATACENTER("MicrosoftWindowsServer", "WindowsServer", "2012-Datacenter"), - /** Windows Server 2012 R2 data center. **/ + /** Windows Server 2012 R2 Data center. */ WINDOWS_SERVER_2012_R2_DATACENTER("MicrosoftWindowsServer", "WindowsServer", "2012-R2-Datacenter"), - /** Windows Server 2016 technical preview with containers. **/ - WINDOWS_SERVER_2016_TECHNICAL_PREVIEW_WITH_CONTAINIERS("MicrosoftWindowsServer", "WindowsServer", "2016-Technical-Preview-with-Containers"), - /** Windows Server technical preview . **/ + /** Windows Server 2016 technical preview with container support. */ + WINDOWS_SERVER_2016_TECHNICAL_PREVIEW_WITH_CONTAINERS("MicrosoftWindowsServer", "WindowsServer", "2016-Technical-Preview-with-Containers"), + /** Windows Server 2016 technical preview. */ WINDOWS_SERVER_TECHNICAL_PREVIEW("MicrosoftWindowsServer", "WindowsServer", "Windows-Server-Technical-Preview"); private final String publisher; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java index 1b075ddbfa45..0b66a4abbcfe 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageImpl.java @@ -1,19 +1,19 @@ package com.microsoft.azure.management.compute.implementation; import com.microsoft.azure.management.compute.VirtualMachineImage; -import com.microsoft.azure.management.compute.implementation.api.VirtualMachineImageInner; -import com.microsoft.azure.management.compute.implementation.api.VirtualMachineImagesInner; +import com.microsoft.azure.management.compute.implementation.api.DataDiskImage; import com.microsoft.azure.management.compute.implementation.api.ImageReference; -import com.microsoft.azure.management.compute.implementation.api.PurchasePlan; import com.microsoft.azure.management.compute.implementation.api.OSDiskImage; -import com.microsoft.azure.management.compute.implementation.api.DataDiskImage; +import com.microsoft.azure.management.compute.implementation.api.PurchasePlan; +import com.microsoft.azure.management.compute.implementation.api.VirtualMachineImageInner; +import com.microsoft.azure.management.compute.implementation.api.VirtualMachineImagesInner; import com.microsoft.azure.management.resources.fluentcore.arm.Region; import com.microsoft.azure.management.resources.fluentcore.model.implementation.IndexableWrapperImpl; import java.util.List; /** - * Represents an Azure virtual machine image. + * The implementation for {@link VirtualMachineImage}. */ class VirtualMachineImageImpl extends IndexableWrapperImpl diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageOfferImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageOfferImpl.java index cf27184542b0..2045094971d7 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageOfferImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageOfferImpl.java @@ -10,6 +10,9 @@ import java.util.ArrayList; import java.util.List; +/** + * The implementation for {@link VirtualMachineImage.Offer}. + */ class VirtualMachineImageOfferImpl implements VirtualMachineImage.Offer { private final VirtualMachineImagesInner client; @@ -40,8 +43,8 @@ public String offer() { @Override public List listSkus() throws CloudException, IOException { List skus = new ArrayList<>(); - for (VirtualMachineImageResourceInner inner : - client.listSkus(region().toString(), publisher(), offer()).getBody()) { + for (VirtualMachineImageResourceInner inner + : client.listSkus(region().toString(), publisher(), offer()).getBody()) { skus.add(new VirtualMachineImageSkuImpl(this, inner.name(), client)); } return skus; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagePublisherImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagePublisherImpl.java index ace6ebe52992..1e20a742422d 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagePublisherImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagePublisherImpl.java @@ -11,7 +11,7 @@ import java.util.List; /** - * Represents an Azure virtual machine image publisher. + * The implementation for {@link VirtualMachineImage.Publisher}. */ class VirtualMachineImagePublisherImpl implements VirtualMachineImage.Publisher { diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageSkuImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageSkuImpl.java index a664020d91e5..755c34e9323e 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageSkuImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImageSkuImpl.java @@ -11,7 +11,7 @@ import java.util.List; /** - * Represents an Azure virtual machine image sku. + * The implementation for {@link VirtualMachineImage.Sku}. */ class VirtualMachineImageSkuImpl implements VirtualMachineImage.Sku { @@ -47,8 +47,8 @@ public String sku() { @Override public List listImages() throws CloudException, IOException { List images = new ArrayList<>(); - for (VirtualMachineImageResourceInner inner : - client.list( + for (VirtualMachineImageResourceInner inner + : client.list( region().toString(), publisher(), offer(), diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagesImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagesImpl.java index 9276259368e8..60856d2cb0e1 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagesImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineImagesImpl.java @@ -11,6 +11,9 @@ import java.util.ArrayList; import java.util.List; +/** + * The implementation for {@link VirtualMachineImages}. + */ class VirtualMachineImagesImpl implements VirtualMachineImages { private final VirtualMachineImagesInner client; @@ -22,8 +25,8 @@ class VirtualMachineImagesImpl @Override public List listPublishers(final Region region) throws CloudException, IOException { List publishers = new ArrayList<>(); - for (VirtualMachineImageResourceInner inner : - client.listPublishers(region.toString()).getBody()) { + for (VirtualMachineImageResourceInner inner + : client.listPublishers(region.toString()).getBody()) { publishers.add(new VirtualMachineImagePublisherImpl(region, inner.name(), client)); } return publishers; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineSizeImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineSizeImpl.java index 123184ff24ea..c6adb91291fb 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineSizeImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineSizeImpl.java @@ -4,7 +4,7 @@ import com.microsoft.azure.management.compute.implementation.api.VirtualMachineSizeInner; /** - * Represents an Azure virtual machine size. + * The implementation for {@link VirtualMachineSize}. */ class VirtualMachineSizeImpl implements VirtualMachineSize { private VirtualMachineSizeInner innerModel; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java index 25ca842550aa..f2c8c929a1d9 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesImpl.java @@ -34,7 +34,11 @@ import java.util.List; /** +<<<<<<< HEAD + * The implementation for {@link VirtualMachines}. +======= * The type representing Azure virtual machines. +>>>>>>> eca873299bef401bbca4c7084dc790063446e986 */ class VirtualMachinesImpl implements VirtualMachines { diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/api/VirtualMachineScaleSetsInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/api/VirtualMachineScaleSetsInner.java index 49f6ae75df64..d25ec56ec9bb 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/api/VirtualMachineScaleSetsInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/api/VirtualMachineScaleSetsInner.java @@ -6,35 +6,35 @@ package com.microsoft.azure.management.compute.implementation.api; -import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceResponseBuilder; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; -import com.microsoft.rest.serializer.CollectionFormat; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; import com.microsoft.rest.Validator; -import java.io.IOException; -import java.util.List; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; import retrofit2.http.Body; import retrofit2.http.GET; +import retrofit2.http.HTTP; import retrofit2.http.Header; import retrofit2.http.Headers; -import retrofit2.http.HTTP; -import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.PUT; +import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.http.Url; -import retrofit2.Response; + +import java.io.IOException; +import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -514,7 +514,7 @@ public ServiceResponse beginDeallocate(String resourceGroupName, String vm if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginDeallocate(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); @@ -550,7 +550,7 @@ public ServiceCall beginDeallocateAsync(String resourceGroupName, String vmScale serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginDeallocate(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); @@ -1563,7 +1563,7 @@ public ServiceResponse beginPowerOff(String resourceGroupName, String vmSc if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginPowerOff(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); @@ -1599,7 +1599,7 @@ public ServiceCall beginPowerOffAsync(String resourceGroupName, String vmScaleSe serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginPowerOff(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); @@ -1886,7 +1886,7 @@ public ServiceResponse beginRestart(String resourceGroupName, String vmSca if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginRestart(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); @@ -1922,7 +1922,7 @@ public ServiceCall beginRestartAsync(String resourceGroupName, String vmScaleSet serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginRestart(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); @@ -2209,7 +2209,7 @@ public ServiceResponse beginStart(String resourceGroupName, String vmScale if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginStart(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); @@ -2245,7 +2245,7 @@ public ServiceCall beginStartAsync(String resourceGroupName, String vmScaleSetNa serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Call call = service.beginStart(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); diff --git a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java index 2341dd5e8535..a4ccc9c6e059 100644 --- a/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java +++ b/azure-mgmt-compute/src/test/java/com/microsoft/azure/management/compute/VirtualMachineOperationsTests.java @@ -13,7 +13,14 @@ import com.microsoft.azure.management.compute.implementation.api.StorageProfile; import com.microsoft.azure.management.compute.implementation.api.VirtualHardDisk; import com.microsoft.azure.management.compute.implementation.api.VirtualMachineInner; -import com.microsoft.azure.management.network.implementation.api.*; +import com.microsoft.azure.management.network.implementation.api.AddressSpace; +import com.microsoft.azure.management.network.implementation.api.DhcpOptions; +import com.microsoft.azure.management.network.implementation.api.NetworkInterfaceIPConfiguration; +import com.microsoft.azure.management.network.implementation.api.NetworkInterfaceInner; +import com.microsoft.azure.management.network.implementation.api.PublicIPAddressDnsSettings; +import com.microsoft.azure.management.network.implementation.api.PublicIPAddressInner; +import com.microsoft.azure.management.network.implementation.api.SubnetInner; +import com.microsoft.azure.management.network.implementation.api.VirtualNetworkInner; import com.microsoft.azure.management.resources.implementation.api.ResourceGroupInner; import com.microsoft.azure.management.storage.implementation.api.AccountType; import com.microsoft.azure.management.storage.implementation.api.StorageAccountCreateParametersInner; diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Network.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Network.java index 5c6750b7ede8..ab381272f180 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Network.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Network.java @@ -18,7 +18,7 @@ import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; /** - * Virtual network + * Entry point for Virtual Network management API in Azure. */ public interface Network extends GroupableResource, @@ -33,43 +33,43 @@ public interface Network extends * @return list of address spaces associated with this virtual network, in the CIDR notation */ List addressSpaces(); - + /** * @return list of DNS server IP addresses associated with this virtual network */ List dnsServerIPs(); - + /** * @return list of subnets of this virtual network */ List subnets(); - /************************************************************** * Fluent interfaces for provisioning **************************************************************/ - /** - * The entirety of the virtual network definition. - */ - interface Definitions extends - DefinitionBlank, - DefinitionWithGroup, - DefinitionWithSubnet, - DefinitionCreatable, - DefinitionCreatableWithSubnet {} - - /** - * The first stage of a virtual network definition. - */ - interface DefinitionBlank - extends GroupableResource.DefinitionWithRegion { - } + /** + * The entirety of the virtual network definition. + */ + interface Definitions extends + DefinitionBlank, + DefinitionWithGroup, + DefinitionWithSubnet, + DefinitionCreatable, + DefinitionCreatableWithSubnet { + } + + /** + * The first stage of a virtual network definition. + */ + interface DefinitionBlank + extends GroupableResource.DefinitionWithRegion { + } /** * The stage of the virtual network definition allowing to specify the resource group. */ - interface DefinitionWithGroup + interface DefinitionWithGroup extends GroupableResource.DefinitionWithGroup { } @@ -80,10 +80,10 @@ interface DefinitionWithSubnet { /** * Explicitly adds a subnet to the virtual network. *

- * If no subnets are explicitly specified, a default subnet called "subnet1" covering the + * If no subnets are explicitly specified, a default subnet called "subnet1" covering the * entire first address space will be created. *

- * Note this method's effect is additive, i.e. each time it is used, a new subnet is added to the network. + * Note this method's effect is additive, i.e. each time it is used, a new subnet is added to the network. * @param name the name to assign to the subnet * @param cidr the address space of the subnet, within the address space of the network, using the CIDR notation * @return the next stage of the virtual network definition @@ -96,19 +96,19 @@ interface DefinitionWithSubnet { * @return the next stage of the virtual network definition */ DefinitionCreatableWithSubnet withSubnets(Map nameCidrPairs); - + Subnet.DefinitionBlank defineSubnet(String name); } /** - * The stage of the virtual network update allowing to add or remove subnets + * The stage of the virtual network update allowing to add or remove subnets. */ interface UpdateWithSubnet { /** * Explicitly adds a subnet to the virtual network. *

- * Note this method's effect is additive, i.e. each time it is used, a new subnet is added to the network. + * Note this method's effect is additive, i.e. each time it is used, a new subnet is added to the network. * @param name the name to assign to the subnet * @param cidr the address space of the subnet, within the address space of the network, using the CIDR notation * @return the next stage of the virtual network update @@ -132,23 +132,22 @@ interface UpdateWithSubnet { Update withoutSubnet(String name); } - /** * The stage of the virtual network definition which contains all the minimum required inputs for - * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows + * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows * for any other optional settings to be specified, except for adding subnets. *

- * Subnets can be added only right after the address space is explicitly specified + * Subnets can be added only right after the address space is explicitly specified * (see {@link DefinitionWithAddressSpace#withAddressSpace(String)). */ - interface DefinitionCreatable extends + interface DefinitionCreatable extends Creatable, - Resource.DefinitionWithTags { - + Resource.DefinitionWithTags { + /** * Specifies the IP address of an existing DNS server to associate with the virtual network. *

- * Note this method's effect is additive, i.e. each time it is used, a new dns server is added + * Note this method's effect is additive, i.e. each time it is used, a new dns server is added * to the network. * @param ipAddress the IP address of the DNS server * @return the next stage of the virtual network definition @@ -162,7 +161,7 @@ interface DefinitionCreatable extends * assigned to the virtual network. *

* Note that this method's effect is additive, i.e. each time it is used, a new address space is added to the network. - * This method does not check for conflicts or overlaps with other address spaces. If there is a conflict, + * This method does not check for conflicts or overlaps with other address spaces. If there is a conflict, * a cloud exception may be thrown at the time the network is created. * @param cidr the CIDR representation of the address space * @return the next stage of the virtual network definition @@ -172,21 +171,21 @@ interface DefinitionCreatable extends /** * The stage of the public IP definition which contains all the minimum required inputs for - * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows + * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows * for any other optional settings to be specified, including adding subnets. */ interface DefinitionCreatableWithSubnet extends DefinitionCreatable, DefinitionWithSubnet { } - + /** - * The template for a public IP address update operation, containing all the settings that + * The template for a public IP address update operation, containing all the settings that * can be modified. *

* Call {@link Update#apply()} to apply the changes to the resource in Azure. */ - interface Update extends + interface Update extends Appliable, Resource.UpdateWithTags, UpdateWithSubnet { @@ -194,19 +193,19 @@ interface Update extends /** * Specifies the IP address of the DNS server to associate with the virtual network. *

- * Note this method's effect is additive, i.e. each time it is used, a new dns server is + * Note this method's effect is additive, i.e. each time it is used, a new dns server is * added to the network * @param ipAddress the IP address of the DNS server * @return the next stage of the virtual network update */ Update withDnsServer(String ipAddress); - + /** * Explicitly adds an address space to the virtual network. *

* Note this method's effect is additive, i.e. each time it is used, a new address space is added to the network. *

- * This method does not check for conflicts or overlaps with other address spaces. If there is a conflict, + * This method does not check for conflicts or overlaps with other address spaces. If there is a conflict, * a cloud exception may be thrown after the update is applied. * @param cidr the CIDR representation of the address space * @return the next stage of the virtual network update diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Networks.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Networks.java index 59f6ec93df7f..9e612103d38f 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Networks.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Networks.java @@ -14,7 +14,7 @@ /** - * Entry point to virtual network management + * Entry point to virtual network management API in Azure. */ public interface Networks extends SupportsCreating, diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java index bb45a1d36570..4757257da1a7 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIpAddress.java @@ -171,7 +171,7 @@ interface UpdateWithLeafDomainLabel { Update withLeafDomainLabel(String dnsName); /** - * Ensures that no leaf domain label will be used. + * Ensures that no leaf domain label will be used. *

* This means that this public IP address will not be associated with a domain name. * @return the next stage of the resource update @@ -179,16 +179,17 @@ interface UpdateWithLeafDomainLabel { Update withoutLeafDomainLabel(); } - /** - * A public IP address definition allowing the reverse FQDN to be specified + * A public IP address definition allowing the reverse FQDN to be specified. + * + * @param the type of the inherited definition interface */ interface DefinitionWithReverseFQDN { /** * Specifies the reverse FQDN to assign to this public IP address. *

- * - * @param reverseFQDN the reverse FQDN to assign + * + * @param reverseFQDN the reverse FQDN to assign * @return the next stage of the resource definition */ T withReverseFqdn(String reverseFQDN); @@ -201,18 +202,20 @@ interface DefinitionWithReverseFQDN { } /** - * A public IP address update allowing the reverse FQDN to be specified + * A public IP address update allowing the reverse FQDN to be specified. */ interface UpdateWithReverseFQDN { /** - * Specifies the reverse FQDN to assign to this public IP address - * @param reverseFQDN the reverse FQDN to assign + * Specifies the reverse FQDN to assign to this public IP address. + * + * @param reverseFQDN the reverse FQDN to assign * @return the next stage of the resource update */ Update withReverseFqdn(String reverseFQDN); /** * Ensures that no reverse FQDN will be used. + * * @return The next stage of the resource update */ Update withoutReverseFqdn(); @@ -220,18 +223,19 @@ interface UpdateWithReverseFQDN { /** * The stage of the public IP definition which contains all the minimum required inputs for - * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows + * the resource to be created (via {@link DefinitionCreatable#create()}), but also allows * for any other optional settings to be specified. */ - interface DefinitionCreatable extends + interface DefinitionCreatable extends Creatable, DefinitionWithLeafDomainLabel, DefinitionWithIpAddress, DefinitionWithReverseFQDN, Resource.DefinitionWithTags { - + /** - * Specifies the timeout (in minutes) for an idle connection + * Specifies the timeout (in minutes) for an idle connection. + * * @param minutes the length of the time out in minutes * @return the next stage of the resource definition */ @@ -239,19 +243,20 @@ interface DefinitionCreatable extends } /** - * The template for a public IP address update operation, containing all the settings that + * The template for a public IP address update operation, containing all the settings that * can be modified. *

* Call {@link Update#apply()} to apply the changes to the resource in Azure. */ - interface Update extends + interface Update extends Appliable, UpdateWithIpAddress, UpdateWithLeafDomainLabel, UpdateWithReverseFQDN, Resource.UpdateWithTags { /** - * Specifies the timeout (in minutes) for an idle connection + * Specifies the timeout (in minutes) for an idle connection. + * * @param minutes the length of the time out in minutes * @return the next stage of the resource update */ diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java index d7d5bd17cf27..dd7a5a5d4f8c 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/Subnet.java @@ -11,27 +11,27 @@ import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; /** - * A subnet of a virtual network + * An immutable client-side representation of a subnet of a virtual network. */ -public interface Subnet extends +public interface Subnet extends Wrapper, ChildResource { - + /** * @return the address space prefix, in CIDR notation, assigned to this subnet */ String addressPrefix(); //TODO: String networkSecurityGroup(); - + /** * The entirety of a Subnet definition. * @param the return type of the final {@link DefinitionAttachable#attach()} */ - interface Definition extends + interface Definition extends DefinitionBlank, DefinitionAttachable { } - + /** * The first stage of the subnet definition. * @param the return type of the final {@link DefinitionAttachable#attach()} @@ -39,14 +39,14 @@ interface Definition extends interface DefinitionBlank { DefinitionAttachable withAddressPrefix(String cidr); } - + /** The final stage of the subnet definition. *

- * At this stage, any remaining optional settings can be specified, or the subnet definition + * At this stage, any remaining optional settings can be specified, or the subnet definition * can be attached to the parent virtual network definition using {@link DefinitionAttachable#attach()}. * @param the return type of {@link DefinitionAttachable#attach()} */ interface DefinitionAttachable extends - Attachable { //TODO: WithNSG + Attachable { //TODO: WithNSG } } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java index 08259f3c008a..6fe461cdbd44 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NetworkInterfaceImpl.java @@ -7,15 +7,20 @@ package com.microsoft.azure.management.network.implementation; import com.microsoft.azure.CloudException; -import com.microsoft.azure.management.network.*; +import com.microsoft.azure.management.network.Network; +import com.microsoft.azure.management.network.NetworkInterface; +import com.microsoft.azure.management.network.Networks; +import com.microsoft.azure.management.network.NicIpConfiguration; +import com.microsoft.azure.management.network.PublicIpAddress; +import com.microsoft.azure.management.network.PublicIpAddresses; +import com.microsoft.azure.management.network.implementation.api.NetworkInterfaceIPConfiguration; import com.microsoft.azure.management.network.implementation.api.NetworkInterfaceInner; import com.microsoft.azure.management.network.implementation.api.NetworkInterfacesInner; -import com.microsoft.azure.management.network.implementation.api.NetworkInterfaceIPConfiguration; import com.microsoft.azure.management.resources.ResourceGroup; import com.microsoft.azure.management.resources.ResourceGroups; +import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource; import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; import com.microsoft.azure.management.resources.fluentcore.model.Creatable; -import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource; import com.microsoft.azure.management.resources.fluentcore.utils.Utils; import com.microsoft.rest.ServiceResponse; @@ -46,8 +51,8 @@ class NetworkInterfaceImpl // list of references to all ip configuration private List nicIpConfigurations; // Cached related resources. - PublicIpAddress primaryPublicIp; - Network primaryNetwork; + private PublicIpAddress primaryPublicIp; + private Network primaryNetwork; NetworkInterfaceImpl(String name, NetworkInterfaceInner innerModel, @@ -172,7 +177,7 @@ public NicIpConfigurationImpl defineSecondaryIpConfiguration(String name) { public NicIpConfigurationImpl updateIpConfiguration(String name) { for (NicIpConfiguration nicIpConfiguration : this.nicIpConfigurations) { if (name.compareToIgnoreCase(nicIpConfiguration.name()) == 0) { - return (NicIpConfigurationImpl)nicIpConfiguration; + return (NicIpConfigurationImpl) nicIpConfiguration; } } throw new RuntimeException("An Ip configuration with name'" + name + "' not found"); @@ -340,7 +345,7 @@ private List dnsServerIps() { } /** - * Initializes the list of {@link NicIpConfiguration} that wraps {@link NetworkInterfaceInner#ipConfigurations()} + * Initializes the list of {@link NicIpConfiguration} that wraps {@link NetworkInterfaceInner#ipConfigurations()}. */ private void initializeNicIpConfigurations() { if (this.inner().ipConfigurations() == null) { diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java index 13151e6a1409..530456913a20 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/NicIpConfigurationImpl.java @@ -2,7 +2,12 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.SubResource; -import com.microsoft.azure.management.network.*; +import com.microsoft.azure.management.network.Network; +import com.microsoft.azure.management.network.NetworkInterface; +import com.microsoft.azure.management.network.Networks; +import com.microsoft.azure.management.network.NicIpConfiguration; +import com.microsoft.azure.management.network.PublicIpAddress; +import com.microsoft.azure.management.network.PublicIpAddresses; import com.microsoft.azure.management.network.implementation.api.NetworkInterfaceIPConfiguration; import com.microsoft.azure.management.network.implementation.api.PublicIPAddressInner; import com.microsoft.azure.management.network.implementation.api.SubnetInner; @@ -205,7 +210,7 @@ public NicIpConfigurationImpl withSubnet(String name) { protected static void ensureConfigurations(List nicIpConfigurations) { for (NicIpConfiguration nicIpConfiguration : nicIpConfigurations) { - NicIpConfigurationImpl config = (NicIpConfigurationImpl)nicIpConfiguration; + NicIpConfigurationImpl config = (NicIpConfigurationImpl) nicIpConfiguration; config.inner().withSubnet(config.subnetToAssociate()); config.inner().withPublicIPAddress(config.publicIpToAssociate()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/AzureConfigurable.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/AzureConfigurable.java index 38b79ec9da6c..fd9d8b808172 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/AzureConfigurable.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/AzureConfigurable.java @@ -9,8 +9,33 @@ import okhttp3.Interceptor; import okhttp3.logging.HttpLoggingInterceptor; +/** + * The base interface for allowing configurations to be made on the HTTP client. + * + * @param the actual type of the interface extending this interface + */ public interface AzureConfigurable> { + /** + * Set the logging level on the HTTP client. + * + * @param level the OkHttp logging level + * @return the configurable object itself + */ T withLogLevel(HttpLoggingInterceptor.Level level); + + /** + * Plug in an interceptor into the HTTP pipeline. + * + * @param interceptor the interceptor to plug in + * @return the configurable object itself + */ T withInterceptor(Interceptor interceptor); + + /** + * Specify the user agent header. + * + * @param userAgent the user agent to use + * @return the configurable object itself + */ T withUserAgent(String userAgent); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/Region.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/Region.java index e3560fa2d295..39a8a687b945 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/Region.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/Region.java @@ -10,56 +10,66 @@ * Enumeration of the Azure datacenter regions. See https://azure.microsoft.com/regions/ */ public enum Region { - US_WEST("westus", "West US"), - US_CENTRAL("centralus", "Central US"), - US_EAST("eastus", "East US"), - US_EAST2("eastus2", "East US 2"), - US_NORTH_CENTRAL("northcentralus", "North Central US"), - US_SOUTH_CENTRAL("southcentralus", "South Central US"), - EUROPE_NORTH("northeurope", "North Europe"), - EUROPE_WEST("westeurope", "West Europe"), - ASIA_EAST("eastasia", "East Asia"), - ASIA_SOUTHEAST("southeastasia", "South East Asia"), - JAPAN_EAST("japaneast", "Japan East"), - JAPAN_WEST("japanwest", "Japan West"), - BRAZIL_SOUTH("brazilsouth", "Brazil South"), - AUSTRALIA_EAST("australiaeast", "Australia East"), - AUSTRALIA_SOUTHEAST("australiasoutheast", "Australia Southeast"), - INDIA_CENTRAL("centralindia", "Central India"), - INDIA_SOUTH("southindia", "South India"), - INDIA_WEST("westindia", "West India"); - - private final String name; - public final String label; - Region(String name, String label) { - this.name = name; - this.label = label; - } - - @Override - public String toString() { - return this.name; - } - - - public static Region fromLabel(String label) { - for(Region region : Region.values()) { - if(region.label.equalsIgnoreCase(label)) { - return region; - } - } - - return null; - } + // CHECKSTYLE IGNORE Javadoc FOR NEXT 18 LINES + US_WEST("westus", "West US"), + US_CENTRAL("centralus", "Central US"), + US_EAST("eastus", "East US"), + US_EAST2("eastus2", "East US 2"), + US_NORTH_CENTRAL("northcentralus", "North Central US"), + US_SOUTH_CENTRAL("southcentralus", "South Central US"), + EUROPE_NORTH("northeurope", "North Europe"), + EUROPE_WEST("westeurope", "West Europe"), + ASIA_EAST("eastasia", "East Asia"), + ASIA_SOUTHEAST("southeastasia", "South East Asia"), + JAPAN_EAST("japaneast", "Japan East"), + JAPAN_WEST("japanwest", "Japan West"), + BRAZIL_SOUTH("brazilsouth", "Brazil South"), + AUSTRALIA_EAST("australiaeast", "Australia East"), + AUSTRALIA_SOUTHEAST("australiasoutheast", "Australia Southeast"), + INDIA_CENTRAL("centralindia", "Central India"), + INDIA_SOUTH("southindia", "South India"), + INDIA_WEST("westindia", "West India"); - - public static Region fromName(String name) { - for(Region region : Region.values()) { - if(region.name.equalsIgnoreCase(name)) { - return region; - } - } - - return null; - } + private final String name; + private final String label; + + Region(String name, String label) { + this.name = name; + this.label = label; + } + + @Override + public String toString() { + return this.name; + } + + /** + * Parses a label into a Region object. + * + * @param label the region label + * @return the parsed region or null if there's no such region + */ + public static Region fromLabel(String label) { + for (Region region : Region.values()) { + if (region.label.equalsIgnoreCase(label)) { + return region; + } + } + return null; + } + + /** + * Parses a name into a Region object. + * + * @param name the region name + * @return the parsed region or null if there's no such region + */ + public static Region fromName(String name) { + for (Region region : Region.values()) { + if (region.name.equalsIgnoreCase(name)) { + return region; + } + } + return null; + } } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/package-info.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/package-info.java new file mode 100644 index 000000000000..6dc9a0a5a6e5 --- /dev/null +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/arm/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +/** + * This package contains the common resource manager utility classes + * that are useful to other management plane libraries. + */ +package com.microsoft.azure.management.resources.fluentcore.arm; diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Appliable.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Appliable.java index 562f0c9e2972..f33c3c73e4e6 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Appliable.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Appliable.java @@ -6,6 +6,17 @@ package com.microsoft.azure.management.resources.fluentcore.model; +/** + * The base interface for all template interfaces that support update operations. + * + * @param the type of the resource returned from the update. + */ public interface Appliable extends Indexable { + /** + * Execute the update request. + * + * @return the updated resource + * @throws Exception exceptions from Azure + */ T apply() throws Exception; } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Indexable.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Indexable.java index 3d24e0434210..30915ba45d32 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Indexable.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/Indexable.java @@ -6,7 +6,12 @@ package com.microsoft.azure.management.resources.fluentcore.model; -// Encapsulates the name accessor +/** + * Base interface for all models that can be indexed by a key. + */ public interface Indexable { + /** + * @return the index key. + */ String key(); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/IndexableImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/IndexableImpl.java index 9bb6b8798520..abbc4f9a1bf8 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/IndexableImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/fluentcore/model/implementation/IndexableImpl.java @@ -8,7 +8,9 @@ import com.microsoft.azure.management.resources.fluentcore.model.Indexable; -// Base implementation for indexable entities +/** + * The base implementation for {@link Indexable}. + */ public abstract class IndexableImpl implements Indexable { protected String key; diff --git a/pom.xml b/pom.xml index 14afc37d75ef..7675133f2367 100644 --- a/pom.xml +++ b/pom.xml @@ -118,6 +118,7 @@ checkstyle.xml samedir=runtimes/build-tools/src/main/resources suppressions.xml + true diff --git a/runtimes/build-tools/src/main/resources/checkstyle.xml b/runtimes/build-tools/src/main/resources/checkstyle.xml index d156ff63e65f..1875d6f100ca 100644 --- a/runtimes/build-tools/src/main/resources/checkstyle.xml +++ b/runtimes/build-tools/src/main/resources/checkstyle.xml @@ -248,7 +248,6 @@ --> -